From 69663a12bd3912fffd531e0082b5dcca6dd585ae Mon Sep 17 00:00:00 2001 From: mage2-team <mage2-team@magento.com> Date: Thu, 19 Dec 2013 11:06:04 -0800 Subject: [PATCH] 2.0.0.0-dev57 * Fixed bugs: * Fixed [MAP]: "Click for price" link is broken on the category page * Fixed tax rule search on the grid * Fixed redirect on dashboard if "Search", "Reset", "Export" buttons are clicked on several pages * Fixed switching user to alternate store-view when clicking on the Category (with Add Store Code to Urls="Yes" in the config) * Fixed printing Order/Shipping/Credit Memo from backend * Fixed 404 Error on attempt to print Shipping Label * Fixed duplication of JavaScript Resources in head on frontend * Fixed inconsistency with disabled states on Configurable product page in the Plushe theme * Fixed 3D Secure Information absence on Admin Order Info page * Fixed possibility to download or revert Backup * Fixed session fixation in user registration during checkout * Fixed fatal error during login to backend * Fixed inline translations in the Adminhtml area * Fixed partial refunds/invoices in Payflow Pro * Fixed the issue with ignoring area in design emulation * Fixed order placing with virtual product using Express Checkout * Fixed the error during order placement with Recurring profile payment * Fixed wrong redirect after customer registration during multishipping checkout * Fixed inability to crate shipping labels * Fixed inability to switch language, if the default language is English * Fixed an issue with incorrect XML appearing in cache after some actions on the frontend * Fixed product export * Fixed inability to configure memcache as session save handler * GitHub requests: * [#406](https://github.com/magento/magento2/pull/406) -- Remove cast to (int) for the varch increment_id * [#425](https://github.com/magento/magento2/issues/425) -- Installation of dev53 fails * [#324](https://github.com/magento/magento2/pull/324) -- ImportExport: Easier debugging * Modularity improvements: * Removed \Magento\App\Helper\HelperFactory * Removed the "helper" method from the abstract block interface * Layout page type config moved to library * Design loader moved to library * Theme label moved to library * Remaining part from Adminhtml moved to the appropriate modules. Adminhtml module has been eliminated * Core Session and Cookie models decomposed and moved to library * \Magento\Stdlib\Cookie library created * Session Manager and Session Config interfaces provided * Session save handler interface created * Session storage interface created, session does not extend \Magento\Object anymore * Session validator interface created * Session generic wrapper moved to library * Messages functionality moved from the Session model as separate component, message manager interface created * Sid resolver interface created to handle session sid from request --- .htaccess | 3 +- CHANGELOG.md | 49 +- app/bootstrap.php | 7 +- .../Block/Grid/Renderer/Actions.php | 21 +- .../Block/System/Messages.php | 10 +- .../Controller/Adminhtml/Notification.php | 40 +- .../AdminNotification/etc/adminhtml/menu.xml | 2 +- .../etc/adminhtml/routes.xml | 4 +- .../Magento/AdminNotification/etc/module.xml | 2 - .../Magento/Adminhtml/Block/Widget/Button.php | 38 - .../Adminhtml/Block/Widget/Container.php | 38 - .../Adminhtml/Block/Widget/Form/Container.php | 38 - .../Adminhtml/Block/Widget/Form/Element.php | 38 - .../Block/Widget/Form/Element/Dependence.php | 38 - .../Block/Widget/Form/Element/Gallery.php | 38 - .../Block/Widget/Form/Renderer/Element.php | 38 - .../Block/Widget/Form/Renderer/Fieldset.php | 38 - .../Widget/Form/Renderer/Fieldset/Element.php | 39 - .../Magento/Adminhtml/Block/Widget/Grid.php | 38 - .../Adminhtml/Block/Widget/Grid/Column.php | 38 - .../Grid/Column/Filter/AbstractFilter.php | 39 - .../Widget/Grid/Column/Filter/Checkbox.php | 39 - .../Widget/Grid/Column/Filter/Country.php | 39 - .../Block/Widget/Grid/Column/Filter/Date.php | 38 - .../Widget/Grid/Column/Filter/Datetime.php | 39 - .../Grid/Column/Filter/FilterInterface.php | 39 - .../Widget/Grid/Column/Filter/Massaction.php | 39 - .../Block/Widget/Grid/Column/Filter/Price.php | 38 - .../Block/Widget/Grid/Column/Filter/Radio.php | 38 - .../Block/Widget/Grid/Column/Filter/Range.php | 38 - .../Widget/Grid/Column/Filter/Select.php | 38 - .../Block/Widget/Grid/Column/Filter/Store.php | 38 - .../Block/Widget/Grid/Column/Filter/Text.php | 38 - .../Block/Widget/Grid/Column/Filter/Theme.php | 38 - .../Grid/Column/Renderer/AbstractRenderer.php | 39 - .../Widget/Grid/Column/Renderer/Action.php | 39 - .../Widget/Grid/Column/Renderer/Checkbox.php | 39 - .../Widget/Grid/Column/Renderer/Concat.php | 39 - .../Widget/Grid/Column/Renderer/Country.php | 39 - .../Widget/Grid/Column/Renderer/Currency.php | 39 - .../Widget/Grid/Column/Renderer/Date.php | 38 - .../Widget/Grid/Column/Renderer/Datetime.php | 39 - .../Widget/Grid/Column/Renderer/Input.php | 39 - .../Block/Widget/Grid/Column/Renderer/Ip.php | 38 - .../Widget/Grid/Column/Renderer/Longtext.php | 39 - .../Grid/Column/Renderer/Massaction.php | 39 - .../Widget/Grid/Column/Renderer/Number.php | 39 - .../Widget/Grid/Column/Renderer/Options.php | 39 - .../Widget/Grid/Column/Renderer/Price.php | 39 - .../Widget/Grid/Column/Renderer/Radio.php | 39 - .../Column/Renderer/RendererInterface.php | 39 - .../Widget/Grid/Column/Renderer/Select.php | 39 - .../Widget/Grid/Column/Renderer/Store.php | 39 - .../Widget/Grid/Column/Renderer/Text.php | 38 - .../Widget/Grid/Column/Renderer/Wrapline.php | 39 - .../Adminhtml/Block/Widget/Grid/Container.php | 38 - .../Block/Widget/Grid/Massaction.php | 38 - .../Grid/Massaction/AbstractMassaction.php | 38 - .../Block/Widget/Grid/Massaction/Item.php | 38 - .../Item/Additional/AdditionalInterface.php | 39 - .../Item/Additional/DefaultAdditional.php | 39 - .../Block/Widget/Grid/Serializer.php | 38 - .../Block/Widget/Tab/TabInterface.php | 38 - .../Adminhtml/Block/Widget/View/Container.php | 38 - app/code/Magento/Adminhtml/i18n/de_DE.csv | 1144 ---------------- app/code/Magento/Adminhtml/i18n/en_US.csv | 1162 ---------------- app/code/Magento/Adminhtml/i18n/es_ES.csv | 1144 ---------------- app/code/Magento/Adminhtml/i18n/fr_FR.csv | 1144 ---------------- app/code/Magento/Adminhtml/i18n/nl_NL.csv | 1144 ---------------- app/code/Magento/Adminhtml/i18n/pt_BR.csv | 1144 ---------------- app/code/Magento/Adminhtml/i18n/zh_CN.csv | 1163 ----------------- .../Authorizenet/Directpost/Payment.php | 12 +- .../Magento/Authorizenet/Helper/Backend.php | 21 - .../Magento/Authorizenet/Model/Directpost.php | 4 +- .../Authorizenet/Model/Directpost/Session.php | 33 +- .../Magento/Authorizenet/etc/adminhtml/di.xml | 2 +- .../Authorizenet/etc/adminhtml/routes.xml | 4 +- app/code/Magento/Authorizenet/etc/di.xml | 10 + app/code/Magento/Authorizenet/etc/module.xml | 1 - .../Magento/Backend/App/AbstractAction.php | 17 +- .../Magento/Backend/App/Action/Context.php | 14 +- .../App/Action/Plugin/Authentication.php | 22 +- .../Backend/App/Response/Http/FileFactory.php | 20 +- .../Backend/App/Router/DefaultRouter.php | 16 +- app/code/Magento/Backend/Block/Cache.php | 2 +- .../Block/Cache/Grid/Column/Statuses.php | 2 +- app/code/Magento/Backend/Block/Context.php | 45 +- .../Block/Dashboard/AbstractDashboard.php | 29 +- .../Backend/Block/Dashboard/Diagrams.php | 4 +- .../Magento/Backend/Block/Dashboard/Graph.php | 12 +- .../Magento/Backend/Block/Dashboard/Grid.php | 2 +- .../Magento/Backend/Block/Dashboard/Grids.php | 4 +- .../Backend/Block/Dashboard/Orders/Grid.php | 6 +- .../Magento/Backend/Block/Dashboard/Sales.php | 2 +- .../Backend/Block/Dashboard/Searches/Last.php | 6 +- .../Searches/Renderer/Searchquery.php | 2 +- .../Backend/Block/Dashboard/Searches/Top.php | 6 +- .../Backend/Block/Dashboard/Tab/Amounts.php | 19 +- .../Block/Dashboard/Tab/Customers/Most.php | 4 +- .../Block/Dashboard/Tab/Customers/Newest.php | 4 +- .../Backend/Block/Dashboard/Tab/Orders.php | 19 +- .../Block/Dashboard/Tab/Products/Ordered.php | 6 +- .../Block/Dashboard/Tab/Products/Viewed.php | 4 +- .../Backend/Block/Dashboard/Totals.php | 2 +- .../Magento/Backend/Block/Media/Uploader.php | 2 +- app/code/Magento/Backend/Block/Page/Head.php | 6 +- .../Block/Page/System/Config/Robots/Reset.php | 2 +- .../Backend/Block/System/Account/Edit.php | 2 +- .../Backend/Block/System/Cache/Edit.php | 4 +- .../Block/System/Config/Form/Field/Export.php | 12 +- .../Block/System/Config/Form/Fieldset.php | 10 +- .../Form/Fieldset/Modules/DisableOutput.php | 4 +- .../Backend/Block/System/Config/Tabs.php | 10 +- .../Magento/Backend/Block/System/Design.php | 2 +- .../Backend/Block/System/Design/Edit.php | 8 +- .../Backend/Block/System/Design/Edit/Tabs.php | 2 +- .../Backend/Block/System/Store/Delete.php | 2 +- .../Block/System/Store/Delete/Group.php | 6 +- .../Block/System/Store/Delete/Website.php | 6 +- .../Backend/Block/System/Store/Edit.php | 2 +- .../Block/System/Store/Edit/AbstractForm.php | 2 +- .../Block/System/Store/Grid/Render/Group.php | 2 +- .../Block/System/Store/Grid/Render/Store.php | 2 +- .../System/Store/Grid/Render/Website.php | 2 +- .../Magento/Backend/Block/System/Variable.php | 2 +- .../Backend/Block/System/Variable/Edit.php | 2 +- app/code/Magento/Backend/Block/Template.php | 2 +- .../Backend/Block/Template/Context.php | 6 - .../Block/Urlrewrite.php | 16 +- .../Urlrewrite/Catalog/Category/Edit.php | 14 +- .../Urlrewrite/Catalog/Category/Tree.php | 2 +- .../Block/Urlrewrite/Catalog/Edit/Form.php | 10 +- .../Block/Urlrewrite/Catalog/Product/Edit.php | 22 +- .../Block/Urlrewrite/Catalog/Product/Grid.php | 6 +- .../Block/Urlrewrite/Cms/Page/Edit.php | 14 +- .../Block/Urlrewrite/Cms/Page/Edit/Form.php | 8 +- .../Block/Urlrewrite/Cms/Page/Grid.php | 6 +- .../Block/Urlrewrite/Edit.php | 18 +- .../Block/Urlrewrite/Edit/Form.php | 10 +- .../Block/Urlrewrite/Link.php | 2 +- .../Block/Urlrewrite/Selector.php | 2 +- .../Magento/Backend/Block/Widget/Grid.php | 12 +- .../Backend/Block/Widget/Grid/Export.php | 44 +- .../Backend/Block/Widget/Grid/Extended.php | 36 +- .../Grid/Massaction/AbstractMassaction.php | 7 - .../Backend/Controller/Adminhtml/Auth.php | 2 +- .../Backend/Controller/Adminhtml/Cache.php | 52 +- .../Adminhtml/System/AbstractConfig.php | 2 +- .../Controller/Adminhtml/System/Account.php | 6 +- .../Adminhtml/System/Config/Save.php | 6 +- .../Controller/Adminhtml/System/Design.php | 17 +- .../Controller/Adminhtml/System/Store.php | 83 +- .../Controller/Adminhtml/System/Variable.php | 12 +- .../Controller/Adminhtml}/Urlrewrite.php | 42 +- .../Helper/Addresses.php | 2 +- .../{Adminhtml => Backend}/Helper/Js.php | 2 +- .../Helper/Media/Js.php | 2 +- .../Magento/Backend/Model/Auth/Session.php | 41 +- .../Model/Config/Backend/Admin/Robots.php | 21 +- .../Model/Config/Backend/Email/Logo.php | 13 +- .../Backend/Model/Config/Backend/File.php | 34 +- .../Model/Config/Backend/Image/Favicon.php | 22 +- .../Model/Config/Backend/Image/Logo.php | 22 +- .../Backend/Model/Config/SchemaLocator.php | 6 +- .../Model/Menu/Config/SchemaLocator.php | 2 +- app/code/Magento/Backend/Model/Menu/Item.php | 47 +- .../Backend/Model/Menu/Item/Factory.php | 22 +- app/code/Magento/Backend/Model/Session.php | 18 +- .../Model/Session/Quote.php | 38 +- .../Model/Translate/Inline/ConfigFactory.php | 27 +- app/code/Magento/Backend/Model/View.php | 4 +- app/code/Magento/Backend/etc/adminhtml/di.xml | 5 + .../Magento/Backend/etc/adminhtml/menu.xml | 44 +- app/code/Magento/Backend/etc/di.xml | 35 + app/code/Magento/Backend/etc/module.xml | 2 +- .../Backend/view/adminhtml/admin/popup.phtml | 2 +- .../view/adminhtml/email/order/items.phtml | 0 .../view/adminhtml/images/btn_bg.gif | Bin .../view/adminhtml/images/btn_on_bg.gif | Bin .../view/adminhtml/images/btn_over_bg.gif | Bin .../view/adminhtml/images/error_msg_icon.gif | Bin .../adminhtml/images/fam_bullet_error.gif | Bin .../adminhtml/images/fam_bullet_success.gif | Bin .../adminhtml/images/image-placeholder.png | Bin .../view/adminhtml/images/note_msg_icon.gif | Bin .../adminhtml/images/success_msg_icon.gif | Bin .../adminhtml/images/warning_msg_icon.gif | Bin .../layout/adminhtml_urlrewrite_index.xml | 2 +- .../Backend/view/adminhtml/layout/default.xml | 2 +- .../Backend/view/adminhtml/page/notices.phtml | 2 +- .../adminhtml/urlrewrite/categories.phtml | 2 +- .../view/adminhtml/urlrewrite/edit.phtml | 2 +- .../view/adminhtml/urlrewrite/selector.phtml | 2 +- .../view/adminhtml/widget/tabshoriz.phtml | 0 .../view/adminhtml/widget/tabsleft.phtml | 0 .../Magento/Backup/Block/Adminhtml/Backup.php | 6 +- .../Block/Adminhtml/Grid/Column/Rollback.php | 21 +- .../Backup/Controller/Adminhtml/Index.php | 46 +- app/code/Magento/Backup/Helper/Data.php | 48 +- app/code/Magento/Backup/Model/Backup.php | 85 +- .../Magento/Backup/Model/BackupFactory.php | 50 +- .../Magento/Backup/Model/Fs/Collection.php | 44 +- app/code/Magento/Backup/Model/Observer.php | 14 +- .../Magento/Backup/etc/adminhtml/menu.xml | 2 +- .../adminhtml/layout/backup_index_block.xml | 2 +- .../Catalog/Product/Edit/Tab/Bundle.php | 6 +- .../Product/Edit/Tab/Bundle/Option.php | 6 +- .../Product/Edit/Tab/Bundle/Option/Search.php | 2 +- .../Edit/Tab/Bundle/Option/Search/Grid.php | 4 +- .../Edit/Tab/Bundle/Option/Selection.php | 2 +- .../Bundle/Block/Catalog/Product/Price.php | 16 +- .../Catalog/Product/View/Type/Bundle.php | 17 + .../Product/View/Type/Bundle/Option.php | 52 +- .../Block/Checkout/Cart/Item/Renderer.php | 10 +- .../Sales/Order/Pdf/Items/Creditmemo.php | 6 +- .../Model/Sales/Order/Pdf/Items/Invoice.php | 6 +- .../Model/Sales/Order/Pdf/Items/Shipment.php | 6 +- .../Magento/Bundle/etc/adminhtml/routes.xml | 4 +- app/code/Magento/Bundle/etc/module.xml | 1 - .../mysql4-upgrade-1.6.0.0-1.6.0.0.1.php | 13 +- .../Magento/Captcha/Helper/Adminhtml/Data.php | 4 +- app/code/Magento/Captcha/Helper/Data.php | 30 +- app/code/Magento/Captcha/Model/Cron.php | 17 +- .../Magento/Captcha/Model/DefaultModel.php | 6 +- app/code/Magento/Captcha/Model/Observer.php | 26 +- .../Magento/Captcha/etc/adminhtml/routes.xml | 4 +- .../Catalog/Block/Adminhtml/Category/Edit.php | 2 +- .../Block/Adminhtml/Category/Edit/Form.php | 8 +- .../Block/Adminhtml/Category/Tab/Product.php | 6 +- .../Catalog/Block/Adminhtml/Category/Tabs.php | 2 +- .../Catalog/Block/Adminhtml/Category/Tree.php | 4 +- .../Magento/Catalog/Block/Adminhtml/Form.php | 4 +- .../Form/Renderer/Fieldset/Element.php | 2 +- .../Block/Adminhtml/Helper/Form/Wysiwyg.php | 2 +- .../Catalog/Block/Adminhtml/Product.php | 2 +- .../Block/Adminhtml/Product/Attribute.php | 2 +- .../Product/Attribute/Edit/Tab/Front.php | 2 +- .../Adminhtml/Product/Attribute/Edit/Tabs.php | 2 +- .../Adminhtml/Product/Attribute/Grid.php | 4 +- .../Adminhtml/Product/Attribute/Set/Main.php | 14 +- .../Attribute/Set/Main/Formattribute.php | 2 +- .../Product/Attribute/Set/Main/Formgroup.php | 2 +- .../Product/Attribute/Set/Toolbar/Add.php | 4 +- .../Product/Attribute/Set/Toolbar/Main.php | 2 +- .../Adminhtml/Product/Composite/Configure.php | 2 +- .../Product/Composite/Fieldset/Grouped.php | 36 +- .../Product/Composite/Update/Result.php | 6 +- .../Block/Adminhtml/Product/Created.php | 4 +- .../Catalog/Block/Adminhtml/Product/Edit.php | 18 +- .../Product/Edit/Action/Attribute.php | 12 +- .../Edit/Action/Attribute/Tab/Attributes.php | 10 +- .../Edit/Action/Attribute/Tab/Inventory.php | 4 +- .../Edit/Action/Attribute/Tab/Websites.php | 4 +- .../Product/Edit/Action/Attribute/Tabs.php | 2 +- .../Adminhtml/Product/Edit/Tab/Alerts.php | 4 +- .../Product/Edit/Tab/Alerts/Price.php | 6 +- .../Product/Edit/Tab/Alerts/Stock.php | 6 +- .../Adminhtml/Product/Edit/Tab/Crosssell.php | 12 +- .../Adminhtml/Product/Edit/Tab/Inventory.php | 2 +- .../Adminhtml/Product/Edit/Tab/Options.php | 6 +- .../Product/Edit/Tab/Options/Option.php | 2 +- .../Edit/Tab/Options/Type/AbstractType.php | 2 +- .../Product/Edit/Tab/Options/Type/Select.php | 4 +- .../Product/Edit/Tab/Price/Group.php | 2 +- .../Edit/Tab/Price/Group/AbstractGroup.php | 2 +- .../Adminhtml/Product/Edit/Tab/Price/Tier.php | 2 +- .../Adminhtml/Product/Edit/Tab/Related.php | 12 +- .../Product/Edit/Tab/Super/Config.php | 2 +- .../Super/Config/Grid/Filter/Inventory.php | 2 +- .../Super/Config/Grid/Renderer/Checkbox.php | 2 +- .../Super/Config/Grid/Renderer/Inventory.php | 2 +- .../Product/Edit/Tab/Super/Settings.php | 10 +- .../Adminhtml/Product/Edit/Tab/Upsell.php | 12 +- .../Catalog/Block/Adminhtml/Product/Grid.php | 6 +- .../Adminhtml/Product/Widget/Chooser.php | 12 +- .../Catalog/Block/Adminhtml/Search.php | 2 +- .../Catalog/Block/Adminhtml/Search/Edit.php | 2 +- .../Config/Form/Field/Select/Flatcatalog.php | 21 +- .../Config/Form/Field/Select/Flatproduct.php | 21 +- .../Magento/Catalog/Block/Category/View.php | 10 +- .../Catalog/Block/Product/AbstractProduct.php | 62 +- .../Block/Product/Compare/AbstractCompare.php | 32 +- .../Block/Product/Compare/ListCompare.php | 32 +- .../AssociatedSelector/Renderer/Id.php | 22 +- .../Magento/Catalog/Block/Product/Gallery.php | 3 +- .../Catalog/Block/Product/ListProduct.php | 27 +- .../Catalog/Block/Product/NewProduct.php | 27 +- .../Magento/Catalog/Block/Product/Price.php | 10 +- .../Block/Product/ProductList/Promotion.php | 17 + .../Block/Product/ProductList/Random.php | 17 + .../Block/Product/ProductList/Related.php | 27 +- .../Block/Product/ProductList/Upsell.php | 27 +- .../Magento/Catalog/Block/Product/Send.php | 27 +- .../Magento/Catalog/Block/Product/View.php | 43 +- .../Block/Product/View/AbstractView.php | 27 +- .../Product/View/Options/AbstractOptions.php | 18 +- .../Block/Product/View/Options/Type/Date.php | 4 +- .../Product/View/Options/Type/Select.php | 25 +- .../Block/Product/View/Type/Configurable.php | 36 +- .../Catalog/Controller/Adminhtml/Category.php | 13 +- .../Catalog/Controller/Adminhtml/Product.php | 46 +- .../Adminhtml/Product/Action/Attribute.php | 18 +- .../Adminhtml/Product/Attribute.php | 52 +- .../Controller/Adminhtml/Product/Gallery.php | 7 +- .../Controller/Adminhtml/Product/Group.php | 6 +- .../Controller/Adminhtml/Product/Review.php | 61 +- .../Controller/Adminhtml/Product/Set.php | 14 +- .../Catalog/Controller/Adminhtml/Search.php | 27 +- .../Magento/Catalog/Controller/Category.php | 2 +- .../Catalog/Controller/Product/Compare.php | 10 +- app/code/Magento/Catalog/Helper/Data.php | 15 +- .../Helper/Product/ConfigurationPool.php | 5 +- .../Catalog/Helper/Product/Options.php | 8 +- .../Magento/Catalog/Helper/Product/View.php | 24 +- .../Category/Attribute/Backend/Image.php | 14 +- app/code/Magento/Catalog/Model/Product.php | 18 +- .../Model/Product/Attribute/Backend/Media.php | 88 +- .../Magento/Catalog/Model/Product/Image.php | 77 +- .../Catalog/Model/Product/Media/Config.php | 140 +- .../Model/Product/Option/Type/File.php | 162 +-- .../Model/Product/Type/AbstractType.php | 8 +- .../ProductOptions/Config/SchemaLocator.php | 4 +- .../ProductTypes/Config/SchemaLocator.php | 4 +- .../Resource/Category/Indexer/Product.php | 30 +- .../Product/Attribute/Backend/Image.php | 15 +- .../Model/Resource/Product/Collection.php | 18 +- app/code/Magento/Catalog/Model/Session.php | 32 +- .../Magento/Catalog/etc/adminhtml/menu.xml | 6 +- app/code/Magento/Catalog/etc/di.xml | 27 +- app/code/Magento/Catalog/etc/module.xml | 1 - .../mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php | 13 +- .../layout/catalog_product_crosssell.xml | 2 +- .../layout/catalog_product_related.xml | 2 +- .../layout/catalog_product_upsell.xml | 2 +- .../view/adminhtml/product/product.css | 2 +- .../Catalog/view/frontend/js/configurable.js | 5 +- .../view/frontend/product/price_msrp.phtml | 2 + .../view/type/options/configurable.phtml | 2 +- .../Block/Adminhtml/Promo/Catalog/Edit.php | 2 +- .../Adminhtml/Promo/Catalog/Edit/Tabs.php | 2 +- .../Block/Adminhtml/Promo/Widget/Chooser.php | 8 +- .../Adminhtml/Promo/Widget/Chooser/Sku.php | 4 +- .../Controller/Adminhtml/Promo/Catalog.php | 42 +- .../Magento/CatalogRule/Model/Observer.php | 18 +- .../CatalogRule/etc/adminhtml/menu.xml | 2 +- .../CatalogSearch/Block/Autocomplete.php | 23 +- .../Magento/CatalogSearch/Block/Result.php | 6 +- .../CatalogSearch/Controller/Advanced.php | 12 +- .../CatalogSearch/Controller/Result.php | 3 +- .../Magento/CatalogSearch/Controller/Term.php | 4 +- .../CatalogSearch/Model/Fulltext/Observer.php | 12 +- .../CatalogSearch/etc/adminhtml/di.xml | 9 +- .../CatalogSearch/etc/adminhtml/menu.xml | 2 +- .../Magento/CatalogSearch/etc/frontend/di.xml | 9 +- app/code/Magento/CatalogSearch/etc/module.xml | 1 - .../Magento/Centinel/Model/AbstractState.php | 2 +- app/code/Magento/Centinel/Model/Service.php | 10 +- .../Magento/Centinel/etc/adminhtml/di.xml | 9 +- .../Magento/Centinel/etc/adminhtml/routes.xml | 4 +- app/code/Magento/Centinel/etc/frontend/di.xml | 9 +- .../Checkout/Block/Adminhtml/Agreement.php | 2 +- .../Block/Adminhtml/Agreement/Edit.php | 2 +- .../Block/Adminhtml/Agreement/Edit/Form.php | 2 +- .../Block/Adminhtml/Agreement/Grid.php | 6 +- app/code/Magento/Checkout/Block/Cart.php | 10 +- .../Magento/Checkout/Block/Cart/Crosssell.php | 25 +- .../Checkout/Block/Cart/Item/Renderer.php | 55 +- .../Block/Cart/Item/Renderer/Configurable.php | 2 +- .../Block/Cart/Item/Renderer/Grouped.php | 6 +- app/code/Magento/Checkout/Block/Cart/Link.php | 10 +- .../Magento/Checkout/Block/Cart/Shipping.php | 10 +- .../Magento/Checkout/Block/Cart/Sidebar.php | 22 +- app/code/Magento/Checkout/Block/Link.php | 10 +- .../Checkout/Block/Multishipping/Billing.php | 4 +- .../Checkout/Block/Multishipping/Overview.php | 10 +- .../Checkout/Block/Multishipping/Shipping.php | 10 +- .../Magento/Checkout/Block/Onepage/Link.php | 10 +- .../Magento/Checkout/Block/Onepage/Login.php | 10 +- .../Block/Onepage/Payment/Methods.php | 4 +- .../Magento/Checkout/Controller/Action.php | 2 +- .../Controller/Adminhtml/Agreement.php | 23 +- app/code/Magento/Checkout/Controller/Cart.php | 80 +- .../Checkout/Controller/Multishipping.php | 62 +- .../Controller/Multishipping/Address.php | 13 +- .../Magento/Checkout/Controller/Onepage.php | 13 +- app/code/Magento/Checkout/Model/Cart.php | 41 +- app/code/Magento/Checkout/Model/Observer.php | 26 +- app/code/Magento/Checkout/Model/Session.php | 135 +- .../Magento/Checkout/Model/Type/Onepage.php | 12 +- .../Magento/Checkout/etc/adminhtml/menu.xml | 2 +- app/code/Magento/Checkout/etc/di.xml | 10 + .../Magento/Checkout/etc/email_templates.xml | 2 +- .../Magento/Cms/Block/Adminhtml/Block.php | 2 +- .../Cms/Block/Adminhtml/Block/Edit.php | 2 +- .../Block/Adminhtml/Block/Widget/Chooser.php | 10 +- app/code/Magento/Cms/Block/Adminhtml/Page.php | 2 +- .../Magento/Cms/Block/Adminhtml/Page/Edit.php | 2 +- .../Block/Adminhtml/Page/Edit/Tab/Content.php | 2 +- .../Cms/Block/Adminhtml/Page/Edit/Tabs.php | 2 +- .../Magento/Cms/Block/Adminhtml/Page/Grid.php | 6 +- .../Adminhtml/Page/Grid/Renderer/Action.php | 20 +- .../Block/Adminhtml/Page/Widget/Chooser.php | 10 +- .../Adminhtml/Wysiwyg/Images/Content.php | 2 +- .../Block/Adminhtml/Wysiwyg/Images/Tree.php | 4 +- .../Cms/Controller/Adminhtml/Block.php | 20 +- .../Magento/Cms/Controller/Adminhtml/Page.php | 24 +- .../Controller/Adminhtml/Wysiwyg/Images.php | 12 +- app/code/Magento/Cms/Helper/Page.php | 24 +- .../Magento/Cms/Helper/Wysiwyg/Images.php | 83 +- .../Cms/Model/Wysiwyg/Images/Storage.php | 99 +- .../Wysiwyg/Images/Storage/Collection.php | 6 +- app/code/Magento/Cms/etc/adminhtml/menu.xml | 4 +- app/code/Magento/Cms/etc/module.xml | 2 - .../Block/Adminhtml/Extension/Custom/Edit.php | 2 +- .../Extension/Custom/Edit/Tab/AbstractTab.php | 6 +- .../Extension/Custom/Edit/Tab/Authors.php | 2 +- .../Extension/Custom/Edit/Tab/Grid.php | 6 +- .../Adminhtml/Extension/Custom/Edit/Tabs.php | 2 +- .../Controller/Adminhtml/Extension/Custom.php | 16 +- app/code/Magento/Connect/Helper/Data.php | 59 +- app/code/Magento/Connect/Model/Extension.php | 93 +- .../Connect/Model/Extension/Collection.php | 40 +- app/code/Magento/Connect/Model/Session.php | 27 +- .../Magento/Connect/etc/adminhtml/menu.xml | 2 +- .../Magento/Connect/etc/adminhtml/routes.xml | 4 +- .../etc/di.xml} | 27 +- app/code/Magento/Connect/etc/module.xml | 1 - .../Magento/Contacts/Controller/Index.php | 12 +- .../Magento/Contacts/etc/email_templates.xml | 2 +- .../Core/App/Action/Plugin/Install.php | 5 +- .../Core/App/Action/Plugin/Session.php | 12 +- .../Plugin/DispatchExceptionHandler.php | 19 +- app/code/Magento/Core/App/Media.php | 26 +- .../Magento/Core/App/Response/Redirect.php | 6 +- app/code/Magento/Core/App/Router/Base.php | 6 +- app/code/Magento/Core/Controller/Index.php | 2 +- app/code/Magento/Core/Helper/File/Media.php | 20 +- .../Core/Helper/File/Storage/Database.php | 23 +- app/code/Magento/Core/Helper/Js.php | 10 +- app/code/Magento/Core/Helper/Theme.php | 44 +- app/code/Magento/Core/Helper/Translate.php | 11 +- app/code/Magento/Core/Model/AbstractModel.php | 2 +- app/code/Magento/Core/Model/AbstractShell.php | 34 +- app/code/Magento/Core/Model/App.php | 9 +- app/code/Magento/Core/Model/App/Emulation.php | 2 +- .../Model/Asset/Plugin/CleanMergedJsCss.php | 15 +- .../Core/Model/Config/FileResolver.php | 29 +- .../Core/Model/Config/Initial/Reader.php | 9 +- .../Core/Model/DataService/Config/Reader.php | 4 +- .../DataService/Config/Reader/Factory.php | 2 +- app/code/Magento/Core/Model/File/Storage.php | 16 +- .../Core/Model/File/Storage/Config.php | 45 +- .../Magento/Core/Model/File/Storage/File.php | 2 +- .../Core/Model/File/Storage/Request.php | 2 +- .../Model/File/Storage/Synchronization.php | 42 +- .../Model/File/Validator/AvailablePath.php | 18 +- app/code/Magento/Core/Model/Input/Filter.php | 15 +- app/code/Magento/Core/Model/Layout.php | 71 +- app/code/Magento/Core/Model/Layout/Merge.php | 19 +- .../Core/Model/Layout/Update/Validator.php | 4 +- .../Locale/Hierarchy/Config/FileResolver.php | 33 +- .../Locale/Hierarchy/Config/SchemaLocator.php | 2 +- app/code/Magento/Core/Model/Observer.php | 3 +- .../Core/Model/Resource/File/Storage/File.php | 90 +- .../Magento/Core/Model/Resource/Setup.php | 54 +- .../Core/Model/Resource/Setup/Context.php | 22 +- .../Core/Model/Resource/Setup/Migration.php | 28 +- .../Core/Model/Resource/Type/Db/Pdo/Mysql.php | 19 +- app/code/Magento/Core/Model/Session.php | 21 +- .../Core/Model/Session/AbstractSession.php | 715 ---------- .../Magento/Core/Model/Session/Config.php | 63 +- .../Magento/Core/Model/Session/Context.php | 199 --- app/code/Magento/Core/Model/Session/Pool.php | 12 +- .../Core/Model/Session/SidResolver.php | 16 +- .../Magento/Core/Model/Session/Validator.php | 13 +- app/code/Magento/Core/Model/Store.php | 38 +- app/code/Magento/Core/Model/StoreManager.php | 18 +- app/code/Magento/Core/Model/Theme.php | 8 +- .../Magento/Core/Model/Theme/Collection.php | 85 +- .../Magento/Core/Model/Theme/Image/Path.php | 21 +- .../Magento/Core/Model/Theme/Registration.php | 27 +- app/code/Magento/Core/Model/Translate.php | 36 +- .../Magento/Core/Model/Translate/Factory.php | 2 +- .../Magento/Core/Model/Translate/Inline.php | 8 + .../Model/Translate/Inline/ConfigFactory.php | 3 +- app/code/Magento/Core/Model/Url/Rewrite.php | 2 +- app/code/Magento/Core/Model/View/Design.php | 2 +- app/code/Magento/Core/etc/config.xml | 125 +- app/code/Magento/Core/etc/di.xml | 40 +- app/code/Magento/Core/etc/module.xml | 1 - .../Block/Adminhtml/System/Currency.php | 6 +- .../Block/Adminhtml/System/Currencysymbol.php | 2 +- .../Controller/Adminhtml/System/Currency.php | 16 +- .../Adminhtml/System/Currencysymbol.php | 6 +- .../CurrencySymbol/etc/adminhtml/menu.xml | 4 +- .../CurrencySymbol/etc/adminhtml/routes.xml | 4 +- .../Magento/CurrencySymbol/etc/module.xml | 1 - .../Block/Account/AuthorizationLink.php | 13 +- .../Customer/Block/Account/Customer.php | 10 +- .../Magento/Customer/Block/Account/Link.php | 21 +- .../Customer/Block/Account/RegisterLink.php | 10 +- .../Customer/Block/Adminhtml/Customer.php | 2 +- .../Magento/Customer/Block/Adminhtml/Edit.php | 2 +- .../Edit/Renderer/Attribute/Group.php | 2 +- .../Block/Adminhtml/Edit/Renderer/Region.php | 21 +- .../Block/Adminhtml/Edit/Tab/Account.php | 14 +- .../Block/Adminhtml/Edit/Tab/Addresses.php | 30 +- .../Block/Adminhtml/Edit/Tab/Cart.php | 6 +- .../Adminhtml/Edit/Tab/Newsletter/Grid.php | 6 +- .../Tab/Newsletter/Grid/Filter/Status.php | 2 +- .../Tab/Newsletter/Grid/Renderer/Action.php | 2 +- .../Tab/Newsletter/Grid/Renderer/Status.php | 2 +- .../Block/Adminhtml/Edit/Tab/Orders.php | 6 +- .../Block/Adminhtml/Edit/Tab/View.php | 2 +- .../Adminhtml/Edit/Tab/View/Accordion.php | 2 +- .../Block/Adminhtml/Edit/Tab/View/Cart.php | 6 +- .../Edit/Tab/View/Grid/Renderer/Item.php | 32 +- .../Block/Adminhtml/Edit/Tab/View/Orders.php | 6 +- .../Adminhtml/Edit/Tab/View/Wishlist.php | 6 +- .../Wishlist/Grid/Renderer/Description.php | 2 +- .../Magento/Customer/Block/Adminhtml/Grid.php | 16 +- .../Block/Adminhtml/Grid/Filter/Country.php | 24 +- .../Adminhtml/Grid/Renderer/Multiaction.php | 2 +- .../Customer/Block/Adminhtml/Group.php | 2 +- .../Customer/Block/Adminhtml/Group/Edit.php | 2 +- .../Adminhtml/Online/Grid/Renderer/Ip.php | 2 +- .../Adminhtml/Online/Grid/Renderer/Type.php | 2 +- .../Adminhtml/Online/Grid/Renderer/Url.php | 2 +- .../Sales/Order/Address/Form/Renderer/Vat.php | 8 +- .../Magento/Customer/Block/Form/Login.php | 14 +- .../Magento/Customer/Block/Form/Register.php | 24 +- .../Customer/Block/Widget/AbstractWidget.php | 10 +- .../Magento/Customer/Block/Widget/Gender.php | 4 +- .../Magento/Customer/Block/Widget/Name.php | 27 +- .../Magento/Customer/Block/Widget/Taxvat.php | 4 +- .../Magento/Customer/Controller/Account.php | 143 +- .../Magento/Customer/Controller/Address.php | 27 +- .../Adminhtml/Cart/Product/Composite/Cart.php | 6 +- .../Customer/Controller/Adminhtml/Group.php | 24 +- .../Customer/Controller/Adminhtml/Index.php | 88 +- .../Wishlist/Product/Composite/Wishlist.php | 4 +- app/code/Magento/Customer/Model/Session.php | 66 +- .../Customer/Model/Session/Storage.php | 51 + .../Magento/Customer/etc/adminhtml/menu.xml | 2 +- app/code/Magento/Customer/etc/di.xml | 3 + .../Magento/Customer/etc/email_templates.xml | 12 +- .../Adminhtml/Editor/Toolbar/Buttons.php | 21 +- .../Adminhtml/Editor/Tools/Code/Css/Group.php | 21 +- .../Block/Adminhtml/Editor/Tools/Code/Js.php | 10 +- .../Adminhtml/Editor/Tools/Files/Content.php | 4 +- .../Editor/Tools/Files/Content/Files.php | 21 +- .../Adminhtml/Editor/Tools/Files/Tree.php | 2 +- .../DesignEditor/Block/Adminhtml/Theme.php | 21 +- .../Adminhtml/Theme/Selector/StoreView.php | 10 +- .../Adminhtml/System/Design/Editor.php | 14 +- .../Adminhtml/System/Design/Editor/Tools.php | 2 +- .../Model/Config/Control/ImageSizing.php | 11 +- .../Model/Config/Control/QuickStyles.php | 12 +- .../Editor/Tools/Controls/Configuration.php | 3 +- .../Model/Editor/Tools/Controls/Factory.php | 27 +- .../Tools/QuickStyles/ImageUploader.php | 17 +- .../etc/adminhtml/di.xml} | 12 +- .../DesignEditor/etc/adminhtml/menu.xml | 2 +- .../DesignEditor/etc/adminhtml/routes.xml | 4 +- .../Adminhtml/Frontend/Region/Updater.php | 21 +- .../Magento/Directory/etc/email_templates.xml | 2 +- .../Catalog/Product/Edit/Tab/Downloadable.php | 4 +- .../Product/Edit/Tab/Downloadable/Links.php | 74 +- .../Product/Edit/Tab/Downloadable/Samples.php | 37 +- .../Block/Catalog/Product/Links.php | 32 +- .../Block/Checkout/Cart/Item/Renderer.php | 10 +- .../Adminhtml/Downloadable/File.php | 33 +- .../Adminhtml/Downloadable/Product/Edit.php | 2 +- .../Downloadable/Controller/Customer.php | 4 +- .../Downloadable/Controller/Download.php | 18 +- .../Magento/Downloadable/Helper/Download.php | 139 +- app/code/Magento/Downloadable/Helper/File.php | 102 +- app/code/Magento/Downloadable/Model/Link.php | 27 +- .../Downloadable/Model/Product/Type.php | 2 +- .../Sales/Order/Pdf/Items/AbstractItems.php | 6 +- .../Sales/Order/Pdf/Items/Creditmemo.php | 6 +- .../Model/Sales/Order/Pdf/Items/Invoice.php | 6 +- .../Magento/Downloadable/Model/Sample.php | 24 +- .../Downloadable/etc/adminhtml/routes.xml | 4 +- app/code/Magento/Downloadable/etc/module.xml | 1 - .../mysql4-upgrade-1.6.0.0.1-1.6.0.0.2.php | 16 +- .../Adminhtml/Attribute/Grid/AbstractGrid.php | 2 +- .../Magento/Eav/Model/Attribute/Data/File.php | 21 +- .../Entity/Attribute/Config/SchemaLocator.php | 2 +- app/code/Magento/Eav/etc/module.xml | 1 - .../Email/Block/Adminhtml/Template/Edit.php | 30 +- .../Block/Adminhtml/Template/Edit/Form.php | 4 +- .../Adminhtml/Template/Grid/Filter/Type.php | 2 +- .../Template/Grid/Renderer/Action.php | 2 +- .../Template/Grid/Renderer/Sender.php | 2 +- .../Adminhtml/Template/Grid/Renderer/Type.php | 2 +- .../Block/Adminhtml/Template/Preview.php | 2 +- .../Controller/Adminhtml/Email/Template.php | 18 +- .../Magento/Email/Model/BackendTemplate.php | 5 +- app/code/Magento/Email/Model/Template.php | 15 +- .../Model/Template/Config/FileIterator.php | 72 + .../Model/Template/Config/FileResolver.php | 65 + .../Email/Model/Template/Config/Reader.php | 24 - app/code/Magento/Email/etc/adminhtml/menu.xml | 2 +- .../Magento/Email/etc/adminhtml/routes.xml | 4 +- app/code/Magento/Email/etc/di.xml | 3 + .../Magento/Email/etc/email_templates.xsd | 26 +- app/code/Magento/Email/etc/module.xml | 4 + .../Email/sql/email_setup/install-1.0.0.0.php | 6 +- .../Adminhtml/Sales/Order/Create/Form.php | 16 +- .../Adminhtml/Sales/Order/Create/Items.php | 23 +- .../Adminhtml/Sales/Order/View/Items.php | 21 +- .../GiftMessage/Block/Message/Inline.php | 14 +- app/code/Magento/GiftMessage/Model/Save.php | 6 +- app/code/Magento/GiftMessage/etc/module.xml | 1 - .../Block/Adminhtml/Shipping/Merchant.php | 4 +- .../GoogleCheckout/Controller/Redirect.php | 2 +- .../Model/Api/Xml/AbstractXml.php | 10 +- .../Magento/GoogleCheckout/etc/module.xml | 1 - .../Block/Adminhtml/Captcha.php | 2 +- .../GoogleShopping/Block/Adminhtml/Items.php | 2 +- .../Block/Adminhtml/Items/Item.php | 4 +- .../Block/Adminhtml/Items/Product.php | 4 +- .../Block/Adminhtml/Types/Edit.php | 2 +- .../Block/Adminhtml/Types/Edit/Attributes.php | 6 +- .../Adminhtml/Googleshopping/Items.php | 16 +- .../Adminhtml/Googleshopping/Types.php | 25 +- .../Magento/GoogleShopping/Model/Observer.php | 24 +- .../GoogleShopping/etc/adminhtml/di.xml | 2 +- .../GoogleShopping/etc/adminhtml/routes.xml | 4 +- .../Magento/GoogleShopping/etc/module.xml | 1 - .../Block/Adminhtml/Export/Filter.php | 6 +- .../Block/Adminhtml/Import/Edit.php | 2 +- .../Controller/Adminhtml/Export.php | 10 +- .../Controller/Adminhtml/Import.php | 9 +- .../ImportExport/Model/AbstractModel.php | 26 +- .../Magento/ImportExport/Model/Export.php | 6 +- .../Model/Export/Adapter/AbstractAdapter.php | 24 +- .../ImportExport/Model/Export/Adapter/Csv.php | 14 +- .../Model/Export/Config/SchemaLocator.php | 4 +- .../Magento/ImportExport/Model/Import.php | 39 +- .../ImportExport/Model/Import/Adapter.php | 10 +- .../Model/Import/Config/SchemaLocator.php | 4 +- .../Model/Import/Entity/Product.php | 55 +- .../ImportExport/Model/Import/Source/Csv.php | 24 +- .../ImportExport/Model/Import/Uploader.php | 21 +- .../ImportExport/etc/adminhtml/menu.xml | 4 +- .../ImportExport/etc/adminhtml/routes.xml | 4 +- app/code/Magento/ImportExport/etc/module.xml | 1 - app/code/Magento/Index/App/Indexer.php | 15 +- .../Magento/Index/Block/Adminhtml/Process.php | 2 +- .../Index/Block/Adminhtml/Process/Edit.php | 2 +- .../Block/Adminhtml/Process/Edit/Tabs.php | 2 +- .../Index/Block/Adminhtml/Process/Grid.php | 12 +- .../Adminhtml/Process/Grid/Massaction.php | 2 +- .../Index/Controller/Adminhtml/Process.php | 34 +- .../Model/Indexer/Config/SchemaLocator.php | 6 +- app/code/Magento/Index/Model/Lock/Storage.php | 34 +- app/code/Magento/Index/Model/Process/File.php | 67 +- app/code/Magento/Index/Model/Shell.php | 6 +- app/code/Magento/Index/etc/adminhtml/menu.xml | 2 +- .../Magento/Index/etc/adminhtml/routes.xml | 4 +- app/code/Magento/Index/etc/module.xml | 1 - .../Magento/Install/App/Action/Plugin/Dir.php | 45 +- app/code/Magento/Install/App/Console.php | 34 +- .../Magento/Install/Block/AbstractBlock.php | 6 +- app/code/Magento/Install/Block/Begin.php | 8 +- app/code/Magento/Install/Block/Config.php | 4 +- app/code/Magento/Install/Block/Db/Main.php | 6 +- app/code/Magento/Install/Block/Db/Type.php | 6 +- app/code/Magento/Install/Block/Download.php | 10 +- app/code/Magento/Install/Block/End.php | 4 +- app/code/Magento/Install/Block/Locale.php | 41 +- app/code/Magento/Install/Block/State.php | 7 + .../Magento/Install/Controller/Wizard.php | 39 +- app/code/Magento/Install/Model/Config.php | 24 +- app/code/Magento/Install/Model/Installer.php | 10 +- .../Install/Model/Installer/Config.php | 99 +- .../Install/Model/Installer/Console.php | 29 +- .../Install/Model/Installer/Filesystem.php | 64 +- .../Magento/Install/Model/Installer/Pear.php | 18 +- app/code/Magento/Install/Model/Observer.php | 6 +- app/code/Magento/Install/Model/Wizard.php | 4 +- app/code/Magento/Install/etc/di.xml | 14 +- app/code/Magento/Install/etc/frontend/di.xml | 9 +- app/code/Magento/Install/etc/module.xml | 1 - .../Integration/Activate/Permissions/Tabs.php | 2 +- .../Block/Adminhtml/Integration/Edit.php | 16 +- .../Block/Adminhtml/Integration/Edit/Form.php | 2 +- .../Adminhtml/Integration/Edit/Tab/Info.php | 13 + .../Block/Adminhtml/Integration/Edit/Tabs.php | 2 +- .../Widget/Grid/Column/Renderer/Link.php | 21 +- .../Grid/Column/Renderer/Link/Activate.php | 14 +- .../Controller/Adminhtml/Integration.php | 188 ++- .../Magento/Integration/Controller/Token.php | 32 +- .../Integration/Model/Config/Converter.php | 7 +- .../Model/Config/SchemaLocator.php | 3 +- .../Magento/Integration/Model/Integration.php | 17 +- .../Magento/Integration/Model/Manager.php | 4 + .../Magento/Integration/Model/Oauth/Token.php | 3 +- .../Integration/Service/IntegrationV1.php | 9 + .../Service/IntegrationV1Interface.php | 10 +- .../Magento/Integration/Service/OauthV1.php | 36 +- .../Integration/Service/OauthV1Interface.php | 21 +- .../Integration/etc/adminhtml/menu.xml | 2 +- .../Integration/etc/adminhtml/routes.xml | 2 +- .../Integration/etc/integration/config.xsd | 1 + app/code/Magento/Integration/etc/module.xml | 4 +- .../sql/integration_setup/install-1.0.0.0.php | 2 +- .../upgrade-1.0.0.1-1.0.0.2.php} | 29 +- .../view/adminhtml/integration.css | 4 +- .../integration/activate/permissions.phtml | 2 +- .../integration/popup_container.phtml | 9 +- .../integration/tokens_exchange.phtml | 29 + .../view/adminhtml/js/integration.js | 212 ++- .../adminhtml_integration_grid_block.xml | 9 - .../adminhtml_integration_tokensexchange.xml} | 13 +- app/code/Magento/Log/Model/Shell.php | 6 +- app/code/Magento/Log/Model/Visitor.php | 8 +- app/code/Magento/Log/etc/email_templates.xml | 2 +- .../Newsletter/Block/Adminhtml/Problem.php | 4 +- .../Problem/Grid/Filter/Checkbox.php | 2 +- .../Problem/Grid/Renderer/Checkbox.php | 2 +- .../Newsletter/Block/Adminhtml/Queue/Edit.php | 10 +- .../Adminhtml/Queue/Grid/Renderer/Action.php | 2 +- .../Block/Adminhtml/Queue/Preview.php | 8 +- .../Block/Adminhtml/Queue/Preview/Form.php | 2 +- .../Block/Adminhtml/Subscriber/Grid.php | 4 +- .../Subscriber/Grid/Filter/Checkbox.php | 2 +- .../Subscriber/Grid/Renderer/Checkbox.php | 2 +- .../Block/Adminhtml/Template/Edit.php | 18 +- .../Block/Adminhtml/Template/Grid.php | 4 +- .../Template/Grid/Renderer/Action.php | 2 +- .../Template/Grid/Renderer/Sender.php | 2 +- .../Block/Adminhtml/Template/Preview.php | 8 +- .../Block/Adminhtml/Template/Preview/Form.php | 2 +- .../Controller/Adminhtml/Problem.php | 21 +- .../Newsletter/Controller/Adminhtml/Queue.php | 6 +- .../Controller/Adminhtml/Subscriber.php | 36 +- .../Controller/Adminhtml/Template.php | 12 +- .../Magento/Newsletter/Controller/Manage.php | 25 +- .../Newsletter/Controller/Subscriber.php | 32 +- app/code/Magento/Newsletter/Model/Queue.php | 6 +- app/code/Magento/Newsletter/Model/Session.php | 29 +- .../Magento/Newsletter/etc/adminhtml/menu.xml | 6 +- app/code/Magento/Newsletter/etc/di.xml | 10 + .../Newsletter/etc/email_templates.xml | 6 +- app/code/Magento/Newsletter/etc/module.xml | 1 - app/code/Magento/Ogone/Controller/Api.php | 38 +- .../Controller/Adminhtml/PageCache.php | 20 +- .../PageCache/etc/adminhtml/routes.xml | 4 +- .../Paygate/Block/Authorizenet/Form/Cc.php | 2 +- .../Paygate/Block/Authorizenet/Info/Cc.php | 1 + .../Paygate/Authorizenet/Payment.php | 6 +- .../Magento/Paygate/Model/Authorizenet.php | 6 +- .../Paygate/Model/Authorizenet/Cards.php | 18 +- app/code/Magento/Paygate/etc/adminhtml/di.xml | 2 +- .../Magento/Paygate/etc/adminhtml/routes.xml | 4 +- app/code/Magento/Paygate/etc/module.xml | 1 - .../Paygate/view/adminhtml/info/cc.phtml | 4 +- .../Magento/Payment/Block/Form/Container.php | 23 +- app/code/Magento/Payment/Block/Info.php | 14 +- .../Block/Adminhtml/Settlement/Details.php | 2 +- .../System/Config/Fieldset/Expanded.php | 4 +- .../System/Config/Fieldset/Group.php | 4 +- .../Adminhtml/System/Config/Fieldset/Hint.php | 21 +- .../System/Config/Fieldset/Location.php | 2 +- .../System/Config/Fieldset/Payment.php | 4 +- .../Magento/Paypal/Block/Express/Review.php | 25 +- app/code/Magento/Paypal/Block/Iframe.php | 15 +- .../Paypal/Block/Payflow/Link/Iframe.php | 4 +- .../Controller/Adminhtml/Paypal/Reports.php | 6 +- .../Magento/Paypal/Controller/Express.php | 4 +- .../Controller/Express/AbstractExpress.php | 66 +- .../Paypal/Controller/Payflowadvanced.php | 4 +- app/code/Magento/Paypal/Model/Cert.php | 56 +- app/code/Magento/Paypal/Model/Payflowpro.php | 51 +- .../Paypal/Model/Report/Settlement.php | 35 +- app/code/Magento/Paypal/Model/Standard.php | 6 +- .../Model/System/Config/Backend/Cert.php | 18 +- app/code/Magento/Paypal/etc/adminhtml/di.xml | 14 +- .../Magento/Paypal/etc/adminhtml/routes.xml | 2 +- app/code/Magento/Paypal/etc/frontend/di.xml | 14 +- app/code/Magento/Paypal/etc/module.xml | 1 - .../Paypal/view/frontend/order-review.js | 5 +- .../Magento/PaypalUk/etc/adminhtml/di.xml | 9 +- app/code/Magento/PaypalUk/etc/frontend/di.xml | 9 +- .../Magento/Persistent/Controller/Index.php | 12 +- app/code/Magento/Persistent/Helper/Data.php | 2 +- .../Magento/Persistent/Model/Observer.php | 22 +- .../Persistent/Model/Persistent/Config.php | 24 +- app/code/Magento/Persistent/etc/module.xml | 1 - .../ProductAlert/Block/Email/Stock.php | 21 +- .../Magento/ProductAlert/Controller/Add.php | 21 +- .../ProductAlert/Controller/Unsubscribe.php | 29 +- .../ProductAlert/etc/email_templates.xml | 6 +- .../Magento/Rating/Block/Adminhtml/Edit.php | 2 +- .../Rating/Block/Adminhtml/Edit/Tab/Form.php | 7 +- .../Rating/Block/Adminhtml/Edit/Tabs.php | 2 +- .../Rating/Controller/Adminhtml/Index.php | 12 +- app/code/Magento/Rating/etc/adminhtml/di.xml | 2 +- .../Reports/Block/Adminhtml/Filter/Form.php | 4 +- .../Block/Adminhtml/Grid/AbstractGrid.php | 4 +- .../Grid/Column/Renderer/Blanknumber.php | 2 +- .../Grid/Column/Renderer/Customer.php | 2 +- .../Grid/Column/Renderer/Product.php | 2 +- .../Reports/Block/Adminhtml/Product.php | 2 +- .../Block/Adminhtml/Product/Downloads.php | 2 +- .../Adminhtml/Product/Downloads/Grid.php | 6 +- .../Product/Downloads/Renderer/Purchases.php | 2 +- .../Reports/Block/Adminhtml/Product/Grid.php | 4 +- .../Block/Adminhtml/Product/Lowstock.php | 2 +- .../Block/Adminhtml/Product/Lowstock/Grid.php | 4 +- .../Block/Adminhtml/Product/Viewed.php | 2 +- .../Block/Adminhtml/Product/Viewed/Grid.php | 2 +- .../Block/Adminhtml/Review/Customer.php | 2 +- .../Reports/Block/Adminhtml/Review/Detail.php | 2 +- .../Block/Adminhtml/Review/Detail/Grid.php | 6 +- .../Block/Adminhtml/Review/Product.php | 2 +- .../Block/Adminhtml/Sales/Bestsellers.php | 2 +- .../Reports/Block/Adminhtml/Sales/Coupons.php | 2 +- .../Sales/Grid/Column/Renderer/Date.php | 2 +- .../Block/Adminhtml/Sales/Invoiced.php | 2 +- .../Block/Adminhtml/Sales/Refunded.php | 2 +- .../Reports/Block/Adminhtml/Sales/Sales.php | 2 +- .../Block/Adminhtml/Sales/Shipping.php | 2 +- .../Reports/Block/Adminhtml/Sales/Tax.php | 2 +- .../Block/Adminhtml/Sales/Tax/Grid.php | 12 +- .../Block/Adminhtml/Shopcart/Abandoned.php | 2 +- .../Adminhtml/Shopcart/Abandoned/Grid.php | 4 +- .../Block/Adminhtml/Shopcart/Customer.php | 2 +- .../Adminhtml/Shopcart/Customer/Grid.php | 4 +- .../Block/Adminhtml/Shopcart/Product.php | 2 +- .../Block/Adminhtml/Shopcart/Product/Grid.php | 4 +- .../Reports/Block/Adminhtml/Wishlist/Grid.php | 6 +- .../Reports/Block/Product/AbstractProduct.php | 27 +- .../Adminhtml/Report/AbstractReport.php | 2 +- .../Controller/Adminhtml/Report/Sales.php | 6 +- .../Adminhtml/Report/Statistics.php | 23 +- app/code/Magento/Reports/Model/Config.php | 6 +- .../Model/Product/Index/AbstractIndex.php | 8 +- .../Reports/Model/Product/Index/Compared.php | 4 +- app/code/Magento/Reports/Model/Totals.php | 2 +- .../Magento/Reports/etc/adminhtml/menu.xml | 2 +- app/code/Magento/Reports/etc/di.xml | 9 +- app/code/Magento/Reports/etc/module.xml | 1 - .../reports_setup/mysql4-install-1.6.0.0.php | 66 +- .../reports_report_product_lowstock_grid.xml | 2 +- .../Magento/Review/Block/Adminhtml/Add.php | 2 +- .../Magento/Review/Block/Adminhtml/Edit.php | 2 +- .../Magento/Review/Block/Adminhtml/Grid.php | 4 +- .../Block/Adminhtml/Grid/Filter/Type.php | 2 +- .../Block/Adminhtml/Grid/Renderer/Type.php | 2 +- .../Magento/Review/Block/Adminhtml/Main.php | 2 +- .../Review/Block/Adminhtml/Product/Grid.php | 5 + .../Magento/Review/Block/Customer/View.php | 27 +- app/code/Magento/Review/Block/Form.php | 14 +- .../Magento/Review/Block/Product/View.php | 24 +- app/code/Magento/Review/Block/View.php | 27 +- .../Magento/Review/Controller/Customer.php | 4 +- .../Magento/Review/Controller/Product.php | 16 +- app/code/Magento/Review/etc/adminhtml/di.xml | 9 +- .../Magento/Review/etc/adminhtml/menu.xml | 4 +- app/code/Magento/Review/etc/frontend/di.xml | 9 +- .../Rss/App/Action/Plugin/Authentication.php | 8 +- .../Magento/Rss/Block/Catalog/Category.php | 10 +- .../Magento/Rss/Block/Catalog/NewCatalog.php | 10 +- .../Magento/Rss/Block/Catalog/Special.php | 22 +- app/code/Magento/Rss/Block/Wishlist.php | 34 +- .../Block/Adminhtml/Billing/Agreement.php | 2 +- .../Adminhtml/Billing/Agreement/Grid.php | 10 +- .../Sales/Block/Adminhtml/Creditmemo.php | 2 +- .../Sales/Block/Adminhtml/Creditmemo/Grid.php | 6 +- .../Adminhtml/Customer/Edit/Tab/Agreement.php | 16 +- .../Customer/Edit/Tab/Recurring/Profile.php | 12 +- .../Magento/Sales/Block/Adminhtml/Invoice.php | 2 +- .../Sales/Block/Adminhtml/Invoice/Grid.php | 6 +- .../Magento/Sales/Block/Adminhtml/Order.php | 2 +- .../Block/Adminhtml/Order/AbstractOrder.php | 14 +- .../Sales/Block/Adminhtml/Order/Address.php | 2 +- .../Block/Adminhtml/Order/Address/Form.php | 17 +- .../Block/Adminhtml/Order/Comments/View.php | 2 +- .../Sales/Block/Adminhtml/Order/Create.php | 10 +- .../Adminhtml/Order/Create/AbstractCreate.php | 6 +- .../Order/Create/Billing/Method/Form.php | 10 +- .../Block/Adminhtml/Order/Create/Customer.php | 2 +- .../Block/Adminhtml/Order/Create/Data.php | 4 +- .../Block/Adminhtml/Order/Create/Form.php | 4 +- .../Order/Create/Form/AbstractForm.php | 10 +- .../Adminhtml/Order/Create/Form/Account.php | 4 +- .../Adminhtml/Order/Create/Form/Address.php | 28 +- .../Adminhtml/Order/Create/Giftmessage.php | 14 +- .../Order/Create/Giftmessage/Form.php | 16 +- .../Block/Adminhtml/Order/Create/Items.php | 2 +- .../Adminhtml/Order/Create/Items/Grid.php | 18 +- .../Block/Adminhtml/Order/Create/Load.php | 6 +- .../Block/Adminhtml/Order/Create/Messages.php | 25 +- .../Order/Create/Newsletter/Form.php | 2 +- .../Block/Adminhtml/Order/Create/Search.php | 2 +- .../Adminhtml/Order/Create/Search/Grid.php | 14 +- .../Create/Search/Grid/Renderer/Price.php | 2 +- .../Create/Search/Grid/Renderer/Product.php | 2 +- .../Order/Create/Search/Grid/Renderer/Qty.php | 2 +- .../Order/Create/Shipping/Method/Form.php | 4 +- .../Block/Adminhtml/Order/Create/Sidebar.php | 2 +- .../Order/Create/Sidebar/AbstractSidebar.php | 4 +- .../Adminhtml/Order/Create/Sidebar/Cart.php | 2 +- .../Order/Create/Sidebar/Pcompared.php | 4 +- .../Order/Create/Sidebar/Pviewed.php | 4 +- .../Order/Create/Sidebar/Reorder.php | 4 +- .../Block/Adminhtml/Order/Create/Totals.php | 4 +- .../Order/Create/Totals/DefaultTotals.php | 2 +- .../Order/Create/Totals/Discount.php | 4 +- .../Order/Create/Totals/Grandtotal.php | 4 +- .../Order/Create/Totals/Shipping.php | 4 +- .../Order/Create/Totals/Subtotal.php | 4 +- .../Adminhtml/Order/Creditmemo/Create.php | 2 +- .../Order/Creditmemo/Create/Items.php | 8 +- .../Block/Adminhtml/Order/Creditmemo/View.php | 4 +- .../Block/Adminhtml/Order/Invoice/Create.php | 2 +- .../Adminhtml/Order/Invoice/Create/Items.php | 4 +- .../Order/Invoice/Create/Tracking.php | 2 +- .../Block/Adminhtml/Order/Invoice/View.php | 2 +- .../Block/Adminhtml/Order/Shipment/Create.php | 2 +- .../Adminhtml/Order/Shipment/Create/Items.php | 2 +- .../Order/Shipment/Create/Tracking.php | 2 +- .../Adminhtml/Order/Shipment/Packaging.php | 2 +- .../Block/Adminhtml/Order/Shipment/View.php | 2 +- .../Adminhtml/Order/Shipment/View/Form.php | 6 +- .../Order/Shipment/View/Tracking.php | 2 +- .../Block/Adminhtml/Order/Status/Assign.php | 2 +- .../Adminhtml/Order/Status/Assign/Form.php | 2 +- .../Adminhtml/Order/Status/Edit/Form.php | 2 +- .../Adminhtml/Order/Status/NewStatus.php | 2 +- .../Adminhtml/Order/Status/NewStatus/Form.php | 2 +- .../Block/Adminhtml/Order/Totals/Item.php | 4 +- .../Block/Adminhtml/Order/Totals/Tax.php | 10 +- .../Sales/Block/Adminhtml/Order/View.php | 10 +- .../Adminhtml/Order/View/Giftmessage.php | 16 +- .../Block/Adminhtml/Order/View/History.php | 2 +- .../Sales/Block/Adminhtml/Order/View/Info.php | 4 +- .../View/Items/Renderer/DefaultRenderer.php | 43 +- .../Block/Adminhtml/Order/View/Messages.php | 4 +- .../Adminhtml/Order/View/Tab/Creditmemos.php | 8 +- .../Adminhtml/Order/View/Tab/History.php | 2 +- .../Block/Adminhtml/Order/View/Tab/Info.php | 2 +- .../Adminhtml/Order/View/Tab/Invoices.php | 8 +- .../Adminhtml/Order/View/Tab/Shipments.php | 8 +- .../Adminhtml/Order/View/Tab/Transactions.php | 2 +- .../Block/Adminhtml/Recurring/Profile.php | 2 +- .../Adminhtml/Recurring/Profile/Edit/Form.php | 2 +- .../Adminhtml/Recurring/Profile/Grid.php | 8 +- .../Recurring/Profile/View/Getawayinfo.php | 2 +- .../Adminhtml/Recurring/Profile/View/Info.php | 2 +- .../Recurring/Profile/View/Tab/Info.php | 4 +- .../Recurring/Profile/View/Tab/Orders.php | 8 +- .../Block/Adminhtml/Report/Filter/Form.php | 2 +- .../Adminhtml/Report/Filter/Form/Coupon.php | 4 +- .../Sales/Block/Adminhtml/Shipment.php | 2 +- .../Sales/Block/Adminhtml/Shipment/Grid.php | 12 +- .../Config/Form/Fieldset/Order/Statuses.php | 4 +- .../Magento/Sales/Block/Adminhtml/Totals.php | 23 +- .../Sales/Block/Adminhtml/Transactions.php | 2 +- .../Adminhtml/Transactions/Child/Grid.php | 2 +- .../Block/Adminhtml/Transactions/Detail.php | 2 +- .../Adminhtml/Transactions/Detail/Grid.php | 10 +- .../Block/Adminhtml/Transactions/Grid.php | 10 +- .../Sales/Block/Billing/Agreement/View.php | 10 +- .../Sales/Block/Billing/Agreements.php | 12 +- .../Magento/Sales/Block/Order/Creditmemo.php | 10 +- app/code/Magento/Sales/Block/Order/Info.php | 10 +- .../Magento/Sales/Block/Order/Invoice.php | 10 +- .../Block/Order/PrintOrder/Creditmemo.php | 10 +- .../Sales/Block/Order/PrintOrder/Invoice.php | 10 +- .../Sales/Block/Order/PrintOrder/Shipment.php | 10 +- .../Sales/Block/Order/PrintShipment.php | 10 +- .../Magento/Sales/Block/Order/Shipment.php | 10 +- app/code/Magento/Sales/Block/Order/View.php | 10 +- .../Recurring/Profile/Related/Orders/Grid.php | 10 +- .../Block/Recurring/Profile/View/Fees.php | 23 +- .../Sales/Block/Status/Grid/Column/State.php | 2 +- .../Block/Status/Grid/Column/Unassign.php | 2 +- .../Sales/Controller/AbstractController.php | 12 +- .../Adminhtml/Billing/Agreement.php | 14 +- .../Creditmemo/AbstractCreditmemo.php | 2 +- .../Adminhtml/Invoice/AbstractInvoice.php | 2 +- .../Sales/Controller/Adminhtml/Order.php | 73 +- .../Controller/Adminhtml/Order/Create.php | 37 +- .../Controller/Adminhtml/Order/Creditmemo.php | 26 +- .../Sales/Controller/Adminhtml/Order/Edit.php | 4 +- .../Controller/Adminhtml/Order/Invoice.php | 44 +- .../Controller/Adminhtml/Order/Shipment.php | 61 +- .../Controller/Adminhtml/Order/Status.php | 26 +- .../Adminhtml/Order/View/Giftmessage.php | 4 +- .../Adminhtml/Recurring/Profile.php | 19 +- .../Adminhtml/Shipment/AbstractShipment.php | 4 +- .../Controller/Adminhtml/Transactions.php | 12 +- .../Sales/Controller/Billing/Agreement.php | 28 +- .../Magento/Sales/Controller/Download.php | 51 +- app/code/Magento/Sales/Controller/Order.php | 4 +- .../Sales/Controller/Recurring/Profile.php | 22 +- app/code/Magento/Sales/Helper/Guest.php | 14 +- app/code/Magento/Sales/Model/AdminOrder.php | 18 +- .../Magento/Sales/Model/AdminOrder/Create.php | 20 +- app/code/Magento/Sales/Model/Order.php | 30 +- .../Magento/Sales/Model/Order/Payment.php | 2 +- .../Sales/Model/Order/Pdf/AbstractPdf.php | 28 +- .../Sales/Model/Order/Pdf/Creditmemo.php | 6 +- .../Magento/Sales/Model/Order/Pdf/Invoice.php | 6 +- .../Model/Order/Pdf/Items/AbstractItems.php | 16 +- .../Items/Creditmemo/DefaultCreditmemo.php | 6 +- .../Pdf/Items/Invoice/DefaultInvoice.php | 6 +- .../Pdf/Items/Shipment/DefaultShipment.php | 6 +- .../Sales/Model/Order/Pdf/Shipment.php | 6 +- .../Model/Order/Pdf/Shipment/Packaging.php | 6 +- app/code/Magento/Sales/Model/Quote.php | 4 +- .../Magento/Sales/Model/Resource/Quote.php | 2 +- app/code/Magento/Sales/etc/adminhtml/menu.xml | 2 +- .../Magento/Sales/etc/adminhtml/routes.xml | 4 +- .../Magento/Sales/etc/email_templates.xml | 32 +- app/code/Magento/Sales/etc/module.xml | 1 - .../layout/sales_order_grid_block.xml | 20 +- .../layout/sales_recurring_profile_view.xml | 2 +- .../adminhtml/order/shipment/packaging.js | 5 - .../SalesRule/Block/Adminhtml/Promo/Quote.php | 2 +- .../Block/Adminhtml/Promo/Quote/Edit.php | 2 +- .../Promo/Quote/Edit/Tab/Coupons.php | 2 +- .../Promo/Quote/Edit/Tab/Coupons/Form.php | 2 +- .../Promo/Quote/Edit/Tab/Coupons/Grid.php | 10 +- .../Tab/Coupons/Grid/Column/Renderer/Used.php | 2 +- .../Adminhtml/Promo/Quote/Edit/Tab/Main.php | 2 +- .../Block/Adminhtml/Promo/Quote/Edit/Tabs.php | 2 +- .../Controller/Adminhtml/Promo/Quote.php | 34 +- app/code/Magento/SalesRule/Model/Observer.php | 12 +- .../Model/Resource/Coupon/Collection.php | 2 +- .../SalesRule/etc/adminhtml/routes.xml | 2 +- app/code/Magento/SalesRule/etc/di.xml | 5 - .../Magento/Sendfriend/Controller/Product.php | 16 +- .../Sendfriend/etc/email_templates.xml | 2 +- .../Adminhtml/Carrier/Tablerate/Grid.php | 8 +- .../Model/Resource/Carrier/Tablerate.php | 58 +- .../Shipping/Model/Shipping/Labels.php | 11 +- .../Magento/Sitemap/Block/Adminhtml/Edit.php | 2 +- .../Block/Adminhtml/Grid/Renderer/Action.php | 2 +- .../Block/Adminhtml/Grid/Renderer/Link.php | 5 +- .../Block/Adminhtml/Grid/Renderer/Time.php | 2 +- .../Sitemap/Block/Adminhtml/Sitemap.php | 2 +- .../Sitemap/Controller/Adminhtml/Sitemap.php | 63 +- app/code/Magento/Sitemap/Model/Sitemap.php | 131 +- .../Magento/Sitemap/etc/adminhtml/menu.xml | 2 +- .../Magento/Sitemap/etc/adminhtml/routes.xml | 4 +- .../Magento/Sitemap/etc/email_templates.xml | 2 +- app/code/Magento/Sitemap/etc/module.xml | 1 - .../Adminhtml/Frontend/Region/Updater.php | 21 +- .../Adminhtml/Rate/Grid/Renderer/Country.php | 2 +- .../Adminhtml/Rate/Grid/Renderer/Data.php | 2 +- .../Tax/Block/Adminhtml/Rate/ImportExport.php | 2 +- .../Adminhtml/Rate/ImportExportHeader.php | 2 +- .../Tax/Block/Adminhtml/Rate/Toolbar/Add.php | 2 +- .../Tax/Block/Adminhtml/Rate/Toolbar/Save.php | 8 +- app/code/Magento/Tax/Block/Adminhtml/Rule.php | 2 +- .../Magento/Tax/Block/Adminhtml/Rule/Edit.php | 2 +- .../Tax/Block/Adminhtml/Rule/Edit/Form.php | 2 +- .../Magento/Tax/Controller/Adminhtml/Rate.php | 36 +- .../Magento/Tax/Controller/Adminhtml/Rule.php | 22 +- .../Model/Resource/Rule/Grid/Collection.php | 6 +- app/code/Magento/Tax/etc/adminhtml/menu.xml | 4 +- app/code/Magento/Tax/etc/module.xml | 1 - .../System/Design/Theme/Edit/Tab/Css.php | 6 +- .../Block/Adminhtml/Wysiwyg/Files/Content.php | 39 +- .../Wysiwyg/Files/Content/Uploader.php | 25 +- .../Block/Adminhtml/Wysiwyg/Files/Tree.php | 31 +- app/code/Magento/Theme/Block/Html/Head.php | 13 +- app/code/Magento/Theme/Block/Html/Header.php | 26 +- .../Adminhtml/System/Design/Theme.php | 24 +- .../Adminhtml/System/Design/Wysiwyg/Files.php | 2 +- app/code/Magento/Theme/Helper/Storage.php | 45 +- app/code/Magento/Theme/Model/CopyService.php | 22 +- .../Magento/Theme/Model/Uploader/Service.php | 14 +- .../Magento/Theme/Model/Wysiwyg/Storage.php | 70 +- .../etc/adminhtml/di.xml} | 36 +- app/code/Magento/Theme/etc/adminhtml/menu.xml | 2 +- .../Magento/Theme/etc/adminhtml/routes.xml | 4 +- app/code/Magento/Theme/etc/di.xml | 5 + app/code/Magento/Theme/etc/module.xml | 1 - .../Shipping/Carrier/Dhl/International.php | 26 +- .../Usa/Model/Shipping/Carrier/Fedex.php | 2 +- .../Magento/User/Block/Role/Grid/User.php | 6 +- .../User/Block/User/Edit/Tab/Roles.php | 6 +- .../User/Controller/Adminhtml/Auth.php | 14 +- .../User/Controller/Adminhtml/User.php | 18 +- .../User/Controller/Adminhtml/User/Role.php | 26 +- app/code/Magento/User/etc/adminhtml/menu.xml | 2 +- .../Magento/User/etc/adminhtml/routes.xml | 4 +- app/code/Magento/User/etc/email_templates.xml | 4 +- app/code/Magento/User/etc/module.xml | 1 - .../Webapi/Controller/ErrorProcessor.php | 25 +- .../Rest/Request/Deserializer/Factory.php | 3 +- .../Config/Integration/SchemaLocator.php | 3 +- .../Webapi/Model/Config/SchemaLocator.php | 2 +- .../Model/Plugin/AuthorizationServiceV1.php | 93 ++ app/code/Magento/Webapi/Model/Soap/Config.php | 25 +- .../Magento/Webapi/etc/webapi_rest/di.xml | 3 + .../Magento/Webapi/etc/webapi_soap/di.xml | 3 + .../Magento/Weee/Block/Renderer/Weee/Tax.php | 4 +- app/code/Magento/Weee/etc/module.xml | 1 - .../Magento/Widget/Block/Adminhtml/Widget.php | 2 +- .../Widget/Block/Adminhtml/Widget/Chooser.php | 2 +- .../Block/Adminhtml/Widget/Instance.php | 2 +- .../Block/Adminhtml/Widget/Instance/Edit.php | 2 +- .../Widget/Instance/Edit/Chooser/Template.php | 2 +- .../Widget/Instance/Edit/Tab/Main/Layout.php | 4 +- .../Widget/Instance/Edit/Tab/Properties.php | 2 +- .../Widget/Instance/Edit/Tab/Settings.php | 2 +- .../Adminhtml/Widget/Instance/Edit/Tabs.php | 2 +- .../Widget/Block/Adminhtml/Widget/Options.php | 4 +- .../Controller/Adminhtml/Widget/Instance.php | 18 +- .../Widget/Model/Config/FileResolver.php | 42 +- .../Magento/Widget/Model/Template/Filter.php | 4 +- .../Magento/Widget/Model/Widget/Instance.php | 12 +- .../Magento/Widget/etc/adminhtml/menu.xml | 2 +- .../Magento/Widget/etc/adminhtml/routes.xml | 4 +- app/code/Magento/Widget/etc/module.xml | 1 - .../Magento/Wishlist/Block/AbstractBlock.php | 53 +- .../Wishlist/Block/Customer/Sharing.php | 6 +- .../Wishlist/Block/Customer/Wishlist.php | 20 +- .../Block/Customer/Wishlist/Item/Options.php | 20 +- app/code/Magento/Wishlist/Block/Link.php | 23 +- .../Wishlist/Block/Share/Email/Items.php | 2 +- .../Magento/Wishlist/Block/Share/Wishlist.php | 20 +- .../Controller/AbstractController.php | 8 +- .../Magento/Wishlist/Controller/Index.php | 80 +- .../Magento/Wishlist/Controller/Shared.php | 10 +- app/code/Magento/Wishlist/Model/Observer.php | 10 +- .../Magento/Wishlist/etc/adminhtml/di.xml | 9 +- .../Magento/Wishlist/etc/email_templates.xml | 2 +- app/code/Magento/Wishlist/etc/frontend/di.xml | 14 +- .../layout/default.xml | 0 .../install/magento_basic/images/i_notice.gif | Bin 0 -> 802 bytes .../images/validation_advice_bg.gif | Bin 0 -> 134 bytes app/etc/di.xml | 40 +- .../TestFramework/Annotation/DataFixture.php | 2 +- .../Magento/TestFramework/Application.php | 57 +- .../Magento/TestFramework/Bootstrap.php | 13 +- .../TestFramework/Bootstrap/Settings.php | 2 +- .../Magento/TestFramework/Db/Mysql.php | 4 +- .../Magento/TestFramework/ObjectManager.php | 5 + .../TestFramework/ObjectManagerFactory.php | 32 +- .../TestCase/AbstractConfigFiles.php | 31 +- .../TestCase/AbstractController.php | 18 +- dev/tests/integration/framework/bootstrap.php | 5 +- .../Magento/Test/ApplicationTest.php | 17 +- .../Magento/Test/Bootstrap/SettingsTest.php | 2 +- .../testsuite/Magento/Test/BootstrapTest.php | 21 +- .../Magento/Test/Helper/BootstrapTest.php | 8 +- .../Magento/Test/ObjectManagerTest.php | 4 +- .../Test/TestCase/ControllerAbstractTest.php | 28 +- dev/tests/integration/phpunit.xml.dist | 5 +- .../Adminhtml/Block/Widget/ContainerTest.php | 88 -- .../Backend/Block/Dashboard/GraphTest.php | 8 +- .../Backend/Block/System/Config/FormTest.php | 9 +- .../Urlrewrite/Catalog/Category/EditTest.php | 34 +- .../Urlrewrite/Catalog/Category/TreeTest.php | 12 +- .../Urlrewrite/Catalog/Edit/FormTest.php | 10 +- .../Urlrewrite/Catalog/Product/EditTest.php | 48 +- .../Urlrewrite/Catalog/Product/GridTest.php | 8 +- .../Urlrewrite/Cms/Page/Edit/FormTest.php | 10 +- .../Block/Urlrewrite/Cms/Page/EditTest.php | 34 +- .../Block/Urlrewrite/Cms/Page/GridTest.php | 12 +- .../Block/Urlrewrite/Edit/FormTest.php | 10 +- .../Block/Urlrewrite/EditTest.php | 22 +- .../Backend/Block/Widget/ContainerTest.php | 54 + .../Block/Widget/Form/ContainerTest.php | 6 +- .../Block/Widget/Grid}/ItemTest.php | 6 +- .../Block/Widget/Grid/MassactionTest.php | 4 +- .../Magento/Backend/Block/Widget/GridTest.php | 29 +- .../Block/Widget/TabsTest.php | 6 +- .../Backend/Block/_files/backend_theme.php | 4 +- .../Block}/_files/form_key_disabled.php | 0 .../_files/form_key_disabled_rollback.php | 0 .../Controller/Adminhtml/CacheTest.php | 3 +- .../Model/Config/Backend/Admin/RobotsTest.php | 33 +- .../Magento/Backend/Model/ConfigTest.php | 4 +- .../Magento/Backend/Model/UrlTest.php | 4 +- .../Backend/Model/_files/no_robots_txt.php | 9 +- .../Backend/Model/_files/robots_txt.php | 10 +- .../Magento/Backend/Utility/Controller.php | 17 +- .../Magento/Captcha/Model/ObserverTest.php | 3 +- .../Controller/Adminhtml/CategoryTest.php | 4 +- .../Product/Action/AttributeTest.php | 4 +- .../Controller/Adminhtml/ProductTest.php | 8 +- .../Controller/Product/CompareTest.php | 28 +- .../Magento/Catalog/Helper/ImageTest.php | 42 +- .../Catalog/Helper/Product/ViewTest.php | 42 - .../Magento/Catalog/Model/DesignTest.php | 4 +- .../Product/Attribute/Backend/MediaTest.php | 36 +- .../Product/Attribute/Backend/SkuTest.php | 4 +- .../Catalog/Model/ProductGettersTest.php | 8 +- .../Magento/Catalog/Model/ProductTest.php | 33 +- .../Magento/Catalog/_files/product_image.php | 9 +- .../Catalog/_files/product_image_rollback.php | 10 +- .../Catalog/controllers/_files/products.php | 27 +- .../Magento/Checkout/Controller/CartTest.php | 15 +- .../Magento/Cms/Helper/Wysiwyg/ImagesTest.php | 8 +- .../Cms/Model/Wysiwyg/Images/StorageTest.php | 23 +- .../testsuite/Magento/Code/GeneratorTest.php | 19 +- .../Core/Model/DataService/ConfigTest.php | 79 +- .../Core/Model/DataService/LayoutTest.php | 60 +- .../Magento/Core/Model/File/StorageTest.php | 3 +- .../Magento/Core/Model/ObserverTest.php | 7 +- .../Session/AbstractSession/VarienTest.php | 8 +- .../Magento/Core/Model/Session/ConfigTest.php | 33 +- .../Core/Model/Session/SidResolverTest.php | 18 +- .../Magento/Core/Model/StoreTest.php | 10 +- .../Core/Model/Theme/CollectionTest.php | 19 +- .../Core/Model/Theme/RegistrationTest.php | 10 +- .../Core/Model/Translate/InlineTest.php | 9 + .../Magento/Core/Model/TranslateTest.php | 2 +- .../Magento/Core/Model/View/DesignTest.php | 82 +- .../Core/Model/_files/design/themes.php | 8 +- .../_files/design/var/log/exception.log} | 0 .../Model/_files/design/var/log/system.log} | 0 .../testsuite/Magento/Core/Utility/Layout.php | 2 +- .../Magento/Core/Utility/LayoutTest.php | 5 + .../Magento/Core/_files/media_for_change.php | 10 +- .../Core/_files/media_for_change_rollback.php | 15 +- .../Controller/Adminhtml/GroupTest.php | 7 +- .../Controller/Adminhtml/IndexTest.php | 21 +- .../Magento/Customer/Model/SessionTest.php | 65 + .../Magento/Customer/_files/session.php | 63 + .../Adminhtml/System/Design/EditorTest.php | 2 +- .../Model/Config/QuickStylesTest.php | 6 +- .../Tools/Controls/ConfigurationTest.php | 16 +- .../Model/_files/design/themes.php | 9 +- .../Email/Model/Template/FilterTest.php | 4 +- .../Magento/Email/Model/TemplateTest.php | 5 +- .../Magento/Email/Model/_files/themes.php | 16 +- .../Magento/Filesystem/Adapter/LocalTest.php | 486 ------- .../Magento/Filesystem/Adapter/ZlibTest.php | 78 -- .../Magento/Filesystem/Directory/ReadTest.php | 71 +- .../Filesystem/Directory/WriteTest.php | 70 +- .../Magento/Filesystem/File/ReadTest.php | 12 +- .../Magento/Filesystem/File/WriteTest.php | 13 +- .../Magento/Filesystem/FilesystemTest.php | 91 ++ .../Magento/Filesystem/Stream/LocalTest.php | 256 ---- .../Magento/Filesystem/Stream/ZlibTest.php | 36 - .../Magento/Image/Adapter/InterfaceTest.php | 6 +- .../Model/Export/Entity/ProductTest.php | 45 +- .../Import/Entity/CustomerCompositeTest.php | 5 +- .../Entity/Eav/Customer/AddressTest.php | 16 +- .../Import/Entity/Eav/CustomerImportTest.php | 21 +- .../Model/Import/Entity/ProductTest.php | 90 +- ...oducts_to_import_invalid_attribute_set.csv | 4 + .../Model/Import/EntityAbstractTest.php | 5 +- .../Magento/Index/Model/Process/FileTest.php | 54 +- .../Magento/Install/Block/AdminTest.php | 2 +- .../Magento/Install/Controller/WizardTest.php | 63 +- .../Magento/Install/Model/ConfigTest.php | 29 +- .../Install/Model/Installer/ConfigTest.php | 42 +- .../Magento/Install/Model/InstallerTest.php | 34 +- .../Controller/Adminhtml/IntegrationTest.php | 4 +- .../Integration/Model/Config/ReaderTest.php | 4 +- .../Model/Config/_files/integration.php | 6 +- .../Model/Config/_files/integrationA.xml | 1 + .../Model/Config/_files/integrationB.xml | 1 + .../Magento/Message/CollectionFactoryTest.php | 53 + .../testsuite/Magento/Message/FactoryTest.php | 75 ++ .../testsuite/Magento/Message/ManagerTest.php | 133 ++ .../Adminhtml/NewsletterQueueTest.php | 5 +- .../Adminhtml/NewsletterTemplateTest.php | 21 +- .../Magento/Newsletter/Model/QueueTest.php | 2 - .../Magento/Newsletter/Model/TemplateTest.php | 63 +- .../Magento/Object/Copy/Config/ReaderTest.php | 28 +- .../ObjectManager/Config/Reader/DomTest.php | 6 +- .../Payment/Model/Config/ReaderTest.php | 6 +- .../Magento/Payment/Model/ConfigTest.php | 4 +- .../Paypal/Adminhtml/Paypal/ReportsTest.php | 2 +- .../Magento/Paypal/Controller/ExpressTest.php | 4 +- .../Model/Persistent/ConfigTest.php | 18 +- .../Order/Create/Form/AbstractTest.php | 2 +- .../Sales/Block/Order/CommentsTest.php | 12 +- .../Magento/Sales/_files/order_info.php | 2 +- .../SaveHandler/DbTableTest.php} | 14 +- .../SessionManagerTest.php} | 39 +- .../Sitemap/_files/sitemap_products.php | 23 +- .../Block/Adminhtml/Rate/ImportExportTest.php | 2 +- .../Tax/Model/Rate/CsvImportHandlerTest.php | 6 +- .../Integrity/Modular/AclConfigFilesTest.php | 8 +- .../Integrity/Modular/DiConfigFilesTest.php | 45 +- .../Modular/EavAttributesConfigFilesTest.php | 12 +- .../Modular/ExportConfigFilesTest.php | 12 +- .../Modular/FieldsetConfigFilesTest.php | 6 +- .../Modular/ImportConfigFilesTest.php | 12 +- .../Modular/IndexerConfigFilesTest.php | 12 +- .../Modular/InstallWizardConfigFilesTest.php | 6 +- .../Email/EmailTemplateConfigFilesTest.php | 2 +- .../Integrity/Modular/MenuConfigFilesTest.php | 2 +- .../Modular/PaymentConfigFilesTest.php | 6 +- .../Modular/ProductOptionsConfigFilesTest.php | 14 +- .../Modular/ProductTypesConfigFilesTest.php | 13 +- .../Modular/ResourcesConfigFilesTest.php | 13 +- .../Modular/ServiceCallsConfigFilesTest.php | 4 +- .../Modular/SystemConfigFilesTest.php | 4 +- .../Modular/ThemeConfigFilesTest.php | 6 +- .../Integrity/Modular/ViewConfigFilesTest.php | 5 +- .../Test/Integrity/Modular/ViewFilesTest.php | 2 +- .../Modular/WidgetConfigFilesTest.php | 6 +- .../Modular/_files/view_files_ce.php | 2 - .../Test/Integrity/Theme/ViewFilesTest.php | 6 +- .../Test/Integrity/Theme/XmlFilesTest.php | 26 +- .../Test/Integrity/ViewFileReferenceTest.php | 2 +- .../Tools/Layout/Reference/ProcessorTest.php | 6 +- .../System/Design/ThemeControllerTest.php | 22 +- .../Theme/Model/Layout/Config/ReaderTest.php | 6 +- .../Magento/Theme/Model/Layout/ConfigTest.php | 2 +- .../Theme/Model/Wysiwyg/StorageTest.php | 57 +- .../User/Controller/Adminhtml/AuthTest.php | 8 +- .../User/Controller/Adminhtml/UserTest.php | 4 +- .../Magento/View/Asset/MergedTest.php | 44 +- .../FileResolution/Strategy/FallbackTest.php | 28 +- .../View/Element/AbstractBlockTest.php | 31 +- .../testsuite/Magento/View/FileSystemTest.php | 5 +- .../Magento/View/PublicationTest.php | 58 +- .../layout_test_handle_sample.xml | 6 +- .../Magento/View/_files/design/themes.php | 2 +- .../Model/Config/Integration/ReaderTest.php | 4 +- .../Webapi/Model/Config/ReaderTest.php | 4 +- .../Magento/Widget/Model/Config/DataTest.php | 39 +- .../Widget/Model/Config/FileResolverTest.php | 59 +- .../Widget/Model/Config/ReaderTest.php | 39 +- .../Magento/Widget/Model/WidgetTest.php | 27 +- .../Magento/Widget/_files/themes.php | 4 +- .../Magento/Wishlist/Block/AbstractTest.php | 4 + .../Magento/Wishlist/Controller/IndexTest.php | 15 +- dev/tests/js/run_js_tests.php | 6 +- .../Magento/TestFramework/Application.php | 5 +- .../TestFramework/Performance/Bootstrap.php | 11 +- .../TestFramework/Performance/Config.php | 2 +- .../TestFramework/Performance/Testsuite.php | 2 +- .../Test/Performance/BootstrapTest.php | 5 +- .../Magento/Test/Performance/ConfigTest.php | 22 +- .../Scenario/Handler/JmeterTest.php | 2 +- .../Test/Performance/TestsuiteTest.php | 19 +- .../CodingStandard/Tool/CodeMessDetector.php | 2 +- .../CodingStandard/Tool/CodeSniffer.php | 4 +- .../TestFramework/Inspection/WordsFinder.php | 6 +- .../Magento/TestFramework/Utility/Classes.php | 2 +- .../Magento/TestFramework/Utility/Files.php | 11 +- dev/tests/static/framework/bootstrap.php | 5 +- .../Magento/Test/Integrity/AdminhtmlTest.php | 92 -- .../Magento/Test/Integrity/ClassesTest.php | 6 +- .../Test/Integrity/Di/CompilerTest.php | 14 +- .../Test/Integrity/Layout/FilesTest.php | 2 +- .../Test/Integrity/Library/DependencyTest.php | 2 +- .../Integrity/Library/_files/blacklist.txt | 3 + .../Magento/Widget/_files/invalid_widget.xml | 4 +- .../Magento/Widget/_files/widget.xml | 2 +- .../Test/Integrity/PageType/FilesTest.php | 2 +- .../_files/blacklist/adminhtml_decoupling.php | 47 - .../Integrity/_files/blacklist/namespace.txt | 5 + .../Magento/Test/Js/LiveCodeTest.php | 3 +- .../Magento/Test/Legacy/LicenseTest.php | 2 +- .../Magento/Test/Legacy/ObsoleteCodeTest.php | 4 +- .../Test/Legacy/_files/obsolete_classes.php | 28 +- .../Legacy/_files/obsolete_config_nodes.php | 4 +- .../Test/Legacy/_files/obsolete_constants.php | 39 +- .../Test/Legacy/_files/obsolete_methods.php | 90 +- .../Legacy/_files/obsolete_properties.php | 81 +- .../Php/_files/phpcpd/blacklist/common.txt | 2 +- .../Test/Php/_files/whitelist/common.txt | 4 +- .../Magento/Test/Block/Adminhtml.php | 10 - dev/tests/unit/framework/bootstrap.php | 10 +- .../Helper/ObjectManagerTest.php | 4 +- .../Acl/Resource/Config/Converter/DomTest.php | 4 +- .../Magento/Acl/Resource/TreeBuilderTest.php | 6 +- .../App/Cache/Frontend/FactoryTest.php | 25 +- .../App/Config/FileResolver/PrimaryTest.php | 54 +- .../Magento/App/Config/LoaderTest.php | 12 +- .../Magento/App/Dir/VerificationTest.php | 220 ---- .../Magento/App/Error/HandlerTest.php | 70 +- .../Magento/App/FrontControllerTest.php | 8 +- .../App/Resource/Config/ConverterTest.php | 2 +- .../App/Resource/Config/ReaderTest.php | 4 +- .../App/Resource/Config/SchemaLocatorTest.php | 6 +- .../App/Response/Http/FileFactoryTest.php | 27 +- .../Authorizenet/Helper/BackendTest.php | 6 +- .../App/Response/Http/FileFactoryTest.php | 14 +- .../System/Config/Form/Field/ExportTest.php | 18 +- .../Block/System/Config/Form/FieldsetTest.php | 28 +- .../Backend/Block/System/Config/TabsTest.php | 16 - .../Magento/Backend/Block/UrlrewriteTest.php | 6 +- .../Backend/Block/Widget/ButtonTest.php | 30 +- .../Block}/Widget/Form/ContainerTest.php | 4 +- .../Block/Widget/Grid/MassactionTest.php | 25 - .../Controller/Adminhtml/CacheTest.php | 45 +- .../Adminhtml/System/AccountTest.php | 13 +- .../Adminhtml/System/Config/SaveTest.php | 17 +- .../Model/Config/SchemaLocatorTest.php | 4 +- .../Model/Menu/Config/SchemaLocatorTest.php | 2 +- .../Backend/Model/Menu/Item/FactoryTest.php | 105 -- .../Magento/Backend/Model/Menu/ItemTest.php | 22 +- .../Translate/Inline/ConfigFactoryTest.php | 49 +- .../testsuite/Magento/Backup/MediaTest.php | 118 +- .../Backup/Model/BackupFactoryTest.php | 131 ++ .../testsuite/Magento/Backup/NomediaTest.php | 86 +- .../testsuite/Magento/Backup/SnapshotTest.php | 10 +- .../testsuite/Magento/Backup/_files/Fs.php} | 24 +- .../testsuite/Magento/Backup/_files/Ftp.php | 24 +- .../testsuite/Magento/Backup/_files/Gz.php | 27 +- .../Magento/Backup/_files/Helper.php | 64 + .../testsuite/Magento/Backup/_files/Tar.php} | 42 +- .../{pub/media => data/code}/.gitignore | 0 .../_files/{var/tmp => data/media}/.gitignore | 0 .../Backup/_files/data/pub/media/.gitignore | 0 .../Backup/_files/data/var/log/.gitignore | 0 .../testsuite/Magento/Backup/_files/io.php | 105 ++ .../Magento/Cache/Config/ConverterTest.php | 4 +- .../Captcha/Helper/Adminhtml/DataTest.php | 9 +- .../Magento/Captcha/Helper/DataTest.php | 42 +- .../Magento/Captcha/Model/CronTest.php | 22 +- .../Magento/Captcha/Model/DefaultTest.php | 9 +- .../Magento/Captcha/Model/ObserverTest.php | 15 +- .../Adminhtml/Product/Attribute/GridTest.php | 6 +- .../Block/Product/View/OptionsTest.php | 2 +- .../Model/Attribute/Config/ReaderTest.php | 4 +- .../Product/Attribute/Backend/MediaTest.php | 6 +- .../Model/Product/Option/Type/FileTest.php | 81 -- .../ProductTypes/Config/ConverterTest.php | 2 +- .../ProductTypes/Config/SchemaLocatorTest.php | 4 +- .../Checkout/Block/Cart/Item/RendererTest.php | 9 +- .../Magento/Checkout/Block/Cart/LinkTest.php | 32 +- .../Magento/Checkout/Block/LinkTest.php | 18 +- .../Checkout/Block/Onepage/SuccessTest.php | 8 +- .../Magento/Checkout/Model/SessionTest.php | 18 +- .../Magento/Checkout/_files/session.php | 48 + .../Cms/Model/Wysiwyg/Images/StorageTest.php | 20 +- .../Magento/Code/Generator/IoTest.php | 54 +- .../testsuite/Magento/Code/GeneratorTest.php | 52 +- .../Code/Minifier/Strategy/GenerateTest.php | 112 +- .../Code/Minifier/Strategy/LiteTest.php | 92 +- .../testsuite/Magento/Code/MinifierTest.php | 136 +- .../Code/Plugin/InvocationChainTest.php | 8 +- .../Code/Validator/ArgumentSequenceTest.php | 7 +- .../Validator/ConstructorIntegrityTest.php | 11 +- .../Code/Validator/ContextAggregationTest.php | 4 +- .../Code/Validator/TypeDuplicationTest.php | 5 +- .../Magento/Config/Converter/Dom/FlatTest.php | 6 +- .../Dom/Converter/ArrayConverterTest.php | 5 +- .../Magento/Config/Reader/FilesystemTest.php | 4 +- .../testsuite/Magento/Config/ThemeTest.php | 6 +- .../testsuite/Magento/Config/ViewTest.php | 4 +- .../testsuite/Magento/Convert/ExcelTest.php | 11 +- .../Core/App/Action/FormKeyValidatorTest.php | 2 +- .../Plugin/DispatchExceptionHandlerTest.php | 6 +- .../testsuite/Magento/Core/App/MediaTest.php | 56 +- .../Magento/Core/Helper/ThemeTest.php | 116 +- .../Core/Model/Config/FileResolverTest.php | 183 +-- .../Model/Config/Initial/ConverterTest.php | 2 +- .../Core/Model/Config/Initial/ReaderTest.php | 35 +- .../Model/DataService/Config/ReaderTest.php | 9 +- .../testsuite/Magento/Core/Model/DirTest.php | 132 -- .../Core/Model/File/Storage/ConfigTest.php | 90 +- .../Core/Model/File/Storage/RequestTest.php | 2 +- .../File/Storage/SynchronizationTest.php | 115 +- .../Layout/Argument/AbstractHandlerTest.php | 3 +- .../Layout/Argument/Handler/ArrayTest.php | 2 +- .../Layout/Argument/Handler/BooleanTest.php | 2 +- .../Layout/Argument/Handler/HelperTest.php | 4 +- .../Layout/Argument/Handler/NumberTest.php | 2 +- .../Layout/Argument/Handler/ObjectTest.php | 4 +- .../Layout/Argument/Handler/OptionsTest.php | 4 +- .../Layout/Argument/Handler/StringTest.php | 2 +- .../Model/Layout/Argument/Handler/UrlTest.php | 2 +- .../Magento/Core/Model/Layout/MergeTest.php | 72 +- .../Model/Layout/Update/ValidatorTest.php | 2 +- .../Hierarchy/Config/FileResolverTest.php | 56 +- .../Core/Model/Resource/Db/AbstractTest.php | 4 +- .../Core/Model/Resource/SessionTest.php | 16 +- .../Model/Resource/Setup/MigrationTest.php | 12 +- .../Magento/Core/Model/Session/ConfigTest.php | 26 +- .../Magento/Core/Model/StoreManagerTest.php | 24 +- .../Core/Model/Theme/Image/PathTest.php | 18 +- .../Translate/Inline/ConfigFactoryTest.php | 2 +- .../Magento/Cron/Model/ObserverTest.php | 2 +- .../Block/Account/AuthorizationLinkTest.php | 4 +- .../Customer/Block/Account/LinkTest.php | 17 +- .../Block/Account/RegisterLinkTest.php | 3 +- .../Controller/Adminhtml/IndexTest.php | 92 +- .../Model/Address/Config/ReaderTest.php | 4 +- .../Magento/DB/Adapter/Pdo/MysqlTest.php | 2 +- .../Block/Adminhtml/Editor/ContainerTest.php | 3 - .../Adminhtml/Editor/Tools/Code/JsTest.php | 30 +- .../Editor/Tools/Files/ContentTest.php | 14 +- .../Adminhtml/Editor/Tools/Files/TreeTest.php | 15 +- .../Entity/Attribute/Config/ConverterTest.php | 3 +- .../Block/Adminhtml/Template/EditTest.php | 38 +- .../Model/Template/Config/ReaderTest.php | 73 +- .../Email/Model/Template/Config/XsdTest.php | 72 - .../Magento/Event/Config/ConverterTest.php | 2 +- .../Event/Config/SchemaLocatorTest.php | 8 +- .../Magento/Filesystem/Directory/ReadTest.php | 103 ++ .../Filesystem/Directory/WriteTest.php | 90 ++ .../DirectoryList/VerificationTest.php | 249 ++++ .../Magento/Filesystem/DirectoryListTest.php | 164 +++ .../Filesystem/Stream/Mode/ZlibTest.php | 61 - .../Magento/Filesystem/Stream/ModeTest.php | 275 ---- .../unit/testsuite/Magento/FilesystemTest.php | 1027 --------------- .../Magento/Image/Adapter/AbstractTest.php | 48 +- .../Magento/Image/Adapter/ImageMagickTest.php | 3 +- .../Model/Export/Config/ConverterTest.php | 2 +- .../Model/Export/Config/SchemaLocatorTest.php | 4 +- .../Model/Export/Entity/AbstractEavTest.php | 11 +- .../Magento/ImportExport/Model/ExportTest.php | 4 +- .../Model/Import/Config/ConverterTest.php | 2 +- .../Model/Import/Config/SchemaLocatorTest.php | 4 +- .../Import/Entity/CustomerCompositeTest.php | 11 +- .../Entity/Eav/Customer/AddressTest.php | 1 + .../Model/Import/Source/CsvTest.php | 62 +- .../Magento/Index/App/IndexerTest.php | 9 +- .../Indexer/Config/SchemaLocatorTest.php | 4 +- .../Magento/Index/Model/Lock/StorageTest.php | 54 +- .../Magento/Index/Model/ProcessTest.php | 20 +- .../Install/App/Action/Plugin/DirTest.php | 64 +- .../Magento/Install/App/ConsoleTest.php | 34 +- .../Magento/Install/Block/BeginTest.php | 11 +- .../Magento/Install/Controller/WizardTest.php | 232 ++++ .../Install/Model/Installer/ConfigTest.php | 47 +- .../Magento/Install/Model/WizardTest.php | 88 ++ .../Controller/Adminhtml/IntegrationTest.php | 482 ++++--- .../Integration/Model/Config/XsdTest.php | 40 +- .../Model/Config/_files/integration.php | 3 +- .../Model/Config/_files/integration.xml | 1 + .../Magento/Integration/Model/ManagerTest.php | 4 +- .../Integration/Service/IntegrationV1Test.php | 31 + .../Integration/Service/OauthV1Test.php | 259 +++- .../Interception/Config/ConfigTest.php | 20 +- .../PluginList/PluginListTest.php | 12 +- .../unit/testsuite/Magento/Io/FileTest.php | 92 -- .../unit/testsuite/Magento/Log/LoggerTest.php | 31 +- .../testsuite/Magento/Log/Model/ShellTest.php | 3 +- .../Magento/Message/AbstractMessageTest.php | 116 ++ .../Magento/Message/CollectionTest.php | 228 ++++ .../testsuite/Magento/Message/ErrorTest.php | 26 +- .../testsuite/Magento/Message/ManagerTest.php | 198 +++ .../testsuite/Magento/Message/NoticeTest.php | 30 +- .../testsuite/Magento/Message/SuccessTest.php | 47 + .../testsuite/Magento/Message/WarningTest.php | 47 + .../Module/Declaration/Converter/DomTest.php | 4 +- .../Module/Declaration/FileResolverTest.php | 80 +- .../Declaration/Reader/FilesystemTest.php | 33 +- .../Magento/Module/Dir/ReaderTest.php | 7 +- .../unit/testsuite/Magento/Module/DirTest.php | 43 +- .../Magento/Module/ResourceResolverTest.php | 4 +- .../ObjectManager/Config/Mapper/DomTest.php | 4 +- .../Paygate/Model/Authorizenet/CardsTest.php | 108 ++ .../Magento/Payment/Block/InfoTest.php | 132 ++ .../Magento/Paypal/Helper/CheckoutTest.php | 4 +- .../Magento/Paypal/Model/PayflowlinkTest.php | 2 +- .../Magento/Paypal/Model/PayflowproTest.php | 84 ++ .../Magento/Persistent/Helper/DataTest.php | 2 +- .../Adminhtml/Items/AbstractItemsTest.php | 4 +- .../Block/Adminhtml/Items/AbstractTest.php | 4 +- .../Adminhtml/Order/Create/Items/GridTest.php | 18 +- .../Profile/Related/Orders/GridTest.php | 4 +- .../Adminhtml/Order/CreditmemoTest.php | 23 +- .../Sales/Model/Config/ConverterTest.php | 4 +- .../Magento/Sales/Model/Order/PaymentTest.php | 49 + .../Sales/Model/Order/Pdf/AbstractTest.php | 4 +- .../Model/Order/Pdf/Config/ReaderTest.php | 4 +- .../Sales/Model/Order/Pdf/InvoiceTest.php | 24 +- .../Magento/Sales/Model/OrderTest.php | 115 +- .../Sales/Model/Resource/QuoteTest.php | 102 ++ .../Magento/SalesRule/Model/ValidatorTest.php | 6 +- .../Session/SaveHandler/DbTableTest.php | 329 +++++ .../Session/SaveHandlerFactoryTest.php | 55 + .../Magento/Sitemap/Model/SitemapTest.php | 220 ++-- .../Tools/Migration/Acl/Db/FileReaderTest.php | 3 +- .../Migration/Acl/GeneratorRemoveTest.php | 4 +- .../Tools/Migration/Acl/GeneratorSaveTest.php | 6 +- .../Tools/Migration/Acl/GeneratorTest.php | 58 +- .../Migration/Acl/Menu/GeneratorTest.php | 28 +- .../Tools/View/Generator/CopyRuleTest.php | 45 +- .../View/Generator/ThemeDeploymentTest.php | 37 +- .../View/Generator/_files/fixture_themes.php | 42 +- .../System/Design/Theme/Tab/CssTest.php | 1 - .../Adminhtml/Wysiwyg/Files/ContentTest.php | 13 +- .../Adminhtml/Wysiwyg/Files/TreeTest.php | 15 +- .../Magento/Theme/Block/Html/HeaderTest.php | 28 +- .../Magento/Theme/Helper/StorageTest.php | 276 ++-- .../Magento/Theme/Model/CopyServiceTest.php | 37 +- .../Theme/Model/Uploader/ServiceTest.php | 41 +- .../Theme/Model/Wysiwyg/StorageTest.php | 151 +-- .../Magento/Validator/ConfigTest.php | 6 +- ...k.xml => invalid_content_for_callback.xml} | 0 .../Magento/View/Asset/MergeServiceTest.php | 19 +- .../View/Asset/MergeStrategy/ChecksumTest.php | 97 +- .../View/Asset/MergeStrategy/DirectTest.php | 62 +- .../Asset/MergeStrategy/FileExistsTest.php | 39 +- .../Magento/View/Asset/MergedTest.php | 62 +- .../Magento/View/Asset/MinifyServiceTest.php | 18 +- .../Magento/View/DeployedFilesManagerTest.php | 4 +- .../View/Design/Fallback/FactoryTest.php | 77 +- .../Strategy/Fallback/CachingProxyTest.php | 103 +- .../FileResolution/Strategy/FallbackTest.php | 27 +- .../FileResolution/StrategyPoolTest.php | 18 +- .../Theme/Customization/AbstractFileTest.php | 24 +- .../Design/Theme/Customization/PathTest.php | 45 +- .../View/Design/Theme/Image/UploaderTest.php | 8 +- .../Magento/View/Design/Theme/ImageTest.php | 58 +- .../Magento/View/Element/TemplateTest.php | 33 +- .../View/Layout/File/Source/BaseTest.php | 55 +- .../Layout/File/Source/Override/BaseTest.php | 57 +- .../Layout/File/Source/Override/ThemeTest.php | 44 +- .../View/Layout/File/Source/ThemeTest.php | 58 +- .../Magento/View/TemplateEngine/PhpTest.php | 30 +- .../Magento/View/Url/CssResolverTest.php | 15 +- .../unit/testsuite/Magento/View/UrlTest.php | 20 +- .../Webapi/Controller/ErrorProcessorTest.php | 8 +- .../Magento/Webapi/Model/Soap/ConfigTest.php | 2 - .../Widget/Model/Widget/InstanceTest.php | 17 + .../Magento/Widget/Model/_files/widget.xml | 2 +- .../Widget/Model/_files/widget_config.php | 2 +- .../Di/Code/Scanner/XmlInterceptorScanner.php | 2 +- dev/tools/Magento/Tools/Di/compiler.php | 18 +- .../Magento/Tools/Di/entity_generator.php | 4 +- dev/tools/Magento/Tools/I18n/bootstrap.php | 6 +- .../Magento/Tools/Migration/Acl/Generator.php | 14 +- .../Tools/Migration/Acl/Menu/Generator.php | 10 +- .../System/Configuration/Generator.php | 4 +- .../Migration/System/Configuration/Reader.php | 2 +- .../Magento/Tools/View/Generator/Config.php | 17 +- .../Magento/Tools/View/Generator/CopyRule.php | 27 +- .../Tools/View/Generator/ThemeDeployment.php | 2 +- dev/tools/Magento/Tools/View/generator.php | 16 +- .../Magento/Tools/classmap/fs_generator.php | 6 +- .../Magento/Tools/classmap/log_generator.php | 2 +- dev/tools/bootstrap.php | 9 +- downloader/app/Magento/Downloader/Connect.php | 17 +- .../app/Magento/Downloader/Controller.php | 31 +- .../Model/Config/AbstractConfig.php | 2 +- .../app/Magento/Downloader/Model/Connect.php | 2 +- downloader/lib/Magento/Archive.php | 6 +- .../lib/Magento/Archive/AbstractArchive.php | 2 +- downloader/lib/Magento/Archive/Tar.php | 8 +- downloader/lib/Magento/Autoload/Simple.php | 2 +- .../lib/Magento/Backup/AbstractBackup.php | 2 +- downloader/lib/Magento/Backup/Factory.php | 34 +- downloader/lib/Magento/Backup/Filesystem.php | 2 +- .../Backup/Filesystem/Rollback/Ftp.php | 14 +- downloader/lib/Magento/Backup/Media.php | 107 +- downloader/lib/Magento/Backup/Nomedia.php | 8 +- downloader/lib/Magento/Backup/Snapshot.php | 14 +- downloader/lib/Magento/Connect/Command.php | 2 +- .../lib/Magento/Connect/Command/Install.php | 16 +- .../lib/Magento/Connect/Command/Registry.php | 16 +- .../lib/Magento/Connect/Command/Remote.php | 2 +- downloader/lib/Magento/Connect/Config.php | 8 +- downloader/lib/Magento/Connect/Converter.php | 13 +- downloader/lib/Magento/Connect/Loader/Ftp.php | 6 +- downloader/lib/Magento/Connect/Package.php | 14 +- .../lib/Magento/Connect/Package/Hotfix.php | 2 +- .../lib/Magento/Connect/Package/Writer.php | 8 +- downloader/lib/Magento/Connect/Packager.php | 28 +- downloader/lib/Magento/Connect/Validator.php | 2 +- downloader/lib/Magento/HTTP/Client.php | 2 +- downloader/lib/Magento/System/Dirs.php | 2 +- downloader/mage.php | 13 +- index.php | 2 +- lib/Magento/App/Action/Action.php | 16 +- lib/Magento/App/Action/Context.php | 18 +- lib/Magento/App/Action/Forward.php | 3 +- lib/Magento/App/Action/Redirect.php | 5 +- lib/Magento/App/ActionInterface.php | 4 +- lib/Magento/App/Cache/Frontend/Factory.php | 19 +- .../App/Config/FileResolver/Primary.php | 47 +- lib/Magento/App/Config/Loader.php | 14 +- lib/Magento/App/Dir.php | 339 ----- lib/Magento/App/Error/Handler.php | 12 +- lib/Magento/App/FrontController.php | 14 +- lib/Magento/App/Http.php | 18 +- .../ObjectManager/ConfigLoader/Primary.php | 23 +- lib/Magento/App/ObjectManagerFactory.php | 43 +- lib/Magento/App/Response/Http/FileFactory.php | 49 +- lib/Magento/App/State.php | 5 +- lib/Magento/Archive.php | 9 +- lib/Magento/Archive/AbstractArchive.php | 2 +- lib/Magento/Archive/Tar.php | 8 +- lib/Magento/Autoload/ClassMap.php | 2 +- lib/Magento/Autoload/IncludePath.php | 2 +- lib/Magento/Autoload/Simple.php | 2 +- lib/Magento/Backup/AbstractBackup.php | 2 +- lib/Magento/Backup/Filesystem.php | 4 +- .../Backup/Filesystem/Rollback/Ftp.php | 14 +- lib/Magento/Backup/Media.php | 107 +- lib/Magento/Backup/Nomedia.php | 8 +- lib/Magento/Backup/Snapshot.php | 14 +- lib/Magento/Code/Generator.php | 16 +- lib/Magento/Code/Generator/EntityAbstract.php | 15 +- lib/Magento/Code/Generator/Io.php | 63 +- lib/Magento/Code/Minifier.php | 36 +- .../Code/Minifier/Strategy/Generate.php | 45 +- lib/Magento/Code/Minifier/Strategy/Lite.php | 34 +- .../Code/Minifier/StrategyInterface.php | 4 +- .../Code/Validator/ArgumentSequence.php | 11 +- .../Code/Validator/ConstructorIntegrity.php | 9 +- .../Code/Validator/ContextAggregation.php | 3 +- .../Code/Validator/TypeDuplication.php | 3 +- lib/Magento/Config/AbstractXml.php | 13 +- lib/Magento/Config/FileIterator.php | 128 ++ lib/Magento/Config/FileIteratorFactory.php | 33 + lib/Magento/Config/Reader/Filesystem.php | 22 +- lib/Magento/Connect/Command.php | 2 +- lib/Magento/Connect/Command/Install.php | 4 +- lib/Magento/Connect/Command/Remote.php | 2 +- lib/Magento/Connect/Config.php | 6 +- lib/Magento/Connect/Converter.php | 15 +- lib/Magento/Connect/Loader/Ftp.php | 2 +- lib/Magento/Connect/Package.php | 16 +- lib/Magento/Connect/Package/Hotfix.php | 2 +- lib/Magento/Connect/Package/Writer.php | 16 +- lib/Magento/Connect/Packager.php | 16 +- lib/Magento/Convert/Excel.php | 4 +- lib/Magento/DB/Adapter/Pdo/Mysql.php | 39 +- lib/Magento/Data/Collection/Filesystem.php | 2 +- lib/Magento/Data/Form/Element/Gallery.php | 2 +- lib/Magento/Data/Form/FormKey.php | 8 +- lib/Magento/File/Uploader.php | 12 +- lib/Magento/Filesystem.php | 544 +++----- lib/Magento/Filesystem/Adapter/Local.php | 371 ------ lib/Magento/Filesystem/Adapter/Zlib.php | 131 -- lib/Magento/Filesystem/AdapterInterface.php | 183 --- lib/Magento/Filesystem/Directory/Read.php | 171 ++- .../Filesystem/Directory/ReadFactory.php | 44 + .../Filesystem/Directory/ReadInterface.php | 49 +- lib/Magento/Filesystem/Directory/Write.php | 211 ++- .../Filesystem/Directory/WriteFactory.php | 46 + .../Filesystem/Directory/WriteInterface.php | 39 +- lib/Magento/Filesystem/DirectoryList.php | 263 ++++ .../DirectoryList/Configuration.php | 83 ++ .../DirectoryList}/Verification.php | 92 +- lib/Magento/Filesystem/Driver/File.php | 706 ++++++++++ lib/Magento/Filesystem/Driver/Http.php | 245 ++++ .../FactoryInterface.php => Driver/Https.php} | 20 +- lib/Magento/Filesystem/Driver/Zlib.php | 34 + lib/Magento/Filesystem/DriverFactory.php | 68 + lib/Magento/Filesystem/DriverInterface.php | 337 +++++ lib/Magento/Filesystem/File/Read.php | 69 +- lib/Magento/Filesystem/File/ReadFactory.php | 22 +- lib/Magento/Filesystem/File/ReadInterface.php | 9 + lib/Magento/Filesystem/File/Write.php | 75 +- lib/Magento/Filesystem/File/WriteFactory.php | 30 +- .../Filesystem/File/WriteInterface.php | 4 +- lib/Magento/Filesystem/Stream/Local.php | 325 ----- lib/Magento/Filesystem/Stream/Mode.php | 172 --- lib/Magento/Filesystem/Stream/Mode/Zlib.php | 80 -- lib/Magento/Filesystem/StreamInterface.php | 136 -- lib/Magento/Filesystem/WrapperFactory.php | 67 + lib/Magento/Filesystem/WrapperInterface.php | 174 +++ lib/Magento/HTTP/Client.php | 2 +- lib/Magento/Image/Adapter/AbstractAdapter.php | 36 +- lib/Magento/Io/File.php | 6 +- lib/Magento/Io/Sftp.php | 2 +- lib/Magento/Logger.php | 29 +- lib/Magento/Message/AbstractMessage.php | 100 +- lib/Magento/Message/Collection.php | 75 +- lib/Magento/Message/Error.php | 9 +- lib/Magento/Message/Factory.php | 99 +- lib/Magento/Message/Manager.php | 275 ++++ lib/Magento/Message/ManagerInterface.php | 125 ++ lib/Magento/Message/MessageInterface.php | 110 ++ lib/Magento/Message/Notice.php | 9 +- .../Magento/Message/Session.php | 12 +- lib/Magento/Message/Success.php | 9 +- lib/Magento/Message/Warning.php | 9 +- .../Module/Declaration/FileIterator.php | 36 + .../Declaration/FileIteratorFactory.php | 34 + .../Module/Declaration/FileResolver.php | 65 +- lib/Magento/Module/Dir.php | 23 +- lib/Magento/Module/Dir/Reader.php | 50 +- lib/Magento/Module/ResourceResolver.php | 4 +- .../Object/Copy/Config/SchemaLocator.php | 8 +- .../ObjectManager/Config/SchemaLocator.php | 2 +- .../ObjectManager/DefinitionFactory.php | 51 +- lib/Magento/Pear.php | 37 +- lib/Magento/Pear/Package.php | 2 +- lib/Magento/Pear/Registry.php | 6 +- .../Session/Config/ConfigInterface.php | 168 ++- .../Magento/Session/Exception.php | 20 +- .../Model => lib/Magento}/Session/Generic.php | 30 +- lib/Magento/Session/SaveHandler.php | 119 ++ .../Magento/Session/SaveHandler/DbTable.php | 80 +- .../Magento/Session/SaveHandler/Native.php | 14 +- lib/Magento/Session/SaveHandlerException.php | 34 + lib/Magento/Session/SaveHandlerFactory.php | 83 ++ .../Magento/Session/SaveHandlerInterface.php | 19 +- lib/Magento/Session/SessionManager.php | 484 +++++++ .../Session/SessionManagerInterface.php | 161 +++ lib/Magento/Session/SidResolverInterface.php | 8 +- lib/Magento/Session/Storage.php | 85 ++ .../Magento/Session/StorageInterface.php | 31 +- .../Magento/Session/ValidatorInterface.php | 23 +- lib/Magento/Simplexml/Config/Cache/File.php | 2 +- lib/Magento/System/Dirs.php | 2 +- lib/Magento/Validator/Config.php | 2 +- lib/Magento/View/Asset/MergeService.php | 11 +- .../View/Asset/MergeStrategy/Checksum.php | 9 +- .../View/Asset/MergeStrategy/Direct.php | 28 +- .../View/Asset/MergeStrategy/FileExists.php | 2 +- lib/Magento/View/Asset/Merged.php | 22 +- lib/Magento/View/Asset/MinifyService.php | 23 +- lib/Magento/View/Config.php | 58 +- lib/Magento/View/Context.php | 27 +- lib/Magento/View/DeployedFilesManager.php | 6 +- lib/Magento/View/Design/Fallback/Factory.php | 26 +- .../FileResolution/Strategy/Fallback.php | 14 +- .../Strategy/Fallback/CachingProxy.php | 43 +- .../Design/FileResolution/StrategyPool.php | 16 +- .../Theme/Customization/AbstractFile.php | 21 +- .../View/Design/Theme/Customization/Path.php | 45 +- lib/Magento/View/Design/Theme/Image.php | 36 +- .../View/Design/Theme/Image/Uploader.php | 2 +- lib/Magento/View/Element/AbstractBlock.php | 21 +- lib/Magento/View/Element/Context.php | 24 +- lib/Magento/View/Element/Messages.php | 69 +- lib/Magento/View/Element/Template.php | 110 +- lib/Magento/View/Element/Template/Context.php | 27 +- lib/Magento/View/Layout/File/Source/Base.php | 32 +- .../View/Layout/File/Source/Override/Base.php | 33 +- .../Layout/File/Source/Override/Theme.php | 18 +- lib/Magento/View/Layout/File/Source/Theme.php | 31 +- lib/Magento/View/Publisher.php | 74 +- lib/Magento/View/Service.php | 12 +- lib/Magento/View/TemplateEngine/Php.php | 32 + lib/Magento/View/Url.php | 16 +- lib/Magento/View/Url/CssResolver.php | 51 +- lib/Zend/Session/Config/ConfigInterface.php | 52 - pub/.htaccess | 2 +- pub/get.php | 2 +- pub/index.php | 2 +- 1839 files changed, 23982 insertions(+), 28569 deletions(-) delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Button.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Container.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Form/Container.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Form/Element.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Form/Element/Dependence.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Form/Element/Gallery.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Form/Renderer/Element.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Form/Renderer/Fieldset.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Form/Renderer/Fieldset/Element.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/AbstractFilter.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Checkbox.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Country.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/FilterInterface.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Massaction.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Radio.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Range.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Select.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Store.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Theme.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Concat.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Country.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Input.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Longtext.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Massaction.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Radio.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/RendererInterface.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Select.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Store.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Wrapline.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Container.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/AbstractMassaction.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/Item.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/AdditionalInterface.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/DefaultAdditional.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Grid/Serializer.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/Tab/TabInterface.php delete mode 100644 app/code/Magento/Adminhtml/Block/Widget/View/Container.php delete mode 100644 app/code/Magento/Adminhtml/i18n/de_DE.csv delete mode 100644 app/code/Magento/Adminhtml/i18n/en_US.csv delete mode 100644 app/code/Magento/Adminhtml/i18n/es_ES.csv delete mode 100644 app/code/Magento/Adminhtml/i18n/fr_FR.csv delete mode 100644 app/code/Magento/Adminhtml/i18n/nl_NL.csv delete mode 100644 app/code/Magento/Adminhtml/i18n/pt_BR.csv delete mode 100644 app/code/Magento/Adminhtml/i18n/zh_CN.csv rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite.php (81%) rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Catalog/Category/Edit.php (87%) rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Catalog/Category/Tree.php (99%) rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Catalog/Edit/Form.php (94%) rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Catalog/Product/Edit.php (85%) rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Catalog/Product/Grid.php (93%) rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Cms/Page/Edit.php (86%) rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Cms/Page/Edit/Form.php (95%) rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Cms/Page/Grid.php (94%) rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Edit.php (92%) rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Edit/Form.php (97%) rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Link.php (97%) rename app/code/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Selector.php (98%) rename app/code/Magento/{Adminhtml/Controller => Backend/Controller/Adminhtml}/Urlrewrite.php (90%) rename app/code/Magento/{Adminhtml => Backend}/Helper/Addresses.php (97%) rename app/code/Magento/{Adminhtml => Backend}/Helper/Js.php (98%) rename app/code/Magento/{Adminhtml => Backend}/Helper/Media/Js.php (98%) rename app/code/Magento/{Adminhtml => Backend}/Model/Session/Quote.php (81%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/email/order/items.phtml (100%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/images/btn_bg.gif (100%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/images/btn_on_bg.gif (100%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/images/btn_over_bg.gif (100%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/images/error_msg_icon.gif (100%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/images/fam_bullet_error.gif (100%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/images/fam_bullet_success.gif (100%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/images/image-placeholder.png (100%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/images/note_msg_icon.gif (100%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/images/success_msg_icon.gif (100%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/images/warning_msg_icon.gif (100%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/layout/adminhtml_urlrewrite_index.xml (98%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/urlrewrite/categories.phtml (95%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/urlrewrite/edit.phtml (96%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/urlrewrite/selector.phtml (97%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/widget/tabshoriz.phtml (100%) rename app/code/Magento/{Adminhtml => Backend}/view/adminhtml/widget/tabsleft.phtml (100%) rename lib/Magento/App/Helper/HelperFactory.php => app/code/Magento/Backup/Model/BackupFactory.php (53%) rename app/code/Magento/{Email/etc/email_templates_file.xsd => Connect/etc/di.xml} (65%) delete mode 100644 app/code/Magento/Core/Model/Session/AbstractSession.php delete mode 100644 app/code/Magento/Core/Model/Session/Context.php create mode 100644 app/code/Magento/Customer/Model/Session/Storage.php rename app/code/Magento/{Adminhtml/etc/adminhtml/routes.xml => DesignEditor/etc/adminhtml/di.xml} (80%) create mode 100644 app/code/Magento/Email/Model/Template/Config/FileIterator.php create mode 100644 app/code/Magento/Email/Model/Template/Config/FileResolver.php rename app/code/Magento/{Core/Model/Session/Exception.php => Integration/sql/integration_setup/upgrade-1.0.0.1-1.0.0.2.php} (71%) create mode 100644 app/code/Magento/Integration/view/adminhtml/integration/tokens_exchange.phtml rename app/code/Magento/{Adminhtml/etc/module.xml => Integration/view/adminhtml/layout/adminhtml_integration_tokensexchange.xml} (77%) mode change 100755 => 100644 rename app/code/Magento/{Email/etc/email_templates_types.xsd => Theme/etc/adminhtml/di.xml} (54%) create mode 100644 app/code/Magento/Webapi/Model/Plugin/AuthorizationServiceV1.php rename app/design/adminhtml/magento_backend/{Magento_Adminhtml => Magento_Backend}/layout/default.xml (100%) create mode 100644 app/design/install/magento_basic/images/i_notice.gif create mode 100644 app/design/install/magento_basic/images/validation_advice_bg.gif delete mode 100644 dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/ContainerTest.php rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Catalog/Category/EditTest.php (87%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Catalog/Category/TreeTest.php (85%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Catalog/Edit/FormTest.php (95%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Catalog/Product/EditTest.php (86%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Catalog/Product/GridTest.php (88%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Cms/Page/Edit/FormTest.php (93%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Cms/Page/EditTest.php (87%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Cms/Page/GridTest.php (86%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend}/Block/Urlrewrite/Edit/FormTest.php (94%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend}/Block/Urlrewrite/EditTest.php (88%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend}/Block/Widget/Form/ContainerTest.php (89%) rename dev/tests/integration/testsuite/Magento/{Adminhtml/Block/Widget/Grid/Massaction => Backend/Block/Widget/Grid}/ItemTest.php (86%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend}/Block/Widget/TabsTest.php (91%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend/Block}/_files/form_key_disabled.php (100%) rename dev/tests/integration/testsuite/Magento/{Adminhtml => Backend/Block}/_files/form_key_disabled_rollback.php (100%) rename dev/tests/{unit/testsuite/Magento/Backup/_files/code/.gitignore => integration/testsuite/Magento/Core/Model/_files/design/var/log/exception.log} (100%) rename dev/tests/{unit/testsuite/Magento/Backup/_files/media/.gitignore => integration/testsuite/Magento/Core/Model/_files/design/var/log/system.log} (100%) create mode 100644 dev/tests/integration/testsuite/Magento/Customer/Model/SessionTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/session.php delete mode 100644 dev/tests/integration/testsuite/Magento/Filesystem/Adapter/LocalTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Filesystem/Adapter/ZlibTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Filesystem/FilesystemTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Filesystem/Stream/LocalTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Filesystem/Stream/ZlibTest.php create mode 100644 dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/_files/products_to_import_invalid_attribute_set.csv create mode 100644 dev/tests/integration/testsuite/Magento/Message/CollectionFactoryTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Message/FactoryTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Message/ManagerTest.php rename dev/tests/integration/testsuite/Magento/{Core/Model/Resource/SessionTest.php => Session/SaveHandler/DbTableTest.php} (93%) rename dev/tests/integration/testsuite/Magento/{Core/Model/Session/AbstractSessionTest.php => Session/SessionManagerTest.php} (80%) delete mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/AdminhtmlTest.php delete mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/adminhtml_decoupling.php delete mode 100644 dev/tests/unit/testsuite/Magento/App/Dir/VerificationTest.php rename dev/tests/unit/testsuite/Magento/{Adminhtml => Backend/Block}/Widget/Form/ContainerTest.php (91%) delete mode 100644 dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Item/FactoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Backup/Model/BackupFactoryTest.php rename dev/tests/{integration/testsuite/Magento/Adminhtml/Model/SessionTest.php => unit/testsuite/Magento/Backup/_files/Fs.php} (71%) rename app/code/Magento/Adminhtml/Block/Widget/Accordion.php => dev/tests/unit/testsuite/Magento/Backup/_files/Ftp.php (70%) rename app/code/Magento/Adminhtml/Block/Widget/Breadcrumbs.php => dev/tests/unit/testsuite/Magento/Backup/_files/Gz.php (69%) create mode 100644 dev/tests/unit/testsuite/Magento/Backup/_files/Helper.php rename dev/tests/{integration/testsuite/Magento/Adminhtml/Block/Widget/GridTest.php => unit/testsuite/Magento/Backup/_files/Tar.php} (58%) rename dev/tests/unit/testsuite/Magento/Backup/_files/{pub/media => data/code}/.gitignore (100%) rename dev/tests/unit/testsuite/Magento/Backup/_files/{var/tmp => data/media}/.gitignore (100%) create mode 100644 dev/tests/unit/testsuite/Magento/Backup/_files/data/pub/media/.gitignore create mode 100644 dev/tests/unit/testsuite/Magento/Backup/_files/data/var/log/.gitignore create mode 100644 dev/tests/unit/testsuite/Magento/Backup/_files/io.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FileTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/_files/session.php delete mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/DirTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Filesystem/Directory/ReadTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Filesystem/Directory/WriteTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Filesystem/DirectoryList/VerificationTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Filesystem/DirectoryListTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Filesystem/Stream/Mode/ZlibTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Filesystem/Stream/ModeTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/FilesystemTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Install/Controller/WizardTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Install/Model/WizardTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Io/FileTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Message/AbstractMessageTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Message/CollectionTest.php rename app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/Reauthorize.php => dev/tests/unit/testsuite/Magento/Message/ErrorTest.php (65%) create mode 100644 dev/tests/unit/testsuite/Magento/Message/ManagerTest.php rename lib/Magento/Filesystem/Stream/Zlib.php => dev/tests/unit/testsuite/Magento/Message/NoticeTest.php (65%) create mode 100644 dev/tests/unit/testsuite/Magento/Message/SuccessTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Message/WarningTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Paygate/Model/Authorizenet/CardsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Payment/Block/InfoTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Paypal/Model/PayflowproTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/PaymentTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Resource/QuoteTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Session/SaveHandler/DbTableTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Session/SaveHandlerFactoryTest.php rename dev/tests/unit/testsuite/Magento/Validator/_files/validation/negative/{invalid_content_for callback.xml => invalid_content_for_callback.xml} (100%) delete mode 100644 lib/Magento/App/Dir.php create mode 100644 lib/Magento/Config/FileIterator.php create mode 100644 lib/Magento/Config/FileIteratorFactory.php delete mode 100644 lib/Magento/Filesystem/Adapter/Local.php delete mode 100644 lib/Magento/Filesystem/Adapter/Zlib.php delete mode 100644 lib/Magento/Filesystem/AdapterInterface.php create mode 100644 lib/Magento/Filesystem/Directory/ReadFactory.php create mode 100644 lib/Magento/Filesystem/Directory/WriteFactory.php create mode 100644 lib/Magento/Filesystem/DirectoryList.php create mode 100644 lib/Magento/Filesystem/DirectoryList/Configuration.php rename lib/Magento/{App/Dir => Filesystem/DirectoryList}/Verification.php (53%) create mode 100644 lib/Magento/Filesystem/Driver/File.php create mode 100644 lib/Magento/Filesystem/Driver/Http.php rename lib/Magento/Filesystem/{Stream/FactoryInterface.php => Driver/Https.php} (77%) create mode 100644 lib/Magento/Filesystem/Driver/Zlib.php create mode 100644 lib/Magento/Filesystem/DriverFactory.php create mode 100644 lib/Magento/Filesystem/DriverInterface.php delete mode 100644 lib/Magento/Filesystem/Stream/Local.php delete mode 100644 lib/Magento/Filesystem/Stream/Mode.php delete mode 100644 lib/Magento/Filesystem/Stream/Mode/Zlib.php delete mode 100644 lib/Magento/Filesystem/StreamInterface.php create mode 100644 lib/Magento/Filesystem/WrapperFactory.php create mode 100644 lib/Magento/Filesystem/WrapperInterface.php create mode 100644 lib/Magento/Message/Manager.php create mode 100644 lib/Magento/Message/ManagerInterface.php create mode 100644 lib/Magento/Message/MessageInterface.php rename app/code/Magento/Adminhtml/Exception.php => lib/Magento/Message/Session.php (79%) create mode 100644 lib/Magento/Module/Declaration/FileIterator.php create mode 100644 lib/Magento/Module/Declaration/FileIteratorFactory.php rename app/code/Magento/Adminhtml/Block/Widget/Form.php => lib/Magento/Session/Exception.php (62%) rename {app/code/Magento/Core/Model => lib/Magento}/Session/Generic.php (61%) create mode 100644 lib/Magento/Session/SaveHandler.php rename app/code/Magento/Core/Model/Resource/Session.php => lib/Magento/Session/SaveHandler/DbTable.php (71%) rename app/code/Magento/Adminhtml/Block/Widget/Tabs.php => lib/Magento/Session/SaveHandler/Native.php (74%) create mode 100644 lib/Magento/Session/SaveHandlerException.php create mode 100644 lib/Magento/Session/SaveHandlerFactory.php rename app/code/Magento/Adminhtml/Block/Widget.php => lib/Magento/Session/SaveHandlerInterface.php (76%) create mode 100644 lib/Magento/Session/SessionManager.php create mode 100644 lib/Magento/Session/SessionManagerInterface.php create mode 100644 lib/Magento/Session/Storage.php rename app/code/Magento/Adminhtml/Model/Session.php => lib/Magento/Session/StorageInterface.php (71%) rename app/code/Magento/Adminhtml/Block/Widget/Accordion/Item.php => lib/Magento/Session/ValidatorInterface.php (71%) delete mode 100644 lib/Zend/Session/Config/ConfigInterface.php diff --git a/.htaccess b/.htaccess index 891fbd1f181..360a61895f3 100644 --- a/.htaccess +++ b/.htaccess @@ -32,7 +32,7 @@ ## adjust memory limit # php_value memory_limit 64M - php_value memory_limit 256M + php_value memory_limit 2048M php_value max_execution_time 18000 ############################################ @@ -176,7 +176,6 @@ order allow,deny deny from all </Files> - ############################################ ## If running in cluster environment, uncomment this ## http://developer.yahoo.com/performance/rules.html#etags diff --git a/CHANGELOG.md b/CHANGELOG.md index 4baa1101f39..5e9863bafdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,50 @@ +2.0.0.0-dev57 +============= +* Fixed bugs: + * Fixed [MAP]: "Click for price" link is broken on the category page + * Fixed tax rule search on the grid + * Fixed redirect on dashboard if "Search", "Reset", "Export" buttons are clicked on several pages + * Fixed switching user to alternate store-view when clicking on the Category (with Add Store Code to Urls="Yes" in the config) + * Fixed printing Order/Shipping/Credit Memo from backend + * Fixed 404 Error on attempt to print Shipping Label + * Fixed duplication of JavaScript Resources in head on frontend + * Fixed inconsistency with disabled states on Configurable product page in the Plushe theme + * Fixed 3D Secure Information absence on Admin Order Info page + * Fixed possibility to download or revert Backup + * Fixed session fixation in user registration during checkout + * Fixed fatal error during login to backend + * Fixed inline translations in the Adminhtml area + * Fixed partial refunds/invoices in Payflow Pro + * Fixed the issue with ignoring area in design emulation + * Fixed order placing with virtual product using Express Checkout + * Fixed the error during order placement with Recurring profile payment + * Fixed wrong redirect after customer registration during multishipping checkout + * Fixed inability to crate shipping labels + * Fixed inability to switch language, if the default language is English + * Fixed an issue with incorrect XML appearing in cache after some actions on the frontend + * Fixed product export + * Fixed inability to configure memcache as session save handler +* GitHub requests: + * [#406](https://github.com/magento/magento2/pull/406) -- Remove cast to (int) for the varch increment_id + * [#425](https://github.com/magento/magento2/issues/425) -- Installation of dev53 fails + * [#324](https://github.com/magento/magento2/pull/324) -- ImportExport: Easier debugging +* Modularity improvements: + * Removed \Magento\App\Helper\HelperFactory + * Removed the "helper" method from the abstract block interface + * Layout page type config moved to library + * Design loader moved to library + * Theme label moved to library + * Remaining part from Adminhtml moved to the appropriate modules. Adminhtml module has been eliminated + * Core Session and Cookie models decomposed and moved to library + * \Magento\Stdlib\Cookie library created + * Session Manager and Session Config interfaces provided + * Session save handler interface created + * Session storage interface created, session does not extend \Magento\Object anymore + * Session validator interface created + * Session generic wrapper moved to library + * Messages functionality moved from the Session model as separate component, message manager interface created + * Sid resolver interface created to handle session sid from request + 2.0.0.0-dev56 ============= * Fixed bugs: @@ -23,7 +70,7 @@ * Ability to delete API integrations that were not created using configuration files * Removed System REST menu item and all associated UX flows: * Users, Roles, and Webhook Subscriptions sub-menu items were removed -* Removed the Webhook module +* Removed the Webhook module until it can be refactored to use the new Authorization service 2.0.0.0-dev55 ============= diff --git a/app/bootstrap.php b/app/bootstrap.php index ddb065617c0..91b01777136 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -54,7 +54,6 @@ HTML; /**#@+ * Shortcut constants */ -define('DS', DIRECTORY_SEPARATOR); define('BP', dirname(__DIR__)); /**#@-*/ @@ -65,10 +64,10 @@ require_once BP . '/app/functions.php'; require_once __DIR__ . '/autoload.php'; \Magento\Autoload\IncludePath::addIncludePath(array( - BP . DS . 'app' . DS . 'code', - BP . DS . 'lib', + BP . '/app/code', + BP . '/lib', )); -$classMapPath = BP . DS . 'var/classmap.ser'; +$classMapPath = BP . '/var/classmap.ser'; if (file_exists($classMapPath)) { require_once BP . '/lib/Magento/Autoload/ClassMap.php'; $classMap = new \Magento\Autoload\ClassMap(BP); diff --git a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php index 44e74e36cde..f41f44ce2a8 100644 --- a/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php +++ b/app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php @@ -28,6 +28,25 @@ namespace Magento\AdminNotification\Block\Grid\Renderer; class Actions extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { + /** + * @var \Magento\Core\Helper\Url + */ + protected $_urlHelper; + + /** + * @param \Magento\Backend\Block\Context $context + * @param \Magento\Core\Helper\Url $urlHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Context $context, + \Magento\Core\Helper\Url $urlHelper, + array $data = array() + ) { + $this->_urlHelper = $urlHelper; + parent::__construct($context, $data); + } + /** * Renders grid column * @@ -46,7 +65,7 @@ class Actions __('Mark as Read') .'</a> | ' : ''; - $encodedUrl = $this->helper('Magento\Core\Helper\Url')->getEncodedUrl(); + $encodedUrl = $this->_urlHelper->getEncodedUrl(); return sprintf('%s%s<a href="%s" onClick="deleteConfirm(\'%s\', this.href); return false;">%s</a>', $readDetailsHtml, $markAsReadHtml, diff --git a/app/code/Magento/AdminNotification/Block/System/Messages.php b/app/code/Magento/AdminNotification/Block/System/Messages.php index c856cf0f7b2..3e09a6e2743 100644 --- a/app/code/Magento/AdminNotification/Block/System/Messages.php +++ b/app/code/Magento/AdminNotification/Block/System/Messages.php @@ -32,16 +32,24 @@ class Messages extends \Magento\Backend\Block\Template */ protected $_messages; + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\AdminNotification\Model\Resource\System\Message\Collection\Synchronized $messages + * @param \Magento\Core\Helper\Data $coreHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\AdminNotification\Model\Resource\System\Message\Collection\Synchronized $messages, + \Magento\Core\Helper\Data $coreHelper, array $data = array() ) { + $this->_coreHelper = $coreHelper; parent::__construct($context, $data); $this->_messages = $messages; } @@ -124,7 +132,7 @@ class Messages extends \Magento\Backend\Block\Template */ public function getSystemMessageDialogJson() { - return $this->helper('Magento\Core\Helper\Data')->jsonEncode(array( + return $this->_coreHelper->jsonEncode(array( 'systemMessageDialog' => array( 'autoOpen' => false, 'width' => 600, diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php index e79c4a49bd5..d031fa954b3 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php @@ -49,13 +49,12 @@ class Notification extends \Magento\Backend\App\AbstractAction try { $this->_objectManager->create('Magento\AdminNotification\Model\NotificationService') ->markAsRead($notificationId); - $this->_session->addSuccess( - __('The message has been marked as Read.') - ); + $this->messageManager->addSuccess(__('The message has been marked as Read.')); } catch (\Magento\Core\Exception $e) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_session->addException($e, + $this->messageManager->addException( + $e, __("We couldn't mark the notification as Read because of an error.") ); } @@ -92,7 +91,7 @@ class Notification extends \Magento\Backend\App\AbstractAction { $ids = $this->getRequest()->getParam('notification'); if (!is_array($ids)) { - $this->_session->addError(__('Please select messages.')); + $this->messageManager->addError(__('Please select messages.')); } else { try { foreach ($ids as $id) { @@ -103,13 +102,12 @@ class Notification extends \Magento\Backend\App\AbstractAction ->save(); } } - $this->_getSession()->addSuccess( - __('A total of %1 record(s) have been marked as Read.', count($ids)) - ); + $this->messageManager->addSuccess(__('A total of %1 record(s) have been marked as Read.', count($ids))); } catch (\Magento\Core\Exception $e) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_session->addException($e, + $this->messageManager->addException( + $e, __("We couldn't mark the notification as Read because of an error.") ); } @@ -131,13 +129,14 @@ class Notification extends \Magento\Backend\App\AbstractAction try { $model->setIsRemove(1) ->save(); - $this->_session->addSuccess( + $this->messageManager->addSuccess( __('The message has been removed.') ); } catch (\Magento\Core\Exception $e) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_session->addException($e, + $this->messageManager->addException( + $e, __("We couldn't remove the messages because of an error.") ); } @@ -152,9 +151,7 @@ class Notification extends \Magento\Backend\App\AbstractAction { $ids = $this->getRequest()->getParam('notification'); if (!is_array($ids)) { - $this->_session->addError( - __('Please select messages.') - ); + $this->messageManager->addError(__('Please select messages.')); } else { try { foreach ($ids as $id) { @@ -165,14 +162,11 @@ class Notification extends \Magento\Backend\App\AbstractAction ->save(); } } - $this->_getSession()->addSuccess( - __('Total of %1 record(s) have been removed.', count($ids)) - ); + $this->messageManager->addSuccess(__('Total of %1 record(s) have been removed.', count($ids))); } catch (\Magento\Core\Exception $e) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_session->addException($e, - __("We couldn't remove the messages because of an error.")); + $this->messageManager->addException($e, __("We couldn't remove the messages because of an error.")); } } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); diff --git a/app/code/Magento/AdminNotification/etc/adminhtml/menu.xml b/app/code/Magento/AdminNotification/etc/adminhtml/menu.xml index 1af3ee94b3b..6a4f223aad2 100644 --- a/app/code/Magento/AdminNotification/etc/adminhtml/menu.xml +++ b/app/code/Magento/AdminNotification/etc/adminhtml/menu.xml @@ -27,6 +27,6 @@ --> <config> <menu> - <add id="Magento_AdminNotification::system_adminnotification" title="Notifications" module="Magento_AdminNotification" sortOrder="10" parent="Magento_Adminhtml::system_other_settings" action="adminhtml/notification" resource="Magento_AdminNotification::adminnotification"/> + <add id="Magento_AdminNotification::system_adminnotification" title="Notifications" module="Magento_AdminNotification" sortOrder="10" parent="Magento_Backend::system_other_settings" action="adminhtml/notification" resource="Magento_AdminNotification::adminnotification"/> </menu> </config> diff --git a/app/code/Magento/AdminNotification/etc/adminhtml/routes.xml b/app/code/Magento/AdminNotification/etc/adminhtml/routes.xml index 01c3192ed6a..ff863ec256f 100644 --- a/app/code/Magento/AdminNotification/etc/adminhtml/routes.xml +++ b/app/code/Magento/AdminNotification/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_AdminNotification_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_AdminNotification" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/AdminNotification/etc/module.xml b/app/code/Magento/AdminNotification/etc/module.xml index 8548afe579f..ae252d011f3 100755 --- a/app/code/Magento/AdminNotification/etc/module.xml +++ b/app/code/Magento/AdminNotification/etc/module.xml @@ -27,11 +27,9 @@ <module name="Magento_AdminNotification" version="2.0.0.0" active="true"> <sequence> <module name="Magento_Core"/> - <module name="Magento_Adminhtml"/> </sequence> <depends> <module name="Magento_Core"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Backend"/> <module name="Magento_Theme"/> </depends> diff --git a/app/code/Magento/Adminhtml/Block/Widget/Button.php b/app/code/Magento/Adminhtml/Block/Widget/Button.php deleted file mode 100644 index fac04979d7d..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Button.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget; - -class Button extends \Magento\Backend\Block\Widget\Button -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Container.php b/app/code/Magento/Adminhtml/Block/Widget/Container.php deleted file mode 100644 index 74e2ae7d7a3..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Container.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget; - -class Container extends \Magento\Backend\Block\Widget\Container -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Form/Container.php b/app/code/Magento/Adminhtml/Block/Widget/Form/Container.php deleted file mode 100644 index b194e05fb6e..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Form/Container.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Form; - -class Container extends \Magento\Backend\Block\Widget\Form\Container -{ - protected $_blockGroup = 'Magento_Adminhtml'; -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Form/Element.php b/app/code/Magento/Adminhtml/Block/Widget/Form/Element.php deleted file mode 100644 index d57d85d3532..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Form/Element.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Form; - -class Element extends \Magento\Backend\Block\Widget\Form\Element -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Form/Element/Dependence.php b/app/code/Magento/Adminhtml/Block/Widget/Form/Element/Dependence.php deleted file mode 100644 index b1deb5f7acd..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Form/Element/Dependence.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Form\Element; - -class Dependence extends \Magento\Backend\Block\Widget\Form\Element\Dependence -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Form/Element/Gallery.php b/app/code/Magento/Adminhtml/Block/Widget/Form/Element/Gallery.php deleted file mode 100644 index e5dce87b531..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Form/Element/Gallery.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Form\Element; - -class Gallery extends \Magento\Backend\Block\Widget\Form\Element\Gallery -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Form/Renderer/Element.php b/app/code/Magento/Adminhtml/Block/Widget/Form/Renderer/Element.php deleted file mode 100644 index 38b8e3251a7..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Form/Renderer/Element.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Form\Renderer; - -class Element extends \Magento\Backend\Block\Widget\Form\Renderer\Element -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Form/Renderer/Fieldset.php b/app/code/Magento/Adminhtml/Block/Widget/Form/Renderer/Fieldset.php deleted file mode 100644 index 99285ba74a4..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Form/Renderer/Fieldset.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Form\Renderer; - -class Fieldset extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Form/Renderer/Fieldset/Element.php b/app/code/Magento/Adminhtml/Block/Widget/Form/Renderer/Fieldset/Element.php deleted file mode 100644 index d7689b0fe24..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Form/Renderer/Fieldset/Element.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset; - -class Element - extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid.php b/app/code/Magento/Adminhtml/Block/Widget/Grid.php deleted file mode 100644 index 81aaf8597dd..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget; - -class Grid extends \Magento\Backend\Block\Widget\Grid\Extended -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column.php deleted file mode 100644 index 0a94a823a30..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid; - -class Column extends \Magento\Backend\Block\Widget\Grid\Column -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/AbstractFilter.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/AbstractFilter.php deleted file mode 100644 index f1b5def35cf..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/AbstractFilter.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class AbstractFilter - extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilter -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Checkbox.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Checkbox.php deleted file mode 100644 index c4b588bed14..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Checkbox.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class Checkbox - extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Checkbox -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Country.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Country.php deleted file mode 100644 index d40271a29ec..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Country.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class Country - extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Country -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php deleted file mode 100644 index 54e60bc7e11..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class Date extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Date -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php deleted file mode 100644 index c542f50d918..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class Datetime - extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Datetime -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/FilterInterface.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/FilterInterface.php deleted file mode 100644 index c5237ef0516..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/FilterInterface.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -interface FilterInterface - extends \Magento\Backend\Block\Widget\Grid\Column\Filter\FilterInterface -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Massaction.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Massaction.php deleted file mode 100644 index 66637953647..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Massaction.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class Massaction - extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Massaction -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php deleted file mode 100644 index 93bf93ec718..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class Price extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Price -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Radio.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Radio.php deleted file mode 100644 index b3a0da3dcd6..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Radio.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class Radio extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Radio -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Range.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Range.php deleted file mode 100644 index 6ce0c118d47..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Range.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class Range extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Range -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Select.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Select.php deleted file mode 100644 index c06668058d9..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Select.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class Select extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Store.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Store.php deleted file mode 100644 index b1deb440c06..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Store.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class Store extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Store -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php deleted file mode 100644 index 0a980c1c2b5..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class Text extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Text -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Theme.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Theme.php deleted file mode 100644 index 06dd4f193b3..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Filter/Theme.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Filter; - -class Theme extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Theme -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php deleted file mode 100644 index 75a3412fdf6..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class AbstractRenderer - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php deleted file mode 100644 index e62529f3ab9..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Action - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php deleted file mode 100644 index bb4fe69e36f..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Checkbox - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Checkbox -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Concat.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Concat.php deleted file mode 100644 index ef3fe84173a..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Concat.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Concat - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Concat -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Country.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Country.php deleted file mode 100644 index b31bdd9c9b5..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Country.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Country - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Country -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php deleted file mode 100644 index e0d2dfc3e56..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Currency - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Currency -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php deleted file mode 100644 index 79d03bf48a6..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Date extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Date -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php deleted file mode 100644 index e9971e67ec9..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Datetime - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Datetime -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Input.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Input.php deleted file mode 100644 index 7b3b401526f..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Input.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Input - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Input -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php deleted file mode 100644 index a2e200db66e..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Ip extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Ip -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Longtext.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Longtext.php deleted file mode 100644 index c61973cf581..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Longtext.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Longtext - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Longtext -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Massaction.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Massaction.php deleted file mode 100644 index e244b533689..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Massaction.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Massaction - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Massaction -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php deleted file mode 100644 index b8d7fdf297a..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Number - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Number -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php deleted file mode 100644 index 045027096df..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Options - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Options -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php deleted file mode 100644 index 6c0b60ac111..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Price - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Price -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Radio.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Radio.php deleted file mode 100644 index 40d94c01a3e..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Radio.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Radio - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Radio -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/RendererInterface.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/RendererInterface.php deleted file mode 100644 index 3332a7b88eb..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/RendererInterface.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -interface RendererInterface - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\RendererInterface -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Select.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Select.php deleted file mode 100644 index d2487c6ec4c..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Select.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Select - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Select -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Store.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Store.php deleted file mode 100644 index bed9d2d8d4b..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Store.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Store - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Store -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php deleted file mode 100644 index e85825c2242..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Text extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Wrapline.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Wrapline.php deleted file mode 100644 index 25299aaf29f..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Column/Renderer/Wrapline.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Column\Renderer; - -class Wrapline - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Wrapline -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Container.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Container.php deleted file mode 100644 index 190fdd789a3..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Container.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid; - -class Container extends \Magento\Backend\Block\Widget\Grid\Container -{ - protected $_blockGroup = 'Magento_Adminhtml'; -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction.php deleted file mode 100644 index 6d77c30c186..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid; - -class Massaction extends \Magento\Adminhtml\Block\Widget\Grid\Massaction\AbstractMassaction -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/AbstractMassaction.php deleted file mode 100644 index 7787fa5970b..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/AbstractMassaction.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Massaction; - -class AbstractMassaction extends \Magento\Backend\Block\Widget\Grid\Massaction\Extended -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/Item.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/Item.php deleted file mode 100644 index 0478be3692c..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/Item.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Massaction; - -class Item extends \Magento\Backend\Block\Widget\Grid\Massaction\Item -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/AdditionalInterface.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/AdditionalInterface.php deleted file mode 100644 index 78a7a826f63..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/AdditionalInterface.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Massaction\Item\Additional; - -interface AdditionalInterface - extends \Magento\Backend\Block\Widget\Grid\Massaction\Item\Additional\AdditionalInterface -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/DefaultAdditional.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/DefaultAdditional.php deleted file mode 100644 index f79959b4034..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/DefaultAdditional.php +++ /dev/null @@ -1,39 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid\Massaction\Item\Additional; - -class DefaultAdditional - extends \Magento\Backend\Block\Widget\Grid\Massaction\Item\Additional\DefaultAdditional -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Grid/Serializer.php b/app/code/Magento/Adminhtml/Block/Widget/Grid/Serializer.php deleted file mode 100644 index 3cc589d377c..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Grid/Serializer.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Grid; - -class Serializer extends \Magento\Backend\Block\Widget\Grid\Serializer -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/Tab/TabInterface.php b/app/code/Magento/Adminhtml/Block/Widget/Tab/TabInterface.php deleted file mode 100644 index d0516ac8c7b..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/Tab/TabInterface.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\Tab; - -interface TabInterface extends \Magento\Backend\Block\Widget\Tab\TabInterface -{ - -} diff --git a/app/code/Magento/Adminhtml/Block/Widget/View/Container.php b/app/code/Magento/Adminhtml/Block/Widget/View/Container.php deleted file mode 100644 index a7640e48a49..00000000000 --- a/app/code/Magento/Adminhtml/Block/Widget/View/Container.php +++ /dev/null @@ -1,38 +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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block\Widget\View; - -class Container extends \Magento\Backend\Block\Widget\View\Container -{ - protected $_blockGroup = 'Magento_Adminhtml'; -} diff --git a/app/code/Magento/Adminhtml/i18n/de_DE.csv b/app/code/Magento/Adminhtml/i18n/de_DE.csv deleted file mode 100644 index 5e27124f3b6..00000000000 --- a/app/code/Magento/Adminhtml/i18n/de_DE.csv +++ /dev/null @@ -1,1144 +0,0 @@ -" The customer does not exist in the system anymore.","Der Kunde ist im System nicht mehr vorhanden." -" You will need to navigate to your ","Begeben Sie sich zu Ihrem" -" [deleted]"," [gelöscht]" -" and "," und " -" and go to the "," und gehen Sie nach " -" sections for your Hosted Checkout Pages."," Abschnitte für Ihre Hosted-Checkout-Seiten" -"%s (Default Template from Locale)","%s (Standardvorlage von Gebietsschema)" -"%s cache type(s) disabled.","%s Cachetyp(en) deaktiviert." -"%s cache type(s) enabled.","%s Cachetyp(en) aktiviert." -"%s cache type(s) refreshed.","%s Cachetyp(en) aktualisiert." -"(For Type ""Local Server"" need to use relative path to Magento install var/export or var/import, e.g. var/export, var/import, var/export/some/dir, var/import/some/dir)","(yp ""Lokaler Server"" muss die relative Pfadangabe zu Magento install var/export oder var/import nutzen, z.B. var/export, var/import, var/export/some/dir, var/import/some/dir)" -"(For US 2-letter state names)","(Für USA Bundesstaatabkürzungen aus 2 Buchstaben)" -"(If left empty will be auto-generated)","(Wert wird automatisch generiert, wenn leer)" -"(Leave empty for first spreadsheet)","(Frei lassen bei erstem Tabellenkalkulationsblatt)" -"(Products will be added/updated to this store if 'store' column is blank or missing in the import file.)","(Produkte werden zu diesem Laden hinzugefügt/aktualisiert, wenn die Spalte 'Laden' leer ist oder in der Importdatei fehlt.)" -"(Shift-)Click or drag to change value","Zum Ändern des Wertes (Umschalt-)klicken oder ziehen." -"(Starting with)","(Beginnt mit)" -"(When 'No', only mapped fields will be imported. When mapping, use 'column1', 'column2', etc.)","(Bei ""Nein"" werden nur die gemappten Felder importiert. Benutzen sie beim Übernehmen der Felder 'spalte1', 'spalte2', etc.)" -"(You have to increase php memory_limit before changing this value)","(Sie müssen das php-Speicherlimit erhöhen, bevor Sie diesen Wert ändern können.)" -"(\\t for tab)","(\t für Tab)" -"* - If indexing is in progress, it will be killed and new indexing process will start.","* - Wenn die Indexerstellung in Bearbeitung ist, wird sie abgebrochen und ein neuer Indexerstellungsprozess wird gestartet." -"- Click on any of the time parts to increase it","- Klicken Sie auf einen Zeitanteil, um ihn zu erhöhen." -"- Hold mouse button on any of the above buttons for faster selection.","- Halten Sie die Maustaste auf eine der obigen Schaltflächen, um die Auswahl zu beschleunigen." -"- Use the %s buttons to select month","- Wählen Sie den Monat mit den %s-Schaltflächen aus." -"- Use the %s, %s buttons to select year","- Wählen Sie das Jahr mit den %s-Schaltflächen aus." -"- or Shift-click to decrease it","- oder Umschalt-Klicken Sie, um den Wert zu verringern" -"- or click and drag for faster selection.","- oder Klicken und Ziehen Sie, um die Auswahl schneller zu treffen." -"-- Not Selected --","-- Nicht gewählt --" -"-- Please Select --","-- Bitte auswählen --" -"-- Please Select Billing Agreement--","-- Bitte Rechnungsvereinbarung auswählen --" -"-- Please Select a Category --","-- Bitte eine Kategorie auswählen --" -"-- Please select --","-- Bitte auswählen --" -"--Please Select--","-- Bitte auswählen --" -"1 Hour","1 Stunde" -"1. set up","1. einrichten" -"12 Hours","12 Stunden" -"12h AM/PM","12h AM/PM" -"2 Hours","2 Stunden" -"2. customize","2. anpassen" -"24 Hours","24 Stunden" -"24h","24h" -"2YTD","2 Jahr bis Datum" -"6 Hours","6 Stunden" -"<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>","<h1 class=""page-heading"">404 Fehler</h1><p>Seite nicht gefunden.</p>" -"<strong>Attention</strong>: Captcha is case sensitive.","<strong>Achtung</strong>: Beim Captcha Groß- und Kleinschreibung beachten." -"A user with the same user name or email aleady exists.","Ein Benutzer mit demselben Benutzernamen oder derselben E-Mail-Adresse ist bereits vorhanden." -"API Key","API-Schlüssel" -"API Key Confirmation","Bestätigung API-Schlüssel" -"ASCII","ASCII" -"Abandoned Carts","Aufgegebene Einkaufswagen" -"About the calendar","Über den Kalender" -"Access Denied","Zugriff verweigert" -"Access denied","Zugriff verweigert" -"Access denied.","Zugriff verweigert." -"Account Created in:","Konto erstellt in:" -"Account Created on (%s):","Konto erstellt am (%s):" -"Account Created on:","Konto erstellt am:" -"Account Information","Kontoinformationen" -"Account Status","Kontostatus" -"Account status","Kontostatus" -"Action","Aktion" -"Actions","Aktionen" -"Actions XML","Aktionen XML" -"Active","Aktiv" -"Add","Hinzufügen" -"Add \Exception","Ausnahme hinzufügen" -"Add Field Mapping","Feldzuordnung hinzufügen" -"Add Field with URL:","Feld mit folgender URL hinzufügen:" -"Add New","Neues hinzufügen" -"Add New Image","Neues Bild hinzufügen" -"Add New Profile","Neues Profil hinzufügen" -"Add New Role","Neue Rolle hinzufügen" -"Add New Template","Neue Vorlage hinzufügen" -"Add New URL Rewrite","Neues URL-Rewrite hinzufügen" -"Add New User","Neuen Benutzer hinzufügen" -"Add New Variable","Neue Variable hinzufügen" -"Add Products","Produkte hinzufügen" -"Add URL Rewrite","URL-Rewrite hinzufügen" -"Add URL Rewrite for a Category","URL-Rewrite für eine Kategorie hinzufügen" -"Add URL Rewrite for a Product","URL-Rewrite für ein Produkt hinzufügen" -"Add after","Hinzufügen nach" -"Additional Cache Management","Verwaltung von zusätzlichem Cache" -"Address Type:","Adressentyp:" -"Admin","Admin" -"Advanced Admin Section","Erweiterter Admin-Bereich" -"Advanced Profiles","Erweiterte Profile" -"Advanced Section","Erweiterter Bereich" -"All","Alle" -"All Allowed Countries","Alle erlaubten Länder" -"All Cache","Alle Caches" -"All Files","Alle Dateien" -"All Reviews","Alle Beurteilungen" -"All Store Views","Alle Ladenansichten" -"All Websites","Alle Websites" -"All countries","Alle Länder" -"All fields","Alle Felder" -"All possible rates were fetched, please click on ""Save"" to apply","Alle verfügbaren Preise wurden geladen, bitte klicken sie auf ""Speichern"" um diese zu übernehmen." -"All rates were fetched, please click on ""Save"" to apply","Alle Preise wurden geladen, bitte klicken sie auf ""Speichern"" um diese zu übernehmen." -"All valid rates have been saved.","Alle gültigen Tarife wurden gespeichert." -"Always (during development)","Immer (während der Entwicklung)" -"Amounts","Beträge" -"An error has occurred while syncronizing media storages.","Während der Synchronisation der Speichermedien ist ein Fehler aufgetreten." -"An error occurred while clearing the JavaScript/CSS cache.","Beim Leeren des JavaScript/CSS-Caches ist ein Fehler aufgetreten." -"An error occurred while clearing the image cache.","Beim Leeren des Bild-Caches ist ein Fehler aufgetreten." -"An error occurred while deleting URL Rewrite.","Beim Löschen des URL-Rewrites ist ein Fehler aufgetreten." -"An error occurred while deleting email template data. Please review log and try again.","Beim Löschen der E-Mail-Vorlagendaten ist ein Fehler aufgetreten. Überprüfen Sie das Protokoll und versuchen Sie es erneut." -"An error occurred while deleting record(s).","Ein Fehler ist bei der Eintragungslöschung aufgetreten." -"An error occurred while deleting this role.","Beim Löschen dieser Rolle ist ein Fehler aufgetreten." -"An error occurred while deleting this set.","Beim Löschen dieser Menge ist ein Fehler aufgetreten." -"An error occurred while deleting this template.","Beim Löschen dieser Vorlage ist ein Fehler aufgetreten." -"An error occurred while finishing process. Please refresh the cache","Beim Fertigstellen des Vorgangs ist ein Fehler aufgetreten. Aktualisieren Sie den Cache." -"An error occurred while rebuilding the CatalogInventory Stock Status.","Beim erneuten Aufbau des CatalogInventory-Bestandsstatus ist ein Fehler aufgetreten." -"An error occurred while rebuilding the catalog index.","Beim erneuten Aufbau des Katalogindexes ist ein Fehler aufgetreten." -"An error occurred while rebuilding the flat catalog category.","Beim erneuten Aufbau der Flat Catalog-Kategorie ist ein Fehler aufgetreten." -"An error occurred while rebuilding the flat product catalog.","Beim erneuten Aufbau des Flat Product Catalog ist ein Fehler aufgetreten." -"An error occurred while rebuilding the search index.","Beim erneuten Aufbau des Suchindexes ist ein Fehler aufgetreten." -"An error occurred while refreshing the Catalog Rewrites.","Beim Aktualisieren der Katalog-Rewrites ist ein Fehler aufgetreten." -"An error occurred while refreshing the Layered Navigation indices.","Beim Aktualisieren der Layered Navigation-Indizes ist ein Fehler aufgetreten." -"An error occurred while refreshing the catalog rewrites.","Während des Neuladens der umgeschriebenen Kataloge ist ein Fehler aufgetreten." -"An error occurred while refreshing the layered navigation indices.","Während des Neuladens der Layered Navigation ist ein Fehler aufgetreten." -"An error occurred while saving URL Rewrite.","Beim Speichern des URL-Rewrites ist ein Fehler aufgetreten." -"An error occurred while saving account.","Beim Speichern des Kontos ist ein Fehler aufgetreten." -"An error occurred while saving review.","Beim Speichern der Bewertung ist ein Fehler aufgetreten." -"An error occurred while saving the customer.","Beim Speichern des Kunden ist ein Fehler aufgetreten." -"An error occurred while saving this configuration:","Beim Speichern der Konfiguration ist ein Fehler aufgetreten." -"An error occurred while saving this role.","Beim Speichern dieser Rolle ist ein Fehler aufgetreten." -"An error occurred while saving this template.","Beim Speichern dieser Vorlage ist ein Fehler aufgetreten." -"An error occurred while updating the selected review(s).","Beim Aktualisieren der ausgewählten Beurteilung(en) ist ein Fehler aufgetreten." -"Any","Beliebig" -"Any Attribute Set","Attributmenge beliebig" -"Any Group","Gruppe beliebig" -"Any Status","Status beliebig" -"Any Store","Laden beliebig" -"Any Type","Typ beliebig" -"Any Visibility","Sichtbarkeit beliebig" -"Any data created since the backup was made will be lost including admin users, customers and orders.","Sämtliche seit dem Backup erstellten Daten gehen verloren, einschließlich der Administratoren, Kunden und Bestellungen." -"Archive file name:","Dateinamen archivieren:" -"Are you sure that you want to delete this template?","Diese Vorlage wirklich löschen?" -"Are you sure that you want to strip tags?","Tags wirklich entfernen?" -"Are you sure you want to do this?","Diesen Vorgang wirklich ausführen?" -"Are you sure you want to proceed?","Sind Sie sicher, dass Sie fortfahren möchten?" -"Area","Bereich" -"As low as:","Unterster Wert:" -"Assigned","Zugewiesen" -"Attribute Set Name:","Name der Attributmenge:" -"Attributes","Attribute" -"Automatic","Automatisch" -"Average","Durchschnittlicher Bestellungsbetrag" -"Average Orders","Bestellungen durchschnittlich" -"BINARY","BINÄR" -"Back","Zurück" -"Back to Login","Zurück zur Anmeldung" -"Backup","Sichern" -"Backup Name","Backup-Name" -"Backup options","Backup-Optionen" -"Backups","Sicherungskopien" -"Base currency","Basiswährung" -"Bcc","Bcc" -"Bestsellers","Am meisten verkauft" -"Billing Address","Rechnungsanschrift" -"Billing Address: ","Rechnungsanschrift:" -"Billing Agreement","Rechnungsvereinbarung" -"Billing Agreements","Rechnungsvereinbarungen" -"Block Information","Information sperren" -"Both (without and with tax)","Beides (mit und ohne Steuern)" -"Both IPN and PDT","Sowohl IPN als auch PDT" -"Browse Files...","Dateien durchsuchen ..." -"Bundle with dynamic pricing cannot include custom defined options. Options will not be saved.","Bündelung mit dynamischer Preisgebung darf keine benutzerdefinierten Optionen enthalten. Optionen werden nicht gespeichert." -"CMS","CMS" -"CRITICAL","kritisch" -"CSV","CSV" -"CSV / Tab separated","CSV / Tab-getrennt" -"Cache Control","Cache-Steuerung" -"Cache Control (beta)","Cache-Steuerung (beta)" -"Cache Management","Cache-Verwaltung" -"Cache Type","Cache-Typ" -"Cancel","Abbrechen" -"Cannot add new comment.","Neuer Kommentar kann nicht hinzugefügt werden." -"Cannot add tracking number.","Trackingnummer kann nicht hinzugefügt werden." -"Cannot create an invoice without products.","Rechnung kann nicht ohne Produkte erstellt werden." -"Cannot create credit memo for the order.","Gutschrift für die Bestellung kann nicht erstellt werden." -"Cannot delete the design change.","Designänderung kann nicht gelöscht werden." -"Cannot delete tracking number.","Trackingnummer kann nicht gelöscht werden." -"Cannot do shipment for the order separately from invoice.","Lieferung für die Bestellung kann nicht von der Rechnung getrennt erfolgen." -"Cannot do shipment for the order.","Lieferung für die Bestellung kann nicht ausgeführt werden." -"Cannot initialize shipment for adding tracking number.","Lieferung kann nicht initialisiert werden - Trackingnummer hinzugefügt." -"Cannot initialize shipment for delete tracking number.","Lieferung kann nicht initialisiert werden - Trackingnummer gelöscht." -"Cannot load track with retrieving identifier.","Track kann nicht mit Abrufkennzeichen geladen werden." -"Cannot retrieve tracking number detail.","Trackingnummerdetail kann nicht abgerufen werden." -"Cannot save shipment.","Lieferung kann nicht gespeichert werden." -"Cannot save the credit memo.","Die Gutschrift kann nicht gespeichert werden." -"Cannot send shipment information.","Die Lieferdaten können nicht gesendet werden." -"Cannot update item quantity.","Artikelmenge kann nicht aktualisiert werden." -"Cannot update the item\'s quantity.","Artikelmenge kann nicht aktualisiert werden." -"Catalog","Katalog" -"Catalog Price Rules","Katalogpreisregeln" -"Catalog Rewrites","Katalog-Rewrites" -"Categories","Kategorien" -"Category:","Kategorie:" -"Chart is disabled. If you want to enable chart, click <a href=""%s"">here</a>.","Chart ist deaktiviert. Wenn Sie den Chart aktivieren wollen, klicken Sie <a href=""%s"">hier</a> ." -"Checkbox","Kontrollkästchen" -"Child Transactions","Kindertransaktionen" -"Choose Store View:","Shopansicht auswählen:" -"Choose an attribute","Ein Attribut auswählen" -"Chosen category does not associated with any website, so url rewrite is not possible.","Gewählte Kategorie ist mit keiner Webseite verbunden, ein Überschreiben der URL ist nicht möglich." -"Chosen product does not associated with any website, so url rewrite is not possible.","Gewähltes Produkt ist mit keiner Webseite verbunden, ein Überschreiben der URL ist nicht möglich." -"Clear","Auswahl aufheben" -"Close","Schließen" -"Comment text field cannot be empty.","Das Textfeld für Kommentare darf nicht leer sein." -"Complete","Abgeschlossen" -"Configuration","Konfiguration" -"Confirm New Password","Neues Passwort bestätigen" -"Confirmed email:","Bestätigte E-Mail-Adresse:" -"Connect with the Magento Community","Mit der Magento-Community verbinden" -"Continue","Weiter" -"Continuous","Durchgängig" -"Convert to Plain Text","In unformatierten Text konvertieren" -"Cookie (unsafe)","Cookie (unsicher)" -"Country","Land" -"Country:","Land:" -"Coupons","Coupons" -"Create","Erstellen" -"Create DB Backup","DB-Sicherungskopie erstellen" -"Create New Attribute","Neues Attribut erstellen" -"Create URL Rewrite:","URL-Rewrite erstellen:" -"Created At","Erstellt um" -"Credit Card %s","Kreditkarten" -"Credit Memo History","Gutschriftverlauf" -"Credit Memo Totals","Gutschriftensummen" -"Credit Memos","Gutschriften" -"Credit memo #%s comment added","Gutschrift #%s Kommentar hinzugefügt" -"Credit memo #%s created","Gutschrift #%s erstellt" -"Credit memo\'s total must be positive.","Die Summe aller Gutschriften muss positiv sein." -"Currency","Währung" -"Currency ""%s"" is used as %s in %s.","Währung ""%s"" wird verwendet als %s in %s." -"Currency Information","Währungsdaten" -"Currency Setup Section","Bereich für Währungseinstellung" -"Current Configuration Scope:","Aktueller Konfigurationsumfang:" -"Current Month","Aktueller Monat" -"Custom","Benutzerdefiniert" -"Custom Variable ""%s""","Benutzerdefinierte Variable ""% s""" -"Custom Variables","Benutzerdefinierte Variablen" -"Customer","Kunde" -"Customer Group:","Kundengruppe:" -"Customer Groups","Kundengruppen" -"Customer","Kundenname" -"Customer Reviews","Kundenbeurteilungen" -"Customer Shopping Carts","Einkaufswagen von Kunden" -"Customer Since:","Kunde seit:" -"Customer Tax Classes","Kundensteuerklassen" -"Customer with the same email already exists.","Ein Kunde mit derselben E-Mail-Adresse ist bereits vorhanden." -"Customers","Kunden" -"Customers by Orders","Kunden nach Anzahl der Bestellungen" -"Customers by Orders Total","Kunden nach Summe der Bestellungen" -"DHTML Date/Time Selector","DHTML Datums-/Uhrzeitauswahltool" -"Dashboard","Dashboard" -"Data Format","Datenformat" -"Data transfer:","Datenübertragung:" -"Database","Datenbank" -"Date","Datum" -"Date & Time","Datum & Uhrzeit" -"Added","Hinzugefügt am (Datum)" -"Updated","Aktualisiert am (Datum)" -"Date selection:","Datumsauswahl:" -"Date selector","Datumsauswahltool" -"Day","Tag" -"Decimal separator:","Dezimaltrennzeichen:" -"Default (Admin) Values","Standardwerte (Admin)" -"Default Billing Address","Standardrechnungsadresse" -"Default Config","Standardkonfig." -"Default Template from Locale","Standardvorlage von Gebietsschema" -"Default Values","Standardwerte" -"Default display currency ""%s"" is not available in allowed currencies.","Im Display angezeigte Währung ""% s"" ist nicht in zugelassenen Währungen verfügbar." -"Default scope","Standardumfang" -"Delete","Löschen" -"Delete %s","%s löschen" -"Delete %s '%s'","%s '%s' löschen" -"Delete File","Datei löschen" -"Delete Image","Bild löschen" -"Delete Profile","Profil löschen" -"Delete Role","Rolle löschen" -"Delete Store","Laden löschen" -"Delete Store View","Ladenansicht löschen" -"Delete Template","Vorlage löschen" -"Delete User","Benutzer löschen" -"Delete Website","Website löschen" -"Description","Beschreibung" -"Design","Design" -"Design Section","Design-Bereich" -"Details","Details" -"Developer Section","Entwicklerbereich" -"Direction:","Richtung:" -"Disable","Deaktivieren" -"Disabled","Deaktiviert" -"Display %s first","%s zuerst anzeigen" -"Display default currency","Standardwährung anzeigen" -"Distributed under GNU LGPL. See %s for details.","Vertrieb unter GNU LGPL. Zu Details siehe %s." -"Do you really want to KILL parallel process and start new indexing process?","Parallelprozess wirklich BEENDEN und neuen Indexerstellungsprozess starten?" -"Do you really want to proceed?","Möchten Sie wirklich fortfahren?" -"Download","Download" -"Downloads","Downloads" -"Drag to move","Zum Verschieben ziehen" -"Drop-down","Dropdown" -"Edit","Bearbeiten" -"Edit Design Change","Designänderung bearbeiten" -"Edit Email Template","E-Mail-Vorlage bearbeiten" -"Edit Order","Ordner bearbeiten" -"Edit Queue","Warteschlange bearbeiten" -"Edit Review","Bewertung aufbereiten" -"Edit Role","Rolle bearbeiten" -"Edit Store View","Ladenansicht bearbeiten" -"Edit System Template","Systemvorlage bearbeiten" -"Edit Template","Vorlage bearbeiten" -"Edit URL Rewrite","URL-Rewrite bearbeiten" -"Edit User","Nutzer aufbereiten" -"Edit User '%s'","Benutzer '%s' bearbeiten" -"Edit Website","Website bearbeiten" -"Email","E-Mail" -"Email Address:","Email-Adresse:" -"Email Preview","E-Mail-Vorschau" -"Email to a Friend","E-Mail an einen Freund" -"Email:","E-Mail:" -"Enable","Aktivieren" -"Enabled","Aktiviert" -"Enclose Values In:","Werte einschließen in:" -"Entity Attributes","Entitätenattribute" -"Entity Type","Entitätstyp" -"Entity type:","Art der Organisation:" -"Error","Fehler" -"Excel XML","Excel-XML" -"Excl. Tax","Ausschl. Steuer" -"Exclude media folder from backup","Medienordner vom Backup ausnehmen" -"Export","Export" -"Export CSV","CSV exportieren" -"Export Filters","Filter exportieren" -"Export to:","Exportieren an:" -"Export:","Export:" -"FTP Host","FTP-Host" -"FTP Host[:Port]","FTP Host[:Port]" -"FTP Login","FTP Login" -"FTP Password","FTP Passwort" -"FTP credentials","FTP-Berechtigungen" -"Failed to add a product to cart by id ""%s"".","Kein Produkt in den Warenkorb von ID ""% s"" gelegt." -"Failed to cancel the billing agreement.","Stornierung der Zahlungsvereinbarung fehlgeschlagen." -"Failed to clear the JavaScript/CSS cache.","Leeren des JavaScript/CSS-Caches fehlgeschlagen." -"Failed to delete the billing agreement.","Aufheben der Zahlungsvereinbarung fehlgeschlagen." -"Failed to update the profile.","Aktualisierung des Profils fehlgeschlagen." -"Field","Feld" -"Field Mapping","Feldzuordnung" -"File","Datei" -"File Information","Dateiinformation" -"File System","Dateisystem" -"File mode","Dateimodus" -"File name:","Dateiname:" -"File size should be more than 0 bytes","Dateigröße sollte mehr als 0 Byte betragen." -"Finished profile execution.","Profilausführung fertig." -"First Invoice Created Date","Erstellungsdatum der ersten Rechnung" -"First Name","Vorname" -"First Name is required field.","Vorname ist ein Pflichtfeld." -"First Name:","Vorname:" -"Fixed","Feststehend" -"Flush Catalog Images Cache","Katalogbildercache leeren" -"Flush JavaScript/CSS Cache","JavaScript/CSS-Cache leeren" -"For category","Für Kategorie" -"For latest version visit: %s","Neueste Version siehe: %s" -"For product","Für Produkt" -"Forgot Admin Password","Admin-Passwort vergessen" -"Forgot your password?","Passwort vergessen?" -"Forgot your user name or password?","Haben Sie Ihren Benutzernamen oder Ihr Passwort vergessen?" -"From","von" -"GLOBAL","ALLGEMEIN" -"Gb","GB" -"General Information","Allgemeine Angaben" -"General Section","Allgemeiner Bereich" -"Get Image Base64","Get Image Base64" -"Get help for this page","Hilfe zu dieser Seite einholen" -"Global Attribute","Allgemeines Attribut" -"Global Record Search","Globale Eintragssuche" -"Global Search","Allgemeine Suche" -"Go Today","Heute aktiv werden" -"Go to messages inbox","Zum Posteingang" -"Go to notifications","Zu den Benachrichtigungen" -"Google Base","Google Base" -"Google Sitemaps","Google Sitemaps" -"Grand Total","Rechnungsbetrag" -"Grid (default) / List","Tabelle (Standard)/Liste" -"Grid Only","Grid Only" -"Group:","Gruppe:" -"Guest","Gast" -"HTTP (unsecure)","HTTP (unsicher)" -"HTTPS (SSL)","HTTPS (SSL)" -"Help Us Keep Magento Healthy - Report All Bugs","Helfen Sie uns, Magento sauber zu halten - Melden Sie alle Fehler" -"Helper attributes should not be used in custom layout updates.","Helfereigenschaften sollten nicht in den benutzerdefinierten Layoutaktualisierungen verwendet werden." -"Helper for options rendering doesn't implement required interface.","Hilfsfunktion für Wiedergabemöglichkeiten richtet erforderliche Schnittstelle nicht ein." -"Home","Startseite" -"ID","ID" -"ID Path","ID-Pfad" -"IP Address","IP-Adresse" -"IPN (Instant Payment Notification) Only","Nur IPN (Sofortzahlungsbenachrichtigung)" -"If there is an account associated with %s you will receive an email with a link to reset your password.","Wenn ein Konto mit %s verknüpft ist, erhalten Sie eine E-Mail mit einem Link für das Resetten Ihres Passworts." -"If this message persists, please contact the store owner.","Wenn diese Meldung weiterhin angezeigt wird, wenden Sie sich bitte an den Ladeneigentümer." -"Images (.gif, .jpg, .png)","Bilder (.gif, .jpg, .png)" -"Images Cache","Bildercache" -"Import","Importieren" -"Import Service","Importdienst" -"Import and Export","Importieren und exportieren" -"Import and Export Tax Rates","Steuersätze importieren und exportieren" -"Import/Export","Importieren/Exportieren" -"Import/Export Advanced","Import/Export Erweitert" -"Import/Export Profile","Profil importieren/exportieren" -"Important: ","Wichtig:" -"Imported <strong>%s</strong> records","Importierte <strong>%s</strong> Datensätze" -"In","In" -"In Database:","In Datenbank:" -"In File:","In Datei:" -"Inactive","Inaktiv" -"Incl. Tax","Einschl. Steuern" -"Incoming Message","Eingehende Nachricht" -"Insert Variable...","Variable einfügen..." -"Interactive","Interaktiv" -"Interface Locale: %s","Interface Locale: %s" -"Invalid Form Key. Please refresh the page.","Ungültiger Formularschlüssel. Aktualisieren Sie die Seite." -"Invalid Import Service Specified","Ungültiger Importdienst angegeben" -"Invalid POST data (please check post_max_size and upload_max_filesize settings in your php.ini file).","Ungültige POST-Daten (prüfen Sie die Einstellungen für post_max_size und upload_max_filesize in Ihrer php.ini-Datei)." -"Invalid Secret Key. Please refresh the page.","Ungültiger Geheimschlüssel. Aktualisieren Sie die Seite." -"Invalid User Name or Password.","Benutzername oder Passwort ungültig." -"Invalid directory: %s","Ungültiges Verzeichnis: %s" -"Invalid email address ""%s"".","Ungültige E-Mail-Adresse ""%s""." -"Invalid email address.","Ungültige E-Mail-Adresse." -"Invalid file: %s","Ungültige Datei: %s" -"Invalid input data for %s => %s rate","Ungültige Eingabedaten für %s => %s Rate" -"Invalid parent block for this block","Ungültiger Elternblock für diesen Block" -"Invalid parent block for this block.","Ungültiger übergeordneter Block für diesen Block." -"Invalid password reset token.","Ungültiger Token für das Resetten des Passworts." -"Invalid sender name ""%s"". Please use only visible characters and spaces.","Ungültiger Absendername ""%s"". Bitte verwenden Sie nur lesbare Zeichen und Leerzeichen." -"Invalid timezone","Ungültige Zeitzone" -"Invalidated","Ungültig gemacht" -"Inventory Stock Status","Vorratsbestand Status" -"Invoice #%s comment added","Rechnung #%s - Kommentar hinzugefügt" -"Invoice #%s created","Rechnung #%s erstellt" -"Invoice History","Rechnungsverlauf" -"Invoice Totals","Rechnungssummen" -"Invoice canceling error.","Fehler beim Stornieren der Rechnung." -"Invoice capturing error.","Fehler beim Erfassen der Rechnung." -"Invoice voiding error.","Fehler beim Ungültigmachen der Rechnung." -"Invoices","Rechnungen" -"Is Closed","Ist geschlossen" -"Issue Number","Ausstellnummer" -"Items","Elemente" -"JavaScript seems to be disabled in your browser.","JavaScript scheint in Ihrem Browser deaktiviert zu sein." -"JavaScript/CSS","JavaScript/CSS" -"JavaScript/CSS Cache","JavaScript/CSS-Cache" -"Kb","KB" -"Last 24 Hours","Letzte 24 Stunden" -"Last 5 Orders","Letzte 5 Bestellungen" -"Last 5 Search Terms","Letzte 5 Suchbegriffe" -"Last 7 Days","Letzte 7 Tage" -"Last Credit Memo Created Date","Datum der letzten Gutschrifterstellung" -"Last Invoice Created Date","Datum der letzten Rechnungserstellung" -"Last Logged In (%s):","Zuletzt angemeldet (%s):" -"Last Logged In:","Letzte Anmeldung:" -"Last Name","Nachname" -"Last Name is required field.","Das Feld 'Nachname' muss ausgefüllt werden." -"Last Name:","Nachname:" -"Last updated: %s. To refresh last day\'s <a href=""%s"">statistics</a>, click <a href=""%s"">here</a>.","Zuletzt aktualisiert: %s. Um die <a href=""%s"">Statistiken</a> von gestern zu aktualisieren, klicken Sie <a href=""%s"">hier</a>." -"Latest Message:","Neueste Meldung:" -"Layered Navigation Indices","Layered Navigation-Indizes" -"Layered Navigation Indices were refreshed.","Layered Navigation Indices wurden aktualisiert." -"Leave empty to use tax identifier","Frei lassen, um Steuernummer einzusetzen" -"Lifetime Sales","Gesamtumsatz" -"Lifetime statistics have been updated.","Lebenslange Statistik wurde aktualisiert." -"Links","Links" -"Links with associated products will retain only after saving current product.","Links mit verknüpften Produkten werden nur beibehalten, nachdem das aktuelle Produkt gespeichert wurde." -"List (default) / Grid","Liste (Standard)/Tabelle" -"List Only","Nur Liste" -"Load Template","Vorlage laden" -"Load default template","Standardvorlage laden" -"Loading...","Laden ..." -"Local Server","Lokaler Server" -"Local/Remote Server","Lokaler Server/Remote-Server" -"Locale","Gebietsschema" -"Log Out","Abmelden" -"Log in to Admin Panel","Beim Admin-Panel anmelden" -"Log into Magento Admin Page","Bei der Magento Admin-Seite anmelden" -"Logged in as %s","Angemeldet als %s" -"Login","Login" -"Low Stock","Vorratsbestand niedrig" -"MAJOR","größer" -"MINOR","KLEINER" -"MS Excel XML","MS Excel XML" -"Magento Admin","Magento Admin" -"Magento Commerce - Administrative Panel","Magento Commerce - Verwaltungspanel" -"Magento Connect","Magento Connect" -"Magento Connect Manager","Magento Connect-Manager" -"Magento Logo","Magento-Logo" -"Magento is a trademark of X.commerce, Inc. Copyright © %s X.commerce, Inc.","Magento ist ein Warenzeichen von X.commerce, Inc. Copyright © %s X.commerce, Inc." -"Magento root directory","Magento-Rootverzeichnis" -"Magento ver. %s","Magento Version %s" -"Magento® is a trademark of X.commerce, Inc.<br/>Copyright © %s X.commerce, Inc.","Magento® ist ein Warenzeichen von X.commerce, Inc.<br/>Copyright © %s X.commerce, Inc." -"Make sure that data encoding in the file is consistent and saved in one of supported encodings (UTF-8 or ANSI).","Achten Sie darauf, dass die Datenkodierung in der Datei konsistent ist und in einem unterstützten Kodierungsformat gespeichert wird (UTF-8 oder ANSI)." -"Manage Attribute Sets","Attributmengen verwalten" -"Manage Attributes","Attribute verwalten" -"Manage Categories","Kategorien verwalten" -"Manage Content","Inhalt verwalten" -"Manage Currency Rates","Wechselkurse verwalten" -"Manage Customers","Kunden verwalten" -"Manage Ratings","Bewertungen verwalten" -"Manage Stores","Läden verwalten" -"Manage Tax Rules","Steuerregeln verwalten" -"Manage Tax Zones and Rates","Steuergebiete und -sätze verwalten" -"Manual","Manuell" -"Matched Expression","Übereinstimmender Ausdruck" -"Mb","MB" -"Media (.avi, .flv, .swf)","Medien (.avi, .flv, .swf)" -"Media storages synchronization has completed!","Synchronisation des Medienspeichers fertiggestellt!" -"Messages Inbox","Eingehende Nachrichten" -"Month","Monat" -"Most Viewed","Am häufigsten angezeigt" -"Most Viewed Products","Meistgesehene Produkte" -"Multiple Select","Mehrfachauswahl" -"My Account","Mein Konto" -"N/A","N.Z." -"NOTICE","Hinweis" -"Name","Name" -"Name:","Name:" -"Never (production)","Nie (Produktion)" -"New ","Neu" -"New API Key","Neuer API-Schlüssel" -"New Accounts","Neue Konten" -"New Attribute","Neues Attribut" -"New Block","Neuer Block" -"New Category","Neue Kategorie" -"New Class","Neue Klasse" -"New Condition","Neue Bedingung" -"New Custom Variable","Neue Kundenvariable" -"New Customer","Neuer Kunde" -"New Customers","Neue Kunden" -"New Design Change","Neue Designänderung" -"New Email Template","Neue Email-Vorlage" -"New Group","Neue Gruppe" -"New Invoice","Neue Rechnung" -"New Item Type","Neuer Elementtyp" -"New Memo","Neues Memo" -"New Memo for #%s","Neues Memo für #%s" -"New Page","Neue Seite" -"New Password","Neues Passwort" -"New Profile","Neues Profil" -"New Rate","Neue Rate" -"New Rating","Neue Bewertung" -"New Review","Neue Beurteilung" -"New Role","Neue Rolle" -"New Rule","Neue Regel" -"New Search","Neue Suche" -"New Set","Neuer Satz" -"New Shipment","Neue Lieferung" -"New Sitemap","Neue Sitemap" -"New Store View","Neue Ladenansicht" -"New System Template","Neue Systemvorlage" -"New Template","Neue Vorlage" -"New User","Neuer Benutzer" -"New Variable","Neue Variable" -"New Website","Neue Website" -"New password field cannot be empty.","Das Feld für das neue Passwort kann nicht leer sein." -"Newsletter","Newsletter" -"Newsletter Problems","Newsletter-Probleme" -"Newsletter Queue","Newsletter-Warteschlange" -"Newsletter Subscribers","Newsletter-Abonnenten" -"Newsletter Templates","Newsletter-Vorlagen" -"Next month (hold for menu)","Folgemonat (für Menü gedrückt halten)" -"Next year (hold for menu)","Nächstes Jahr (halten für Menü)" -"No","Nein" -"No (price without tax)","Nein (Preis vor Steuern)" -"No Data","Keine Daten" -"No Data Found","Keine Daten gefunden" -"No Templates Found","Keine Vorlagen gefunden" -"No change","Keine Änderung" -"No customer id defined.","Keine Kunden-ID definiert." -"No information available.","Keine Informationen verfügbar." -"No profile loaded...","Kein Profil geladen..." -"No records found for this period.","Keine Datensätze gefunden für diesen Zeitraum." -"No records found.","Keine Datensätze gefunden." -"No report code specified.","Kein Berichtcode angegeben." -"No search keywords.","Keine Suchstichwörter." -"No search modules were registered","Keine registrierten Suchmodule" -"No wishlist item id defined.","Keine Wunschlisten-ID definiert." -"None","Keins" -"Note:","Hinweis:" -"Notes","Hinweise" -"Notifications","Benachrichtigungen:" -"Orders","Zahl der Bestellungen" -"Uses","Zahl der Verwendungen" -"Views","Anzahl der Ansichten" -"Number of records:","Zahl der Datensätze:" -"OK","OK" -"Old rate:","Alter Satz:" -"One or more media files failed to be synchronized during the media storages syncronization process. Refer to the log file for details.","Eine oder mehrere Mediendateien konnten nicht synchronisiert werden während der Synchronisation des Medienspeichers. Sie finden mehr Details in den Logdateien." -"One or more of the Cache Types are invalidated:","Mindestens ein Cache-Typ wurde für ungültig befunden:" -"Online Customers","Online-Kunden" -"Only Once (version upgrade)","Nur einmal (Upgrade der Version)" -"Only attributes with scope ""Global"", input type ""Dropdown"" and Use To Create Configurable Product ""Yes"" are available.","Nur Einstellungen im Anwendungsbereich ""Global"", der Eingabetyp ""Dropdown"" und Verwenden, um ein konfigurierbares Produkt zu erstellen ""Ja"" sind verfügbar." -"Only mapped fields","Nur zugeordnete Felder" -"Optional","Optional" -"Options","Optionen" -"Order","Bestellung" -"Order %s","Bestellnr. %s" -"Order %s (%s)","Auftrag #%s (%s)" -"Order Created Date","Datum der Auftragserstellung" -"Order ID","Auftrags-ID" -"Order Totals","Bestellsummen" -"Order Updated Date","Datum der Auftragsaktualisierung" -"Order Updated Date report is real-time, does not need statistics refreshing.","Der Bericht über das Datum der Auftragsaktualisierung wird in Echtzeit erstellt; die Statistik braucht nicht aktualisiert zu werden." -"Orders","Bestellungen" -"Original Magento attribute names in first row:","Ursprüngliche Magento-Attributnamen in erster Zeile:" -"Out of stock","Ausverkauft" -"PDT (Payment Data Transfer) Only","Nur PDT (Zahlungsdatenübertragung)" -"Package Extensions","Paketerweiterungen" -"Pages","Seiten" -"Parent Product Thumbnail","Miniaturbild für Elternprodukt" -"Parent Transaction ID","Transaktions-ID für Eltern" -"Passive mode","Passiver Modus" -"Password","Passwort" -"Password Confirmation","Passwortbestätigung" -"Password confirmation must be same as password.","Kennwort-Bestätigung stimmt nicht mit Kennwort überein." -"Password must be at least of %d characters.","Das Passwort muss mindestens %d Zeichen lang sein." -"Password must include both numeric and alphabetic characters.","Das Passwort muss sowohl numerische als auch alphabetische Zeichen enthalten." -"Password:","Kennwort:" -"Path:","Pfad:" -"PayPal Manager","PayPal-Manager" -"Payment method instance is not available.","Zahlungsforminstanz ist nicht verfügbar." -"Payment method is not available.","Zahlungsform ist nicht verfügbar." -"Payment method must be specified.","Angabe der Zahlungsmethode erforderlich." -"Pending Reviews","Ausstehende Beurteilungen" -"Per Item","Je Element" -"Per Order","Je Bestellung" -"Percent","Prozent" -"Performed At","Ausgeführt Um" -"Interval","Zeitraum" -"Permanent (301)","Ständig (301)" -"Permissions","Rechte" -"Personal Information","Persönliche Angaben" -"Phone:","Telefon:" -"Please Select","Bitte auswählen" -"Please confirm site switching. All data that hasn\'t been saved will be lost.","Bestätigen Sie den Website-Wechsel. Alle nicht gespeicherten Daten gehen verloren." -"Please enter 6 or more characters.","Geben Sie mindestens 6 Zeichen ein." -"Please enter a number greater than 0 in this field.","Geben Sie in dieses Feld eine Zahl ein, die größer als 0 ist." -"Please enter a valid $ amount. For example $100.00.","Geben Sie einen gültigen Betrag in $ ein. Beispiel: $100,00." -"Please enter a valid URL. For example http://www.example.com or www.example.com","Geben Sie eine gültige URL ein. Beispiel: http://www.beispiel.com oder www.beispiel.com." -"Please enter a valid URL. http:// is required","Geben Sie eine gültige URL ein. Sie müssen http:// angeben." -"Please enter a valid credit card number.","Geben Sie bitte eine gültige Kreditkartennummer ein." -"Please enter a valid date.","Geben Sie ein gültiges Datum ein." -"Please enter a valid email address. For example johndoe@domain.com.","Geben Sie eine gültige E-Mail-Adresse ein. Beispiel: johndoe@domain.com." -"Please enter a valid email.","Geben Sie bitte ein gültige Email-Adresse an." -"Please enter a valid number in this field.","Geben Sie eine gültige Zahl in dieses Feld ein." -"Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.","Geben Sie eine gültige Telefonnummer ein. Beispiel: (123) 456-7890 oder 123-456-7890." -"Please enter a valid social security number. For example 123-45-6789.","Geben Sie eine gültige Steuernummer ein. Beispiel: 012-34-5678-90." -"Please enter a valid value from list","Geben Sie einen gültigen Wert aus der Liste ein." -"Please enter a valid value, ex: 10,20,30","Geben Sie einen gültigen Wert ein, Beispiel: 10,20,30" -"Please enter a valid zip code.","Geben Sie eine gültige PLZ ein." -"Please enter a valid zip code. For example 90602 or 90602-1234.","Geben Sie eine gültige Postleitzahl ein. Beispiel: 90602." -"Please enter another credit card number to complete your purchase.","Bitte geben Sie eine andere Kreditkarten-Nummer ein, um Ihren Kauf abzuschließen." -"Please enter password","Bitte Passwort eingeben" -"Please enter password to confirm rollback.","Zum Bestätigen des Zurücksetzens bitte Passwort eingeben" -"Please enter valid password.","Geben Sie ein gültiges Passwort ein." -"Please make sure that all global admin search modules are installed and activated.","Stellen Sie sicher, dass alle allgemeinen Admin-Suchmodule installiert und aktiviert sind." -"Please make sure that your changes were saved before running the profile.","Vergewissern Sie sich, dass vor Ausführung des Profils Ihre Änderungen gespeichert wurden." -"Please make sure your passwords match.","Achten Sie darauf, dass Ihre Passwörter übereinstimmen." -"Please select State/Province.","Wählen Sie bitte Staat/Bundesland aus." -"Please select a customer.","Wählen Sie einen Kunden aus." -"Please select a store.","Wählen Sie einen Laden aus." -"Please select an option.","Bitte wählen Sie eine Option." -"Please select catalog searches.","Wählen Sie Katalogsuchen aus." -"Please select customer(s).","Wählen Sie (einen) Kunden aus." -"Please select message(s).","Bitte Nachricht(en) auswählen." -"Please select one of the above options.","Wählen Sie bitte eine der obigen Optionen aus." -"Please select one of the options.","Wählen Sie eine der Optionen aus." -"Please select review(s).","Wählen Sie (eine) Beurteilung aus." -"Please specify backup creation options","Bitte die Optionen für die Ausführung des Backups bestimmen" -"Please specify the admin custom URL.","Geben Sie bitte die Admin-URL des Kunden ein." -"Please try to logout and sign in again.","Melden Sie sich ab und melden Sie sich dann erneut an." -"Please type the letters from the image:","Bitte geben Sie die Buchstaben auf diesem Bild ein:" -"Please use in this field only ""a-z,0-9,_"".","Bitte verwenden Sie in diesem Feld nur ""a-z,0-9._""." -"Please use letters only (a-z) in this field.","Benutzen Sie in diesem Feld bitte nur Buchstaben (a-z)." -"Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.","Bitte verwenden Sie in diesem Feld nur Zahlen. Vermeiden Sie bitte Leerzeichen und andere Zeichen, wie Punkt oder Komma." -"Please use only letters (a-z or A-Z), numbers (0-9) or spaces in this field.","Geben Sie in dieses Feld bitte nur Buchstaben (a-z or A-Z), Ziffern (0-9) oder Leerzeichen ein." -"Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.","Benutzen Sie in diesem Feld bitte nur Buchstaben (a-z) oder Ziffern (0-9). Erlaubt sind weder Leer- noch andere Zeichen." -"Please use only letters (a-z) or numbers (0-9) or spaces and # only in this field.","Geben Sie nur Buchstaben (a-z) oder Zahlen (0-9) oder Leerzeichen und das Rautenzeichen (#) in dieses Feld ein." -"Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.","Verwenden Sie dieses Datumsformat: tt.mm.jjjj. Beispiel: 17.03.2006 für den 17. März 2006." -"Please wait while the indexes are being refreshed.","Die Indizes werden aktualisiert. Bitte haben Sie einen Moment Geduld." -"Please wait, loading...","Daten werden geladen, bitte warten ..." -"Please wait...","Bitte warten..." -"Popular","Beliebt" -"Position of Watermark for %s","Position des Wasserzeichens für %s" -"Pregenerated product images files.","Vorgenerierte Produktbilddateien." -"Prev. month (hold for menu)","Vormonat (für Menü gedrückt halten)" -"Prev. year (hold for menu)","Vorheriges Jahr (halten für Menü)" -"Preview","Vorschau" -"Preview Template","Vorlagenvorschau" -"Price","Preis" -"Price alert subscription was saved.","Preiswarnungsabo wurde gespeichert." -"Price:","Preis:" -"Processed <strong>%s%% %s/%d</strong> records","Verarbeitete <strong>%s%% %s/%d</strong> Datensätze" -"Product","Produkt" -"Product","Produktbezeichnung" -"Product Reviews","Produktbeurteilungen" -"Product Tax Classes","Produktsteuerklassen" -"Product Thumbnail Itself","Produktvorschau selbst" -"Product is not loaded.","Produkt wurde nicht geladen." -"Product:","Produkt:" -"Products","Produkte" -"Products Bestsellers Report","Bericht meistverkaufte Produkte" -"Products Most Viewed Report","Bericht zu den meistgesehenen Produkten" -"Products Ordered","Bestellte Produkte" -"Products in Carts","Produkte im Einkaufswagen" -"Profile Action","Profilaktion" -"Profile Actions XML","Profilaktionen XML" -"Profile Direction","Profilrichtung" -"Profile History","Profilverlauf" -"Profile Information","Profilinformationen" -"Profile Name","Profilname" -"Profile Payments","Profilzahlungen" -"Profile Schedule","Profile-Termine" -"Profile Wizard","Profil-Assistent" -"Profiles","Profile" -"Promo","Werbeaktion" -"Promotions","Werbeaktionen" -"Purchased Item","Gekaufter Artikel" -"Put store on the maintenance mode while backup creation","Versetzen Sie vor einer Sicherung den Speicher in den Wartungsmodus" -"Put store on the maintenance mode while rollback processing","Während der Durchführung der Wiederherstellung auf den Wartungsmodus verlassen" -"Quantity","Stückzahl" -"Queue Refresh","Warteschlange aktualisieren" -"Queued... Cancel","In Warteschlange ... Abbrechen" -"Radio Buttons","Optionsschaltflächen" -"Rates","Kurse" -"Read details","Details lesen" -"Rebuild","Erneut aufbauen" -"Rebuild Catalog Index","Katalogindex erneut aufbauen" -"Rebuild Flat Catalog Category","Flat Catalog-Kategorie erneut aufbauen" -"Rebuild Flat Catalog Product","Flat Catalog-Produkt erneut aufbauen" -"Recent Orders","Letzte Bestellungen" -"Recent statistics have been updated.","Neueste Statistiken sind aktualisiert worden." -"Recurring Profile View","Wiederkehrende Profilansicht" -"Recursive Dir","Rekursives Verz." -"Redirect","Umleiten" -"Reference","Verweis" -"Reference ID","Verweis-ID" -"Refresh","Aktualisieren" -"Refresh Now*","Jetzt aktualisieren*" -"Refresh Statistics","Statistiken aktualisieren" -"Region/State","Region/Staat" -"Regular Price:","Normalpreis:" -"Release","Freigeben" -"Release Stability","Stabilität freigeben" -"Release Version","Version freigeben" -"Reload captcha","Captcha neu laden" -"Remote FTP","Remote-FTP" -"Remove","Entfernen" -"Reports","Berichte" -"Request Path","Anforderungspfad" -"Required","Erforderlich" -"Reset","Zurücksetzen" -"Reset Filter","Filter zurücksetzen" -"Reset Password","Passwort zurücksetzen" -"Reset a Password","Passwort zurücksetzen" -"Resize","Größe ändern" -"Resource Access","Zugriff auf Ressource" -"Resources","Mittel" -"Results","Ergebenisse" -"Retrieve Password","Passwort abrufen" -"Return Html Version","HTML-Version ausgeben" -"Revenue","Umsatz" -"Reviews","Beurteilungen" -"Reviews and Ratings","Beurteilungen und Bewertungen" -"Rewrite Rules","Rewrite-Regeln" -"Role ID","Rollen-ID" -"Role Info","Rollen-Info" -"Role Information","Rollen-Informationen" -"Role Name","Rollenname" -"Role Resources","Rollen-Ressourcen" -"Role Users","Rollenbenutzer" -"Roles","Rollen" -"Roles Resources","Rollen-Ressourcen" -"Rotate CCW","Gegen den Uhrzeigersinn drehen" -"Rotate CW","Im Uhrzeigersinn drehen" -"Run","Ausführen" -"Run Profile","Profil ausführen" -"Run Profile Inside This Window","Profil in diesem Fenster ausführen" -"Run Profile in Popup","Profil in Popup ausführen" -"Running... Kill","Wird ausgeführt ... Beenden" -"SKU","Artikelposition" -"SKU:","SKU:" -"SSL Error: Invalid or self-signed certificate","SSL-Fehler: Ungültiges oder selbstsigniertes Zertifikat" -"Sales","Verkäufe" -"Sales Report","Umsatzbericht" -"Samples","Proben" -"Save","Speichern" -"Save & Generate","Sichern & Generieren" -"Save Account","Konto speichern" -"Save Cache Settings","Cache-Einstellungen speichern" -"Save Config","Konfig. speichern" -"Save Currency Rates","Wechselkurse speichern" -"Save Profile","Profil speichern" -"Save Role","Rolle speichern" -"Save Template","Vorlage speichern" -"Save User","Benutzer speichern" -"Save and Continue Edit","Speichern und Bearbeiten fortsetzen" -"Search","Suche" -"Search Index","Suchindex" -"Search Term","Suchbegriff" -"Search Terms","Suchbegriffe" -"Select","Auswählen" -"Select All","Alle auswählen" -"Select Category","Kategorie auswählen" -"Select Date","Datum selektieren" -"Select Range","Bereich auswählen" -"Select date","Datum wählen" -"Selected allowed currency ""%s"" is not available in installed currencies.","Die gewählte erlaubte Währung ""%s"" ist nicht in den installierten Währungen verfügbar." -"Selected base currency is not available in installed currencies.","Ausgewählte Basiswährung fehlt unter den installierten Währungen." -"Selected default display currency is not available in allowed currencies.","Die gewählte angezeigte Standardwährung ist nicht in den zulässigen Währungen verfügbar." -"Selected default display currency is not available in installed currencies.","Ausgewählte Standard-Anzeigewährung fehlt unter den installierten Währungen." -"Self-assigned roles cannot be deleted.","Selbst zugeordnete Rollen können nicht gelöscht werden." -"Sender","Absender" -"Separate Email","Separate E-Mail" -"Service Settings","Service-Einstellungen" -"Set up & Customize","Installation & Anpassung" -"Shipment #%s comment added","Lieferun Nr. %s - Kommentar hinzugefügt" -"Shipment #%s created","Sendung #%s erstellt" -"Shipment Comments","Lieferungskommentare" -"Shipment History","Lieferungsverlauf" -"Shipments","Lieferungen" -"Shipping","Lieferung" -"Shipping Address","Lieferadresse" -"Shipping Address: ","Versandadresse:" -"Shipping Origin","Herkunft der Lieferung" -"Shipping Price","Versandkosten" -"Shipping address selection is not applicable","Ausgewählte Lieferadresse ist nicht zutreffend" -"Shipping method must be specified.","Die Angabe der Versandart ist erforderlich." -"Shipping method selection is not applicable","Auswahl der Versandmethode ist nicht anwendbar" -"Shopping Cart","Einkaufswagen" -"Shopping Cart Price Rules","Preisvorschriften für den Einkaufswagen" -"Shopping Cart from %s","Einkaufswagen von %s" -"Show By","Einkaufen nach" -"Show Report For:","Bericht anzeigen für:" -"Show Reviews","Kurze Beurteilungen" -"Sitemap Information","Sitempa-Informationen" -"Size for %s","Größe für %s" -"Skip Category Selection","Kategorieauswahl überspringen" -"Some items in this order have different invoice and shipment types. You can create shipment only after the invoice is created.","Einige Artikel in dieser Bestellung haben unterschiedliche Rechnungs- und Liefertypen. Sie können eine Lieferung erst erstellen, nachdem eine Rechnung erstellt wurde." -"Some of the ordered items do not exist in the catalog anymore and will be removed if you try to edit the order.","Einige der bestellten Artikel werden nicht mehr im Katalog angeboten und werden entfernt, falls Sie versuchen, den Auftrag zu bearbeiten." -"Sorry, this feature is coming soon...","Leider ist dieses Angebot erst in Kürze erhältlich ..." -"Special Price:","Sezialpreis:" -"Specific Countries","Spezifische Länder" -"Specified","Angegeben" -"Specified profile does not exist.","Angegebenes Profil nicht vorhanden." -"Spreadsheet Name:","Name des Tabellenkalkulationsblattes:" -"Start Date","Startdatum" -"Starting profile execution, please wait...","Profilausführung wird gestartet, bitte warten ..." -"State/Province:","Bundesstaat/Provinz:" -"Static Blocks","Statische Blöcke" -"Status","Status" -"Status:","Status:" -"Stock Quantity:","Vorratsmenge:" -"Stock notification was saved.","Bestandsmeldung gesichert." -"Store","Laden" -"Store Email Addresses Section","Email-Adressdaten speichern" -"Store View","Ladenansicht" -"Store:","Speicher:" -"Stores","Läden" -"Subject","Betreff" -"Submit","Absenden" -"Subpackage cannot be conflicting.","Teilpaket darf nicht im Konflikt stehen." -"Subtotal","Zwischensumme" -"Switch/Solo/Maestro Only","Nur Switch/Solo/Maestro" -"Synchronization is required.","Synchronisation ist erforderlich." -"Synchronization of media storages has been successfully completed.","Synchronisation von Medien-Speichern wurde erfolgreich abgeschlossen." -"Synchronize","Synchronisieren" -"Synchronizing %s to %s","Synchronisierung von %s bis %s" -"Synchronizing...","Synchronisierung..." -"System","System" -"System Section","Systembereich" -"System busy","System belegt" -"Target Path","Zielpfad" -"Tax","Steuern" -"Tb","TB" -"Template","Vorlage" -"Template Content","Vorlageninhalt" -"Template Information","Vorlageninformation" -"Template","Vorlagenname" -"Template Styles","Vorlagenstile" -"Template Subject","Vorlagenthema" -"Template Type","Vorlagentyp" -"Temporary (302)","Temporary (302)" -"Terms and Conditions","AGB" -"Text","Text" -"The Catalog Rewrites were refreshed.","Die Katalog-Rewrites wurden aktualisiert." -"The CatalogInventory Stock Status has been rebuilt.","Der Status des Katalogbestandes ist aktualisiert worden." -"The Comment Text field cannot be empty.","Das Kommentarfeld ist auszufüllen." -"The Flat Catalog Product was rebuilt","Das Flat Catalog-Produkt wurde neu aufgebaut." -"The JavaScript/CSS cache has been cleaned.","Der JavaScript/CSS-Cache wurde bereinigt." -"The JavaScript/CSS cache has been cleared.","Der JavaScript/CSS-Cache ist bereinigt worden." -"The Layered Navigation indexing has been queued.","Die Layered Navigation-Indexerstellung wurde in die Warteschlange gestellt." -"The Layered Navigation indexing queue has been canceled.","Die Warteschlange für die Layered Navigation-Indexerstellung wurde storniert." -"The Layered Navigation indices were refreshed.","Die Layered Navigation-Indizes wurden aktualisiert." -"The Layered Navigation process has been queued to be killed.","Der Layered Navigation-Vorgang wurde zum Beenden in die Warteschlange gestellt." -"The Magento cache storage has been flushed.","Der Magento-Cachespeicher ist geleert worden." -"The URL Rewrite has been deleted.","Das URL-Rewrite wurde gelöscht." -"The URL Rewrite has been saved.","Das URL-Rewrite wurde gespeichert." -"The account has been saved.","Das Konto wurde gespeichert." -"The archive can be uncompressed with <a href=""%s"">%s</a> on Windows systems","Das Archiv kann mit <a href=""%s"">% s</a> auf Windows-Systemen dekomprimiert werden." -"The attribute set has been removed.","Die Attributmenge wurde entfernt." -"The backup's creation process will take time.","Das Erstellen der Sicherungskopie dauert einige Zeit." -"The billing agreement has been canceled.","Die Rechnungsvereinbarung wurde storniert." -"The billing agreement has been deleted.","Die Rechnungsvereinbarung wurde gelöscht." -"The cache storage has been flushed.","Der Cache-Speicher wurde geleert." -"The carrier needs to be specified.","Der Spediteur muss spezifiziert werden." -"The catalog index has been rebuilt.","Der Katalogindex wurde neu aufgebaut." -"The catalog rewrites have been refreshed.","Die Katalog-Rewrites wurden aktualisiert." -"The configuration has been saved.","Die Konfiguration wurde gespeichert." -"The credit memo has been canceled.","Die Gutschrift wurde storniert." -"The credit memo has been created.","Die Gutschrift wurde erstellt." -"The credit memo has been voided.","Die Gutschrift ist nicht länger gültig." -"The custom variable has been deleted.","Die benutzerdefinierte Variable wurde gelöscht." -"The custom variable has been saved.","Die Kundenvariable ist gespeichert worden." -"The customer has been deleted.","Der Kunde wurde gelöscht." -"The customer has been saved.","Der Kunde ist gespeichert worden." -"The design change has been deleted.","Die Designänderung wurde gelöscht." -"The design change has been saved.","Die Designänderung wurde gespeichert." -"The email address is empty.","Die E-Mail-Adresse ist leer." -"The email template has been deleted.","Die Emailvorlage ist gelöscht worden." -"The email template has been saved.","Die E-Mail-Vorlage wurde gespeichert." -"The flat catalog category has been rebuilt.","Die Flat Catalog Category ist neu erstellt worden." -"The group node name must be specified with field node name.","Der Gruppen-Node-Name muss mit dem Feld-Node-Namen angegeben werden." -"The image cache was cleaned.","Der Bild-Cache wurde bereinigt." -"The image cache was cleared.","Der Bild-Cache wurde geleert." -"The invoice and shipment have been created.","Die Rechnung und die Lieferung wurden erstellt." -"The invoice and the shipment have been created. The shipping label cannot be created at the moment.","Rechnung und Versand wurden erstellt. Das Versandetikett kann derzeit nicht erstellt werden." -"The invoice has been canceled.","Die Rechnung wurde storniert." -"The invoice has been captured.","Die Rechnung wurde erfasst." -"The invoice has been created.","Die Rechnung wurde erstellt." -"The invoice has been voided.","Die Rechnung ist für nichtig erklärt worden." -"The invoice no longer exists.","Die Rechnung ist nicht mehr vorhanden." -"The item %s (SKU %s) does not exist in the catalog anymore.","Der Artikel %s (SKU %s) ist nicht mehr im Katalog vorhanden." -"The order does not allow creating an invoice.","Der Auftrag erlaubt keine Rechnungserstellung." -"The order no longer exists.","Der Auftrag besteht nicht mehr." -"The profile has been deleted.","Das Profil wurde gelöscht." -"The profile has been saved.","Das Profil ist gespeichert worden." -"The profile has been updated.","Das Profil wurde aktualisiert." -"The profile has no changes.","Das Profil hat keine Änderungen." -"The profile you are trying to save no longer exists","Das Profil, das Sie speichern wollen, ist nicht mehr vorhanden" -"The rating has been deleted.","Die Bewertung ist gelöscht worden." -"The rating has been saved.","Die Bewertung wurde gespeichert." -"The role has been deleted.","Die Rolle wurde gelöscht." -"The role has been saved.","Die Rolle wurde gespeichert." -"The role has been successfully saved.","Die Rolle wurde erfolgreich gespeichert." -"The search index has been rebuilt.","Der Suchindex wurde neu aufgebaut." -"The shipment has been created.","Die Lieferung wurde erstellt." -"The shipment has been sent.","Die Sendung ist ausgeliefert worden." -"The shipping label has been created.","Das Versandlabel wurde erstellt." -"The transaction details have been updated.","Die Transaktionsdetails sind aktualisiert worden." -"The user has been deleted.","Der Benutzer wurde gelöscht." -"The user has been saved.","Der Benutzer ist gespeichert worden." -"Themes JavaScript and CSS files combined to one file.","Themes JavaScript- und CSS-Dateien in eine Datei kombiniert." -"There is an error in one of the option rows.","In einer der Optionszeilen ist ein Fehler." -"This Account is","Dieses Konto ist" -"This Email template no longer exists.","Diese E-Mail-Vorlage existiert nicht mehr." -"This Role no longer exists","Diese Rolle gibt es nicht mehr." -"This Role no longer exists.","Diese Rolle existiert nicht mehr." -"This account is","Dieses Konto ist" -"This account is inactive.","Dieses Konto ist inaktiv." -"This action cannot be undone.","Diese Aktion kann nicht rückgängig gemacht werden." -"This attribute set does not have attributes which we can use for configurable product","Diese Attributmenge enthält keine Attribute, die wir für konfigurierbare Produkte verwenden können." -"This attribute shares the same value in all the stores","Dieses Attribut hat denselben Wert in allen Läden." -"This is a demo store. Any orders placed through this store will not be honored or fulfilled.","Dies ist ein Demo-Handel. In diesem Geschäft aufgegebene Bestellungen werden weder akzeptiert noch ausgeführt." -"This is a required field.","Dies ist ein Pflichtfeld." -"This product is currently disabled.","Dieses Produkt ist zur Zeit deaktiviert." -"This report depends on timezone configuration. Once timezone is changed, the lifetime statistics need to be refreshed.","Dieser Bericht hängt von der Zeitzonenkonfiguration ab. Nachdem die Zeitzone geändert wurde, müssen die Lebenszeitstatistiken aktualisiert werden." -"This section is not allowed.","Kein Zugang zu diesem Bereich." -"This user no longer exists.","Dieser Benutzer existiert nicht mehr." -"Time","Zeit" -"Time selection:","Gewählte Zeit:" -"Time:","Zeit:" -"Timeout limit for response from synchronize process was reached.","Zeitlimit für die Antwort auf den Synchronisierungsvorgang wurde überschritten." -"To","Nach" -"To cancel pending authorizations and release amounts that have already been processed during this payment, click Cancel.","Zum Abbrechen anhängiger Genehmigungen und zur Freigabe von Beträge, die bereits während dieser Zahlung bearbeitet wurden, klicken Sie auf Abbrechen." -"To use PayPal Payflow Link you must configure some settings in your Payflow account by logging into","Um den Payflow Link zu benutzen, müssen Sie Ihr Payflow Link-Konto auf der Paypal-Website konfigurieren." -"To use PayPal Payments Advanced you must configure some settings in your PayPal Payments Advanced account by logging into","Um PayPal Payments Advanced zu nutzen, müssen Sie einige Einstellungen in Ihrem PayPal Payments Advanced-Konto vornehmen, indem Sie sich einloggen" -"Toggle Editor","Zum Editor wechseln" -"Tools","Werkzeuge" -"Top 5 Search Terms","Oberste 5 Suchbegriffe" -"Total","Gesamt" -"Total Invoiced","Rechnungssumme" -"Total","Auftrags-Gesamtbetrag" -"Total Refunded","Erstattete Summe" -"Total of %d record(s) have been deleted.","Insgesamt %d Datensatz/Datensätze wurde(n) gelöscht." -"Total of %d record(s) have been updated.","Insgeamt %d Datensätze wurden aktualisiert." -"Total of %d record(s) were canceled.","Insgesamt %d Eintragung(en) wurden gelöscht." -"Total of %d record(s) were deleted","Insgesamt wurde(n) %d Aufzeichnung(en) gelöscht" -"Total of %d record(s) were deleted.","Ingesamt wurde(n) %d Aufzeichnung(en) gelöscht" -"Total of %d record(s) were updated","Insgeamt wurde(n) %d Aufzeichnung(en) aktualisiert" -"Total of %d record(s) were updated.","Insgeamt wurde(n) %d Aufzeichnung(en) aktualisiert" -"Track Order","Bestellung verfolgen" -"Track this shipment","Diese Lieferung verfolgen" -"Tracking number %s for %s assigned","Auftragsverfolgungsnummer %s für %s zugeordnet" -"Tracking number cannot be empty.","Nummer zum Verlaufsstatus kann nicht leer sein." -"Transaction Data","Transaktionsdaten" -"Transaction Details","Transaktionsdetails" -"Transaction ID","Transaktions-ID" -"Transaction Type","Transaktionstyp" -"Transactional Emails","E-Mails zur Transaktion" -"Transactions","Transaktionen" -"Type","Typ" -"Type:","Typ:" -"URL Rewrite","URL-Rewrite" -"URL Rewrite Information","URL-Rewrite-Information" -"URL Rewrite Management","URL-Rewrite-Verwaltung" -"Unable to cancel the credit memo.","Gutschrift kann nicht storniert werden." -"Unable to find a Email Template to delete.","Keine E-Mail-Vorlage zum Löschen gefunden." -"Unable to find a user to delete.","Kein zu löschender Benutzer auffindbar." -"Unable to initialize import model","Importmodell kann nicht initialisiert werden." -"Unable to refresh lifetime statistics.","Lebenszeitstatistik kann nicht aktualisiert werden." -"Unable to refresh recent statistics.","Letzte Statistik kann nicht aktualisiert werden." -"Unable to save Cron expression","Chron. Ausdruck kann nicht gespeichert werden." -"Unable to save the cron expression.","Chron. Ausdruck kann nicht gespeichert werden." -"Unable to save the invoice.","Rechnung kann nicht gespeichert werden." -"Unable to send the invoice email.","E-Mail mit Rechnung kann nicht gesendet werden." -"Unable to send the shipment email.","Versand-Email kann nicht gesendet werden." -"Unable to update transaction details.","Die Angaben zu Ihrer Transaktion konnten nicht aktualisiert werden." -"Unable to void the credit memo.","Gutschrift kann nicht ungültig gemacht werden." -"Unknown","Unbekannt" -"Unlimited","Unbegrenzt" -"Update","Aktualisieren" -"Updated At","Aktualisiert um" -"Upload File","Datei hochladen" -"Upload Files","Dateien hochladen" -"Upload HTTP Error","HTTP-Fehler hochladen" -"Upload I/O Error","Ein-/Ausgabefehler beim Hochladen" -"Upload Security Error","Security-Fehler hochladen" -"Upload import file","Importdatei hochladen" -"Uploaded file is larger than %.2f kilobytes allowed by server","Hochgeladene Datei ist %.2f Kilobytes größer als der Server ermöglicht." -"Use All Available Attributes","Alle verfügbaren Attribute verwenden" -"Use Config Settings","Konfig.-Einstellungen verwenden" -"Use Default","Standard verwenden" -"Use Default Value","Standardwert verwenden" -"Use Default Variable Values","Standardvariablenwerte verwenden" -"Use FTP Connection","FTP-Verbindung verwenden" -"Use Website","Website verwenden" -"Used Currently For","Zurzeit verwendet für" -"Used as Default For","Als Standard Genutzt Für" -"User Email","Benutzer-Email" -"User ID","Benutzer-ID" -"User Info","Benutzerinfo" -"User Information","Benutzer-Information" -"User Name","Benutzername" -"User Name is required field.","Das Feld 'Benutzername' muss ausgefüllt werden." -"User Name:","Benutzername:" -"User Password","Benutzerpasswort" -"User Role","Benutzerrolle" -"User Roles","Benutzerrollen" -"User Roles Information","Informationen zu Benutzerrollen" -"User name","Benutzername" -"Users","Benutzer" -"VAT Number is Invalid","Umsatzsteuer-Identifikationsnummer ist Ungültig" -"VAT Number is Valid","Umsatzsteuer-Identifikationsnummer ist Gültig" -"Validation Results","Prüfergebnisse" -"Value","Wert" -"Value Delimiter:","Wertbegrenzer:" -"Variable","Variable" -"Variable Code","Variabler Code" -"Variable HTML Value","Variabler HTML-Wert" -"Variable ID","Variablen-ID" -"Variable Name","Name der Variablen" -"Variable Plain Value","Einfacher Variablenwert" -"View Actions XML","XML mit Aktionen anzeigen" -"View Full Size","Gesamtgröße ansehen" -"View Memo","Memo anzeigen" -"View Memo for #%s","Siehe Memo für #%s" -"View Shipment","Lieferung anzeigen" -"View Statistics For:","Statistiken einsehen für:" -"Visibility:","Sichtbarkeit:" -"Warning","Warnung" -"Warning! Empty value can cause problems with CSV format.","Warnhinweis! Ein leerer Wert kann Probleme beim CSV-Format verursachen." -"Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?","Warnmeldung!\r\nDurch diese Aktion wird dieser Benutzer von einer bereits zugewiesenen Rolle entfernt.\r\nAktion dennoch ausführen?" -"Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?","Warnung!\r\nSie sind dabei, diese Anwender von bereits zugeordneten Rollen zu entfernen\r\nSind Sie sicher?" -"Warning: Please do not close the window during importing/exporting data","Warnhinweis: Schließen Sie das Fenster nicht, während Daten importiert/exportiert werden." -"Watermark File for %s","Wasserzeichendatei für %s" -"We appreciate our merchants\' feedback, please <a href=""#"" onclick=""surveyAction(\'yes\'); return false;"">take our survey</a> to provide insight on the features you would like included in Magento. <a href=""#"" onclick=""surveyAction(\'no\'); return false;"">Remove this notification</a>","Das Feedback unserer\' Händler ist uns wichtig, bitte <a href=""#"" onclick=""surveyAction(\'yes\'); return false;"">Nehmen Sie an unserer Umfrage teil</a>, um uns einen Einblick in die Funktionen zu vermitteln, die Sie sich in Magento wünschen. <a href=""#"" onclick=""surveyAction(\'no\'); return false;"">Diese Mitteilung entfernen</a>" -"We\'re in our typing table, coding away more features for Magento. Thank you for your patience.","Wir arbeiten zurzeit an der Entwicklung neuer Angebote für Magento. Vielen Dank für Ihre Geduld." -"Web Section","Webbereich" -"Web Services","Webdienste" -"Web services","Web Services" -"Website","Website" -"What is this?","Was ist das?" -"Wishlist Report","Wunschlistenbericht" -"Wishlist item is not loaded.","Der Artikel auf der Wunschliste wird nicht geladen." -"Wrong account specified.","Falsches Konto angegeben." -"Wrong billing agreement ID specified.","Falsche Zahlungsvereinbarungs-ID angegeben." -"Wrong column format.","Falsches Spaltenformat." -"Wrong newsletter template.","Falsche Newsletter-Vorlage." -"Wrong quote item.","Falsches Inhaltselement." -"Wrong tab configuration.","Fehlerhafte Konfiguration der Registerkarte." -"Wrong transaction ID specified.","Falsche Transaktions-ID angegeben." -"XML","XML" -"XML data is invalid.","XML-Daten sind ungültig." -"XML object is not instance of ""Magento\Simplexml\Element"".","XML-Objekt ist kein ""Magento\Simplexml\Element""." -"YTD","Jahr bis Datum" -"Year","Jahr" -"Yes","Ja" -"Yes (301 Moved Permanently)","Ja (301 dauerhaft entfernt)" -"Yes (302 Found)","Ja (302 gefunden)" -"Yes (only price with tax)","Ja (nur Preis mit Steuer)" -"You cannot delete your own account.","Sie können Ihren eigenen Account nicht löschen." -"You have %s unread message(s).","Sie haben %s ungelesene Nachricht(en)." -"You have %s unread message(s). <a href=""%s"">Go to messages inbox</a>.","Sie haben %s ungelesene Nachricht(en). <a>Gehen Sie zum Posteingang</a>." -"You have %s, %s and %s unread messages. <a href=""%s"">Go to messages inbox</a>.","Sie haben %s, %s und %s ungelesene Nachrichten. <a>Gehen Sie zum Posteingang</a>." -"You have logged out.","Sie haben sich abgemeldet." -"You have not enough permissions to use this functionality.","Sie haben keine ausreichenden Berechtigungen für die Verwendung dieser Funktion." -"You must have JavaScript enabled in your browser to utilize the functionality of this website.","Sie müssen JavaScript in Ihrem Browser aktiviert haben, damit die Funktionen der Webseite ordnungsgemäß genutzt werden können." -"You need to specify order items.","Sie müssen Bestellartikel angeben." -"You will need to wait when the action ends.","Sie werden das Ende der Aktion abwarten müssen." -"Your answers contain duplicates.","Ihre Antworten enthalten Duplikate." -"Your password has been updated.","Ihr Passwort wurde geändert." -"Your password reset link has expired.","Der Link für das Resetten Ihres Passworts ist abgelaufen." -"Your server PHP settings allow you to upload files not more than %s at a time. Please modify post_max_size (currently is %s) and upload_max_filesize (currently is %s) values in php.ini if you want to upload larger files.","Die PHP-Einstellungen Ihres Servers ermöglichen Ihnen das Hochladen von Dateien mit maximal %s gleichzeitig. Bitte ändern Sie die Werte für post_max_size (aktueller Wert: %s) und upload_max_filesize (aktueller Wert: %s) in der php.ini-Datei, wenn Sie größere Dateien hochladen möchten." -"Your web server is configured incorrectly. As a result, configuration files with sensitive information are accessible from the outside. Please contact your hosting provider.","Ihr Webserver ist falsch konfiguriert. Als Ergebnis sind Konfigurationsdateien mit sensiblen Informationen von außen zugänglich. Bitte kontaktieren Sie Ihren Hosting-Anbieter." -"Zip/Postal Code","Postleitzahl" -"Zip/Postal Code:","Postleitzahl:" -"[ deleted ]","[gelöscht]" -"[GLOBAL]","[GLOBAL]" -"[STORE VIEW]","[LADENANSICHT]" -"[WEBSITE]","[WEBSEITE]" -"b","b" -"close","schließen" -"critical","kritisch" -"example: ""sitemap/"" or ""/"" for base path (path must be writeable)","Beispiel: ""Sitemap/"" oder ""/"" für den Basis-Pfad (Pfad muss beschreibbar sein)" -"example: sitemap.xml","example: sitemap.xml" -"failed","fehlgeschlagen" -"from","von" -"major","größer" -"minor","kleiner" -"notice","Bemerkung" -"store(%s) scope","Laden(%s)-Umfang" -"successful","erfolgreich" -"to","bis" -"website(%s) scope","Website(%s)-Umfang" -"{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. It is highly recommended to change this value in your Magento <a href=""%s"">configuration</a>.","{{base_url}} wird nicht empfohlen, in einer Produktionsumgebung zu verwenden, um die Base als Unsichere URL / Base Sicher URL zu erklären. Es wird dringend empfohlen, diesen Wert in Ihrer Magento-<a href=""%s"">Konfiguration</a> zu ändern." diff --git a/app/code/Magento/Adminhtml/i18n/en_US.csv b/app/code/Magento/Adminhtml/i18n/en_US.csv deleted file mode 100644 index 1ed1af94ffb..00000000000 --- a/app/code/Magento/Adminhtml/i18n/en_US.csv +++ /dev/null @@ -1,1162 +0,0 @@ -" The customer does not exist in the system anymore."," The customer does not exist in the system anymore." -" You will need to navigate to your "," You will need to navigate to your " -" [deleted]"," [deleted]" -" and "," and " -" and go to the "," and go to the " -" sections for your Hosted Checkout Pages."," sections for your Hosted Checkout Pages." -"%s (Default Template from Locale)","%s (Default Template from Locale)" -"%s cache type(s) disabled.","%s cache type(s) disabled." -"%s cache type(s) enabled.","%s cache type(s) enabled." -"%s cache type(s) refreshed.","%s cache type(s) refreshed." -"(For Type ""Local Server"" need to use relative path to Magento install var/export or var/import, e.g. var/export, var/import, var/export/some/dir, var/import/some/dir)","(For Type ""Local Server"" need to use relative path to Magento install var/export or var/import, e.g. var/export, var/import, var/export/some/dir, var/import/some/dir)" -"(For US 2-letter state names)","(For US 2-letter state names)" -"(If left empty will be auto-generated)","(If left empty will be auto-generated)" -"(Leave empty for first spreadsheet)","(Leave empty for first spreadsheet)" -"(Products will be added/updated to this store if 'store' column is blank or missing in the import file.)","(Products will be added/updated to this store if 'store' column is blank or missing in the import file.)" -"(Shift-)Click or drag to change value","(Shift-)Click or drag to change value" -"(Starting with)","(Starting with)" -"(When 'No', only mapped fields will be imported. When mapping, use 'column1', 'column2', etc.)","(When 'No', only mapped fields will be imported. When mapping, use 'column1', 'column2', etc.)" -"(You have to increase php memory_limit before changing this value)","(You have to increase php memory_limit before changing this value)" -"(\\t for tab)","(\\t for tab)" -"* - If indexing is in progress, it will be killed and new indexing process will start.","* - If indexing is in progress, it will be killed and new indexing process will start." -"- Click on any of the time parts to increase it","- Click on any of the time parts to increase it" -"- Hold mouse button on any of the above buttons for faster selection.","- Hold mouse button on any of the above buttons for faster selection." -"- Use the %s buttons to select month","- Use the %s buttons to select month" -"- Use the %s, %s buttons to select year","- Use the %s, %s buttons to select year" -"- or Shift-click to decrease it","- or Shift-click to decrease it" -"- or click and drag for faster selection.","- or click and drag for faster selection." -"-- Not Selected --","-- Not Selected --" -"-- Please Select --","-- Please Select --" -"-- Please Select Billing Agreement--","-- Please Select Billing Agreement--" -"-- Please Select a Category --","-- Please Select a Category --" -"-- Please select --","-- Please select --" -"--Please Select--","--Please Select--" -"1 Hour","1 Hour" -"1. set up","1. set up" -"12 Hours","12 Hours" -"12h AM/PM","12h AM/PM" -"2 Hours","2 Hours" -"2. customize","2. customize" -"24 Hours","24 Hours" -"24h","24h" -"2YTD","2YTD" -"6 Hours","6 Hours" -"<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>","<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>" -"<strong>Attention</strong>: Captcha is case sensitive.","<strong>Attention</strong>: Captcha is case sensitive." -"A user with the same user name or email aleady exists.","A user with the same user name or email aleady exists." -"API Key","API Key" -"API Key Confirmation","API Key Confirmation" -"ASCII","ASCII" -"Abandoned Carts","Abandoned Carts" -"About the calendar","About the calendar" -"Access Denied","Access Denied" -"Access denied","Access denied" -"Access denied.","Access denied." -"Account Created in:","Account Created in:" -"Account Created on (%s):","Account Created on (%s):" -"Account Created on:","Account Created on:" -"Account Information","Account Information" -"Account Status","Account Status" -"Account status","Account status" -"Action","Action" -"Actions","Actions" -"Actions XML","Actions XML" -"Active","Active" -"Add","Add" -"Add \Exception","Add \Exception" -"Add Field Mapping","Add Field Mapping" -"Add Field with URL:","Add Field with URL:" -"Add New","Add New" -"Add New Image","Add New Image" -"Add New Profile","Add New Profile" -"Add New Role","Add New Role" -"Add New Template","Add New Template" -"Add New URL Rewrite","Add New URL Rewrite" -"Add New User","Add New User" -"Add New Variable","Add New Variable" -"Add Products","Add Products" -"Add URL Rewrite","Add URL Rewrite" -"Add URL Rewrite for a Category","Add URL Rewrite for a Category" -"Add URL Rewrite for a Product","Add URL Rewrite for a Product" -"Add after","Add after" -"Additional Cache Management","Additional Cache Management" -"Address Type:","Address Type:" -"Admin","Admin" -"Advanced Admin Section","Advanced Admin Section" -"Advanced Profiles","Advanced Profiles" -"Advanced Section","Advanced Section" -"All","All" -"All Allowed Countries","All Allowed Countries" -"All Cache","All Cache" -"All Files","All Files" -"All Reviews","All Reviews" -"All Store Views","All Store Views" -"All Websites","All Websites" -"All countries","All countries" -"All fields","All fields" -"All possible rates were fetched, please click on ""Save"" to apply","All possible rates were fetched, please click on ""Save"" to apply" -"All rates were fetched, please click on ""Save"" to apply","All rates were fetched, please click on ""Save"" to apply" -"All valid rates have been saved.","All valid rates have been saved." -"Always (during development)","Always (during development)" -"Amounts","Amounts" -"An error has occurred while syncronizing media storages.","An error has occurred while syncronizing media storages." -"An error occurred while clearing the JavaScript/CSS cache.","An error occurred while clearing the JavaScript/CSS cache." -"An error occurred while clearing the image cache.","An error occurred while clearing the image cache." -"An error occurred while deleting URL Rewrite.","An error occurred while deleting URL Rewrite." -"An error occurred while deleting email template data. Please review log and try again.","An error occurred while deleting email template data. Please review log and try again." -"An error occurred while deleting record(s).","An error occurred while deleting record(s)." -"An error occurred while deleting this role.","An error occurred while deleting this role." -"An error occurred while deleting this set.","An error occurred while deleting this set." -"An error occurred while deleting this template.","An error occurred while deleting this template." -"An error occurred while finishing process. Please refresh the cache","An error occurred while finishing process. Please refresh the cache" -"An error occurred while rebuilding the CatalogInventory Stock Status.","An error occurred while rebuilding the CatalogInventory Stock Status." -"An error occurred while rebuilding the catalog index.","An error occurred while rebuilding the catalog index." -"An error occurred while rebuilding the flat catalog category.","An error occurred while rebuilding the flat catalog category." -"An error occurred while rebuilding the flat product catalog.","An error occurred while rebuilding the flat product catalog." -"An error occurred while rebuilding the search index.","An error occurred while rebuilding the search index." -"An error occurred while refreshing the Catalog Rewrites.","An error occurred while refreshing the Catalog Rewrites." -"An error occurred while refreshing the Layered Navigation indices.","An error occurred while refreshing the Layered Navigation indices." -"An error occurred while refreshing the catalog rewrites.","An error occurred while refreshing the catalog rewrites." -"An error occurred while refreshing the layered navigation indices.","An error occurred while refreshing the layered navigation indices." -"An error occurred while saving URL Rewrite.","An error occurred while saving URL Rewrite." -"An error occurred while saving account.","An error occurred while saving account." -"An error occurred while saving review.","An error occurred while saving review." -"An error occurred while saving the customer.","An error occurred while saving the customer." -"An error occurred while saving this configuration:","An error occurred while saving this configuration:" -"An error occurred while saving this role.","An error occurred while saving this role." -"An error occurred while saving this template.","An error occurred while saving this template." -"An error occurred while updating the selected review(s).","An error occurred while updating the selected review(s)." -"Any","Any" -"Any Attribute Set","Any Attribute Set" -"Any Group","Any Group" -"Any Status","Any Status" -"Any Store","Any Store" -"Any Type","Any Type" -"Any Visibility","Any Visibility" -"Any data created since the backup was made will be lost including admin users, customers and orders.","Any data created since the backup was made will be lost including admin users, customers and orders." -"Archive file name:","Archive file name:" -"Are you sure that you want to delete this template?","Are you sure that you want to delete this template?" -"Are you sure that you want to strip tags?","Are you sure that you want to strip tags?" -"Are you sure you want to do this?","Are you sure you want to do this?" -"Are you sure you want to proceed?","Are you sure you want to proceed?" -"Area","Area" -"As low as:","As low as:" -"Assigned","Assigned" -"Attribute Set Name:","Attribute Set Name:" -"Attributes","Attributes" -"Automatic (equalize price ranges)","Automatic (equalize price ranges)" -"Automatic (equalize product counts)","Automatic (equalize product counts)" -"Average","Average" -"Average Orders","Average Orders" -"BINARY","BINARY" -"Back","Back" -"Back to Login","Back to Login" -"Backup","Backup" -"Backup Name","Backup Name" -"Backup options","Backup options" -"Backups","Backups" -"Base currency","Base currency" -"Bcc","Bcc" -"Bestsellers","Bestsellers" -"Billing Address","Billing Address" -"Billing Address: ","Billing Address: " -"Billing Agreement","Billing Agreement" -"Billing Agreements","Billing Agreements" -"Block Information","Block Information" -"Both (without and with tax)","Both (without and with tax)" -"Both IPN and PDT","Both IPN and PDT" -"Browse Files...","Browse Files..." -"Bundle with dynamic pricing cannot include custom defined options. Options will not be saved.","Bundle with dynamic pricing cannot include custom defined options. Options will not be saved." -"CMS","CMS" -"CRITICAL","CRITICAL" -"CSV","CSV" -"CSV / Tab separated","CSV / Tab separated" -"Cache Control","Cache Control" -"Cache Control (beta)","Cache Control (beta)" -"Cache Management","Cache Management" -"Cache Type","Cache Type" -"Cancel","Cancel" -"Cannot add new comment.","Cannot add new comment." -"Cannot add tracking number.","Cannot add tracking number." -"Cannot create an invoice without products.","Cannot create an invoice without products." -"Cannot create credit memo for the order.","Cannot create credit memo for the order." -"Cannot delete the design change.","Cannot delete the design change." -"Cannot delete tracking number.","Cannot delete tracking number." -"Cannot do shipment for the order separately from invoice.","Cannot do shipment for the order separately from invoice." -"Cannot do shipment for the order.","Cannot do shipment for the order." -"Cannot initialize shipment for adding tracking number.","Cannot initialize shipment for adding tracking number." -"Cannot initialize shipment for delete tracking number.","Cannot initialize shipment for delete tracking number." -"Cannot load track with retrieving identifier.","Cannot load track with retrieving identifier." -"Cannot retrieve tracking number detail.","Cannot retrieve tracking number detail." -"Cannot save shipment.","Cannot save shipment." -"Cannot save the credit memo.","Cannot save the credit memo." -"Cannot send shipment information.","Cannot send shipment information." -"Cannot update item quantity.","Cannot update item quantity." -"Cannot update the item\'s quantity.","Cannot update the item\'s quantity." -"Card Verification Number","Card Verification Number" -"Catalog","Catalog" -"Catalog Price Rules","Catalog Price Rules" -"Catalog Rewrites","Catalog Rewrites" -"Categories","Categories" -"Category:","Category:" -"Chart is disabled. If you want to enable chart, click <a href=""%s"">here</a>.","Chart is disabled. If you want to enable chart, click <a href=""%s"">here</a>." -"Checkbox","Checkbox" -"Child Transactions","Child Transactions" -"Choose Store View:","Choose Store View:" -"Choose an attribute","Choose an attribute" -"Chosen category does not associated with any website, so url rewrite is not possible.","Chosen category does not associated with any website, so url rewrite is not possible." -"Chosen product does not associated with any website, so url rewrite is not possible.","Chosen product does not associated with any website, so url rewrite is not possible." -"Clear","Clear" -"Close","Close" -"Comment text field cannot be empty.","Comment text field cannot be empty." -"Complete","Complete" -"Configuration","Configuration" -"Confirm New Password","Confirm New Password" -"Confirmed email:","Confirmed email:" -"Connect with the Magento Community","Connect with the Magento Community" -"Continue","Continue" -"Convert to Plain Text","Convert to Plain Text" -"Cookie (unsafe)","Cookie (unsafe)" -"Country","Country" -"Country:","Country:" -"Coupons","Coupons" -"Create","Create" -"Create DB Backup","Create DB Backup" -"Create New Attribute","Create New Attribute" -"Create URL Rewrite:","Create URL Rewrite:" -"Created At","Created At" -"Credit Card %s","Credit Card %s" -"Credit Card Number","Credit Card Number" -"Credit Card Number: xxxx-%s","Credit Card Number: xxxx-%s" -"Credit Card Type","Credit Card Type" -"Credit Card Type: %s","Credit Card Type: %s" -"Credit Memo History","Credit Memo History" -"Credit Memo Totals","Credit Memo Totals" -"Credit Memos","Credit Memos" -"Credit memo #%s comment added","Credit memo #%s comment added" -"Credit memo #%s created","Credit memo #%s created" -"Credit memo\'s total must be positive.","Credit memo\'s total must be positive." -"Currency","Currency" -"Currency ""%s"" is used as %s in %s.","Currency ""%s"" is used as %s in %s." -"Currency Information","Currency Information" -"Currency Setup Section","Currency Setup Section" -"Current Configuration Scope:","Current Configuration Scope:" -"Current Month","Current Month" -"Custom","Custom" -"Custom Variable ""%s""","Custom Variable ""%s""" -"Custom Variables","Custom Variables" -"Customer","Customer" -"Customer Group:","Customer Group:" -"Customer Groups","Customer Groups" -"Customer","Customer" -"Customer Reviews","Customer Reviews" -"Customer Shopping Carts","Customer Shopping Carts" -"Customer Since:","Customer Since:" -"Customer Tax Classes","Customer Tax Classes" -"Customer with the same email already exists.","Customer with the same email already exists." -"Customers","Customers" -"Customers by Orders","Customers by Orders" -"Customers by Orders Total","Customers by Orders Total" -"DHTML Date/Time Selector","DHTML Date/Time Selector" -"Dashboard","Dashboard" -"Data Format","Data Format" -"Data transfer:","Data transfer:" -"Database","Database" -"Date","Date" -"Date & Time","Date & Time" -"Added","Added" -"Updated","Updated" -"Date selection:","Date selection:" -"Date selector","Date selector" -"Day","Day" -"Decimal separator:","Decimal separator:" -"Default (Admin) Values","Default (Admin) Values" -"Default Billing Address","Default Billing Address" -"Default Config","Default Config" -"Default Template from Locale","Default Template from Locale" -"Default Values","Default Values" -"Default display currency ""%s"" is not available in allowed currencies.","Default display currency ""%s"" is not available in allowed currencies." -"Default scope","Default scope" -"Delete","Delete" -"Delete %s","Delete %s" -"Delete %s '%s'","Delete %s '%s'" -"Delete File","Delete File" -"Delete Image","Delete Image" -"Delete Profile","Delete Profile" -"Delete Role","Delete Role" -"Delete Store","Delete Store" -"Delete Store View","Delete Store View" -"Delete Template","Delete Template" -"Delete User","Delete User" -"Delete Website","Delete Website" -"Description","Description" -"Design","Design" -"Design Section","Design Section" -"Details","Details" -"Developer Section","Developer Section" -"Direction:","Direction:" -"Disable","Disable" -"Disabled","Disabled" -"Display %s first","Display %s first" -"Display default currency","Display default currency" -"Distributed under GNU LGPL. See %s for details.","Distributed under GNU LGPL. See %s for details." -"Do you really want to KILL parallel process and start new indexing process?","Do you really want to KILL parallel process and start new indexing process?" -"Do you really want to proceed?","Do you really want to proceed?" -"Download","Download" -"Downloads","Downloads" -"Drag to move","Drag to move" -"Drop-down","Drop-down" -"Edit","Edit" -"Edit Design Change","Edit Design Change" -"Edit Email Template","Edit Email Template" -"Edit Order","Edit Order" -"Edit Queue","Edit Queue" -"Edit Review","Edit Review" -"Edit Role","Edit Role" -"Edit Store View","Edit Store View" -"Edit System Template","Edit System Template" -"Edit Template","Edit Template" -"Edit URL Rewrite","Edit URL Rewrite" -"Edit User","Edit User" -"Edit User '%s'","Edit User '%s'" -"Edit Website","Edit Website" -"Email","Email" -"Email Address:","Email Address:" -"Email Preview","Email Preview" -"Email to a Friend","Email to a Friend" -"Email:","Email:" -"Enable","Enable" -"Enabled","Enabled" -"Enclose Values In:","Enclose Values In:" -"Entity Attributes","Entity Attributes" -"Entity Type","Entity Type" -"Entity type:","Entity type:" -"Error","Error" -"Excel XML","Excel XML" -"Excl. Tax","Excl. Tax" -"Exclude media folder from backup","Exclude media folder from backup" -"Expiration Date","Expiration Date" -"Expiration Date: %s/%s","Expiration Date: %s/%s" -"Export","Export" -"Export CSV","Export CSV" -"Export Filters","Export Filters" -"Export to:","Export to:" -"Export:","Export:" -"FTP Host","FTP Host" -"FTP Host[:Port]","FTP Host[:Port]" -"FTP Login","FTP Login" -"FTP Password","FTP Password" -"FTP credentials","FTP credentials" -"Failed to add a product to cart by id ""%s"".","Failed to add a product to cart by id ""%s""." -"Failed to cancel the billing agreement.","Failed to cancel the billing agreement." -"Failed to clear the JavaScript/CSS cache.","Failed to clear the JavaScript/CSS cache." -"Failed to delete the billing agreement.","Failed to delete the billing agreement." -"Failed to update the profile.","Failed to update the profile." -"Field","Field" -"Field Mapping","Field Mapping" -"File","File" -"File Information","File Information" -"File System","File System" -"File mode","File mode" -"File name:","File name:" -"File size should be more than 0 bytes","File size should be more than 0 bytes" -"Finished profile execution.","Finished profile execution." -"First Invoice Created Date","First Invoice Created Date" -"First Name","First Name" -"First Name is required field.","First Name is required field." -"First Name:","First Name:" -"Fixed","Fixed" -"Flush Catalog Images Cache","Flush Catalog Images Cache" -"Flush JavaScript/CSS Cache","Flush JavaScript/CSS Cache" -"For category","For category" -"For latest version visit: %s","For latest version visit: %s" -"For product","For product" -"Forgot Admin Password","Forgot Admin Password" -"Forgot your password?","Forgot your password?" -"Forgot your user name or password?","Forgot your user name or password?" -"From","From" -"GLOBAL","GLOBAL" -"Gb","Gb" -"General Information","General Information" -"General Section","General Section" -"Get Image Base64","Get Image Base64" -"Get help for this page","Get help for this page" -"Global Attribute","Global Attribute" -"Global Record Search","Global Record Search" -"Global Search","Global Search" -"Go Today","Go Today" -"Go to messages inbox","Go to messages inbox" -"Go to notifications","Go to notifications" -"Google Base","Google Base" -"Google Content","Google Content" -"Google Sitemaps","Google Sitemaps" -"Grand Total","Grand Total" -"Grid (default) / List","Grid (default) / List" -"Grid Only","Grid Only" -"Group:","Group:" -"Guest","Guest" -"HTTP (unsecure)","HTTP (unsecure)" -"HTTPS (SSL)","HTTPS (SSL)" -"Help Us Keep Magento Healthy - Report All Bugs","Help Us Keep Magento Healthy - Report All Bugs" -"Helper attributes should not be used in custom layout updates.","Helper attributes should not be used in custom layout updates." -"Helper for options rendering doesn't implement required interface.","Helper for options rendering doesn't implement required interface." -"Home","Home" -"ID","ID" -"ID Path","ID Path" -"IP Address","IP Address" -"IPN (Instant Payment Notification) Only","IPN (Instant Payment Notification) Only" -"If there is an account associated with %s you will receive an email with a link to reset your password.","If there is an account associated with %s you will receive an email with a link to reset your password." -"If this message persists, please contact the store owner.","If this message persists, please contact the store owner." -"Images (.gif, .jpg, .png)","Images (.gif, .jpg, .png)" -"Images Cache","Images Cache" -"Import","Import" -"Import Service","Import Service" -"Import and Export","Import and Export" -"Import and Export Tax Rates","Import and Export Tax Rates" -"Import/Export","Import/Export" -"Import/Export Advanced","Import/Export Advanced" -"Import/Export Profile","Import/Export Profile" -"Important: ","Important: " -"Imported <strong>%s</strong> records","Imported <strong>%s</strong> records" -"In","In" -"In Database:","In Database:" -"In File:","In File:" -"Inactive","Inactive" -"Incl. Tax","Incl. Tax" -"Incoming Message","Incoming Message" -"Insert Variable...","Insert Variable..." -"Interactive","Interactive" -"Interface Locale: %s","Interface Locale: %s" -"Invalid Form Key. Please refresh the page.","Invalid Form Key. Please refresh the page." -"Invalid Import Service Specified","Invalid Import Service Specified" -"Invalid POST data (please check post_max_size and upload_max_filesize settings in your php.ini file).","Invalid POST data (please check post_max_size and upload_max_filesize settings in your php.ini file)." -"Invalid Secret Key. Please refresh the page.","Invalid Secret Key. Please refresh the page." -"Invalid User Name or Password.","Invalid User Name or Password." -"Invalid directory: %s","Invalid directory: %s" -"Invalid email address ""%s"".","Invalid email address ""%s""." -"Invalid email address.","Invalid email address." -"Invalid file: %s","Invalid file: %s" -"Invalid input data for %s => %s rate","Invalid input data for %s => %s rate" -"Invalid parent block for this block","Invalid parent block for this block" -"Invalid parent block for this block.","Invalid parent block for this block." -"Invalid password reset token.","Invalid password reset token." -"Invalid sender name ""%s"". Please use only visible characters and spaces.","Invalid sender name ""%s"". Please use only visible characters and spaces." -"Invalid timezone","Invalid timezone" -"Invalidated","Invalidated" -"Inventory Stock Status","Inventory Stock Status" -"Invoice #%s comment added","Invoice #%s comment added" -"Invoice #%s created","Invoice #%s created" -"Invoice History","Invoice History" -"Invoice Totals","Invoice Totals" -"Invoice canceling error.","Invoice canceling error." -"Invoice capturing error.","Invoice capturing error." -"Invoice voiding error.","Invoice voiding error." -"Invoices","Invoices" -"Is Closed","Is Closed" -"Issue Number","Issue Number" -"Items","Items" -"JavaScript seems to be disabled in your browser.","JavaScript seems to be disabled in your browser." -"JavaScript/CSS","JavaScript/CSS" -"JavaScript/CSS Cache","JavaScript/CSS Cache" -"Kb","Kb" -"Last 24 Hours","Last 24 Hours" -"Last 5 Orders","Last 5 Orders" -"Last 5 Search Terms","Last 5 Search Terms" -"Last 7 Days","Last 7 Days" -"Last Credit Memo Created Date","Last Credit Memo Created Date" -"Last Invoice Created Date","Last Invoice Created Date" -"Last Logged In (%s):","Last Logged In (%s):" -"Last Logged In:","Last Logged In:" -"Last Name","Last Name" -"Last Name is required field.","Last Name is required field." -"Last Name:","Last Name:" -"Last updated: %s. To refresh last day\'s <a href=""%s"">statistics</a>, click <a href=""%s"">here</a>.","Last updated: %s. To refresh last day\'s <a href=""%s"">statistics</a>, click <a href=""%s"">here</a>." -"Latest Message:","Latest Message:" -"Layered Navigation Indices","Layered Navigation Indices" -"Layered Navigation Indices were refreshed.","Layered Navigation Indices were refreshed." -"Leave empty to use tax identifier","Leave empty to use tax identifier" -"Lifetime Sales","Lifetime Sales" -"Lifetime statistics have been updated.","Lifetime statistics have been updated." -"Links","Links" -"Links with associated products will retain only after saving current product.","Links with associated products will retain only after saving current product." -"List (default) / Grid","List (default) / Grid" -"List Only","List Only" -"Load Template","Load Template" -"Load default template","Load default template" -"Loading...","Loading..." -"Local Server","Local Server" -"Local/Remote Server","Local/Remote Server" -"Locale","Locale" -"Log Out","Log Out" -"Log in to Admin Panel","Log in to Admin Panel" -"Log into Magento Admin Page","Log into Magento Admin Page" -"Logged in as %s","Logged in as %s" -"Login","Login" -"Low Stock","Low Stock" -"MAJOR","MAJOR" -"MINOR","MINOR" -"MS Excel XML","MS Excel XML" -"Magento Admin","Magento Admin" -"Magento Commerce - Administrative Panel","Magento Commerce - Administrative Panel" -"Magento Connect","Magento Connect" -"Magento Connect Manager","Magento Connect Manager" -"Magento Logo","Magento Logo" -"Magento is a trademark of X.commerce, Inc. Copyright © %s X.commerce, Inc.","Magento is a trademark of X.commerce, Inc. Copyright © %s X.commerce, Inc." -"Magento root directory","Magento root directory" -"Magento ver. %s","Magento ver. %s" -"Magento® is a trademark of X.commerce, Inc.<br/>Copyright © %s X.commerce, Inc.","Magento® is a trademark of X.commerce, Inc.<br/>Copyright © %s X.commerce, Inc." -"Make sure that data encoding in the file is consistent and saved in one of supported encodings (UTF-8 or ANSI).","Make sure that data encoding in the file is consistent and saved in one of supported encodings (UTF-8 or ANSI)." -"Manage Attribute Sets","Manage Attribute Sets" -"Manage Attributes","Manage Attributes" -"Manage Categories","Manage Categories" -"Manage Content","Manage Content" -"Manage Currency Rates","Manage Currency Rates" -"Manage Customers","Manage Customers" -"Manage Ratings","Manage Ratings" -"Manage Stores","Manage Stores" -"Manage Tax Rules","Manage Tax Rules" -"Manage Tax Zones and Rates","Manage Tax Zones and Rates" -"Manual","Manual" -"Matched Expression","Matched Expression" -"Mb","Mb" -"Media (.avi, .flv, .swf)","Media (.avi, .flv, .swf)" -"Media storages synchronization has completed!","Media storages synchronization has completed!" -"Messages Inbox","Messages Inbox" -"Month","Month" -"Most Viewed","Most Viewed" -"Most Viewed Products","Most Viewed Products" -"Multiple Select","Multiple Select" -"My Account","My Account" -"N/A","N/A" -"NOTICE","NOTICE" -"Name","Name" -"Name on Card","Name on Card" -"Name on the Card: %s","Name on the Card: %s" -"Name:","Name:" -"Never (production)","Never (production)" -"New ","New " -"New API Key","New API Key" -"New Accounts","New Accounts" -"New Attribute","New Attribute" -"New Block","New Block" -"New Category","New Category" -"New Class","New Class" -"New Condition","New Condition" -"New Custom Variable","New Custom Variable" -"New Customer","New Customer" -"New Customers","New Customers" -"New Design Change","New Design Change" -"New Email Template","New Email Template" -"New Group","New Group" -"New Invoice","New Invoice" -"New Item Type","New Item Type" -"New Memo","New Memo" -"New Memo for #%s","New Memo for #%s" -"New Page","New Page" -"New Password","New Password" -"New Profile","New Profile" -"New Rate","New Rate" -"New Rating","New Rating" -"New Review","New Review" -"New Role","New Role" -"New Rule","New Rule" -"New Search","New Search" -"New Set","New Set" -"New Shipment","New Shipment" -"New Sitemap","New Sitemap" -"New Store View","New Store View" -"New System Template","New System Template" -"New Template","New Template" -"New User","New User" -"New Variable","New Variable" -"New Website","New Website" -"New attribute set mapping","New attribute set mapping" -"New password field cannot be empty.","New password field cannot be empty." -"Newsletter","Newsletter" -"Newsletter Problems","Newsletter Problems" -"Newsletter Queue","Newsletter Queue" -"Newsletter Subscribers","Newsletter Subscribers" -"Newsletter Templates","Newsletter Templates" -"Next month (hold for menu)","Next month (hold for menu)" -"Next year (hold for menu)","Next year (hold for menu)" -"No","No" -"No (price without tax)","No (price without tax)" -"No Data","No Data" -"No Data Found","No Data Found" -"No Templates Found","No Templates Found" -"No change","No change" -"No customer id defined.","No customer id defined." -"No information available.","No information available." -"No profile loaded...","No profile loaded..." -"No records found for this period.","No records found for this period." -"No records found.","No records found." -"No report code specified.","No report code specified." -"No search keywords.","No search keywords." -"No search modules were registered","No search modules were registered" -"No wishlist item id defined.","No wishlist item id defined." -"None","None" -"Note:","Note:" -"Notes","Notes" -"Notifications","Notifications" -"Orders","Orders" -"Uses","Uses" -"Views","Views" -"Number of records:","Number of records:" -"OK","OK" -"Old rate:","Old rate:" -"One or more media files failed to be synchronized during the media storages syncronization process. Refer to the log file for details.","One or more media files failed to be synchronized during the media storages syncronization process. Refer to the log file for details." -"One or more of the Cache Types are invalidated:","One or more of the Cache Types are invalidated:" -"Online Customers","Online Customers" -"Only Once (version upgrade)","Only Once (version upgrade)" -"Only attributes with scope ""Global"", input type ""Dropdown"" and Use To Create Configurable Product ""Yes"" are available.","Only attributes with scope ""Global"", input type ""Dropdown"" and Use To Create Configurable Product ""Yes"" are available." -"Only mapped fields","Only mapped fields" -"Optional","Optional" -"Options","Options" -"Order","Order" -"Order %s","Order %s" -"Order %s (%s)","Order %s (%s)" -"Order Created Date","Order Created Date" -"Order ID","Order ID" -"Order Totals","Order Totals" -"Order Updated Date","Order Updated Date" -"Order Updated Date report is real-time, does not need statistics refreshing.","Order Updated Date report is real-time, does not need statistics refreshing." -"Orders","Orders" -"Original Magento attribute names in first row:","Original Magento attribute names in first row:" -"Out of stock","Out of stock" -"PDT (Payment Data Transfer) Only","PDT (Payment Data Transfer) Only" -"Package Extensions","Package Extensions" -"Pages","Pages" -"Parent Product Thumbnail","Parent Product Thumbnail" -"Parent Transaction ID","Parent Transaction ID" -"Passive mode","Passive mode" -"Password","Password" -"Password Confirmation","Password Confirmation" -"Password confirmation must be same as password.","Password confirmation must be same as password." -"Password must be at least of %d characters.","Password must be at least of %d characters." -"Password must include both numeric and alphabetic characters.","Password must include both numeric and alphabetic characters." -"Password:","Password:" -"Path:","Path:" -"PayPal Manager","PayPal Manager" -"Payment method instance is not available.","Payment method instance is not available." -"Payment method is not available.","Payment method is not available." -"Payment method must be specified.","Payment method must be specified." -"Pending Reviews","Pending Reviews" -"Per Item","Per Item" -"Per Order","Per Order" -"Percent","Percent" -"Performed At","Performed At" -"Interval","Interval" -"Permanent (301)","Permanent (301)" -"Permissions","Permissions" -"Personal Information","Personal Information" -"Phone:","Phone:" -"Please Select","Please Select" -"Please confirm site switching. All data that hasn\'t been saved will be lost.","Please confirm site switching. All data that hasn\'t been saved will be lost." -"Please enter 6 or more characters.","Please enter 6 or more characters." -"Please enter a number greater than 0 in this field.","Please enter a number greater than 0 in this field." -"Please enter a valid $ amount. For example $100.00.","Please enter a valid $ amount. For example $100.00." -"Please enter a valid URL. For example http://www.example.com or www.example.com","Please enter a valid URL. For example http://www.example.com or www.example.com" -"Please enter a valid URL. http:// is required","Please enter a valid URL. http:// is required" -"Please enter a valid credit card number.","Please enter a valid credit card number." -"Please enter a valid date.","Please enter a valid date." -"Please enter a valid email address. For example johndoe@domain.com.","Please enter a valid email address. For example johndoe@domain.com." -"Please enter a valid email.","Please enter a valid email." -"Please enter a valid number in this field.","Please enter a valid number in this field." -"Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.","Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890." -"Please enter a valid social security number. For example 123-45-6789.","Please enter a valid social security number. For example 123-45-6789." -"Please enter a valid value from list","Please enter a valid value from list" -"Please enter a valid value, ex: 10,20,30","Please enter a valid value, ex: 10,20,30" -"Please enter a valid zip code.","Please enter a valid zip code." -"Please enter a valid zip code. For example 90602 or 90602-1234.","Please enter a valid zip code. For example 90602 or 90602-1234." -"Please enter another credit card number to complete your purchase.","Please enter another credit card number to complete your purchase." -"Please enter password","Please enter password" -"Please enter password to confirm rollback.","Please enter password to confirm rollback." -"Please enter valid password.","Please enter valid password." -"Please make sure that all global admin search modules are installed and activated.","Please make sure that all global admin search modules are installed and activated." -"Please make sure that your changes were saved before running the profile.","Please make sure that your changes were saved before running the profile." -"Please make sure your passwords match.","Please make sure your passwords match." -"Please select State/Province.","Please select State/Province." -"Please select a customer.","Please select a customer." -"Please select a store.","Please select a store." -"Please select an option.","Please select an option." -"Please select catalog searches.","Please select catalog searches." -"Please select customer(s).","Please select customer(s)." -"Please select message(s).","Please select message(s)." -"Please select one of the above options.","Please select one of the above options." -"Please select one of the options.","Please select one of the options." -"Please select review(s).","Please select review(s)." -"Please specify backup creation options","Please specify backup creation options" -"Please specify the admin custom URL.","Please specify the admin custom URL." -"Please try to logout and sign in again.","Please try to logout and sign in again." -"Please type the letters from the image:","Please type the letters from the image:" -"Please use in this field only ""a-z,0-9,_"".","Please use in this field only ""a-z,0-9,_""." -"Please use letters only (a-z) in this field.","Please use letters only (a-z) in this field." -"Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.","Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas." -"Please use only letters (a-z or A-Z), numbers (0-9) or spaces in this field.","Please use only letters (a-z or A-Z), numbers (0-9) or spaces in this field." -"Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.","Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed." -"Please use only letters (a-z) or numbers (0-9) or spaces and # only in this field.","Please use only letters (a-z) or numbers (0-9) or spaces and # only in this field." -"Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.","Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006." -"Please wait while the indexes are being refreshed.","Please wait while the indexes are being refreshed." -"Please wait, loading...","Please wait, loading..." -"Please wait...","Please wait..." -"Popular","Popular" -"Position of Watermark for %s","Position of Watermark for %s" -"Pregenerated product images files.","Pregenerated product images files." -"Prev. month (hold for menu)","Prev. month (hold for menu)" -"Prev. year (hold for menu)","Prev. year (hold for menu)" -"Preview","Preview" -"Preview Template","Preview Template" -"Price","Price" -"Price alert subscription was saved.","Price alert subscription was saved." -"Price:","Price:" -"Processed <strong>%s%% %s/%d</strong> records","Processed <strong>%s%% %s/%d</strong> records" -"Product","Product" -"Product","Product" -"Product Reviews","Product Reviews" -"Product Tax Classes","Product Tax Classes" -"Product Thumbnail Itself","Product Thumbnail Itself" -"Product is not loaded.","Product is not loaded." -"Product:","Product:" -"Products","Products" -"Products Bestsellers Report","Products Bestsellers Report" -"Products Most Viewed Report","Products Most Viewed Report" -"Products Ordered","Products Ordered" -"Products in Carts","Products in Carts" -"Profile Action","Profile Action" -"Profile Actions XML","Profile Actions XML" -"Profile Direction","Profile Direction" -"Profile History","Profile History" -"Profile Information","Profile Information" -"Profile Name","Profile Name" -"Profile Payments","Profile Payments" -"Profile Schedule","Profile Schedule" -"Profile Wizard","Profile Wizard" -"Profiles","Profiles" -"Promo","Promo" -"Promotions","Promotions" -"Purchased Item","Purchased Item" -"Put store on the maintenance mode while backup creation","Put store on the maintenance mode while backup creation" -"Put store on the maintenance mode while rollback processing","Put store on the maintenance mode while rollback processing" -"Quantity","Quantity" -"Queue Refresh","Queue Refresh" -"Queued... Cancel","Queued... Cancel" -"Radio Buttons","Radio Buttons" -"Rates","Rates" -"Read details","Read details" -"Rebuild","Rebuild" -"Rebuild Catalog Index","Rebuild Catalog Index" -"Rebuild Flat Catalog Category","Rebuild Flat Catalog Category" -"Rebuild Flat Catalog Product","Rebuild Flat Catalog Product" -"Recent Orders","Recent Orders" -"Recent statistics have been updated.","Recent statistics have been updated." -"Recurring Profile View","Recurring Profile View" -"Recursive Dir","Recursive Dir" -"Redirect","Redirect" -"Reference","Reference" -"Reference ID","Reference ID" -"Refresh","Refresh" -"Refresh Now*","Refresh Now*" -"Refresh Statistics","Refresh Statistics" -"Region/State","Region/State" -"Regular Price:","Regular Price:" -"Release","Release" -"Release Stability","Release Stability" -"Release Version","Release Version" -"Reload captcha","Reload captcha" -"Remote FTP","Remote FTP" -"Remove","Remove" -"Reports","Reports" -"Request Path","Request Path" -"Required","Required" -"Reset","Reset" -"Reset Filter","Reset Filter" -"Reset Password","Reset Password" -"Reset a Password","Reset a Password" -"Resize","Resize" -"Resource Access","Resource Access" -"Resources","Resources" -"Results","Results" -"Retrieve Password","Retrieve Password" -"Return Html Version","Return Html Version" -"Revenue","Revenue" -"Reviews","Reviews" -"Reviews and Ratings","Reviews and Ratings" -"Rewrite Rules","Rewrite Rules" -"Role ID","Role ID" -"Role Info","Role Info" -"Role Information","Role Information" -"Role Name","Role Name" -"Role Resources","Role Resources" -"Role Users","Role Users" -"Roles","Roles" -"Roles Resources","Roles Resources" -"Rotate CCW","Rotate CCW" -"Rotate CW","Rotate CW" -"Run","Run" -"Run Profile","Run Profile" -"Run Profile Inside This Window","Run Profile Inside This Window" -"Run Profile in Popup","Run Profile in Popup" -"Running... Kill","Running... Kill" -"SKU","SKU" -"SKU:","SKU:" -"SSL Error: Invalid or self-signed certificate","SSL Error: Invalid or self-signed certificate" -"Sales","Sales" -"Sales Report","Sales Report" -"Samples","Samples" -"Save","Save" -"Save & Generate","Save & Generate" -"Save Account","Save Account" -"Save Cache Settings","Save Cache Settings" -"Save Config","Save Config" -"Save Currency Rates","Save Currency Rates" -"Save Profile","Save Profile" -"Save Role","Save Role" -"Save Template","Save Template" -"Save User","Save User" -"Save and Continue Edit","Save and Continue Edit" -"Search","Search" -"Search Index","Search Index" -"Search Term","Search Term" -"Search Terms","Search Terms" -"Select","Select" -"Select All","Select All" -"Select Category","Select Category" -"Select Date","Select Date" -"Select Range","Select Range" -"Select date","Select date" -"Selected allowed currency ""%s"" is not available in installed currencies.","Selected allowed currency ""%s"" is not available in installed currencies." -"Selected base currency is not available in installed currencies.","Selected base currency is not available in installed currencies." -"Selected default display currency is not available in allowed currencies.","Selected default display currency is not available in allowed currencies." -"Selected default display currency is not available in installed currencies.","Selected default display currency is not available in installed currencies." -"Self-assigned roles cannot be deleted.","Self-assigned roles cannot be deleted." -"Sender","Sender" -"Separate Email","Separate Email" -"Service Settings","Service Settings" -"Set up & Customize","Set up & Customize" -"Shipment #%s comment added","Shipment #%s comment added" -"Shipment #%s created","Shipment #%s created" -"Shipment Comments","Shipment Comments" -"Shipment History","Shipment History" -"Shipments","Shipments" -"Shipping","Shipping" -"Shipping Address","Shipping Address" -"Shipping Address: ","Shipping Address: " -"Shipping Origin","Shipping Origin" -"Shipping Price","Shipping Price" -"Shipping address selection is not applicable","Shipping address selection is not applicable" -"Shipping method must be specified.","Shipping method must be specified." -"Shipping method selection is not applicable","Shipping method selection is not applicable" -"Shopping Cart","Shopping Cart" -"Shopping Cart Price Rules","Shopping Cart Price Rules" -"Shopping Cart from %s","Shopping Cart from %s" -"Show By","Show By" -"Show Report For:","Show Report For:" -"Show Reviews","Show Reviews" -"Sitemap Information","Sitemap Information" -"Size for %s","Size for %s" -"Skip Category Selection","Skip Category Selection" -"Some items in this order have different invoice and shipment types. You can create shipment only after the invoice is created.","Some items in this order have different invoice and shipment types. You can create shipment only after the invoice is created." -"Some of the ordered items do not exist in the catalog anymore and will be removed if you try to edit the order.","Some of the ordered items do not exist in the catalog anymore and will be removed if you try to edit the order." -"Sorry, this feature is coming soon...","Sorry, this feature is coming soon..." -"Special Price:","Special Price:" -"Specific Countries","Specific Countries" -"Specified","Specified" -"Specified profile does not exist.","Specified profile does not exist." -"Spreadsheet Name:","Spreadsheet Name:" -"Start Date","Start Date" -"Starting profile execution, please wait...","Starting profile execution, please wait..." -"State/Province:","State/Province:" -"Static Blocks","Static Blocks" -"Status","Status" -"Status:","Status:" -"Stock Quantity:","Stock Quantity:" -"Stock notification was saved.","Stock notification was saved." -"Store","Store" -"Store Email Addresses Section","Store Email Addresses Section" -"Store View","Store View" -"Store:","Store:" -"Stores","Stores" -"Subject","Subject" -"Submit","Submit" -"Subpackage cannot be conflicting.","Subpackage cannot be conflicting." -"Subtotal","Subtotal" -"Switch/Solo card issue number: %s","Switch/Solo card issue number: %s" -"Switch/Solo card start Date: %s/%s","Switch/Solo card start Date: %s/%s" -"Switch/Solo/Maestro Only","Switch/Solo/Maestro Only" -"Switch/Solo/Maestro(UK Domestic) Only","Switch/Solo/Maestro(UK Domestic) Only" -"Switch/Solo/Maestro(UK Domestic) card issue number: %s","Switch/Solo/Maestro(UK Domestic) card issue number: %s" -"Switch/Solo/Maestro(UK Domestic) card start Date: %s/%s","Switch/Solo/Maestro(UK Domestic) card start Date: %s/%s" -"Symbol","Symbol" -"Synchronization is required.","Synchronization is required." -"Synchronization of media storages has been successfully completed.","Synchronization of media storages has been successfully completed." -"Synchronize","Synchronize" -"Synchronizing %s to %s","Synchronizing %s to %s" -"Synchronizing...","Synchronizing..." -"System","System" -"System Section","System Section" -"System busy","System busy" -"Target Path","Target Path" -"Tax","Tax" -"Tb","Tb" -"Template","Template" -"Template Content","Template Content" -"Template Information","Template Information" -"Template","Template" -"Template Styles","Template Styles" -"Template Subject","Template Subject" -"Template Type","Template Type" -"Temporary (302)","Temporary (302)" -"Terms and Conditions","Terms and Conditions" -"Text","Text" -"The Catalog Rewrites were refreshed.","The Catalog Rewrites were refreshed." -"The CatalogInventory Stock Status has been rebuilt.","The CatalogInventory Stock Status has been rebuilt." -"The Comment Text field cannot be empty.","The Comment Text field cannot be empty." -"The Flat Catalog Product was rebuilt","The Flat Catalog Product was rebuilt" -"The JavaScript/CSS cache has been cleaned.","The JavaScript/CSS cache has been cleaned." -"The JavaScript/CSS cache has been cleared.","The JavaScript/CSS cache has been cleared." -"The Layered Navigation indexing has been queued.","The Layered Navigation indexing has been queued." -"The Layered Navigation indexing queue has been canceled.","The Layered Navigation indexing queue has been canceled." -"The Layered Navigation indices were refreshed.","The Layered Navigation indices were refreshed." -"The Layered Navigation process has been queued to be killed.","The Layered Navigation process has been queued to be killed." -"The Magento cache storage has been flushed.","The Magento cache storage has been flushed." -"The URL Rewrite has been deleted.","The URL Rewrite has been deleted." -"The URL Rewrite has been saved.","The URL Rewrite has been saved." -"The account has been saved.","The account has been saved." -"The archive can be uncompressed with <a href=""%s"">%s</a> on Windows systems","The archive can be uncompressed with <a href=""%s"">%s</a> on Windows systems" -"The attribute set has been removed.","The attribute set has been removed." -"The backup's creation process will take time.","The backup's creation process will take time." -"The billing agreement has been canceled.","The billing agreement has been canceled." -"The billing agreement has been deleted.","The billing agreement has been deleted." -"The cache storage has been flushed.","The cache storage has been flushed." -"The carrier needs to be specified.","The carrier needs to be specified." -"The catalog index has been rebuilt.","The catalog index has been rebuilt." -"The catalog rewrites have been refreshed.","The catalog rewrites have been refreshed." -"The configuration has been saved.","The configuration has been saved." -"The credit memo has been canceled.","The credit memo has been canceled." -"The credit memo has been created.","The credit memo has been created." -"The credit memo has been voided.","The credit memo has been voided." -"The custom variable has been deleted.","The custom variable has been deleted." -"The custom variable has been saved.","The custom variable has been saved." -"The customer has been deleted.","The customer has been deleted." -"The customer has been saved.","The customer has been saved." -"The design change has been deleted.","The design change has been deleted." -"The design change has been saved.","The design change has been saved." -"The email address is empty.","The email address is empty." -"The email template has been deleted.","The email template has been deleted." -"The email template has been saved.","The email template has been saved." -"The flat catalog category has been rebuilt.","The flat catalog category has been rebuilt." -"The group node name must be specified with field node name.","The group node name must be specified with field node name." -"The image cache was cleaned.","The image cache was cleaned." -"The image cache was cleared.","The image cache was cleared." -"The invoice and shipment have been created.","The invoice and shipment have been created." -"The invoice and the shipment have been created. The shipping label cannot be created at the moment.","The invoice and the shipment have been created. The shipping label cannot be created at the moment." -"The invoice has been canceled.","The invoice has been canceled." -"The invoice has been captured.","The invoice has been captured." -"The invoice has been created.","The invoice has been created." -"The invoice has been voided.","The invoice has been voided." -"The invoice no longer exists.","The invoice no longer exists." -"The item %s (SKU %s) does not exist in the catalog anymore.","The item %s (SKU %s) does not exist in the catalog anymore." -"The order does not allow creating an invoice.","The order does not allow creating an invoice." -"The order no longer exists.","The order no longer exists." -"The profile has been deleted.","The profile has been deleted." -"The profile has been saved.","The profile has been saved." -"The profile has been updated.","The profile has been updated." -"The profile has no changes.","The profile has no changes." -"The profile you are trying to save no longer exists","The profile you are trying to save no longer exists" -"The rating has been deleted.","The rating has been deleted." -"The rating has been saved.","The rating has been saved." -"The role has been deleted.","The role has been deleted." -"The role has been saved.","The role has been saved." -"The role has been successfully saved.","The role has been successfully saved." -"The search index has been rebuilt.","The search index has been rebuilt." -"The shipment has been created.","The shipment has been created." -"The shipment has been sent.","The shipment has been sent." -"The shipping label has been created.","The shipping label has been created." -"The transaction details have been updated.","The transaction details have been updated." -"The user has been deleted.","The user has been deleted." -"The user has been saved.","The user has been saved." -"Themes JavaScript and CSS files combined to one file.","Themes JavaScript and CSS files combined to one file." -"There is an error in one of the option rows.","There is an error in one of the option rows." -"This Account is","This Account is" -"This Email template no longer exists.","This Email template no longer exists." -"This Role no longer exists","This Role no longer exists" -"This Role no longer exists.","This Role no longer exists." -"This account is","This account is" -"This account is inactive.","This account is inactive." -"This action cannot be undone.","This action cannot be undone." -"This attribute set does not have attributes which we can use for configurable product","This attribute set does not have attributes which we can use for configurable product" -"This attribute shares the same value in all the stores","This attribute shares the same value in all the stores" -"This is a demo store. Any orders placed through this store will not be honored or fulfilled.","This is a demo store. Any orders placed through this store will not be honored or fulfilled." -"This is a required field.","This is a required field." -"This product is currently disabled.","This product is currently disabled." -"This report depends on timezone configuration. Once timezone is changed, the lifetime statistics need to be refreshed.","This report depends on timezone configuration. Once timezone is changed, the lifetime statistics need to be refreshed." -"This section is not allowed.","This section is not allowed." -"This user no longer exists.","This user no longer exists." -"Time","Time" -"Time selection:","Time selection:" -"Time:","Time:" -"Timeout limit for response from synchronize process was reached.","Timeout limit for response from synchronize process was reached." -"To","To" -"To cancel pending authorizations and release amounts that have already been processed during this payment, click Cancel.","To cancel pending authorizations and release amounts that have already been processed during this payment, click Cancel." -"To use PayPal Payflow Link you must configure some settings in your Payflow account by logging into","To use PayPal Payflow Link you must configure some settings in your Payflow account by logging into" -"To use PayPal Payments Advanced you must configure some settings in your PayPal Payments Advanced account by logging into","To use PayPal Payments Advanced you must configure some settings in your PayPal Payments Advanced account by logging into" -"Toggle Editor","Toggle Editor" -"Tools","Tools" -"Top 5 Search Terms","Top 5 Search Terms" -"Total","Total" -"Total Invoiced","Total Invoiced" -"Total","Total" -"Total Refunded","Total Refunded" -"Total of %d record(s) have been deleted.","Total of %d record(s) have been deleted." -"Total of %d record(s) have been updated.","Total of %d record(s) have been updated." -"Total of %d record(s) were canceled.","Total of %d record(s) were canceled." -"Total of %d record(s) were deleted","Total of %d record(s) were deleted" -"Total of %d record(s) were deleted.","Total of %d record(s) were deleted." -"Total of %d record(s) were updated","Total of %d record(s) were updated" -"Total of %d record(s) were updated.","Total of %d record(s) were updated." -"Track Order","Track Order" -"Track this shipment","Track this shipment" -"Tracking number %s for %s assigned","Tracking number %s for %s assigned" -"Tracking number cannot be empty.","Tracking number cannot be empty." -"Transaction Data","Transaction Data" -"Transaction Details","Transaction Details" -"Transaction ID","Transaction ID" -"Transaction Type","Transaction Type" -"Transactional Emails","Transactional Emails" -"Transactions","Transactions" -"Try Magento Go for Free","Try Magento Go for Free" -"Type","Type" -"Type:","Type:" -"URL Rewrite","URL Rewrite" -"URL Rewrite Information","URL Rewrite Information" -"URL Rewrite Management","URL Rewrite Management" -"Unable to cancel the credit memo.","Unable to cancel the credit memo." -"Unable to find a Email Template to delete.","Unable to find a Email Template to delete." -"Unable to find a user to delete.","Unable to find a user to delete." -"Unable to initialize import model","Unable to initialize import model" -"Unable to refresh lifetime statistics.","Unable to refresh lifetime statistics." -"Unable to refresh recent statistics.","Unable to refresh recent statistics." -"Unable to save Cron expression","Unable to save Cron expression" -"Unable to save the cron expression.","Unable to save the cron expression." -"Unable to save the invoice.","Unable to save the invoice." -"Unable to send the invoice email.","Unable to send the invoice email." -"Unable to send the shipment email.","Unable to send the shipment email." -"Unable to update transaction details.","Unable to update transaction details." -"Unable to void the credit memo.","Unable to void the credit memo." -"Unknown","Unknown" -"Unlimited","Unlimited" -"Update","Update" -"Updated At","Updated At" -"Upload File","Upload File" -"Upload Files","Upload Files" -"Upload HTTP Error","Upload HTTP Error" -"Upload I/O Error","Upload I/O Error" -"Upload Security Error","Upload Security Error" -"Upload import file","Upload import file" -"Uploaded file is larger than %.2f kilobytes allowed by server","Uploaded file is larger than %.2f kilobytes allowed by server" -"Use All Available Attributes","Use All Available Attributes" -"Use Config Settings","Use Config Settings" -"Use Default","Use Default" -"Use Default Value","Use Default Value" -"Use Default Variable Values","Use Default Variable Values" -"Use FTP Connection","Use FTP Connection" -"Use Website","Use Website" -"Used Currently For","Used Currently For" -"Used as Default For","Used as Default For" -"User Email","User Email" -"User ID","User ID" -"User Info","User Info" -"User Information","User Information" -"User Name","User Name" -"User Name is required field.","User Name is required field." -"User Name:","User Name:" -"User Password","User Password" -"User Role","User Role" -"User Roles","User Roles" -"User Roles Information","User Roles Information" -"User name","User name" -"Users","Users" -"VAT Number is Invalid","VAT Number is Invalid" -"VAT Number is Valid","VAT Number is Valid" -"Validation Results","Validation Results" -"Value","Value" -"Value Delimiter:","Value Delimiter:" -"Variable","Variable" -"Variable Code","Variable Code" -"Variable HTML Value","Variable HTML Value" -"Variable ID","Variable ID" -"Variable Name","Variable Name" -"Variable Plain Value","Variable Plain Value" -"View Actions XML","View Actions XML" -"View Full Size","View Full Size" -"View Memo","View Memo" -"View Memo for #%s","View Memo for #%s" -"View Shipment","View Shipment" -"View Statistics For:","View Statistics For:" -"Visibility:","Visibility:" -"Warning","Warning" -"Warning! Empty value can cause problems with CSV format.","Warning! Empty value can cause problems with CSV format." -"Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?","Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?" -"Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?","Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?" -"Warning: Please do not close the window during importing/exporting data","Warning: Please do not close the window during importing/exporting data" -"Watermark File for %s","Watermark File for %s" -"We appreciate our merchants\' feedback, please <a href=""#"" onclick=""surveyAction(\'yes\'); return false;"">take our survey</a> to provide insight on the features you would like included in Magento. <a href=""#"" onclick=""surveyAction(\'no\'); return false;"">Remove this notification</a>","We appreciate our merchants\' feedback, please <a href=""#"" onclick=""surveyAction(\'yes\'); return false;"">take our survey</a> to provide insight on the features you would like included in Magento. <a href=""#"" onclick=""surveyAction(\'no\'); return false;"">Remove this notification</a>" -"We\'re in our typing table, coding away more features for Magento. Thank you for your patience.","We\'re in our typing table, coding away more features for Magento. Thank you for your patience." -"Web Section","Web Section" -"Web Services","Web Services" -"Web services","Web services" -"Website","Website" -"What is this?","What is this?" -"Wishlist Report","Wishlist Report" -"Wishlist item is not loaded.","Wishlist item is not loaded." -"Wrong account specified.","Wrong account specified." -"Wrong billing agreement ID specified.","Wrong billing agreement ID specified." -"Wrong column format.","Wrong column format." -"Wrong newsletter template.","Wrong newsletter template." -"Wrong quote item.","Wrong quote item." -"Wrong tab configuration.","Wrong tab configuration." -"Wrong transaction ID specified.","Wrong transaction ID specified." -"XML","XML" -"XML data is invalid.","XML data is invalid." -"XML object is not instance of ""Magento\Simplexml\Element"".","XML object is not instance of ""Magento\Simplexml\Element""." -"YTD","YTD" -"Year","Year" -"Yes","Yes" -"Yes (301 Moved Permanently)","Yes (301 Moved Permanently)" -"Yes (302 Found)","Yes (302 Found)" -"Yes (only price with tax)","Yes (only price with tax)" -"You cannot delete your own account.","You cannot delete your own account." -"You have %s unread message(s).","You have %s unread message(s)." -"You have %s unread message(s). <a href=""%s"">Go to messages inbox</a>.","You have %s unread message(s). <a href=""%s"">Go to messages inbox</a>." -"You have %s, %s and %s unread messages. <a href=""%s"">Go to messages inbox</a>.","You have %s, %s and %s unread messages. <a href=""%s"">Go to messages inbox</a>." -"You have logged out.","You have logged out." -"You have not enough permissions to use this functionality.","You have not enough permissions to use this functionality." -"You must have JavaScript enabled in your browser to utilize the functionality of this website.","You must have JavaScript enabled in your browser to utilize the functionality of this website." -"You need to specify order items.","You need to specify order items." -"You will need to wait when the action ends.","You will need to wait when the action ends." -"Your answers contain duplicates.","Your answers contain duplicates." -"Your password has been updated.","Your password has been updated." -"Your password reset link has expired.","Your password reset link has expired." -"Your server PHP settings allow you to upload files not more than %s at a time. Please modify post_max_size (currently is %s) and upload_max_filesize (currently is %s) values in php.ini if you want to upload larger files.","Your server PHP settings allow you to upload files not more than %s at a time. Please modify post_max_size (currently is %s) and upload_max_filesize (currently is %s) values in php.ini if you want to upload larger files." -"Your web server is configured incorrectly. As a result, configuration files with sensitive information are accessible from the outside. Please contact your hosting provider.","Your web server is configured incorrectly. As a result, configuration files with sensitive information are accessible from the outside. Please contact your hosting provider." -"Zip/Postal Code","Zip/Postal Code" -"Zip/Postal Code:","Zip/Postal Code:" -"[ deleted ]","[ deleted ]" -"[GLOBAL]","[GLOBAL]" -"[STORE VIEW]","[STORE VIEW]" -"[WEBSITE]","[WEBSITE]" -"b","b" -"close","close" -"critical","critical" -"example: ""sitemap/"" or ""/"" for base path (path must be writeable)","example: ""sitemap/"" or ""/"" for base path (path must be writeable)" -"example: sitemap.xml","example: sitemap.xml" -"failed","failed" -"from","from" -"major","major" -"minor","minor" -"notice","notice" -"store(%s) scope","store(%s) scope" -"successful","successful" -"to","to" -"website(%s) scope","website(%s) scope" -"{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. It is highly recommended to change this value in your Magento <a href=""%s"">configuration</a>.","{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. It is highly recommended to change this value in your Magento <a href=""%s"">configuration</a>." diff --git a/app/code/Magento/Adminhtml/i18n/es_ES.csv b/app/code/Magento/Adminhtml/i18n/es_ES.csv deleted file mode 100644 index 39bf86f8596..00000000000 --- a/app/code/Magento/Adminhtml/i18n/es_ES.csv +++ /dev/null @@ -1,1144 +0,0 @@ -" The customer does not exist in the system anymore.","El cliente ya no existe en el sistema." -" You will need to navigate to your ","Necesitas ir a tu" -" [deleted]"," [eliminado]" -" and "," y " -" and go to the "," e ir al " -" sections for your Hosted Checkout Pages."," secciones para tus páginas de verificación alojadas." -"%s (Default Template from Locale)","%s (Plantilla Predeterminada en Ubicación Local)" -"%s cache type(s) disabled.","%s tipo(s) de caché desactivado(s)." -"%s cache type(s) enabled.","%s tipo(s) de caché activado(s)." -"%s cache type(s) refreshed.","%s tipo(s) de caché actualizado(s)." -"(For Type ""Local Server"" need to use relative path to Magento install var/export or var/import, e.g. var/export, var/import, var/export/some/dir, var/import/some/dir)","(Para el Tipo ""Servidor Local"") necesitas usar una ruta relativa para instalar Magento var/export o var/import, ej. var/export, var/import, var/export/some/dir, var/import/some/dir)" -"(For US 2-letter state names)","(Para los nombres de estado de 2 letras de los EE.UU.)" -"(If left empty will be auto-generated)","(Se generará automáticamente si se deja en blanco)" -"(Leave empty for first spreadsheet)","(Dejar en blanco para la primera hoja de cálculo)" -"(Products will be added/updated to this store if 'store' column is blank or missing in the import file.)","(Los productos se añadirán/actualizarán en esta tienda si la columna 'tienda' está vacÃa o no aparece en el fichero de importación.)" -"(Shift-)Click or drag to change value","Pulse (Shift-) o arrastre para modificar el valor" -"(Starting with)","(Comenzando con)" -"(When 'No', only mapped fields will be imported. When mapping, use 'column1', 'column2', etc.)","(Cuando 'No', solo los campos mapeados se importarán. Al hacer los mapas, usa 'column1', 'column2', etc.)" -"(You have to increase php memory_limit before changing this value)","(Debe aumentar el lÃmite de memoria php antes de modificar este valor)" -"(\\t for tab)","(\t para tabular)" -"* - If indexing is in progress, it will be killed and new indexing process will start.","* - Si está ejecutándose un indexado, será interrumpido y empezará un nuevo proceso de indexado." -"- Click on any of the time parts to increase it","- Pulse sobre cualquiera de los fragmentos de tiempo para aumentarlo" -"- Hold mouse button on any of the above buttons for faster selection.","- Mantenga pulsado el botón del ratón sobre cualquiera de los botones de arriba para obtener una selección más rápida." -"- Use the %s buttons to select month","- Utilice los botones %s para seleccionar el mes" -"- Use the %s, %s buttons to select year","- Utilice los botones %s, %s para seleccionar el año" -"- or Shift-click to decrease it","- o pulse Shift para disminuirlo" -"- or click and drag for faster selection.","- o pulse y arrastre para obtener una selección más rápida." -"-- Not Selected --","-- Sin seleccionar --" -"-- Please Select --","-- Por favor seleccione --" -"-- Please Select Billing Agreement--","-- Por favor, Seleccione el Acuerdo de Facturación--" -"-- Please Select a Category --","-- Por favor, Elija una CategorÃa --" -"-- Please select --","--Por favor, selecciona--" -"--Please Select--","--Seleccione--" -"1 Hour","1 Hora" -"1. set up","1. configuración" -"12 Hours","12 Horas" -"12h AM/PM","12h AM/PM" -"2 Hours","2 Horas" -"2. customize","2. personalización" -"24 Hours","24 Horas" -"24h","24h" -"2YTD","2YTD" -"6 Hours","6 Horas" -"<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>","<h1 class=""page-heading"">Error 404</h1><p>Página no encontrada.</p>" -"<strong>Attention</strong>: Captcha is case sensitive.","<strong>Atención</strong>: Captcha es sensible al uso de mayúsculas y minúsculas." -"A user with the same user name or email aleady exists.","Ya existe un usuario con el mismo nombre de usuario o correo electrónico." -"API Key","Clave API" -"API Key Confirmation","Confirmación de Clave API" -"ASCII","ASCII" -"Abandoned Carts","Carros Abandonados" -"About the calendar","Sobre el calendario" -"Access Denied","Acceso denegado" -"Access denied","Acceso denegado" -"Access denied.","Acceso denegado" -"Account Created in:","Cuenta Creada en:" -"Account Created on (%s):","Cuenta Creada en (%s):" -"Account Created on:","Cuenta Creada en:" -"Account Information","Información de Cuenta" -"Account Status","Estado de la cuenta" -"Account status","Estado de la cuenta" -"Action","Acción" -"Actions","Acciones" -"Actions XML","Acciones XML" -"Active","Activo" -"Add","Agregar" -"Add \Exception","Añadir Excepción" -"Add Field Mapping","Añadir Mapeo de Campo" -"Add Field with URL:","Añadir Campo con URL:" -"Add New","Añadir Nuevo" -"Add New Image","Añadir Nueva Imagen" -"Add New Profile","Añadir Nuevo Perfil" -"Add New Role","Añadir Nuevo Papel" -"Add New Template","Agregar nueva plantilla" -"Add New URL Rewrite","Añadir Nueva Reescritura de URL" -"Add New User","Añadir Nuevo Usuario" -"Add New Variable","Añadir Nueva Variable" -"Add Products","Añadir productos" -"Add URL Rewrite","Añadir Reescritura de URL" -"Add URL Rewrite for a Category","Añadir Reescritura de URL para una CategorÃa" -"Add URL Rewrite for a Product","Añadir Reescritura de URL para un Producto" -"Add after","Añadir después" -"Additional Cache Management","Gestión de Caché Adicional" -"Address Type:","Tipo de dirección:" -"Admin","Administrar" -"Advanced Admin Section","Sección de Adminsitración Avanzada" -"Advanced Profiles","Perfiles Avanzados" -"Advanced Section","Sección Avanzada" -"All","Todo" -"All Allowed Countries","Todos los Paises Aceptados" -"All Cache","Todo Cache" -"All Files","Todos los Archivos" -"All Reviews","Todas las Revisiones" -"All Store Views","Todas las vistas de tienda" -"All Websites","Todos los Sitios Web" -"All countries","Todos los paÃses" -"All fields","Todos los campos" -"All possible rates were fetched, please click on ""Save"" to apply","Todas las tarifas posibles se recuperaron, por favor, haz clic en ""Guardar"" para aplicarlas." -"All rates were fetched, please click on ""Save"" to apply","Todas las tarifas se recuperaron. por favor, haz clic en ""Guardar"" para aplicarlas" -"All valid rates have been saved.","Todas las tarifas válidas han sido guardadas" -"Always (during development)","Siempre (durante el desarrollo)" -"Amounts","Cantidades" -"An error has occurred while syncronizing media storages.","Ha ocurrido un error mientras se sincronizaban los soportes audiovisuales." -"An error occurred while clearing the JavaScript/CSS cache.","Un error ocurrió mientras se borraba el cache de JavaScript/CSS." -"An error occurred while clearing the image cache.","Un error ocurrió mientras se borraba el cache de imagen" -"An error occurred while deleting URL Rewrite.","Ha habido un error al borrar la URL, reescribela." -"An error occurred while deleting email template data. Please review log and try again.","Un error ocurrió mientras se borraba la plantilla de datos de e-mail. Por favor revisa el usuario e intente otra vez." -"An error occurred while deleting record(s).","Ha habido un error al borrar el(los) historial(es)." -"An error occurred while deleting this role.","Un error ocurrió mientras se borraba esta función." -"An error occurred while deleting this set.","Un error ocurrió mientras se borraba este modelo." -"An error occurred while deleting this template.","Un error ocurrió mientras se borraba esta plantilla." -"An error occurred while finishing process. Please refresh the cache","Un error ocurrió mientras se finalizaba el proceso. Por favor actualice el cache." -"An error occurred while rebuilding the CatalogInventory Stock Status.","Un error ocurrió mientras se reconstruia el estado del catálogo-inventario" -"An error occurred while rebuilding the catalog index.","Un error ocurrió mientras se reconstruÃa el Ãndice del catálogo." -"An error occurred while rebuilding the flat catalog category.","Un error ocurrió mientras se reconstruÃa la categorÃa catálogo." -"An error occurred while rebuilding the flat product catalog.","Un error ocurrió mientras se reconstruÃa el catálogo de producto." -"An error occurred while rebuilding the search index.","Un error ocurrió mientras se reconstruÃa el Ãndice buscador." -"An error occurred while refreshing the Catalog Rewrites.","Un error ocurrió mientras se actualizaba los correcciones en el catálogo." -"An error occurred while refreshing the Layered Navigation indices.","Se produjo un error al actualizar los Ãndices de navegación por capas." -"An error occurred while refreshing the catalog rewrites.","Ha ocurrido un error al actualizar la reescritura de los catálogos." -"An error occurred while refreshing the layered navigation indices.","Ha ocurrido un error al actualizar los Ãndices de navegación por capas." -"An error occurred while saving URL Rewrite.","Ha habido un error al guardar la URL, reescribela." -"An error occurred while saving account.","Se produjo un error al guardar la cuenta" -"An error occurred while saving review.","Ha habido un error al guardar la reseña." -"An error occurred while saving the customer.","Se produjo un error al guardar el cliente." -"An error occurred while saving this configuration:","Se produjo un error al guardar esta configuración:" -"An error occurred while saving this role.","Se produjo un error al guardar esta profesión." -"An error occurred while saving this template.","Se produjo un error al salvar este modelo." -"An error occurred while updating the selected review(s).","Se produjo un error al actualizar la(s) revisión(es) seleccionada(s)." -"Any","Cualquier" -"Any Attribute Set","Cualquier Atributo Establecido." -"Any Group","Todos los grupos" -"Any Status","Todos los estados" -"Any Store","Cualquier Tienda." -"Any Type","Todos los tipos" -"Any Visibility","Todas las visualizaciones" -"Any data created since the backup was made will be lost including admin users, customers and orders.","Cualquier archivo creado desde la creación de la copia de seguridad se perderá, incluyendo usuarios administradores, clientes y pedidos." -"Archive file name:","Nombre del archivo:" -"Are you sure that you want to delete this template?","¿Está seguro de que quiere borrar esta plantilla?" -"Are you sure that you want to strip tags?","¿Está seguro de que quiere eliminar las etiquetas?" -"Are you sure you want to do this?","¿Estás seguro de querer hacer esto?" -"Are you sure you want to proceed?","¿Estás seguro de que quieres continuar?" -"Area","Ãrea" -"As low as:","Tan bajo como:" -"Assigned","Asignado" -"Attribute Set Name:","Nombre del conjunto de atributos:" -"Attributes","Atributos" -"Automatic","Automático" -"Average","Cantidad orden media" -"Average Orders","Órdenes promedias" -"BINARY","BINARIO" -"Back","Volver" -"Back to Login","Volver a Conexión" -"Backup","Copia de respaldo" -"Backup Name","Nombre de la copia de seguridad" -"Backup options","Opciones de la copia de seguridad" -"Backups","Copias de seguridad" -"Base currency","Moneda base" -"Bcc","CO" -"Bestsellers","Los más vendidos" -"Billing Address","Dirección de facturación" -"Billing Address: ","Dirección de facturación:" -"Billing Agreement","Acuerdo de facturación" -"Billing Agreements","Contratos de facturación" -"Block Information","Información de bloque" -"Both (without and with tax)","Ambos (con y sin impuestos)" -"Both IPN and PDT","Tanto IPN como PDT" -"Browse Files...","Examinar archivos..." -"Bundle with dynamic pricing cannot include custom defined options. Options will not be saved.","Un lote con precio dinámico no puede incluir opciones personalizadas. No se grabarán las opciones." -"CMS","CMS" -"CRITICAL","crÃtico" -"CSV","CSV" -"CSV / Tab separated","CSV / separado por tabuladores" -"Cache Control","Control de memoria caché" -"Cache Control (beta)","Control de memoria caché (beta)" -"Cache Management","Gestión de Caché." -"Cache Type","Tipo de memoria caché" -"Cancel","Cancelar" -"Cannot add new comment.","No se puede agregar un nuevo comentario." -"Cannot add tracking number.","No se puede agregar un número de seguimiento." -"Cannot create an invoice without products.","No se puede crear una factura sin productos." -"Cannot create credit memo for the order.","No se puede crear una nota de crédito para el pedido." -"Cannot delete the design change.","No se puede eliminar el cambio de diseño." -"Cannot delete tracking number.","No se puede eliminar el número de seguimiento." -"Cannot do shipment for the order separately from invoice.","No se pueden hacer envÃos para el pedido independientemente de la factura." -"Cannot do shipment for the order.","No se pueden hacer envÃos para el pedido." -"Cannot initialize shipment for adding tracking number.","No se puede inicializar el envÃo para agregar el número de seguimiento." -"Cannot initialize shipment for delete tracking number.","No se puede inicializar el envÃo para eliminar el número de seguimiento." -"Cannot load track with retrieving identifier.","No se puede cargar el seguimiento con el identificador de recuperación." -"Cannot retrieve tracking number detail.","No se puede recuperar el detalle del número de seguimiento." -"Cannot save shipment.","No se puede guardar el envÃo." -"Cannot save the credit memo.","No se puede guardar la nota de crédito." -"Cannot send shipment information.","No se puede enviar información del envÃo." -"Cannot update item quantity.","No se puede actualizar la cantidad de artÃculos." -"Cannot update the item\'s quantity.","No se puede actualizar la cantidad del artÃculo." -"Catalog","Catálogo" -"Catalog Price Rules","Catálogo de Normas sobre Precios" -"Catalog Rewrites","Reescrituras de catálogo" -"Categories","CategorÃas" -"Category:","CategorÃa:" -"Chart is disabled. If you want to enable chart, click <a href=""%s"">here</a>.","Tabla deshabilitada. Si quere habilitar la tabla, pulse <a href=""%s"">here</a>." -"Checkbox","Casilla de verificación" -"Child Transactions","Transacciones hija" -"Choose Store View:","Selecciona Vista de la Tienda:" -"Choose an attribute","Elija un atributo" -"Chosen category does not associated with any website, so url rewrite is not possible.","La categorÃa elegida no está asociada con ninguna página web, asà que no es posible reescribir la url." -"Chosen product does not associated with any website, so url rewrite is not possible.","El producto elegido no está asociado con ninguna página web, asà que no es posible reescribir la url." -"Clear","Limpiar" -"Close","cerrar" -"Comment text field cannot be empty.","El campo de texto de comentarios no puede quedar vacÃo." -"Complete","Completo" -"Configuration","Configuración" -"Confirm New Password","Confirmar Nueva Contraseña" -"Confirmed email:","Correo electrónico confirmado:" -"Connect with the Magento Community","Conectarse con la comunidad Magento" -"Continue","Continuar" -"Continuous","Continuo" -"Convert to Plain Text","Convertir a texto sin formato" -"Cookie (unsafe)","Cookie (no segura)" -"Country","PaÃs" -"Country:","PaÃs:" -"Coupons","Cupones" -"Create","Crear." -"Create DB Backup","Crear Copia de Seguridad de la Base de Datos" -"Create New Attribute","Crear Nuevo Atributo" -"Create URL Rewrite:","Crear Reestructura de URL:" -"Created At","Creado en" -"Credit Card %s","%s de la tarjeta de crédito" -"Credit Memo History","Historial de facturas rectificativas" -"Credit Memo Totals","Total de las facturas rectificativas" -"Credit Memos","Facturas rectificativas" -"Credit memo #%s comment added","%s Comentario añadido en la nota de crédito" -"Credit memo #%s created","Creada nota de crédito #%s" -"Credit memo\'s total must be positive.","El total de la nota de crédito debe ser positivo." -"Currency","Divisa" -"Currency ""%s"" is used as %s in %s.","Moneda ""%s"" es usada como %s en %s." -"Currency Information","Información sobre la Divisa" -"Currency Setup Section","Sección de Configuración de Divisa" -"Current Configuration Scope:","Rango de configuración actual:" -"Current Month","Mes Actual" -"Custom","Personalizado" -"Custom Variable ""%s""","""%s"" customizados variables" -"Custom Variables","Variables personalizadas" -"Customer","Cliente" -"Customer Group:","Grupo de clientes:" -"Customer Groups","Grupos de Cliente" -"Customer","Nombre del Cliente" -"Customer Reviews","Revisiones de Cliente" -"Customer Shopping Carts","Carritos de la Compra del Cliente" -"Customer Since:","Cliente desde:" -"Customer Tax Classes","Tipos de impuestos del cliente" -"Customer with the same email already exists.","Ya existe un cliente con el mismo correo electrónico." -"Customers","Clientes" -"Customers by Orders","Clientes por número de pedidos." -"Customers by Orders Total","Clientes por total de pedidos" -"DHTML Date/Time Selector","Selector de fecha/hora DHTML" -"Dashboard","Panel de control" -"Data Format","Formato de la fecha" -"Data transfer:","Transferencia de datos:" -"Database","Base de datos" -"Date","Fecha" -"Date & Time","Fecha y Hora" -"Added","Añadido el dÃa" -"Updated","Fecha de actualización" -"Date selection:","Elección de la fecha:" -"Date selector","Selector de fechas" -"Day","DÃa" -"Decimal separator:","Separador de decimales:" -"Default (Admin) Values","Valores iniciales (de admin.)" -"Default Billing Address","Dirección de Facturación por Defecto" -"Default Config","Configuración por Defecto" -"Default Template from Locale","Configuración Regional de la Plantilla por Defecto" -"Default Values","Valores por Defecto" -"Default display currency ""%s"" is not available in allowed currencies.","""%s"" de la moneda por defecto no disponible en monedas permitdas." -"Default scope","Ãmbito por defecto." -"Delete","Eliminar" -"Delete %s","Borrar %s" -"Delete %s '%s'","Borrar %s '%s'" -"Delete File","Borrar Archivo" -"Delete Image","Borrar Imagen" -"Delete Profile","Borrar Perfil" -"Delete Role","Borrar Rol" -"Delete Store","Eliminar tienda" -"Delete Store View","Eliminar vista de la tienda" -"Delete Template","Eliminar plantilla" -"Delete User","Borrar Usuario" -"Delete Website","Eliminar página web" -"Description","Descripción" -"Design","Diseño" -"Design Section","Sección de diseño" -"Details","Detalles" -"Developer Section","Sección para desarrolladores" -"Direction:","Dirección:" -"Disable","Desactivar" -"Disabled","Deshabilitado" -"Display %s first","Mostrar %s primero" -"Display default currency","Mostrar moneda predeterminada" -"Distributed under GNU LGPL. See %s for details.","Distribuido según la LGPL de GNU. Para más información véase %s." -"Do you really want to KILL parallel process and start new indexing process?","¿Desea anular todos los procesos paralelos y comenzar un nuevo proceso de indexación?" -"Do you really want to proceed?","¿De verdad que quieres seguir?" -"Download","Descargar" -"Downloads","Descargas." -"Drag to move","Arrastrar para mover" -"Drop-down","Desplegable" -"Edit","Editar" -"Edit Design Change","Editar Diseñar cambio" -"Edit Email Template","Editar plantilla de correo electrónico" -"Edit Order","Editar pedido" -"Edit Queue","Editar cola" -"Edit Review","Editar Comentario" -"Edit Role","Modificar el rol" -"Edit Store View","Editar vista de la tienda" -"Edit System Template","Editar plantilla del sistema" -"Edit Template","Editar plantilla" -"Edit URL Rewrite","Editar Reescritura de URL" -"Edit User","Editar Usuario" -"Edit User '%s'","Modificar usuario «%s»" -"Edit Website","Editar página web" -"Email","Correo electrónico" -"Email Address:","Dirección de Correo Electrónico:" -"Email Preview","Vista previa de email" -"Email to a Friend","Escribir un Email a un amigo" -"Email:","Email:" -"Enable","Habilitar" -"Enabled","Habilitado" -"Enclose Values In:","Adjuntar valores en:" -"Entity Attributes","Atributos de la Entidad" -"Entity Type","Tipo de Entidad" -"Entity type:","Tipo de entidad:" -"Error","Error" -"Excel XML","Excel XML" -"Excl. Tax","Impuestos no incluidos" -"Exclude media folder from backup","Excluir carpetas de archivos multimedia para la copia de seguridad" -"Export","Exportar" -"Export CSV","Exportar CSV" -"Export Filters","Exportar Filtros" -"Export to:","Exportar a:" -"Export:","Exportar:" -"FTP Host","Servidor FTP" -"FTP Host[:Port]","Servidor FTP[:Puerto]" -"FTP Login","Inicio de sesión FTP" -"FTP Password","Contraseña FTP" -"FTP credentials","Credenciales FTP" -"Failed to add a product to cart by id ""%s"".","Fallo en añadir producto a la cesta por ""%s"" de id." -"Failed to cancel the billing agreement.","No se pudo cancelar el acuerdo de pago." -"Failed to clear the JavaScript/CSS cache.","No se pudo borrar la memoria caché de JavaScript/CSS." -"Failed to delete the billing agreement.","No se pudo eliminar el acuerdo de pago." -"Failed to update the profile.","No se ha podido actualizar el perfil." -"Field","Campo" -"Field Mapping","Mapeo del área" -"File","Archivo" -"File Information","Información de Archivo" -"File System","Sistema de archivos" -"File mode","Modo de archivo" -"File name:","Nombre del archivo:" -"File size should be more than 0 bytes","El tamaño del archivo debe ser mayor a 0 bytes" -"Finished profile execution.","Ejecución del perfil finalizada" -"First Invoice Created Date","Fecha de Creación de la Primera Factura" -"First Name","Nombre" -"First Name is required field.","El campo Nombre es obligatorio." -"First Name:","Nombre:" -"Fixed","Fijo" -"Flush Catalog Images Cache","Limpiar la caché de imágenes de catálogo" -"Flush JavaScript/CSS Cache","Limpiar la caché del JavaScrip/CSS" -"For category","Para la categorÃa" -"For latest version visit: %s","Para la última versión visita: %s" -"For product","Para el producto" -"Forgot Admin Password","Ha olvidado la contraseña de Administrador" -"Forgot your password?","¿Olvidaste tu contraseña?" -"Forgot your user name or password?","¿Ha olvidado el usuario o la contraseña?" -"From","desde" -"GLOBAL","GLOBAL" -"Gb","Gb" -"General Information","Información general" -"General Section","Sección general" -"Get Image Base64","Obtener imagen Base64" -"Get help for this page","Consiga ayuda para esta página" -"Global Attribute","Atributo global" -"Global Record Search","Búsqueda de registro global" -"Global Search","Búsqueda global" -"Go Today","Ir a Hoy" -"Go to messages inbox","Ir al buzón de entrada de mensajes" -"Go to notifications","Ir a notificaciones" -"Google Base","Google Base" -"Google Sitemaps","Google Sitemaps" -"Grand Total","Suma total" -"Grid (default) / List","CuadrÃcula (por omisión) / lista" -"Grid Only","Solo cuadrÃcula" -"Group:","Grupo:" -"Guest","Invitado" -"HTTP (unsecure)","HTTP (inseguro)" -"HTTPS (SSL)","HTTPS (SSL)" -"Help Us Keep Magento Healthy - Report All Bugs","Ayúdanos a Mantener Magento Saludable - Informar de Todos los Errores" -"Helper attributes should not be used in custom layout updates.","Los atributos del asistente no se deberÃan utilizar en las actualizaciones de diseños personalizados." -"Helper for options rendering doesn't implement required interface.","El asistente para la ejecución de opciones no implementa la interfaz solicitada." -"Home","Inicio" -"ID","Identificación" -"ID Path","Ruta de la ID" -"IP Address","Dirección IP" -"IPN (Instant Payment Notification) Only","Sólo IPN (notificación de pago instantánea)" -"If there is an account associated with %s you will receive an email with a link to reset your password.","Si hay una cuenta asociada con %s recibirás un correo electrónico con un enlace para reiniciar tu contraseña." -"If this message persists, please contact the store owner.","Si persiste este mensaje póngase en contacto con el dueño de la tienda." -"Images (.gif, .jpg, .png)","Imágenes (.gif, .jpg, .png)" -"Images Cache","Caché de Imágenes" -"Import","Importar" -"Import Service","Importar servicio" -"Import and Export","Importación y exportación" -"Import and Export Tax Rates","Impuestos de importación y exportación" -"Import/Export","Importación/exportación" -"Import/Export Advanced","Importar/Exportar Avanzados" -"Import/Export Profile","Perfil de importación/exportación" -"Important: ","Importante:" -"Imported <strong>%s</strong> records","Registros importados de <strong>%s</strong>" -"In","En" -"In Database:","En base de datos:" -"In File:","En el Archivo:" -"Inactive","Inactivo" -"Incl. Tax","Impuestos incluidos" -"Incoming Message","Mensaje nuevo" -"Insert Variable...","Insertar variable..." -"Interactive","Interactivo" -"Interface Locale: %s","Configuración regional de interfaz: %s" -"Invalid Form Key. Please refresh the page.","Clave de Formulario No Válida. Por favor, actualice la página." -"Invalid Import Service Specified","Se Especificó un Servicio de Importación No Válido." -"Invalid POST data (please check post_max_size and upload_max_filesize settings in your php.ini file).","Datos introducidos no válidos (compruebe la configuración de entrada_tamaño_máximo y carga_tamañodearchivo_máximo en su archivo php.ini)." -"Invalid Secret Key. Please refresh the page.","Clave Secreta No Válida. Por favor, actualice la página." -"Invalid User Name or Password.","La contraseña o nombre usuario no son correctos." -"Invalid directory: %s","Directorio inválido: %s" -"Invalid email address ""%s"".","Dirección de mail ""%s"" no válida." -"Invalid email address.","Dirección de correo electrónico no válida." -"Invalid file: %s","Archivo no válido: %s" -"Invalid input data for %s => %s rate","Datos de entrada no válidos para %s => %s tasa" -"Invalid parent block for this block","Bloque principal no válido para este bloque" -"Invalid parent block for this block.","Bloque padre no válido para este bloque." -"Invalid password reset token.","La contraseña no es correcta, reinicia el token." -"Invalid sender name ""%s"". Please use only visible characters and spaces.","Nombre de remitente ""%s"" no válido. Por favor, utilice solo caracteres visibles y espacios." -"Invalid timezone","Zona horaria no válida" -"Invalidated","Invalidado" -"Inventory Stock Status","Estado de Existencias de Inventario" -"Invoice #%s comment added","Comentario de factura #%s añadido" -"Invoice #%s created","Factura #%s creada" -"Invoice History","Historial de Facturas" -"Invoice Totals","Total de la factura" -"Invoice canceling error.","Error de cancelación de factura." -"Invoice capturing error.","Error de captura de factura." -"Invoice voiding error.","Error de anulación de factura." -"Invoices","Facturas" -"Is Closed","Está cerrado" -"Issue Number","Número de Emisión" -"Items","ArtÃculos." -"JavaScript seems to be disabled in your browser.","Puede que JavaScript esté deshabilitado en tu navegador." -"JavaScript/CSS","JavaScript/CSS" -"JavaScript/CSS Cache","JavaScript/CSS Caché" -"Kb","Kb" -"Last 24 Hours","Últimas 24 Horas" -"Last 5 Orders","Últimos 5 pedidos." -"Last 5 Search Terms","Últimas 5 búsquedas." -"Last 7 Days","Últimos 7 DÃas" -"Last Credit Memo Created Date","Fecha de Creación de la Última Factura de Abono" -"Last Invoice Created Date","Fecha de Creación de la Última Factura" -"Last Logged In (%s):","Última conexión (%s):" -"Last Logged In:","Último inicio de sesión:" -"Last Name","Apellido" -"Last Name is required field.","El campo Apellido es obligatorio." -"Last Name:","Apellido:" -"Last updated: %s. To refresh last day\'s <a href=""%s"">statistics</a>, click <a href=""%s"">here</a>.","Última actualización: %s. Para refrescar las <a href=""%s"">estadÃsticas</a> del último dÃa, pinche <a href=""%s"">aquÃ</a>." -"Latest Message:","Último mensaje:" -"Layered Navigation Indices","Ãndices de Navegación en Capas" -"Layered Navigation Indices were refreshed.","Los Ãndices de la navegación por capas se han refrescado." -"Leave empty to use tax identifier","Deje en blanco para identificación fiscal" -"Lifetime Sales","Ventas de por vida" -"Lifetime statistics have been updated.","Se actualizaron las estadÃsticas de vigencia." -"Links","Enlaces" -"Links with associated products will retain only after saving current product.","Los enlaces a los productos relacionados sólo quedarán registrados tras guardar el producto actual." -"List (default) / Grid","Lista (por defecto) / cuadrÃcula" -"List Only","Lista Solamente" -"Load Template","Cargar Plantilla" -"Load default template","Cargar plantilla por defecto" -"Loading...","Cargando..." -"Local Server","Servidor local" -"Local/Remote Server","Servidor local/remoto" -"Locale","Configuración regional" -"Log Out","Cerrar sesión" -"Log in to Admin Panel","Iniciar Sesión en el Panel de Administración" -"Log into Magento Admin Page","Iniciar Sesión en la Página de Administración de Magento" -"Logged in as %s","Sesión iniciada como %s" -"Login","Iniciar sesión" -"Low Stock","Existencias Bajas" -"MAJOR","mayor" -"MINOR","MENOR" -"MS Excel XML","MS Excel XML" -"Magento Admin","Administración de Magento" -"Magento Commerce - Administrative Panel","Magento Commerce - Panel de administración" -"Magento Connect","Magento Connect" -"Magento Connect Manager","Administrador de Magento Connect" -"Magento Logo","Logotipo de Magento" -"Magento is a trademark of X.commerce, Inc. Copyright © %s X.commerce, Inc.","Magento es una marca registrada de X.commerce, Inc. Copyright © %s X.commerce, Inc." -"Magento root directory","Directorio raÃz Magento" -"Magento ver. %s","Magento versión %s" -"Magento® is a trademark of X.commerce, Inc.<br/>Copyright © %s X.commerce, Inc.","Magento® es una marca registrada de X.commerce, Inc. <br/>Copyright ©: %s X.commerce, Inc." -"Make sure that data encoding in the file is consistent and saved in one of supported encodings (UTF-8 or ANSI).","Asegúrese de que la codificación de los datos en el archivo es consistente y han sido guardados en alguno de los códigos admitidos (UTF-8 o ANSI)." -"Manage Attribute Sets","Administrar conjuntos de atributos" -"Manage Attributes","Administrar atributos" -"Manage Categories","Gestionar categorÃas" -"Manage Content","Administre Contenido" -"Manage Currency Rates","Gestionar Tasa de Moneda" -"Manage Customers","Gestionar Clientes" -"Manage Ratings","Administrar puntuaciones" -"Manage Stores","Gestionar Tiendas" -"Manage Tax Rules","Gestión de las normas fiscales" -"Manage Tax Zones and Rates","Administrar zonas y tasas impositivas" -"Manual","Manual" -"Matched Expression","Expresión de coincidencia" -"Mb","Mb" -"Media (.avi, .flv, .swf)","Archivos multimedia (.avi, .flv, swf)" -"Media storages synchronization has completed!","¡Se ha completado la sincronización del almacenamiento de contenido!" -"Messages Inbox","Bandeja de entrada de mensajes" -"Month","Mes" -"Most Viewed","Los Más Vistos" -"Most Viewed Products","Productos Más Vistos" -"Multiple Select","Elección múltiple" -"My Account","Mi cuenta" -"N/A","N/A" -"NOTICE","aviso" -"Name","Nombre" -"Name:","Nombre:" -"Never (production)","Nunca (producción)" -"New ","Nuevo" -"New API Key","Nueva clave de API" -"New Accounts","Nuevas Cuentas" -"New Attribute","Nuevo Atributo" -"New Block","Nuevo bloque" -"New Category","Nueva categorÃa" -"New Class","Nueva clase" -"New Condition","Nueva condición" -"New Custom Variable","Nueva variable personalizada" -"New Customer","Nuevo cliente" -"New Customers","Nuevos Clientes" -"New Design Change","Nuevo cambio de diseño" -"New Email Template","Plantilla de nuevo correo" -"New Group","Nuevo grupo" -"New Invoice","Nueva Factura" -"New Item Type","Nuevo tipo de artÃculo" -"New Memo","Nueva nota" -"New Memo for #%s","Nueva nota para n.º %s" -"New Page","Nueva Página" -"New Password","Nueva Contraseña" -"New Profile","Nuevo perfil" -"New Rate","Nueva tasa" -"New Rating","Nueva puntuación" -"New Review","Nueva Revisión" -"New Role","Nuevo rol" -"New Rule","Nueva Regla" -"New Search","Nueva búsqueda" -"New Set","Nuevo Conjunto" -"New Shipment","Nuevo EnvÃo" -"New Sitemap","Nuevo mapa del sitio web" -"New Store View","Nueva vista de tienda" -"New System Template","Nueva plantilla del sistema" -"New Template","Nueva Plantilla" -"New User","Nuevo usuario" -"New Variable","Nueva variable" -"New Website","Nuevo Sitio Web" -"New password field cannot be empty.","El campo de nueva contraseña no puede estar en blanco." -"Newsletter","BoletÃn de noticias" -"Newsletter Problems","Problemas del BoletÃn" -"Newsletter Queue","Cola de BoletÃn de Noticias" -"Newsletter Subscribers","Suscriptores de BoletÃn de Noticias" -"Newsletter Templates","Plantillas de BoletÃn de Noticias" -"Next month (hold for menu)","Próximo mes (mantener para menú)" -"Next year (hold for menu)","Año siguiente (mantenga presionado para ver menú)" -"No","No" -"No (price without tax)","No (precio sin impuestos)" -"No Data","Sin datos" -"No Data Found","No se han encontrado datos" -"No Templates Found","No se Encontraron Plantillas" -"No change","Sin cambios" -"No customer id defined.","No se ha definido ningún id de cliente." -"No information available.","No hay información disponible." -"No profile loaded...","No hay perfil cargado..." -"No records found for this period.","No se han encontrado registros para este perÃodo." -"No records found.","No se han encontrado registros." -"No report code specified.","No se especificó el código de informe." -"No search keywords.","No hay palabras de búsqueda." -"No search modules were registered","No se han registrado módulos de búsqueda" -"No wishlist item id defined.","No se ha definido ningún id de artÃculo de lista de intención de compra." -"None","Ninguno" -"Note:","Nota:" -"Notes","Notas" -"Notifications","Notificaciones" -"Orders","Número de pedidos" -"Uses","Número de Usos" -"Views","Número de visualizaciones" -"Number of records:","Número de registros:" -"OK","Aceptar" -"Old rate:","Tasa anterior:" -"One or more media files failed to be synchronized during the media storages syncronization process. Refer to the log file for details.","Ha fallado la sincronización de uno o más ficheros de contenido durante el proceso de sincronización del almacenamiento de contenido. Revise el fichero de log para ver más detalles." -"One or more of the Cache Types are invalidated:","Están invalidados uno o más de los tipos de caché:" -"Online Customers","Clientes conectados" -"Only Once (version upgrade)","Solo una vez (actualización de la versión)" -"Only attributes with scope ""Global"", input type ""Dropdown"" and Use To Create Configurable Product ""Yes"" are available.","Solo están disponibles los atributos con alcance ""Global"", tipo de selección ""Lista desplegable"" y los de tipo Utilizar para Crear Producto Configurable ""Si""." -"Only mapped fields","Sólo campos mapeados" -"Optional","Opcional" -"Options","Opciones" -"Order","Pedido" -"Order %s","Pedido #%s" -"Order %s (%s)","Pedido #%s (%s)" -"Order Created Date","Fecha de creación del pedido" -"Order ID","Solicitar ID" -"Order Totals","Solicitar totales" -"Order Updated Date","Fecha de actualización del pedido" -"Order Updated Date report is real-time, does not need statistics refreshing.","El informe de la fecha de actualización del pedido se hace en tiempo real, asà que no es necesario actualizar la estadÃstica." -"Orders","Pedidos" -"Original Magento attribute names in first row:","Nombres originales de atributos Magento en la primera fila:" -"Out of stock","Sin existencias" -"PDT (Payment Data Transfer) Only","Sólo PDT (transmisión de datos de pago)" -"Package Extensions","Extensiones de paquete" -"Pages","Páginas" -"Parent Product Thumbnail","Miniatura del producto padre" -"Parent Transaction ID","ID de la transacción de origen" -"Passive mode","Modo pasivo" -"Password","Contraseña" -"Password Confirmation","Confirmación de contraseña" -"Password confirmation must be same as password.","La confirmación de contraseña debe ser igual que la contraseña." -"Password must be at least of %d characters.","La contraseña debe tener al menos %d caracteres." -"Password must include both numeric and alphabetic characters.","La contraseña debe contener letras y números." -"Password:","Contraseña:" -"Path:","Ruta:" -"PayPal Manager","Gestor de PayPal" -"Payment method instance is not available.","No está disponible la instancia del método de pago." -"Payment method is not available.","No está disponible el método de pago." -"Payment method must be specified.","Se debe especificar el método de pago." -"Pending Reviews","Revisiones Pendientes" -"Per Item","Por artÃculo" -"Per Order","Por Pedido" -"Percent","Porcentaje" -"Performed At","Realizo en" -"Interval","PerÃodo" -"Permanent (301)","Permanente (301)" -"Permissions","Permisos" -"Personal Information","Información Personal" -"Phone:","Teléfono:" -"Please Select","Seleccionar, por favor." -"Please confirm site switching. All data that hasn\'t been saved will be lost.","Confirme el cambio de sitio. Se perderán todos los datos que no se hayan guardado." -"Please enter 6 or more characters.","Ingrese 6 o más caracteres." -"Please enter a number greater than 0 in this field.","Ingrese un número mayor que 0 en este campo." -"Please enter a valid $ amount. For example $100.00.","Ingrese un monto válido en $. Por ejemplo: $100.00." -"Please enter a valid URL. For example http://www.example.com or www.example.com","Ingrese una dirección URL válida. Por ejemplo: http://www.ejemplo.com o www.ejemplo.com" -"Please enter a valid URL. http:// is required","Ingrese una dirección URL válida. El prefijo http:// es obligatorio" -"Please enter a valid credit card number.","Por favor, introduce un número de tarjeta de crédito válido." -"Please enter a valid date.","Ingrese una fecha válida." -"Please enter a valid email address. For example johndoe@domain.com.","Ingrese una dirección de correo electrónico válida. Por ejemplo: juanperez@dominio.com." -"Please enter a valid email.","Por favor, escriba un email válido." -"Please enter a valid number in this field.","Ingrese un número válido en este campo." -"Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.","Ingrese un número de teléfono válido. Por ejemplo: (123) 456-7890 o 123-456-7890." -"Please enter a valid social security number. For example 123-45-6789.","Ingrese un número de seguro social válido. Por ejemplo: 123-45-6789." -"Please enter a valid value from list","Ingrese un valor válido de la lista" -"Please enter a valid value, ex: 10,20,30","Ingrese un valor válido, por ej., 10, 20, 30" -"Please enter a valid zip code.","Por favor, introduce un código postal válido." -"Please enter a valid zip code. For example 90602 or 90602-1234.","Ingrese un código postal válido. Por ejemplo: 90602 o 90602-1234." -"Please enter another credit card number to complete your purchase.","Escriba el número de otra tarjeta de crédito para terminar su compra." -"Please enter password","Por favor introduce la contraseña" -"Please enter password to confirm rollback.","Por favor introduce la contraseña para confirmar la restauración." -"Please enter valid password.","Ingrese una contraseña válida." -"Please make sure that all global admin search modules are installed and activated.","Asegúrese de que todos los módulos de búsqueda de administración global estén instalados y activados." -"Please make sure that your changes were saved before running the profile.","Por favor, asegúrate de que los cambios se guardan antes de iniciar el perfil." -"Please make sure your passwords match.","Asegúrese de que sus contraseñas coincidan." -"Please select State/Province.","Por favor, selecciona Estado/Provincia." -"Please select a customer.","Seleccione un cliente." -"Please select a store.","Seleccione una tienda." -"Please select an option.","Por favor selecciona una opción." -"Please select catalog searches.","Seleccione búsquedas de catálogos." -"Please select customer(s).","Seleccione clientes." -"Please select message(s).","Por favor, seleccione mensaje(s)." -"Please select one of the above options.","Por favor, selecciona una de las opciones anteriores." -"Please select one of the options.","Seleccione una de las opciones." -"Please select review(s).","Seleccione reseñas." -"Please specify backup creation options","Por favor especifica las opciones de creación de la copia de seguridad" -"Please specify the admin custom URL.","Por favor, especifica la dirección URL personalizada de administración." -"Please try to logout and sign in again.","Intente cerrar sesión y volver a iniciarla." -"Please type the letters from the image:","Por favor escribe las letras de la imagen:" -"Please use in this field only ""a-z,0-9,_"".","En este campo sólo se pueden escribir letras, números y guiones bajos (""a-z,0-9,_"")." -"Please use letters only (a-z) in this field.","Por favor, utiliza solo las letras (a-z) en este campo." -"Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.","En este campo sólo se pueden escribir números. Evite los espacios en blanco u otros caracteres, como los puntos o las comas, por ejemplo." -"Please use only letters (a-z or A-Z), numbers (0-9) or spaces in this field.","Por favor, utilice solo letras (a-z o A-Z), números (0-9) o espacios en este campo." -"Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.","Por favor, utiliza solo letras (a-z) o números (0-9) en este campo. No se permiten espacios u otros caracteres." -"Please use only letters (a-z) or numbers (0-9) or spaces and # only in this field.","Utilice sólo letras (a-z) o números (0-9), o espacios y números en este campo." -"Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.","Utilice este formato de fecha: dd/mm/aaaa. Por ejemplo, 17/03/2006 para el 17 de marzo de 2006." -"Please wait while the indexes are being refreshed.","Espere mientras se actualizan los Ãndices." -"Please wait, loading...","Espera, por favor. Cargando...." -"Please wait...","Por favor, espera..." -"Popular","Popular" -"Position of Watermark for %s","Posición de la marca de agua para %s" -"Pregenerated product images files.","Archivos de imágenes de producto generadas previamente." -"Prev. month (hold for menu)","Mes anterior (mantener para menú)" -"Prev. year (hold for menu)","Año anterior (mantenga presionado para ver el menú)" -"Preview","Vista previa" -"Preview Template","Vista previa de la plantilla" -"Price","Precio" -"Price alert subscription was saved.","Se guardó la suscripción de alerta de precio." -"Price:","Precio:" -"Processed <strong>%s%% %s/%d</strong> records","Procesados <strong>%s%% %s/%d</strong> registros" -"Product","Producto" -"Product","Nombre de Producto" -"Product Reviews","Opiniones de Producto" -"Product Tax Classes","Clases de Impuestos a Productos" -"Product Thumbnail Itself","Imagen en miniatura del producto" -"Product is not loaded.","El producto no está cargado." -"Product:","Producto:" -"Products","Productos" -"Products Bestsellers Report","Informe de Productos Más Vendidos" -"Products Most Viewed Report","Informe de productos con más visualizaciones" -"Products Ordered","Productos Encargados" -"Products in Carts","Productos en Carritos" -"Profile Action","Acción del perfil" -"Profile Actions XML","XML de las acciones del perfil" -"Profile Direction","Dirección del perfil" -"Profile History","Historial del perfil" -"Profile Information","Información de perfil" -"Profile Name","Nombre de perfil" -"Profile Payments","Pagos del perfil" -"Profile Schedule","Programación del perfil" -"Profile Wizard","Asistente del perfil" -"Profiles","Perfiles" -"Promo","Promoción" -"Promotions","Promociones" -"Purchased Item","ArtÃculo Comprado" -"Put store on the maintenance mode while backup creation","Ponga la tienda en el modo de mantenimiento mientras se crea la copia de seguridad" -"Put store on the maintenance mode while rollback processing","Pon la tienda en modo de mantenimiento mientras se procesa la restauración" -"Quantity","Cantidad" -"Queue Refresh","Actualizar la cola" -"Queued... Cancel","En cola... cancelar" -"Radio Buttons","Botones de selección" -"Rates","Tasas" -"Read details","Leer detalles" -"Rebuild","Reconstruir" -"Rebuild Catalog Index","Reconstruir Ãndice del catálogo" -"Rebuild Flat Catalog Category","Reconstruir CategorÃa Catálogo Plano" -"Rebuild Flat Catalog Product","Reconstruir Producto Catálogo Plano" -"Recent Orders","Pedidos recientes" -"Recent statistics have been updated.","Se han actualizado las estadÃsticas recientes." -"Recurring Profile View","Vista de perfil recurrente" -"Recursive Dir","Dir Repetitivo" -"Redirect","Redirigir" -"Reference","Referencia" -"Reference ID","ID de referencia" -"Refresh","Actualizar" -"Refresh Now*","Actualizar ahora*" -"Refresh Statistics","Actualizar EstadÃsticas" -"Region/State","Región/Provincia" -"Regular Price:","Precio habitual:" -"Release","Versión" -"Release Stability","Estabilidad de la versión" -"Release Version","Lanzar Versión" -"Reload captcha","Volver a cargar captcha" -"Remote FTP","FTP remoto" -"Remove","Eliminar" -"Reports","Informes" -"Request Path","Solicitud de ruta" -"Required","Obligatorio" -"Reset","Reiniciar" -"Reset Filter","Restablecer Filtro" -"Reset Password","Reiniciar contraseña" -"Reset a Password","Restablecer contraseña" -"Resize","Redimensionar" -"Resource Access","Acceso a recursos" -"Resources","Recursos" -"Results","Resultados" -"Retrieve Password","Recuperar Contraseña" -"Return Html Version","Volver a la versión html" -"Revenue","Ingresos" -"Reviews","Reseñas" -"Reviews and Ratings","Revisiones y Valoraciones" -"Rewrite Rules","Volver a escribir reglas" -"Role ID","ID del rol" -"Role Info","Información del rol" -"Role Information","Información de la función" -"Role Name","Nombre de la función" -"Role Resources","Recursos de la función" -"Role Users","Usuario con roles" -"Roles","Roles" -"Roles Resources","Recursos de roles" -"Rotate CCW","Girar a la izquierda" -"Rotate CW","Girar a la derecha" -"Run","Ejecutar" -"Run Profile","Ejecutar el perfil" -"Run Profile Inside This Window","Ejecutar el perfil en esta ventana" -"Run Profile in Popup","Ejecutar el perfil en una nueva ventana" -"Running... Kill","Ejecutar.......Detener" -"SKU","SKU (Número de Referencia)" -"SKU:","SKU:" -"SSL Error: Invalid or self-signed certificate","Error SSL: certificado inválido o autofirmado" -"Sales","Ventas" -"Sales Report","Informe de ventas" -"Samples","Ejemplos" -"Save","Guardar" -"Save & Generate","Grabar y generar" -"Save Account","Guardar cuenta" -"Save Cache Settings","Guardar los ajustes caché" -"Save Config","Guardar configuración" -"Save Currency Rates","Guardar tasas de cambio" -"Save Profile","Guardar perfil" -"Save Role","Guardar función" -"Save Template","Guardar Plantilla" -"Save User","Guardar usuario" -"Save and Continue Edit","Guardar y continuar editando" -"Search","Buscar" -"Search Index","Ãndice de Búsqueda" -"Search Term","Plazo de búsqueda" -"Search Terms","Buscar Términos" -"Select","Seleccionar" -"Select All","Seleccionar todo" -"Select Category","Seleccionar CategorÃa" -"Select Date","Seleccionar Fechas" -"Select Range","Seleccionar Rango" -"Select date","Seleccionar fecha" -"Selected allowed currency ""%s"" is not available in installed currencies.","La divisa permitida seleccionada ""%s"" no está disponible en las divisas instaladas." -"Selected base currency is not available in installed currencies.","La moneda base seleccionada no está disponible en las monedas instaladas." -"Selected default display currency is not available in allowed currencies.","La divisa seleccionada en la pantalla predeterminada no está disponible entre las instaladas." -"Selected default display currency is not available in installed currencies.","La moneda seleccionada por defecto para mostrar no está disponible entre las monedas instaladas." -"Self-assigned roles cannot be deleted.","Los roles autoasignados no se pueden borrar." -"Sender","Remitente" -"Separate Email","Correo aparte" -"Service Settings","Configuración del servicio" -"Set up & Customize","Configuración y personalización" -"Shipment #%s comment added","El comentario al envÃo #%s ha sido añadido" -"Shipment #%s created","Se creó el envÃo #%s" -"Shipment Comments","Comentarios de EnvÃo" -"Shipment History","Historial de EnvÃos" -"Shipments","EnvÃos" -"Shipping","EnvÃo" -"Shipping Address","Dirección de EnvÃo" -"Shipping Address: ","Dirección de" -"Shipping Origin","Origen del envÃo" -"Shipping Price","Precio de EnvÃo" -"Shipping address selection is not applicable","La selección de dirección de envÃo no es aplicable" -"Shipping method must be specified.","El método de envÃo debe ser especificado." -"Shipping method selection is not applicable","La selección del método de envÃo no es aplicable" -"Shopping Cart","Cesta de la Compra" -"Shopping Cart Price Rules","Reglas de Precios del Carrito de Compra" -"Shopping Cart from %s","Carro de compra de %s" -"Show By","Mostrar Por" -"Show Report For:","Mostrar informe de:" -"Show Reviews","Mostrar Análisis" -"Sitemap Information","Información del Mapa de la Web" -"Size for %s","Tamaño de %s" -"Skip Category Selection","Saltar Selección de CategorÃa" -"Some items in this order have different invoice and shipment types. You can create shipment only after the invoice is created.","Algunos artÃculos de este pedido tienen diferentes tipos de factura y envÃo. Sólo puede crearse el envÃo una vez se haya creado la factura." -"Some of the ordered items do not exist in the catalog anymore and will be removed if you try to edit the order.","Algunos de los artÃculos solicitados no existen ya en el catálogo y serán eliminados si intentas modificar el pedido." -"Sorry, this feature is coming soon...","Lo siento, esta prestación pronto estará disponible..." -"Special Price:","Precio especial:" -"Specific Countries","Especifique paÃses" -"Specified","Especificado" -"Specified profile does not exist.","No existe el perfil solicitado." -"Spreadsheet Name:","Nombre de la Hoja de cálculo:" -"Start Date","Fecha de Inicio" -"Starting profile execution, please wait...","Comenzando la ejecución del perfil, espere por favor..." -"State/Province:","Estado/Provincia:" -"Static Blocks","Bloques estáticos" -"Status","Progreso" -"Status:","Situación:" -"Stock Quantity:","Cantidad en Existencias:" -"Stock notification was saved.","Se ha guardado la notificación de stock." -"Store","Tienda" -"Store Email Addresses Section","Almacenar Sección de Direcciones de Correo Electrónico" -"Store View","Ver Tienda" -"Store:","Tienda:" -"Stores","Tiendas" -"Subject","Asunto" -"Submit","Enviar" -"Subpackage cannot be conflicting.","El Subpaquete no puede estar en conflicto" -"Subtotal","Subtotal" -"Switch/Solo/Maestro Only","Únicamente Switch/Solo/Maestro" -"Synchronization is required.","Se requiere sincronización." -"Synchronization of media storages has been successfully completed.","La sincronización de los almacenamientos de medios se ha completado correctamente." -"Synchronize","Sincronizar" -"Synchronizing %s to %s","Sincronizando %s con %s" -"Synchronizing...","Sincronizando..." -"System","Sistema" -"System Section","Selección de Sistema" -"System busy","El sistema está ocupado" -"Target Path","Ruta objetivo" -"Tax","Impuestos" -"Tb","Tb" -"Template","Plantilla" -"Template Content","Contenido de la plantilla" -"Template Information","Información de Plantilla" -"Template","Nombre de la plantilla" -"Template Styles","Estilos de plantilla" -"Template Subject","Tema de la plantilla" -"Template Type","Tipo de plantilla" -"Temporary (302)","Temporal (302)" -"Terms and Conditions","Términos y Condiciones" -"Text","Texto" -"The Catalog Rewrites were refreshed.","La Reescritura del Catálogo ha sido refrescada." -"The CatalogInventory Stock Status has been rebuilt.","Se ha reconstruido el Estado del Stock del Inventario de Catálogo." -"The Comment Text field cannot be empty.","El campo Comentar Texto no puede estar vacÃo." -"The Flat Catalog Product was rebuilt","El Cátalogo Plano de Producto ha sido reconstruido" -"The JavaScript/CSS cache has been cleaned.","La cache de JavaScript/CSS se ha limpiado" -"The JavaScript/CSS cache has been cleared.","Se ha limpiado la caché de JavaScript/CSS." -"The Layered Navigation indexing has been queued.","La Indexación de la Navegación por Capas se ha puesto en cola." -"The Layered Navigation indexing queue has been canceled.","La cola de indexación de la Navegación por Capas ha sido cancelada" -"The Layered Navigation indices were refreshed.","Los Ãndices de Navegación por Capas han sido refrescados." -"The Layered Navigation process has been queued to be killed.","El proceso de Navegación por Capas ha sido puesto en cola para su finalización." -"The Magento cache storage has been flushed.","Se ha vaciado el almacenamiento de caché de Magento." -"The URL Rewrite has been deleted.","La URL Reescrita ha sido borrada" -"The URL Rewrite has been saved.","La URL Reescrita ha sido guardada" -"The account has been saved.","La cuenta se ha guardado." -"The archive can be uncompressed with <a href=""%s"">%s</a> on Windows systems","El archivo se puede descomprimir con <a href=""%s"">%s</a> en sistemas Windows" -"The attribute set has been removed.","Se eliminó el conjunto de atributos." -"The backup's creation process will take time.","El proceso de creación de la copia de seguridad llevará tiempo." -"The billing agreement has been canceled.","Se canceló el acuerdo de facturación." -"The billing agreement has been deleted.","Se eliminó el acuerdo de facturación." -"The cache storage has been flushed.","Se borró el almacenamiento de memoria caché." -"The carrier needs to be specified.","Necesita especificarse el transportista." -"The catalog index has been rebuilt.","Se reconstruyó el Ãndice del catálogo." -"The catalog rewrites have been refreshed.","Se actualizaron las reescrituras del catálogo." -"The configuration has been saved.","Se guardó la configuración." -"The credit memo has been canceled.","Se canceló la nota de crédito." -"The credit memo has been created.","Se creó la nota de crédito." -"The credit memo has been voided.","La nota de crédito ha sido cancelada." -"The custom variable has been deleted.","Se eliminó la variable personalizada." -"The custom variable has been saved.","Se ha guardado la variable personalizada." -"The customer has been deleted.","Se eliminó el cliente." -"The customer has been saved.","Se ha guardado el cliente." -"The design change has been deleted.","Se eliminó el cambio de diseño." -"The design change has been saved.","Se guardó el cambio de diseño." -"The email address is empty.","La dirección de correo electrónico está vacÃa." -"The email template has been deleted.","Se ha eliminado la plantilla de correo electrónico." -"The email template has been saved.","Se guardó la plantilla de correo electrónico." -"The flat catalog category has been rebuilt.","Se ha reconstruido la categorÃa de catálogo plana." -"The group node name must be specified with field node name.","Debe especificarse el nombre del nodo grupal con el nombre del nodo de campo." -"The image cache was cleaned.","Se borró la memoria caché de la imagen." -"The image cache was cleared.","Se borró la memoria caché de la imagen." -"The invoice and shipment have been created.","Se creó la factura y el envÃo." -"The invoice and the shipment have been created. The shipping label cannot be created at the moment.","La factura y el envÃo se han creado. La etiqueta de envÃo no se puede crear en este momento." -"The invoice has been canceled.","Se canceló la factura." -"The invoice has been captured.","Se capturó la factura." -"The invoice has been created.","La factura ha sido creada." -"The invoice has been voided.","La factura se ha anulado." -"The invoice no longer exists.","La factura ya no existe." -"The item %s (SKU %s) does not exist in the catalog anymore.","El artÃculo %s (SKU %s) ya no existe en el catálogo." -"The order does not allow creating an invoice.","El pedido no permite crear una factura." -"The order no longer exists.","El pedido ya no existe." -"The profile has been deleted.","Se eliminó el perfil." -"The profile has been saved.","Se ha guardado el perfil." -"The profile has been updated.","El perfil ha sido actualizado." -"The profile has no changes.","El perfil no ha cambiado." -"The profile you are trying to save no longer exists","El perfil que está intentando guardar ya no existe" -"The rating has been deleted.","Se ha eliminado la valoración." -"The rating has been saved.","Se guardó la puntuación." -"The role has been deleted.","Se eliminó el rol." -"The role has been saved.","Se guardó el rol." -"The role has been successfully saved.","Se guardó correctamente el rol." -"The search index has been rebuilt.","Se reconstruyó el Ãndice de búsqueda." -"The shipment has been created.","Se creó el en" -"The shipment has been sent.","Se ha enviado el pedido." -"The shipping label has been created.","Se ha creado la etiqueta de envÃo." -"The transaction details have been updated.","Se han actualizado los detalles de la transacción." -"The user has been deleted.","Se eliminó el usuario." -"The user has been saved.","Se ha guardado el usuario." -"Themes JavaScript and CSS files combined to one file.","Archivos de tema de JavaScript y CSS combinados en un archivo." -"There is an error in one of the option rows.","Se produjo un error en una de las filas de opción." -"This Account is","Esta cuenta es" -"This Email template no longer exists.","Esta plantilla de correo electrónico ya no existe." -"This Role no longer exists","Este Rol ya no existe" -"This Role no longer exists.","Este rol ya no existe." -"This account is","Esta cuenta es" -"This account is inactive.","Esta cuenta está inactiva." -"This action cannot be undone.","Esta acción no se puede deshacer." -"This attribute set does not have attributes which we can use for configurable product","Este conjunto de atributos no tiene atributos que podamos utilizar para un producto configurable" -"This attribute shares the same value in all the stores","Este atributo comparte el mismo valor en todas las tiendas" -"This is a demo store. Any orders placed through this store will not be honored or fulfilled.","Esta es una tienda de demostración. Cualquier pedido que se realice a través de esta tienda no será tramitado o completado." -"This is a required field.","Este es un campo obligatorio." -"This product is currently disabled.","Este producto está desactivado actualmente." -"This report depends on timezone configuration. Once timezone is changed, the lifetime statistics need to be refreshed.","Este informe depende de la configuración de la zona horaria. Una vez que se cambia la zona horaria, el periodo de extensión de las estadÃsticas ha de ser actualizado." -"This section is not allowed.","Esta sección no está permitida." -"This user no longer exists.","Este usuario ya no existe." -"Time","Hora" -"Time selection:","Selección de hora:" -"Time:","Hora:" -"Timeout limit for response from synchronize process was reached.","Se ha alcanzado el lÃmite de tiempo de espera del proceso de sincronización." -"To","A" -"To cancel pending authorizations and release amounts that have already been processed during this payment, click Cancel.","Para cancelar autorizaciones pendientes y liberar importes que ya se han procesado durante este pago, haga clic en Cancelar." -"To use PayPal Payflow Link you must configure some settings in your Payflow account by logging into","Para usar Payflow Link, debe configurar su cuenta de Payflow Link en el sitio web de Paypal." -"To use PayPal Payments Advanced you must configure some settings in your PayPal Payments Advanced account by logging into","Para usar Pagos Avanzados de PayPal debes configurar algunas opciones de tu cuenta de Pagos Avanzados de PayPal iniciando sesión." -"Toggle Editor","Cambiar a editor" -"Tools","Herramientas" -"Top 5 Search Terms","5 ArtÃculos Más Buscados" -"Total","Total" -"Total Invoiced","Total facturado" -"Total","Cantidad total del pedido" -"Total Refunded","Total reembolsado" -"Total of %d record(s) have been deleted.","Total de % registrado se ha eliminado." -"Total of %d record(s) have been updated.","Un total de %d registro(s) ha(n) sido actualizado(s)." -"Total of %d record(s) were canceled.","Se ha cancelado un total de %d registro(s)." -"Total of %d record(s) were deleted","Se han eliminado un total de %d registro(s)" -"Total of %d record(s) were deleted.","Se han eliminado un total de %d registro(s)." -"Total of %d record(s) were updated","Se han actualizado un total de %d registro(s)" -"Total of %d record(s) were updated.","Se han actualizado un total de %d registro(s)." -"Track Order","Rastrear un Pedido" -"Track this shipment","Rastrear este envÃo" -"Tracking number %s for %s assigned","Número de seguimiento %s asignado para %s" -"Tracking number cannot be empty.","El número de seguimiento no puede estar vacÃo." -"Transaction Data","Datos de la Transacción" -"Transaction Details","Detalles de la transacción" -"Transaction ID","Número de identificación de la transacción" -"Transaction Type","Tipo de Transacción" -"Transactional Emails","Emails Transaccionales" -"Transactions","Transacciones" -"Type","Tipo" -"Type:","Tipo:" -"URL Rewrite","Reescritura de la URL" -"URL Rewrite Information","Información de reescritura de URL" -"URL Rewrite Management","Administración de la reescritura de la URL" -"Unable to cancel the credit memo.","Deshabilitar cancelación de nota de crédito." -"Unable to find a Email Template to delete.","Deshabilitar encontrar plantilla de email para eliminar." -"Unable to find a user to delete.","No se puede encontrar un usuario para eliminar." -"Unable to initialize import model","Incapaz de iniciar el modelo de importación" -"Unable to refresh lifetime statistics.","Incapaz de volver a cargar estadÃsticas totales." -"Unable to refresh recent statistics.","Imposible actualizar las estadÃsticas" -"Unable to save Cron expression","Imposible guardar la expresión Cron" -"Unable to save the cron expression.","No se puede guardar la expresión de cron." -"Unable to save the invoice.","Imposible guardar la factura." -"Unable to send the invoice email.","Imposible mandar la factura por correo electrónico." -"Unable to send the shipment email.","No ha sido posible mandar el correo electrónico de envÃo." -"Unable to update transaction details.","No es posible actualizar la información de la transación." -"Unable to void the credit memo.","Imposible anular la nota de crédito." -"Unknown","Desconocido" -"Unlimited","Ilimitado" -"Update","Actualizar" -"Updated At","Hora de actualización" -"Upload File","Cargar Archivo" -"Upload Files","Subir archivos" -"Upload HTTP Error","Error HTTP de carga" -"Upload I/O Error","Cargar Error I/O" -"Upload Security Error","Error de seguridad de carga" -"Upload import file","Cargar archivo importado" -"Uploaded file is larger than %.2f kilobytes allowed by server","El archivo subido es mayor de los %.2f kb que permite el servidor" -"Use All Available Attributes","Utilizar todas las caracterÃsticas disponibles" -"Use Config Settings","Usar Opciones de Configuración" -"Use Default","El uso por defecto" -"Use Default Value","Utilizar Valor por Defecto" -"Use Default Variable Values","Utilizar los valores variables por defecto" -"Use FTP Connection","Usar conexión FTP" -"Use Website","Utilizar el sitio web" -"Used Currently For","Utilizado actualmente para" -"Used as Default For","Utilizado por defecto para" -"User Email","Dirección de correo del cliente" -"User ID","ID de Usuario" -"User Info","Información del usuario" -"User Information","Información de usuario" -"User Name","Nombre de usuario" -"User Name is required field.","El nombre del usuario es un campo obligatorio." -"User Name:","Nombre usuario:" -"User Password","Contraseña del usuario" -"User Role","Profesión del usuario" -"User Roles","Papeles de Usuario" -"User Roles Information","Información de profesión del usuario" -"User name","Nombre de usuario" -"Users","Usuarios" -"VAT Number is Invalid","El número de IVA es inválido" -"VAT Number is Valid","El número de IVA es válido" -"Validation Results","Resultados de Validación" -"Value","Valor" -"Value Delimiter:","Separador de valores:" -"Variable","Variable" -"Variable Code","Código Variable" -"Variable HTML Value","Valor de HTML Variable" -"Variable ID","ID de variable" -"Variable Name","Nombre Variable" -"Variable Plain Value","Valor Simple Variable" -"View Actions XML","Ver Acciones XML" -"View Full Size","Ver a tamaño completo" -"View Memo","Ver Memorándum" -"View Memo for #%s","Ver el memorándum de #%s" -"View Shipment","Ver EnvÃo" -"View Statistics For:","Ver estadÃsticas de:" -"Visibility:","Visibilidad:" -"Warning","Aviso" -"Warning! Empty value can cause problems with CSV format.","Atención: los valores vacÃos pueden causar problemas con el formato CSV." -"Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?","¡Atención!\r\nLa acción eliminará al usuario de un rol ya asignado.\r\n¿Está seguro?" -"Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?","¡Atención!\r\nEsta acción borrará aquellos usuarios de los roles ya asignados\r\n¿Está seguro?" -"Warning: Please do not close the window during importing/exporting data","Atención: No cierre la ventana mientras importa/exporta datos" -"Watermark File for %s","Archivo de Marca de Agua de %s" -"We appreciate our merchants\' feedback, please <a href=""#"" onclick=""surveyAction(\'yes\'); return false;"">take our survey</a> to provide insight on the features you would like included in Magento. <a href=""#"" onclick=""surveyAction(\'no\'); return false;"">Remove this notification</a>","Agradecemos los comentarios de nuestros vendedores. Por favor, <a href=""#"" onclick=""surveyAction(\'yes\'); return false;"">rellene nuestra encuesta</a> para indicarnos las funcionalidades que querrÃa ver en Magento. <a href=""#"" onclick=""surveyAction(\'no\'); return false;"">Eliminar esta notificación</a>" -"We\'re in our typing table, coding away more features for Magento. Thank you for your patience.","Estamos en nuestro escritorio, codificando más caracterÃsticas para Magento. Gracias por su paciencia." -"Web Section","Sección Web" -"Web Services","Servicios Web" -"Web services","Servicios web" -"Website","Sitio web" -"What is this?","¿Qué es esto?" -"Wishlist Report","Informe de lista de deseos" -"Wishlist item is not loaded.","El artÃculo de la lista de intención de compra no está cargado." -"Wrong account specified.","La cuenta especificada es errónea." -"Wrong billing agreement ID specified.","Se ha especificado un ID de acuerdo de facturación no válido." -"Wrong column format.","Formato de columna erróneo." -"Wrong newsletter template.","Plantilla de boletÃn de noticias errónea." -"Wrong quote item.","ArtÃculo mal expresado." -"Wrong tab configuration.","Configuración de pestañas no válido." -"Wrong transaction ID specified.","ID de transacción especificada errónea." -"XML","XML" -"XML data is invalid.","dato XML inválido" -"XML object is not instance of ""Magento\Simplexml\Element"".","El objeto XML no es un caso de ""Magento\Simplexml\Element""." -"YTD","YTD" -"Year","Año" -"Yes","SÃ" -"Yes (301 Moved Permanently)","Sà (301 Movidos Permanentemente)" -"Yes (302 Found)","Sà (302 Encontrados)" -"Yes (only price with tax)","Si (solo el precio con impuestos)" -"You cannot delete your own account.","No puede borrar su propia cuenta." -"You have %s unread message(s).","Tiene %s mensaje(s) sin leer." -"You have %s unread message(s). <a href=""%s"">Go to messages inbox</a>.","Tienes %s mensaje(s) sin leer. <a>Ir a la bandeja de entrada</a>." -"You have %s, %s and %s unread messages. <a href=""%s"">Go to messages inbox</a>.","Tienes %s, %s y %s mensajes sin leer. <a>Ir a la bandeja de entrada</a>." -"You have logged out.","Se ha desconectado." -"You have not enough permissions to use this functionality.","No tiene suficientes permisos para usar esta función." -"You must have JavaScript enabled in your browser to utilize the functionality of this website.","Debe tener activado JavaScript en su navegador para utilizar la funcionalidad de esta página web." -"You need to specify order items.","Tiene que especificar objetos de orden." -"You will need to wait when the action ends.","Tendrá que esperar cuando termine la acción." -"Your answers contain duplicates.","Sus respuestas contienen duplicados." -"Your password has been updated.","Se ha actualizado su contraseña." -"Your password reset link has expired.","El enlace para reiniciar la contraseña ha caducado." -"Your server PHP settings allow you to upload files not more than %s at a time. Please modify post_max_size (currently is %s) and upload_max_filesize (currently is %s) values in php.ini if you want to upload larger files.","La configuración del PHP de su servidor sólo le permite subir archivos de no más de %s de una vez. Modifique los valores de post_max_size (actualmente es %s) y upload_max_filesize (actualmente es %s) de php.ini si quiere subir archivos mayores." -"Your web server is configured incorrectly. As a result, configuration files with sensitive information are accessible from the outside. Please contact your hosting provider.","Tu servidor web está configurado incorrectamente. Como resultado, los ficheros de configuración con información confidencial son accesibles desde fuera. Por favor, contacta a tu proveedor de alojamiento." -"Zip/Postal Code","Código postal" -"Zip/Postal Code:","Código postal:" -"[ deleted ]","[ eliminado ]" -"[GLOBAL]","[GLOBAL]" -"[STORE VIEW]","[VISTA DE TIENDA]" -"[WEBSITE]","[PÃGINA WEB]" -"b","b" -"close","cerrar" -"critical","crÃtico" -"example: ""sitemap/"" or ""/"" for base path (path must be writeable)","ejemplo: ""sitemap/"" o ""/"" para la ruta base (la ruta debe poder reescribirse)" -"example: sitemap.xml","ejemplo: sitemap.xml" -"failed","error" -"from","de" -"major","mayor" -"minor","menor" -"notice","aviso" -"store(%s) scope","ámbito de almacenamiento(%s)" -"successful","exitoso" -"to","para" -"website(%s) scope","ámbito de página web(%s)" -"{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. It is highly recommended to change this value in your Magento <a href=""%s"">configuration</a>.","{{base_url}} no recomienda usarse en un ambiente de producción para declarar la URL Base Insegura / URL Base Segura. Es altamente recomendable cambiar este valor en tu <a href=""%s"">configuración</a> de Magento." diff --git a/app/code/Magento/Adminhtml/i18n/fr_FR.csv b/app/code/Magento/Adminhtml/i18n/fr_FR.csv deleted file mode 100644 index ec17ff90df4..00000000000 --- a/app/code/Magento/Adminhtml/i18n/fr_FR.csv +++ /dev/null @@ -1,1144 +0,0 @@ -" The customer does not exist in the system anymore.","Le client n'existe plus dans le système." -" You will need to navigate to your ","Vous aurez besoin de vous diriger vers votre" -" [deleted]","[supprimé]" -" and "," et " -" and go to the "," et d'aller à " -" sections for your Hosted Checkout Pages."," les sections de vos pages de sortie hébergées." -"%s (Default Template from Locale)","%s (Modèle par Défaut de la Configuration Locale)" -"%s cache type(s) disabled.","Type(s) de cache %s désactivé(s)" -"%s cache type(s) enabled.","Type(s) de cache %s activé(s)" -"%s cache type(s) refreshed.","Type(s) de cache %s rafraîchi(s)." -"(For Type ""Local Server"" need to use relative path to Magento install var/export or var/import, e.g. var/export, var/import, var/export/some/dir, var/import/some/dir)","(pour le type ""Serveur local"", nécessaire d'utiliser le chemin relatif vers l'installation de Magento var/export ou var/import, e.g. var/export, var/import, var/export/some/dir, var/import/some/dir)" -"(For US 2-letter state names)","(Pour noms d'Etats US à 2 lettres)" -"(If left empty will be auto-generated)","(si laissé vide, sera généré automatiquement)" -"(Leave empty for first spreadsheet)","(Laisser vide pour premier tableur)" -"(Products will be added/updated to this store if 'store' column is blank or missing in the import file.)","(Les produits seront ajoutés/actualisés à cette boutique si la colonne ""boutique"" est vide ou fait défaut dans le fichier d'importation.)" -"(Shift-)Click or drag to change value","Cliquez + SHIFT ou faites glisser pour modifier la valeur" -"(Starting with)","(Commençant par)" -"(When 'No', only mapped fields will be imported. When mapping, use 'column1', 'column2', etc.)","(Lorsque ""Non"", seuls les champs taggés seront importés. Lors du tag, utilisez ""colonne1"", colonne2"", etc)" -"(You have to increase php memory_limit before changing this value)","(Vous devez augmenter la limite de mémoire php avant de modifier cette valeur)" -"(\\t for tab)","(\t pour tabulation)" -"* - If indexing is in progress, it will be killed and new indexing process will start.","* - Si l'indexation est en cours, elle sera annulée et une nouvelle indexation commencera." -"- Click on any of the time parts to increase it","- Cliquez sur n'importe quelle partie de l'heure pour l'augmenter" -"- Hold mouse button on any of the above buttons for faster selection.","- Maintenez le bouton de la souris enfoncé sur n'importe lequel des boutons ci-dessus pour accélérer la sélection." -"- Use the %s buttons to select month","- Utilisez les boutons %s pour sélectionner le mois" -"- Use the %s, %s buttons to select year","- Utilisez les boutons %s, %s pour sélectionner l'année" -"- or Shift-click to decrease it","- ou Cliquez + SHIFT pour la diminuer" -"- or click and drag for faster selection.","- ou cliquez et faites glisser pour accélérer la sélection." -"-- Not Selected --","-- Non Sélectionné --" -"-- Please Select --","-- Sélectionnez --" -"-- Please Select Billing Agreement--","-- Veuillez sélectionner un accord de facturation--" -"-- Please Select a Category --","-- Sélectionnez une catégorie --" -"-- Please select --","-- Veuillez sélectionner --" -"--Please Select--","--Veuillez sélectionner--" -"1 Hour","1 Heure" -"1. set up","1. installation" -"12 Hours","12 Heures" -"12h AM/PM","12h AM/PM" -"2 Hours","2 Heures" -"2. customize","2. personnaliser" -"24 Hours","24 Heures" -"24h","24h" -"2YTD","Jusqu'à ce jour" -"6 Hours","6 Heures" -"<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>","<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>" -"<strong>Attention</strong>: Captcha is case sensitive.","<strong>Attention</strong>:Captcha est sensible à la casse." -"A user with the same user name or email aleady exists.","Un utilisateur avec le même nom d'utilisateur ou le même email existe déjà ." -"API Key","Clé API" -"API Key Confirmation","Confirmation Clé API" -"ASCII","ASCII" -"Abandoned Carts","Paniers abandonnés" -"About the calendar","Au sujet du calendrier" -"Access Denied","Accès refusé" -"Access denied","Accès refusé" -"Access denied.","Accès refusé." -"Account Created in:","Compte créé dans:" -"Account Created on (%s):","Compte créé sur (%s):" -"Account Created on:","Compte créé sur:" -"Account Information","Informations du compte" -"Account Status","Statut Compte" -"Account status","Statut du compte" -"Action","Action" -"Actions","Action" -"Actions XML","Actions XML" -"Active","Actif" -"Add","Ajouter" -"Add \Exception","Ajouter \Exception" -"Add Field Mapping","Ajouter Mappage Champ" -"Add Field with URL:","Ajouter Champ avec URL:" -"Add New","Ajouter nouveau" -"Add New Image","Ajouter Nouvelle Image" -"Add New Profile","Ajouter Nouveau Profil" -"Add New Role","Ajouter Nouveau Rôle" -"Add New Template","Ajouter un nouveau modèle" -"Add New URL Rewrite","Ajouter Réécriture Nouvelle URL" -"Add New User","Ajouter Nouvel Utilisateur" -"Add New Variable","Ajouter Nouvelle Variable" -"Add Products","Ajouter produits" -"Add URL Rewrite","Ajouter Réécriture URL" -"Add URL Rewrite for a Category","Ajouter Réécriture URL pour une Catégorie" -"Add URL Rewrite for a Product","Ajouter Réécriture URL pour un Produit" -"Add after","Ajouter après" -"Additional Cache Management","Gestion Cache Additionnel" -"Address Type:","Type d'Adresse:" -"Admin","Admin" -"Advanced Admin Section","Section Avancée Administrateur" -"Advanced Profiles","Profils Avancés" -"Advanced Section","Section Avancée" -"All","Tous" -"All Allowed Countries","Tous les Pays Possibles" -"All Cache","Tout le Cache" -"All Files","Tous les Fichiers" -"All Reviews","Tous les avis" -"All Store Views","Toutes les vues de la boutique" -"All Websites","Tous les sites web" -"All countries","Tous les pays" -"All fields","Tous les champs" -"All possible rates were fetched, please click on ""Save"" to apply","Tous les taux possibles ont été estimés, veuillez cliquer sur ""Enregistrer"" pour appliquer" -"All rates were fetched, please click on ""Save"" to apply","Tous les taux ont été estimés, cliquez sur ""Enregistrer"" pour appliquer" -"All valid rates have been saved.","Tous les taux valides ont été sauvegardés." -"Always (during development)","Toujours (durant le développement)" -"Amounts","Montants" -"An error has occurred while syncronizing media storages.","Une erreur est survenue lors de la synchronisation." -"An error occurred while clearing the JavaScript/CSS cache.","Une erreur s'est produite lors de la suppression du cache JavaScript/CSS." -"An error occurred while clearing the image cache.","Une erreur s'est produite lors de la suppression du cache de l'image." -"An error occurred while deleting URL Rewrite.","Un erreur s'est produite lors de l'effacement de URL de réécriture." -"An error occurred while deleting email template data. Please review log and try again.","Une erreur s'est produite lors de la suppression des données du modèle d'email. Consultez le journal des erreurs et réessayez." -"An error occurred while deleting record(s).","Une erreur s'est produite lors de l'effacement des enregistrements." -"An error occurred while deleting this role.","Une erreur s'est produite lors de la suppression de ce rôle." -"An error occurred while deleting this set.","Une erreur s'est produite lors de la suppression de ce jeu." -"An error occurred while deleting this template.","Une erreur s'est produite lors de la suppression de ce modèle." -"An error occurred while finishing process. Please refresh the cache","Une erreur s'est produite lors de la finalisation du processus. Rafraîchissez le cache" -"An error occurred while rebuilding the CatalogInventory Stock Status.","Une erreur s'est produite lors de la reconstitution du Statut de l'Inventaire du Stock du Catalogue." -"An error occurred while rebuilding the catalog index.","Une erreur s'est produite lors de la la reconstitution de l'indexation du catalogue." -"An error occurred while rebuilding the flat catalog category.","Une erreur s'est produite lors de la reconstitution de la catégorie du flat catalog" -"An error occurred while rebuilding the flat product catalog.","Une erreur s'est produite lors de la reconstitution du flat catalog produit." -"An error occurred while rebuilding the search index.","Une erreur s'est produite lors de la reconstitution de l'index de recherche." -"An error occurred while refreshing the Catalog Rewrites.","Une erreur s'est produite lors du rafraîchissement des réécritures catalogue." -"An error occurred while refreshing the Layered Navigation indices.","Une erreur s'est produite lors du rafraîchissement des indices de navigation multicouches." -"An error occurred while refreshing the catalog rewrites.","Une erreur est survenue lors de l'actualisation des catalogues." -"An error occurred while refreshing the layered navigation indices.","Une erreur est survenue lors de l'actualisation des indices de navigation;" -"An error occurred while saving URL Rewrite.","Une erreur s'est produite lors de la sauvegarde de l'URL de réécriture." -"An error occurred while saving account.","Une erreur s'est produite lors de la sauvegarde du compte." -"An error occurred while saving review.","Une erreur s'est produite lors de la sauvegarde de la vérification." -"An error occurred while saving the customer.","Une erreur s'est produite lors de la sauvegarde du client." -"An error occurred while saving this configuration:","Une erreur s'est produite lors de la sauvegarde de cette configuration:" -"An error occurred while saving this role.","Une erreur s'est produite lors de la sauvegarde de ce rôle." -"An error occurred while saving this template.","Une erreur s'est produite lors de la sauvegarde de ce modèle." -"An error occurred while updating the selected review(s).","Une erreur s'est produite lors de l'actualisation des commentaires sélectionnés." -"Any","Indifférent" -"Any Attribute Set","N'importe quel jeu d'attributs." -"Any Group","N'importe quel groupe." -"Any Status","N'importe quel Statut" -"Any Store","N'importe quelle Boutique" -"Any Type","N'importe quel Type" -"Any Visibility","N'importe quelle Visibilité" -"Any data created since the backup was made will be lost including admin users, customers and orders.","Toutes les données crées depuis la sauvegarde seront perdues, y compris les utilisateurs-administrateurs, les clients et les commandes." -"Archive file name:","Nom du fichier d'archive:" -"Are you sure that you want to delete this template?","Voulez-vous vraiment supprimer ce modèle ?" -"Are you sure that you want to strip tags?","Êtes-vous sûr de vouloir enlever les tags?" -"Are you sure you want to do this?","Êtes-vous sûrs de vouloir faire celà ?" -"Are you sure you want to proceed?","Etes-vous certain(e) de vouloir continuer?" -"Area","Zone" -"As low as:","Aussi bas que :" -"Assigned","Assigné" -"Attribute Set Name:","Nom du jeu d'attributs:" -"Attributes","Attributs" -"Automatic","Automatique" -"Average","Montant Moyen des Commandes" -"Average Orders","Commandes moyennes" -"BINARY","BINAIRE" -"Back","Retour" -"Back to Login","Retour à la connexion" -"Backup","Sauvegarde" -"Backup Name","Nom de la sauvegarde" -"Backup options","Options de sauvegarde" -"Backups","Sauvegardes" -"Base currency","Monnaie de base" -"Bcc","Liste des destinataires cachée." -"Bestsellers","Meilleures ventes" -"Billing Address","Adresse de facturation" -"Billing Address: ","Adresse de facturation :" -"Billing Agreement","Accord de facturation" -"Billing Agreements","Accords de facturation" -"Block Information","Bloquer l'information" -"Both (without and with tax)","Les deux (avec et sans les taxes)" -"Both IPN and PDT","IPN et PDT" -"Browse Files...","Parcourir..." -"Bundle with dynamic pricing cannot include custom defined options. Options will not be saved.","Les ensembles comprenant une tarification dynamique ne peuvent pas comprendre d'option personnalisée. Les options ne seront pas enregistrées." -"CMS","CMS" -"CRITICAL","critique" -"CSV","CSV (valeurs séparées par des virgules)" -"CSV / Tab separated","CSV / Séparé par onglets" -"Cache Control","Cache-control" -"Cache Control (beta)","Cache-control (beta)" -"Cache Management","Gestion du cache" -"Cache Type","Type de cache" -"Cancel","Annuler" -"Cannot add new comment.","Impossible d'ajouter un nouveau commentaire." -"Cannot add tracking number.","Impossible d'ajouter un numéro de suivi." -"Cannot create an invoice without products.","Impossible de créer une facture sans produit." -"Cannot create credit memo for the order.","Impossible de créer la note de crédit pour la commande." -"Cannot delete the design change.","Impossible de supprimer la modification du design." -"Cannot delete tracking number.","Impossible de supprimer le numéro de suivi." -"Cannot do shipment for the order separately from invoice.","Impossible d'effectuer l'envoi et la facture de la commande séparément." -"Cannot do shipment for the order.","Impossible d'effectuer l'envoi pour la commande." -"Cannot initialize shipment for adding tracking number.","Impossible d'initialiser l'envoi pour ajouter un numéro de suivi." -"Cannot initialize shipment for delete tracking number.","Impossible d'initialiser l'envoi pour supprimer un numéro de suivi." -"Cannot load track with retrieving identifier.","Ne peut pas récupérer l'identifiant pour charger le suivi" -"Cannot retrieve tracking number detail.","Impossible de récupérer le détail du numéro de suivi." -"Cannot save shipment.","Impossible d'enregistrer l'envoi." -"Cannot save the credit memo.","Impossible d'enregistrer la note de crédit." -"Cannot send shipment information.","Impossible d'envoyer les informations sur l'envoi." -"Cannot update item quantity.","Impossible de mettre à jour la quantité d'articles." -"Cannot update the item\'s quantity.","Impossible de mettre à jour la quantité de cet article." -"Catalog","Catalogue" -"Catalog Price Rules","Règles de prix du catalogue" -"Catalog Rewrites","Réécritures catalogue" -"Categories","Catégories" -"Category:","Catégorie :" -"Chart is disabled. If you want to enable chart, click <a href=""%s"">here</a>.","Graphique désactivé. Si vous souhaitez l'activer, cliquez <a href=""%s"">ici</a>." -"Checkbox","Case à cocher" -"Child Transactions","Transactions enfant" -"Choose Store View:","Sélectionner la vue de la boutique :" -"Choose an attribute","Choisir un attribut" -"Chosen category does not associated with any website, so url rewrite is not possible.","La catégorie choisie n'est associée à aucun site Web, la réécriture de l'URL n'est donc pas possible." -"Chosen product does not associated with any website, so url rewrite is not possible.","Le produit choisi n'est associé à aucun site Web, la réécriture de l'URL n'est donc pas possible." -"Clear","Effacer" -"Close","fermer" -"Comment text field cannot be empty.","Le champ de texte du commentaire ne peut pas être vide." -"Complete","Terminer" -"Configuration","Configuration" -"Confirm New Password","Confirmer le nouveau mot de passe" -"Confirmed email:","E-mail confirmé :" -"Connect with the Magento Community","Connexion avec Magento Community" -"Continue","Continuer" -"Continuous","Continu(e)" -"Convert to Plain Text","Convertir en texte intégral" -"Cookie (unsafe)","Cookie (dangereux)" -"Country","Pays" -"Country:","Pays :" -"Coupons","Coupons" -"Create","Créer" -"Create DB Backup","Créer une sauvegarde de la base de données" -"Create New Attribute","Créer un nouvel attribut" -"Create URL Rewrite:","Créer une réécriture d'URL :" -"Created At","Créé à " -"Credit Card %s","Carte bancaire %s" -"Credit Memo History","Historique des notes de crédit" -"Credit Memo Totals","Total des notes de crédit" -"Credit Memos","Avoirs" -"Credit memo #%s comment added","Commentaire ajouté à la note de crédit #%s" -"Credit memo #%s created","Note de crédit #%s créée" -"Credit memo\'s total must be positive.","Le total des notes de crédit doit être positif." -"Currency","Monnaie" -"Currency ""%s"" is used as %s in %s.","La monnaie ""%s"" est utilisée comme %s dans %s." -"Currency Information","Informations sur la devise" -"Currency Setup Section","Section d'installation de devises" -"Current Configuration Scope:","Portée actuelle des options :" -"Current Month","Mois actuel" -"Custom","Personnalisé" -"Custom Variable ""%s""","Variable personnalisée ""%s""" -"Custom Variables","Variables sur mesure" -"Customer","Client" -"Customer Group:","Groupe de clients :" -"Customer Groups","Groupes de clients" -"Customer","Nom du client" -"Customer Reviews","Avis du client" -"Customer Shopping Carts","Panier du client" -"Customer Since:","Client depuis :" -"Customer Tax Classes","Classes de taxe client" -"Customer with the same email already exists.","Un client avec le même e-mail existe déjà ." -"Customers","Clients" -"Customers by Orders","Clients par nombre de commandes" -"Customers by Orders Total","Clients par total des commandes" -"DHTML Date/Time Selector","Sélecteur de date/heure DHTML" -"Dashboard","Tableau de bord" -"Data Format","Format des données" -"Data transfer:","Transfert de données :" -"Database","Base de données" -"Date","Date" -"Date & Time","Date & Heure" -"Added","Date ajoutée" -"Updated","Date de mise à jour" -"Date selection:","Sélection de la date :" -"Date selector","Sélecteur de date" -"Day","Jour" -"Decimal separator:","Séparateur de décimales :" -"Default (Admin) Values","Valeurs par défaut (Admin)" -"Default Billing Address","Adresse de facturation par défaut" -"Default Config","Config par défaut" -"Default Template from Locale","Modèle par défaut de Locale" -"Default Values","Valeurs par défaut" -"Default display currency ""%s"" is not available in allowed currencies.","Monnaie d'affichage apr défaut ""%s"" ne fait pas partie des monnaies autorisées." -"Default scope","Portée par défaut" -"Delete","Supprimer" -"Delete %s","Supprimer %s" -"Delete %s '%s'","Supprimer %s '%s'" -"Delete File","Supprimer fichier" -"Delete Image","Supprimer l'image" -"Delete Profile","Supprimer profil" -"Delete Role","Supprimer modèle" -"Delete Store","Supprimer le magasin" -"Delete Store View","Supprimer la vue du magasin" -"Delete Template","Supprimer le modèle" -"Delete User","Supprimer utilisateur" -"Delete Website","Supprimer le site" -"Description","Description" -"Design","Design" -"Design Section","Section de design" -"Details","Détails" -"Developer Section","Section développeur" -"Direction:","Direction :" -"Disable","Désactiver" -"Disabled","Désactivé" -"Display %s first","Afficher %s en premier" -"Display default currency","Afficher la devise par défaut" -"Distributed under GNU LGPL. See %s for details.","Distribué sous la licence GNU LGPL. Voir %s pour plus de détails." -"Do you really want to KILL parallel process and start new indexing process?","Voulez-vous vraiment ARRÊTER les processus parallèles et commencer un nouveau processus d'indexation ?" -"Do you really want to proceed?","Voulez-vous vraiment continuer?" -"Download","Téléchargement" -"Downloads","Téléchargements" -"Drag to move","Faire glisser pour déplacer" -"Drop-down","Menu déroulant" -"Edit","Modifier" -"Edit Design Change","Éditer les changements de design" -"Edit Email Template","Modifier le modèle d'e-mail" -"Edit Order","Modifier la commande" -"Edit Queue","Modifier la file d'attente" -"Edit Review","Modifier le rapport" -"Edit Role","Modifier modèle" -"Edit Store View","Éditer la vue du magasin" -"Edit System Template","Modifier modèle système" -"Edit Template","Modifier le modèle" -"Edit URL Rewrite","Modifier la réécriture d'URL" -"Edit User","Modifier l'utilisateur" -"Edit User '%s'","Modifier l'utilisateur '%s'" -"Edit Website","Éditer le site web" -"Email","Email" -"Email Address:","Adresse e-mail:" -"Email Preview","Prévisualisation de l'e-mail" -"Email to a Friend","Envoyer à un ami par email" -"Email:","Email :" -"Enable","Activer" -"Enabled","Actif" -"Enclose Values In:","Joindre les valeurs dans :" -"Entity Attributes","Attributs de l'entité" -"Entity Type","Type d'entité" -"Entity type:","Type d'entité :" -"Error","Erreur" -"Excel XML","Excel XML" -"Excl. Tax","Taxe non comprise" -"Exclude media folder from backup","Exclure les fichiers médias de la sauvegarde" -"Export","Exporter" -"Export CSV","Exporter en CSV" -"Export Filters","Filtres d'exportation" -"Export to:","Exporter vers" -"Export:","Exporter:" -"FTP Host","Hôte FTP" -"FTP Host[:Port]","Hôte FTP [:Port]" -"FTP Login","Connexion FTP" -"FTP Password","Mot de passe FTP" -"FTP credentials","Certificats FTP" -"Failed to add a product to cart by id ""%s"".","Echec de l'ajout du produit au panier ""%s""" -"Failed to cancel the billing agreement.","L'annulation du tarif précédemment accepté a échoué." -"Failed to clear the JavaScript/CSS cache.","Échec de l'effacement du cache JavaScript/CSS." -"Failed to delete the billing agreement.","L'effacement du tarif précédemment accepté a échoué." -"Failed to update the profile.","Échec de la mise à jour du profil." -"Field","Champ" -"Field Mapping","Mappage de champ" -"File","Fichier" -"File Information","Informations du fichier" -"File System","Système de fichier" -"File mode","Mode de fichier" -"File name:","Nom de fichier :" -"File size should be more than 0 bytes","La taille du fichier doit dépasser 0 bytes." -"Finished profile execution.","Exécution du profil terminée." -"First Invoice Created Date","Date de création de la première facture" -"First Name","Prénom" -"First Name is required field.","Il est obligatoire de remplir le champ du prénom." -"First Name:","Prénom :" -"Fixed","Fixé" -"Flush Catalog Images Cache","Effacer le cache image du catalogue" -"Flush JavaScript/CSS Cache","Effacer le cache JavaScript/CSS" -"For category","Pour la catégorie" -"For latest version visit: %s","Pour la version de la dernière visite: %s" -"For product","Pour le produit" -"Forgot Admin Password","Mot de passe administrateur oublié" -"Forgot your password?","Mot de passe oublié ?" -"Forgot your user name or password?","Mot de passe ou nom d'utilisateur oublié ?" -"From","de" -"GLOBAL","GLOBAL" -"Gb","La G.B." -"General Information","Informations générales" -"General Section","Section générale" -"Get Image Base64","Encoder les images en base 64" -"Get help for this page","Obtenir de l'aide pour cette page" -"Global Attribute","Attribut global" -"Global Record Search","Enregistrement global des recherches" -"Global Search","Recherche globale" -"Go Today","Aller à aujourd'hui" -"Go to messages inbox","Aller à la boite de réception" -"Go to notifications","Aller aux notifications" -"Google Base","Google Base" -"Google Sitemaps","Google Sitemaps" -"Grand Total","Total final" -"Grid (default) / List","Grille (par défaut) / Liste" -"Grid Only","Grille uniquement" -"Group:","Groupe :" -"Guest","Invité" -"HTTP (unsecure)","HTTP (non-sécurisé)" -"HTTPS (SSL)","HTTPS (SSL) (Secure Socket Layer: confidentialité, intégrité, authentification)" -"Help Us Keep Magento Healthy - Report All Bugs","Aidez-nous à maintenir le bon fonctionnement de Magento: signalez tout dysfonctionnement." -"Helper attributes should not be used in custom layout updates.","Les attributs helper ne doivent pas être utilisés dans les mises à jour des dispositions personnalisées." -"Helper for options rendering doesn't implement required interface.","Helper pour le rendu des options n'implante pas l'interface requise." -"Home","Accueil" -"ID","ID" -"ID Path","ID du chemin" -"IP Address","Adresse IP" -"IPN (Instant Payment Notification) Only","NPI (Notification de Paiement Instantanée) seulement" -"If there is an account associated with %s you will receive an email with a link to reset your password.","S'il y a un compte associé à %s, vous recevrez un courriel contenant un lien pour réinitialiser votre mot de passe." -"If this message persists, please contact the store owner.","Si ce message persiste, veuillez contacter le propriétaire de la boutique." -"Images (.gif, .jpg, .png)","Images (.gif, .jpg, .png)" -"Images Cache","Cache d'image" -"Import","Importer" -"Import Service","Service d'importation" -"Import and Export","Importation et exportation" -"Import and Export Tax Rates","Taux d'imposition des importations et des exportations." -"Import/Export","Import/Export" -"Import/Export Advanced","Importation/exportation avancée" -"Import/Export Profile","Profil Import/Export" -"Important: ","Important :" -"Imported <strong>%s</strong> records","Enregistrements <strong>%s</strong> importés" -"In","Dans" -"In Database:","Dans la base de données :" -"In File:","Dans le fichier:" -"Inactive","Désactivé" -"Incl. Tax","Taxe comprise" -"Incoming Message","Message entrant" -"Insert Variable...","Insérez une variable" -"Interactive","Interactif" -"Interface Locale: %s","Interface locale: %s" -"Invalid Form Key. Please refresh the page.","Forme de clé invalide. Veuillez rafraîchir la page." -"Invalid Import Service Specified","Le service d'importation spécifié est invalide" -"Invalid POST data (please check post_max_size and upload_max_filesize settings in your php.ini file).","POST data invalide (veuillez vérifier les réglages post_max_size et upload_max_filesize dans votre fichier php.ini)." -"Invalid Secret Key. Please refresh the page.","Clé secrète invalide. Veuillez rafraîchir la page." -"Invalid User Name or Password.","Nom d'utilisateur ou mot de passe invalide." -"Invalid directory: %s","Répertoire invalide: %s" -"Invalid email address ""%s"".","Adresse email invalide ""%s""" -"Invalid email address.","Adresse email invalide." -"Invalid file: %s","Fichier invalide : %s" -"Invalid input data for %s => %s rate","Données entrées invalides pour %s => %s du tarif" -"Invalid parent block for this block","Bloc parent invalide pour ce bloc" -"Invalid parent block for this block.","Bloc parent invalide pour ce bloc." -"Invalid password reset token.","Preuve de réinitialisation de mot de passe invalide." -"Invalid sender name ""%s"". Please use only visible characters and spaces.","Nom de l'expéditeur invalide ""%s"". Veuillez n'utiliser que des caractères visibles et des espaces" -"Invalid timezone","Fuseau horaire invalide" -"Invalidated","Invalidé" -"Inventory Stock Status","Statut de l'inventaire des stocks" -"Invoice #%s comment added","Ajout d'un commentaire sur la facture #%s" -"Invoice #%s created","La facture #%s a été créée." -"Invoice History","Historique des factures" -"Invoice Totals","Totaux de facture" -"Invoice canceling error.","Erreur d'annulation de la facture." -"Invoice capturing error.","Erreur de capture de la facture." -"Invoice voiding error.","Erreur d'annulation de la facture." -"Invoices","Factures" -"Is Closed","Est fermé" -"Issue Number","Numéro de livraison" -"Items","Articles" -"JavaScript seems to be disabled in your browser.","Le JavaScript semble être désactivé sur votre navigateur." -"JavaScript/CSS","JavaScript/CSS" -"JavaScript/CSS Cache","Cache JavaScript/CSS" -"Kb","Kb" -"Last 24 Hours","Dernières 24 Heures" -"Last 5 Orders","5 Dernières Commandes" -"Last 5 Search Terms","5 Derniers Termes de Recherche" -"Last 7 Days","Ces 7 derniers jours" -"Last Credit Memo Created Date","Date du dernier avoir créé" -"Last Invoice Created Date","Date de la dernière facture créée" -"Last Logged In (%s):","Dernière connexion (%s):" -"Last Logged In:","Dernière connexion en:" -"Last Name","Nom" -"Last Name is required field.","Le nom de famille est un champ obligatoire." -"Last Name:","Nom de Famille:" -"Last updated: %s. To refresh last day\'s <a href=""%s"">statistics</a>, click <a href=""%s"">here</a>.","Dernière mise à jour : ""%s"" Pour mettre à jour les <a href=""%s"">statistiques</a> du dernier jour, cliquez <a href=""%s"">ici</a>." -"Latest Message:","Dernier message:" -"Layered Navigation Indices","Indice de navigation par niveaux" -"Layered Navigation Indices were refreshed.","Les indices de navigation par couches ont été rafraîchis." -"Leave empty to use tax identifier","Laisser vide pour utiliser l'identifiant taxe" -"Lifetime Sales","Ventes totales" -"Lifetime statistics have been updated.","Les statistiques de durée de vie ont été mises à jour." -"Links","Liens" -"Links with associated products will retain only after saving current product.","Les liens avec les produits associés seront retenus seulement après la sauvegarde du produit actuel." -"List (default) / Grid","Liste (par défaut) / Grille" -"List Only","Liste seule" -"Load Template","Charger le modèle" -"Load default template","Télécharger le formulaire -type par défaut" -"Loading...","Chargement..." -"Local Server","Serveur local" -"Local/Remote Server","Serveur Local/Distant" -"Locale","Paramètres régionaux" -"Log Out","Se déconnecter" -"Log in to Admin Panel","Se connecter en administrateur" -"Log into Magento Admin Page","Se connecter à la page Administration de Magento" -"Logged in as %s","Connecté en tant que %s" -"Login","Connexion" -"Low Stock","Stock bas" -"MAJOR","majeur" -"MINOR","MINEUR" -"MS Excel XML","MS Excel XML" -"Magento Admin","Administrateur de Magento" -"Magento Commerce - Administrative Panel","Commerce Magento - Membres Administratifs" -"Magento Connect","Magento Connect" -"Magento Connect Manager","Magento Connect Manager" -"Magento Logo","Logo de Magento" -"Magento is a trademark of X.commerce, Inc. Copyright © %s X.commerce, Inc.","Magento est une marque de X.commerce, Inc. Copyright © %s X.commerce, Inc." -"Magento root directory","Répertoire racine Magento" -"Magento ver. %s","Magento ver. %s" -"Magento® is a trademark of X.commerce, Inc.<br/>Copyright © %s X.commerce, Inc.","Magento® est une marque déposée de X.commerce, Inc.<br/>Copyright © %s X.commerce, Inc." -"Make sure that data encoding in the file is consistent and saved in one of supported encodings (UTF-8 or ANSI).","Assurez vous que les données d'encodage de ce fichier sont cohérentes et enrigistrées dans un des types d'encodage supportés (UTF-8 ou ANSI)." -"Manage Attribute Sets","Gérer les jeux d'attributs" -"Manage Attributes","Gérer attributs" -"Manage Categories","Gérer les catégories" -"Manage Content","Gérer le contenu" -"Manage Currency Rates","Gérer les taux de devises" -"Manage Customers","Gérer les utilisateurs" -"Manage Ratings","Gérer les Notes" -"Manage Stores","Gérer boutiques" -"Manage Tax Rules","Gérer les règles d'imposition" -"Manage Tax Zones and Rates","Gérer les taxes et les taux par zone" -"Manual","Manuel" -"Matched Expression","Expression correspondante" -"Mb","Mo" -"Media (.avi, .flv, .swf)","Media (.avi, .flv, .swf)" -"Media storages synchronization has completed!","La synchronisation des média est terminée !" -"Messages Inbox","Boîtes des messages entrants" -"Month","Mois" -"Most Viewed","Les plus vus" -"Most Viewed Products","Produits les plus regardés" -"Multiple Select","Choix multiple" -"My Account","Mon compte" -"N/A","non applicable" -"NOTICE","notice" -"Name","Nom" -"Name:","Nom :" -"Never (production)","Jamais (production)" -"New ","Nouveau" -"New API Key","Nouvelle Clé API" -"New Accounts","Nouveaux comptes" -"New Attribute","Nouvel attribut" -"New Block","Nouveau bloc" -"New Category","Nouvelle catégorie" -"New Class","Nouvelle classe" -"New Condition","Nouvelle Condition" -"New Custom Variable","Nouvelle variable personnalisable" -"New Customer","Nouvel utilisateur" -"New Customers","Nouveaux utilisateurs" -"New Design Change","Changement de nouveau dessin" -"New Email Template","Nouveau formulaire-type de courriel." -"New Group","Nouveau groupe" -"New Invoice","Nouvelle facture" -"New Item Type","Type de nouvel article" -"New Memo","Nouveau mémo" -"New Memo for #%s","Nouveau mémo pour #%s" -"New Page","Nouvelle page" -"New Password","Nouveau mot de passe" -"New Profile","Nouveau profil" -"New Rate","Nouveau taux" -"New Rating","Nouvelle note" -"New Review","Nouvel avis" -"New Role","Nouveau rôle" -"New Rule","Nouvelle règle" -"New Search","Nouvelle recherche" -"New Set","Nouvelle configuration" -"New Shipment","Nouvelle livraison" -"New Sitemap","Nouveau plan du site" -"New Store View","Vue nouvelle boutique" -"New System Template","Nouveau modèle de livraison" -"New Template","Nouveau modèle" -"New User","Nouvel utilisateur" -"New Variable","Nouvelle variable" -"New Website","Nouveau site Internet" -"New password field cannot be empty.","Le champ nouveau mot de passe ne peut pas être vide." -"Newsletter","Bulletin d'information" -"Newsletter Problems","Erreurs dans le bulletin d'information" -"Newsletter Queue","Fille d'attente de la newsletter" -"Newsletter Subscribers","Abonnés à la newsletter" -"Newsletter Templates","Modèles de newsletter" -"Next month (hold for menu)","Nouveau mois (maintenez la pression pour revenir au menu)" -"Next year (hold for menu)","Année prochaine (patienter pour le menu)" -"No","Non" -"No (price without tax)","Non (tarifs hors taxes)" -"No Data","Pas de données" -"No Data Found","Pas de données trouvées" -"No Templates Found","Aucun modèle trouvé" -"No change","Pas de modification" -"No customer id defined.","Pas d'identifiant utilisateur défini." -"No information available.","Aucune information disponible." -"No profile loaded...","Aucun profil téléchargé" -"No records found for this period.","Pas d'enregistrement pour cette période." -"No records found.","Aucun enregistrement trouvé." -"No report code specified.","Aucun code de rapport indiqué." -"No search keywords.","Aucun mot clé de recherche." -"No search modules were registered","Aucun module de recherche n'a été enregistré" -"No wishlist item id defined.","Par d'identifiant d'objet liste de souhaits défini." -"None","Aucun" -"Note:","Note :" -"Notes","Notes" -"Notifications","Notifications" -"Orders","Nombre de commandes" -"Uses","Nombre d'utilisations" -"Views","Nombre de vues" -"Number of records:","Nombre d'enregistrements :" -"OK","OK" -"Old rate:","Ancien taux :" -"One or more media files failed to be synchronized during the media storages syncronization process. Refer to the log file for details.","Un ou plusieurs fichiers n'ont pas pu être synchronisées durant le processus. Référez-vous au fichier log pour plus de détails." -"One or more of the Cache Types are invalidated:","Un ou plusieurs type(s) de cache sont invalidés :" -"Online Customers","Utilisateurs en ligne" -"Only Once (version upgrade)","Une seule fois (mise à niveau de la version)" -"Only attributes with scope ""Global"", input type ""Dropdown"" and Use To Create Configurable Product ""Yes"" are available.","Seuls les attributs concernant ""Global"", entrée de type ""Dropdown"", et utilisés pour créer des produits configurables ""Oui"" sont disponibles<" -"Only mapped fields","Champs mappés uniquement" -"Optional","En supplément" -"Options","Options" -"Order","Commande" -"Order %s","Commande #%s" -"Order %s (%s)","Commande N°%s (%s)" -"Order Created Date","Date de création de la commande" -"Order ID","ID de la commande" -"Order Totals","Total commandes" -"Order Updated Date","Date de mise à jour de la commande" -"Order Updated Date report is real-time, does not need statistics refreshing.","La date de mise à jour de la commande est temps réel, il n'y a pas besoin de rafraîchir les statistiques." -"Orders","Commandes" -"Original Magento attribute names in first row:","Nom d'attributs originaaux Magento dans la première ligne :" -"Out of stock","Epuisé" -"PDT (Payment Data Transfer) Only","TDP (Transfer des données de paiement) seulement" -"Package Extensions","Extensions du paquet" -"Pages","Pages" -"Parent Product Thumbnail","Miniature du produit parent" -"Parent Transaction ID","Identifiant de la transaction parente" -"Passive mode","Mode passif" -"Password","Mot de passe" -"Password Confirmation","Confirmation du mot de passe" -"Password confirmation must be same as password.","Le mot de passe de confirmation doit être le même que le mot de passe initial." -"Password must be at least of %d characters.","Le mot de passe doit être d'au moins %d caractères." -"Password must include both numeric and alphabetic characters.","Le mot de passe doit contenir des caractères numériques et alphabétiques." -"Password:","Mot de passe:" -"Path:","Chemin:" -"PayPal Manager","Gérant PayPal" -"Payment method instance is not available.","La méthode de paiement n'est pas disponible." -"Payment method is not available.","La méthode de paiement n'est pas disponible." -"Payment method must be specified.","Le mode de paiement doit être précisé." -"Pending Reviews","Avis en attente" -"Per Item","Par article" -"Per Order","Par commande" -"Percent","pour cent" -"Performed At","Fait à " -"Interval","Période" -"Permanent (301)","Permanent (301)" -"Permissions","Autorisations" -"Personal Information","Information personnelle" -"Phone:","Téléphone :" -"Please Select","Veuillez sélectionner" -"Please confirm site switching. All data that hasn\'t been saved will be lost.","Veuillez confirmer le changement de site. Toutes les données qui n'ont pas été sauvegardées seront perdues." -"Please enter 6 or more characters.","Veuillez entrer 6 caractères ou plus." -"Please enter a number greater than 0 in this field.","Veuillez entrer un nombre plus grand que 0 dans ce champ." -"Please enter a valid $ amount. For example $100.00.","Veuillez entrer un montant en $ valide. Par exemple 100 $." -"Please enter a valid URL. For example http://www.example.com or www.example.com","Veuillez entrer un URL valide. Par exemple http://www.exemple.com ou www.exemple.com" -"Please enter a valid URL. http:// is required","Veuillez entrer un URL valide. http:// est requis" -"Please enter a valid credit card number.","Veuillez taper un numéro de carte de crédit valide." -"Please enter a valid date.","Veuillez entrer une date valide." -"Please enter a valid email address. For example johndoe@domain.com.","Veuillez entrer une adresse courriel valide. Par exemple pierremaistre@domaine.com." -"Please enter a valid email.","Veuillez taper une adresse e-mail valide." -"Please enter a valid number in this field.","Veuillez entrer un numéro valide dans ce champ." -"Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.","Veuillez entrer un numéro de téléphone valide. Par exemple (123) 456-7890 ou 123-456-7890." -"Please enter a valid social security number. For example 123-45-6789.","Veuillez entrer un numéro de sécurité sociale valide. Par exemple 123-54-6789." -"Please enter a valid value from list","Veuillez entrer une valeur valide à partir de la liste" -"Please enter a valid value, ex: 10,20,30","Veuillez entrer une valeur valide, ex : 10,20,30" -"Please enter a valid zip code.","Veuillez taper un code postal valide." -"Please enter a valid zip code. For example 90602 or 90602-1234.","Veuillez entrer un code postal valide. Par exemple 90602 ou 90602-1234." -"Please enter another credit card number to complete your purchase.","Veuillez entrer un autre numéro de carte bancaire pour compléter votre commande." -"Please enter password","Veuillez taper votre mot de passe" -"Please enter password to confirm rollback.","Veuillez taper votre mot de passe pour confirmer la restauration." -"Please enter valid password.","Veuillez entrer un mot de passe valide." -"Please make sure that all global admin search modules are installed and activated.","Veuillez vous assurer que tous les modules de recherche globale sont installés et activés." -"Please make sure that your changes were saved before running the profile.","Veuillez vous assurer que vos modifications ont été sauvegardées avant d'exécuter le profil." -"Please make sure your passwords match.","Veuillez vérifier que votre mot de passe fonctionne." -"Please select State/Province.","Veuillez choisir l'état/la province." -"Please select a customer.","Veuillez sélectionner un utilisateur." -"Please select a store.","Veuillez sélectionner une boutique." -"Please select an option.","Veuillez sélectionner une option." -"Please select catalog searches.","Veuillez sélectionner des recherches du catalogue." -"Please select customer(s).","Veuillez sélectionner le(s) client(s)." -"Please select message(s).","Veuillez sélectionner des messages." -"Please select one of the above options.","Veuillez sélectionner l'un des choix ci-dessus." -"Please select one of the options.","Veuillez sélectionner l'une des options." -"Please select review(s).","Veuillez sélectionner les avis." -"Please specify backup creation options","Veuillez préciser les options de création de la sauvegarde" -"Please specify the admin custom URL.","Veuillez préciser la nouvelle URL d'aminnistration." -"Please try to logout and sign in again.","Veuillez essayer de vous déconnecter, puis de vous connecter à nouveau." -"Please type the letters from the image:","Veuillez taper les lettres de l'image:" -"Please use in this field only ""a-z,0-9,_"".","Veuillez n'utiliser que ""a-z,0-9,_"". dans ce champ." -"Please use letters only (a-z) in this field.","Veuillez n'utiliser que des lettres (de ""a"" à ""z"") dans ce champ." -"Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.","Veuillez n'utiliser que des chiffres dans ce champ. Evitez les espaces et autres caractères tels que des points ou des virgules." -"Please use only letters (a-z or A-Z), numbers (0-9) or spaces in this field.","Veuillez n'utiliser que des lettres (a-z ou A-Z), chiffres (0-9) ou espaces dans ce champs." -"Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.","Veuillez n'utiliser que des lettres (de ""a"" à ""z"") ou des chiffres (de ""0"" à ""9"") dans ce champ. Aucun espace ou autre caractère n'est autorisé." -"Please use only letters (a-z) or numbers (0-9) or spaces and # only in this field.","Veuillez utiliser seulement des lettres (a-z) ou des chiffres (0-9) ou des espaces et # dans ce champ." -"Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.","Veuillez utiliser ce format de date: dd/mm/yyyy. Par exemple 29/04/1960 pour le 29th of April, 1960." -"Please wait while the indexes are being refreshed.","Veuillez patienter durant l'actualisation des index." -"Please wait, loading...","En cours de chargement, veuillez patienter..." -"Please wait...","Veuillez patienter..." -"Popular","Populaire" -"Position of Watermark for %s","Position du filigrane pour %s" -"Pregenerated product images files.","Fichiers images produit pré-générées" -"Prev. month (hold for menu)","Mois préc. (maintenez la pression pour revenir au menu)" -"Prev. year (hold for menu)","Année préc. (patienter pour le menu)" -"Preview","Aperçu" -"Preview Template","Prévisualiser le modèle" -"Price","Prix" -"Price alert subscription was saved.","La souscription à l'alerte de prix a été enregistrée." -"Price:","Prix:" -"Processed <strong>%s%% %s/%d</strong> records","Enregistrements <strong>%s%% %s/%d</strong> traités" -"Product","Produit" -"Product","Nom du produit" -"Product Reviews","Avis sur le produit" -"Product Tax Classes","Classes des produits pour les taxes" -"Product Thumbnail Itself","Cliqué réduit du produit lui-même" -"Product is not loaded.","Le produit n'est pas chargé." -"Product:","Produit:" -"Products","Produits" -"Products Bestsellers Report","Rapport des meilleures ventes" -"Products Most Viewed Report","Rapport concernant les produits les plus vus" -"Products Ordered","Produits commandés" -"Products in Carts","Produits dans le panier." -"Profile Action","Action de profil" -"Profile Actions XML","Actions XML du profil" -"Profile Direction","Direction du produit" -"Profile History","Historique du profil" -"Profile Information","Information sur le profil" -"Profile Name","Nom du profil" -"Profile Payments","Paiements du profil" -"Profile Schedule","Calendrier du profil" -"Profile Wizard","Assistant du profil" -"Profiles","Profils" -"Promo","Promo" -"Promotions","Promotions" -"Purchased Item","Article acheté" -"Put store on the maintenance mode while backup creation","Mettre le magasin en mode de maintenance pendant la création de la sauvegarde" -"Put store on the maintenance mode while rollback processing","Placer le magasin en mode maitenance pendant que la restauration s'effectue." -"Quantity","Quantité" -"Queue Refresh","Rafraîchissement de la liste d'attente" -"Queued... Cancel","En liste d'attente ... Annuler." -"Radio Buttons","Boutons radios" -"Rates","Taux" -"Read details","Lire détails" -"Rebuild","Reconstruire" -"Rebuild Catalog Index","Reconstruire l'index du catalogue" -"Rebuild Flat Catalog Category","Reconstruire les catégories du catalogue" -"Rebuild Flat Catalog Product","Reconstruire les produits du catalogue" -"Recent Orders","Commandes récentes" -"Recent statistics have been updated.","Les statistiques récentes on été sauvegardées." -"Recurring Profile View","Consultations multiples de ce profil." -"Recursive Dir","Répertoire récursif" -"Redirect","Rediriger" -"Reference","Référence" -"Reference ID","Identifiant Référence" -"Refresh","Rafraîchir" -"Refresh Now*","Actualiser maintenant*" -"Refresh Statistics","Rafraîchir les statistiques" -"Region/State","Région/État" -"Regular Price:","Prix habituel:" -"Release","Sortie" -"Release Stability","Sortir stable" -"Release Version","Version récente" -"Reload captcha","Téléarger à nouveau Captcha" -"Remote FTP","FTP à distance" -"Remove","Supprimer" -"Reports","Rapports" -"Request Path","Chemin demandé" -"Required","Requis" -"Reset","Réinitialiser" -"Reset Filter","Mettre à zéro le filtre" -"Reset Password","Réinitialiser le mot de passe" -"Reset a Password","Réinitialiser un mot de passe" -"Resize","Redimensionner" -"Resource Access","Accès aux ressources" -"Resources","Ressources" -"Results","Résultats" -"Retrieve Password","Récupérer votre mot de passe" -"Return Html Version","Retourner à la version HTML" -"Revenue","Revenu" -"Reviews","Commentaires" -"Reviews and Ratings","Avis et évaluations" -"Rewrite Rules","Réécrire les règles" -"Role ID","Identité du rôle" -"Role Info","Infos sur le rôle" -"Role Information","Informations du rôle" -"Role Name","Nom du rôle" -"Role Resources","Ressources du rôle" -"Role Users","Utilisateurs rôles" -"Roles","Rôles" -"Roles Resources","Ressources du rôle" -"Rotate CCW","Tourner CCW" -"Rotate CW","Tourner CW" -"Run","Exécuter" -"Run Profile","Exécuter profil" -"Run Profile Inside This Window","Exécuter le profil dans cette fenêtre" -"Run Profile in Popup","Exécuter le profil dans une pop-up" -"Running... Kill","En cours d'exécution... Arrêter" -"SKU","UGS" -"SKU:","UGS:" -"SSL Error: Invalid or self-signed certificate","Erreur SSL : certificat invalide" -"Sales","Ventes" -"Sales Report","Rapport de ventes" -"Samples","Échantillons" -"Save","Enregistrer" -"Save & Generate","Sauvegarder et générer" -"Save Account","Sauvegarder le compte" -"Save Cache Settings","Sauvegarder les options du cache" -"Save Config","Sauvegarder la configuration" -"Save Currency Rates","Sauvegarder les taux de conversion des monnaies" -"Save Profile","Sauvegarder le profil" -"Save Role","Sauvegarder le rôle" -"Save Template","Sauvegarder le formulaire-type" -"Save User","Sauvegarder l'utilisateur" -"Save and Continue Edit","Sauvegarder et continuer l'édition" -"Search","Rechercher" -"Search Index","Rechercher l'index" -"Search Term","Terme de recherche" -"Search Terms","Rechercher les conditions" -"Select","Sélectionner" -"Select All","Sélectionner tout" -"Select Category","Sélectionner catégorie" -"Select Date","Sélectionner la date" -"Select Range","Sélectionner la portée" -"Select date","Sélectionner date" -"Selected allowed currency ""%s"" is not available in installed currencies.","La monnaie autorisée sélectionnée ""%s"" n'est pas disponible dans les monnaies installées." -"Selected base currency is not available in installed currencies.","La devise de base sélectionnée n'est pas disponible parmi les devises inscrites dans le système." -"Selected default display currency is not available in allowed currencies.","La monnaie d'affichage par défaut sélectionnée n'est pas disponible dans les monnaies installées." -"Selected default display currency is not available in installed currencies.","L'affichage dans la devise choisie par défaut n'est pas disponible parmi les devises inscrites dans le système." -"Self-assigned roles cannot be deleted.","Les rôles attribués par soi-même ne peuvent être effacés." -"Sender","Expéditeur" -"Separate Email","Email séparée" -"Service Settings","Réglages du service" -"Set up & Customize","Configurez et personnalisez" -"Shipment #%s comment added","Commentaire ajouté sur l'expédition #%s" -"Shipment #%s created","Expédition #%s crée" -"Shipment Comments","Commentaires sur l'expédition" -"Shipment History","Historique de l'expédition" -"Shipments","Expéditions" -"Shipping","Expédition" -"Shipping Address","Adresse d'expédition" -"Shipping Address: ","Adresse d'expédition:" -"Shipping Origin","Origine de l'expédition" -"Shipping Price","Frais de port:" -"Shipping address selection is not applicable","L'adresse d'expédition sélectionnée n'est pas disponible" -"Shipping method must be specified.","Le mode d'expédition doit être précisé." -"Shipping method selection is not applicable","Le mode d'expédition choisi est impossible dans ce cas." -"Shopping Cart","Panier" -"Shopping Cart Price Rules","Règles s'appliquant aux paniers" -"Shopping Cart from %s","Panier de %s" -"Show By","Montrer par" -"Show Report For:","Afficher le rapport pour :" -"Show Reviews","Montrer les avis" -"Sitemap Information","Plan du site" -"Size for %s","Taille de %s" -"Skip Category Selection","Passer la sélection de catégorie" -"Some items in this order have different invoice and shipment types. You can create shipment only after the invoice is created.","Certains éléments dans cette commande ont des types de facture et d'expédition différents. Vous pouvez créer l'expédition seulement après avoir créé la facture." -"Some of the ordered items do not exist in the catalog anymore and will be removed if you try to edit the order.","Certains des articles commandés n'existent plus dans le catalogue et seront supprimés si vous voulez bien modifier la commande." -"Sorry, this feature is coming soon...","Désolé, cette fonction arrive bientôt..." -"Special Price:","Prix spécial:" -"Specific Countries","Pays spécifiques" -"Specified","Spécifié" -"Specified profile does not exist.","Le profil indiqué n'existe pas." -"Spreadsheet Name:","Nom du la feuille de calcul" -"Start Date","Date de début" -"Starting profile execution, please wait...","Démarrage de l'exécution de profil, veuillez patienter..." -"State/Province:","État/Région" -"Static Blocks","Blocs statiques" -"Status","Statut" -"Status:","Statut" -"Stock Quantity:","Quantité en stock :" -"Stock notification was saved.","La notification du stock a été sauvegardée." -"Store","Magasin" -"Store Email Addresses Section","Rubrique contenant les adresses e-mail des magasins" -"Store View","Vue du magasin" -"Store:","Magasin:" -"Stores","Boutiques" -"Subject","Sujet" -"Submit","Soumettre" -"Subpackage cannot be conflicting.","Le subpackage ne peut pas être contradictoire." -"Subtotal","Sous-total" -"Switch/Solo/Maestro Only","Switch/Solo/Maestro seulement" -"Synchronization is required.","La synchronisation est nécessaire." -"Synchronization of media storages has been successfully completed.","La synchronisation du staockage médias a été effectuée avec succès." -"Synchronize","Synchroniser" -"Synchronizing %s to %s","Synchronisation de %s et %s" -"Synchronizing...","Synchronisation en cours...." -"System","Système" -"System Section","Section système" -"System busy","Le système est occupé" -"Target Path","Chemin cible" -"Tax","Taxe" -"Tb","Tb" -"Template","Modèle visuel" -"Template Content","Contenu du modèle" -"Template Information","Formulaire-type d'information" -"Template","Nom du template" -"Template Styles","Styles de modèle" -"Template Subject","Sujet du modèle" -"Template Type","Type de modèle" -"Temporary (302)","Temporaire (302)" -"Terms and Conditions","Termes et conditions" -"Text","Texte" -"The Catalog Rewrites were refreshed.","Les réécritures du catalogue ont été actualisées." -"The CatalogInventory Stock Status has been rebuilt.","Le statut du stock de l'inventaire-catalogue a été repensé." -"The Comment Text field cannot be empty.","Le champ de commentaire doit être rempli." -"The Flat Catalog Product was rebuilt","Le produit fixe du catalogue a été reconstruit." -"The JavaScript/CSS cache has been cleaned.","Le cache JavaScript/CSS a été effacé." -"The JavaScript/CSS cache has been cleared.","Le cache JavaScript/CSS a été enlevé." -"The Layered Navigation indexing has been queued.","L'index de la navigation par niveaux a été mis en queue." -"The Layered Navigation indexing queue has been canceled.","La mise en queue de l'index de la navigation par niveaux a été annulée." -"The Layered Navigation indices were refreshed.","Les index sous-jacents de la navigation ont été rafraîchis." -"The Layered Navigation process has been queued to be killed.","La réalisation de la navigation par niveaux a été mise en queue pour être annulée." -"The Magento cache storage has been flushed.","Le stockage du cache Magento a été purgé." -"The URL Rewrite has been deleted.","La réécriture d'URL a été supprimée." -"The URL Rewrite has been saved.","La réécriture d'URL a été enregistrée." -"The account has been saved.","Le compte a été enregistré." -"The archive can be uncompressed with <a href=""%s"">%s</a> on Windows systems","Les archives peuvent être décompressées par le biais de <a href=""%s"">%s</a> sur les système Windows" -"The attribute set has been removed.","L'ensemble d'attributs a été supprimé." -"The backup's creation process will take time.","La création de la sauvegarde va prendre du temps." -"The billing agreement has been canceled.","L'accord de facturation a été annulé." -"The billing agreement has been deleted.","L'accord de facturation a été supprimé." -"The cache storage has been flushed.","Le stockage du cache a été vidé." -"The carrier needs to be specified.","Le transporteur doit être spécifié." -"The catalog index has been rebuilt.","L'index du catalogue a été reconstruit." -"The catalog rewrites have been refreshed.","Les réécritures du catalogue ont été réactualisées." -"The configuration has been saved.","La configuration a été enregistrée." -"The credit memo has been canceled.","L'avoir a été annulé." -"The credit memo has been created.","L'avoir a été créé." -"The credit memo has been voided.","Le mémo de crédit a été vidé." -"The custom variable has been deleted.","La variable courante a été supprimée." -"The custom variable has been saved.","La variable personnelle a été sauvegardée." -"The customer has been deleted.","Le client a été supprimé." -"The customer has been saved.","Le client a été sauvegardé." -"The design change has been deleted.","Le changement de forme a été supprimé." -"The design change has been saved.","Le changement de forme a été enregistré." -"The email address is empty.","L'adresse email est vide." -"The email template has been deleted.","Le formulaire-type du courriel a été effacé." -"The email template has been saved.","Le modèle d'email a été enregistré." -"The flat catalog category has been rebuilt.","La catégorie du catalogue neutre a été réparée." -"The group node name must be specified with field node name.","Le nom du noeud du groupe doit être défini dans le champ nom du noeud." -"The image cache was cleaned.","L'image cache a été nettoyée." -"The image cache was cleared.","L'image cache a été vidée." -"The invoice and shipment have been created.","La facture et l'envoi ont été créés." -"The invoice and the shipment have been created. The shipping label cannot be created at the moment.","La facture et l'expédition ont été créés. Le label d'expédition ne peut pas être créé à ce moment." -"The invoice has been canceled.","La facture a été annulée." -"The invoice has been captured.","La facture a été capturée." -"The invoice has been created.","La facture a été créée." -"The invoice has been voided.","La facture a été annulée." -"The invoice no longer exists.","La facture n'existe plus." -"The item %s (SKU %s) does not exist in the catalog anymore.","L'objet %s (SKU %s) n'existe plus dans la catalogue." -"The order does not allow creating an invoice.","La commande n'autorise pas la création de facture." -"The order no longer exists.","La commande a disparu." -"The profile has been deleted.","Le profil a été supprimé." -"The profile has been saved.","Le profil a été sauvegardé." -"The profile has been updated.","Le profil a été mis à jour." -"The profile has no changes.","Le profil ne comporte aucune modification." -"The profile you are trying to save no longer exists","Le profil que vous essayez d'enregistrer n'existe plus" -"The rating has been deleted.","L'évaluation a été effacée." -"The rating has been saved.","L'évaluation a été enregistrée." -"The role has been deleted.","Le modèle a été supprimé." -"The role has been saved.","Le modèle a été enregistré." -"The role has been successfully saved.","Le modèle a été enregistré avec succès." -"The search index has been rebuilt.","L'index de recherche a été refait." -"The shipment has been created.","L'envoi a été créé." -"The shipment has been sent.","La commande a été expédiée." -"The shipping label has been created.","L'étiquette d'expédition a été créée." -"The transaction details have been updated.","Les détails de la transaction ont été mis a jour." -"The user has been deleted.","L'utilisateur a été supprimé." -"The user has been saved.","L'utilisateur a été sauvegardé." -"Themes JavaScript and CSS files combined to one file.","Themes JavaScript et fichiers CSS combinés en un fichier." -"There is an error in one of the option rows.","Il y a un erreur dans les rangées des choix." -"This Account is","Le compte est" -"This Email template no longer exists.","Ce modèle d'email n'existe plus." -"This Role no longer exists","Ce rôle n'existe plus." -"This Role no longer exists.","Ce rôle n'existe plus." -"This account is","Ce compte est" -"This account is inactive.","Ce compte est inactif." -"This action cannot be undone.","Cette action ne peut être annulée." -"This attribute set does not have attributes which we can use for configurable product","Ce jeu d'attributs n'a pas d'attributs que nous pouvons utiliser pour un produit paramétrable" -"This attribute shares the same value in all the stores","Cet attribut a la même valeur dans tous les magasins" -"This is a demo store. Any orders placed through this store will not be honored or fulfilled.","Il ne s'agit que d'un magasin de démonstration. Toute commande passée par l'intermédiaire de ce magasin ne sera pas honorée ou satisfaite." -"This is a required field.","Ceci est un champ requis." -"This product is currently disabled.","Ce produit est pour l'instant désactivé." -"This report depends on timezone configuration. Once timezone is changed, the lifetime statistics need to be refreshed.","Ce rapport dépend de la configuration du fuseau horaire. Une fois le fuseau horaire modifié, les statistiques de durée de vie nécessiteront une réactualisation." -"This section is not allowed.","Cette rubrique est interdite." -"This user no longer exists.","Cet utilisateur n'existe plus." -"Time","Heure" -"Time selection:","Sélection de l'heure:" -"Time:","Heure:" -"Timeout limit for response from synchronize process was reached.","La limite de délai d'attente pour la réponse du processus de synchronisation a été atteinte." -"To","A" -"To cancel pending authorizations and release amounts that have already been processed during this payment, click Cancel.","Pour annuler les autorisations en attente et libérer les montants qui ont déjà été traités au cours de ce paiement, cliquez sur Annuler." -"To use PayPal Payflow Link you must configure some settings in your Payflow account by logging into","Pour utiliser Payflow Link, vous devez configurer votre compte Payflow Link sur le site de Paypal." -"To use PayPal Payments Advanced you must configure some settings in your PayPal Payments Advanced account by logging into","Pour utiliser PayPal Payments Advanced , vous devez configurer des paramètres de votre compte PayPal Payments Advanced en vous connectant." -"Toggle Editor","Editeur de bouton" -"Tools","Outils" -"Top 5 Search Terms","5 termes les plus recherchés" -"Total","Total" -"Total Invoiced","Total facturé" -"Total","Somme totale de la commande" -"Total Refunded","Total remboursé" -"Total of %d record(s) have been deleted.","Un total de %d entrée(s) ont été supprimées." -"Total of %d record(s) have been updated.","Un total de %d article(s) a/ont été mis à jour." -"Total of %d record(s) were canceled.","Au total, %d enregistrement(s) ont été annulés." -"Total of %d record(s) were deleted","Un total de %d enregistrements ont été supprimés." -"Total of %d record(s) were deleted.","Un total de %d enregistrements ont été supprimés." -"Total of %d record(s) were updated","Un total de %d enregistrements ont été mis à jour." -"Total of %d record(s) were updated.","Un total de %d enregistrements ont été mis à jour." -"Track Order","Suivre la commande" -"Track this shipment","Suivre cette expédition" -"Tracking number %s for %s assigned","Numéro de suivi %s attribué %s pour" -"Tracking number cannot be empty.","Le numéro de suivi ne peut pas être vide." -"Transaction Data","Données de transaction" -"Transaction Details","Détails de la transaction" -"Transaction ID","ID de la transaction" -"Transaction Type","Type de transaction" -"Transactional Emails","Emails de transaction" -"Transactions","Transactions" -"Type","Type" -"Type:","Type:" -"URL Rewrite","Réécriture URL" -"URL Rewrite Information","Informations de réécriture d'URL" -"URL Rewrite Management","Gestion de la réécriture URL" -"Unable to cancel the credit memo.","Impossible d'annuler l'avoir." -"Unable to find a Email Template to delete.","Impossible de trouver un modèle d'email à supprimer." -"Unable to find a user to delete.","Impossible de trouver un utilisateur à effacer." -"Unable to initialize import model","Impossible d'initialiser le modèle importé" -"Unable to refresh lifetime statistics.","Impossible de réactualiser les statistiques de durée de vie" -"Unable to refresh recent statistics.","Impossible de réactualiser les statistiques récentes." -"Unable to save Cron expression","Impossible de sauvegarder l'expression Cron" -"Unable to save the cron expression.","Impossible de sauvegarder l'expression cron." -"Unable to save the invoice.","Impossible d'enregistrer la facture." -"Unable to send the invoice email.","Impossible d'envoyer la facture électronique." -"Unable to send the shipment email.","Impossible d'envoyer le courriel d'expédition." -"Unable to update transaction details.","Impossible de mettre à jour les détails de transactions." -"Unable to void the credit memo.","Impossible d'annuler l'avoir." -"Unknown","Inconnu" -"Unlimited","Illimité" -"Update","Mettre à jour" -"Updated At","Mis à jour à " -"Upload File","Télécharger le fichier" -"Upload Files","Envoyer des fichiers" -"Upload HTTP Error","Télécharger l'erreur HTTP" -"Upload I/O Error","Erreur d'envoi E/S (Entrée/Sortie)" -"Upload Security Error","Télécharger l'erreur de sécurité" -"Upload import file","Envoyer un fichier d'importation" -"Uploaded file is larger than %.2f kilobytes allowed by server","Le fichier téléchargé est plus volumineux que les %.2f kilobytes autorisés par le serveur" -"Use All Available Attributes","Utiliser tous les attributs disponibles" -"Use Config Settings","Utiliser les Paramètres de Configuration" -"Use Default","Utiliser par défaut." -"Use Default Value","Utiliser la Valeur par Défaut" -"Use Default Variable Values","Utiliser les valeurs variables par défaut" -"Use FTP Connection","Utilisez la connexion FTP" -"Use Website","Utiliser le site web" -"Used Currently For","Actuellement utilisé pour" -"Used as Default For","Utilisé par défaut pour" -"User Email","Adresse E-mail de l'utilisateur" -"User ID","ID utilisateur" -"User Info","Info sur l'utilisateur" -"User Information","Informations sur les utilisateurs" -"User Name","Nom d'utilisateur" -"User Name is required field.","Le nom d'utilisateur est requis" -"User Name:","Nom d'utilisateur :" -"User Password","Mot de passe utilisateur" -"User Role","Modèle d'utilisateur" -"User Roles","Modèles d'utilisateur" -"User Roles Information","Information sur les modèles utilisateur" -"User name","Nom d'utilisateur" -"Users","Utilisateurs" -"VAT Number is Invalid","Le numéro de TVA est invalide" -"VAT Number is Valid","Le numéro de TVA est valide" -"Validation Results","Résultats validation" -"Value","Valeur" -"Value Delimiter:","Délimiteur de valeur :" -"Variable","Variable" -"Variable Code","Code variable" -"Variable HTML Value","Valeur HTML variable" -"Variable ID","Identité changeante" -"Variable Name","Nom de la variable" -"Variable Plain Value","Valeur simple de la variable" -"View Actions XML","Voir les actions XML" -"View Full Size","Voir en taille réelle" -"View Memo","Voir la note" -"View Memo for #%s","Voir le mémo #%s" -"View Shipment","Voir l'envoi" -"View Statistics For:","Voir les statistiques pour:" -"Visibility:","Visibilité :" -"Warning","Avertissement" -"Warning! Empty value can cause problems with CSV format.","Attention! Une valeur vide peut causer des problèmes avec le format CSV." -"Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?","Attention!\r\n Cette action défera cet utilisateur de son rôle déjà assigné\r\nEtes-vous sûr ?" -"Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?","Attention!\r\n Cette action supprimera les rôles ont déjà été attribués aux utilisateurs concernés\r\nÊtes-vous certain(e) de vouloir continuer?" -"Warning: Please do not close the window during importing/exporting data","Attention: Veuillez ne pas fermer la fenêtre pendant l'importation ou l'exportation de données" -"Watermark File for %s","Fichier Filigrane pour %s" -"We appreciate our merchants\' feedback, please <a href=""#"" onclick=""surveyAction(\'yes\'); return false;"">take our survey</a> to provide insight on the features you would like included in Magento. <a href=""#"" onclick=""surveyAction(\'no\'); return false;"">Remove this notification</a>","Nous apprécions les remarques de nos revendeurs\', ainsi veuillez avoir l'obligeance <a href=""#"" onclick=""surveyAction(\'yes\'); return false;""> de remplir notre enquête </a> afin de nous faire connaître les améliorations que vous souhaiteriez voir apportées à Magento.<a href=""#"" onclick=""surveyAction(\'no\'); return false;"">Supprimer ce message</a>" -"We\'re in our typing table, coding away more features for Magento. Thank you for your patience.","Nous sommes devant notre bureau, programmant de nouvelles fonctions pour Magento. Merci pour votre patience." -"Web Section","Section Web" -"Web Services","Services Web" -"Web services","Services web" -"Website","Site" -"What is this?","Qu'est-ce que c'est ?" -"Wishlist Report","Rapport de liste cadeaux" -"Wishlist item is not loaded.","L'article désiré n'a pas été chargé." -"Wrong account specified.","Le compte indiqué est erroné." -"Wrong billing agreement ID specified.","Le numéro indiqué de la facturation acceptée est erroné." -"Wrong column format.","Mauvais format de colonne." -"Wrong newsletter template.","Mauvais modèle de lettre de diffusion" -"Wrong quote item.","Mauvais objet" -"Wrong tab configuration.","L'onglet de configuration est erroné." -"Wrong transaction ID specified.","Mauvais identifiant transaction défini." -"XML","XML" -"XML data is invalid.","Données XML invalides" -"XML object is not instance of ""Magento\Simplexml\Element"".","L'objet XML n'est pas une instance de ""Magento\Simplexml\Element""" -"YTD","Année en cours" -"Year","Année" -"Yes","Oui" -"Yes (301 Moved Permanently)","Oui (301 déplacé de façon permanente)" -"Yes (302 Found)","Oui (302 trouvé)" -"Yes (only price with tax)","Oui (tarifs TTC uniquement)" -"You cannot delete your own account.","Vous ne pouvez pas effacer votre propre compte." -"You have %s unread message(s).","Vous avez %s message(s) non lu(s)." -"You have %s unread message(s). <a href=""%s"">Go to messages inbox</a>.","Vous avez %s messages non lus. <a>Aller à la boite de réception</a>." -"You have %s, %s and %s unread messages. <a href=""%s"">Go to messages inbox</a>.","Vous avez %s, %s et %s messages non lus. <a>Aller à la boite de réception</a>." -"You have logged out.","Vous vous êtes déconnecté(e)." -"You have not enough permissions to use this functionality.","Vous n'avez pas les permissions suffisantes pour utiliser cette fonctionnalité." -"You must have JavaScript enabled in your browser to utilize the functionality of this website.","Vous devez avoir activé le JavaScript dans votre navigateur pour utiliser les fonctionnalités de ce site web." -"You need to specify order items.","Vous devez spécifier les articles de la commande." -"You will need to wait when the action ends.","Vous devrez attendre jusqu'à la fin de l'action." -"Your answers contain duplicates.","Vous avez des réponses en double." -"Your password has been updated.","Votre mot de passe a été mis à jour." -"Your password reset link has expired.","Votre lien de réinitialisation de mot de passe a expiré." -"Your server PHP settings allow you to upload files not more than %s at a time. Please modify post_max_size (currently is %s) and upload_max_filesize (currently is %s) values in php.ini if you want to upload larger files.","Les paramètres de votre serveur PHP ne vous permettent pas de télécharger plus de %s fichiers à la fois sur le serveur. Modifiez les valeurs post_max_size (actuellement %s) et upload_max_filesize (actuellement %s) dans php.ini si vous voulez télécharger des fichiers plus volumineux sur le serveur." -"Your web server is configured incorrectly. As a result, configuration files with sensitive information are accessible from the outside. Please contact your hosting provider.","Votre serveur web n'est pas configuré correctement. Par conséquent, les fichiers de configuration contenant des informations sensibles sont accessibles de l'extérieur. Veuillez contacter votre hébergeur." -"Zip/Postal Code","Code postal" -"Zip/Postal Code:","Code postal:" -"[ deleted ]","[ supprimé ]" -"[GLOBAL]","[GLOBAL]" -"[STORE VIEW]","[ VUE BOUTIQUE ]" -"[WEBSITE]","[SITE WEB]" -"b","o" -"close","fermer" -"critical","critique" -"example: ""sitemap/"" or ""/"" for base path (path must be writeable)","exemple: ""sitemap/"" ou ""/"" pour le répertoire de base (doit être accessible en écriture)" -"example: sitemap.xml","Exemple: sitemap.xml" -"failed","échoué" -"from","de" -"major","majeur" -"minor","mineur" -"notice","notice" -"store(%s) scope","périmètre boutique (%s)" -"successful","réussi" -"to","à " -"website(%s) scope","périmètre site internet (%s)" -"{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. It is highly recommended to change this value in your Magento <a href=""%s"">configuration</a>.","{{base_url}} n'est pas recommandé pour déclarer Base Unsecure URL / Base Secure URL dans un environnement de production. Il est fortement recommandé de changer cette valeur dans votre <a href=""%s"">configuration</a> de Magento." diff --git a/app/code/Magento/Adminhtml/i18n/nl_NL.csv b/app/code/Magento/Adminhtml/i18n/nl_NL.csv deleted file mode 100644 index 635f28d6f23..00000000000 --- a/app/code/Magento/Adminhtml/i18n/nl_NL.csv +++ /dev/null @@ -1,1144 +0,0 @@ -" The customer does not exist in the system anymore.","Deze klant staat niet meer in het systeem." -" You will need to navigate to your ","U zult moeten navigeren naar uw" -" [deleted]"," [verwijderd]" -" and "," en " -" and go to the "," en ga naar de " -" sections for your Hosted Checkout Pages."," sectie voor uw Hosted Checkout Pagina's." -"%s (Default Template from Locale)","%s (Standaard sjabloon van Lokale)" -"%s cache type(s) disabled.","%s cache type(s) uitgeschakeld." -"%s cache type(s) enabled.","%s cache type(s) ingeschakeld." -"%s cache type(s) refreshed.","%s cache type(s) herladen." -"(For Type ""Local Server"" need to use relative path to Magento install var/export or var/import, e.g. var/export, var/import, var/export/some/dir, var/import/some/dir)","(Voor ""Local Server"" Type moet u het desbetreffende pad naar Magento install var/export of var/import gebruiken, b.v. var/export, var/import, var/export/some/dir, var/import/some/dir)" -"(For US 2-letter state names)","(Voor VS 2-letter staatsnamen)" -"(If left empty will be auto-generated)","(Indien leeg gelaten wordt dit automatisch gegenereerd)" -"(Leave empty for first spreadsheet)","(Laat leeg voor de eerste spreadsheet)" -"(Products will be added/updated to this store if 'store' column is blank or missing in the import file.)","(Producten worden toegevoegd/geüpdatet aan deze winkel, indien de 'winkel' kolom leeg of niet aanwezig is in het import bestand.)" -"(Shift-)Click or drag to change value","(Shift-)Klik of sleep om de waarde te veranderen" -"(Starting with)","(Beginnende met)" -"(When 'No', only mapped fields will be imported. When mapping, use 'column1', 'column2', etc.)","(Bij 'Nee', worden alleen in kaart gebrachte velden geïmporteerd. Wanneer in kaart gebracht, gebruik kolom1, kolom2, enz.)" -"(You have to increase php memory_limit before changing this value)","(U moet uw PHP memory_limit verhogen voordat u deze waarde verhoogt)" -"(\\t for tab)","(\\t voor tabblad)" -"* - If indexing is in progress, it will be killed and new indexing process will start.","* - Indien een indexeringproces bezig is zal deze worden gestopt en een nieuw proces worden begonnen." -"- Click on any of the time parts to increase it","- Klik op een van de tijd gedeeltes om deze te verhogen" -"- Hold mouse button on any of the above buttons for faster selection.","- Houd de muisknop op een van de bovenstaande knoppen om sneller te selecteren" -"- Use the %s buttons to select month","- Gebruik de %s knoppen om de maand te selecteren" -"- Use the %s, %s buttons to select year","- Gebruik de %s, %s knoppen om het jaar te selecteren" -"- or Shift-click to decrease it","- of Shift-klik om het te verlagen" -"- or click and drag for faster selection.","- of klik en sleep voor snelle selectie." -"-- Not Selected --","-- Niet geselecteerd --" -"-- Please Select --","-- Selecteer alstublieft --" -"-- Please Select Billing Agreement--","-- Selecteer Factureringsovereenkomst" -"-- Please Select a Category --","-- Selecteer een Categorie --" -"-- Please select --","-- Selecteer a.u.b. --" -"--Please Select--","--Selecteer alstublieft--" -"1 Hour","1 Uur" -"1. set up","1. instellen" -"12 Hours","12 Uur" -"12h AM/PM","12h AM/PM" -"2 Hours","2 Uur" -"2. customize","2. aanpassen" -"24 Hours","24 Uur" -"24h","24u" -"2YTD","2JTD" -"6 Hours","6 Uur" -"<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>","<h1 class=""page-heading"">404 Error</h1><p>Pagina niet gevonden.</p>" -"<strong>Attention</strong>: Captcha is case sensitive.","<strong>Attention</strong>: Captcha is hoofdletter gevoelig" -"A user with the same user name or email aleady exists.","Er bestaat al een gebruiker met dezelfde naam of hetzelfde e-mailadres." -"API Key","API Sleutel" -"API Key Confirmation","API Sleutel Bevestiging" -"ASCII","ASCII" -"Abandoned Carts","Verlaten winkelwagens" -"About the calendar","Over de kalender" -"Access Denied","Toegang Geweigerd" -"Access denied","Toegang gewijgerd" -"Access denied.","Toegang geweigerd." -"Account Created in:","Account Gecreëerd in:" -"Account Created on (%s):","Account Gecreëerd op (%s):" -"Account Created on:","Account Gecreëerd op:" -"Account Information","Accountinformatie" -"Account Status","Account Status" -"Account status","Account status" -"Action","Actie" -"Actions","Acties" -"Actions XML","Acties XML" -"Active","Actief" -"Add","Toevoegen" -"Add \Exception","Voeg uitzondering toe" -"Add Field Mapping","Veldmapping Toevoegen" -"Add Field with URL:","Veld met URL toevoegen:" -"Add New","Nieuwe Toevoegen" -"Add New Image","Nieuw Plaatje Toevoegen" -"Add New Profile","Nieuw Profiel Toevoegen" -"Add New Role","Nieuwe Rol Toevoegen" -"Add New Template","Nieuw Sjabloon Toevoegen" -"Add New URL Rewrite","Voeg Nieuwe URL Herschrijving Toe" -"Add New User","Voeg Nieuwe Gebruiker Toe" -"Add New Variable","Voeg Nieuwe Variabele Toe" -"Add Products","Producten toevoegen" -"Add URL Rewrite","Voeg URL Herschrijving Toe" -"Add URL Rewrite for a Category","Voeg URL Herschrijving toe voor een Categorie" -"Add URL Rewrite for a Product","Voeg URL Herschrijving toe voor een Product" -"Add after","Voeg toe na" -"Additional Cache Management","Extra Cache Beheer" -"Address Type:","Adrestype:" -"Admin","Admin" -"Advanced Admin Section","Geavanceerde Admin Sectie" -"Advanced Profiles","Geavanceerde Profielen" -"Advanced Section","Geavanceerde Sectie" -"All","Alles" -"All Allowed Countries","Alle Toegestane Landen" -"All Cache","Alle Cache" -"All Files","Alle Bestanden" -"All Reviews","Alle Recensies" -"All Store Views","Alle Winkelbezichtigingen" -"All Websites","Alle Websites" -"All countries","Alle landen" -"All fields","Alle velden" -"All possible rates were fetched, please click on ""Save"" to apply","Alle mogelijke cijfers zijn opgehaald, klik op ""Save"" om toe te passen" -"All rates were fetched, please click on ""Save"" to apply","Alle cijfers zijn opgehaald, klik op ""Save"" om toe te passen" -"All valid rates have been saved.","Alle geldige aantallen zijn opgeslagen." -"Always (during development)","Altijd (tijdens ontwikkeling)" -"Amounts","Hoeveelheden" -"An error has occurred while syncronizing media storages.","Een fout heeft zich voorgedaan tijdens het synchroniseren van het mediageheugen." -"An error occurred while clearing the JavaScript/CSS cache.","Er is een fout opgetreden tijdens het opschonen van de JavaScript/CSS opslagplaats." -"An error occurred while clearing the image cache.","Er is een fout opgetreden tijdens het opschonen van de afbeeldingopslagplaats." -"An error occurred while deleting URL Rewrite.","er is een fout opgetreden tijdens het verwijderen van URL Rewrite." -"An error occurred while deleting email template data. Please review log and try again.","Er is een fout opgetreden tijdens het verwijderen van e-mail sjabloondata. Bekijk de log en probeer opnieuw." -"An error occurred while deleting record(s).","Er is een fout opgetreden tijdens het verwijderen van data." -"An error occurred while deleting this role.","Er is een fout opgetreden tijdens het verwijderen van deze role." -"An error occurred while deleting this set.","Er is een fout opgetreden tijdens het verwijderen van deze set." -"An error occurred while deleting this template.","Er is een fout opgetreden tijdens het verwijderen van dit sjabloon." -"An error occurred while finishing process. Please refresh the cache","Er is een fout opgetreden tijdens het afsluiten. Ververs de opslagplaats." -"An error occurred while rebuilding the CatalogInventory Stock Status.","Er is een fout opgetreden tijdens het herbouwen van de CatalogInventory Stock Status." -"An error occurred while rebuilding the catalog index.","Er is een fout opgetreden tijdens het herbouwen van de catalogus index." -"An error occurred while rebuilding the flat catalog category.","Er is een fout opgetreden tijdens het herbouwen van de flat catalogus categorie." -"An error occurred while rebuilding the flat product catalog.","Er is een fout opgetreden tijdens het herbouwen van de flat product catalogus" -"An error occurred while rebuilding the search index.","Er is een fout opgetreden tijdens het herbouwen van de zoekindex." -"An error occurred while refreshing the Catalog Rewrites.","Er is een fout opgetreden tijdens het verversen van de Catalog Rewrites." -"An error occurred while refreshing the Layered Navigation indices.","Er is een fout opgetreden tijdens het verversen van de Layered Navigation indices." -"An error occurred while refreshing the catalog rewrites.","Een fout heeft zich voorgedaan tijdens het verversen van de catalogus." -"An error occurred while refreshing the layered navigation indices.","Een fout heeft zich voorgedaan tijdens het verversen van de gelaagde navigatie indexen." -"An error occurred while saving URL Rewrite.","Er is een fout opgetreden tijdens het opslaan van URL Rewrite" -"An error occurred while saving account.","Fout voorgekomen bij opslaan van account." -"An error occurred while saving review.","Er is een fout opgetreden tijdens het opslaan van de beoordeling." -"An error occurred while saving the customer.","Fout voorgekomen bij opslaan klant." -"An error occurred while saving this configuration:","Fout voorgekomen bij opslaan van deze configuratie:" -"An error occurred while saving this role.","Fout voorgekomen bij opslaan van deze rol." -"An error occurred while saving this template.","Fout voorgekomen bij opslaan van dit sjabloon." -"An error occurred while updating the selected review(s).","Fout voorgekomen bij het updaten van de geselecteerde beoordeling(en)." -"Any","Iedere" -"Any Attribute Set","Iedere attribuut set" -"Any Group","Iedere groep" -"Any Status","Iedere status" -"Any Store","Iedere winkel" -"Any Type","Ieder type" -"Any Visibility","Iedere zichtbaarheid" -"Any data created since the backup was made will be lost including admin users, customers and orders.","Alle data dat gecreëerd is sinds de backup is gemaakt zal verloren gaan inclusief admin gebruikers, klanten en orders." -"Archive file name:","Archiveer bestandsnaam:" -"Are you sure that you want to delete this template?","Weet je zeker dat je dit sjabloon wilt verwijderen?" -"Are you sure that you want to strip tags?","Weet je zeker dat je de tags wilt verwijderen?" -"Are you sure you want to do this?","Weet je zeker dat je dit wilt doen?" -"Are you sure you want to proceed?","Weet u zeker dat u door wilt gaan?" -"Area","Gebied" -"As low as:","Zo laag als:" -"Assigned","Toegewezen" -"Attribute Set Name:","Attribuut set naam:" -"Attributes","Attributen" -"Automatic","Automatisch" -"Average","Gemiddeld Orderbedrag" -"Average Orders","Gemiddelde Orders" -"BINARY","BINAIR" -"Back","Terug" -"Back to Login","Terug naar Inloggen" -"Backup","Backup" -"Backup Name","Backup Naam" -"Backup options","Backup opties" -"Backups","Backups" -"Base currency","Basisvaluta" -"Bcc","Bcc" -"Bestsellers","Bestsellers" -"Billing Address","Facturatieadres" -"Billing Address: ","Factuuradres:" -"Billing Agreement","Facturatieovereenkomst:" -"Billing Agreements","Facturatieovereenkomsten:" -"Block Information","Blok Informatie" -"Both (without and with tax)","Beiden (zonder en met btw)" -"Both IPN and PDT","Zowel IPN als PDT" -"Browse Files...","Blader door Bestanden..." -"Bundle with dynamic pricing cannot include custom defined options. Options will not be saved.","Bundel met dynamische prijzen kan geen op maat gedefinieerde opties bevatten. Opties zullen niet opgeslagen worden." -"CMS","CMS" -"CRITICAL","KRITIEK" -"CSV","CSV" -"CSV / Tab separated","CSV / Tabel gescheiden" -"Cache Control","Cache-controle" -"Cache Control (beta)","Cache-controle (beta)" -"Cache Management","Beheer cache" -"Cache Type","Cache-type" -"Cancel","Annuleren" -"Cannot add new comment.","Kan geen nieuw commentaar toevoegen." -"Cannot add tracking number.","Kan geen volgnummer toevoegen." -"Cannot create an invoice without products.","Kan geen factuur aanmaken zonder producten." -"Cannot create credit memo for the order.","Kan geen kredietnota voor de order aanmaken." -"Cannot delete the design change.","Kan de ontwerpverandering niet verwijderen." -"Cannot delete tracking number.","Kan volgnummer niet verwijderen." -"Cannot do shipment for the order separately from invoice.","Kan de verzending voor de bestelling niet los van de factuur doen." -"Cannot do shipment for the order.","Kan geen verzending van de bestelling doen." -"Cannot initialize shipment for adding tracking number.","Kan de verzending niet beginnen voor het toevoegen van volgnummer." -"Cannot initialize shipment for delete tracking number.","Kan de verzending niet beginnen voor het verwijderen van volgnummer." -"Cannot load track with retrieving identifier.","Kan het volgen niet laden met het ophalen van id." -"Cannot retrieve tracking number detail.","Kan detail van het volgnummer niet ophalen." -"Cannot save shipment.","Kan verzending niet opslaan." -"Cannot save the credit memo.","Kan kredietnota niet opslaan." -"Cannot send shipment information.","Kan verzendingsinformatie niet verzenden." -"Cannot update item quantity.","Kan product hoeveelheid niet updaten." -"Cannot update the item\'s quantity.","Kan de product hoeveelheid niet updaten." -"Catalog","Catalogus" -"Catalog Price Rules","Catalogus prijs regels" -"Catalog Rewrites","Catalogus herschrijvingen" -"Categories","Categoriën" -"Category:","Categorie:" -"Chart is disabled. If you want to enable chart, click <a href=""%s"">here</a>.","Grafiek is uitgeschakeld. Indien u de grafiek wilt inschakelen, klik <a href=""%s"">here</a>." -"Checkbox","Selectie vakje" -"Child Transactions","Kinder transacties" -"Choose Store View:","Selecteer winkel aanzicht:" -"Choose an attribute","Kies een attribuut" -"Chosen category does not associated with any website, so url rewrite is not possible.","Gekozen categorie komt met geen enkele website overeen, de url herschrijving is daarom niet mogelijk." -"Chosen product does not associated with any website, so url rewrite is not possible.","Gekozen product komt met geen enkele website overeen, de url herschrijving is daarom niet mogelijk," -"Clear","Haal weg" -"Close","Sluiten" -"Comment text field cannot be empty.","Comment tekstbox kan niet leeg zijn." -"Complete","Compleet" -"Configuration","Configuratie" -"Confirm New Password","Bevestig nieuw wachtwoord" -"Confirmed email:","Bevestigd e-mail:" -"Connect with the Magento Community","Verbind met de Magento Gemeenschap" -"Continue","Doorgaan" -"Continuous","Continu" -"Convert to Plain Text","Verander naar Gewone Tekst" -"Cookie (unsafe)","Cookie (onveilig)" -"Country","Land" -"Country:","Land:" -"Coupons","Waardebonnen" -"Create","Maak aan" -"Create DB Backup","Maak DB Back-up" -"Create New Attribute","Maak Nieuw Attribuut" -"Create URL Rewrite:","Maak URL Herschrijving:" -"Created At","Gecreëerd op" -"Credit Card %s","Credit Card %s" -"Credit Memo History","Creditnota Geschiedenis" -"Credit Memo Totals","Creditnota Totaal" -"Credit Memos","Creditnotas" -"Credit memo #%s comment added","Creditnota #%s commentaar toegevoegd" -"Credit memo #%s created","Creditnota #%s aangemaakt" -"Credit memo\'s total must be positive.","Totaal van creditmemo's moet positief zijn." -"Currency","Munteenheid" -"Currency ""%s"" is used as %s in %s.","Valuta ""%s"" wordt gebruikt als %s in %s." -"Currency Information","Valutainformatie" -"Currency Setup Section","Sectie voor instellen valuta" -"Current Configuration Scope:","Bereik van huidige configuratie:" -"Current Month","Huidige maand" -"Custom","Zelfgekozen" -"Custom Variable ""%s""","Gepersonaliseerde Variabele ""%s""" -"Custom Variables","Zelfgekozen variabelen" -"Customer","Klant" -"Customer Group:","Klantgroep:" -"Customer Groups","Klantgroepen" -"Customer","Naam klant" -"Customer Reviews","Klantbeoordelingen" -"Customer Shopping Carts","Klantwinkelmandjes" -"Customer Since:","Klant sinds:" -"Customer Tax Classes","Belastingtarieven klant" -"Customer with the same email already exists.","Klant met dit emailadres bestaat reeds." -"Customers","Klanten" -"Customers by Orders","Klanten op volgorde van aantal bestellingen" -"Customers by Orders Total","Klanten op volgorde van totaal bestellingen" -"DHTML Date/Time Selector","DHTML Datum/tijd selectie" -"Dashboard","Dashboard" -"Data Format","Dataformat" -"Data transfer:","Dataoverdracht:" -"Database","Database" -"Date","Datum" -"Date & Time","Datum & tijd" -"Added","Datum Toegevoegd" -"Updated","Bijgewerkt op datum" -"Date selection:","Datumselectie:" -"Date selector","Datumselector:" -"Day","Dag" -"Decimal separator:","Scheidingsteken decimalen:" -"Default (Admin) Values","Standaard (admin) waardes" -"Default Billing Address","Standaard betalingsadres" -"Default Config","Standaardconfiguratie" -"Default Template from Locale","Standaardsjabloon van locale" -"Default Values","Standaardwaardes" -"Default display currency ""%s"" is not available in allowed currencies.","Standaard weergegeven valuta ""%s"" is niet beschikbaar in toegestane valuta." -"Default scope","Standaardbereik" -"Delete","Verwijderen" -"Delete %s","Verwijder %s" -"Delete %s '%s'","Verwijder %s '%s'" -"Delete File","Verwijder bestand" -"Delete Image","Verwijder beeld" -"Delete Profile","Profiel verwijderen" -"Delete Role","Verwijder Rol" -"Delete Store","Verwijder Winkel" -"Delete Store View","Verwijder Winkel Aanzicht" -"Delete Template","Verwijder Template" -"Delete User","Verwijder Gebruiker" -"Delete Website","Verwijder Website" -"Description","Beschrijving" -"Design","Ontwerp" -"Design Section","Ontwerp Sectie" -"Details","Details" -"Developer Section","Ontwikkelaar Sectie" -"Direction:","Richting:" -"Disable","Maak onbruikbaar" -"Disabled","Uitgeschakeld" -"Display %s first","Geef %s eerst weer" -"Display default currency","Geef standaard muntsoort weer" -"Distributed under GNU LGPL. See %s for details.","Gedistrubueerd onder GNU LGPL. Zie %s voor details." -"Do you really want to KILL parallel process and start new indexing process?","Weet u zeker dat u het parallele proces wilt AFSLUITEN en een nieuw indexeringsproces wilt starten?" -"Do you really want to proceed?","Wilt u echt doorgaan?" -"Download","Download" -"Downloads","Downloads" -"Drag to move","Sleep om te verplaatsen" -"Drop-down","Drop-down" -"Edit","Bewerken" -"Edit Design Change","Bewerk Ontwerp Verandering" -"Edit Email Template","Bewerk E-mail Sjabloon" -"Edit Order","Bestelling bewerken" -"Edit Queue","Bewerk Rij" -"Edit Review","Bewerk Recensie" -"Edit Role","Bewerk Rol" -"Edit Store View","Bewerk Voorraad View" -"Edit System Template","Bewerk Systeem Sjabloon" -"Edit Template","Bewerk Sjabloon" -"Edit URL Rewrite","Bewerk URL Rewrite" -"Edit User","Bewerk Gebruiker" -"Edit User '%s'","Bewerk Gebruiker ""%s'" -"Edit Website","Bewerk Website" -"Email","Email" -"Email Address:","E-mailadres:" -"Email Preview","E-mail Preview" -"Email to a Friend","E-mail Vriend" -"Email:","E-mail" -"Enable","Maak bruikbaar" -"Enabled","Aan" -"Enclose Values In:","Sluit Waarden In:" -"Entity Attributes","Eenheidattributen" -"Entity Type","Eenheid Type" -"Entity type:","Type eenheid" -"Error","Fout" -"Excel XML","Excel XML" -"Excl. Tax","Excl. BTW" -"Exclude media folder from backup","Sluit de media map uit van de backup" -"Export","Export" -"Export CSV","Exporteer CSV" -"Export Filters","Exporteer Filters" -"Export to:","Exporteer naar:" -"Export:","Exporteer:" -"FTP Host","FTP Host" -"FTP Host[:Port]","FTP Host[:Port]" -"FTP Login","FTP Login" -"FTP Password","FTP wachtwoord" -"FTP credentials","FTP referenties" -"Failed to add a product to cart by id ""%s"".","Product toevoegen aan winkelwagen door I.D. is mislukt ""%s""." -"Failed to cancel the billing agreement.","Kon de facturatie-overeenkomst niet annuleren." -"Failed to clear the JavaScript/CSS cache.","Kon het JavaScript/CSS niet uit de cache verwijderen." -"Failed to delete the billing agreement.","Kon de facturatieovereenkomst niet verwijderen." -"Failed to update the profile.","Was niet in staat het profiel te updaten." -"Field","Veld" -"Field Mapping","Veld Mapping" -"File","Bestand" -"File Information","Bestand informatie" -"File System","Bestanden Systeem" -"File mode","Bestandsmodus" -"File name:","Bestandsnaam:" -"File size should be more than 0 bytes","Bestandsgrootte moet groter zijn dan 0 bytes" -"Finished profile execution.","Klaar met het uitvoeren van het profiel." -"First Invoice Created Date","Datum Eerste Factuur" -"First Name","Voornaam" -"First Name is required field.","Voornaam is een vereist veld." -"First Name:","Voornaam" -"Fixed","Gemaakt" -"Flush Catalog Images Cache","Flush Catalogus Afbeeldingenopslagplaats" -"Flush JavaScript/CSS Cache","Flush JavaScript/CSS Opslagplaats" -"For category","Voor categorie" -"For latest version visit: %s","Zie voor de laatste versie: %s" -"For product","Voor product" -"Forgot Admin Password","Beheerderswachtwoord vergeten" -"Forgot your password?","Uw wachtwoord vergeten?" -"Forgot your user name or password?","Gebruikersnaam of wachtwoord vergeten?" -"From","Van" -"GLOBAL","GLOBAAL" -"Gb","Gb" -"General Information","Algemene informatie" -"General Section","Algemene Sectie" -"Get Image Base64","Krijg Afbeelding Base64" -"Get help for this page","Hulp krijgen voor deze pagina" -"Global Attribute","Globaal Attribuut" -"Global Record Search","Globaal records zoeken" -"Global Search","Globale zoektocht" -"Go Today","Ga Vandaag" -"Go to messages inbox","Ga naar inbox" -"Go to notifications","Ga naar meldingen" -"Google Base","Google Base" -"Google Sitemaps","Google Sitemaps" -"Grand Total","Totaal" -"Grid (default) / List","Grid (vaststaand) / Lijst" -"Grid Only","Alleen Rooster" -"Group:","Groep:" -"Guest","Gast" -"HTTP (unsecure)","HTTP (onbeveiligd)" -"HTTPS (SSL)","HTTPS (SSL)" -"Help Us Keep Magento Healthy - Report All Bugs","Help ons Magento gezond te houden - rapporteer alle bugs" -"Helper attributes should not be used in custom layout updates.","Help attributen moeten niet gebruikt worden in gebruikelijke layout updates." -"Helper for options rendering doesn't implement required interface.","Help voor optie verduidelijking implementeert gevraagde interface niet." -"Home","Thuis" -"ID","ID" -"ID Path","ID Pad" -"IP Address","IP Adres" -"IPN (Instant Payment Notification) Only","Alleen IPN (Onmiddellijke Betaling Notificatie)" -"If there is an account associated with %s you will receive an email with a link to reset your password.","Als er een rekening geassocieerd is met %s ontvangt u een email met een link om uw wachtwoord te herstellen." -"If this message persists, please contact the store owner.","Neem contact op met de winkeleigenaar indien dit bericht aanhoudt." -"Images (.gif, .jpg, .png)","Afbeeldingen (.gif, .jpg, .png)" -"Images Cache","Afbeeldingen Voorraad" -"Import","Import" -"Import Service","Importeer dienst" -"Import and Export","Importeren en exporteren" -"Import and Export Tax Rates","Import en Export Belastingtarieven" -"Import/Export","Import/Export" -"Import/Export Advanced","Import/Export Geavanceerd" -"Import/Export Profile","Import/Export Profiel" -"Important: ","Belangrijk:" -"Imported <strong>%s</strong> records","Geïmporteerde <strong>%s</strong> gegevens" -"In","In" -"In Database:","In databse:" -"In File:","In bestand:" -"Inactive","Inactief" -"Incl. Tax","Incl. BTW" -"Incoming Message","Inkomend Bericht" -"Insert Variable...","Voeg Variabel in..." -"Interactive","Interactief" -"Interface Locale: %s","Interface locatie-instelling: %s" -"Invalid Form Key. Please refresh the page.","Ongeldig Formaat Sleutel. Gelieve de pagina te herladen." -"Invalid Import Service Specified","Ongeldige Import Service Geselecteerd" -"Invalid POST data (please check post_max_size and upload_max_filesize settings in your php.ini file).","Ongeldige POST data (kijk post_max_size en upload_max_filesize instellingen na in uw php.ini file)." -"Invalid Secret Key. Please refresh the page.","Ongeldige Geheime Sleutel. Ververs de pagina." -"Invalid User Name or Password.","Ongeldige Gebruikersnaam of Wachtwoord." -"Invalid directory: %s","Ongeldige directory: %s" -"Invalid email address ""%s"".","Ongeldig e-mailadres ""%s""." -"Invalid email address.","Ongeldig e-mailadres." -"Invalid file: %s","Ongeldig bestand: %s" -"Invalid input data for %s => %s rate","Ongeldige invoerdata voor %s => %s tarief" -"Invalid parent block for this block","Ongeldig hoofdblok voor dit blok" -"Invalid parent block for this block.","Ongeldig bron blok voor dit blok." -"Invalid password reset token.","Ongeldige wachtwoord herstel token" -"Invalid sender name ""%s"". Please use only visible characters and spaces.","Ongeldige naam van verzender ""%s"". Gebruik a.u.b. alleen zichtbare karakters en spaties." -"Invalid timezone","Ongeldige tijdzone" -"Invalidated","Ongeldig gemaakt" -"Inventory Stock Status","Inventarislijst status" -"Invoice #%s comment added","Factuur #%s commentaar toegevoegd" -"Invoice #%s created","Factuur #%s aangemaakt" -"Invoice History","Factuurhistorie" -"Invoice Totals","Totaal facturen" -"Invoice canceling error.","Factuur annuleringsfout." -"Invoice capturing error.","Factuur ophaal fout." -"Invoice voiding error.","Factuur vernietiging fout." -"Invoices","Facturen" -"Is Closed","Is gesloten" -"Issue Number","Uitgave Nummer" -"Items","Artikelen" -"JavaScript seems to be disabled in your browser.","JavaScript lijkt uitgeschakeld te zijn in uw browser." -"JavaScript/CSS","Javascript/CSS" -"JavaScript/CSS Cache","Javascript/CSS Cache" -"Kb","Kb" -"Last 24 Hours","Afgelopen 24 uur" -"Last 5 Orders","Laatste 5 bestellingen" -"Last 5 Search Terms","Laatste 5 zoektermen" -"Last 7 Days","Laatste 7 Dagen" -"Last Credit Memo Created Date","Laatste Kredietnota Aanmaak Datum" -"Last Invoice Created Date","Laatste factuur creatie datum" -"Last Logged In (%s):","Laatst ingelogd in (%s):" -"Last Logged In:","Laatste login:" -"Last Name","Achternaam" -"Last Name is required field.","Achternaam is een verplicht veld." -"Last Name:","Achternaam:" -"Last updated: %s. To refresh last day\'s <a href=""%s"">statistics</a>, click <a href=""%s"">here</a>.","Laatste update: %s. Om de <a href=""%s"">statistieken</a> van de voorgaande dag te verversen, klik <a href=""%s"">hier</a>." -"Latest Message:","Laatste boodschap:" -"Layered Navigation Indices","Gelaagde Navigatie Indices" -"Layered Navigation Indices were refreshed.","Gelaagde Navigatie Indices zijn ververst." -"Leave empty to use tax identifier","Laat dit veld leeg om het belastingidentificatienummer te gebruiken" -"Lifetime Sales","Lifetime Verkopen" -"Lifetime statistics have been updated.","Lifetime statistieken zijn geupdate." -"Links","Links" -"Links with associated products will retain only after saving current product.","Links met gerelateerde producten worden slechts behouden na het opslaan van huidige product." -"List (default) / Grid","Lijst (standaard) / Rooster" -"List Only","Alleen Lijst" -"Load Template","Laad Sjabloon" -"Load default template","Laad standaard sjabloon" -"Loading...","Aan het laden..." -"Local Server","Lokale Server" -"Local/Remote Server","Lokale/Op afstand Server" -"Locale","Lokaal" -"Log Out","Uitloggen" -"Log in to Admin Panel","Log in op het Administratie Bedieningspaneel" -"Log into Magento Admin Page","Inloggen bij Magento administratiepagina" -"Logged in as %s","Ingelogd als %s" -"Login","Log in" -"Low Stock","Lage Voorraad" -"MAJOR","MAJOR" -"MINOR","MINOR" -"MS Excel XML","MS Excel XML" -"Magento Admin","Magento Administrator" -"Magento Commerce - Administrative Panel","Magento Commerce - Administratiepaneel" -"Magento Connect","Magento Connect" -"Magento Connect Manager","Magento Connect Manager" -"Magento Logo","Magento Logo" -"Magento is a trademark of X.commerce, Inc. Copyright © %s X.commerce, Inc.","Magento is een handelsmerk van X.commerce, Inc. Copyright © %s X.commerce, Inc." -"Magento root directory","Magento root directory" -"Magento ver. %s","Magento ver. %s" -"Magento® is a trademark of X.commerce, Inc.<br/>Copyright © %s X.commerce, Inc.","Magento® is een handelsmerk van X.commerce, Inc.<br/>Copyright © %s X.commerce, Inc." -"Make sure that data encoding in the file is consistent and saved in one of supported encodings (UTF-8 or ANSI).","Zorg ervoor dat de data die is gecodeerd in het bestand consistent is en opgeslagen in één van de ondersteunde coderingen. (UTF-8 of ANSI)." -"Manage Attribute Sets","Beheer Attribuut Sets" -"Manage Attributes","Attributen beheren" -"Manage Categories","Beheer Categorieën" -"Manage Content","Content beheren" -"Manage Currency Rates","Beheer Wisselkoersen" -"Manage Customers","Beheer Klanten" -"Manage Ratings","Beheer Ratings" -"Manage Stores","Beheer Winkels" -"Manage Tax Rules","Manage Belasting Regels" -"Manage Tax Zones and Rates","Belastingzones en -tarieven beheren" -"Manual","Handmatig" -"Matched Expression","Bijpassende Expressie" -"Mb","Mb" -"Media (.avi, .flv, .swf)","Media (.avi, .flv, .swf)" -"Media storages synchronization has completed!","Mediageheugen synchronisatie voltooid!" -"Messages Inbox","Berichten Postvak In" -"Month","Maand" -"Most Viewed","Meest bekeken" -"Most Viewed Products","Meest bekeken producten" -"Multiple Select","Multiple Selecteer" -"My Account","Mijn account" -"N/A","Nvt" -"NOTICE","OPMERKING" -"Name","Naam" -"Name:","Naam:" -"Never (production)","Nooit (productie)" -"New ","Nieuw" -"New API Key","Nieuwe API-sleutel" -"New Accounts","Nieuwe Accounts" -"New Attribute","Nieuw Attribuut" -"New Block","Nieuw blok" -"New Category","Nieuwe Categorie" -"New Class","Nieuwe Klasse" -"New Condition","Nieuwe Conditie" -"New Custom Variable","Nieuw Aangepast Variabel" -"New Customer","Nieuwe Klant" -"New Customers","Nieuwe Klanten" -"New Design Change","Nieuwe Ontwerpverandering" -"New Email Template","Nieuw E-mail Sjabloon" -"New Group","Nieuwe Groep" -"New Invoice","Nieuwe Factuur" -"New Item Type","Nieuw Item Type" -"New Memo","Nieuwe Nota" -"New Memo for #%s","Nieuwe Nota voor #%s" -"New Page","Nieuwe Pagina" -"New Password","Nieuw Wachtwoord" -"New Profile","Nieuw Profiel" -"New Rate","Nieuw Tarief" -"New Rating","Nieuwe beoordeling" -"New Review","Nieuwe Review" -"New Role","Nieuwe Rol" -"New Rule","Nieuwe Regel" -"New Search","Nieuwe Zoekopdracht" -"New Set","Nieuwe Reeks" -"New Shipment","Nieuwe Verzending" -"New Sitemap","Nieuwe Sitemap" -"New Store View","Nieuwe Winkel Bezichtiging" -"New System Template","Nieuw Systeemtemplate" -"New Template","Nieuw Sjabloon" -"New User","Nieuwe Gebruiker" -"New Variable","Nieuw Variabele" -"New Website","Nieuwe Website" -"New password field cannot be empty.","Nieuw wachtwoord veld mag niet leeg zijn" -"Newsletter","Nieuwsbrief" -"Newsletter Problems","Nieuwsbrief Problemen" -"Newsletter Queue","Nieuwsbrief Wachtrij" -"Newsletter Subscribers","Nieuwsbrief abonnees" -"Newsletter Templates","Nieuwsbrief sjablonen" -"Next month (hold for menu)","Volgende maand (houd ingedrukt voor menu)" -"Next year (hold for menu)","Volgend jaar (houd ingedrukt voor menu)" -"No","Nee" -"No (price without tax)","Nee (prijs zonder BTW)" -"No Data","Geen Data" -"No Data Found","Geen gegevens gevonden" -"No Templates Found","Geen sjablonen gevonden" -"No change","Geen verandering" -"No customer id defined.","Geen klant identificatie." -"No information available.","Geen informatie beschikbaar." -"No profile loaded...","Geen profiel geladen..." -"No records found for this period.","Geen registraties gevonden voor deze periode." -"No records found.","Geen bestanden gevonden." -"No report code specified.","Geen meldingscode gespecificeerd." -"No search keywords.","Geen zoek sleutelwoorden." -"No search modules were registered","Er werden geen zoekmodules geregistreerd." -"No wishlist item id defined.","Geen verlanglijst identificatie." -"None","Geen" -"Note:","Aantekening:" -"Notes","Aantekeningen" -"Notifications","Notificaties" -"Orders","Aantal Orders" -"Uses","Aantal Gebruiken" -"Views","Aantal keer bekeken" -"Number of records:","Aantal archieven:" -"OK","OK" -"Old rate:","Oude tarief:" -"One or more media files failed to be synchronized during the media storages syncronization process. Refer to the log file for details.","Eén of meer mediabestanden zijn niet gesynchroniseerd tijdens het mediageheugen synchronisatieproces. Ga naar het logbestand voor details." -"One or more of the Cache Types are invalidated:","Een of meer van de cache types zijn niet meer geldig:" -"Online Customers","Online Klanten" -"Only Once (version upgrade)","Slechts eenmalig (versie bijwerken)" -"Only attributes with scope ""Global"", input type ""Dropdown"" and Use To Create Configurable Product ""Yes"" are available.","Alleen eigenschappen met ""Global"" scope, input type ""Dropdown"" en Use To Create Configurable Product ""Ja"" zijn beschikbaar." -"Only mapped fields","Alleen gemapte velden" -"Optional","Optioneel" -"Options","Opties" -"Order","Bestelling" -"Order %s","Bestelling #%s" -"Order %s (%s)","Bestelling #%s (%s)" -"Order Created Date","Bestelling aangemaakt op datum" -"Order ID","ID Bestelling" -"Order Totals","Totalen Bestelling" -"Order Updated Date","Bestelling bijgewerkt op datum" -"Order Updated Date report is real-time, does not need statistics refreshing.","Bestelling Aangepaste Datum rapport is real-time, deze hoeft niet statisch vernieuwd te worden." -"Orders","Bestellingen" -"Original Magento attribute names in first row:","Originele Magento attributennamen in de eerste rij:" -"Out of stock","Uit voorraad" -"PDT (Payment Data Transfer) Only","PDT (Betaling Informatie Overdracht) Alleen" -"Package Extensions","Pakket Uitbreidingen" -"Pages","Pagina's" -"Parent Product Thumbnail","Hoofdproduct Thumbnail" -"Parent Transaction ID","Ouder transactie ID" -"Passive mode","Passieve modus" -"Password","Wachtwoord" -"Password Confirmation","Wachtwoord Confirmatie" -"Password confirmation must be same as password.","Wachtwoord confirmatie moet het zelfde zijn als wachtwoord." -"Password must be at least of %d characters.","Wachtwoord moet ten minste %d tekens lang zijn." -"Password must include both numeric and alphabetic characters.","Wachtwoord moet zowel nummers als letters bevatten." -"Password:","Wachtwoord:" -"Path:","Pad:" -"PayPal Manager","PayPal manager" -"Payment method instance is not available.","Betalingsmethode niet beschikbaar" -"Payment method is not available.","Betalingsmethode is niet beschikbaar." -"Payment method must be specified.","Betalingsmethode moet gekozen worden." -"Pending Reviews","In afwachting van beoordelingen" -"Per Item","Per Stuk" -"Per Order","Per Bestelling" -"Percent","Procent" -"Performed At","Uitgevoerd Op" -"Interval","Periode" -"Permanent (301)","Permanent (301)" -"Permissions","Toestemmingen" -"Personal Information","Persoonlijke Informatie" -"Phone:","Telefoon:" -"Please Select","Selecteer A.U.B." -"Please confirm site switching. All data that hasn\'t been saved will be lost.","Bevestig a.u.b. site switching. Alle data die niet zijn opgeslagen, zullen verdwijnen." -"Please enter 6 or more characters.","Voer 6 of meer karakters in." -"Please enter a number greater than 0 in this field.","Voer a.u.b. een getal groter dan 0 in in dit veld." -"Please enter a valid $ amount. For example $100.00.","Voer a.u.b. een geldig € hoeveelheid in. Bijvoorbeeld €100,00." -"Please enter a valid URL. For example http://www.example.com or www.example.com","Voer a.u.b. een geldige YRL in. Bijvoorbeeld http://www.voorbeeld.com of www.voorbeeld.com" -"Please enter a valid URL. http:// is required","Voer a.u.b. een geldige URL in. http:// is vereist" -"Please enter a valid credit card number.","Voer geldig creditcard nummer in." -"Please enter a valid date.","Voer a.u.b. een geldige datum in." -"Please enter a valid email address. For example johndoe@domain.com.","Voer a.u.b. een geldig e-mailadres in. Bijvoorbeeld johndoe@domain.com." -"Please enter a valid email.","Voer a.u.b. een geldig e-mailadres in." -"Please enter a valid number in this field.","Voer in dit veld een geldig nummer in." -"Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.","Voer een geldig telefoonnummer in. Bijvoorbeeld (123) 456-7890 of 123-456-7890." -"Please enter a valid social security number. For example 123-45-6789.","Voer a.u.b. een geldig burgerservicenummer in. Bijvoorbeeld 123-45-6789." -"Please enter a valid value from list","Voer een geldige invoer van de lijst in" -"Please enter a valid value, ex: 10,20,30","Voer a.u.b. een geldige waarde in, v.b. 10, 20, 30" -"Please enter a valid zip code.","Voer een geldige postcode in." -"Please enter a valid zip code. For example 90602 or 90602-1234.","Voer a.u.b. een geldige postcode in. Bijvoorbeeld 1234 AB." -"Please enter another credit card number to complete your purchase.","Voer alstublieft een ander creditcardnummer in om uw aankoop te voltooien." -"Please enter password","Voer aub uw wachtwoord in" -"Please enter password to confirm rollback.","Voer aub uw wachtwoord in om de rollback te bevestigen." -"Please enter valid password.","Voer a.u.b. een geldig wachtwoord in." -"Please make sure that all global admin search modules are installed and activated.","Zorg dat alle global admin search modules geïnstalleerd en geactiveerd zijn." -"Please make sure that your changes were saved before running the profile.","Zorg dat al uw veranderingen opgeslagen zijn voordat u het profiel uitvoert." -"Please make sure your passwords match.","Let er alstublieft op dat de wachtwoorden overeenkomen." -"Please select State/Province.","Selecteer Staat/Provincie." -"Please select a customer.","Selecteer een klant." -"Please select a store.","Selecteer a.u.b. een winkel." -"Please select an option.","Selecteer alstublieft een optie." -"Please select catalog searches.","Selecteer alstublieft catalogus zoekopdrachten." -"Please select customer(s).","Selecteer a.u.b. (een) klant(en)" -"Please select message(s).","Selecteer alstublieft boodschap(pen)." -"Please select one of the above options.","Selecteer alstublieft een van de bovenstaande opties." -"Please select one of the options.","Selecteer a.u.b. één van de opties." -"Please select review(s).","Selecteer alstublieft recentie(s)." -"Please specify backup creation options","Specificeer aub de backup creatie opties" -"Please specify the admin custom URL.","Specificeer a.u.b. de admin standaard URL." -"Please try to logout and sign in again.","Probeer uit te loggen en log opnieuw in." -"Please type the letters from the image:","Voer aub de letters van de afbeelding in:" -"Please use in this field only ""a-z,0-9,_"".","Gebruikt in dit veld alleen ""a-z,0-9,_""." -"Please use letters only (a-z) in this field.","Gebruik alstublieft alleen letters (a-z) in dit veld." -"Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.","Gebruik alleen getallen in dit veld. Vermijd spaties of andere tekens zoals punten of komma's." -"Please use only letters (a-z or A-Z), numbers (0-9) or spaces in this field.","Gelieve alleen de letters (a-z of A-Z), nummers (0-9) en/of spaties in dit veld te gebruiken." -"Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.","Gebruik a.u.b. alleen letters (a-z) of nummers (0-9) in dit veld. Spaties en andere karakters zijn niet toegestaan." -"Please use only letters (a-z) or numbers (0-9) or spaces and # only in this field.","Gebruik alstublieft alleen letters (a-z) of nummers (0-9) of spaties en # in dit veld." -"Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.","Gebruik het volgende datumformaat: dd/mm/jjjj. Bijvoorbeeld 17/03/2006 voor 17 maart 2006." -"Please wait while the indexes are being refreshed.","Wacht alstublieft terwijl de indexen worden vernieuwd." -"Please wait, loading...","Wacht alstublieft, aan het laden..." -"Please wait...","Even geduld..." -"Popular","Populair" -"Position of Watermark for %s","Positie van Watermerk voor %s" -"Pregenerated product images files.","Gegenereerde product afbeeldingsbestanden." -"Prev. month (hold for menu)","Vorige maand (vasthouden voor menu)" -"Prev. year (hold for menu)","Vorig jaar (houd ingedrukt voor menu)" -"Preview","Preview" -"Preview Template","Voorbeeld sjabloon" -"Price","Prijs" -"Price alert subscription was saved.","Prijsnotificatie abonnement werd opgeslagen." -"Price:","Prijs:" -"Processed <strong>%s%% %s/%d</strong> records","Verwerkte <strong>%s%% %s/%d</strong> bestanden" -"Product","Product" -"Product","Productnaam" -"Product Reviews","Productbeoordelingen" -"Product Tax Classes","Product Belasting Klassen" -"Product Thumbnail Itself","Product Miniatuurweergave Zelf" -"Product is not loaded.","Product is niet geladen." -"Product:","Product:" -"Products","Producten" -"Products Bestsellers Report","Producten Bestsellers Rapport" -"Products Most Viewed Report","Verslag meest bekeken producten" -"Products Ordered","Bestelde Producten" -"Products in Carts","Producten in Wagens" -"Profile Action","Profiel Actie" -"Profile Actions XML","Profiel Acties XML" -"Profile Direction","Profiel Richting" -"Profile History","Profielgeschiedenis" -"Profile Information","Profielinformatie" -"Profile Name","Profielnaam" -"Profile Payments","Profiel Betalingen" -"Profile Schedule","Profiel Schema" -"Profile Wizard","Profiel Wizard" -"Profiles","Profielen" -"Promo","Promotie" -"Promotions","Promoties" -"Purchased Item","Aangeschaft Artikel" -"Put store on the maintenance mode while backup creation","Zet de store in onderhoudsmodus tijdens het maken van back-ups" -"Put store on the maintenance mode while rollback processing","Zet de winkel in de onderhoudsmodus tijdens het rollback proces" -"Quantity","Hoeveelheid" -"Queue Refresh","Verversing Rij" -"Queued... Cancel","In de Wachtrij... Annuleer" -"Radio Buttons","Radio Knoppen" -"Rates","Tarieven" -"Read details","Lees details" -"Rebuild","Herbouwen" -"Rebuild Catalog Index","Herbouw Catalogus Index" -"Rebuild Flat Catalog Category","Herbouw Flat Catalogus Categorie" -"Rebuild Flat Catalog Product","Herbouw Plat Catalogus Product" -"Recent Orders","Recente Bestellingen" -"Recent statistics have been updated.","Recente statistieken zijn geüpdatet." -"Recurring Profile View","Herhaalde Profiel View" -"Recursive Dir","Recursieve Dir" -"Redirect","Doorverwijzing" -"Reference","Referentie" -"Reference ID","Referentie ID" -"Refresh","Ververs" -"Refresh Now*","Vernieuw Nu*" -"Refresh Statistics","Statistieken verversen" -"Region/State","Regio/Staat" -"Regular Price:","Normale prijs:" -"Release","Uitgave" -"Release Stability","Geef Stabiliteit Vrij" -"Release Version","Uitgave Versie" -"Reload captcha","Herlaad captcha" -"Remote FTP","Afgelegen FTP" -"Remove","Verwijderen" -"Reports","Verslagen" -"Request Path","Vraag Pad op" -"Required","Benodigd" -"Reset","Opnieuw" -"Reset Filter","Stel Filter Opnieuw in" -"Reset Password","Herstel Wachtwoord" -"Reset a Password","Wachtwoord opnieuw instellen" -"Resize","Formaat Veranderen" -"Resource Access","Toegang tot hulpbron" -"Resources","Hulpbronnen" -"Results","Resultaten" -"Retrieve Password","Wachtwoord Opvragen" -"Return Html Version","Keer HTML Versie Terug" -"Revenue","Omzet" -"Reviews","Reviews" -"Reviews and Ratings","Beoordelingen en waarderingen" -"Rewrite Rules","Regels herschrijven" -"Role ID","Rol ID" -"Role Info","Rol Informatie" -"Role Information","Rolinformatie" -"Role Name","Rolnaam" -"Role Resources","Rol Bronnen" -"Role Users","Rol gebruikers" -"Roles","Rollen" -"Roles Resources","Rollen hulpbronnen" -"Rotate CCW","Draai CCW" -"Rotate CW","CW roteren" -"Run","Run" -"Run Profile","Profiel uitvoeren" -"Run Profile Inside This Window","Profiel runnen in dit scherm" -"Run Profile in Popup","Profiel runnen in popup scherm" -"Running... Kill","Werkende... Afbreken" -"SKU","SKU" -"SKU:","SKU:" -"SSL Error: Invalid or self-signed certificate","SSL Fout: Ongeldig of zelfondertekend certificaat" -"Sales","Verkoop" -"Sales Report","Verkooprapport" -"Samples","Monsters" -"Save","Opslaan" -"Save & Generate","Sla op & Genereer" -"Save Account","Bewaar Account" -"Save Cache Settings","Bewaar Opslag Instellingen" -"Save Config","Sla Configuratie op" -"Save Currency Rates","Bewaar Huidige Waarden" -"Save Profile","Profiel opslaan" -"Save Role","Sla Rol op" -"Save Template","Sjabloon Opslaan" -"Save User","Bewaar Gebruiker" -"Save and Continue Edit","Opslaan en doorgaan met bewerken" -"Search","Zoeken" -"Search Index","Zoekindex" -"Search Term","Zoek Woord" -"Search Terms","Zoek Voorwaarden" -"Select","Selecteren" -"Select All","Selecteer Alles" -"Select Category","Selecteer Categorie" -"Select Date","Selecteer Datum" -"Select Range","Gebied selecteren" -"Select date","Selecteer datum" -"Selected allowed currency ""%s"" is not available in installed currencies.","Geselecteerde toegestane munteenheid ""%s"" is niet beschikbaar in de geïnstalleerde munteenheden." -"Selected base currency is not available in installed currencies.","De gekozen basis valuta is niet beschikbaar in de geïnstalleerde valuta's." -"Selected default display currency is not available in allowed currencies.","Geselecteerde vaststaande display valuta is niet beschikbaar in toegestane valuta." -"Selected default display currency is not available in installed currencies.","De gekozen weer te geven valuta is niet beschikbaar in de geïnstalleerde valuta's." -"Self-assigned roles cannot be deleted.","Zelf-toegewezen rollen kunnen niet verwijderd worden." -"Sender","Verzender" -"Separate Email","Afgezonderde E-mail" -"Service Settings","Service-instellingen" -"Set up & Customize","Instellen en personaliseren" -"Shipment #%s comment added","Verzending #%s commentaar toegevoegd" -"Shipment #%s created","Verzending #%s gecreëerd" -"Shipment Comments","Verzending Commentaar" -"Shipment History","Verzending geschiedenis" -"Shipments","Verzendingen" -"Shipping","Verzending" -"Shipping Address","Verzendingsadres" -"Shipping Address: ","Verzendadres:" -"Shipping Origin","Verzending Herkomst" -"Shipping Price","Verzendkosten" -"Shipping address selection is not applicable","Verzendadres selectie is niet van toepassing" -"Shipping method must be specified.","Verzendingsmethode moet gekozen worden." -"Shipping method selection is not applicable","Verzendmethode selectie is niet van toepassing" -"Shopping Cart","Winkelmandje" -"Shopping Cart Price Rules","Winkelwagen Berekeningsregels" -"Shopping Cart from %s","Winkelwagen van %s" -"Show By","Tonen op" -"Show Report For:","Toon Verslag Van:" -"Show Reviews","Laat Beoordelingen Zien" -"Sitemap Information","Sitemap Informatie" -"Size for %s","Rangschikken naar %s" -"Skip Category Selection","Sla Categorie Selectie over" -"Some items in this order have different invoice and shipment types. You can create shipment only after the invoice is created.","Some zaken in deze bestelling hebben verschillende factuur- en bezorgtypes. U kunt alleen een bezorging maken na het maken van de rekening." -"Some of the ordered items do not exist in the catalog anymore and will be removed if you try to edit the order.","Sommige van de bestelde artikelen bestaan niet meer in de catalogus en zullen verwijderd worden als u de bestelling aanpast." -"Sorry, this feature is coming soon...","Sorry, deze optie komt binnenkort..." -"Special Price:","Speciale prijs:" -"Specific Countries","Specifieke Landen" -"Specified","Gespecificeerd" -"Specified profile does not exist.","Gespecificeerd profiel bestaat niet." -"Spreadsheet Name:","Naam spreadsheet:" -"Start Date","Begindatum" -"Starting profile execution, please wait...","Bezig met het beginnen van de uitvoering van het profiel, wacht u alstublieft..." -"State/Province:","Staat/Provincie:" -"Static Blocks","Statische blokken" -"Status","Status" -"Status:","Status:" -"Stock Quantity:","Hoeveelheid in voorraad:" -"Stock notification was saved.","Voorraad notificatie opgeslagen." -"Store","Winkel" -"Store Email Addresses Section","Sla E-mail Adres Sectie op" -"Store View","Aanblik winkel" -"Store:","Sla op:" -"Stores","Warenhuizen" -"Subject","Onderwerp" -"Submit","Bevestig" -"Subpackage cannot be conflicting.","Subpakket mag niet conflicteren." -"Subtotal","Subtotaal" -"Switch/Solo/Maestro Only","Alleen Switch/Solo/Maestro" -"Synchronization is required.","Synchronisatie is nodig." -"Synchronization of media storages has been successfully completed.","Synchronisatie van mediaopslag is succesvol voltooid." -"Synchronize","Synchroniseer" -"Synchronizing %s to %s","Aan het synchroniseren van %s tot s%" -"Synchronizing...","Aan het synchroniseren..." -"System","Systeem" -"System Section","Systeem Sectie" -"System busy","Systeem bezig" -"Target Path","Doelpad" -"Tax","Belasting" -"Tb","Tb" -"Template","Sjabloon" -"Template Content","Inhoud sjabloon" -"Template Information","Sjabloon informatie" -"Template","Naam sjabloon" -"Template Styles","Sjabloon Stijlen" -"Template Subject","Sjabloon Onderwerp" -"Template Type","Sjabloon Type" -"Temporary (302)","Tijdelijk (302)" -"Terms and Conditions","Voorwaarden" -"Text","Tekst" -"The Catalog Rewrites were refreshed.","De Catalogus Rewrites zijn ververst." -"The CatalogInventory Stock Status has been rebuilt.","De Catalogus Inventaris Voorraad Status is herbouwd." -"The Comment Text field cannot be empty.","U kunt het Opmerking Tekstveld niet leeglaten." -"The Flat Catalog Product was rebuilt","Het Flat Catalogus Product is verbouwd." -"The JavaScript/CSS cache has been cleaned.","De JavaScript/CSS opslagplaats is opgeschoond." -"The JavaScript/CSS cache has been cleared.","De JavaScript/CSS opslagplaats is opgeruimd." -"The Layered Navigation indexing has been queued.","De Layered Navigation indexering staat in de wachtrij." -"The Layered Navigation indexing queue has been canceled.","De Layered Navigation indexering wachtrij is geannuleerd." -"The Layered Navigation indices were refreshed.","De Layered Navigatie indexen zijn verversd." -"The Layered Navigation process has been queued to be killed.","Het Layered Navigation proces staat in de wachtrij." -"The Magento cache storage has been flushed.","De Magento cache opslag is gespoeld." -"The URL Rewrite has been deleted.","De URL Rewrite is verwijderd." -"The URL Rewrite has been saved.","De URL Rewrite is opgeslagen." -"The account has been saved.","De account is bewaard." -"The archive can be uncompressed with <a href=""%s"">%s</a> on Windows systems","Het archief kan worden uitgepakt met <a href=""%s"">%s</a> op Windows systemen" -"The attribute set has been removed.","De attribuutset is verwijderd." -"The backup's creation process will take time.","Het maken van een back-up zal tijd innemen." -"The billing agreement has been canceled.","De betalingsovereenkomst is geannuleerd." -"The billing agreement has been deleted.","De betaalovereenkomst is verwijderd." -"The cache storage has been flushed.","De cache opslag is gespoeld." -"The carrier needs to be specified.","De vervoerder moet gespecificeerd worden." -"The catalog index has been rebuilt.","De catalogusindex in herbouwd." -"The catalog rewrites have been refreshed.","De catalogus rewrites is verversd." -"The configuration has been saved.","De configuratie is opgeslagen." -"The credit memo has been canceled.","De kredietnota is geannuleerd." -"The credit memo has been created.","Het kredietgeheugen is gemaakt." -"The credit memo has been voided.","De kredietnota is vervallen." -"The custom variable has been deleted.","De standaard variabele is verwijderd." -"The custom variable has been saved.","De custom variabele is opgeslagen." -"The customer has been deleted.","De klant is verwijderd." -"The customer has been saved.","De klant is bewaard." -"The design change has been deleted.","De ontwerpverandering is verwijderd." -"The design change has been saved.","De ontwerpverandering is opgeslagen." -"The email address is empty.","Het email-adres is leeg." -"The email template has been deleted.","De email-template is verwijderd." -"The email template has been saved.","Het e-mailsjabloon is bewaard." -"The flat catalog category has been rebuilt.","De platte cataloguscategorie is herbouwd." -"The group node name must be specified with field node name.","De groepsnode naam moet gespecificeerd worden met een veldnode naam." -"The image cache was cleaned.","Het afbeeldingencache werd opgeschoond." -"The image cache was cleared.","De afbeeldingcache is geschoond." -"The invoice and shipment have been created.","De factuur en verzending zijn aangemaakt." -"The invoice and the shipment have been created. The shipping label cannot be created at the moment.","De factuur en de verzending is gemaakt. De verzendlavel kan nu niet worden gemaakt." -"The invoice has been canceled.","De factuur is geannuleerd." -"The invoice has been captured.","De factuur is berekend." -"The invoice has been created.","De rekening is gemaakt." -"The invoice has been voided.","De factuur is nietig verklaard." -"The invoice no longer exists.","De factuur bestaat niet meer." -"The item %s (SKU %s) does not exist in the catalog anymore.","Het product %s (SKU %s) bestaat niet meer in de catalogus." -"The order does not allow creating an invoice.","De bestelling staat het maken van een factuur niet toe." -"The order no longer exists.","De bestelling bestaat niet meer." -"The profile has been deleted.","Het profiel is verwijderd." -"The profile has been saved.","Het profiel is opgeslagen." -"The profile has been updated.","Het profiel is geüpdatet." -"The profile has no changes.","Het profiel bevat geen wijzigingen." -"The profile you are trying to save no longer exists","Het profiel dat u probeert op te slaan bestaat niet meer" -"The rating has been deleted.","De waardering is verwijderd." -"The rating has been saved.","De waardering is opgeslagen." -"The role has been deleted.","De rol is verwijderd." -"The role has been saved.","De rol is bewaard." -"The role has been successfully saved.","De rol is opgeslagen." -"The search index has been rebuilt.","De zoekindex is opnieuw samengesteld." -"The shipment has been created.","De verzending is aangemaakt." -"The shipment has been sent.","De bestelling is verzonden." -"The shipping label has been created.","Het verzendingslabel is aangemaakt." -"The transaction details have been updated.","De transactiegegevens zijn bijgewerkt." -"The user has been deleted.","De gebruiker is verwijderd." -"The user has been saved.","De gebruiker is opgeslagen." -"Themes JavaScript and CSS files combined to one file.","Thema's JavaScript en CSS bestanden gecombineerd tot een bestand." -"There is an error in one of the option rows.","Er is een fout in één van de optie rijen." -"This Account is","Dit account is" -"This Email template no longer exists.","Deze e-mailsjabloon bestaat niet langer." -"This Role no longer exists","Deze rol bestaat niet meer" -"This Role no longer exists.","Deze rol bestaat niet meer." -"This account is","Dit account is" -"This account is inactive.","Dit account is niet actief." -"This action cannot be undone.","Deze actie kan niet ongedaan worden gemaakt." -"This attribute set does not have attributes which we can use for configurable product","Deze attributenset heeft geen attributen die we voor een configureerbaar product kunnen gebruiken" -"This attribute shares the same value in all the stores","Dit attribuut deelt dezelfde waarde in alle winkels" -"This is a demo store. Any orders placed through this store will not be honored or fulfilled.","Dit is een demo winkel. Geplaatste bestellingen bij deze winkel worden niet gehonoreerd of uitgevoerd." -"This is a required field.","Dit is een verplicht veld." -"This product is currently disabled.","Dit product is momenteel niet aanwezig." -"This report depends on timezone configuration. Once timezone is changed, the lifetime statistics need to be refreshed.","Dit rapport hangt af van tijdzone configuratie. Zodra tijdzone is veranderd, moeten de lifetime statistieken verversd worden." -"This section is not allowed.","Deze sectie is niet toegestaan." -"This user no longer exists.","De gebruiker bestaat niet langer meer." -"Time","Tijd" -"Time selection:","Tijdselectie:" -"Time:","Tijd:" -"Timeout limit for response from synchronize process was reached.","Timeout limiet voor respons van synchroniseerproces is bereikt." -"To","Naar" -"To cancel pending authorizations and release amounts that have already been processed during this payment, click Cancel.","Om wachtende autorisaties te annuleren en bedragen vrij te geven die tijdens deze betaling zijn verwerkt, druk op Annuleer." -"To use PayPal Payflow Link you must configure some settings in your Payflow account by logging into","Om Payflow Link te kunnen gebruiken, dient u een Payflow Link account te configureren op de website van PayPal." -"To use PayPal Payments Advanced you must configure some settings in your PayPal Payments Advanced account by logging into","Om Paypal Payments Advanced te gebruiken moet u eerst een aantal instellingen in uw Paypal Payments Advanced rekening configureren door in te loggen op" -"Toggle Editor","Toggle Editor" -"Tools","Gereedschap" -"Top 5 Search Terms","Top 5 Zoektermen" -"Total","Totaal" -"Total Invoiced","Totaal gefactureerd" -"Total","Totale Bestellingshoeveelheid" -"Total Refunded","Totaal Terugbetaald" -"Total of %d record(s) have been deleted.","Er zijn in totaal %d dossier(s) verwijderd" -"Total of %d record(s) have been updated.","Er zijn in totaal %d dossier(s) bijgewerkt" -"Total of %d record(s) were canceled.","Totaal van %d record(s) zijn geannuleerd." -"Total of %d record(s) were deleted","Totaal van %d verslag(en) zijn gewist" -"Total of %d record(s) were deleted.","Totaal van %d verslag(en) zijn gewist." -"Total of %d record(s) were updated","Totaal van %d verslag(en) zijn bijgewerkt" -"Total of %d record(s) were updated.","Totaal van %d verslag(en) zijn bijgewerkt." -"Track Order","Volg Order" -"Track this shipment","Track deze verzending" -"Tracking number %s for %s assigned","Volgnummer %s voor %s toegewezen" -"Tracking number cannot be empty.","Volgnummer kan niet leeg zijn." -"Transaction Data","Transactie Data" -"Transaction Details","Transactie Details" -"Transaction ID","Transactie ID" -"Transaction Type","Transactie Type" -"Transactional Emails","Transactionele Emails" -"Transactions","Transacties" -"Type","Type" -"Type:","Type:" -"URL Rewrite","URL Herschrijving" -"URL Rewrite Information","URL Herschrijf Informatie" -"URL Rewrite Management","URL Herschrijf Management" -"Unable to cancel the credit memo.","Niet mogelijk om creditnota te annuleren." -"Unable to find a Email Template to delete.","Kan geen Email-Template vinden om te verwijderen." -"Unable to find a user to delete.","Kan geen gebruiker vinden om te verwijderen." -"Unable to initialize import model","Kan importmodel niet initialiseren" -"Unable to refresh lifetime statistics.","Kan levensduur statistieken niet vernieuwen." -"Unable to refresh recent statistics.","Kan recente statistieken niet vernieuwen." -"Unable to save Cron expression","Niet instaat om Cron expressie op te slaan" -"Unable to save the cron expression.","Kan de cron uitdrukking niet opslaan." -"Unable to save the invoice.","Niet instaat om factuur op te slaan." -"Unable to send the invoice email.","Kan geen factuur email sturen." -"Unable to send the shipment email.","Niet instaat om verzending e-mail te versturen." -"Unable to update transaction details.","Onmogelijk om transactie details te updaten." -"Unable to void the credit memo.","Niet instaat om creditnota te vernietigen." -"Unknown","Onbekend" -"Unlimited","Onbeperkt" -"Update","Update" -"Updated At","Geüpdate At" -"Upload File","Bestand uploaden" -"Upload Files","Upload Bestanden" -"Upload HTTP Error","Upload HTTP Fout" -"Upload I/O Error","Upload I/O Fout" -"Upload Security Error","Upload Beveiligingsfout" -"Upload import file","Upload belangrijk bestand" -"Uploaded file is larger than %.2f kilobytes allowed by server","Het geüploade bestand is groter dan de %.2f kilobytes die de server toestaat" -"Use All Available Attributes","Gebruik Alle Beschikbare Attributen" -"Use Config Settings","Gebruik Configuratiesettings" -"Use Default","Gebruik Standaard" -"Use Default Value","Standaardwaarde gebruiken" -"Use Default Variable Values","Gebruik Standaard Variabele Waarden" -"Use FTP Connection","Gebruik FTP Connectie" -"Use Website","Gebruik Website" -"Used Currently For","Momenteel Gebruikt Voor" -"Used as Default For","Standaard Gebruikt Voor" -"User Email","Email van Gebruiker" -"User ID","Gebruikers ID" -"User Info","Gebuikersinformatie" -"User Information","Gebruikersinformatie" -"User Name","Gebruikersnaam" -"User Name is required field.","Gebruikersnaam is verplicht veld." -"User Name:","Gebruikersnaam:" -"User Password","Gebruikerswachtwoord" -"User Role","Rol van gebruiker" -"User Roles","Rollen van gebruiker" -"User Roles Information","Gebruiker Rol Informatie" -"User name","Gebruikersnaam" -"Users","Gebruikers" -"VAT Number is Invalid","Btw-nummer is ongeldig." -"VAT Number is Valid","Btw-nummer is geldig." -"Validation Results","Validatie Resultaten" -"Value","Waarde" -"Value Delimiter:","Waarde scheidingsteken:" -"Variable","Variabele" -"Variable Code","Variabele Code" -"Variable HTML Value","Variabele HTML Waarde" -"Variable ID","Variabele ID" -"Variable Name","Naam variabele" -"Variable Plain Value","Variabele Basis Waarde" -"View Actions XML","Zie Acties XML" -"View Full Size","Zie Volledig Formaat" -"View Memo","Zie Memo" -"View Memo for #%s","Bekijk memo voor #%s" -"View Shipment","Bekijk verzending:" -"View Statistics For:","Bekijk Statistieken voor:" -"Visibility:","Zichtbaarheid:" -"Warning","Waarschuwing" -"Warning! Empty value can cause problems with CSV format.","Waarschuwing! Lege waarde kan problemen veroorzaken met CSV format." -"Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?","Waarschuwing! Deze actie verwijdert deze gebruiker van de al bestaande rol. Weet u het zeker?" -"Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?","Waarschuwing! Deze actie zal de gebruikers verwijderen die al zijn toegewezen. Weet u het zeker?" -"Warning: Please do not close the window during importing/exporting data","Waarschuwing: Sluit dit venster niet tijdens het im-/exporteren van data" -"Watermark File for %s","Watermerk Bestand voor %s" -"We appreciate our merchants\' feedback, please <a href=""#"" onclick=""surveyAction(\'yes\'); return false;"">take our survey</a> to provide insight on the features you would like included in Magento. <a href=""#"" onclick=""surveyAction(\'no\'); return false;"">Remove this notification</a>","Wij waarderen feedback van onze handelaars, doe a.u.b. <a href=""#""> ons onderzoek</a> om ons inzicht te verschaffen in de functies die u graag in Magento zou willen zien. <a href=""#""> Verwijder deze notitie</a>" -"We\'re in our typing table, coding away more features for Magento. Thank you for your patience.","Wij zijn druk aan het werk, bezig met het schrijven van nieuwe functies van Magento. Bedankt voor uw geduld." -"Web Section","Web Sectie" -"Web Services","Web Diensten" -"Web services","Web diensten" -"Website","Website" -"What is this?","Wat is dit?" -"Wishlist Report","Wishlist Rapport" -"Wishlist item is not loaded.","Verlanglijst product is niet geladen." -"Wrong account specified.","Foute rekening gespecificeerd." -"Wrong billing agreement ID specified.","Verkeerde betalingsovereenkomst ID gespecificeerd." -"Wrong column format.","Verkeerd kolomformaat." -"Wrong newsletter template.","Verkeerde nieuwsbrief sjabloon." -"Wrong quote item.","Verkeerde quote item." -"Wrong tab configuration.","Verkeerde tab configuratie." -"Wrong transaction ID specified.","Verkeerde transactie ID gespecificeerd." -"XML","XML" -"XML data is invalid.","XML data is ongeldig." -"XML object is not instance of ""Magento\Simplexml\Element"".","XML object is geen voorbeeld van ""Magento\Simplexml\Element""." -"YTD","YTD" -"Year","Jaar" -"Yes","Ja" -"Yes (301 Moved Permanently)","Ja (301 Permanent Verplaatst)" -"Yes (302 Found)","Ja (302 Gevonden)" -"Yes (only price with tax)","Ja (alleen prijs met belasting)" -"You cannot delete your own account.","U kunt uw eigen account niet verwijderen." -"You have %s unread message(s).","U heeft %s ongelezen boodschap(pen)." -"You have %s unread message(s). <a href=""%s"">Go to messages inbox</a>.","U heeft %s ongelezen bericht(en). <a >Ga naar berichten inbox</a>." -"You have %s, %s and %s unread messages. <a href=""%s"">Go to messages inbox</a>.","U heeft %s, %s en %s ongelezen berichten. <a >Ga naar berichten inbox</a>." -"You have logged out.","U bent uitgelogd." -"You have not enough permissions to use this functionality.","U heeft niet genoeg toegang om deze functie te gebruiken." -"You must have JavaScript enabled in your browser to utilize the functionality of this website.","U moet JavaScript in uw browser hebben ingeschakeld om de functionaliteit van de website te gebruiken." -"You need to specify order items.","U moet order artikelen specificeren." -"You will need to wait when the action ends.","U zult moeten wachten wanneer de actie voltooid is." -"Your answers contain duplicates.","Uw antwoorden bevatten duplicaten." -"Your password has been updated.","Uw wachtwoord is geupdate." -"Your password reset link has expired.","Uw wachtwoord herstel link is verlopen." -"Your server PHP settings allow you to upload files not more than %s at a time. Please modify post_max_size (currently is %s) and upload_max_filesize (currently is %s) values in php.ini if you want to upload larger files.","Uw server PHP settings staan uploadbestanden toe die niet groter zijn dan %s per keer. Pas de post_max_size (is nu %s) en upload_max_filesize (is nu %s) waarden in php.ini aan als u grotere bestanden wilt uploaden." -"Your web server is configured incorrectly. As a result, configuration files with sensitive information are accessible from the outside. Please contact your hosting provider.","Uw webserver is verkeerd geconfigureerd. Daarom zijn geconfigureerde bestanden met gevoelige informatie toegankelijk voor de buitenwereld. Neem contact op met uw provider." -"Zip/Postal Code","Zip/Postcode" -"Zip/Postal Code:","Postcode:" -"[ deleted ]","[ verwijderd ]" -"[GLOBAL]","[GLOBAAL]" -"[STORE VIEW]","[WINKEL OVERZICHT]" -"[WEBSITE]","[WEBSITE]" -"b","b" -"close","sluit" -"critical","kritiek" -"example: ""sitemap/"" or ""/"" for base path (path must be writeable)","voorbeeld: ""sitemap/"" of ""/"" voor basispad (pad moet beschrijfbaar zijn)" -"example: sitemap.xml","voorbeeld: sitmap.xml" -"failed","mislukt" -"from","van" -"major","groot" -"minor","klein" -"notice","merk op" -"store(%s) scope","winkel(%s) omvang" -"successful","succesvol" -"to","naar" -"website(%s) scope","website(%s) omvang" -"{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. It is highly recommended to change this value in your Magento <a href=""%s"">configuration</a>.","Het is niet aanbevolen {{base_url}} te gebruiken in een productieomgeving Base Unsecure URL / Base Secure URL aan te geven. Het is zeer aanbevolen deze waarde in uw magento <a href=""%s"">configuratie</a>te veranderen." diff --git a/app/code/Magento/Adminhtml/i18n/pt_BR.csv b/app/code/Magento/Adminhtml/i18n/pt_BR.csv deleted file mode 100644 index 35173c1d8e3..00000000000 --- a/app/code/Magento/Adminhtml/i18n/pt_BR.csv +++ /dev/null @@ -1,1144 +0,0 @@ -" The customer does not exist in the system anymore.","O cliente não existe mais no sistema." -" You will need to navigate to your ","Você precisará navegar para seu" -" [deleted]"," [suprimido]" -" and "," e " -" and go to the "," e ir para as " -" sections for your Hosted Checkout Pages."," seções para as suas Páginas de Checkout Hospedadas" -"%s (Default Template from Locale)","%s (Modelo Padrão de Locale)" -"%s cache type(s) disabled.","%s tipo(s) cache com deficiência." -"%s cache type(s) enabled.","%s tipo(s) cache habilitado." -"%s cache type(s) refreshed.","%s tipo(s) cache atualizado." -"(For Type ""Local Server"" need to use relative path to Magento install var/export or var/import, e.g. var/export, var/import, var/export/some/dir, var/import/some/dir)","(Para Tipo ""Servidor Local"" necessário utilizar caminho relativo para instalar Magento var/export ou var/import, por exemplo var/export, var/import, var/export/some/dir, var/import/some/dir)" -"(For US 2-letter state names)","(Para EUA nomes de 2 letras de estados)" -"(If left empty will be auto-generated)","(Se deixado vazio será gerado automaticamente)" -"(Leave empty for first spreadsheet)","(Deixe em branco para primeira folha de cálculo)" -"(Products will be added/updated to this store if 'store' column is blank or missing in the import file.)","(Os produtos serão adicionados/atualizados a esta loja, se a coluna 'loja' estiver em branco ou ausente no arquivo de importação.)" -"(Shift-)Click or drag to change value","(Shift-)Clique ou arraste para mudar o valor" -"(Starting with)","(Começando com)" -"(When 'No', only mapped fields will be imported. When mapping, use 'column1', 'column2', etc.)","(Quando 'Não', apenas campos mapeados serão importados. Quando mapeando, use 'coluna1', 'coluna2', etc.)" -"(You have to increase php memory_limit before changing this value)","(Você tem que aumentar o memory_limit php antes de alterar este valor)" -"(\\t for tab)","(\\t para tabulação)" -"* - If indexing is in progress, it will be killed and new indexing process will start.","* - Se a indexação está em andamento, será morta e novo processo de indexação vai começar." -"- Click on any of the time parts to increase it","- Clique em qualquer uma das partes da hora para a aumentar" -"- Hold mouse button on any of the above buttons for faster selection.","- Segure o botão do rato sobre qualquer um dos botões acima para selecionar rapidamente." -"- Use the %s buttons to select month","- Use os botões %s para selecionar o mês" -"- Use the %s, %s buttons to select year","- Use os botões %s, %s para selecionar o ano" -"- or Shift-click to decrease it","- Ou clique-Shift para diminuir" -"- or click and drag for faster selection.","- ou clique e arraste para uma seleção mais rápida." -"-- Not Selected --","-- Não selecionado --" -"-- Please Select --","- Por Favor Selecione -" -"-- Please Select Billing Agreement--","-- Por Favor, Escolha o Acordo de Cobrança--" -"-- Please Select a Category --","-- Por Favor, Escolha uma Categoria --" -"-- Please select --","-- Selecione --" -"--Please Select--","--Por Favor, Escolha--" -"1 Hour","1 Hora" -"1. set up","1. configurar" -"12 Hours","12 Horas" -"12h AM/PM","12h/00h" -"2 Hours","2 Horas" -"2. customize","2. personalizar" -"24 Hours","24 Horas" -"24h","24h" -"2YTD","2YTD" -"6 Hours","6 Horas" -"<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>","<h1 class=""page-heading"">Erro 404</h1><p>Página não encontrada.</p>" -"<strong>Attention</strong>: Captcha is case sensitive.","<strong>Attention</strong>: Captcha diferencia maiúsculas e minúsculas." -"A user with the same user name or email aleady exists.","Já existe um usuário com o mesmo nome ou e-mail." -"API Key","Chave API" -"API Key Confirmation","Confirmação de Chave API" -"ASCII","ASCII" -"Abandoned Carts","Carrinhos de Compras Abandonados" -"About the calendar","Sobre o calendário" -"Access Denied","Acesso negado" -"Access denied","Acesso negado" -"Access denied.","Acesso negado." -"Account Created in:","Conta criada em:" -"Account Created on (%s):","Conta criada em (%s):" -"Account Created on:","Conta criada em:" -"Account Information","Informações da Conta" -"Account Status","Status da conta" -"Account status","Status da conta" -"Action","Ação" -"Actions","Ações" -"Actions XML","Ações XML" -"Active","Ativo" -"Add","Adicionar" -"Add \Exception","Adicionar exceção" -"Add Field Mapping","Adicionar mapeamento de campo" -"Add Field with URL:","Adicionar campo com o URL:" -"Add New","Adicione Novo" -"Add New Image","Adicionar nova imagem" -"Add New Profile","Adicionar novo perfil" -"Add New Role","Adicionar nova função" -"Add New Template","Adicionar novo modelo" -"Add New URL Rewrite","Adicionar Novo Rewrite de URL" -"Add New User","Adicionar Novo Usuário" -"Add New Variable","Adicionar Nova Variável" -"Add Products","Adicionar produtos" -"Add URL Rewrite","Adicionar Rewrite de URL" -"Add URL Rewrite for a Category","Adicionar Rewrite de URL para uma Categoria" -"Add URL Rewrite for a Product","Adicionar Rewrite de URL para um Produto" -"Add after","Adicionar depois" -"Additional Cache Management","Gerenciamento de Cache Adicional" -"Address Type:","Tipo de Endereço:" -"Admin","Admin" -"Advanced Admin Section","Seção de Administrador Avançado" -"Advanced Profiles","Perfis Avançados" -"Advanced Section","Seção Avançada" -"All","Todos" -"All Allowed Countries","Todos os PaÃses Permitidos" -"All Cache","Todo o Cache" -"All Files","Todos os Arquivos" -"All Reviews","Todas as Revisões" -"All Store Views","Todas as Visualizações da Loja" -"All Websites","Todos os sites" -"All countries","Todos os paÃses" -"All fields","Todos os campos" -"All possible rates were fetched, please click on ""Save"" to apply","Todas as tarifas possÃveis foram obtidas, por favor clique em ""Salvar"" para aplicar" -"All rates were fetched, please click on ""Save"" to apply","Todas as tarifas foram obtidas, por favor clique em ""Salvar"" para aplicar" -"All valid rates have been saved.","Todas as tarifas válidas foram salvas." -"Always (during development)","Sempre (durante desenvolvimento)" -"Amounts","Quantidades" -"An error has occurred while syncronizing media storages.","Ocorreu um erro enquanto sincronizando armazenamentos de mÃdia." -"An error occurred while clearing the JavaScript/CSS cache.","Ocorreu um erro ao limpar a cache JavaScript/CSS." -"An error occurred while clearing the image cache.","Ocorreu um erro ao limpar a cache de imagem." -"An error occurred while deleting URL Rewrite.","Ocorreu um erro ao excluir URL Escreva novamente" -"An error occurred while deleting email template data. Please review log and try again.","Ocorreu um erro durante a exclusão de dados modelo de e-mail. Por favor analise o registro e tente novamente." -"An error occurred while deleting record(s).","Ocorreu um erro ao excluir registro(s)." -"An error occurred while deleting this role.","Ocorreu um erro ao excluir este papel." -"An error occurred while deleting this set.","Ocorreu um erro ao excluir este conjunto." -"An error occurred while deleting this template.","Ocorreu um erro ao excluir este modelo." -"An error occurred while finishing process. Please refresh the cache","Ocorreu um erro ao finalizar o processo. Por favor atualize a cache" -"An error occurred while rebuilding the CatalogInventory Stock Status.","Ocorreu um erro durante a reconstrução do Catálogo INventário do estado das unidades." -"An error occurred while rebuilding the catalog index.","Ocorreu um erro durante a reconstrução do Ãndice do catálogo." -"An error occurred while rebuilding the flat catalog category.","Ocorreu um erro durante a reconstrução da categoria plana do catálogo." -"An error occurred while rebuilding the flat product catalog.","Ocorreu um erro durante a reconstrução do produto plano do catálogo." -"An error occurred while rebuilding the search index.","Ocorreu um erro durante a reconstrução do Ãndice de pesquisa." -"An error occurred while refreshing the Catalog Rewrites.","Ocorreu um erro durante a atualização do Catálogo Rewrites." -"An error occurred while refreshing the Layered Navigation indices.","Ocorreu um erro durante a atualização dos Ãndices de Navegação em Camadas." -"An error occurred while refreshing the catalog rewrites.","Ocorreu um erro durante a atualização dos reescritos do catálogo." -"An error occurred while refreshing the layered navigation indices.","Ocorreu um erro ao atualizar os Ãndices de navegação em camadas." -"An error occurred while saving URL Rewrite.","Ocorreu um erro ao salvar URL Escreva novamente." -"An error occurred while saving account.","Ocorreu um erro ao salvar conta." -"An error occurred while saving review.","Ocorreu um erro ao salvar revisão." -"An error occurred while saving the customer.","Ocorreu um erro ao salvar o cliente." -"An error occurred while saving this configuration:","Ocorreu um erro ao salvar esta configuração:" -"An error occurred while saving this role.","Ocorreu um erro ao salvar este papel." -"An error occurred while saving this template.","Ocorreu um erro ao salvar este modelo." -"An error occurred while updating the selected review(s).","Ocorreu um erro durante a atualização da revisão selecionada." -"Any","Qualquer um" -"Any Attribute Set","Qualquer Conjunto de Atributos" -"Any Group","Qualquer Grupo" -"Any Status","Qualquer Estado" -"Any Store","Qualquer Loja" -"Any Type","Qualquer Tipo" -"Any Visibility","Qualquer Visibilidade" -"Any data created since the backup was made will be lost including admin users, customers and orders.","Qualquer dado criado desde a realização do backup será perdido, incluindo usuários admin, clientes e pedidos." -"Archive file name:","Nome do ficheiro de arquivo:" -"Are you sure that you want to delete this template?","Tem certeza de que deseja apagar este modelo?" -"Are you sure that you want to strip tags?","Tem certeza que você quer retirar tags?" -"Are you sure you want to do this?","Tem certeza de que quer fazer isso?" -"Are you sure you want to proceed?","Você tem certeza que deseja continuar?" -"Area","Ãrea" -"As low as:","A partir de:" -"Assigned","AtribuÃdo" -"Attribute Set Name:","Atribuir Nome de Conjunto:" -"Attributes","Atributos" -"Automatic","Automático" -"Average","Total do pedido médio" -"Average Orders","Pedido médio" -"BINARY","BINÃRIO" -"Back","Voltar" -"Back to Login","Voltar à Entrada" -"Backup","Backup" -"Backup Name","Nome do Backup" -"Backup options","Opções de backup" -"Backups","Cópias de segurança" -"Base currency","Moeda base" -"Bcc","CCO" -"Bestsellers","Mais vendidos" -"Billing Address","Endereço de faturamento" -"Billing Address: ","Endereço de faturamento:" -"Billing Agreement","Contrato de faturamento" -"Billing Agreements","Contratos de faturamento" -"Block Information","Informações de bloco" -"Both (without and with tax)","Ambos (com e sem impostos)" -"Both IPN and PDT","IPN e PDT" -"Browse Files...","Pesquisar arquivos..." -"Bundle with dynamic pricing cannot include custom defined options. Options will not be saved.","O pacote com preço dinâmico não pode incluir opções personalizadas definidas. As opções não serão salvas." -"CMS","SGC" -"CRITICAL","CRÃTICO" -"CSV","CSV" -"CSV / Tab separated","CSV / Tab separados" -"Cache Control","Controle de Cache" -"Cache Control (beta)","Controle de Cache (beta)" -"Cache Management","Gerenciamento de Cache" -"Cache Type","Tipo de Cache" -"Cancel","Cancelar" -"Cannot add new comment.","Não é possÃvel adicionar um novo comentário." -"Cannot add tracking number.","Não é possÃvel adicionar número de rastreamento." -"Cannot create an invoice without products.","Não é possÃvel criar uma fatura sem produtos." -"Cannot create credit memo for the order.","Não é possÃvel criar uma nota de crédito para a ordem." -"Cannot delete the design change.","Não é possÃvel apagar a mudança de desenho." -"Cannot delete tracking number.","Não é possÃvel apagar o número de rastreamento." -"Cannot do shipment for the order separately from invoice.","Não é possÃvel fazer envio para a ordem separadamente da fatura." -"Cannot do shipment for the order.","Não é possÃvel fazer envio para a ordem." -"Cannot initialize shipment for adding tracking number.","Não é possÃvel inicializar envio para adicionar número de rastreamento." -"Cannot initialize shipment for delete tracking number.","Não é possÃvel inicializar envio para apagar número de rastreamento." -"Cannot load track with retrieving identifier.","Não é possÃvel carregar pista com identificador de recuperação." -"Cannot retrieve tracking number detail.","Não é possÃvel recuperar detalhes do número de rastreamento." -"Cannot save shipment.","Não é possÃvel salvar envio." -"Cannot save the credit memo.","Não é possÃvel salvar a nota de crédito." -"Cannot send shipment information.","Não é possÃvel enviar informações de envio." -"Cannot update item quantity.","Não é possÃvel atualizar a quantidade do item." -"Cannot update the item\'s quantity.","Não é possÃvel atualizar a quantidade do item." -"Catalog","Catálogo" -"Catalog Price Rules","Regras de Preço do Catálogo" -"Catalog Rewrites","Reescrituras de Catálogo" -"Categories","Categorias" -"Category:","Categoria:" -"Chart is disabled. If you want to enable chart, click <a href=""%s"">here</a>.","A opção Tabela está desativada. Para ativá-la, clique <a href=""%s"">aqui</a>." -"Checkbox","Caixa de Seleção" -"Child Transactions","Transações Inferiores" -"Choose Store View:","Escolha a exibição de loja:" -"Choose an attribute","Escolha um atributo" -"Chosen category does not associated with any website, so url rewrite is not possible.","A categoria escolhida não está associada a nenhum website; não é possÃvel, portanto, reescrever a url." -"Chosen product does not associated with any website, so url rewrite is not possible.","O produto escolhido não está associado a nenhum website; não é possÃvel, portanto, reescrever a url." -"Clear","Limpar" -"Close","Fechar" -"Comment text field cannot be empty.","O campo de texto Comentário não pode ser deixado em branco." -"Complete","Completar" -"Configuration","Configuração" -"Confirm New Password","Confirmar a nova senha" -"Confirmed email:","E-mail confirmado:" -"Connect with the Magento Community","Conecte-se com a Comunidade Magento" -"Continue","Continue" -"Continuous","ContÃnuo" -"Convert to Plain Text","Converter para Texto Simples" -"Cookie (unsafe)","Cookie (não seguro)" -"Country","PaÃs" -"Country:","PaÃs:" -"Coupons","Cupons" -"Create","Criar" -"Create DB Backup","Criar DB Backup" -"Create New Attribute","Criar Novo Atributo" -"Create URL Rewrite:","Criar Reescritura de URL:" -"Created At","Criada Em" -"Credit Card %s","Cartão de Crédito %s" -"Credit Memo History","Histórico de Notas de Crédito" -"Credit Memo Totals","Totais da Nota de Crédito" -"Credit Memos","Notas de Crédito" -"Credit memo #%s comment added","Comentário de nota de crédito #%s adicionado" -"Credit memo #%s created","Nota de crédito #%s criada" -"Credit memo\'s total must be positive.","O total da nota de crédito deve ser positivo." -"Currency","Moeda" -"Currency ""%s"" is used as %s in %s.","Moeda ""%s"" é usada como %s em %s." -"Currency Information","Informação de moeda" -"Currency Setup Section","Seção de Configuração de Moeda" -"Current Configuration Scope:","Escopo da Configuração Atual:" -"Current Month","Mês corrente" -"Custom","Personalizado" -"Custom Variable ""%s""","Variável Personalizada ""%s""" -"Custom Variables","Variáveis de Personalização." -"Customer","Cliente" -"Customer Group:","Grupo do Cliente:" -"Customer Groups","Grupos do cliente" -"Customer","Nome do Cliente" -"Customer Reviews","Resenhas de Cliente" -"Customer Shopping Carts","Carrinhos de Compras dos Clientes" -"Customer Since:","Cliente desde:" -"Customer Tax Classes","Classes de Taxa do Cliente" -"Customer with the same email already exists.","Já existe um cliente com o mesmo email." -"Customers","Clientes" -"Customers by Orders","Clientes por Número de Pedidos" -"Customers by Orders Total","Clientes por Total dos Pedidos" -"DHTML Date/Time Selector","Seletor de Data/Hora DHTML" -"Dashboard","Painel" -"Data Format","Formato dos Dados" -"Data transfer:","Transferência de Dados:" -"Database","Base de Dados" -"Date","Data" -"Date & Time","Data & Hora" -"Added","Data de Adição" -"Updated","Data de Atualização" -"Date selection:","Seleção de data:" -"Date selector","Seletor de data" -"Day","Dia" -"Decimal separator:","Separador decimal:" -"Default (Admin) Values","Valores (de Admin) Padrão" -"Default Billing Address","Endereço padrão de faturamento" -"Default Config","Config Padrão" -"Default Template from Locale","Modelo Padrão do Locale" -"Default Values","Valores padrão" -"Default display currency ""%s"" is not available in allowed currencies.","Moeda de exibição padrão ""%s"" não está disponÃvel nas moedas permitidas." -"Default scope","Escopo padrão" -"Delete","Excluir" -"Delete %s","Apagar %s" -"Delete %s '%s'","Apagar %s '%s'" -"Delete File","Apagar Arquivo" -"Delete Image","Apagar Imagem" -"Delete Profile","Apagar Perfil" -"Delete Role","Apagar Papel" -"Delete Store","Apagar Loja" -"Delete Store View","Apagar Visão de Loja" -"Delete Template","Apagar Modelo" -"Delete User","Apagar Usuário" -"Delete Website","Apagar Site Web" -"Description","Descrição" -"Design","Design" -"Design Section","Seção de Design" -"Details","Detalhes" -"Developer Section","Seção de Desenvolvedor" -"Direction:","Direção:" -"Disable","Desativar" -"Disabled","Desativado" -"Display %s first","Mostrar primeiro %s" -"Display default currency","Mostrar moeda predifinida" -"Distributed under GNU LGPL. See %s for details.","DistribuÃdo sob a GNU LGPL. Veja %s para detalhes." -"Do you really want to KILL parallel process and start new indexing process?","Você realmente quer MATAR o processo paralelo e iniciar um novo processo de indexação?" -"Do you really want to proceed?","Você realmente deseja continuar?" -"Download","Baixar" -"Downloads","Transferências" -"Drag to move","Arraste para mover" -"Drop-down","Suspenso" -"Edit","Editar" -"Edit Design Change","Editar alteração de design" -"Edit Email Template","Editar modelo de e-mail" -"Edit Order","Editar Ordem (Pedido)" -"Edit Queue","Editar fila" -"Edit Review","Editar análise" -"Edit Role","Editar funçõa" -"Edit Store View","Editar visualização de loja" -"Edit System Template","Editar modelo de sistema" -"Edit Template","Editar modelo" -"Edit URL Rewrite","Editar o novo URL" -"Edit User","Editar usuário" -"Edit User '%s'","Editar usuário ""%s""" -"Edit Website","Editar site" -"Email","E-mail" -"Email Address:","Endereço de e-mail:" -"Email Preview","Visualização por e-mail" -"Email to a Friend","Enviar por e-mail a um amigo" -"Email:","E-mail:" -"Enable","Ativar" -"Enabled","Ativado" -"Enclose Values In:","Anexar valores:" -"Entity Attributes","Atributos da entidade" -"Entity Type","Tipo de entidade" -"Entity type:","Tipo de entidade:" -"Error","Erro" -"Excel XML","Excel XML" -"Excl. Tax","Excluir taxas" -"Exclude media folder from backup","Excluir pasta mÃdia do backup" -"Export","Exportar" -"Export CSV","Exportar CSV" -"Export Filters","Exportar filtros" -"Export to:","Exportar para:" -"Export:","Exportar:" -"FTP Host","Host FTP" -"FTP Host[:Port]","FTP Anfitrião[:Porta] (FTP Host[:Port])" -"FTP Login","Login FTP" -"FTP Password","Senha FTP" -"FTP credentials","Credenciais FTP" -"Failed to add a product to cart by id ""%s"".","Falha ao adicionar um produto ao carrinho de id ""%s""." -"Failed to cancel the billing agreement.","Falha ao cancelar o contrato de faturamento." -"Failed to clear the JavaScript/CSS cache.","Falha ao limpar acache JavaScript/CSS." -"Failed to delete the billing agreement.","Falha ao apagar o acordo de faturamento." -"Failed to update the profile.","Falha ao atualizar o perfil." -"Field","Campo" -"Field Mapping","Mapeamento de campo" -"File","Arquivo" -"File Information","Informação do Arquivo" -"File System","Arquivo de Sistema" -"File mode","Modo de Arquivo" -"File name:","Nome do arquivo:" -"File size should be more than 0 bytes","Tamanho do arquivo deve ser superior a 0 bytes" -"Finished profile execution.","Execução de perfil terminada." -"First Invoice Created Date","Data de criação do primeiro invoice" -"First Name","Primeiro nome" -"First Name is required field.","Nome Próprio é um campo obrigatório." -"First Name:","Primeiro nome:" -"Fixed","Fixado" -"Flush Catalog Images Cache","Limpar cache de imagens do catálogo" -"Flush JavaScript/CSS Cache","Limpar cache de JavaScript/CSS" -"For category","Para categoria" -"For latest version visit: %s","Para última versão, visitar: %s" -"For product","Para produto" -"Forgot Admin Password","Esqueci a senha de administrador" -"Forgot your password?","Esqueceu sua senha?" -"Forgot your user name or password?","Esqueceu seu nome de usuário ou senha?" -"From","De" -"GLOBAL","GLOBAL" -"Gb","Gb" -"General Information","Informações gerais" -"General Section","Seção Geral" -"Get Image Base64","Obter Imagem Base64" -"Get help for this page","Receber ajuda para esta página" -"Global Attribute","Atributo Global" -"Global Record Search","Busca Global de Registros" -"Global Search","Busca Global" -"Go Today","Ir Hoje" -"Go to messages inbox","Ir para caixa de entrada" -"Go to notifications","Ir para notificações" -"Google Base","Google Base" -"Google Sitemaps","Sitemaps Google" -"Grand Total","Total geral" -"Grid (default) / List","Grade (padrão) / Lista" -"Grid Only","Somente Grade" -"Group:","Grupo:" -"Guest","Convidado" -"HTTP (unsecure)","HTTP (inseguro)" -"HTTPS (SSL)","HTTPS (SSL)" -"Help Us Keep Magento Healthy - Report All Bugs","Ajude-nos a manter a Magento em forma - Informe qualquer defeito" -"Helper attributes should not be used in custom layout updates.","Não se devem usar atributos da ajuda em atualizações personalizadas de layout." -"Helper for options rendering doesn't implement required interface.","A ajuda para processamento de opções não implementa a interface necessária." -"Home","InÃcio" -"ID","Identidade" -"ID Path","Caminho de identificação" -"IP Address","Endereço de IP" -"IPN (Instant Payment Notification) Only","Somente NIP (Notificação Instantânea de Pagamento)" -"If there is an account associated with %s you will receive an email with a link to reset your password.","Se houver uma conta associada a %s você receberá um email com um link para reconfigurar a sua senha." -"If this message persists, please contact the store owner.","Se esta mensagem persistir, favor contatar dono da loja." -"Images (.gif, .jpg, .png)","Imagens (.gif, .jpg, .png)" -"Images Cache","Cache de Imagens" -"Import","Importar" -"Import Service","Serviço de Importação" -"Import and Export","Importação e Exportação" -"Import and Export Tax Rates","AlÃquotas de Importação e Exportação" -"Import/Export","Importação/Exportação" -"Import/Export Advanced","Importação/Exportação Avançado" -"Import/Export Profile","Perfil de Importação/Exportação" -"Important: ","Importante:" -"Imported <strong>%s</strong> records","Registros <strong>%s</strong> importados" -"In","Em" -"In Database:","Na Base de Dados:" -"In File:","No Arquivo:" -"Inactive","Inativo" -"Incl. Tax","Incluir taxas" -"Incoming Message","Mensagem Nova" -"Insert Variable...","Inserir Variável..." -"Interactive","Interativo" -"Interface Locale: %s","Configuração Regional da Interface: %s" -"Invalid Form Key. Please refresh the page.","Chave de Formulário Inválida. Favor atualizar a página." -"Invalid Import Service Specified","Especificação Inválida de Serviço de Importação" -"Invalid POST data (please check post_max_size and upload_max_filesize settings in your php.ini file).","Dados inválidos POST (por favor verifique as configurações post_max_size e upload_max_filesize no seu arquivo php.ini)." -"Invalid Secret Key. Please refresh the page.","Chave secreta inválida. Atualize a página." -"Invalid User Name or Password.","Nome de Usuário ou Senha Inválido" -"Invalid directory: %s","Diretório inválido: %s" -"Invalid email address ""%s"".","Endereço de email inválido ""%s""." -"Invalid email address.","Endereço de e-mail inválido." -"Invalid file: %s","Arquivo inválido: %s" -"Invalid input data for %s => %s rate","Dados inválido de entrada para %s => taxa de %s" -"Invalid parent block for this block","Bloco pai inválido para este bloco" -"Invalid parent block for this block.","Bloco-pai inválido para este bloco." -"Invalid password reset token.","Senha inválida reconfigure vale." -"Invalid sender name ""%s"". Please use only visible characters and spaces.","Nome ""%s"" de remetente inválido. Por favor use apenas caracteres visÃveis e espaços." -"Invalid timezone","Fuso horário inválido" -"Invalidated","Invalidado" -"Inventory Stock Status","Estado do Inventário de Estoque" -"Invoice #%s comment added","Comentário adicionado à fatura nº %s" -"Invoice #%s created","Fatura #%s criada" -"Invoice History","História da Fatura" -"Invoice Totals","Totais da Fatura" -"Invoice canceling error.","Erro de cancelamento da fatura." -"Invoice capturing error.","Erro ao registrar fatura." -"Invoice voiding error.","Erro ao anular fatura." -"Invoices","Faturas" -"Is Closed","Está Fechado" -"Issue Number","Número de Emissão" -"Items","Itens" -"JavaScript seems to be disabled in your browser.","O JavaScript parece estar desativado no seu navegador." -"JavaScript/CSS","JavaScript/CSS" -"JavaScript/CSS Cache","Cache JavaScript/CSS" -"Kb","Kb" -"Last 24 Hours","Últimas 24 Horas" -"Last 5 Orders","Últimos 5 Pedidos" -"Last 5 Search Terms","Últimos 5 Termos de Pesquisa" -"Last 7 Days","Últimos 7 Dias" -"Last Credit Memo Created Date","Data de Criação do Último Memorando de Crédito" -"Last Invoice Created Date","Data da Última Fatura Criada" -"Last Logged In (%s):","Último Login Em (%s):" -"Last Logged In:","Último Acesso:" -"Last Name","Último nome" -"Last Name is required field.","Sobrenome é um campo obrigatório." -"Last Name:","Último nome:" -"Last updated: %s. To refresh last day\'s <a href=""%s"">statistics</a>, click <a href=""%s"">here</a>.","Última actualização: %s. Para atualizar as <a href=""%s"">estatÃsticas</a> dos últimos dias, clique <a href=""%s"">aqui</a>." -"Latest Message:","Última Mensagem:" -"Layered Navigation Indices","Ãndices de Navegação por Camadas" -"Layered Navigation Indices were refreshed.","Ãndices de Navegação por Camadas foram atualizados." -"Leave empty to use tax identifier","Deixe em branco para usar identificador de impostos" -"Lifetime Sales","Vendas de Vida Inteira" -"Lifetime statistics have been updated.","EstatÃsticas de vida inteira foram atualizadas" -"Links","Ligações" -"Links with associated products will retain only after saving current product.","Ligações com produtos associados reterão apenas depois de salvar produto atual." -"List (default) / Grid","Lista (padrão) / Rede" -"List Only","Apenas Lista" -"Load Template","Carregar Modelo" -"Load default template","Carregar modelo predifinido" -"Loading...","Carregando..." -"Local Server","Servidor Local" -"Local/Remote Server","Servidor Local/Remoto" -"Locale","Locale" -"Log Out","Sair" -"Log in to Admin Panel","Entrar no Painel de Administração" -"Log into Magento Admin Page","Entrar na Página de Administração Magento" -"Logged in as %s","Conetado como %s" -"Login","Conectar-se" -"Low Stock","Baixo Estoque" -"MAJOR","PRINCIPAL" -"MINOR","MENOR" -"MS Excel XML","MS Excel XML" -"Magento Admin","Administração Magento" -"Magento Commerce - Administrative Panel","Comércio Magento - Painel Administrativo" -"Magento Connect","Conexão Magento" -"Magento Connect Manager","Gerenciador de Conexão Magento" -"Magento Logo","Logo Magento" -"Magento is a trademark of X.commerce, Inc. Copyright © %s X.commerce, Inc.","Magento é uma marca comercial da X.commerce, Inc.© Direitos Autorais©, %s X.commerce, Inc." -"Magento root directory","Diretório raiz Magento" -"Magento ver. %s","Ver. %s Magento" -"Magento® is a trademark of X.commerce, Inc.<br/>Copyright © %s X.commerce, Inc.","Magento® é uma marca comercial da X.commerce, Inc.<br/> Copyright © %s X.commerce, Inc." -"Make sure that data encoding in the file is consistent and saved in one of supported encodings (UTF-8 or ANSI).","Certifique-se que a codificação de dados no arquivo é consistente e salva em uma das codificações suportadas (UTF-8 ou ANSI)." -"Manage Attribute Sets","Gerenciar Conjuntos de Atributos" -"Manage Attributes","Gerenciar Atributos" -"Manage Categories","Gerenciar Categorias" -"Manage Content","Gerenciar conteúdo" -"Manage Currency Rates","Gerenciar Taxas de Câmbio" -"Manage Customers","Gerenciar clientes" -"Manage Ratings","Gerenciar Classificações" -"Manage Stores","Gerenciar Lojas" -"Manage Tax Rules","Gerenciar Regras de Imposto" -"Manage Tax Zones and Rates","Gerenciar Zonas de Imposto e Taxas" -"Manual","Manual" -"Matched Expression","Expressão Combinada" -"Mb","Mb" -"Media (.avi, .flv, .swf)","MÃdias (.avi, .flv, .swf)" -"Media storages synchronization has completed!","ConcluÃda a sincronização dos armazenamentos de mÃdias!" -"Messages Inbox","Caixa de Entrada de Mensagens" -"Month","Mês" -"Most Viewed","Mais vistos" -"Most Viewed Products","Produtos Mais Vistos" -"Multiple Select","Múltipla escolha" -"My Account","Minha Conta" -"N/A","IndisponÃvel" -"NOTICE","AVISO" -"Name","Nome" -"Name:","Nome:" -"Never (production)","Nunca (produção)" -"New ","Novo" -"New API Key","Nova Chave API" -"New Accounts","Novas Contas" -"New Attribute","Novo atributo" -"New Block","Novo Bloco" -"New Category","Nova Categoria" -"New Class","Nova Classe" -"New Condition","Nova Condição" -"New Custom Variable","Nova Variável Personalizada" -"New Customer","Novo Cliente" -"New Customers","Novos clientes" -"New Design Change","Nova Alteração de Design" -"New Email Template","Novo Modelo de Email" -"New Group","Novo Grupo" -"New Invoice","Nova Fatura" -"New Item Type","Novo Tipo de Item" -"New Memo","Nova Nota" -"New Memo for #%s","Nova Nota para #%s" -"New Page","Nova página" -"New Password","Nova senha" -"New Profile","Novo Perfil" -"New Rate","Nova Taxa" -"New Rating","Nova avaliação" -"New Review","Nova Resenha" -"New Role","Nova Função" -"New Rule","Nova Regra" -"New Search","Nova Busca" -"New Set","Novo Conjunto" -"New Shipment","Nova Remessa" -"New Sitemap","Novo Sitemap" -"New Store View","Nova Visualização de Loja" -"New System Template","Novo Modelo de Sistema" -"New Template","Novo Modelo" -"New User","Novo Usuário" -"New Variable","Nova Variável" -"New Website","Novo Website" -"New password field cannot be empty.","O campo de preenchimento de nova senha não pode ser deixado em branco." -"Newsletter","Newsletter" -"Newsletter Problems","Problemas com Newsletter" -"Newsletter Queue","Fila do Boletim Informativo" -"Newsletter Subscribers","Assinantes do Boletim Informativo" -"Newsletter Templates","Modelos de Boletim Informativo" -"Next month (hold for menu)","Próximo mês (segurar para menu)" -"Next year (hold for menu)","Próximo ano (segurar para menu)" -"No","Não" -"No (price without tax)","Não (preço sem imposto)" -"No Data","Nenhum Dado" -"No Data Found","Nenhum Dado Encontrado" -"No Templates Found","Nenhum Modelo Encontrado" -"No change","Sem alterações" -"No customer id defined.","Não definida uma identificação de cliente." -"No information available.","Nenhuma informação disponÃvel" -"No profile loaded...","Nenhum perfil carregado..." -"No records found for this period.","Nenhum registro encontrado para este perÃodo." -"No records found.","Nenhum registro encontrado." -"No report code specified.","Nenhum código de relatório especificado." -"No search keywords.","Nenhuma palavra-chave de busca." -"No search modules were registered","Não foram registrados módulos de busca." -"No wishlist item id defined.","Não foi definido item de lista de desejos." -"None","Nenhum" -"Note:","Observação:" -"Notes","Observações" -"Notifications","Notificações" -"Orders","Número de pedidos" -"Uses","Número de Usuários" -"Views","Número de Visualizações" -"Number of records:","Número de registros:" -"OK","OK" -"Old rate:","Valor antigo:" -"One or more media files failed to be synchronized during the media storages syncronization process. Refer to the log file for details.","Um ou mais arquivos de mÃdia deixaram de ser sincronizados durante o processo de sincronização de armazenamento de mÃdia. Consulte o arquivo de registro para obter detalhes." -"One or more of the Cache Types are invalidated:","Está invalidado um ou mais Tipo de Cache." -"Online Customers","Clientes Conectados" -"Only Once (version upgrade)","Somente Uma Vez (atualização da versão)" -"Only attributes with scope ""Global"", input type ""Dropdown"" and Use To Create Configurable Product ""Yes"" are available.","Apenas atributos de âmbito ""Global"", tipo de entrada ""Dropdown"" e ""Sim"" Use Para Criar Produto Configurável estão disponÃveis." -"Only mapped fields","Somente campos mapeados" -"Optional","Opcional" -"Options","Opções" -"Order","Pedido" -"Order %s","Pedido #%s" -"Order %s (%s)","Ordem #%s (%s)" -"Order Created Date","Data de Criação do Pedido" -"Order ID","ID da Ordem" -"Order Totals","Totais da Ordem" -"Order Updated Date","Data de Atualização do Pedido" -"Order Updated Date report is real-time, does not need statistics refreshing.","Relatório dos Dados de Atualização da Ordem em tempo real, não precisa de atualizar as estatÃsticas." -"Orders","Ordens" -"Original Magento attribute names in first row:","Nomes originais de atributo Magento na primeira linha:" -"Out of stock","Fora de estoque" -"PDT (Payment Data Transfer) Only","Apenas TDP (Transferência de Dados de Pagamento)" -"Package Extensions","Extensões da Embalagem" -"Pages","Páginas" -"Parent Product Thumbnail","Miniatura do Produto Parental" -"Parent Transaction ID","ID da Transação Parental" -"Passive mode","Modo passivo" -"Password","Senha" -"Password Confirmation","Confirmação de Senha" -"Password confirmation must be same as password.","Confirmação de senha tem de ser a mesma que a senha." -"Password must be at least of %d characters.","Senha deve ser de pelo menos %d caracteres." -"Password must include both numeric and alphabetic characters.","Senha deve conter caracteres numéricos e alfabéticos." -"Password:","Senha:" -"Path:","Caminho:" -"PayPal Manager","Gerenciador PayPal" -"Payment method instance is not available.","Instância de método de pagamento não está disponÃvel." -"Payment method is not available.","Método de pagamento não está disponÃvel." -"Payment method must be specified.","Método de pagamento deve ser especificado." -"Pending Reviews","Comentários Pendentes" -"Per Item","Por Item" -"Per Order","Por Ordem" -"Percent","Percentagem" -"Performed At","Realizado Em" -"Interval","PerÃodo" -"Permanent (301)","Permanente (301)" -"Permissions","Permissões" -"Personal Information","Informações pessoais" -"Phone:","Telefone:" -"Please Select","Por Favor Selecione" -"Please confirm site switching. All data that hasn\'t been saved will be lost.","Por favor confirme a mudança de site. Todos os dados que não tenham sido salvos serão perdidos." -"Please enter 6 or more characters.","Por favor insira 6 ou mais caracteres." -"Please enter a number greater than 0 in this field.","Por favor insira um número maior que 0 neste campo." -"Please enter a valid $ amount. For example $100.00.","Por favor introduza uma quantidade válida de $. Por exemplo $100,00." -"Please enter a valid URL. For example http://www.example.com or www.example.com","Por favor insira uma URL válida. Por exemplo http://www.exemplo.com ou www.exemplo.com" -"Please enter a valid URL. http:// is required","Por favor insira uma URL válida. http:// é necessário" -"Please enter a valid credit card number.","Por favor insira um número válido de cartão de crédito." -"Please enter a valid date.","Por favor insira uma data válida." -"Please enter a valid email address. For example johndoe@domain.com.","Por favor insira um endereço de e-mail válido. Por exemplo joao@domain.com." -"Please enter a valid email.","Por favor insira um e-mail válido." -"Please enter a valid number in this field.","Por favor insira um número válido neste campo." -"Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.","Por favor insira um número de telefone válido. Por exemplo (123) 456-7890 ou 123-456-7890." -"Please enter a valid social security number. For example 123-45-6789.","Por favor insira um número válido de segurança social. Por exemplo 123-45-6789." -"Please enter a valid value from list","Insira um valor válido da lista" -"Please enter a valid value, ex: 10,20,30","Por favor insira um valor válido, ex: 10,20,30" -"Please enter a valid zip code.","Por favor insira um código postal válido." -"Please enter a valid zip code. For example 90602 or 90602-1234.","Por favor insira um código postal válido. Por exemplo 90602 ou 90602-1234." -"Please enter another credit card number to complete your purchase.","Por favor insira outro número de cartão de crédito para concluir a sua compra." -"Please enter password","Por favor insira a senha" -"Please enter password to confirm rollback.","Por favor insira a senha para confirmar redução." -"Please enter valid password.","Por favor insira uma senha válida." -"Please make sure that all global admin search modules are installed and activated.","Por favor certifique-se que todos os módulos de pesquisa de administração global estão instalados e ativados." -"Please make sure that your changes were saved before running the profile.","Por favor certifique-se que suas alterações foram salvas antes de executar o perfil." -"Please make sure your passwords match.","Por favor certifique-se que suas senhas coincidem." -"Please select State/Province.","Por favor selecione Estado/ProvÃncia." -"Please select a customer.","Por favor selecione um cliente." -"Please select a store.","Por favor selecione uma loja." -"Please select an option.","Por favor selecione uma opção." -"Please select catalog searches.","Por favor selecione pesquisas de catálogo." -"Please select customer(s).","Por favor selecione cliente(s)." -"Please select message(s).","Por favor selecione mensagem/mensagens." -"Please select one of the above options.","Por favor selecione uma das opções acima." -"Please select one of the options.","Por favor selecione uma das opções." -"Please select review(s).","Por favor selecione comentário(s)." -"Please specify backup creation options","Por favor especifique opções de criação de backup." -"Please specify the admin custom URL.","Por favor especifique o URL de administração personalizada." -"Please try to logout and sign in again.","Por favor tente sair e entrar novamente." -"Please type the letters from the image:","Por favor digite as letras da imagem:" -"Please use in this field only ""a-z,0-9,_"".","Por favor use neste campo apenas ""a-z,0-9,_""." -"Please use letters only (a-z) in this field.","Por favor use apenas letras (a-z) neste campo." -"Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.","Por favor use apenas números nesse campo. Por favor evite espaços ou outros caracteres tais como pontos ou vÃrgulas." -"Please use only letters (a-z or A-Z), numbers (0-9) or spaces in this field.","Por favor use somente letras (a-z ou A-Z), números (0-9) ou espaços neste campo." -"Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.","Por favor use apenas letras (a-z) ou números (0-9) apenas neste campo. Espaços ou outros caracteres não são permitidos." -"Please use only letters (a-z) or numbers (0-9) or spaces and # only in this field.","Por favor use apenas letras (a-z) ou números (0-9) ou espaços e # apenas neste campo." -"Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.","Por favor utilize este formato de data: dd/mm/aaaa. Por exemplo 17/03/2006 para 17 de Março de 2006." -"Please wait while the indexes are being refreshed.","Por favor aguarde enquanto os Ãndices estão sendo atualizados." -"Please wait, loading...","Por favor aguarde, carregando..." -"Please wait...","Por favor aguarde..." -"Popular","Popular" -"Position of Watermark for %s","Posição da Marca d'Ãgua para %s" -"Pregenerated product images files.","Arquivos de imagens do produto pré-gerados." -"Prev. month (hold for menu)","Mês prévio (segure para menu)" -"Prev. year (hold for menu)","Ano anterior (segure para menu)" -"Preview","Visualizar" -"Preview Template","Visualização do Modelo" -"Price","Preço" -"Price alert subscription was saved.","Alerta de preço de subscrição foi salvo." -"Price:","Preço:" -"Processed <strong>%s%% %s/%d</strong> records","Registros <strong>%s%% %s/%d</strong> processados" -"Product","Produto" -"Product","Nome do produto" -"Product Reviews","Comentários sobre Produto" -"Product Tax Classes","Classe de Imposto do Produto" -"Product Thumbnail Itself","Miniatura do Produto em Si" -"Product is not loaded.","O produto não está carregado." -"Product:","Produto:" -"Products","Produtos" -"Products Bestsellers Report","Relatório dos Produtos Mais Vendidos" -"Products Most Viewed Report","Relatório dos produtos mais vistos" -"Products Ordered","Produtos Encomendados" -"Products in Carts","Produtos em Carrinhos" -"Profile Action","Ação de Perfil" -"Profile Actions XML","Perfil de Ações XML" -"Profile Direction","Direção de Perfil" -"Profile History","Histórico do Perfil" -"Profile Information","Informação do Perfil" -"Profile Name","Nome do Perfil" -"Profile Payments","Pagamentos de Perfil" -"Profile Schedule","Horário do Perfil" -"Profile Wizard","Wizard de Perfil" -"Profiles","Perfis" -"Promo","Promoção" -"Promotions","Promoções" -"Purchased Item","Item Comprado" -"Put store on the maintenance mode while backup creation","Colocar loja em modo de manutenção durante a criação do backup" -"Put store on the maintenance mode while rollback processing","Coloque a loja em modo de manutenção durante o processamento da reversão" -"Quantity","Quantidade" -"Queue Refresh","Atualizar a Fila de Espera" -"Queued... Cancel","Em fila de espera... Cancelar" -"Radio Buttons","Botões de Opção" -"Rates","Valores" -"Read details","Ler detalhes" -"Rebuild","Refazer" -"Rebuild Catalog Index","Refazer Ãndice de Catálogo" -"Rebuild Flat Catalog Category","Reconstruir Categoria de Catálogo Único" -"Rebuild Flat Catalog Product","Refazer Produto de Catálogo Simplificado" -"Recent Orders","Pedidos Recentes" -"Recent statistics have been updated.","As estatÃsticas recentes foram atualizadas." -"Recurring Profile View","Visualização de Perfil Recorrente" -"Recursive Dir","Diretório Recursivo" -"Redirect","Redirecionar" -"Reference","Referência" -"Reference ID","Identificação de Referência" -"Refresh","Atualizar" -"Refresh Now*","Atualizar Agora*" -"Refresh Statistics","Atualizar EstatÃsticas" -"Region/State","Região/Estado" -"Regular Price:","Preço Normal:" -"Release","Lançamento" -"Release Stability","Liberar Estabilidade" -"Release Version","Versão de Lançamento" -"Reload captcha","Recarregar captcha" -"Remote FTP","FTP Remoto" -"Remove","Remover" -"Reports","Relatórios" -"Request Path","Solicitar Caminho" -"Required","Obrigatório" -"Reset","Redefinir" -"Reset Filter","Reiniciar Filtro" -"Reset Password","Reconfigurar Senha" -"Reset a Password","Redefinir uma senha" -"Resize","Redimensionar" -"Resource Access","Acesso a Recursos" -"Resources","Recursos" -"Results","Resultados" -"Retrieve Password","Recuperar Senha" -"Return Html Version","Retornar Versão HTML" -"Revenue","Receita" -"Reviews","Resenhas" -"Reviews and Ratings","Resenhas e Avaliações" -"Rewrite Rules","Regras de Rewrite" -"Role ID","Identidade de Função" -"Role Info","Informação de Função" -"Role Information","Informação de Função" -"Role Name","Nome de Função" -"Role Resources","Recursos de Função" -"Role Users","Usuários de Função" -"Roles","Funções" -"Roles Resources","Recursos de Funções" -"Rotate CCW","Girar em sentido anti-horário" -"Rotate CW","Girar em sentido horário" -"Run","Executar" -"Run Profile","Executar Perfil" -"Run Profile Inside This Window","Executar Perfil Dentro Desta Janela" -"Run Profile in Popup","Executar Perfil em Pop-up" -"Running... Kill","Executando... Parar" -"SKU","Unidade de Manutenção de Estoque" -"SKU:","SKU (Unidade de Manutenção de Estoque):" -"SSL Error: Invalid or self-signed certificate","Erro SSL: Certificado inválido ou autoassinado" -"Sales","Vendas" -"Sales Report","Relatório de Vendas" -"Samples","Amostras" -"Save","Salvar" -"Save & Generate","Salvar & Gerar" -"Save Account","Salvar Conta" -"Save Cache Settings","Salvar Configurações de Cache" -"Save Config","Salvar Configuração" -"Save Currency Rates","Salvar Taxas de Câmbio" -"Save Profile","Salvar Perfil" -"Save Role","Salvar Função" -"Save Template","Salvar Modelo" -"Save User","Salvar Usuário" -"Save and Continue Edit","Salvar e continuar a editar" -"Search","Pesquisa" -"Search Index","Buscar no Ãndice" -"Search Term","Buscar Termo" -"Search Terms","Buscar Termos" -"Select","Selecione" -"Select All","Selecionar Tudo" -"Select Category","Selecionar categoria" -"Select Date","Selecione Data" -"Select Range","Selecionar Intervalo" -"Select date","Selecione data" -"Selected allowed currency ""%s"" is not available in installed currencies.","Moeda selecionada permitida ""%s"" não está disponÃvel nas moedas instaladas." -"Selected base currency is not available in installed currencies.","A moeda base selecionada não está disponÃvel nas moedas instaladas." -"Selected default display currency is not available in allowed currencies.","Moeda predifinida de exibição selecionada não está disponÃvel nas moedas permitidas." -"Selected default display currency is not available in installed currencies.","A moeda de exibição padrão selecionada não está disponÃvel nas moedas instaladas." -"Self-assigned roles cannot be deleted.","Papéis auto-atribuÃdos não podem ser apagados." -"Sender","Remetente" -"Separate Email","Email Separado" -"Service Settings","Configurações de serviço" -"Set up & Customize","Ajustes & customização" -"Shipment #%s comment added","Comentário de envio #%s adicionado" -"Shipment #%s created","Criado embarque #%s" -"Shipment Comments","Comentários de Envio" -"Shipment History","Histórico de Entregas" -"Shipments","Envios" -"Shipping","Remessa" -"Shipping Address","Endereço de Envio" -"Shipping Address: ","Endereço de Envio:" -"Shipping Origin","Origem do Envio" -"Shipping Price","Valor do Frete" -"Shipping address selection is not applicable","Seleção de endereço de envio não é aplicável" -"Shipping method must be specified.","O método de entrega deve ser especificado." -"Shipping method selection is not applicable","Seleção de método de envio não é aplicável" -"Shopping Cart","Carrinho de compras" -"Shopping Cart Price Rules","Regras de Preços de Carrinho de Compras" -"Shopping Cart from %s","Carrinho de Compras de %s" -"Show By","Mostrar Por" -"Show Report For:","Mostrar relatório de:" -"Show Reviews","Mostrar Resenhas" -"Sitemap Information","Informações do Mapa do Site" -"Size for %s","Tamanho para %s" -"Skip Category Selection","Pular Seleção de Categoria" -"Some items in this order have different invoice and shipment types. You can create shipment only after the invoice is created.","Alguns itens nesta ordem têm diferentes notas fiscais e tipos de embarque. Você pode criar o embarque somente depois que a fatura é criada." -"Some of the ordered items do not exist in the catalog anymore and will be removed if you try to edit the order.","Alguns dos itens pedidos não existem mais no catálogo, e serão removidos se você tentar editar o pedido." -"Sorry, this feature is coming soon...","Desculpe, esta funcionalidade estará disponÃvel em breve..." -"Special Price:","Preço Especial:" -"Specific Countries","PaÃses EspecÃficos" -"Specified","Especificado" -"Specified profile does not exist.","O perfil especificado não existe." -"Spreadsheet Name:","Nome da Planilha:" -"Start Date","Data de inÃcio" -"Starting profile execution, please wait...","Iniciando execução do perfil, por favor aguarde..." -"State/Province:","Estado/ProvÃncia:" -"Static Blocks","Blocos Estáticos" -"Status","Status" -"Status:","Estado atual:" -"Stock Quantity:","Quantidade em Estoque:" -"Stock notification was saved.","A notificação de estoque foi salva." -"Store","Loja" -"Store Email Addresses Section","Seção de Endereços de Email da Loja" -"Store View","Visualização da loja" -"Store:","Loja:" -"Stores","Lojas" -"Subject","Assunto" -"Submit","Enviar" -"Subpackage cannot be conflicting.","Subpacote não pode gerar conflito." -"Subtotal","Subtotal" -"Switch/Solo/Maestro Only","Somente Swith/Solo/Maestro" -"Synchronization is required.","Sincronização necessária." -"Synchronization of media storages has been successfully completed.","A sincronização dos armazenamentos em mÃdia foi concluÃda com sucesso." -"Synchronize","Sincronizar" -"Synchronizing %s to %s","Sincronização %s para %s" -"Synchronizing...","Sincronizando..." -"System","Sistema" -"System Section","Seção de Sistema" -"System busy","Sistema ocupado" -"Target Path","Caminho Alvo" -"Tax","Taxas" -"Tb","Tb" -"Template","Modelo" -"Template Content","Conteúdo do Modelo" -"Template Information","Informação do Modelo" -"Template","Nome do Modelo" -"Template Styles","Estilos do Modelo" -"Template Subject","Assunto do Modelo" -"Template Type","Tipo de Modelo" -"Temporary (302)","Temporário (302)" -"Terms and Conditions","Termos e Condições" -"Text","Texto" -"The Catalog Rewrites were refreshed.","Os Reescritos do Catálogo foram atualizados." -"The CatalogInventory Stock Status has been rebuilt.","O Estado do Catálogo de Inventário de Estoque foi reconstruÃdo." -"The Comment Text field cannot be empty.","O campo de texto do comentário não pode estar vazio." -"The Flat Catalog Product was rebuilt","O Catálogo Base de Produtos foi reconstruÃdo" -"The JavaScript/CSS cache has been cleaned.","O cache JavaScript/CSS foi limpo." -"The JavaScript/CSS cache has been cleared.","O cache JavaScript/CSS foi limpo." -"The Layered Navigation indexing has been queued.","A indexação de navegação em camadas foi colocada na fila." -"The Layered Navigation indexing queue has been canceled.","A fila de indexação de navegação em camadas foi cancelada." -"The Layered Navigation indices were refreshed.","Os Ãndices de Navegação por Camadas foram atualizados." -"The Layered Navigation process has been queued to be killed.","O processo de navegação em camadas foi colocado na fila para ser eliminado." -"The Magento cache storage has been flushed.","O armazenamento de cache Magento foi liberado." -"The URL Rewrite has been deleted.","O URL Reescrito foi apagado." -"The URL Rewrite has been saved.","O URL Reescrito foi salvo." -"The account has been saved.","A conta foi salva." -"The archive can be uncompressed with <a href=""%s"">%s</a> on Windows systems","O arquivo pode ser descompactado com <a href=""%s"">%s</a> nos sistemas Windows" -"The attribute set has been removed.","O conjunto de atributos foi removido." -"The backup's creation process will take time.","O processo de criação do backup levará algum tempo." -"The billing agreement has been canceled.","O acordo de cobrança foi cancelado." -"The billing agreement has been deleted.","O acordo de faturamento foi eliminado." -"The cache storage has been flushed.","O armazenamento de cache foi liberado." -"The carrier needs to be specified.","A transportadora deve ser especificada." -"The catalog index has been rebuilt.","O Ãndice do catálogo foi reconstruÃdo." -"The catalog rewrites have been refreshed.","Os reescritos do catálogo foram atualizados." -"The configuration has been saved.","A configuração foi salva." -"The credit memo has been canceled.","A nota de crédito foi cancelada." -"The credit memo has been created.","A nota de crédito foi criada." -"The credit memo has been voided.","A nota de crédito foi anulada." -"The custom variable has been deleted.","A variável personalizada foi apagada." -"The custom variable has been saved.","A variável personalizada foi salva." -"The customer has been deleted.","O cliente foi apagado." -"The customer has been saved.","O cliente foi salvo." -"The design change has been deleted.","A mudança de design foi apagada." -"The design change has been saved.","A mudança de design foi salva." -"The email address is empty.","O endereço de email está vazio." -"The email template has been deleted.","O modelo de e-mail foi apagado." -"The email template has been saved.","O modelo de e-mail foi salvo." -"The flat catalog category has been rebuilt.","A categoria catálogo plano foi reconstruÃda." -"The group node name must be specified with field node name.","O nome do nó de grupo deve ser especificado com o nome do nó de campo." -"The image cache was cleaned.","A cache de imagem foi limpa." -"The image cache was cleared.","A cache de imagem foi limpa." -"The invoice and shipment have been created.","A fatura e remessa foram criadas." -"The invoice and the shipment have been created. The shipping label cannot be created at the moment.","A factura e o envio foram criados. A etiqueta de remessa não pode ser criada no momento." -"The invoice has been canceled.","A fatura foi cancelada." -"The invoice has been captured.","A fatura foi capturada." -"The invoice has been created.","A fatura foi criada." -"The invoice has been voided.","A fatura foi cancelada." -"The invoice no longer exists.","A fatura não existe mais." -"The item %s (SKU %s) does not exist in the catalog anymore.","O item %s (SKU %s) não existe mais no catálogo." -"The order does not allow creating an invoice.","A ordem não permite a criação de uma fatura." -"The order no longer exists.","A ordem não existe mais." -"The profile has been deleted.","O perfil foi apagado." -"The profile has been saved.","O perfil foi salvo." -"The profile has been updated.","O perfil foi atualizado." -"The profile has no changes.","O perfil não tem alterações." -"The profile you are trying to save no longer exists","O perfil que você está tentando salvar não existe mais" -"The rating has been deleted.","A avaliação foi eliminada." -"The rating has been saved.","A avaliação foi salva." -"The role has been deleted.","O papel foi eliminado." -"The role has been saved.","O papel foi salvo." -"The role has been successfully saved.","O papel foi salvo com sucesso." -"The search index has been rebuilt.","O Ãndice de pesquisa foi reconstruÃdo." -"The shipment has been created.","A remessa foi criada." -"The shipment has been sent.","A remessa foi enviada." -"The shipping label has been created.","A etiqueta de envio foi criada." -"The transaction details have been updated.","Os detalhes da transação foram atualizados." -"The user has been deleted.","O usuário foi apagado." -"The user has been saved.","O usuário foi salvo." -"Themes JavaScript and CSS files combined to one file.","Temas JavaScript e CSS combinados para um arquivo." -"There is an error in one of the option rows.","Há um erro em uma das linhas de opção." -"This Account is","Esta Conta é" -"This Email template no longer exists.","Este modelo de e-mail não existe mais." -"This Role no longer exists","Esse papel não existe mais" -"This Role no longer exists.","Esse Papel não existe mais." -"This account is","Esta conta é" -"This account is inactive.","Esta conta está inativa." -"This action cannot be undone.","Essa ação não pode ser desfeita." -"This attribute set does not have attributes which we can use for configurable product","Este conjunto de atributos não possui atributos que possamos utilizar para o produto configurável" -"This attribute shares the same value in all the stores","Este atributo partilha o mesmo valor em todas as lojas" -"This is a demo store. Any orders placed through this store will not be honored or fulfilled.","Esta é uma loja de demonstração. Qualquer ordem ou encomenda colocada nesta loja não será honrada ou completa." -"This is a required field.","Este é um campo obrigatório." -"This product is currently disabled.","Este produto está atualmente desativado." -"This report depends on timezone configuration. Once timezone is changed, the lifetime statistics need to be refreshed.","Este relatório depende da configuração de fuso horário. Uma vez que o fuso horário é alterado, as estatÃsticas de vida precisam ser atualizadas." -"This section is not allowed.","Esta seção não é permitida." -"This user no longer exists.","Este usuário não existe mais." -"Time","Tempo" -"Time selection:","Seleção de tempo:" -"Time:","Tempo:" -"Timeout limit for response from synchronize process was reached.","Tempo limite para a resposta do processo de sincronização foi alcançado." -"To","Para" -"To cancel pending authorizations and release amounts that have already been processed during this payment, click Cancel.","Para cancelar autorizações pendentes e liberar quantidades que já foram processadas durante este pagamento, clique em Cancelar." -"To use PayPal Payflow Link you must configure some settings in your Payflow account by logging into","Para usar o Payflow Link, você deve configurar sua conta Payflow Link no site do Paypal." -"To use PayPal Payments Advanced you must configure some settings in your PayPal Payments Advanced account by logging into","Para usar Pagamentos Adiantados PayPal você deve configurar algumas configurações na sua conta de Pagamentos Adiantados PayPal fazendo login em" -"Toggle Editor","Editor de Alternar" -"Tools","Ferramentas" -"Top 5 Search Terms","Top 5 de Termos de Pesquisa" -"Total","Total" -"Total Invoiced","Total Faturado" -"Total","Valor Total da Ordem" -"Total Refunded","Total Reembolsado" -"Total of %d record(s) have been deleted.","No total %d registro(s) foi(foram) excluÃdo(s)." -"Total of %d record(s) have been updated.","Total de %d registro(s) foram atualizados." -"Total of %d record(s) were canceled.","Total de %d registros foram cancelados" -"Total of %d record(s) were deleted","Total de %d registro(s) foram excluÃdos" -"Total of %d record(s) were deleted.","Total de %d registro(s) foram excluÃdos." -"Total of %d record(s) were updated","Total de %d registro(s) foram atualizados" -"Total of %d record(s) were updated.","Total de %d registro(s) foram atualizados." -"Track Order","Rastrear Ordem" -"Track this shipment","Acompanhar este envio" -"Tracking number %s for %s assigned","AtribuÃdo número de rastreamento %s para %s" -"Tracking number cannot be empty.","Número de rastreamento não pode ser vazio." -"Transaction Data","Dados da Transação" -"Transaction Details","Detalhes da Transação" -"Transaction ID","ID da Transação" -"Transaction Type","Tipo de Transação" -"Transactional Emails","Emails de Transações" -"Transactions","Transações" -"Type","Tipo" -"Type:","Tipo:" -"URL Rewrite","Reescrever URL" -"URL Rewrite Information","Informação Reescrita de URL" -"URL Rewrite Management","Gestão Reescrita de URL" -"Unable to cancel the credit memo.","Não foi possÃvel cancelar a nota de crédito." -"Unable to find a Email Template to delete.","Incapaz de encontrar um Modelo de Email para apagar." -"Unable to find a user to delete.","ImpossÃvel encontrar usuário a ser apagado." -"Unable to initialize import model","ImpossÃvel iniciar modelo de importação" -"Unable to refresh lifetime statistics.","ImpossÃvel atualizar estatÃsticas do tempo de existência." -"Unable to refresh recent statistics.","ImpossÃvel atualizar estatÃsticas recentes." -"Unable to save Cron expression","Não foi possÃvel salvar expressão Cron" -"Unable to save the cron expression.","ImpossÃvel salvar a expressão cron." -"Unable to save the invoice.","Não foi possÃvel salvar a fatura." -"Unable to send the invoice email.","ImpossÃvel enviar email com a fatura." -"Unable to send the shipment email.","Não foi possÃvel enviar o email de expedição." -"Unable to update transaction details.","Não foi possÃvel atualizar as informações da transação." -"Unable to void the credit memo.","Não foi possÃvel anular a nota de crédito." -"Unknown","Desconhecido" -"Unlimited","Ilimitado" -"Update","Atualizar" -"Updated At","Atualizado Em" -"Upload File","Carregar Arquivo" -"Upload Files","Carregar Arquivos" -"Upload HTTP Error","Carregar Erro HTTP" -"Upload I/O Error","Carregar Erro de E/S" -"Upload Security Error","Carregar Erro de Segurança" -"Upload import file","Carregar arquivo de importação" -"Uploaded file is larger than %.2f kilobytes allowed by server","O arquivo de upload é maior que os %.2f kilobytes permitidos pelo servidor" -"Use All Available Attributes","Usar Todos os Atributos DisponÃveis" -"Use Config Settings","Utilizar opções de configuração" -"Use Default","Utilizar padrão" -"Use Default Value","Utilizar valor padrão" -"Use Default Variable Values","Usar Valores-Padrão para Variáveis" -"Use FTP Connection","Use Conexão FTP" -"Use Website","Usar Website" -"Used Currently For","Atualmente Usado(s) Para" -"Used as Default For","Usado(s) por Padrão Para" -"User Email","Email do Usuário" -"User ID","Identificação do Usuário" -"User Info","Informações do Usuário" -"User Information","Informações do Usuário" -"User Name","Nome do Usuário" -"User Name is required field.","Nome de Usuário é um campo obrigatório." -"User Name:","Nome do Usuário:" -"User Password","Senha do Usuário" -"User Role","Função do Usuário" -"User Roles","Funções do Usuário" -"User Roles Information","Informações sobre Papéis do Usuário" -"User name","Nome do Usuário" -"Users","Usuários" -"VAT Number is Invalid","O número VAT é inválido" -"VAT Number is Valid","O número VAT é válido" -"Validation Results","Resultados de Validação" -"Value","Valor" -"Value Delimiter:","Valor Delimitador:" -"Variable","Variável" -"Variable Code","Código de Variável" -"Variable HTML Value","Valor HTML de Variável" -"Variable ID","Identificação de Variável" -"Variable Name","Nome da Variável" -"Variable Plain Value","Valor PLAIN de Variável" -"View Actions XML","Visualizar XML de Ações" -"View Full Size","Visualizar Tamanho Completo" -"View Memo","Visualizar Memorando" -"View Memo for #%s","Ver Memo por #%s" -"View Shipment","Ver Remessa" -"View Statistics For:","Veja EstatÃsticas Para:" -"Visibility:","Visibilidade:" -"Warning","Aviso" -"Warning! Empty value can cause problems with CSV format.","Atenção! Valor vazio pode causar problemas com o formato CSV." -"Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?","Aviso!\r\nEsta ação removerá este usuário do papel já atribuÃdo\r\nVocê tem certeza?" -"Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?","Atenção!\r\nEsta ação irá remover os usuários das funções já atribuÃdas\r\nVocê tem certeza?" -"Warning: Please do not close the window during importing/exporting data","Aviso: Por favor não feche a janela durante a importação/exportação de dados" -"Watermark File for %s","Arquivo Marca d'Ãgua para %s" -"We appreciate our merchants\' feedback, please <a href=""#"" onclick=""surveyAction(\'yes\'); return false;"">take our survey</a> to provide insight on the features you would like included in Magento. <a href=""#"" onclick=""surveyAction(\'no\'); return false;"">Remove this notification</a>","Agradecemos o feedback de nossos comerciantes, por favor <a href=""#"">responda a nosso inquérito</a> para fornecer uma visão sobre as caracterÃsticas que você gostaria de incluir no Magento. <a href=""#"">Remover esta notificação</a>" -"We\'re in our typing table, coding away more features for Magento. Thank you for your patience.","Estamos em nossa tabela de digitação, codificando mais recursos para Magento. Obrigado pela sua paciência." -"Web Section","Seção Web" -"Web Services","Serviços Web" -"Web services","Serviços Web" -"Website","Website" -"What is this?","O que é isso?" -"Wishlist Report","Assinalar na Lista de Desejos" -"Wishlist item is not loaded.","O item da lista de presentes não foi carregado." -"Wrong account specified.","Conta errada especificada." -"Wrong billing agreement ID specified.","ID de acordo de faturamento especificado errado." -"Wrong column format.","Formato errado de coluna." -"Wrong newsletter template.","Modelo de newsletter errado." -"Wrong quote item.","Item de citação errado." -"Wrong tab configuration.","Configuração errada de tabulação." -"Wrong transaction ID specified.","ID errado de transação especificado." -"XML","XML" -"XML data is invalid.","Dados XML inválidos." -"XML object is not instance of ""Magento\Simplexml\Element"".","Objeto XML não é instância de ""Magento\Simplexml\Element""." -"YTD","YTD" -"Year","Ano" -"Yes","Sim" -"Yes (301 Moved Permanently)","Sim (301 movido permanentemente)" -"Yes (302 Found)","Sim (302 Encontrado)" -"Yes (only price with tax)","Sim (preço somente com impostos)" -"You cannot delete your own account.","Você não pode apagar sua própria conta." -"You have %s unread message(s).","Você tem %s mensagens não lidas." -"You have %s unread message(s). <a href=""%s"">Go to messages inbox</a>.","Você tem %s mensagem(s) não lidas. <a href=""%s"">Ir para a caixa de entrada de mensagens</a>." -"You have %s, %s and %s unread messages. <a href=""%s"">Go to messages inbox</a>.","Você tem %s, %s e %s mensagens não lidas. <a href=""%s"">Ir para a caixa de entrada de mensagens</a>." -"You have logged out.","Você se desconetou." -"You have not enough permissions to use this functionality.","Você não tem permissões suficientes para utilizar esta funcionalidade." -"You must have JavaScript enabled in your browser to utilize the functionality of this website.","Você deve ativar o Javascript no seu navegador para utilizar as funcionalidades deste site." -"You need to specify order items.","Você precisa especificar itens da ordem." -"You will need to wait when the action ends.","Será necessário aguardar quando a ação terminar." -"Your answers contain duplicates.","Suas respostas contêm duplicatas." -"Your password has been updated.","A sua senha foi atualizada." -"Your password reset link has expired.","Seu link de configuração de senha expirou." -"Your server PHP settings allow you to upload files not more than %s at a time. Please modify post_max_size (currently is %s) and upload_max_filesize (currently is %s) values in php.ini if you want to upload larger files.","As configurações do seu servidor PHP permitem que você faça o carregamento de arquivos não mais que %s de cada vez. Por favor modifique os valores post_max_size (atualmente é %s) e upload_max_filesize (atualmente é %s) em php.ini se você quiser fazer carregar arquivos maiores." -"Your web server is configured incorrectly. As a result, configuration files with sensitive information are accessible from the outside. Please contact your hosting provider.","Seu servidor web está configurado incorretamente. Como resultado, os arquivos de configuração com informações confidenciais são acessÃveis de fora. Entre em contato com seu provedor de hospedagem." -"Zip/Postal Code","Zip/Código Postal" -"Zip/Postal Code:","CEP/Código Postal:" -"[ deleted ]","[ apagado ]" -"[GLOBAL]","[GLOBAL]" -"[STORE VIEW]","[VISUALIZAR LOJA]" -"[WEBSITE]","[WEBSITE]" -"b","b" -"close","fechar" -"critical","crÃtico" -"example: ""sitemap/"" or ""/"" for base path (path must be writeable)","exemplo: ""sitemap /"" ou ""/"" para o caminho base (caminho deve ser gravável)" -"example: sitemap.xml","exemplo: sitemap.xml" -"failed","fracassado" -"from","de" -"major","maior" -"minor","menor" -"notice","aviso" -"store(%s) scope","âmbito de loja (%s)" -"successful","bem sucedido" -"to","para" -"website(%s) scope","âmbito de site (%s)" -"{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. It is highly recommended to change this value in your Magento <a href=""%s"">configuration</a>.","{{base_url}} não é recomendada para uso em um ambiente de produção para declarar Base URL Insegura/Base URL Segura. É altamente recomendável alterar este valor em suas <a href=""%s"">configurações</a> Magento." diff --git a/app/code/Magento/Adminhtml/i18n/zh_CN.csv b/app/code/Magento/Adminhtml/i18n/zh_CN.csv deleted file mode 100644 index 6fd6c89218f..00000000000 --- a/app/code/Magento/Adminhtml/i18n/zh_CN.csv +++ /dev/null @@ -1,1163 +0,0 @@ -" The customer does not exist in the system anymore.","系统ä¸ä¸å˜åœ¨è¯¥å®¢æˆ·ã€‚" -" You will need to navigate to your ","ä½ éœ€è¦è¿›å…¥åˆ°ä½ çš„" -" [deleted]","[å·²åˆ é™¤]" -" and ","并且" -" and go to the ","并转到" -" sections for your Hosted Checkout Pages.","托管结账页é¢éƒ¨åˆ†" -"%s (Default Template from Locale)","%s (ä¸åŒåœ°åŒºçš„默认模æ¿ï¼‰" -"%s cache type(s) disabled.","%s个缓å˜ç±»åž‹è¢«ç¦ç”¨ã€‚" -"%s cache type(s) enabled.","%s个缓å˜ç±»åž‹è¢«å¯ç”¨ã€‚" -"%s cache type(s) refreshed.","%s个缓å˜ç±»åž‹è¢«åˆ·æ–°ã€‚" -"(For Type ""Local Server"" need to use relative path to Magento install var/export or var/import, e.g. var/export, var/import, var/export/some/dir, var/import/some/dir)","(对于类型 ""Local Server"" 需è¦ä½¿ç”¨åˆ° Magento install var/export 或 var/import 的相对路径,例如 var/exportã€var/importã€var/export/some/dirã€var/import/some/dir)" -"(For US 2-letter state names)","ï¼ˆç”¨äºŽç¾Žå›½ä¸¤ä¸ªå—æ¯ä»£è¡¨çš„å·žå称)" -"(If left empty will be auto-generated)","(如果留空将自动生æˆï¼‰" -"(Leave empty for first spreadsheet)","ï¼ˆç¬¬ä¸€ä¸ªè¡¨æ ¼å¯ç•™ç©ºï¼‰" -"(Products will be added/updated to this store if 'store' column is blank or missing in the import file.)","(如果“店铺â€ä¸€æ 为空或在导入的文件ä¸ä¸å˜åœ¨ï¼Œåˆ™äº§å“ä¼šè¢«æ·»åŠ /更新到该店铺ä¸ã€‚)" -"(Shift-)Click or drag to change value","(Shift-)点击或拖拽å³å¯æ›´æ”¹å€¼" -"(Starting with)","(始于)" -"(When 'No', only mapped fields will be imported. When mapping, use 'column1', 'column2', etc.)","(如果为“å¦â€ï¼Œåˆ™åªæœ‰æ˜ å°„çš„æ–‡ä»¶ä¼šè¢«å¯¼å…¥ã€‚åœ¨æ˜ å°„æ—¶ï¼Œè¯·ä½¿ç”¨ 'column1'ã€'column2'ç‰ã€‚)" -"(You have to increase php memory_limit before changing this value)","ï¼ˆæ›´æ”¹è¯¥å€¼ä¹‹å‰æ‚¨éœ€è¦å¢žå¤§phpçš„memory_limit)" -"(\\t for tab)","(\\t 坿‰“开选项å¡ï¼‰" -"* - If indexing is in progress, it will be killed and new indexing process will start.","* - 如果æ£åœ¨åˆ›å»ºç´¢å¼•ï¼Œåˆ™ä¼šè¢«åœæ¢ï¼Œå¹¶é‡æ–°å¼€å§‹æ–°çš„索引进程。" -"- Click on any of the time parts to increase it","- 点击时间的任何部分å³å¯æ›´æ”¹" -"- Hold mouse button on any of the above buttons for faster selection.","- åœ¨ä»»ä½•æŒ‰é’®ä¸ŠæŒ‰ä¸‹é¼ æ ‡æŒ‰é”®å³å¯é€‰ä¸ã€‚" -"- Use the %s buttons to select month","- 使用%s 按钮选择月份" -"- Use the %s, %s buttons to select year","- 使用%s,%s按钮选择年份" -"- or Shift-click to decrease it","- 或Shift-点击以å‡å°" -"- or click and drag for faster selection.","- 或点击并拖拽以快速选ä¸ã€‚" -"-- Not Selected --","-- 未选择 --" -"-- Please Select --","-- 请选择 --" -"-- Please Select Billing Agreement--","-- 请选择记账åè®® --" -"-- Please Select a Category --","-- 请选择一个分类 --" -"-- Please select --","--请选择--" -"--Please Select--","-- 请选择 --" -"1 Hour","1å°æ—¶" -"1. set up","1.设置" -"12 Hours","12å°æ—¶" -"12h AM/PM","21h AM/PM" -"2 Hours","2å°æ—¶" -"2. customize","2.定制" -"24 Hours","24å°æ—¶" -"24h","24h" -"2YTD","2YTD" -"6 Hours","6å°æ—¶" -"<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>","<h1 class=""page-heading"">404 错误</h1><p>页颿œªæ‰¾åˆ°ã€‚</p>" -"<strong>Attention</strong>: Captcha is case sensitive.","<strong>注æ„</strong>:验è¯ç 为大å°å†™æ•感的。" -"A user with the same user name or email aleady exists.","使用相åŒå称或邮件地å€çš„用户已å˜åœ¨ã€‚" -"API Key","API Key" -"API Key Confirmation","API Keyé…ç½®" -"ASCII","ASCII" -"Abandoned Carts","放弃è´ç‰©è½¦" -"About the calendar","关于日历" -"Access Denied","访问被拒ç»" -"Access denied","访问被拒ç»" -"Access denied.","访问被拒ç»" -"Account Created in:","叿ˆ·åˆ›å»ºäºŽï¼š" -"Account Created on (%s):","叿ˆ·åˆ›å»ºäºŽï¼ˆ%s):" -"Account Created on:","叿ˆ·åˆ›å»ºäºŽï¼š" -"Account Information","叿ˆ·ä¿¡æ¯" -"Account Status","叿ˆ·çжæ€" -"Account status","叿ˆ·çжæ€" -"Action","æ“作" -"Actions","æ“作" -"Actions XML","æ“作XML" -"Active","活动" -"Add","æ·»åŠ " -"Add Exception","æ·»åŠ ä¾‹å¤–" -"Add Field Mapping","æ·»åŠ å—æ®µæ˜ å°„" -"Add Field with URL:","æ·»åŠ å¸¦URLçš„å—æ®µï¼š" -"Add New","æ·»åŠ æ–°å†…å®¹" -"Add New Image","æ·»åŠ æ–°å›¾åƒ" -"Add New Profile","æ·»åŠ æ–°é…置文件" -"Add New Role","æ·»åŠ æ–°è§’è‰²" -"Add New Template","æ·»åŠ æ–°æ¨¡æ¿" -"Add New URL Rewrite","æ·»åŠ æ–°URLé‡å†™" -"Add New User","æ·»åŠ æ–°ç”¨æˆ·" -"Add New Variable","æ·»åŠ æ–°å˜é‡" -"Add Products","æ·»åŠ äº§å“" -"Add URL Rewrite","æ·»åŠ URLé‡å†™" -"Add URL Rewrite for a Category","ä¸ºåˆ†ç±»æ·»åŠ URLé‡å†™" -"Add URL Rewrite for a Product","ä¸ºäº§å“æ·»åŠ URLé‡å†™" -"Add after","éšåŽæ·»åŠ " -"Additional Cache Management","é¢å¤–的缓å˜ç®¡ç†" -"Address Type:","地å€ç±»åž‹ï¼š" -"Admin","管ç†å‘˜" -"Advanced Admin Section","高级管ç†åŒºåŸŸ" -"Advanced Profiles","高级é…置文件" -"Advanced Section","高级区域" -"All","全部" -"All Allowed Countries","所有å…许的国家" -"All Cache","所有缓å˜" -"All Files","所有文件" -"All Reviews","所有评测" -"All Store Views","所有店铺视图" -"All Tags","æ‰€æœ‰æ ‡ç¾" -"All Websites","所有网站" -"All countries","所有国家" -"All fields","æ‰€æœ‰å—æ®µ" -"All possible rates were fetched, please click on ""Save"" to apply","å°†è‡ªåŠ¨èŽ·å–æ‰€æœ‰å¯èƒ½çš„费率,请å•击“ä¿å˜â€ä»¥åº”用" -"All rates were fetched, please click on ""Save"" to apply","所有费率已获å–,请å•击“ä¿å˜â€å·²åº”用" -"All valid rates have been saved.","所有有效的评级å‡å·²ä¿å˜ã€‚" -"Always (during development)","总是(在开å‘过程ä¸ï¼‰" -"Amounts","æ•°é‡" -"An error has occurred while syncronizing media storages.","åŒæ¥åª’体å˜å‚¨æ—¶é‡åˆ°äº†é”™è¯¯ã€‚" -"An error occurred while clearing the JavaScript/CSS cache.","清空 JavaScript/CSS ç¼“å˜æ—¶å‘生错误。" -"An error occurred while clearing the image cache.","清空图åƒç¼“å˜æ—¶å‘生错误。" -"An error occurred while deleting URL Rewrite.","åˆ é™¤ URL é‡å†™æ—¶å‡ºé”™ã€‚" -"An error occurred while deleting email template data. Please review log and try again.","åˆ é™¤ç”µåé‚®ä»¶æ¨¡æ¿æ•°æ®æ—¶å‘生错误。请查看日志并é‡è¯•。" -"An error occurred while deleting record(s).","åˆ é™¤è®°å½•æ—¶å‡ºé”™ã€‚" -"An error occurred while deleting this role.","åˆ é™¤è¯¥è§’è‰²æ—¶å‘生错误。" -"An error occurred while deleting this set.","åˆ é™¤è¯¥é›†åˆæ—¶å‘生错误。" -"An error occurred while deleting this template.","åˆ é™¤è¯¥æ¨¡æ¿æ—¶å‘生错误。" -"An error occurred while finishing process. Please refresh the cache","完æˆè¿›ç¨‹æ—¶å‘生错误。请刷新缓å˜" -"An error occurred while rebuilding the CatalogInventory Stock Status.","é‡å»ºç›®å½•库å˜çŠ¶æ€æ—¶å‘生错误。" -"An error occurred while rebuilding the catalog index.","é‡å»ºç›®å½•索引时å‘生错误。" -"An error occurred while rebuilding the flat catalog category.","é‡å»ºå¹³é¢ç›®å½•类别时å‘生错误。" -"An error occurred while rebuilding the flat product catalog.","é‡å»ºå¹³é¢äº§å“目录时å‘生错误。" -"An error occurred while rebuilding the search index.","é‡å»ºæœç´¢ç´¢å¼•æ—¶å‘生错误。" -"An error occurred while refreshing the Catalog Rewrites.","刷新目录é‡å†™æ—¶å‘生错误。" -"An error occurred while refreshing the Layered Navigation indices.","åˆ·æ–°åˆ†å±‚å¯¼èˆªæŒ‡æ ‡æ—¶å‘生错误。" -"An error occurred while refreshing the catalog rewrites.","刷新目录é‡å†™æ—¶é‡åˆ°äº†é”™è¯¯ã€‚" -"An error occurred while refreshing the layered navigation indices.","刷新层次å¼å¯¼èˆªç´¢å¼•æ—¶é‡åˆ°äº†é”™è¯¯ã€‚" -"An error occurred while saving URL Rewrite.","ä¿å˜ URL é‡å†™æ—¶å‡ºé”™ã€‚" -"An error occurred while saving account.","ä¿å˜è´¦æˆ·æ—¶å‘生错误。" -"An error occurred while saving review.","ä¿å˜è¯„价时出错。" -"An error occurred while saving the customer.","ä¿å˜å®¢æˆ·æ—¶å‘生错误。" -"An error occurred while saving this configuration:","ä¿å˜è¯¥é…置时å‘生错误:" -"An error occurred while saving this role.","ä¿å˜è¯¥è§’色时出现了错误。" -"An error occurred while saving this template.","ä¿å˜è¯¥æ¨¡æ¿æ—¶å‡ºçŽ°äº†é”™è¯¯ã€‚" -"An error occurred while updating the selected review(s).","更新所选评测时出现了错误。" -"Any","ä»»æ„" -"Any Attribute Set","任何属性集" -"Any Group","任何组" -"Any Status","任何状æ€" -"Any Store","任何店铺" -"Any Type","任何类型" -"Any Visibility","任何å¯è§æ€§" -"Any data created since the backup was made will be lost including admin users, customers and orders.","备份完æˆåŽåˆ›å»ºçš„任何数æ®éƒ½å°†ä¸¢å¤±ï¼ŒåŒ…括管ç†å‘˜ç”¨æˆ·ã€é¡¾å®¢ï¼Œä»¥åŠè®¢å•。" -"Archive file name:","å˜æ¡£æ–‡ä»¶å:" -"Are you sure that you want to delete this template?","您是å¦ç¡®è®¤è¦åˆ 除该模æ¿ï¼Ÿ" -"Are you sure that you want to strip tags?","您是å¦ç¡®è®¤è¦å–æ¶ˆæ ‡ç¾ï¼Ÿ" -"Are you sure you want to do this?","您是å¦ç¡®è®¤è¦è¿™æ ·åšï¼Ÿ" -"Are you sure you want to proceed?","ä½ æ˜¯å¦ç¡®å®šè¦ç»§ç»ï¼Ÿ" -"Area","区域" -"As low as:","低至:" -"Assigned","已分é…" -"Tags","已分é…çš„æ ‡ç¾" -"Attribute Set Name:","属性集å称:" -"Attributes","属性" -"Automatic","自动" -"Average","å¹³å‡è®¢å•é‡" -"Average Orders","å¹³å‡è®¢å•" -"BINARY","二进制" -"Back","返回" -"Back to Login","返回到登录界é¢" -"Backup","备份" -"Backup Name","备份åç§°" -"Backup options","备份选项" -"Backups","备份" -"Base currency","基本汇率" -"Bcc","Bcc" -"Bestsellers","最佳销é‡" -"Billing Address","è´¦å•地å€" -"Billing Address: ","è´¦å•地å€ï¼š" -"Billing Agreement","è®°è´¦åè®®" -"Billing Agreements","è®°è´¦åè®®" -"Block Information","å—ä¿¡æ¯" -"Both (without and with tax)","都有(å«ç¨Žå’Œä¸å«ç¨Žï¼‰" -"Both IPN and PDT","IPNå’ŒPDT" -"Browse Files...","æµè§ˆæ–‡ä»¶..." -"Bundle with dynamic pricing cannot include custom defined options. Options will not be saved.","与动æ€ä»·æ ¼çš„æ†ç»‘ä¸èƒ½åŒ…å«è‡ªå®šä¹‰çš„é€‰é¡¹ã€‚é€‰é¡¹å°†æ— æ³•ä¿å˜ã€‚" -"CMS","CMS" -"CRITICAL","é‡è¦" -"CSV","CSV" -"CSV / Tab separated","CSV / Tab分隔" -"Cache Control","ç¼“å˜æŽ§åˆ¶" -"Cache Control (beta)","ç¼“å˜æŽ§åˆ¶ï¼ˆæµ‹è¯•ç‰ˆï¼‰" -"Cache Management","缓å˜ç®¡ç†" -"Cache Type","缓å˜ç±»åž‹" -"Cancel","å–æ¶ˆ" -"Cannot add new comment.","æ— æ³•æ·»åŠ æ–°è¯„è®ºã€‚" -"Cannot add tracking number.","æ— æ³•è¿½è¸ªç¼–å·ã€‚" -"Cannot create an invoice without products.","æ— æ³•åœ¨æ²¡æœ‰äº§å“æ—¶åˆ›å»ºå‘票。" -"Cannot create credit memo for the order.","æ— æ³•ä¸ºè¯¥è®¢å•创建信用记录。" -"Cannot delete the design change.","æ— æ³•åˆ é™¤è¯¥è®¾è®¡å˜åŠ¨ã€‚" -"Cannot delete tracking number.","æ— æ³•åˆ é™¤è¿½è¸ªç¼–å·ã€‚" -"Cannot do shipment for the order separately from invoice.","æ— æ³•å°†äº§å“与å‘票分开å‘é€ã€‚" -"Cannot do shipment for the order.","æ— æ³•å¯¹è¯¥è®¢å•å‘货。" -"Cannot initialize shipment for adding tracking number.","æ— æ³•åˆå§‹åŒ–订å•ä»¥æ·»åŠ è¿½è¸ªç¼–å·ã€‚" -"Cannot initialize shipment for delete tracking number.","æ— æ³•åˆå§‹åŒ–å‘è´§ä»¥åˆ é™¤è¿½è¸ªç¼–å·ã€‚" -"Cannot load track with retrieving identifier.","æ— æ³•ç”¨èŽ·å–çš„æ ‡è¯†ç¬¦åŠ è½½è¿½è¸ªã€‚" -"Cannot retrieve tracking number detail.","æ— æ³•èŽ·å–追踪编å·è¯¦æƒ…。" -"Cannot save shipment.","æ— æ³•ä¿å˜è¿é€ã€‚" -"Cannot save the credit memo.","æ— æ³•ä¿å˜ä¿¡ç”¨è®°å½•。" -"Cannot send shipment information.","æ— æ³•å‘é€è¿è¡Œä¿¡æ¯ã€‚" -"Cannot update item quantity.","æ— æ³•æ›´æ–°å•†å“æ•°é‡ã€‚" -"Cannot update the item\'s quantity.","æ— æ³•æ›´æ–°å•†å“的数é‡ã€‚" -"Catalog","分类" -"Catalog Price Rules","åˆ†ç±»ä»·æ ¼è§„åˆ™" -"Catalog Rewrites","分类é‡å†™" -"Categories","分类" -"Category:","分类:" -"Chart is disabled. If you want to enable chart, click <a href=""%s"">here</a>.","图表被ç¦ç”¨ã€‚如果希望å¯ç”¨å›¾è¡¨ï¼Œè¯·ç‚¹å‡» <a href=""%s"">这里</a>。" -"Checkbox","å¤é€‰æ¡†" -"Child Transactions","å交易" -"Choose Store View:","选择店铺视图:" -"Choose an attribute","选择一个属性" -"Chosen category does not associated with any website, so url rewrite is not possible.","所选分类没有关è”ç»™ä»»ä½•ç½‘ç«™ï¼Œå› æ¤URLé‡å†™ä¸å¯ç”¨ã€‚" -"Chosen product does not associated with any website, so url rewrite is not possible.","æ‰€é€‰äº§å“æ²¡æœ‰å…³è”ç»™ä»»ä½•ç½‘ç«™ï¼Œå› æ¤URLé‡å†™ä¸å¯ç”¨ã€‚" -"Clear","清空" -"Close","å…³é—" -"Comment text field cannot be empty.","è¯„è®ºæ–‡æœ¬å—æ®µä¸èƒ½ä¸ºç©ºã€‚" -"Complete","完æˆ" -"Configuration","é…ç½®" -"Confirm New Password","确认新密ç " -"Confirmed email:","确认邮件:" -"Connect with the Magento Community","连接到Magento社区" -"Continue","ç»§ç»" -"Continuous","连ç»" -"Convert to Plain Text","转æ¢ä¸ºçº¯æ–‡æœ¬" -"Cookie (unsafe)","Cookie(ä¸å®‰å…¨ï¼‰" -"Country","国家" -"Country:","国家:" -"Coupons","折价券" -"Create","创建" -"Create DB Backup","创建DB备份" -"Create New Attribute","新建属性" -"Create URL Rewrite:","创建URLé‡å†™ï¼š" -"Created At","创建于" -"Credit Card %s","ä¿¡ç”¨å¡ %s" -"Credit Memo History","信用记录历å²" -"Credit Memo Totals","信用记录总数" -"Credit Memos","信用记录" -"Credit memo #%s comment added","信用记录 #%s è¯„è®ºå·²æ·»åŠ " -"Credit memo #%s created","信用记录 #%s 已创建" -"Credit memo\'s total must be positive.","ä¿¡ç”¨è®°å½•çš„æ€»æ•°å¿…é¡»ä¸ºæ£æ•°ã€‚" -"Currency","å¸ç§" -"Currency ""%s"" is used as %s in %s.","è´§å¸ ""%s"" 被用作 %s ä¸çš„ %s。" -"Currency Information","å¸ç§ä¿¡æ¯" -"Currency Setup Section","å¸ç§è®¾ç½®åŒºåŸŸ" -"Current Configuration Scope:","当å‰é…置范围:" -"Current Month","当剿œˆä»½" -"Custom","自定义" -"Custom Variable ""%s""","自定义å˜é‡ ""%s""" -"Custom Variables","自定义å˜é‡" -"Customer","客户" -"Customer Group:","顾客组:" -"Customer Groups","客户组" -"Customer","顾客姓å" -"Customer Reviews","顾客评测" -"Customer Shopping Carts","顾客è´ç‰©è½¦" -"Customer Since:","顾客注册于:" -"Customer Tax Classes","客户税率" -"Customer with the same email already exists.","使用相åŒé‚®ä»¶åœ°å€çš„顾客已å˜åœ¨ã€‚" -"Customers","客户" -"Customers by Orders","按订å•ç¼–å·æŽ’åˆ—é¡¾å®¢" -"Customers by Orders Total","æŒ‰è®¢å•æ•°é‡æŽ’列顾客" -"DHTML Date/Time Selector","DHTML 日期/时间选择器" -"Dashboard","仪表æ¿" -"Data Format","æ•°æ®æ ¼å¼" -"Data transfer:","æ•°æ®ä¼ 输:" -"Database","æ•°æ®åº“" -"Date","日期" -"Date & Time","日期与时间" -"Added","æ·»åŠ æ—¥æœŸ" -"Updated","更新日期" -"Date selection:","选择日期:" -"Date selector","日期选择器" -"Day","天" -"Decimal separator:","å进制分隔符:" -"Default (Admin) Values","默认(管ç†ï¼‰å€¼" -"Default Billing Address","默认账å•地å€" -"Default Config","默认é…ç½®" -"Default Template from Locale","ä¸åŒåœ°åŒºçš„默认模æ¿" -"Default Values","默认值" -"Default display currency ""%s"" is not available in allowed currencies.","默认显示的å¸ç§ ""%s"" ä¸å±žäºŽå…许使用的å¸ç§ã€‚" -"Default scope","默认范围" -"Delete","åˆ é™¤" -"Delete %s","è¨å“ˆæ‹¿å‡º %s" -"Delete %s '%s'","åˆ é™¤ %s '%s'" -"Delete File","åˆ é™¤æ–‡ä»¶" -"Delete Image","åˆ é™¤å›¾åƒ" -"Delete Profile","åˆ é™¤é…置文件" -"Delete Role","åˆ é™¤è§’è‰²" -"Delete Store","åˆ é™¤åº—é“º" -"Delete Store View","åˆ é™¤åº—é“ºè§†å›¾" -"Delete Template","åˆ é™¤æ¨¡æ¿" -"Delete User","åˆ é™¤ç”¨æˆ·" -"Delete Website","åˆ é™¤ç½‘ç«™" -"Description","æè¿°" -"Design","设计" -"Design Section","设计区域" -"Details","详情" -"Developer Section","å¼€å‘人员区域" -"Direction:","指导:" -"Disable","ç¦ç”¨" -"Disabled","å·²ç¦ç”¨" -"Display %s first","æ˜¾ç¤ºå‰ %s个" -"Display default currency","显示默认å¸ç§" -"Distributed under GNU LGPL. See %s for details.","在GNU LGPL下分å‘。详情请å‚考 %s。" -"Do you really want to KILL parallel process and start new indexing process?","æ‚¨æ˜¯å¦æƒ³è¦ç»“æŸå¹¶å‘è¿›ç¨‹å¹¶é‡æ–°å¼€å§‹ç´¢å¼•进程?" -"Do you really want to proceed?","ä½ æ˜¯å¦çœŸçš„è¦ç»§ç»ï¼Ÿ" -"Download","下载" -"Downloads","下载" -"Drag to move","拖拽以移动" -"Drop-down","下拉èœå•" -"Edit","编辑" -"Edit Design Change","编辑设计å˜åЍ" -"Edit Email Template","编辑邮件模æ¿" -"Edit Order","编辑订å•" -"Edit Poll","编辑投票" -"Edit Queue","编辑队列" -"Edit Review","编辑评测" -"Edit Role","编辑角色" -"Edit Store View","编辑店铺视图" -"Edit System Template","编辑系统模æ¿" -"Edit Template","编辑模æ¿" -"Edit URL Rewrite","编辑URLé‡å†™" -"Edit User","编辑用户" -"Edit User '%s'","编辑用户'%s'" -"Edit Website","编辑网站" -"Email","电å邮件" -"Email Address:","电å邮件地å€ï¼š" -"Email Preview","邮件预览" -"Email to a Friend","给朋å‹å‘邮件" -"Email:","电å邮件:" -"Enable","å¯ç”¨" -"Enabled","å·²å¯ç”¨" -"Enclose Values In:","将值包å«äºŽï¼š" -"Entity Attributes","编辑属性" -"Entity Type","实体类型" -"Entity type:","实体类型:" -"Error","错误" -"Excel XML","Excel XML" -"Excl. Tax","ä¸å«ç¨Ž" -"Exclude media folder from backup","ä»Žå¤‡ä»½ä¸æŽ’é™¤åª’ä½“æ–‡ä»¶å¤¹" -"Export","导出" -"Export CSV","导出CSV" -"Export Filters","导出ç›é€‰å™¨" -"Export to:","导出到:" -"Export:","导出:" -"FTP Host","FTP 主机" -"FTP Host[:Port]","FTP主机[:端å£]" -"FTP Login","FTP 登录" -"FTP Password","FTP密ç " -"FTP credentials","FTP 凿®" -"Failed to add a product to cart by id ""%s"".","æŒ‰ç…§ç¼–å· ""%s"" å‘è´ç‰©è½¦æ·»åР商哿—¶å¤±è´¥ã€‚" -"Failed to cancel the billing agreement.","å–æ¶ˆè®°è´¦å议时出错。" -"Failed to clear the JavaScript/CSS cache.","清空JavaScript/CSSç¼“å˜æ—¶å‡ºé”™ã€‚" -"Failed to delete the billing agreement.","åˆ é™¤è®°è´¦å议时出错。" -"Failed to update the profile.","æ›´æ–°é…置文件时出错。" -"Field","å—æ®µ" -"Field Mapping","å—æ®µæ˜ å°„" -"File","文件" -"File Information","文件信æ¯" -"File System","文件系统" -"File mode","文件模å¼" -"File name:","文件å:" -"File size should be more than 0 bytes","文件大å°åº”超过0å—节。" -"Finished profile execution.","é…置文件执行完毕。" -"First Invoice Created Date","ç¬¬ä¸€å¼ å‘票的创建日期" -"First Name","åå—" -"First Name is required field.","å称是必è¦å—段。" -"First Name:","åå—:" -"Fixed","固定" -"Flush Catalog Images Cache","清ç†åˆ†ç±»å›¾åƒç¼“å˜" -"Flush JavaScript/CSS Cache","清ç†JavaScript/CSS缓å˜" -"For category","分类" -"For latest version visit: %s","最新版访问:%s" -"For product","产å“" -"Forgot Admin Password","忘记管ç†å‘˜å¯†ç " -"Forgot your password?","忘记您的密ç ?" -"Forgot your user name or password?","å¿˜è®°äº†æ‚¨çš„ç”¨æˆ·åæˆ–密ç ?" -"From","æ¥è‡ª" -"GLOBAL","全局" -"Gb","Gb" -"General Information","常规信æ¯" -"General Section","常规区域" -"Get Image Base64","获å–Image Base64" -"Get help for this page","获得有关本页é¢çš„帮助" -"Global Attribute","全局属性" -"Global Record Search","全局记录æœç´¢" -"Global Search","全局æœç´¢" -"Go Today","转到今天" -"Go to messages inbox","è¿›å…¥ä¿¡æ¯æ”¶ä»¶ç®±" -"Go to notifications","打开通知" -"Google Base","Google Base" -"Google Sitemaps","Google站点结构图" -"Grand Total","总计" -"Grid (default) / List","ç½‘æ ¼ï¼ˆé»˜è®¤ï¼‰/列表" -"Grid Only","ä»…ç½‘æ ¼" -"Group:","组:" -"Guest","æ¥å®¾" -"HTTP (unsecure)","HTTP(ä¸å®‰å…¨ï¼‰" -"HTTPS (SSL)","HTTPS(SSL)" -"Help Us Keep Magento Healthy - Report All Bugs","å¸®åŠ©æˆ‘ä»¬ä¿æŒMagentoçš„å¥åº· - 汇报所有Bug" -"Helper attributes should not be used in custom layout updates.","自定义布局更新时ä¸èƒ½ä½¿ç”¨ Helper 属性。" -"Helper for options rendering doesn't implement required interface.","渲染选项的 Helper æ— æ³•åœ¨ä¸ä½¿ç”¨ç•Œé¢æ—¶å®žæ–½ã€‚" -"Home","主页" -"ID","ID" -"ID Path","ID路径" -"IP Address","IP地å€" -"IPN (Instant Payment Notification) Only","ä»…IPNï¼ˆå³æ—¶æ”¯ä»˜é€šçŸ¥ï¼‰" -"If there is an account associated with %s you will receive an email with a link to reset your password.","如果有关è”ç»™ %s çš„è´¦æˆ·ï¼Œä½ å°†æ”¶åˆ°ä¸€å°åŒ…å«é‡è®¾å¯†ç 链接的电å邮件。" -"If this message persists, please contact the store owner.","å¦‚æžœè¯¥ä¿¡æ¯æŒç»æ˜¾ç¤ºï¼Œè¯·è”系店铺所有者。" -"Images (.gif, .jpg, .png)","图åƒï¼ˆ.gifã€.jpgã€.png)" -"Images Cache","图åƒç¼“å˜" -"Import","导入" -"Import Service","导入æœåŠ¡" -"Import and Export","导入和导出" -"Import and Export Tax Rates","导入和导出税率" -"Import/Export","导入/导出" -"Import/Export Advanced","高级导入/导出" -"Import/Export Profile","导入/导出é…置文件" -"Important: ","é‡è¦ï¼š" -"Imported <strong>%s</strong> records","导入<strong>%s</strong> 的记录" -"In","ä½äºŽ" -"In Database:","在数æ®åº“:" -"In File:","在文件:" -"Inactive","未激活" -"Incl. Tax","å«ç¨Ž" -"Incoming Message","收到的信æ¯" -"Insert Variable...","æ’å…¥å˜é‡..." -"Interactive","交互" -"Interface Locale: %s","界é¢åŒºåŸŸï¼š%s" -"Invalid Form Key. Please refresh the page.","æ¥æºå¯†é’¥æ— 效,请刷新本页é¢ã€‚" -"Invalid Import Service Specified","指定的导入æœåŠ¡æ— æ•ˆã€‚" -"Invalid POST data (please check post_max_size and upload_max_filesize settings in your php.ini file).","POSTæ•°æ®æ— 效(请检查您php.ini文件ä¸çš„ post_max_size 与 upload_max_filesize 设置)。" -"Invalid Secret Key. Please refresh the page.","å¯†é’¥æ— æ•ˆã€‚è¯·åˆ·æ–°è¯¥é¡µé¢ã€‚" -"Invalid User Name or Password.","æ— æ•ˆçš„ç”¨æˆ·åæˆ–密ç 。" -"Invalid directory: %s","æ— æ•ˆç›®å½•ï¼š%s" -"Invalid email address ""%s"".","电åé‚®ä»¶åœ°å€ ""%s"" æ— æ•ˆã€‚" -"Invalid email address.","é‚®ä»¶åœ°å€æ— 效。" -"Invalid file: %s","æ— æ•ˆæ–‡ä»¶ï¼š%s" -"Invalid input data for %s => %s rate","%sçš„è¾“å…¥æ•°æ®æ— 效 => %s" -"Invalid parent block for this block","该å—çš„çˆ¶å—æ— 效" -"Invalid parent block for this block.","本å—çš„çˆ¶å—æ— 效。" -"Invalid password reset token.","æ— æ•ˆçš„å¯†ç é‡è®¾ä»¤ç‰Œã€‚" -"Invalid sender name ""%s"". Please use only visible characters and spaces.","å‘逿–¹å§“å ""%s"" æ— æ•ˆã€‚è¯·åªä½¿ç”¨å¯è§å—ç¬¦ä¸Žç©ºæ ¼ã€‚" -"Invalid timezone","æ—¶åŒºæ— æ•ˆ" -"Invalidated","撤销" -"Inventory Stock Status","盘点库å˜çжæ€" -"Invoice #%s comment added","å‘票 #%sçš„è¯„è®ºå·²æ·»åŠ " -"Invoice #%s created","å‘票 #%s 已创建" -"Invoice History","å‘票历å²" -"Invoice Totals","å‘票总数" -"Invoice canceling error.","å‘ç¥¨å–æ¶ˆæ—¶å‡ºé”™ã€‚" -"Invoice capturing error.","å‘票获å–出错。" -"Invoice voiding error.","å‘票撤销出错。" -"Invoices","å‘票" -"Is Closed","已关é—" -"Issue Number","问题编å·" -"Items","项目" -"JavaScript seems to be disabled in your browser.","ä½ çš„æµè§ˆå™¨ä¼¼ä¹Žç¦ç”¨äº† JavaScript。" -"JavaScript/CSS","JavaScript/CSS" -"JavaScript/CSS Cache","JavaScript/CSS缓å˜" -"Kb","Kb" -"Last 24 Hours","过去24å°æ—¶" -"Last 5 Orders","上五个订å•" -"Last 5 Search Terms","上五个æœç´¢æ¡ä»¶" -"Last 7 Days","上七天" -"Last Credit Memo Created Date","上次信用记录创建日期" -"Last Invoice Created Date","上一个å‘票创建日期" -"Last Logged In (%s):","上次登录于(%s):" -"Last Logged In:","上次登录:" -"Last Name","å§“æ°" -"Last Name is required field.","å§“æ°æ˜¯å¿…è¦å—段。" -"Last Name:","å§“æ°ï¼š" -"Last updated: %s. To refresh last day\'s <a href=""%s"">statistics</a>, click <a href=""%s"">here</a>.","上次更新: %s。è¦åˆ·æ–°æœ€æ–°ä¸€å¤©çš„ <a href=""%s"">状æ€</a>,请点击<a href=""%s"">这里</a>。" -"Latest Message:","最新信æ¯ï¼š" -"Layered Navigation Indices","层次å¼å¯¼èˆªç›®å½•" -"Layered Navigation Indices were refreshed.","层次å¼å¯¼èˆªç›®å½•å·²æ¢å¤ã€‚" -"Leave empty to use tax identifier","留空å³å¯ä½¿ç”¨ä¼ çœŸæ ‡è¯†ç¬¦" -"Lifetime Sales","终生销售" -"Lifetime statistics have been updated.","有效期状æ€å·²æ›´æ–°ã€‚" -"Links","链接" -"Links with associated products will retain only after saving current product.","å…³è”产å“çš„é“¾æŽ¥åªæœ‰åœ¨ä¿å˜å½“å‰äº§å“åŽæ‰èƒ½ç»´æŒã€‚" -"List (default) / Grid","列表(默认)/ç½‘æ ¼" -"List Only","仅列表" -"Load Template","åŠ è½½æ¨¡æ¿" -"Load default template","åŠ è½½é»˜è®¤æ¨¡æ¿" -"Loading...","æ£åœ¨åŠ è½½..." -"Local Server","本地æœåС噍" -"Local/Remote Server","本地/远程æœåС噍" -"Locale","区域" -"Log Out","注销" -"Log in to Admin Panel","登录到管ç†é¢æ¿" -"Log into Magento Admin Page","登录到Magento管ç†é¡µé¢" -"Logged in as %s","登录为 %s" -"Login","登录" -"Low Stock","库å˜é‡ä½Ž" -"MAJOR","主è¦" -"MINOR","å°‘é‡" -"MS Excel XML","MS Excel XML" -"Magento Admin","Magento管ç†" -"Magento Commerce - Administrative Panel","Magento Commerce - 管ç†é¢æ¿" -"Magento Connect","Magento内容" -"Magento Connect Manager","Magento连接管ç†å™¨" -"Magento Logo","Magentoå¾½æ ‡" -"Magento is a trademark of X.commerce, Inc. Copyright © %s X.commerce, Inc.","Magento是X.commerce, Inc.çš„å•†æ ‡ï¼Œ Copyright © %s X.commerce, Inc." -"Magento root directory","Magento æ ¹ç›®å½•" -"Magento ver. %s","Magento ver.%s" -"Magento® is a trademark of X.commerce, Inc.<br/>Copyright © %s X.commerce, Inc.","Magento® 是X.commerce, Inc.çš„å•†æ ‡<br/>Copyright © %s X.commerce, Inc." -"Make sure that data encoding in the file is consistent and saved in one of supported encodings (UTF-8 or ANSI).","ç¡®ä¿è¯¥å—æ®µç¼–ç æ–¹å¼çš„ä¸€è‡´ï¼Œå¹¶ä½¿ç”¨å¯æ”¯æŒçš„ç¼–ç æ–¹å¼ä¿å˜ï¼ˆUTF-8或ANSI)。" -"Manage Attribute Sets","管ç†å±žæ€§é›†" -"Manage Attributes","管ç†å±žæ€§" -"Manage Categories","管ç†åˆ†ç±»" -"Manage Content","管ç†å†…容" -"Manage Currency Rates","ç®¡ç†æ±‡çއ" -"Manage Customers","管ç†å®¢æˆ·" -"Manage Ratings","管ç†è¯„级" -"Manage Stores","管ç†åº—铺" -"Manage Tax Rules","管ç†ç¨ŽåŠ¡è§„åˆ™" -"Manage Tax Zones and Rates","管ç†ç¨ŽåŠ¡åŒºåŸŸä¸Žç¨ŽçŽ‡" -"Manual","手工" -"Matched Expression","匹é…的表达å¼" -"Mb","Mb" -"Media (.avi, .flv, .swf)","多媒体(.aviã€.flvã€.swf)" -"Media storages synchronization has completed!","媒体å˜å‚¨çš„åŒæ¥å·²å®Œæˆï¼" -"Messages Inbox","æ”¶ä»¶ç®±" -"Month","月" -"Most Viewed","æœ€å—æ¬¢è¿Ž" -"Most Viewed Products","最å—关注商å“" -"Multiple Select","多选" -"My Account","æˆ‘çš„å¸æˆ·" -"N/A","N/A" -"NOTICE","注æ„" -"Name","å§“å" -"Name:","å§“å:" -"Never (production)","从未(生产)" -"New ","æ–°" -"New API Key","æ–°API Key" -"New Accounts","æ–°å¸æˆ·" -"New Attribute","新属性" -"New Block","æ–°å—" -"New Category","新分类" -"New Class","æ–°ç±»" -"New Condition","æ–°æ¡ä»¶" -"New Custom Variable","新自定义å˜é‡" -"New Customer","新顾客" -"New Customers","新客户" -"New Design Change","新设计å˜åЍ" -"New Email Template","新组" -"New Group","新组" -"New Invoice","æ–°å‘票" -"New Item Type","新项目类型" -"New Memo","新纪录" -"New Memo for #%s","#%s的新纪录" -"New Page","新页é¢" -"New Password","新密ç " -"New Poll","新投票" -"New Profile","æ–°é…置文件" -"New Rate","新比例" -"New Rating","新评级" -"New Review","新评测" -"New Role","新角色" -"New Rule","新规则" -"New Search","æ–°æœç´¢" -"New Set","新集" -"New Shipment","æ–°è¿å•" -"New Sitemap","新站点结构图" -"New Store View","新店铺视图" -"New System Template","新系统模æ¿" -"New Tag","æ–°æ ‡ç¾" -"New Template","新模æ¿" -"New User","新用户" -"New Variable","æ–°å˜é‡" -"New Website","新网站" -"New password field cannot be empty.","新密ç å—æ®µä¸èƒ½ä¸ºç©ºã€‚" -"Newsletter","新闻邮件" -"Newsletter Problems","新闻邮件问题" -"Newsletter Queue","新闻邮件队列" -"Newsletter Subscribers","新闻邮件订阅者" -"Newsletter Templates","新闻邮件模æ¿" -"Next month (hold for menu)","ä¸‹ä¸ªæœˆï¼ˆæŒ‰ä¸‹å¯æ‰“å¼€èœå•)" -"Next year (hold for menu)","æ˜Žå¹´ï¼ˆæŒ‰ä¸‹å¯æ‰“å¼€èœå•)" -"No","å¦" -"No (price without tax)","æ— ï¼ˆä¸å«ç¨Žä»·æ ¼ï¼‰" -"No Data","æ— æ•°æ®" -"No Data Found","æ•°æ®æœªæ‰¾åˆ°" -"No Templates Found","æ¨¡æ¿æœªæ‰¾åˆ°" -"No change","æ— å˜åЍ" -"No customer id defined.","未定义自定义 ID。" -"No information available.","æ— å¯ç”¨ä¿¡æ¯ã€‚" -"No profile loaded...","æœªåŠ è½½é…置文件..." -"No records found for this period.","这段时期内未找到记录。" -"No records found.","未找到记录。" -"No report code specified.","未指定报告代ç 。" -"No search keywords.","æ— æœç´¢å…³é”®å—。" -"No search modules were registered","未注册æœç´¢æ¨¡å—" -"No wishlist item id defined.","未定义愿望清å•项目 ID。" -"None","æ— " -"Note:","注æ„:" -"Notes","注æ„" -"Notifications","通知" -"Orders","è®¢å•æ•°é‡" -"Uses","用户数" -"Views","æµè§ˆæ•°é‡" -"Number of records:","记录数é‡ï¼š" -"OK","确定" -"Old rate:","原本的比例:" -"One or more media files failed to be synchronized during the media storages syncronization process. Refer to the log file for details.","在媒体å˜å‚¨åŒæ¥è¿‡ç¨‹ä¸ï¼Œæœ‰ä¸€ä¸ªæˆ–å¤šä¸ªåª’ä½“æ–‡ä»¶çš„åŒæ¥å¤±è´¥ã€‚详情请å‚考日志文件。" -"One or more of the Cache Types are invalidated:","一个或多个缓å˜ç±»åž‹å·²å¤±æ•ˆï¼š" -"Online Customers","在线客户" -"Only Once (version upgrade)","仅一次(版本å‡çº§ï¼‰" -"Only attributes with scope ""Global"", input type ""Dropdown"" and Use To Create Configurable Product ""Yes"" are available.","åªæœ‰èŒƒå›´ä¸º ""Global""ã€è¾“入类型为 ""Dropdown"",并“å…许â€ç”¨äºŽåˆ›å»ºå¯é…置产å“的属性å¯ä»¥ä½¿ç”¨ã€‚" -"Only mapped fields","åªæ˜ å°„å—æ®µ" -"Optional","å¯é€‰" -"Options","选项" -"Order","订å•" -"Order %s","订å•# %s" -"Order %s (%s)","è®¢å• #%s(%s)" -"Order Created Date","订å•创建日期" -"Order ID","è®¢å• ID" -"Order Totals","è®¢å•æ€»æ•°" -"Order Updated Date","è®¢å•æ›´æ–°æ—¥æœŸ" -"Order Updated Date report is real-time, does not need statistics refreshing.","è®¢å•æ›´æ–°æ—¥æœŸæŠ¥å‘Šæ˜¯å®žæ—¶çš„,ä¸éœ€è¦åˆ·æ–°çжæ€ã€‚" -"Orders","订å•" -"Original Magento attribute names in first row:","原始Magento属性åä½äºŽç¬¬ä¸€è¡Œï¼š" -"Out of stock","缺货" -"PDT (Payment Data Transfer) Only","ä»…é™PDT(支付数æ®ä¼ 输)" -"Package Extensions","包括扩展" -"Pages","页é¢" -"Parent Product Thumbnail","父产å“缩略图" -"Parent Transaction ID","父交易ID" -"Passive mode","主动模å¼" -"Password","密ç " -"Password Confirmation","密ç 确认" -"Password confirmation must be same as password.","密ç 确认的密ç 必须一致。" -"Password must be at least of %d characters.","密ç 必须至少为 %s 个å—符。" -"Password must include both numeric and alphabetic characters.","密ç å¿…é¡»åŒ…å«æ•°å—å’Œå—æ¯å—符。" -"Password:","密ç :" -"Path:","路径:" -"PayPal Manager","è´å®ç»ç†" -"Payment method instance is not available.","支付方å¼ä¸å¯ç”¨ã€‚" -"Payment method is not available.","支付方法ä¸å¯ç”¨ã€‚" -"Payment method must be specified.","必须指定支付方法。" -"Pending Reviews","挂起的评测" -"Pending Tags","æŒ‚èµ·çš„æ ‡è®°" -"Per Item","æ¯å•†å“" -"Per Order","æ¯è®¢å•" -"Percent","百分之" -"Performed At","执行于" -"Interval","周期" -"Permanent (301)","永久 (301)" -"Permissions","æƒé™" -"Personal Information","个人信æ¯" -"Phone:","电è¯ï¼š" -"Please Select","请选择" -"Please confirm site switching. All data that hasn\'t been saved will be lost.","è¯·ç¡®è®¤ç½‘ç«™å‚æ•°ã€‚所有未ä¿å˜æ•°æ®éƒ½å°†ä¸¢å¤±ã€‚" -"Please enter 6 or more characters.","请输入 6 个或更多个å—符。" -"Please enter a number greater than 0 in this field.","è¯·åœ¨è¯¥å—æ®µä¸è¾“入大于0的数å—。" -"Please enter a valid $ amount. For example $100.00.","请输入有效的金é¢ï¼Œä¾‹å¦‚$100.00。" -"Please enter a valid URL. For example http://www.example.com or www.example.com","请输入有效的URL,例如http://www.example.com 或 www.example.com" -"Please enter a valid URL. http:// is required","请输入有效URL,需è¦åŒ…å« http://" -"Please enter a valid credit card number.","请输入有效的信用å¡å¡å·ã€‚" -"Please enter a valid date.","请输入有效日期" -"Please enter a valid email address. For example johndoe@domain.com.","请输入有效邮件地å€ã€‚例如johndoe@domain.com。" -"Please enter a valid email.","请输入有效邮件。" -"Please enter a valid number in this field.","请在æ¤åŒºåŸŸè¾“入有效的数å—。" -"Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.","请输入有效的电è¯å·ç 。例如 (123) 456-7890 或 123-456-7890。" -"Please enter a valid social security number. For example 123-45-6789.","请输入有效社会安全å·ç ,例如123-45-6789。" -"Please enter a valid value from list","请从列表ä¸è¾“入有效的数值" -"Please enter a valid value, ex: 10,20,30","请输入有效值,例如10ã€20ã€30" -"Please enter a valid zip code.","请输入有效的邮政编ç 。" -"Please enter a valid zip code. For example 90602 or 90602-1234.","请输入有效邮编,例如90602或90602-1234。" -"Please enter another credit card number to complete your purchase.","请输入其他信用å¡å·ç ä»¥å®Œæˆæ‚¨çš„è´ä¹°ã€‚" -"Please enter password","请输入密ç " -"Please enter password to confirm rollback.","请输入密ç 以确认回滚。" -"Please enter valid password.","请输入有效密ç 。" -"Please make sure that all global admin search modules are installed and activated.","è¯·ç¡®ä¿æ‰€æœ‰å…¨çƒç®¡ç†å‘˜æœç´¢æ¨¡å—已安装并已激活。" -"Please make sure that your changes were saved before running the profile.","请确ä¿åœ¨è¿è¡Œä¸ªäººèµ„æ–™å‰ï¼Œæ‚¨çš„æ›´æ”¹å·²ä¿å˜ã€‚" -"Please make sure your passwords match.","请确ä¿å¯†ç 匹é…。" -"Please select State/Province.","请选择州/çœã€‚" -"Please select a customer.","请选择一ä½å®¢æˆ·ã€‚" -"Please select a store.","请选择一个店铺。" -"Please select an option.","请选择一个选项。" -"Please select catalog searches.","请选择类别æœç´¢ã€‚" -"Please select customer(s).","请选择客户。" -"Please select message(s).","请选择信æ¯ã€‚" -"Please select one of the above options.","请选择上列选项ä¸çš„一个。" -"Please select one of the options.","请选择下列一个选项。" -"Please select review(s).","请选择评论。" -"Please select tag(s).","è¯·é€‰æ‹©æ ‡ç¾ã€‚" -"Please specify backup creation options","请指定备份创建选项" -"Please specify the admin custom URL.","请指定管ç†ç”¨çš„自定义URL。" -"Please try to logout and sign in again.","请å°è¯•æ³¨é”€å¹¶é‡æ–°ç™»å½•。" -"Please type the letters from the image:","请输入图åƒä¸çš„å—æ¯ï¼š" -"Please use in this field only ""a-z,0-9,_"".","è¯·åœ¨è¯¥å—æ®µä¸åªä½¿ç”¨ ""a-z,0-9,_""。" -"Please use letters only (a-z) in this field.","请在æ¤åŒºåŸŸä»…ä½¿ç”¨å—æ¯ (a-z)。" -"Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.","è¯·åœ¨è¯¥å—æ®µä¸åªä½¿ç”¨æ•°å—。请ä¸è¦ä½¿ç”¨ç©ºæ ¼æˆ–其它å—符,例如å¥ç‚¹æˆ–逗å·ã€‚" -"Please use only letters (a-z or A-Z), numbers (0-9) or spaces in this field.","在æ¤å—æ®µå†…è¯·ä»…ä½¿ç”¨å—æ¯ï¼ˆaz或AZï¼‰ã€æ•°å—(0-9ï¼‰æˆ–ç©ºæ ¼ã€‚" -"Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.","è¯·åœ¨è¯¥å—æ®µä¸åªä½¿ç”¨å—æ¯ï¼ˆa-z)或数å—(0-9)。ä¸èƒ½ä½¿ç”¨ç©ºæ ¼æˆ–其它å—符。" -"Please use only letters (a-z) or numbers (0-9) or spaces and # only in this field.","请在æ¤åŒºåŸŸä»…ä½¿ç”¨å—æ¯ (a-z) æˆ–æ•°å— (0-9) æˆ–ç©ºæ ¼ä»¥åŠ #。" -"Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.","è¯·ä½¿ç”¨è¿™æ ·çš„æ—¥æœŸæ ¼å¼ï¼šdd/mm/yyyy。例如17/03/2006代表2006å¹´3月17日。" -"Please wait while the indexes are being refreshed.","索引æ£åœ¨åˆ·æ–°ï¼Œè¯·ç‰å¾…。" -"Please wait, loading...","请ç¨å€™ï¼Œæ£åœ¨åŠ è½½..." -"Please wait...","请ç¨å€™..." -"Please, add some answers to this poll first.","è¯·é¦–å…ˆç»™è¯¥æŠ•ç¥¨ä¸æ·»åŠ ä¸€äº›é—®é¢˜ã€‚" -"Please, select ""Visible in Stores"" for this poll first.","请首先为该投票选择 “店铺ä¸å¯è§â€ã€‚" -"Poll Manager","投票管ç†å™¨" -"Polls","投票" -"Popular","æµè¡Œ" -"Position of Watermark for %s","%s 的水å°ä½ç½®" -"Pregenerated product images files.","预先生æˆäº§å“å›¾åƒæ–‡ä»¶ã€‚" -"Prev. month (hold for menu)","上个月(按下èœå•)" -"Prev. year (hold for menu)","åŽ»å¹´ï¼ˆæŒ‰ä¸‹å¯æ‰“å¼€èœå•)" -"Preview","预览" -"Preview Template","预览模æ¿" -"Price","ä»·æ ¼" -"Price alert subscription was saved.","ä»·æ ¼è¦æŠ¥è®¢é˜…å·²ä¿å˜ã€‚" -"Price:","ä»·æ ¼ï¼š" -"Processed <strong>%s%% %s/%d</strong> records","å·²å¤„ç† <strong>%s%% %s/%d</strong> 记录" -"Product","产å“" -"Product","产å“å" -"Product Reviews","产å“评测" -"Product Tax Classes","产å“税率" -"Product Thumbnail Itself","产å“缩略图本身" -"Product is not loaded.","äº§å“æœªè¢«åŠ è½½ã€‚" -"Product:","产å“:" -"Products","产å“" -"Products Bestsellers Report","äº§å“æœ€ä½³é”€é‡æŠ¥å‘Š" -"Products Most Viewed Report","æµè§ˆæœ€å¤šäº§å“报告" -"Products Ordered","产å“已下å•" -"Products in Carts","è´ç‰©è½¦ä¸çš„产å“" -"Profile Action","é…置文件æ“作" -"Profile Actions XML","é…置文件æ“作XML" -"Profile Direction","é…置文件指导" -"Profile History","é…置文件历å²" -"Profile Information","é…置文件信æ¯" -"Profile Name","é…置文件åç§°" -"Profile Payments","é…置文件支付" -"Profile Schedule","é…置文件计划" -"Profile Wizard","é…置文件å‘导" -"Profiles","é…置文件" -"Promo","促销" -"Promotions","促销" -"Purchased Item","å·²è´ä¹°å†…容" -"Put store on the maintenance mode while backup creation","创建备份时,将商店以维护模å¼è¿è¡Œ" -"Put store on the maintenance mode while rollback processing","在进行回滚时将店铺置于维护模å¼" -"Quantity","æ•°é‡" -"Queue Refresh","队列刷新" -"Queued... Cancel","å·²æ·»åŠ é˜Ÿåˆ—...å–æ¶ˆ" -"Radio Buttons","å•选按钮" -"Rates","费率" -"Read details","阅读详情" -"Rebuild","é‡å»º" -"Rebuild Catalog Index","é‡å»ºåˆ†ç±»ç´¢å¼•" -"Rebuild Flat Catalog Category","é‡å»ºå¹³å¦åˆ†ç±»ç±»åˆ«" -"Rebuild Flat Catalog Product","é‡å»ºå¹³å¦åˆ†ç±»äº§å“" -"Recent Orders","近期订å•" -"Recent statistics have been updated.","最近更新的统计信æ¯ã€‚" -"Recurring Profile View","循环é…置文件视图" -"Recursive Dir","递归目录" -"Redirect","é‡å®šå‘" -"Reference","å‚考" -"Reference ID","å‚考ID" -"Refresh","刷新" -"Refresh Now*","立刻刷新*" -"Refresh Statistics","刷新状æ€" -"Region/State","地区/å·ž" -"Regular Price:","å¸¸è§„ä»·æ ¼ï¼š" -"Release","å‘布" -"Release Stability","释放稳定性" -"Release Version","å‘布版本" -"Reload captcha","刷新验è¯ç " -"Remote FTP","远程FTP" -"Remove","åˆ é™¤" -"Reports","报告" -"Request Path","请求路径" -"Required","å¿…é¡»" -"Reset","é‡ç½®çжæ€" -"Reset Filter","é‡ç½®ç›é€‰å™¨" -"Reset Password","é‡è®¾å¯†ç " -"Reset a Password","é‡ç½®å¯†ç " -"Resize","调整大å°" -"Resource Access","资æºè®¿é—®" -"Resources","资æº" -"Results","结果" -"Retrieve Password","找回密ç " -"Return Html Version","返回Html版本" -"Revenue","æ”¶å…¥" -"Reviews","评测" -"Reviews and Ratings","评测与评级" -"Rewrite Rules","é‡å†™è§„则" -"Role ID","角色ID" -"Role Info","角色信æ¯" -"Role Information","角色信æ¯" -"Role Name","角色åç§°" -"Role Resources","角色资æº" -"Role Users","角色用户" -"Roles","角色" -"Roles Resources","角色资æº" -"Rotate CCW","è½®æ¢CCW" -"Rotate CW","循环CW" -"Run","è¿è¡Œ" -"Run Profile","è¿è¡Œé…置文件" -"Run Profile Inside This Window","在该窗å£å†…è¿è¡Œé…置文件" -"Run Profile in Popup","在弹出窗å£å†…è¿è¡Œé…置文件" -"Running... Kill","æ£åœ¨è¿è¡Œ...结æŸ" -"SKU","SKU" -"SKU:","SKU:" -"SSL Error: Invalid or self-signed certificate","SSLé”™è¯¯ï¼šæ— æ•ˆçš„æˆ–è‡ªç¾åçš„è¯ä¹¦" -"Sales","销售" -"Sales Report","销售报告" -"Samples","æ ·æœ¬" -"Save","ä¿å˜" -"Save & Generate","ä¿å˜å¹¶ç”Ÿæˆ" -"Save Account","ä¿å˜å¸æˆ·" -"Save Cache Settings","ä¿å˜ç¼“å˜è®¾ç½®" -"Save Config","ä¿å˜é…ç½®" -"Save Currency Rates","ä¿å˜æ±‡çއ" -"Save Profile","ä¿å˜é…置文件" -"Save Role","ä¿å˜è§’色" -"Save Template","ä¿å˜æ¨¡æ¿" -"Save User","ä¿å˜ç”¨æˆ·" -"Save and Continue Edit","ä¿å˜å¹¶ç»§ç»ç¼–辑" -"Search","æœç´¢" -"Search Index","æœç´¢ç´¢å¼•" -"Search Term","æœç´¢æ¡ä»¶" -"Search Terms","æœç´¢æ¡ä»¶" -"Select","选择" -"Select All","全选" -"Select Category","选择分类" -"Select Date","选择日期" -"Select Range","选择范围" -"Select date","选择日期" -"Selected allowed currency ""%s"" is not available in installed currencies.","所选的å…许å¸ç§ ""%s"" ä¸å±žäºŽå¯ä½¿ç”¨å¸ç§ã€‚" -"Selected base currency is not available in installed currencies.","å·²æŒ‰è£…çš„æ±‡çŽ‡ä¸æ— 法按照汇率进行选择。" -"Selected default display currency is not available in allowed currencies.","å…许的å¸ç§ä¸éƒ¨å…许选择默认显示的å¸ç§ã€‚" -"Selected default display currency is not available in installed currencies.","å·²å®‰è£…çš„æ±‡çŽ‡æ— æ³•é€‰æ‹©é»˜è®¤æ˜¾ç¤ºçš„å¸ç§ã€‚" -"Self-assigned roles cannot be deleted.","æ— æ³•é€‰æ‹©è‡ªåˆ†é…角色。" -"Sender","å‘逿–¹" -"Separate Email","å•独的邮件" -"Service Settings","æœåŠ¡è®¾ç½®" -"Set up & Customize","设置&自定义" -"Shipment #%s comment added","è¿å• #%sæ·»åŠ äº†è¯„è®º" -"Shipment #%s created","è¿å• #%s已创建" -"Shipment Comments","è¿å•评论" -"Shipment History","è¿é€åކå²" -"Shipments","å‘è´§" -"Shipping","è¿é€" -"Shipping Address","é€è´§åœ°å€" -"Shipping Address: ","é€è´§åœ°å€ï¼š" -"Shipping Origin","é€è´§æºå¤´" -"Shipping Price","è¿è´¹" -"Shipping address selection is not applicable","所选é€è´§åœ°å€ä¸å¯ç”¨" -"Shipping method must be specified.","必须指定è¿é€æ–¹æ³•。" -"Shipping method selection is not applicable","所选é€è´§æ–¹æ³•ä¸å¯ç”¨" -"Shopping Cart","è´ç‰©è½¦" -"Shopping Cart Price Rules","è´ç‰©è½¦ä»·æ ¼è§„则" -"Shopping Cart from %s","%s çš„è´ç‰©è½¦" -"Show By","显示æ¡ä»¶" -"Show Report For:","显示报告:" -"Show Reviews","显示评测" -"Sitemap Information","站点结构图信æ¯" -"Size for %s","%s的大å°" -"Skip Category Selection","跳过分类的选择" -"Some items in this order have different invoice and shipment types. You can create shipment only after the invoice is created.","该订å•ä¸çš„æŸäº›é¡¹ç›®å…·æœ‰ä¸åŒçš„å‘票和é€è´§ç±»åž‹ã€‚您åªèƒ½åœ¨åˆ›å»ºå‘票åŽåˆ›å»ºè¿å•。" -"Some of the ordered items do not exist in the catalog anymore and will be removed if you try to edit the order.","订è´çš„æŸäº›å•†å“å·²ç»ä¸å†åŒ…å«åœ¨åˆ†ç±»ä¸ï¼Œå¦‚æžœå°è¯•修改订å•ï¼Œå°†ä¼šè¢«åˆ é™¤ã€‚" -"Sorry, this feature is coming soon...","对ä¸èµ·ï¼Œè¯¥åŠŸèƒ½å°šæœªå‘布..." -"Special Price:","ç‰¹æ®Šä»·æ ¼ï¼š" -"Specific Countries","指定国家" -"Specified","已指定" -"Specified profile does not exist.","指定的é…置文件ä¸å˜åœ¨ã€‚" -"Spreadsheet Name:","è¡¨æ ¼å称:" -"Start Date","开始日期" -"Starting profile execution, please wait...","开始执行é…置文件,请ç¨å€™..." -"State/Province:","å·ž/çœï¼š" -"Static Blocks","陿€å—" -"Status","状æ€" -"Status:","状æ€ï¼š" -"Stock Quantity:","å˜è´§æ•°é‡ï¼š" -"Stock notification was saved.","库å˜é€šçŸ¥å·²ä¿å˜ã€‚" -"Store","商店" -"Store Email Addresses Section","店铺邮件地å€åŒºåŸŸ" -"Store View","店铺视图" -"Store:","店铺:" -"Stores","店铺" -"Subject","主题" -"Submit","æäº¤" -"Subpackage cannot be conflicting.","å包ä¸èƒ½å†²çªã€‚" -"Subtotal","å°è®¡" -"Switch/Solo/Maestro Only","ä»…é™ Switch/Solo/Maestro" -"Synchronization is required.","需è¦è¿›è¡ŒåŒæ¥ã€‚" -"Synchronization of media storages has been successfully completed.","媒体å˜å‚¨çš„åŒæ¥å·²ç»æˆåŠŸå®Œæˆã€‚" -"Synchronize","åŒæ¥" -"Synchronizing %s to %s","åŒæ¥ %s 到 %s" -"Synchronizing...","æ£åœ¨åŒæ¥..." -"System","系统" -"System Section","系统区域" -"System busy","系统忙碌" -"Tags","æ ‡ç¾" -"Target Path","ç›®æ ‡è·¯å¾„" -"Tax","ä¼ çœŸ" -"Tb","Tb" -"Template","模æ¿" -"Template Content","模æ¿å†…容" -"Template Information","模æ¿ä¿¡æ¯" -"Template","模æ¿åç§°" -"Template Styles","模æ¿é£Žæ ¼" -"Template Subject","模æ¿ä¸»é¢˜" -"Template Type","模æ¿ç±»åž‹" -"Temporary (302)","临时(302)" -"Terms and Conditions","æ¡æ¬¾å’Œæ¡ä»¶" -"Text","æ–‡å—" -"The Catalog Rewrites were refreshed.","该分类é‡å†™å·²é‡å»ºã€‚" -"The CatalogInventory Stock Status has been rebuilt.","CatalogInventory库å˜çжæ€å·²é‡å»ºã€‚" -"The Comment Text field cannot be empty.","该评论文本框ä¸èƒ½ä¸ºç©ºã€‚" -"The Flat Catalog Product was rebuilt","Flat分类产å“å·²é‡å»º" -"The JavaScript/CSS cache has been cleaned.","JavaScript/CSS缓å˜å·²æ¸…空。" -"The JavaScript/CSS cache has been cleared.","JavaScript/CSS 缓å˜å·²è¢«æ¸…空。" -"The Layered Navigation indexing has been queued.","分层导航索引已排入队列。" -"The Layered Navigation indexing queue has been canceled.","åˆ†å±‚å¯¼èˆªç´¢å¼•é˜Ÿåˆ—å·²è¢«åˆ é™¤ã€‚" -"The Layered Navigation indices were refreshed.","层次å¼å¯¼èˆªç›®å½•å·²æ¢å¤ã€‚" -"The Layered Navigation process has been queued to be killed.","å·²æŽ’å…¥é˜Ÿåˆ—çš„åˆ†å±‚å¯¼èˆªè¿›ç¨‹å°†è¢«ä¸æ¢ã€‚" -"The Magento cache storage has been flushed.","Magento缓å˜å˜å‚¨å·²æ¸…ç†ã€‚" -"The URL Rewrite has been deleted.","URL é‡å†™å·²è¢«åˆ 除。" -"The URL Rewrite has been saved.","URL é‡å†™å·²ä¿å˜ã€‚" -"The account has been saved.","叿ˆ·å·²ä¿å˜ã€‚" -"The archive can be uncompressed with <a href=""%s"">%s</a> on Windows systems","Windowsç³»ç»Ÿä¸‹å˜æ¡£çš„解压缩å¯ä½¿ç”¨ <a href=""%s"">%s</a>" -"The attribute set has been removed.","å±žæ€§é›†å·²åˆ é™¤ã€‚" -"The backup's creation process will take time.","备份创建过程需è¦ä¸€äº›æ—¶é—´ã€‚" -"The billing agreement has been canceled.","è´¦å•åè®®å·²è¢«å–æ¶ˆã€‚" -"The billing agreement has been deleted.","è®°è´¦åè®®å·²åˆ é™¤ã€‚" -"The cache storage has been flushed.","缓å˜å˜å‚¨å·²æ¸…ç†ã€‚" -"The carrier needs to be specified.","éœ€è¦æŒ‡å®šæ‰¿è¿äººã€‚" -"The catalog index has been rebuilt.","分类索引已é‡å»ºã€‚" -"The catalog rewrites have been refreshed.","分类é‡å†™å·²æ¢å¤ã€‚" -"The configuration has been saved.","é…置已ä¿å˜ã€‚" -"The credit memo has been canceled.","贷项å‡å•å·²è¢«å–æ¶ˆã€‚" -"The credit memo has been created.","信用记录已创建。" -"The credit memo has been voided.","贷项å‡å•已作废。" -"The custom variable has been deleted.","自定义å˜é‡å·²åˆ 除。" -"The custom variable has been saved.","自定义å˜é‡å·²ä¿å˜ã€‚" -"The customer has been deleted.","å®¢æˆ·å·²è¢«åˆ é™¤ã€‚" -"The customer has been saved.","客户已ä¿å˜ã€‚" -"The design change has been deleted.","设计å˜åŠ¨å·²åˆ é™¤ã€‚" -"The design change has been saved.","è®¾è®¡å˜æ›´å·²ä¿å˜ã€‚" -"The email address is empty.","电å邮件地å€ä¸ºç©ºã€‚" -"The email template has been deleted.","电åé‚®ä»¶æ¨¡ç‰ˆå·²è¢«åˆ é™¤ã€‚" -"The email template has been saved.","邮件模æ¿å·²ä¿å˜ã€‚" -"The flat catalog category has been rebuilt.","å¹³é¢ç›®å½•类别已é‡å»ºã€‚" -"The group node name must be specified with field node name.","群组节点å称并需以域节点å称指定。" -"The image cache was cleaned.","图片缓å˜å·²è¢«æ¸…空。" -"The image cache was cleared.","图åƒç¼“å˜å·²æ¸…ç†ã€‚" -"The invoice and shipment have been created.","å‘票与è¿é€å·²åˆ›å»ºã€‚" -"The invoice and the shipment have been created. The shipping label cannot be created at the moment.","å‘票与è¿é€å·²åˆ›å»ºã€‚ç›®å‰æ— 法更改å‘è´§æ ‡ç¾ã€‚" -"The invoice has been canceled.","å‘ç¥¨å·²è¢«å–æ¶ˆã€‚" -"The invoice has been captured.","å‘票已被æ•获。" -"The invoice has been created.","å‘票已创建。" -"The invoice has been voided.","å‘票已作废。" -"The invoice no longer exists.","清å•ä¸å˜åœ¨ã€‚" -"The item %s (SKU %s) does not exist in the catalog anymore.","项目 %s (SKU %s) å·²ä¸åœ¨è¯¥ç¼–录ä¸ã€‚" -"The order does not allow creating an invoice.","该订å•ä¸å…许创建å‘票。" -"The order no longer exists.","该订å•å·²ä¸å˜åœ¨ã€‚" -"The poll has been deleted.","è°ƒæŸ¥å·²è¢«åˆ é™¤ã€‚" -"The poll has been saved.","调查已ä¿å˜ã€‚" -"The profile has been deleted.","ä¸ªäººèµ„æ–™å·²è¢«åˆ é™¤ã€‚" -"The profile has been saved.","个人资料已ä¿å˜ã€‚" -"The profile has been updated.","个人资料已更新。" -"The profile has no changes.","ä¸ªäººèµ„æ–™æ— å˜åŒ–。" -"The profile you are trying to save no longer exists","您å°è¯•ä¿å˜çš„é…置文件ä¸å˜åœ¨" -"The rating has been deleted.","è¯„çº§å·²è¢«åˆ é™¤ã€‚" -"The rating has been saved.","评级已ä¿å˜ã€‚" -"The role has been deleted.","è§’è‰²å·²è¢«åˆ é™¤ã€‚" -"The role has been saved.","角色已ä¿å˜ã€‚" -"The role has been successfully saved.","角色已æˆåŠŸä¿å˜ã€‚" -"The search index has been rebuilt.","æœç´¢ç´¢å¼•å·²é‡å»ºã€‚" -"The shipment has been created.","货物已被创建。" -"The shipment has been sent.","货物已å‘é€ã€‚" -"The shipping label has been created.","è¿é€æ ‡ç¾å·²åˆ›å»ºã€‚" -"The tag has been deleted.","æ ‡ç¾å·²è¢«åˆ 除。" -"The tag has been saved.","æ ‡ç¾å·²ä¿å˜ã€‚" -"The transaction details have been updated.","已更新交易详情。" -"The user has been deleted.","ç”¨æˆ·å·²è¢«åˆ é™¤ã€‚" -"The user has been saved.","用户已ä¿å˜ã€‚" -"Themes JavaScript and CSS files combined to one file.","主题 JavaScript å’Œ CSS 文件已åˆå¹¶ä¸ºå•个文件。" -"There is an error in one of the option rows.","选项行之一出现错误。" -"This Account is","该账户为" -"This Email template no longer exists.","电å邮件模æ¿å·²ä¸å˜åœ¨ã€‚" -"This Role no longer exists","该角色已ä¸å˜åœ¨" -"This Role no longer exists.","该角色已ä¸å˜åœ¨ã€‚" -"This account is","è¯¥å¸æˆ·ä¸º" -"This account is inactive.","该账户未被激活。" -"This action cannot be undone.","该行为ä¸å¯å–消。" -"This attribute set does not have attributes which we can use for configurable product","该属性集ä¸å…·æœ‰æˆ‘们å¯ç”¨äºŽå¯é…置产å“的属性" -"This attribute shares the same value in all the stores","该属性在所有商店ä¸å…±äº«åŒæ ·çš„æ•°å€¼" -"This is a demo store. Any orders placed through this store will not be honored or fulfilled.","这是一个演示商店。任何在æ¤å•†åº—下的订å•å°†æ— æ³•è¢«å…‘çŽ°æˆ–å±¥è¡Œã€‚" -"This is a required field.","这是必填区域。" -"This product is currently disabled.","该产å“当å‰å·²è¢«ç¦ç”¨ã€‚" -"This report depends on timezone configuration. Once timezone is changed, the lifetime statistics need to be refreshed.","该报告å–决于时区é…置。一旦时区å‘ç”Ÿå˜æ›´ï¼Œæœ‰æ•ˆæœŸç»Ÿè®¡æ•°æ®å³éœ€è¦è¢«åˆ·æ–°ã€‚" -"This section is not allowed.","该å•å…ƒä¸è¢«å…许。" -"This user no longer exists.","该用户已ä¸å˜åœ¨ã€‚" -"Time","æ—¶é—´" -"Time selection:","时间选择:" -"Time:","时间:" -"Timeout limit for response from synchronize process was reached.","åŒæ¥æ“作ä¸çš„å“应超时é™åˆ¶å·²è¾¾åˆ°ã€‚" -"To","å‘é€è‡³" -"To cancel pending authorizations and release amounts that have already been processed during this payment, click Cancel.","è¦å–消挂起的授æƒï¼Œå¹¶é‡Šæ”¾æ”¯ä»˜è¿‡ç¨‹ä¸å·²ç»è¢«å¤„ç†çš„æŽˆæƒï¼Œè¯·ç‚¹å‡»å–消。" -"To use PayPal Payflow Link you must configure some settings in your Payflow account by logging into","è¦ä½¿ç”¨ Payflow 链接,您必须在 Paypal 网站é…置您的 Payflow é“¾æŽ¥å¸æˆ·ã€‚" -"To use PayPal Payments Advanced you must configure some settings in your PayPal Payments Advanced account by logging into","è¦ä½¿ç”¨ PayPal Payments Advancedï¼Œä½ å¿…é¡»åœ¨è‡ªå·±çš„ PayPal Payments Advanced 账户ä¸é…置一些选项,为æ¤è¯·ç™»å½•" -"Toggle Editor","切æ¢ç¼–辑器" -"Tools","工具" -"Top 5 Search Terms","å‰äº”使œç´¢æ¡ä»¶" -"Total","总数" -"Total Invoiced","å‘票总é‡" -"Total","è®¢å•æ€»æ•°é‡" -"Total Refunded","退款总é‡" -"Total of %d record(s) have been deleted.","总共%dè®°å½•å·²è¢«åˆ é™¤ã€‚" -"Total of %d record(s) have been updated.","总共%d记录已被更新。" -"Total of %d record(s) were canceled.","æ€»å…±å–æ¶ˆäº† %d æ¡è®°å½•。" -"Total of %d record(s) were deleted","å…±åˆ é™¤ %d æ¡è®°å½•" -"Total of %d record(s) were deleted.","å…±åˆ é™¤ %d æ¡è®°å½•。" -"Total of %d record(s) were updated","共更新 %d æ¡è®°å½•" -"Total of %d record(s) were updated.","共更新 %d æ¡è®°å½•。" -"Track Order","追踪订å•" -"Track this shipment","追踪该è¿å•" -"Tracking number %s for %s assigned","为%s分é…çš„è¿½è¸ªå· %s" -"Tracking number cannot be empty.","追踪å·ä¸èƒ½ä¸ºç©ºã€‚" -"Transaction Data","交易数æ®" -"Transaction Details","交易详情" -"Transaction ID","交易ID" -"Transaction Type","交易类型" -"Transactional Emails","交易邮件" -"Transactions","交易" -"Type","类型" -"Type:","类型:" -"URL Rewrite","URLé‡å†™" -"URL Rewrite Information","URLé‡å†™ä¿¡æ¯" -"URL Rewrite Management","URLé‡å†™ç®¡ç†" -"Unable to cancel the credit memo.","æ— æ³•å–æ¶ˆä¿¡ç”¨è®°å½•。" -"Unable to find a Email Template to delete.","æ— æ³•æ‰¾åˆ°è¦åˆ 除的邮件模æ¿ã€‚" -"Unable to find a poll to delete.","æ— æ³•æ‰¾åˆ°è¦åˆ 除的投票。" -"Unable to find a tag to delete.","æ— æ³•æ‰¾åˆ°è¦åˆ é™¤çš„æ ‡ç¾ã€‚" -"Unable to find a user to delete.","æ— æ³•æ‰¾åˆ°è¦åˆ 除的用户。" -"Unable to initialize import model","æ— æ³•åˆå§‹åŒ–导入模å—。" -"Unable to refresh lifetime statistics.","æ— æ³•åˆ·æ–°æœ‰æ•ˆæœŸçŠ¶æ€ã€‚" -"Unable to refresh recent statistics.","æ— æ³•åˆ·æ–°æœ€æ–°çŠ¶æ€ã€‚" -"Unable to save Cron expression","æ— æ³•ä¿å˜Cron扩展" -"Unable to save the cron expression.","æ— æ³•ä¿å˜Cron表达å¼ã€‚" -"Unable to save the invoice.","æ— æ³•ä¿å˜è¯¥å‘票。" -"Unable to send the invoice email.","æ— æ³•å‘é€å‘票邮件。" -"Unable to send the shipment email.","æ— æ³•å‘é€è¿é€é‚®ä»¶ã€‚" -"Unable to update transaction details.","æ— æ³•æ›´æ–°äº¤æ˜“è¯¦æƒ…ã€‚" -"Unable to void the credit memo.","æ— æ³•é¿å…信用记录。" -"Unknown","未知" -"Unlimited","æ— é™" -"Update","æ›´æ–°" -"Updated At","更新于" -"Upload File","ä¸Šä¼ æ–‡ä»¶" -"Upload Files","ä¸Šä¼ æ–‡ä»¶" -"Upload HTTP Error","ä¸Šä¼ HTTP错误" -"Upload I/O Error","ä¸Šä¼ I/O错误" -"Upload Security Error","ä¸Šä¼ å®‰å…¨é”™è¯¯" -"Upload import file","ä¸Šä¼ å¯¼å…¥æ–‡ä»¶" -"Uploaded file is larger than %.2f kilobytes allowed by server","ä¸Šä¼ æ–‡ä»¶è¿‡å¤§ï¼Œè¶…è¿‡æœåŠ¡å™¨è®¸å¯å€¼ %.2f åƒå—节" -"Use All Available Attributes","使用全部å¯ç”¨å±žæ€§" -"Use Config Settings","使用é…置设置" -"Use Default","使用默认值" -"Use Default Value","使用默认值" -"Use Default Variable Values","使用默认å˜é‡å€¼" -"Use FTP Connection","使用 FTP 连接" -"Use Website","使用网站" -"Used Currently For","当å‰ç”¨äºŽ" -"Used as Default For","用作默认值" -"User Email","用户邮件" -"User ID","用户ID" -"User Info","用户信æ¯" -"User Information","用户信æ¯" -"User Name","用户å" -"User Name is required field.","ç”¨æˆ·åæ˜¯å¿…è¦å—段。" -"User Name:","用户å:" -"User Password","用户密ç " -"User Role","用户角色" -"User Roles","用户角色" -"User Roles Information","用户角色信æ¯" -"User name","用户å" -"Users","用户" -"VAT Number is Invalid","VAT å·ç æ— æ•ˆ" -"VAT Number is Valid","VAT å·ç 有效" -"Validation Results","验è¯ç»“æžœ" -"Value","值" -"Value Delimiter:","值界定符:" -"Variable","å˜é‡" -"Variable Code","å˜é‡ä»£ç " -"Variable HTML Value","å˜é‡HTML值" -"Variable ID","å˜é‡ID" -"Variable Name","å˜é‡åç§°" -"Variable Plain Value","å˜é‡å¹³å¦å€¼" -"View Actions XML","查看æ“作XML" -"View Full Size","查看完整尺寸" -"View Memo","查看记录" -"View Memo for #%s","查看 #%s的记录" -"View Shipment","查看è¿é€" -"View Statistics For:","查看统计:" -"Visibility:","å¯è§æ€§ï¼š" -"Warning","è¦å‘Š" -"Warning! Empty value can cause problems with CSV format.","è¦å‘Šï¼ç©ºå€¼å°†å¯¼è‡´CSVæ ¼å¼å‡ºé—®é¢˜ã€‚" -"Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?","è¦å‘Šï¼\r\n该æ“作会将用户从已分é…的角色ä¸åˆ 除\r\n是å¦ç»§ç»ï¼Ÿ" -"Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?","è¦å‘Šï¼\r\n该æ“作将从已分é…的角色ä¸å°†è¿™äº›ç”¨æˆ·åˆ 除\r\n您是å¦çœŸè¦è¿™æ ·åšï¼Ÿ" -"Warning: Please do not close the window during importing/exporting data","è¦å‘Šï¼šè¯·ä¸è¦åœ¨å¯¼å…¥/导出数æ®è¿‡ç¨‹ä¸å…³é—该窗å£" -"Watermark File for %s","%sçš„æ°´å°æ–‡ä»¶" -"We appreciate our merchants\' feedback, please <a href=""#"" onclick=""surveyAction(\'yes\'); return false;"">take our survey</a> to provide insight on the features you would like included in Magento. <a href=""#"" onclick=""surveyAction(\'no\'); return false;"">Remove this notification</a>","æˆ‘ä»¬è¦æ„Ÿè°¢æ‰€ç”¨çš„银行\' 若有å馈,请 <a href=""#"">å‚与我们的调查</a> 以便告诉我们您希望在以åŽçš„Magentoä¸çœ‹åˆ°å“ªäº›æ–°åŠŸèƒ½ã€‚ <a href=""#"">åˆ é™¤è¯¥é€šçŸ¥</a>" -"We\'re in our typing table, coding away more features for Magento. Thank you for your patience.","我们æ£åœ¨è¾›è‹¦å·¥ä½œä¸ï¼Œä¸ºMagentoæ·»åŠ æ›´å¤šåŠŸèƒ½ã€‚æ„Ÿè°¢æ‚¨çš„è€å¿ƒã€‚" -"Web Section","Web区域" -"Web Services","WebæœåŠ¡" -"Web services","WebæœåŠ¡" -"Website","网站" -"What is this?","这是什么?" -"Wishlist Report","æ„¿æœ›æ¸…å•æŠ¥å‘Š" -"Wishlist item is not loaded.","愿望清å•é¡¹ç¼–å·æœªè¢«åŠ è½½ã€‚" -"Wrong account specified.","指定的账户有误。" -"Wrong billing agreement ID specified.","指定的记账åè®®ID有误。" -"Wrong column format.","æ æ ¼å¼æœ‰è¯¯ã€‚" -"Wrong newsletter template.","错误的新闻邮件模æ¿ã€‚" -"Wrong quote item.","引用项有误。" -"Wrong tab configuration.","选项å¡é…置有误。" -"Wrong tag was specified.","æŒ‡å®šçš„é€‰é¡¹å¡æœ‰è¯¯ã€‚" -"Wrong transaction ID specified.","指定的交易ID有误。" -"XML","XML" -"XML data is invalid.","XMLæ•°æ®æ— 效。" -"XML object is not instance of ""Varien_Simplexml_Element"".","XML对象并éžâ€œVarien_Simplexml_Elementâ€çš„实例。" -"YTD","YTD" -"Year","å¹´" -"Yes","是" -"Yes (301 Moved Permanently)","是(301 永久移动)" -"Yes (302 Found)","是(302找到)" -"Yes (only price with tax)","æ˜¯ï¼ˆåªæ˜¾ç¤ºå«ç¨Žä»·æ ¼ï¼‰" -"You cannot delete your own account.","æ‚¨æ— æ³•åˆ é™¤è‡ªå·±çš„å¸æˆ·ã€‚" -"You have %s unread message(s).","您有 %s å°æœªè¯»é‚®ä»¶ã€‚" -"You have %s unread message(s). <a href=""%s"">Go to messages inbox</a>.","ä½ æœ‰ %s æ¡æœªè¯»ä¿¡æ¯ã€‚ <a href=""%s"">è½¬å‘æ”¶ä»¶ç®±</a>。" -"You have %s, %s and %s unread messages. <a href=""%s"">Go to messages inbox</a>.","ä½ æœ‰ %sã€%s ä»¥åŠ %s æ¡æœªè¯»ä¿¡æ¯ã€‚ <a href=""%s"">è½¬å‘æ”¶ä»¶ç®±</a>。" -"You have logged out.","您已注销。" -"You have not enough permissions to use this functionality.","您没有使用该功能所需的足够æƒé™ã€‚" -"You must have JavaScript enabled in your browser to utilize the functionality of this website.","您必须在æµè§ˆå™¨ä¸å¯ç”¨JavaScriptæ‰èƒ½ä½¿ç”¨æœ¬ç½‘站的功能。" -"You need to specify order items.","您必须指定订å•项。" -"You will need to wait when the action ends.","è¯¥è¡Œä¸ºç»ˆæ¢æ—¶éœ€è¦ç‰å¾…。" -"Your answers contain duplicates.","您的回ç”包å«é‡å¤å†…容。" -"Your password has been updated.","ä½ çš„å¯†ç 已更新。" -"Your password reset link has expired.","ä½ çš„å¯†ç é‡è®¾é“¾æŽ¥å·²è¿‡æœŸã€‚" -"Your server PHP settings allow you to upload files not more than %s at a time. Please modify post_max_size (currently is %s) and upload_max_filesize (currently is %s) values in php.ini if you want to upload larger files.","您的æœåС噍PHP设置使您å¯ä»¥åŒæ—¶ä¸Šä¼ ä¸è¶…过 %s æ–‡ä»¶ã€‚å¦‚æžœæƒ³ä¸Šä¼ å¤§æ–‡ä»¶ï¼Œè¯·ä¿®æ”¹php.ini文件ä¸çš„ post_max_size (当å‰ä¸º %s)与 upload_max_filesize (当å‰ä¸º %s)值。" -"Your web server is configured incorrectly. As a result, configuration files with sensitive information are accessible from the outside. Please contact your hosting provider.","您的WebæœåС噍é…ç½®æœ‰è¯¯ã€‚å› æ¤ï¼ŒåŒ…嫿•感信æ¯çš„é…置文件将能从外部访问。请è”系您的主机托管商。" -"Zip/Postal Code","邮政编ç " -"Zip/Postal Code:","邮编:" -"[ deleted ]","[å·²åˆ é™¤]" -"[GLOBAL]","[全局]" -"[STORE VIEW]","[店铺视图]" -"[WEBSITE]","[网站]" -"b","b" -"close","å…³é—" -"critical","é‡è¦" -"example: ""sitemap/"" or ""/"" for base path (path must be writeable)","例如: ""sitemap/"" 或 ""/"" å¯ä»£è¡¨è·¯å¾„æ ¹ï¼ˆè·¯å¾„å¿…é¡»å¯å†™ï¼‰" -"example: sitemap.xml","例如:sitemap.xml" -"failed","失败" -"from","æ¥è‡ª" -"major","主è¦" -"minor","次è¦" -"notice","注æ„" -"store(%s) scope","店铺 (%s)范围" -"successful","æˆåŠŸ" -"to","至" -"website(%s) scope","网站(%s)范围" -"{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. It is highly recommended to change this value in your Magento <a href=""%s"">configuration</a>.","ä¸å»ºè®®åœ¨ç”Ÿäº§çŽ¯å¢ƒä¸ä½¿ç”¨ {{base_url}} 检测 Base Unsecure URL / Base Secure URL。强烈建议在您的 Magento <a href=""%s"">é…ç½®</a>䏿›´æ”¹è¯¥å€¼ã€‚" 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 f9a951dd5bb..c8604a91061 100644 --- a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php @@ -62,11 +62,11 @@ class Payment /** * Retrieve session object * - * @return \Magento\Adminhtml\Model\Session\Quote + * @return \Magento\Backend\Model\Session\Quote */ protected function _getOrderSession() { - return $this->_objectManager->get('Magento\Adminhtml\Model\Session\Quote'); + return $this->_objectManager->get('Magento\Backend\Model\Session\Quote'); } /** @@ -149,11 +149,11 @@ class Payment } catch (\Magento\Core\Exception $e) { $message = $e->getMessage(); if (!empty($message)) { - $this->_getSession()->addError($message); + $this->messageManager->addError($message); } $isError = true; } catch (\Exception $e) { - $this->_getSession()->addException($e, __('Order saving error: %1', $e->getMessage())); + $this->messageManager->addException($e, __('Order saving error: %1', $e->getMessage())); $isError = true; } @@ -206,8 +206,8 @@ class Payment //clear sessions $this->_getSession()->clearStorage(); $this->_getDirectPostSession()->removeCheckoutOrderIncrementId($redirectParams['x_invoice_num']); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->clearStorage(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('You created the order.')); + $this->_objectManager->get('Magento\Backend\Model\Session')->clearStorage(); + $this->messageManager->addSuccess(__('You created the order.')); } if (!empty($redirectParams['error_msg'])) { diff --git a/app/code/Magento/Authorizenet/Helper/Backend.php b/app/code/Magento/Authorizenet/Helper/Backend.php index 45d87e23703..a1346be1ffd 100644 --- a/app/code/Magento/Authorizenet/Helper/Backend.php +++ b/app/code/Magento/Authorizenet/Helper/Backend.php @@ -31,27 +31,6 @@ namespace Magento\Authorizenet\Helper; */ class Backend extends Data { - /** - * @var \Magento\Backend\Model\Url - */ - protected $_urlBuilder; - - /** - * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManager $storeManager - * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Backend\Model\Url $urlBuilder - */ - public function __construct( - \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManager $storeManager, - \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Backend\Model\Url $urlBuilder - ) { - parent::__construct($context, $storeManager, $orderFactory); - $this->_urlBuilder = $urlBuilder; - } - /** * Return URL for admin area * diff --git a/app/code/Magento/Authorizenet/Model/Directpost.php b/app/code/Magento/Authorizenet/Model/Directpost.php index 878c38cfcd8..811287383a8 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost.php +++ b/app/code/Magento/Authorizenet/Model/Directpost.php @@ -76,7 +76,7 @@ class Directpost extends \Magento\Paygate\Model\Authorizenet * @param \Magento\Paygate\Model\Authorizenet\RequestFactory $requestFactory * @param \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Paygate\Helper\Data $paygateData * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\QuoteFactory $quoteFactory @@ -99,7 +99,7 @@ class Directpost extends \Magento\Paygate\Model\Authorizenet \Magento\Paygate\Model\Authorizenet\RequestFactory $requestFactory, \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory, \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Core\Model\Session\AbstractSession $session, + \Magento\Session\SessionManagerInterface $session, \Magento\Paygate\Helper\Data $paygateData, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\QuoteFactory $quoteFactory, diff --git a/app/code/Magento/Authorizenet/Model/Directpost/Session.php b/app/code/Magento/Authorizenet/Model/Directpost/Session.php index e7e3dfb566f..bb196669faa 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost/Session.php +++ b/app/code/Magento/Authorizenet/Model/Directpost/Session.php @@ -24,33 +24,34 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Authorize.net DirectPost session model. - * - * @category Magento - * @package Magento_Authorizenet - * @author Magento Core Team <core@magentocommerce.com> - */ namespace Magento\Authorizenet\Model\Directpost; -class Session extends \Magento\Core\Model\Session\AbstractSession +/** + * Authorize.net DirectPost session model + */ +class Session extends \Magento\Session\SessionManager { /** - * @param \Magento\Core\Model\Session\Context $context + * @param \Magento\App\RequestInterface $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param null $sessionName - * @param array $data + * @param \Magento\Session\SaveHandlerInterface $saveHandler + * @param \Magento\Session\ValidatorInterface $validator + * @param \Magento\Session\StorageInterface $storage + * @param string|null $sessionName + * @internal param array $data */ public function __construct( - \Magento\Core\Model\Session\Context $context, + \Magento\App\RequestInterface $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, - $sessionName = null, - array $data = array() + \Magento\Session\SaveHandlerInterface $saveHandler, + \Magento\Session\ValidatorInterface $validator, + \Magento\Session\StorageInterface $storage, + $sessionName = null ) { - parent::__construct($context, $sidResolver, $sessionConfig, $data); - $this->start('authorizenet_directpost', $sessionName); + parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage); + $this->start($sessionName); } /** diff --git a/app/code/Magento/Authorizenet/etc/adminhtml/di.xml b/app/code/Magento/Authorizenet/etc/adminhtml/di.xml index dd7d4918ccc..4128264c127 100644 --- a/app/code/Magento/Authorizenet/etc/adminhtml/di.xml +++ b/app/code/Magento/Authorizenet/etc/adminhtml/di.xml @@ -32,7 +32,7 @@ </type> <type name="Magento\Authorizenet\Model\Directpost"> <param name="session"> - <instance type="Magento\Adminhtml\Model\Session\Quote" /> + <instance type="Magento\Backend\Model\Session\Quote" /> </param> </type> </config> diff --git a/app/code/Magento/Authorizenet/etc/adminhtml/routes.xml b/app/code/Magento/Authorizenet/etc/adminhtml/routes.xml index 2b2a270c359..4741226fd4e 100644 --- a/app/code/Magento/Authorizenet/etc/adminhtml/routes.xml +++ b/app/code/Magento/Authorizenet/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Authorizenet_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Authorizenet" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Authorizenet/etc/di.xml b/app/code/Magento/Authorizenet/etc/di.xml index efdc687d461..46ab7defb96 100644 --- a/app/code/Magento/Authorizenet/etc/di.xml +++ b/app/code/Magento/Authorizenet/etc/di.xml @@ -32,4 +32,14 @@ <instance type="Magento\Core\Helper\Data\Proxy" /> </param> </type> + <virtualType name="Magento\Authorizenet\Model\Directpost\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> + <value>authorizenet_directpost</value> + </param> + </virtualType> + <type name="Magento\Authorizenet\Model\Directpost\Session"> + <param name="storage"> + <instance type="Magento\Authorizenet\Model\Directpost\Session\Storage" /> + </param> + </type> </config> diff --git a/app/code/Magento/Authorizenet/etc/module.xml b/app/code/Magento/Authorizenet/etc/module.xml index efba0d75d9c..e63bb0bbf24 100755 --- a/app/code/Magento/Authorizenet/etc/module.xml +++ b/app/code/Magento/Authorizenet/etc/module.xml @@ -34,7 +34,6 @@ <module name="Magento_Paygate"/> <module name="Magento_Sales"/> <module name="Magento_Checkout"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Backend"/> <module name="Magento_Core"/> <module name="Magento_Payment"/> diff --git a/app/code/Magento/Backend/App/AbstractAction.php b/app/code/Magento/Backend/App/AbstractAction.php index 58259d8b1fe..3628ae730a2 100644 --- a/app/code/Magento/Backend/App/AbstractAction.php +++ b/app/code/Magento/Backend/App/AbstractAction.php @@ -134,6 +134,14 @@ abstract class AbstractAction extends \Magento\App\Action\Action return $this->_session; } + /** + * @return \Magento\Message\ManagerInterface + */ + protected function getMessageManager() + { + return $this->messageManager; + } + /** * Define active menu item in menu block * @param string $itemId current active menu item @@ -209,7 +217,7 @@ abstract class AbstractAction extends \Magento\App\Action\Action /** * @param \Magento\App\RequestInterface $request - * @return $this|mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(\Magento\App\RequestInterface $request) { @@ -218,7 +226,8 @@ abstract class AbstractAction extends \Magento\App\Action\Action } if ($request->isDispatched() && $request->getActionName() !== 'denied' && !$this->_isAllowed()) { - return $this->_forward('denied'); + $this->_forward('denied'); + return $this->_response; } if ($this->_isUrlChecked()) { @@ -334,7 +343,7 @@ abstract class AbstractAction extends \Magento\App\Action\Action { $this->_getSession()->setIsUrlNotice($this->_actionFlag->get('', self::FLAG_IS_URLS_CHECKED)); $this->getResponse()->setRedirect($this->getUrl($path, $arguments)); - return $this; + return $this->getResponse(); } protected function _forward($action, $controller = null, $module = null, array $params = null) @@ -381,7 +390,7 @@ abstract class AbstractAction extends \Magento\App\Action\Action */ protected function _outTemplate($tplName, $data = array()) { - $this->_view->getLayout()->initMessages('Magento\Backend\Model\Session'); + $this->_view->getLayout()->initMessages(); $block = $this->_view->getLayout() ->createBlock('Magento\Backend\Block\Template')->setTemplate("{$tplName}.phtml"); foreach ($data as $index => $value) { diff --git a/app/code/Magento/Backend/App/Action/Context.php b/app/code/Magento/Backend/App/Action/Context.php index c0728e95e41..79b0b88f3f8 100644 --- a/app/code/Magento/Backend/App/Action/Context.php +++ b/app/code/Magento/Backend/App/Action/Context.php @@ -85,6 +85,7 @@ class Context extends \Magento\App\Action\Context * @param \Magento\App\Response\RedirectInterface $redirect * @param \Magento\App\ActionFlag $actionFlag * @param \Magento\App\ViewInterface $view + * @param \Magento\Message\ManagerInterface $messageManager * @param \Magento\Backend\Model\Session $session * @param \Magento\AuthorizationInterface $authorization * @param \Magento\Backend\Model\Auth $auth @@ -104,6 +105,7 @@ class Context extends \Magento\App\Action\Context \Magento\App\Response\RedirectInterface $redirect, \Magento\App\ActionFlag $actionFlag, \Magento\App\ViewInterface $view, + \Magento\Message\ManagerInterface $messageManager, \Magento\Backend\Model\Session $session, \Magento\AuthorizationInterface $authorization, \Magento\Backend\Model\Auth $auth, @@ -114,7 +116,17 @@ class Context extends \Magento\App\Action\Context \Magento\Core\Model\LocaleInterface $locale, $canUseBaseUrl = false ) { - parent::__construct($request, $response, $objectManager, $eventManager, $url, $redirect, $actionFlag, $view); + parent::__construct( + $request, + $response, + $objectManager, + $eventManager, + $url, + $redirect, + $actionFlag, + $view, + $messageManager + ); $this->_session = $session; $this->_authorization = $authorization; diff --git a/app/code/Magento/Backend/App/Action/Plugin/Authentication.php b/app/code/Magento/Backend/App/Action/Plugin/Authentication.php index 9013a9d6d49..695d5a2b285 100644 --- a/app/code/Magento/Backend/App/Action/Plugin/Authentication.php +++ b/app/code/Magento/Backend/App/Action/Plugin/Authentication.php @@ -49,11 +49,6 @@ class Authentication */ protected $_url; - /** - * @var \Magento\Backend\Model\Session - */ - protected $_session; - /** * @var \Magento\App\ResponseInterface */ @@ -64,25 +59,30 @@ class Authentication */ protected $_actionFlag; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\Backend\Model\Auth $auth - * @param \Magento\Backend\Model\Session $session * @param \Magento\Backend\Model\Url $url * @param \Magento\App\ResponseInterface $response * @param \Magento\App\ActionFlag $actionFlag + * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( \Magento\Backend\Model\Auth $auth, - \Magento\Backend\Model\Session $session, \Magento\Backend\Model\Url $url, \Magento\App\ResponseInterface $response, - \Magento\App\ActionFlag $actionFlag + \Magento\App\ActionFlag $actionFlag, + \Magento\Message\ManagerInterface $messageManager ) { $this->_auth = $auth; - $this->_session = $session; $this->_url = $url; $this->_response = $response; $this->_actionFlag = $actionFlag; + $this->messageManager = $messageManager; } /** @@ -160,7 +160,7 @@ class Authentication $this->_auth->login($username, $password); } catch (\Magento\Backend\Model\Auth\Exception $e) { if (!$request->getParam('messageSent')) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $request->setParam('messageSent', true); $outputValue = false; } @@ -193,4 +193,4 @@ class Authentication $this->_actionFlag->set('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); return true; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Backend/App/Response/Http/FileFactory.php b/app/code/Magento/Backend/App/Response/Http/FileFactory.php index 2facf5afe45..faf4961a21d 100644 --- a/app/code/Magento/Backend/App/Response/Http/FileFactory.php +++ b/app/code/Magento/Backend/App/Response/Http/FileFactory.php @@ -36,9 +36,9 @@ class FileFactory extends \Magento\App\Response\Http\FileFactory protected $_backendUrl; /** - * @var \Magento\App\ResponseFactory + * @var \Magento\App\ResponseInterface */ - protected $_responseFactory; + protected $_response; /** * @var \Magento\Backend\Model\Session @@ -56,7 +56,7 @@ class FileFactory extends \Magento\App\Response\Http\FileFactory protected $_helper; /** - * @param \Magento\App\ResponseFactory $responseFactory + * @param \Magento\App\ResponseInterface $response * @param \Magento\Filesystem $filesystem * @param \Magento\Backend\Model\Auth $auth * @param \Magento\Backend\Model\Url $backendUrl @@ -65,7 +65,7 @@ class FileFactory extends \Magento\App\Response\Http\FileFactory * @param \Magento\Backend\Helper\Data $helper */ public function __construct( - \Magento\App\ResponseFactory $responseFactory, + \Magento\App\ResponseInterface $response, \Magento\Filesystem $filesystem, \Magento\Backend\Model\Auth $auth, \Magento\Backend\Model\Url $backendUrl, @@ -78,7 +78,7 @@ class FileFactory extends \Magento\App\Response\Http\FileFactory $this->_session = $session; $this->_flag = $flag; $this->_helper = $helper; - parent::__construct($responseFactory, $filesystem); + parent::__construct($response, $filesystem); } @@ -94,9 +94,8 @@ class FileFactory extends \Magento\App\Response\Http\FileFactory { $this->_session ->setIsUrlNotice($this->_flag->get('', \Magento\Backend\App\AbstractAction::FLAG_IS_URLS_CHECKED)); - $response = $this->_responseFactory->create(); - $response->setRedirect($this->_helper->getUrl($path, $arguments)); - return $response; + $this->_response->setRedirect($this->_helper->getUrl($path, $arguments)); + return $this->_response; } /** @@ -112,9 +111,8 @@ class FileFactory extends \Magento\App\Response\Http\FileFactory public function create($fileName, $content, $contentType = 'application/octet-stream', $contentLength = null) { if ($this->_auth->getAuthStorage()->isFirstPageAfterLogin()) { - $response = $this->_redirect($this->_backendUrl->getStartupPageUrl()); - return $response; + return $this->_redirect($this->_backendUrl->getStartupPageUrl()); } return parent::create($fileName, $content, $contentType, $contentLength); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Backend/App/Router/DefaultRouter.php b/app/code/Magento/Backend/App/Router/DefaultRouter.php index bde535d4029..cc7dee3e9de 100644 --- a/app/code/Magento/Backend/App/Router/DefaultRouter.php +++ b/app/code/Magento/Backend/App/Router/DefaultRouter.php @@ -160,24 +160,20 @@ class DefaultRouter extends \Magento\Core\App\Router\Base /** * Build controller class name based on moduleName and controllerName * - * @param string $realModule + * @param string $module * @param string $controller * @return string */ - public function getControllerClassName($realModule, $controller) + public function getControllerClassName($module, $controller) { /** - * Start temporary block - * TODO: Sprint#27. Delete after adminhtml refactoring + * TODO: Delete these lines after adminhtml module is removed */ - if ($realModule == 'Magento_Adminhtml') { - return parent::getControllerClassName($realModule, $controller); + if ($module == 'Magento_Adminhtml') { + return parent::getControllerClassName($module, $controller); } - /** - * End temporary block - */ - $parts = explode('_', $realModule); + $parts = explode('_', $module); $parts = array_splice($parts, 0, 2); $parts[] = 'Controller'; $parts[] = \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE; diff --git a/app/code/Magento/Backend/Block/Cache.php b/app/code/Magento/Backend/Block/Cache.php index 0e107904966..55fb1f7d2d7 100644 --- a/app/code/Magento/Backend/Block/Cache.php +++ b/app/code/Magento/Backend/Block/Cache.php @@ -26,7 +26,7 @@ namespace Magento\Backend\Block; -class Cache extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Cache extends \Magento\Backend\Block\Widget\Grid\Container { /** * Class constructor diff --git a/app/code/Magento/Backend/Block/Cache/Grid/Column/Statuses.php b/app/code/Magento/Backend/Block/Cache/Grid/Column/Statuses.php index bbe32dd6fc4..0d85c52b838 100644 --- a/app/code/Magento/Backend/Block/Cache/Grid/Column/Statuses.php +++ b/app/code/Magento/Backend/Block/Cache/Grid/Column/Statuses.php @@ -61,7 +61,7 @@ class Statuses extends \Magento\Backend\Block\Widget\Grid\Column * * @param string $value * @param \Magento\Core\Model\AbstractModel $row - * @param \Magento\Adminhtml\Block\Widget\Grid\Column $column + * @param \Magento\Backend\Block\Widget\Grid\Column $column * @param bool $isExport * @return string * @SuppressWarnings(PHPMD.UnusedFormalParameter) diff --git a/app/code/Magento/Backend/Block/Context.php b/app/code/Magento/Backend/Block/Context.php index 28420ebb514..7c371b577e9 100644 --- a/app/code/Magento/Backend/Block/Context.php +++ b/app/code/Magento/Backend/Block/Context.php @@ -1,7 +1,4 @@ <?php - -namespace Magento\Backend\Block; - /** * Backend block context * @@ -25,6 +22,12 @@ namespace Magento\Backend\Block; * * @copyright Copyright (c) 2013 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; + +/** + * Backend block context * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -40,14 +43,13 @@ class Context extends \Magento\View\Element\Context * @param \Magento\View\LayoutInterface $layout * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\UrlInterface $urlBuilder - * @param \Magento\Core\Model\Translate $translator + * @param \Magento\TranslateInterface $translator * @param \Magento\App\CacheInterface $cache * @param \Magento\View\DesignInterface $design - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\App\FrontController $frontController - * @param \Magento\App\Helper\HelperFactory $helperFactory * @param \Magento\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\App\Cache\StateInterface $cacheState @@ -58,7 +60,7 @@ class Context extends \Magento\View\Element\Context * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\AuthorizationInterface $authorization * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -66,14 +68,13 @@ class Context extends \Magento\View\Element\Context \Magento\View\LayoutInterface $layout, \Magento\Event\ManagerInterface $eventManager, \Magento\UrlInterface $urlBuilder, - \Magento\Core\Model\Translate $translator, + \Magento\TranslateInterface $translator, \Magento\App\CacheInterface $cache, \Magento\View\DesignInterface $design, - \Magento\Core\Model\Session\AbstractSession $session, + \Magento\Session\SessionManagerInterface $session, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Core\Model\Store\Config $storeConfig, \Magento\App\FrontController $frontController, - \Magento\App\Helper\HelperFactory $helperFactory, \Magento\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\App\Cache\StateInterface $cacheState, @@ -87,27 +88,9 @@ class Context extends \Magento\View\Element\Context ) { $this->_authorization = $authorization; parent::__construct( - $request, - $layout, - $eventManager, - $urlBuilder, - $translator, - $cache, - $design, - $session, - $sidResolver, - $storeConfig, - $frontController, - $helperFactory, - $viewUrl, - $viewConfig, - $cacheState, - $logger, - $app, - $escaper, - $filterManager, - $locale, - $data + $request, $layout, $eventManager, $urlBuilder, $translator, $cache, $design, $session, $sidResolver, + $storeConfig, $frontController, $viewUrl, $viewConfig, $cacheState, $logger, $app, $escaper, + $filterManager, $locale, $data ); } diff --git a/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php b/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php index ef09ab5fc08..fc42b1059a2 100644 --- a/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php +++ b/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php @@ -34,9 +34,12 @@ namespace Magento\Backend\Block\Dashboard; -abstract class AbstractDashboard extends \Magento\Adminhtml\Block\Widget +abstract class AbstractDashboard extends \Magento\Backend\Block\Widget { - protected $_dataHelperName = null; + /** + * @var \Magento\Backend\Helper\Dashboard\AbstractDashboard + */ + protected $_dataHelper = null; /** * @var \Magento\Reports\Model\Resource\Order\CollectionFactory @@ -59,28 +62,22 @@ abstract class AbstractDashboard extends \Magento\Adminhtml\Block\Widget public function getCollection() { - return $this->getDataHelper()->getCollection(); + return $this->getDataHelper()->getCollection(); } public function getCount() { - return $this->getDataHelper()->getCount(); + return $this->getDataHelper()->getCount(); } + /** + * Get data helper + * + * @return \Magento\Backend\Helper\Dashboard\AbstractDashboard + */ public function getDataHelper() { - return $this->helper($this->getDataHelperName()); - } - - public function getDataHelperName() - { - return $this->_dataHelperName; - } - - public function setDataHelperName($dataHelperName) - { - $this->_dataHelperName = $dataHelperName; - return $this; + return $this->_dataHelper; } protected function _prepareData() diff --git a/app/code/Magento/Backend/Block/Dashboard/Diagrams.php b/app/code/Magento/Backend/Block/Dashboard/Diagrams.php index 6350b999480..2d80493e4ee 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Diagrams.php +++ b/app/code/Magento/Backend/Block/Dashboard/Diagrams.php @@ -34,10 +34,10 @@ namespace Magento\Backend\Block\Dashboard; -class Diagrams extends \Magento\Adminhtml\Block\Widget\Tabs +class Diagrams extends \Magento\Backend\Block\Widget\Tabs { - protected $_template = 'Magento_Adminhtml::widget/tabshoriz.phtml'; + protected $_template = 'Magento_Backend::widget/tabshoriz.phtml'; protected function _construct() { diff --git a/app/code/Magento/Backend/Block/Dashboard/Graph.php b/app/code/Magento/Backend/Block/Dashboard/Graph.php index ee642713d21..ac1e54a7222 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Graph.php +++ b/app/code/Magento/Backend/Block/Dashboard/Graph.php @@ -552,6 +552,14 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard return $this->_height; } + /** + * @param \Magento\Backend\Helper\Dashboard\AbstractDashboard $dataHelper + */ + public function setDataHelper(\Magento\Backend\Helper\Dashboard\AbstractDashboard $dataHelper) + { + $this->_dataHelper = $dataHelper; + } + /** * Prepare chart data * @@ -559,8 +567,8 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard */ protected function _prepareData() { - if (!is_null($this->getDataHelperName())) { - $availablePeriods = array_keys($this->helper('Magento\Backend\Helper\Dashboard\Data')->getDatePeriods()); + if (!is_null($this->_dataHelper)) { + $availablePeriods = array_keys($this->_dashboardData->getDatePeriods()); $period = $this->getRequest()->getParam('period'); $this->getDataHelper()->setParam('period', ($period && in_array($period, $availablePeriods)) ? $period : '24h' diff --git a/app/code/Magento/Backend/Block/Dashboard/Grid.php b/app/code/Magento/Backend/Block/Dashboard/Grid.php index b76681b7126..444c8c9d1a1 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Grid.php +++ b/app/code/Magento/Backend/Block/Dashboard/Grid.php @@ -34,7 +34,7 @@ namespace Magento\Backend\Block\Dashboard; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { protected $_template = 'dashboard/grid.phtml'; diff --git a/app/code/Magento/Backend/Block/Dashboard/Grids.php b/app/code/Magento/Backend/Block/Dashboard/Grids.php index f0d09b59a1f..45f2844beb7 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Grids.php +++ b/app/code/Magento/Backend/Block/Dashboard/Grids.php @@ -34,10 +34,10 @@ namespace Magento\Backend\Block\Dashboard; -class Grids extends \Magento\Adminhtml\Block\Widget\Tabs +class Grids extends \Magento\Backend\Block\Widget\Tabs { - protected $_template = 'Magento_Adminhtml::widget/tabshoriz.phtml'; + protected $_template = 'Magento_Backend::widget/tabshoriz.phtml'; protected function _construct() { diff --git a/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php b/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php index e2225b40488..fd11ca9cf0d 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php +++ b/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php @@ -47,22 +47,24 @@ class Grid extends \Magento\Backend\Block\Dashboard\Grid protected $_moduleManager; /** - * @param \Magento\Module\Manager $moduleManager * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper + * @param \Magento\Module\Manager $moduleManager * @param \Magento\Reports\Model\Resource\Order\CollectionFactory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Module\Manager $moduleManager, \Magento\Reports\Model\Resource\Order\CollectionFactory $collectionFactory, array $data = array() ) { $this->_moduleManager = $moduleManager; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Backend/Block/Dashboard/Sales.php b/app/code/Magento/Backend/Block/Dashboard/Sales.php index a5366e2fe25..2f101fdc7c9 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Sales.php +++ b/app/code/Magento/Backend/Block/Dashboard/Sales.php @@ -34,7 +34,7 @@ namespace Magento\Backend\Block\Dashboard; -use Magento\Adminhtml\Block\Widget; +use Magento\Backend\Block\Widget; class Sales extends \Magento\Backend\Block\Dashboard\Bar { diff --git a/app/code/Magento/Backend/Block/Dashboard/Searches/Last.php b/app/code/Magento/Backend/Block/Dashboard/Searches/Last.php index e6e83587bf9..bc81e230f28 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Searches/Last.php +++ b/app/code/Magento/Backend/Block/Dashboard/Searches/Last.php @@ -49,22 +49,24 @@ class Last extends \Magento\Backend\Block\Dashboard\Grid protected $_moduleManager; /** - * @param \Magento\Module\Manager $moduleManager * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper + * @param \Magento\Module\Manager $moduleManager * @param \Magento\CatalogSearch\Model\Resource\Query\CollectionFactory $queriesFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Module\Manager $moduleManager, \Magento\CatalogSearch\Model\Resource\Query\CollectionFactory $queriesFactory, array $data = array() ) { $this->_moduleManager = $moduleManager; $this->_queriesFactory = $queriesFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Backend/Block/Dashboard/Searches/Renderer/Searchquery.php b/app/code/Magento/Backend/Block/Dashboard/Searches/Renderer/Searchquery.php index 2b9bf27b8a7..6ce9738d500 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Searches/Renderer/Searchquery.php +++ b/app/code/Magento/Backend/Block/Dashboard/Searches/Renderer/Searchquery.php @@ -31,7 +31,7 @@ namespace Magento\Backend\Block\Dashboard\Searches\Renderer; class Searchquery - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer + extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * String helper diff --git a/app/code/Magento/Backend/Block/Dashboard/Searches/Top.php b/app/code/Magento/Backend/Block/Dashboard/Searches/Top.php index 22052714318..837d8bf8eab 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Searches/Top.php +++ b/app/code/Magento/Backend/Block/Dashboard/Searches/Top.php @@ -49,22 +49,24 @@ class Top extends \Magento\Backend\Block\Dashboard\Grid protected $_moduleManager; /** - * @param \Magento\Module\Manager $moduleManager * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper + * @param \Magento\Module\Manager $moduleManager * @param \Magento\CatalogSearch\Model\Resource\Query\CollectionFactory $queriesFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Module\Manager $moduleManager, \Magento\CatalogSearch\Model\Resource\Query\CollectionFactory $queriesFactory, array $data = array() ) { $this->_moduleManager = $moduleManager; $this->_queriesFactory = $queriesFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Amounts.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Amounts.php index 4d63408b824..b986e38466c 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Amounts.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Amounts.php @@ -36,6 +36,24 @@ namespace Magento\Backend\Block\Dashboard\Tab; class Amounts extends \Magento\Backend\Block\Dashboard\Graph { + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Reports\Model\Resource\Order\CollectionFactory $collectionFactory + * @param \Magento\Backend\Helper\Dashboard\Data $dashboardData + * @param \Magento\Backend\Helper\Dashboard\Order $dataHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Reports\Model\Resource\Order\CollectionFactory $collectionFactory, + \Magento\Backend\Helper\Dashboard\Data $dashboardData, + \Magento\Backend\Helper\Dashboard\Order $dataHelper, + array $data = array() + ) { + $this->_dataHelper = $dataHelper; + parent::__construct($context, $collectionFactory, $dashboardData, $data); + } + /** * Initialize object * @@ -54,7 +72,6 @@ class Amounts extends \Magento\Backend\Block\Dashboard\Graph */ protected function _prepareData() { - $this->setDataHelperName('Magento\Backend\Helper\Dashboard\Order'); $this->getDataHelper()->setParam('store', $this->getRequest()->getParam('store')); $this->getDataHelper()->setParam('website', $this->getRequest()->getParam('website')); $this->getDataHelper()->setParam('group', $this->getRequest()->getParam('group')); diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Most.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Most.php index 1c0f19b593c..54bea7a9348 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Most.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Most.php @@ -44,17 +44,19 @@ class Most extends \Magento\Backend\Block\Dashboard\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Order\CollectionFactory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Order\CollectionFactory $collectionFactory, array $data = array() ) { $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Newest.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Newest.php index 82289d9f94d..d667923be13 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Newest.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Newest.php @@ -44,17 +44,19 @@ class Newest extends \Magento\Backend\Block\Dashboard\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Customer\CollectionFactory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Customer\CollectionFactory $collectionFactory, array $data = array() ) { $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Orders.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Orders.php index ff24fa61da3..3806549a5d4 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Orders.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Orders.php @@ -36,6 +36,24 @@ namespace Magento\Backend\Block\Dashboard\Tab; class Orders extends \Magento\Backend\Block\Dashboard\Graph { + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Reports\Model\Resource\Order\CollectionFactory $collectionFactory + * @param \Magento\Backend\Helper\Dashboard\Data $dashboardData + * @param \Magento\Backend\Helper\Dashboard\Order $dataHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Reports\Model\Resource\Order\CollectionFactory $collectionFactory, + \Magento\Backend\Helper\Dashboard\Data $dashboardData, + \Magento\Backend\Helper\Dashboard\Order $dataHelper, + array $data = array() + ) { + $this->_dataHelper = $dataHelper; + parent::__construct($context, $collectionFactory, $dashboardData, $data); + } + /** * Initialize object * @@ -54,7 +72,6 @@ class Orders extends \Magento\Backend\Block\Dashboard\Graph */ protected function _prepareData() { - $this->setDataHelperName('Magento\Backend\Helper\Dashboard\Order'); $this->getDataHelper()->setParam('store', $this->getRequest()->getParam('store')); $this->getDataHelper()->setParam('website', $this->getRequest()->getParam('website')); $this->getDataHelper()->setParam('group', $this->getRequest()->getParam('group')); diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php index d93d9c02b11..adb6416ffa3 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php @@ -47,22 +47,24 @@ class Ordered extends \Magento\Backend\Block\Dashboard\Grid protected $_moduleManager; /** - * @param \Magento\Module\Manager $moduleManager * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper + * @param \Magento\Module\Manager $moduleManager * @param \Magento\Sales\Model\Resource\Report\Bestsellers\CollectionFactory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Module\Manager $moduleManager, \Magento\Sales\Model\Resource\Report\Bestsellers\CollectionFactory $collectionFactory, array $data = array() ) { $this->_collectionFactory = $collectionFactory; $this->_moduleManager = $moduleManager; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Viewed.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Viewed.php index a1298bdac49..815ceb09394 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Viewed.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Viewed.php @@ -44,17 +44,19 @@ class Viewed extends \Magento\Backend\Block\Dashboard\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Product\CollectionFactory $productsFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Product\CollectionFactory $productsFactory, array $data = array() ) { $this->_productsFactory = $productsFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Backend/Block/Dashboard/Totals.php b/app/code/Magento/Backend/Block/Dashboard/Totals.php index 6fdbcad87a0..2e58daa2aec 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Totals.php +++ b/app/code/Magento/Backend/Block/Dashboard/Totals.php @@ -34,7 +34,7 @@ */ namespace Magento\Backend\Block\Dashboard; -use Magento\Adminhtml\Block\Widget; +use Magento\Backend\Block\Widget; class Totals extends \Magento\Backend\Block\Dashboard\Bar { diff --git a/app/code/Magento/Backend/Block/Media/Uploader.php b/app/code/Magento/Backend/Block/Media/Uploader.php index 8a393e05903..b429ee29e69 100644 --- a/app/code/Magento/Backend/Block/Media/Uploader.php +++ b/app/code/Magento/Backend/Block/Media/Uploader.php @@ -29,7 +29,7 @@ */ namespace Magento\Backend\Block\Media; -class Uploader extends \Magento\Adminhtml\Block\Widget +class Uploader extends \Magento\Backend\Block\Widget { /** * @var \Magento\Object diff --git a/app/code/Magento/Backend/Block/Page/Head.php b/app/code/Magento/Backend/Block/Page/Head.php index 96505249f40..da21fb513d3 100644 --- a/app/code/Magento/Backend/Block/Page/Head.php +++ b/app/code/Magento/Backend/Block/Page/Head.php @@ -40,11 +40,6 @@ class Head extends \Magento\Theme\Block\Html\Head */ protected $_template = 'page/head.phtml'; - /** - * @var \Magento\App\Action\Title - */ - protected $_titles; - /** * @var \Magento\Data\Form\FormKey */ @@ -83,6 +78,7 @@ class Head extends \Magento\Theme\Block\Html\Head $assetMinifyService, $data ); + $this->formKey = $formKey; } /** diff --git a/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php b/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php index f1434842a11..1cbf1bf1aca 100644 --- a/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php +++ b/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php @@ -87,7 +87,7 @@ class Reset extends \Magento\Backend\Block\System\Config\Form\Field */ public function getButtonHtml() { - $button = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $button = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'id' => 'reset_to_default_button', 'label' => __('Reset to Default'), diff --git a/app/code/Magento/Backend/Block/System/Account/Edit.php b/app/code/Magento/Backend/Block/System/Account/Edit.php index 02698202807..b69fa06b43c 100644 --- a/app/code/Magento/Backend/Block/System/Account/Edit.php +++ b/app/code/Magento/Backend/Block/System/Account/Edit.php @@ -34,7 +34,7 @@ namespace Magento\Backend\Block\System\Account; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { protected function _construct() { diff --git a/app/code/Magento/Backend/Block/System/Cache/Edit.php b/app/code/Magento/Backend/Block/System/Cache/Edit.php index db9796f3178..e7bb0e15e64 100644 --- a/app/code/Magento/Backend/Block/System/Cache/Edit.php +++ b/app/code/Magento/Backend/Block/System/Cache/Edit.php @@ -33,7 +33,7 @@ */ namespace Magento\Backend\Block\System\Cache; -class Edit extends \Magento\Adminhtml\Block\Widget +class Edit extends \Magento\Backend\Block\Widget { protected $_template = 'Magento_Backend::system/cache/edit.phtml'; @@ -47,7 +47,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget protected function _prepareLayout() { - $this->addChild('save_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save Cache Settings'), 'class' => 'save', 'data_attribute' => array( diff --git a/app/code/Magento/Backend/Block/System/Config/Form/Field/Export.php b/app/code/Magento/Backend/Block/System/Config/Form/Field/Export.php index 3bdedf592d0..4d2d7389e61 100644 --- a/app/code/Magento/Backend/Block/System/Config/Form/Field/Export.php +++ b/app/code/Magento/Backend/Block/System/Config/Form/Field/Export.php @@ -36,25 +36,25 @@ namespace Magento\Backend\Block\System\Config\Form\Field; class Export extends \Magento\Data\Form\Element\AbstractElement { /** - * @var \Magento\App\Helper\HelperFactory + * @var \Magento\Backend\Helper\Data */ - protected $_helperFactory; + protected $_helper; /** * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Escaper $escaper - * @param \Magento\App\Helper\HelperFactory $helperFactory + * @param \Magento\Backend\Helper\Data $helper * @param array $data */ public function __construct( \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Escaper $escaper, - \Magento\App\Helper\HelperFactory $helperFactory, + \Magento\Backend\Helper\Data $helper, array $data = array() ) { - $this->_helperFactory = $helperFactory; + $this->_helper = $helper; parent::__construct($factoryElement, $factoryCollection, $escaper, $data); } @@ -70,7 +70,7 @@ class Export extends \Magento\Data\Form\Element\AbstractElement 'website' => $buttonBlock->getRequest()->getParam('website') ); - $url = $this->_helperFactory->get('Magento\Backend\Helper\Data')->getUrl("*/*/exportTablerates", $params); + $url = $this->_helper->getUrl("*/*/exportTablerates", $params); $data = array( 'label' => __('Export CSV'), 'onclick' => "setLocation('" . $url diff --git a/app/code/Magento/Backend/Block/System/Config/Form/Fieldset.php b/app/code/Magento/Backend/Block/System/Config/Form/Fieldset.php index 1ba61e7167f..069b6b822ab 100644 --- a/app/code/Magento/Backend/Block/System/Config/Form/Fieldset.php +++ b/app/code/Magento/Backend/Block/System/Config/Form/Fieldset.php @@ -38,16 +38,24 @@ class Fieldset */ protected $_authSession; + /** + * @var \Magento\Core\Helper\Js + */ + protected $_jsHelper; + /** * @param \Magento\Backend\Block\Context $context * @param \Magento\Backend\Model\Auth\Session $authSession + * @param \Magento\Core\Helper\Js $jsHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, \Magento\Backend\Model\Auth\Session $authSession, + \Magento\Core\Helper\Js $jsHelper, array $data = array() ) { + $this->_jsHelper = $jsHelper; $this->_authSession = $authSession; parent::__construct($context, $data); } @@ -203,7 +211,7 @@ class Fieldset { $htmlId = $element->getHtmlId(); $output = "Fieldset.applyCollapse('{$htmlId}');"; - return $this->helper('Magento\Core\Helper\Js')->getScript($output); + return $this->_jsHelper->getScript($output); } /** diff --git a/app/code/Magento/Backend/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php b/app/code/Magento/Backend/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php index 2e3e9a7c2ce..72d84d65641 100644 --- a/app/code/Magento/Backend/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php +++ b/app/code/Magento/Backend/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php @@ -56,16 +56,18 @@ class DisableOutput /** * @param \Magento\Backend\Block\Context $context * @param \Magento\Backend\Model\Auth\Session $authSession + * @param \Magento\Core\Helper\Js $jsHelper * @param \Magento\Module\ModuleListInterface $moduleList * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, \Magento\Backend\Model\Auth\Session $authSession, + \Magento\Core\Helper\Js $jsHelper, \Magento\Module\ModuleListInterface $moduleList, array $data = array() ) { - parent::__construct($context, $authSession, $data); + parent::__construct($context, $authSession, $jsHelper, $data); $this->_moduleList = $moduleList; } diff --git a/app/code/Magento/Backend/Block/System/Config/Tabs.php b/app/code/Magento/Backend/Block/System/Config/Tabs.php index a59c7cc7f8a..04055360b4b 100644 --- a/app/code/Magento/Backend/Block/System/Config/Tabs.php +++ b/app/code/Magento/Backend/Block/System/Config/Tabs.php @@ -76,16 +76,24 @@ class Tabs extends \Magento\Backend\Block\Widget */ protected $_storeCode; + /** + * @var \Magento\Backend\Helper\Data + */ + protected $_backendHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Backend\Model\Config\Structure $configStructure + * @param \Magento\Backend\Helper\Data $backendHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Backend\Model\Config\Structure $configStructure, + \Magento\Backend\Helper\Data $backendHelper, array $data = array() ) { + $this->_backendHelper = $backendHelper; parent::__construct($context, $data); $this->_tabs = $configStructure->getTabs(); @@ -93,7 +101,7 @@ class Tabs extends \Magento\Backend\Block\Widget $this->setTitle(__('Configuration')); $this->_currentSectionId = $this->getRequest()->getParam('section'); - $this->helper('Magento\Backend\Helper\Data')->addPageHelpUrl($this->getRequest()->getParam('section') . '/'); + $this->_backendHelper->addPageHelpUrl($this->getRequest()->getParam('section') . '/'); } /** diff --git a/app/code/Magento/Backend/Block/System/Design.php b/app/code/Magento/Backend/Block/System/Design.php index f6b3a5e0f3a..de08547c641 100644 --- a/app/code/Magento/Backend/Block/System/Design.php +++ b/app/code/Magento/Backend/Block/System/Design.php @@ -33,7 +33,7 @@ class Design extends \Magento\Backend\Block\Template { $this->setTemplate('Magento_Backend::system/design/index.phtml'); - $this->addChild('add_new_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('add_new_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add Design Change'), 'onclick' => "setLocation('".$this->getUrl('adminhtml/*/new')."')", 'class' => 'add' diff --git a/app/code/Magento/Backend/Block/System/Design/Edit.php b/app/code/Magento/Backend/Block/System/Design/Edit.php index 104d359393b..c8ee0e9d4b5 100644 --- a/app/code/Magento/Backend/Block/System/Design/Edit.php +++ b/app/code/Magento/Backend/Block/System/Design/Edit.php @@ -26,7 +26,7 @@ namespace Magento\Backend\Block\System\Design; -class Edit extends \Magento\Adminhtml\Block\Widget +class Edit extends \Magento\Backend\Block\Widget { protected $_template = 'Magento_Backend::system/design/edit.phtml'; @@ -61,13 +61,13 @@ class Edit extends \Magento\Adminhtml\Block\Widget protected function _prepareLayout() { - $this->addChild('back_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('back_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Back'), 'onclick' => 'setLocation(\'' . $this->getUrl('adminhtml/*/') . '\')', 'class' => 'back' )); - $this->addChild('save_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save'), 'class' => 'save', 'data_attribute' => array( @@ -77,7 +77,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget ), )); - $this->addChild('delete_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('delete_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete'), 'onclick' => 'confirmSetLocation(\'' . __('Are you sure?') . '\', \'' . $this->getDeleteUrl() . '\')', 'class' => 'delete' diff --git a/app/code/Magento/Backend/Block/System/Design/Edit/Tabs.php b/app/code/Magento/Backend/Block/System/Design/Edit/Tabs.php index 56f07b4ea53..e32a3e97016 100644 --- a/app/code/Magento/Backend/Block/System/Design/Edit/Tabs.php +++ b/app/code/Magento/Backend/Block/System/Design/Edit/Tabs.php @@ -26,7 +26,7 @@ namespace Magento\Backend\Block\System\Design\Edit; -class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs +class Tabs extends \Magento\Backend\Block\Widget\Tabs { protected function _construct() { diff --git a/app/code/Magento/Backend/Block/System/Store/Delete.php b/app/code/Magento/Backend/Block/System/Store/Delete.php index 536d7de13c5..0379e43eef2 100644 --- a/app/code/Magento/Backend/Block/System/Store/Delete.php +++ b/app/code/Magento/Backend/Block/System/Store/Delete.php @@ -34,7 +34,7 @@ */ namespace Magento\Backend\Block\System\Store; -class Delete extends \Magento\Adminhtml\Block\Widget\Form\Container +class Delete extends \Magento\Backend\Block\Widget\Form\Container { /** diff --git a/app/code/Magento/Backend/Block/System/Store/Delete/Group.php b/app/code/Magento/Backend/Block/System/Store/Delete/Group.php index 01542d7b095..8d0135aa706 100644 --- a/app/code/Magento/Backend/Block/System/Store/Delete/Group.php +++ b/app/code/Magento/Backend/Block/System/Store/Delete/Group.php @@ -42,18 +42,18 @@ class Group extends \Magento\Backend\Block\Template $this->setTemplate('system/store/delete_group.phtml'); $this->setAction($this->getUrl('adminhtml/*/deleteGroupPost', array('group_id'=>$itemId))); - $this->addChild('confirm_deletion_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('confirm_deletion_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete Store'), 'onclick' => "deleteForm.submit()", 'class' => 'cancel' )); $onClick = "setLocation('".$this->getUrl('adminhtml/*/editGroup', array('group_id'=>$itemId))."')"; - $this->addChild('cancel_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('cancel_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Cancel'), 'onclick' => $onClick, 'class' => 'cancel' )); - $this->addChild('back_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('back_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Back'), 'onclick' => $onClick, 'class' => 'cancel' diff --git a/app/code/Magento/Backend/Block/System/Store/Delete/Website.php b/app/code/Magento/Backend/Block/System/Store/Delete/Website.php index e72533c732e..cbf70424b23 100644 --- a/app/code/Magento/Backend/Block/System/Store/Delete/Website.php +++ b/app/code/Magento/Backend/Block/System/Store/Delete/Website.php @@ -42,18 +42,18 @@ class Website extends \Magento\Backend\Block\Template $this->setTemplate('system/store/delete_website.phtml'); $this->setAction($this->getUrl('adminhtml/*/deleteWebsitePost', array('website_id'=>$itemId))); - $this->addChild('confirm_deletion_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('confirm_deletion_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete Web Site'), 'onclick' => "deleteForm.submit()", 'class' => 'cancel' )); $onClick = "setLocation('".$this->getUrl('adminhtml/*/editWebsite', array('website_id'=>$itemId))."')"; - $this->addChild('cancel_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('cancel_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Cancel'), 'onclick' => $onClick, 'class' => 'cancel' )); - $this->addChild('back_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('back_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Back'), 'onclick' => $onClick, 'class' => 'cancel' diff --git a/app/code/Magento/Backend/Block/System/Store/Edit.php b/app/code/Magento/Backend/Block/System/Store/Edit.php index 519293e5442..738681a7b2e 100644 --- a/app/code/Magento/Backend/Block/System/Store/Edit.php +++ b/app/code/Magento/Backend/Block/System/Store/Edit.php @@ -30,7 +30,7 @@ namespace Magento\Backend\Block\System\Store; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php b/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php index d8a6907cf18..9db8d97e984 100644 --- a/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php +++ b/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php @@ -50,7 +50,7 @@ abstract class AbstractForm extends \Magento\Backend\Block\Widget\Form\Generic /** * Prepare form data * - * return \Magento\Adminhtml\Block\Widget\Form + * return \Magento\Backend\Block\Widget\Form */ protected function _prepareForm() { diff --git a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php index 346df9d58ce..3a5a13e1fb8 100644 --- a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php +++ b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php @@ -35,7 +35,7 @@ namespace Magento\Backend\Block\System\Store\Grid\Render; class Group - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer + extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { public function render(\Magento\Object $row) { diff --git a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php index 68f82bae201..d8f649c7c56 100644 --- a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php +++ b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php @@ -35,7 +35,7 @@ namespace Magento\Backend\Block\System\Store\Grid\Render; class Store - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer + extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { public function render(\Magento\Object $row) { diff --git a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php index ffacc3a6d2e..ebe99397e26 100644 --- a/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php +++ b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php @@ -35,7 +35,7 @@ namespace Magento\Backend\Block\System\Store\Grid\Render; class Website - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer + extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { public function render(\Magento\Object $row) diff --git a/app/code/Magento/Backend/Block/System/Variable.php b/app/code/Magento/Backend/Block/System/Variable.php index 48e8aa1dc0c..369acdc78c1 100644 --- a/app/code/Magento/Backend/Block/System/Variable.php +++ b/app/code/Magento/Backend/Block/System/Variable.php @@ -34,7 +34,7 @@ namespace Magento\Backend\Block\System; -class Variable extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Variable extends \Magento\Backend\Block\Widget\Grid\Container { /** * Block constructor diff --git a/app/code/Magento/Backend/Block/System/Variable/Edit.php b/app/code/Magento/Backend/Block/System/Variable/Edit.php index 09b71ed2bca..7a46a31f106 100644 --- a/app/code/Magento/Backend/Block/System/Variable/Edit.php +++ b/app/code/Magento/Backend/Block/System/Variable/Edit.php @@ -29,7 +29,7 @@ */ namespace Magento\Backend\Block\System\Variable; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Backend/Block/Template.php b/app/code/Magento/Backend/Block/Template.php index e13c3daf2d7..a205ad63eb6 100644 --- a/app/code/Magento/Backend/Block/Template.php +++ b/app/code/Magento/Backend/Block/Template.php @@ -57,7 +57,7 @@ class Template extends \Magento\View\Element\Template * @var \Magento\Data\Form\FormKey */ protected $formKey; - + /** * @param \Magento\Backend\Block\Template\Context $context * @param array $data diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php index 3ebe55ef756..027c2737e32 100644 --- a/app/code/Magento/Backend/Block/Template/Context.php +++ b/app/code/Magento/Backend/Block/Template/Context.php @@ -62,7 +62,6 @@ class Context extends \Magento\View\Element\Template\Context * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\App\FrontController $frontController - * @param \Magento\App\Helper\HelperFactory $helperFactory * @param \Magento\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\App\Cache\StateInterface $cacheState @@ -71,7 +70,6 @@ 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\App\Dir $dirs * @param \Magento\Filesystem $filesystem * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEnginePool $enginePool @@ -97,7 +95,6 @@ class Context extends \Magento\View\Element\Template\Context \Magento\Session\SidResolverInterface $sidResolver, \Magento\Core\Model\Store\Config $storeConfig, \Magento\App\FrontController $frontController, - \Magento\App\Helper\HelperFactory $helperFactory, \Magento\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\App\Cache\StateInterface $cacheState, @@ -106,7 +103,6 @@ class Context extends \Magento\View\Element\Template\Context \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Core\Model\LocaleInterface $locale, - \Magento\App\Dir $dirs, \Magento\Filesystem $filesystem, \Magento\View\FileSystem $viewFileSystem, \Magento\View\TemplateEnginePool $enginePool, @@ -134,7 +130,6 @@ class Context extends \Magento\View\Element\Template\Context $sidResolver, $storeConfig, $frontController, - $helperFactory, $viewUrl, $viewConfig, $cacheState, @@ -143,7 +138,6 @@ class Context extends \Magento\View\Element\Template\Context $escaper, $filterManager, $locale, - $dirs, $filesystem, $viewFileSystem, $enginePool, diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite.php b/app/code/Magento/Backend/Block/Urlrewrite.php similarity index 81% rename from app/code/Magento/Adminhtml/Block/Urlrewrite.php rename to app/code/Magento/Backend/Block/Urlrewrite.php index d0368dadf97..fa8a195fa4b 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite.php +++ b/app/code/Magento/Backend/Block/Urlrewrite.php @@ -27,16 +27,16 @@ /** * Block for Urlrewrites grid container * - * @method \Magento\Adminhtml\Block\Urlrewrite setSelectorBlock(\Magento\Adminhtml\Block\Urlrewrite\Selector $value) - * @method null|\Magento\Adminhtml\Block\Urlrewrite\Selector getSelectorBlock() + * @method \Magento\Backend\Block\Urlrewrite setSelectorBlock(\Magento\Backend\Block\Urlrewrite\Selector $value) + * @method null|\Magento\Backend\Block\Urlrewrite\Selector getSelectorBlock() * * @category Magento * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block; +namespace Magento\Backend\Block; -class Urlrewrite extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Urlrewrite extends \Magento\Backend\Block\Widget\Grid\Container { /** * Part for generating apropriate grid block name @@ -46,18 +46,18 @@ class Urlrewrite extends \Magento\Adminhtml\Block\Widget\Grid\Container protected $_controller = 'urlrewrite'; /** - * @var \Magento\Adminhtml\Block\Urlrewrite\Selector + * @var \Magento\Backend\Block\Urlrewrite\Selector */ protected $_urlrewriteSelector; /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Block\Urlrewrite\Selector $urlrewriteSelector + * @param \Magento\Backend\Block\Urlrewrite\Selector $urlrewriteSelector * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Block\Urlrewrite\Selector $urlrewriteSelector, + \Magento\Backend\Block\Urlrewrite\Selector $urlrewriteSelector, array $data = array() ) { $this->_urlrewriteSelector = $urlrewriteSelector; @@ -78,7 +78,7 @@ class Urlrewrite extends \Magento\Adminhtml\Block\Widget\Grid\Container /** * Customize grid row URLs * - * @see \Magento\Adminhtml\Block\Urlrewrite\Selector + * @see \Magento\Backend\Block\Urlrewrite\Selector * @return string */ public function getCreateUrl() diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/Edit.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Edit.php similarity index 87% rename from app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/Edit.php rename to app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Edit.php index d3847e57d1b..4e3dab8ddcd 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/Edit.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Edit.php @@ -28,17 +28,17 @@ * Block for Catalog Category URL rewrites * * @method \Magento\Catalog\Model\Category getCategory() - * @method \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Edit + * @method \Magento\Backend\Block\Urlrewrite\Catalog\Category\Edit * setCategory(\Magento\Catalog\Model\Category $category) * * @category Magento * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Urlrewrite\Catalog\Category; +namespace Magento\Backend\Block\Urlrewrite\Catalog\Category; class Edit - extends \Magento\Adminhtml\Block\Urlrewrite\Edit + extends \Magento\Backend\Block\Urlrewrite\Edit { /** * @var \Magento\Catalog\Model\CategoryFactory @@ -102,7 +102,7 @@ class Edit */ private function _addCategoryLinkBlock() { - $this->addChild('category_link', 'Magento\Adminhtml\Block\Urlrewrite\Link', array( + $this->addChild('category_link', 'Magento\Backend\Block\Urlrewrite\Link', array( 'item_url' => $this->_adminhtmlData->getUrl('adminhtml/*/*') . 'category', 'item_name' => $this->_getCategory()->getName(), 'label' => __('Category:') @@ -114,17 +114,17 @@ class Edit */ private function _addCategoryTreeBlock() { - $this->addChild('categories_tree', 'Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree'); + $this->addChild('categories_tree', 'Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree'); } /** * Creates edit form block * - * @return \Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form + * @return \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form */ protected function _createEditFormBlock() { - return $this->getLayout()->createBlock('Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form', '', array( + return $this->getLayout()->createBlock('Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form', '', array( 'data' => array( 'category' => $this->_getCategory(), 'url_rewrite' => $this->_getUrlRewrite() diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/Tree.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Tree.php similarity index 99% rename from app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/Tree.php rename to app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Tree.php index 3d2ed64f2d1..bb7a2838f64 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/Tree.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Category/Tree.php @@ -31,7 +31,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Urlrewrite\Catalog\Category; +namespace Magento\Backend\Block\Urlrewrite\Catalog\Category; class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory { diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Edit/Form.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Edit/Form.php rename to app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php index 4bc9bb0d6d3..08c73a15c16 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Edit/Form.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php @@ -29,21 +29,21 @@ * * @method \Magento\Catalog\Model\Product getProduct() * @method \Magento\Catalog\Model\Category getCategory() - * @method \Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form setProduct(\Magento\Catalog\Model\Product $product) - * @method \Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form setCategory(\Magento\Catalog\Model\Category $category) + * @method \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form setProduct(\Magento\Catalog\Model\Product $product) + * @method \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form setCategory(\Magento\Catalog\Model\Category $category) * * @category Magento * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> * */ -namespace Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit; +namespace Magento\Backend\Block\Urlrewrite\Catalog\Edit; /** * @SuppressWarnings(PHPMD.DepthOfInheritance) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Form extends \Magento\Adminhtml\Block\Urlrewrite\Edit\Form +class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form { /** * @var \Magento\Catalog\Model\Url @@ -110,7 +110,7 @@ class Form extends \Magento\Adminhtml\Block\Urlrewrite\Edit\Form * Form post init * * @param \Magento\Data\Form $form - * @return \Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form + * @return \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form */ protected function _formPostInit($form) { diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/Edit.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Edit.php similarity index 85% rename from app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/Edit.php rename to app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Edit.php index f43d6f80a11..6abbd2040c3 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/Edit.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Edit.php @@ -29,18 +29,18 @@ * * @method \Magento\Catalog\Model\Category getCategory() * @method - * \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit setCategory(\Magento\Catalog\Model\Category $category) + * \Magento\Backend\Block\Urlrewrite\Catalog\Product\Edit setCategory(\Magento\Catalog\Model\Category $category) * @method \Magento\Catalog\Model\Product getProduct() - * @method \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit setProduct(\Magento\Catalog\Model\Product $product) + * @method \Magento\Backend\Block\Urlrewrite\Catalog\Product\Edit setProduct(\Magento\Catalog\Model\Product $product) * @method bool getIsCategoryMode() * * @category Magento * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Urlrewrite\Catalog\Product; +namespace Magento\Backend\Block\Urlrewrite\Catalog\Product; -class Edit extends \Magento\Adminhtml\Block\Urlrewrite\Edit +class Edit extends \Magento\Backend\Block\Urlrewrite\Edit { /** * @var \Magento\Catalog\Model\ProductFactory @@ -142,7 +142,7 @@ class Edit extends \Magento\Adminhtml\Block\Urlrewrite\Edit */ private function _addProductLinkBlock() { - $this->addChild('product_link', 'Magento\Adminhtml\Block\Urlrewrite\Link', array( + $this->addChild('product_link', 'Magento\Backend\Block\Urlrewrite\Link', array( 'item_url' => $this->_adminhtmlData->getUrl('adminhtml/*/*') . 'product', 'item_name' => $this->_getProduct()->getName(), 'label' => __('Product:') @@ -154,7 +154,7 @@ class Edit extends \Magento\Adminhtml\Block\Urlrewrite\Edit */ private function _addCategoryLinkBlock() { - $this->addChild('category_link', 'Magento\Adminhtml\Block\Urlrewrite\Link', array( + $this->addChild('category_link', 'Magento\Backend\Block\Urlrewrite\Link', array( 'item_url' => $this->_adminhtmlData ->getUrl('adminhtml/*/*', array('product' => $this->_getProduct()->getId())) . 'category', 'item_name' => $this->_getCategory()->getName(), @@ -167,7 +167,7 @@ class Edit extends \Magento\Adminhtml\Block\Urlrewrite\Edit */ private function _addProductsGridBlock() { - $this->addChild('products_grid', 'Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Grid'); + $this->addChild('products_grid', 'Magento\Backend\Block\Urlrewrite\Catalog\Product\Grid'); } /** @@ -175,7 +175,7 @@ class Edit extends \Magento\Adminhtml\Block\Urlrewrite\Edit */ private function _addCategoriesTreeBlock() { - $this->addChild('categories_tree', 'Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree'); + $this->addChild('categories_tree', 'Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree'); } /** @@ -183,7 +183,7 @@ class Edit extends \Magento\Adminhtml\Block\Urlrewrite\Edit */ private function _addSkipCategoriesBlock() { - $this->addChild('skip_categories', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('skip_categories', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Skip Category Selection'), 'onclick' => 'window.location = \'' . $this->_adminhtmlData->getUrl('adminhtml/*/*', array('product' => $this->_getProduct()->getId())) @@ -196,11 +196,11 @@ class Edit extends \Magento\Adminhtml\Block\Urlrewrite\Edit /** * Creates edit form block * - * @return \Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form + * @return \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form */ protected function _createEditFormBlock() { - return $this->getLayout()->createBlock('Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form', '', array( + return $this->getLayout()->createBlock('Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form', '', array( 'data' => array( 'product' => $this->_getProduct(), 'category' => $this->_getCategory(), diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/Grid.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Grid.php similarity index 93% rename from app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/Grid.php rename to app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Grid.php index d7e8abd3d36..4e21e92cddf 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/Grid.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Product/Grid.php @@ -31,14 +31,14 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Urlrewrite\Catalog\Product; +namespace Magento\Backend\Block\Urlrewrite\Catalog\Product; class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid { /** * Disable massaction * - * @return \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Grid + * @return \Magento\Backend\Block\Urlrewrite\Catalog\Product\Grid */ protected function _prepareMassaction() { @@ -48,7 +48,7 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid /** * Prepare columns layout * - * @return \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Grid + * @return \Magento\Backend\Block\Urlrewrite\Catalog\Product\Grid */ protected function _prepareColumns() { diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit.php b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit.php similarity index 86% rename from app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit.php rename to app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit.php index 5c813ae2fcb..54eb8ba949f 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit.php @@ -28,15 +28,15 @@ * Block for CMS pages URL rewrites * * @method \Magento\Cms\Model\Page getCmsPage() - * @method \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit setCmsPage(\Magento\Cms\Model\Page $cmsPage) + * @method \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit setCmsPage(\Magento\Cms\Model\Page $cmsPage) * * @category Magento * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Urlrewrite\Cms\Page; +namespace Magento\Backend\Block\Urlrewrite\Cms\Page; -class Edit extends \Magento\Adminhtml\Block\Urlrewrite\Edit +class Edit extends \Magento\Backend\Block\Urlrewrite\Edit { /** * @var \Magento\Cms\Model\PageFactory @@ -100,7 +100,7 @@ class Edit extends \Magento\Adminhtml\Block\Urlrewrite\Edit */ private function _addCmsPageLinkBlock() { - $this->addChild('cms_page_link', 'Magento\Adminhtml\Block\Urlrewrite\Link', array( + $this->addChild('cms_page_link', 'Magento\Backend\Block\Urlrewrite\Link', array( 'item_url' => $this->_adminhtmlData->getUrl('adminhtml/*/*') . 'cms_page', 'item_name' => $this->getCmsPage()->getTitle(), 'label' => __('CMS page:') @@ -112,17 +112,17 @@ class Edit extends \Magento\Adminhtml\Block\Urlrewrite\Edit */ private function _addCmsPageGridBlock() { - $this->addChild('cms_pages_grid', 'Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Grid'); + $this->addChild('cms_pages_grid', 'Magento\Backend\Block\Urlrewrite\Cms\Page\Grid'); } /** * Creates edit form block * - * @return \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit\Form + * @return \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form */ protected function _createEditFormBlock() { - return $this->getLayout()->createBlock('Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit\Form', '', array( + return $this->getLayout()->createBlock('Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form', '', array( 'data' => array( 'cms_page' => $this->_getCmsPage(), 'url_rewrite' => $this->_getUrlRewrite() diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/Form.php b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/Form.php rename to app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php index 3b1ffc4dfc5..14f7f006950 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/Form.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php @@ -28,20 +28,20 @@ * Edit form for CMS page URL rewrites * * @method \Magento\Cms\Model\Page getCmsPage() - * @method \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit\Form setCmsPage(\Magento\Cms\Model\Page $model) + * @method \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form setCmsPage(\Magento\Cms\Model\Page $model) * * @category Magento * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> * */ -namespace Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit; +namespace Magento\Backend\Block\Urlrewrite\Cms\Page\Edit; /** * @SuppressWarnings(PHPMD.DepthOfInheritance) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Form extends \Magento\Adminhtml\Block\Urlrewrite\Edit\Form +class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form { /** * @var \Magento\Cms\Model\PageFactory @@ -100,7 +100,7 @@ class Form extends \Magento\Adminhtml\Block\Urlrewrite\Edit\Form * Form post init * * @param \Magento\Data\Form $form - * @return \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit\Form + * @return \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form */ protected function _formPostInit($form) { diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Grid.php b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Grid.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Grid.php rename to app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Grid.php index 3c6b2c1c2c5..f5e089eeb55 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Grid.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Grid.php @@ -31,7 +31,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Urlrewrite\Cms\Page; +namespace Magento\Backend\Block\Urlrewrite\Cms\Page; class Grid extends \Magento\Cms\Block\Adminhtml\Page\Grid { @@ -47,7 +47,7 @@ class Grid extends \Magento\Cms\Block\Adminhtml\Page\Grid /** * Disable massaction * - * @return \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Grid + * @return \Magento\Backend\Block\Urlrewrite\Cms\Page\Grid */ protected function _prepareMassaction() { @@ -57,7 +57,7 @@ class Grid extends \Magento\Cms\Block\Adminhtml\Page\Grid /** * Prepare columns layout * - * @return \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Grid + * @return \Magento\Backend\Block\Urlrewrite\Cms\Page\Grid */ protected function _prepareColumns() { diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Edit.php b/app/code/Magento/Backend/Block/Urlrewrite/Edit.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/Urlrewrite/Edit.php rename to app/code/Magento/Backend/Block/Urlrewrite/Edit.php index a412712b577..a55dbeb33ea 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Edit.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Edit.php @@ -28,18 +28,18 @@ * Block for URL rewrites edit page * * @method \Magento\Core\Model\Url\Rewrite getUrlRewrite() - * @method \Magento\Adminhtml\Block\Urlrewrite\Edit setUrlRewrite(\Magento\Core\Model\Url\Rewrite $urlRewrite) + * @method \Magento\Backend\Block\Urlrewrite\Edit setUrlRewrite(\Magento\Core\Model\Url\Rewrite $urlRewrite) * * @category Magento * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Urlrewrite; +namespace Magento\Backend\Block\Urlrewrite; -class Edit extends \Magento\Adminhtml\Block\Widget\Container +class Edit extends \Magento\Backend\Block\Widget\Container { /** - * @var \Magento\Adminhtml\Block\Urlrewrite\Selector + * @var \Magento\Backend\Block\Urlrewrite\Selector */ private $_selectorBlock; @@ -89,7 +89,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Container /** * Prepare URL rewrite editing layout * - * @return \Magento\Adminhtml\Block\Urlrewrite\Edit + * @return \Magento\Backend\Block\Urlrewrite\Edit */ protected function _prepareLayout() { @@ -207,11 +207,11 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Container /** * Creates edit form block * - * @return \Magento\Adminhtml\Block\Urlrewrite\Edit\Form + * @return \Magento\Backend\Block\Urlrewrite\Edit\Form */ protected function _createEditFormBlock() { - return $this->getLayout()->createBlock('Magento\Adminhtml\Block\Urlrewrite\Edit\Form', '', + return $this->getLayout()->createBlock('Magento\Backend\Block\Urlrewrite\Edit\Form', '', array('data' => array( 'url_rewrite' => $this->_getUrlRewrite() )) @@ -229,12 +229,12 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Container /** * Get selector block * - * @return \Magento\Adminhtml\Block\Urlrewrite\Selector + * @return \Magento\Backend\Block\Urlrewrite\Selector */ private function _getSelectorBlock() { if (!$this->_selectorBlock) { - $this->_selectorBlock = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Urlrewrite\Selector'); + $this->_selectorBlock = $this->getLayout()->createBlock('Magento\Backend\Block\Urlrewrite\Selector'); } return $this->_selectorBlock; } diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Edit/Form.php b/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/Urlrewrite/Edit/Form.php rename to app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php index 04f0465b272..98a97d41420 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Edit/Form.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php @@ -28,14 +28,14 @@ * URL rewrites edit form * * @method \Magento\Core\Model\Url\Rewrite getUrlRewrite() - * @method \Magento\Adminhtml\Block\Urlrewrite\Edit\Form setUrlRewrite(\Magento\Core\Model\Url\Rewrite $model) + * @method \Magento\Backend\Block\Urlrewrite\Edit\Form setUrlRewrite(\Magento\Core\Model\Url\Rewrite $model) * * @category Magento * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> * */ -namespace Magento\Adminhtml\Block\Urlrewrite\Edit; +namespace Magento\Backend\Block\Urlrewrite\Edit; /** * @SuppressWarnings(PHPMD.DepthOfInheritance) @@ -136,7 +136,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * Initialize form values * Set form data either from model values or from session * - * @return \Magento\Adminhtml\Block\Urlrewrite\Edit\Form + * @return \Magento\Backend\Block\Urlrewrite\Edit\Form */ protected function _initFormValues() { @@ -165,7 +165,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Prepare the form layout * - * @return \Magento\Adminhtml\Block\Urlrewrite\Edit\Form + * @return \Magento\Backend\Block\Urlrewrite\Edit\Form */ protected function _prepareForm() { @@ -286,7 +286,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * Form post init * * @param \Magento\Data\Form $form - * @return \Magento\Adminhtml\Block\Urlrewrite\Edit\Form + * @return \Magento\Backend\Block\Urlrewrite\Edit\Form */ protected function _formPostInit($form) { diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Link.php b/app/code/Magento/Backend/Block/Urlrewrite/Link.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/Urlrewrite/Link.php rename to app/code/Magento/Backend/Block/Urlrewrite/Link.php index 333ffdfdd05..6652e4d0ea0 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Link.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Link.php @@ -35,7 +35,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Urlrewrite; +namespace Magento\Backend\Block\Urlrewrite; class Link extends \Magento\View\Element\AbstractBlock { diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Selector.php b/app/code/Magento/Backend/Block/Urlrewrite/Selector.php similarity index 98% rename from app/code/Magento/Adminhtml/Block/Urlrewrite/Selector.php rename to app/code/Magento/Backend/Block/Urlrewrite/Selector.php index 648f5d328e2..7c8ff91c27f 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Selector.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Selector.php @@ -31,7 +31,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Urlrewrite; +namespace Magento\Backend\Block\Urlrewrite; class Selector extends \Magento\View\Element\Template { diff --git a/app/code/Magento/Backend/Block/Widget/Grid.php b/app/code/Magento/Backend/Block/Widget/Grid.php index 87423d607b7..5384292673d 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid.php +++ b/app/code/Magento/Backend/Block/Widget/Grid.php @@ -119,16 +119,24 @@ class Grid extends \Magento\Backend\Block\Widget */ protected $_backendSession; + /** + * @var \Magento\Backend\Helper\Data + */ + protected $_backendHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, array $data = array() ) { + $this->_backendHelper = $backendHelper; $this->_urlModel = $urlModel; $this->_backendSession = $context->getBackendSession(); parent::__construct($context, $data); @@ -337,7 +345,7 @@ class Grid extends \Magento\Backend\Block\Widget } if (is_string($filter)) { - $data = $this->helper('Magento\Backend\Helper\Data')->prepareFilterString($filter); + $data = $this->_backendHelper->prepareFilterString($filter); $data = array_merge($data, (array)$this->getRequest()->getPost($this->getVarNameFilter())); $this->_setFilterValues($data); } else if ($filter && is_array($filter)) { @@ -363,7 +371,7 @@ class Grid extends \Magento\Backend\Block\Widget */ protected function _decodeFilter(&$value) { - $value = $this->helper('Magento\Backend\Helper\Data')->decodeFilter($value); + $value = $this->_backendHelper->decodeFilter($value); } /** diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Export.php b/app/code/Magento/Backend/Block/Widget/Grid/Export.php index c4a194c43cf..28c1faee7e3 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Export.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Export.php @@ -55,14 +55,21 @@ class Export protected $_template = "Magento_Backend::widget/grid/export.phtml"; /** - * @var string + * @var \Magento\Data\CollectionFactory */ - protected $_exportPath; + protected $_collectionFactory; /** - * @var \Magento\Data\CollectionFactory + * @var \Magento\Filesystem\Directory\WriteInterface */ - protected $_collectionFactory; + protected $_directory; + + /** + * Additional path to folder + * + * @var string + */ + protected $_path = 'export'; /** * @param \Magento\Backend\Block\Template\Context $context @@ -89,7 +96,7 @@ class Export $this->addExportType($type['urlPath'], $type['label']); } } - $this->_exportPath = $this->_dirs->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'export'; + $this->_directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); } /** @@ -206,7 +213,7 @@ class Export */ protected function _getFileContainerContent(array $fileData) { - return $this->_filesystem->read($fileData['value'], $this->_exportPath); + return $this->_directory->readFile('export/' . $fileData['value']); } /** @@ -283,9 +290,9 @@ class Export * Write item data to csv export file * * @param \Magento\Object $item - * @param \Magento\Filesystem\StreamInterface $stream + * @param \Magento\Filesystem\File\WriteInterface $stream */ - protected function _exportCsvItem(\Magento\Object $item, \Magento\Filesystem\StreamInterface $stream) + protected function _exportCsvItem(\Magento\Object $item, \Magento\Filesystem\File\WriteInterface $stream) { $row = array(); foreach ($this->_getColumns() as $column) { @@ -306,21 +313,17 @@ class Export public function getCsvFile() { $name = md5(microtime()); - $file = $this->_exportPath . DS . $name . '.csv'; + $file = $this->_path . '/' . $name . '.csv'; - $this->_filesystem->setIsAllowCreateDirectories(true); - $this->_filesystem->ensureDirectoryExists($this->_exportPath); - $stream = $this->_filesystem->createAndOpenStream($file, 'w+', $this->_exportPath); + $this->_directory->create($this->_path); + $stream = $this->_directory->openFile($file, 'w+'); $stream->writeCsv($this->_getExportHeaders()); - $stream->lock(true); - + $stream->lock(); $this->_exportIterateCollection('_exportCsvItem', array($stream)); - if ($this->getCountTotals()) { $stream->writeCsv($this->_getExportTotals()); } - $stream->unlock(); $stream->close(); @@ -433,12 +436,11 @@ class Export $convert = new \Magento\Convert\Excel($collection->getIterator(), array($this, 'getRowRecord')); $name = md5(microtime()); - $file = $this->_exportPath . DS . $name . '.xml'; + $file = $this->_path . '/' . $name . '.xml'; - $this->_filesystem->setIsAllowCreateDirectories(true); - $this->_filesystem->ensureDirectoryExists($this->_exportPath); - $stream = $this->_filesystem->createAndOpenStream($file, 'w+', $this->_exportPath); - $stream->lock(true); + $this->_directory->create($this->_path); + $stream = $this->_directory->openFile($file, 'w+'); + $stream->lock(); $convert->setDataHeader($this->_getExportHeaders()); if ($this->getCountTotals()) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Extended.php b/app/code/Magento/Backend/Block/Widget/Grid/Extended.php index 27710cfc645..c91b5ff4e0a 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Extended.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Extended.php @@ -176,15 +176,23 @@ class Extended protected $_template = 'Magento_Backend::widget/grid/extended.phtml'; /** + * @var \Magento\Filesystem\Directory\WriteInterface + */ + protected $_directory; + + /** + * Additional path to folder + * * @var string */ - protected $_exportPath; + protected $_path = 'export'; protected function _construct() { parent::_construct(); $this->_emptyText = __('We couldn\'t find any records.'); - $this->_exportPath = $this->_dirs->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'export'; + + $this->_directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); } /** @@ -874,7 +882,7 @@ class Extended */ protected function _getFileContainerContent(array $fileData) { - return $this->_filesystem->read($fileData['value'], $this->_exportPath); + return $this->_directory->readFile('export/' . $fileData['value']); } /** @@ -950,9 +958,9 @@ class Extended * Write item data to csv export file * * @param \Magento\Object $item - * @param \Magento\Filesystem\StreamInterface $stream + * @param \Magento\Filesystem\File\WriteInterface $stream */ - protected function _exportCsvItem(\Magento\Object $item, \Magento\Filesystem\StreamInterface $stream) + protected function _exportCsvItem(\Magento\Object $item, \Magento\Filesystem\File\WriteInterface $stream) { $row = array(); foreach ($this->getColumns() as $column) { @@ -976,13 +984,13 @@ class Extended $this->_prepareGrid(); $name = md5(microtime()); - $file = $this->_exportPath . DS . $name . '.csv'; + $file = $this->_path . '/' . $name . '.csv'; - $this->_filesystem->setIsAllowCreateDirectories(true)->ensureDirectoryExists($this->_exportPath); - $stream = $this->_filesystem->createAndOpenStream($file, 'w+', $this->_exportPath); - $stream->lock(true); - $stream->writeCsv($this->_getExportHeaders()); + $this->_directory->create($this->_path); + $stream = $this->_directory->openFile($file, 'w+'); + $stream->lock(); + $stream->writeCsv($this->_getExportHeaders()); $this->_exportIterateCollection('_exportCsvItem', array($stream)); if ($this->getCountTotals()) { @@ -1111,11 +1119,11 @@ class Extended $convert = new \Magento\Convert\Excel($this->getCollection()->getIterator(), array($this, 'getRowRecord')); $name = md5(microtime()); - $file = $this->_exportPath . DS . $name . '.xml'; + $file = $this->_path . '/' . $name . '.xml'; - $this->_filesystem->setIsAllowCreateDirectories(true)->ensureDirectoryExists($this->_exportPath); - $stream = $this->_filesystem->createAndOpenStream($file, 'w+', $this->_exportPath); - $stream->lock(true); + $this->_directory->create($this->_path); + $stream = $this->_directory->openFile($file, 'w+'); + $stream->lock(); $convert->setDataHeader($this->_getExportHeaders()); if ($this->getCountTotals()) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php index 2b9c927caf6..cfc1b8f6f33 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php @@ -44,13 +44,6 @@ abstract class AbstractMassaction extends \Magento\Backend\Block\Widget */ protected $_jsonEncoder; - /** - * Backend data helper - * - * @var \Magento\Backend\Helper\Data - */ - protected $_backendHelper; - /** * Massaction items * diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Auth.php b/app/code/Magento/Backend/Controller/Adminhtml/Auth.php index 513ac3505ff..364d2df7c24 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Auth.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Auth.php @@ -53,7 +53,7 @@ class Auth extends \Magento\Backend\App\AbstractAction public function logoutAction() { $this->_auth->logout(); - $this->_auth->getAuthStorage()->addSuccess(__('You have logged out.')); + $this->messageManager->addSuccess(__('You have logged out.')); $this->getResponse()->setRedirect($this->_objectManager->get('Magento\Backend\Helper\Data')->getHomePageUrl()); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache.php index 5668dce84c5..edb6bef1be1 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache.php @@ -63,16 +63,6 @@ class Cache extends \Magento\Backend\App\Action $this->_cacheFrontendPool = $cacheFrontendPool; } - /** - * Retrieve session model - * - * @return \Magento\Adminhtml\Model\Session - */ - protected function _getSession() - { - return $this->_objectManager->get('Magento\Core\Model\Session\AbstractSession'); - } - /** * Display cache management grid */ @@ -95,7 +85,7 @@ class Cache extends \Magento\Backend\App\Action foreach ($this->_cacheFrontendPool as $cacheFrontend) { $cacheFrontend->getBackend()->clean(); } - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __("You flushed the cache storage.") ); $this->_redirect('adminhtml/*'); @@ -111,9 +101,7 @@ class Cache extends \Magento\Backend\App\Action $cacheFrontend->clean(); } $this->_eventManager->dispatch('adminhtml_cache_flush_system'); - $this->_getSession()->addSuccess( - __("The Magento cache storage has been flushed.") - ); + $this->messageManager->addSuccess(__("The Magento cache storage has been flushed.")); $this->_redirect('adminhtml/*'); } @@ -137,18 +125,14 @@ class Cache extends \Magento\Backend\App\Action } if ($updatedTypes > 0) { $this->_cacheState->persist(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __("%1 cache type(s) enabled.", $updatedTypes) ); } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); - } - catch (\Exception $e) { - $this->_getSession()->addException( - $e, - __('An error occurred while enabling cache.') - ); + $this->messageManager->addError($e->getMessage()); + } catch (\Exception $e) { + $this->messageManager->addException($e, __('An error occurred while enabling cache.')); } $this->_redirect('adminhtml/*'); } @@ -174,14 +158,14 @@ class Cache extends \Magento\Backend\App\Action } if ($updatedTypes > 0) { $this->_cacheState->persist(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __("%1 cache type(s) disabled.", $updatedTypes) ); } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException( + $this->messageManager->addException( $e, __('An error occurred while disabling cache.') ); @@ -207,12 +191,12 @@ class Cache extends \Magento\Backend\App\Action $updatedTypes++; } if ($updatedTypes > 0) { - $this->_getSession()->addSuccess(__("%1 cache type(s) refreshed.", $updatedTypes)); + $this->messageManager->addSuccess(__("%1 cache type(s) refreshed.", $updatedTypes)); } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException($e, __('An error occurred while refreshing cache.')); + $this->messageManager->addException($e, __('An error occurred while refreshing cache.')); } $this->_redirect('adminhtml/*'); } @@ -243,11 +227,11 @@ class Cache extends \Magento\Backend\App\Action $this->_objectManager->get('Magento\View\Asset\MergeService') ->cleanMergedJsCss(); $this->_eventManager->dispatch('clean_media_cache_after'); - $this->_getSession()->addSuccess(__('The JavaScript/CSS cache has been cleaned.')); + $this->messageManager->addSuccess(__('The JavaScript/CSS cache has been cleaned.')); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException( + $this->messageManager->addException( $e, __('An error occurred while clearing the JavaScript/CSS cache.') ); @@ -263,13 +247,13 @@ class Cache extends \Magento\Backend\App\Action try { $this->_objectManager->create('Magento\Catalog\Model\Product\Image')->clearCache(); $this->_eventManager->dispatch('clean_catalog_images_cache_after'); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('The image cache was cleaned.') ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException( + $this->messageManager->addException( $e, __('An error occurred while clearing the image cache.') ); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/AbstractConfig.php b/app/code/Magento/Backend/Controller/Adminhtml/System/AbstractConfig.php index 0f61f779381..2ed4dd45ed6 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/AbstractConfig.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/AbstractConfig.php @@ -54,7 +54,7 @@ abstract class AbstractConfig extends \Magento\Backend\App\AbstractAction * Check if current section is found and is allowed * * @param \Magento\App\RequestInterface $request - * @return $this|mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(\Magento\App\RequestInterface $request) { diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php index 6bab53bc587..2401b43abb5 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php @@ -80,13 +80,13 @@ class Account extends \Magento\Backend\App\Action try { $user->save(); $user->sendPasswordResetNotificationEmail(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('The account has been saved.') ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addMessages($e->getMessages()); + $this->messageManager->addMessages($e->getMessages()); } catch (\Exception $e) { - $this->_getSession()->addError( + $this->messageManager->addError( __('An error occurred while saving account.') ); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php index ec6a87db567..8e78a2d5c3b 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php @@ -102,16 +102,16 @@ class Save extends \Magento\Backend\Controller\Adminhtml\System\AbstractConfig $configModel = $this->_configFactory->create(array('data' => $configData)); $configModel->save(); - $this->_session->addSuccess( + $this->messageManager->addSuccess( __('You saved the configuration.') ); } catch (\Magento\Core\Exception $e) { $messages = explode("\n", $e->getMessage()); foreach ($messages as $message) { - $this->_session->addError($message); + $this->messageManager->addError($message); } } catch (\Exception $e) { - $this->_session->addException( + $this->messageManager->addException( $e, __('An error occurred while saving this configuration:') . ' ' . $e->getMessage() ); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php index 74e55caa5e7..787ec2188c1 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php @@ -109,11 +109,10 @@ class Design extends \Magento\Backend\App\Action try { $design->save(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('You saved the design change.')); + $this->messageManager->addSuccess(__('You saved the design change.')); } catch (\Exception $e){ - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError($e->getMessage()) - ->setDesignData($data); + $this->messageManager->addError($e->getMessage()); + $this->_objectManager->get('Magento\Backend\Model\Session')->setDesignData($data); $this->_redirect('adminhtml/*/edit', array('id'=>$design->getId())); return; } @@ -130,15 +129,11 @@ class Design extends \Magento\Backend\App\Action try { $design->delete(); - - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addSuccess(__('You deleted the design change.')); + $this->messageManager->addSuccess(__('You deleted the design change.')); } catch (\Magento\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addException($e, __("Cannot delete the design change.")); + $this->messageManager->addException($e, __("Cannot delete the design change.")); } } $this->getResponse()->setRedirect($this->getUrl('adminhtml/*/')); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php index d6ae70931e1..fb27a38d8f4 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php @@ -121,10 +121,9 @@ class Store extends \Magento\Backend\App\Action { $this->_title->add(__('Stores')); - $session = $this->_getSession(); - if ($session->getPostData()) { - $this->_coreRegistry->register('store_post_data', $session->getPostData()); - $session->unsPostData(); + if ($this->_getSession()->getPostData()) { + $this->_coreRegistry->register('store_post_data', $this->_getSession()->getPostData()); + $this->_getSession()->unsPostData(); } if (!$this->_coreRegistry->registry('store_type')) { $this->_coreRegistry->register('store_type', 'store'); @@ -171,14 +170,14 @@ class Store extends \Magento\Backend\App\Action } if ($this->_coreRegistry->registry('store_action') == 'edit' && $codeBase && !$model->isReadOnly()) { - $this->_getSession()->addNotice($codeBase); + $this->messageManager->addNotice($codeBase); } $this->_initAction() ->_addContent($this->_view->getLayout()->createBlock('Magento\Backend\Block\System\Store\Edit')); $this->_view->renderLayout(); } else { - $session->addError($notExists); + $this->messageManager->addError($notExists); $this->_redirect('adminhtml/*/'); } } @@ -190,7 +189,6 @@ class Store extends \Magento\Backend\App\Action $this->_redirect('adminhtml/*/'); return; } - $session = $this->_getSession(); try { switch ($postData['store_type']) { @@ -206,7 +204,7 @@ class Store extends \Magento\Backend\App\Action } $websiteModel->save(); - $session->addSuccess(__('The website has been saved.')); + $this->messageManager->addSuccess(__('The website has been saved.')); break; case 'group': @@ -224,7 +222,7 @@ class Store extends \Magento\Backend\App\Action $this->_eventManager->dispatch('store_group_save', array('group' => $groupModel)); - $session->addSuccess(__('The store has been saved.')); + $this->messageManager->addSuccess(__('The store has been saved.')); break; case 'store': @@ -248,7 +246,7 @@ class Store extends \Magento\Backend\App\Action $this->_eventManager->dispatch($eventName, array('store'=>$storeModel)); - $session->addSuccess(__('The store view has been saved')); + $this->messageManager->addSuccess(__('The store view has been saved')); break; default: $this->_redirect('adminhtml/*/'); @@ -257,11 +255,11 @@ class Store extends \Magento\Backend\App\Action $this->_redirect('adminhtml/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addMessages($e->getMessages()); - $session->setPostData($postData); + $this->messageManager->addMessages($e->getMessages()); + $this->_getSession()->setPostData($postData); } catch (\Exception $e) { - $session->addException($e, __('An error occurred while saving. Please review the error log.')); - $session->setPostData($postData); + $this->messageManager->addException($e, __('An error occurred while saving. Please review the error log.')); + $this->_getSession()->setPostData($postData); } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); return; @@ -273,15 +271,14 @@ class Store extends \Magento\Backend\App\Action { $this->_title->add(__('Delete Web Site')); - $session = $this->_getSession(); $itemId = $this->getRequest()->getParam('item_id', null); if (!$model = $this->_objectManager->create('Magento\Core\Model\Website')->load($itemId)) { - $session->addError(__('Unable to proceed. Please, try again.')); + $this->messageManager->addError(__('Unable to proceed. Please, try again.')); $this->_redirect('adminhtml/*/'); return ; } if (!$model->isCanDelete()) { - $session->addError(__('This website cannot be deleted.')); + $this->messageManager->addError(__('This website cannot be deleted.')); $this->_redirect('adminhtml/*/editWebsite', array('website_id' => $itemId)); return ; } @@ -303,15 +300,14 @@ class Store extends \Magento\Backend\App\Action { $this->_title->add(__('Delete Store')); - $session = $this->_getSession(); $itemId = $this->getRequest()->getParam('item_id', null); if (!$model = $this->_objectManager->create('Magento\Core\Model\Store\Group')->load($itemId)) { - $session->addError(__('Unable to proceed. Please, try again.')); + $this->messageManager->addError(__('Unable to proceed. Please, try again.')); $this->_redirect('adminhtml/*/'); return ; } if (!$model->isCanDelete()) { - $session->addError(__('This store cannot be deleted.')); + $this->messageManager->addError(__('This store cannot be deleted.')); $this->_redirect('adminhtml/*/editGroup', array('group_id' => $itemId)); return ; } @@ -333,15 +329,14 @@ class Store extends \Magento\Backend\App\Action { $this->_title->add(__('Delete Store View')); - $session = $this->_getSession(); $itemId = $this->getRequest()->getParam('item_id', null); if (!$model = $this->_objectManager->create('Magento\Core\Model\Store')->load($itemId)) { - $session->addError(__('Unable to proceed. Please, try again.')); + $this->messageManager->addError(__('Unable to proceed. Please, try again.')); $this->_redirect('adminhtml/*/'); return ; } if (!$model->isCanDelete()) { - $session->addError(__('This store view cannot be deleted.')); + $this->messageManager->addError(__('This store view cannot be deleted.')); $this->_redirect('adminhtml/*/editStore', array('store_id' => $itemId)); return ; } @@ -365,12 +360,12 @@ class Store extends \Magento\Backend\App\Action $model = $this->_objectManager->create('Magento\Core\Model\Website')->load($itemId); if (!$model) { - $this->_getSession()->addError(__('Unable to proceed. Please, try again')); + $this->messageManager->addError(__('Unable to proceed. Please, try again')); $this->_redirect('adminhtml/*/'); return ; } if (!$model->isCanDelete()) { - $this->_getSession()->addError(__('This website cannot be deleted.')); + $this->messageManager->addError(__('This website cannot be deleted.')); $this->_redirect('adminhtml/*/editWebsite', array('website_id' => $model->getId())); return ; } @@ -379,13 +374,13 @@ class Store extends \Magento\Backend\App\Action try { $model->delete(); - $this->_getSession()->addSuccess(__('The website has been deleted.')); + $this->messageManager->addSuccess(__('The website has been deleted.')); $this->_redirect('adminhtml/*/'); return ; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException($e, __('Unable to delete website. Please, try again later.')); + $this->messageManager->addException($e, __('Unable to delete website. Please, try again later.')); } $this->_redirect('adminhtml/*/editWebsite', array('website_id' => $itemId)); } @@ -395,12 +390,12 @@ class Store extends \Magento\Backend\App\Action $itemId = $this->getRequest()->getParam('item_id'); if (!$model = $this->_objectManager->create('Magento\Core\Model\Store\Group')->load($itemId)) { - $this->_getSession()->addError(__('Unable to proceed. Please, try again.')); + $this->messageManager->addError(__('Unable to proceed. Please, try again.')); $this->_redirect('adminhtml/*/'); return ; } if (!$model->isCanDelete()) { - $this->_getSession()->addError(__('This store cannot be deleted.')); + $this->messageManager->addError(__('This store cannot be deleted.')); $this->_redirect('adminhtml/*/editGroup', array('group_id' => $model->getId())); return ; } @@ -409,13 +404,13 @@ class Store extends \Magento\Backend\App\Action try { $model->delete(); - $this->_getSession()->addSuccess(__('The store has been deleted.')); + $this->messageManager->addSuccess(__('The store has been deleted.')); $this->_redirect('adminhtml/*/'); return ; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException($e, __('Unable to delete store. Please, try again later.')); + $this->messageManager->addException($e, __('Unable to delete store. Please, try again later.')); } $this->_redirect('adminhtml/*/editGroup', array('group_id' => $itemId)); } @@ -429,12 +424,12 @@ class Store extends \Magento\Backend\App\Action $itemId = $this->getRequest()->getParam('item_id'); if (!$model = $this->_objectManager->create('Magento\Core\Model\Store')->load($itemId)) { - $this->_getSession()->addError(__('Unable to proceed. Please, try again')); + $this->messageManager->addError(__('Unable to proceed. Please, try again')); $this->_redirect('adminhtml/*/'); return ; } if (!$model->isCanDelete()) { - $this->_getSession()->addError(__('This store view cannot be deleted.')); + $this->messageManager->addError(__('This store view cannot be deleted.')); $this->_redirect('adminhtml/*/editStore', array('store_id' => $model->getId())); return ; } @@ -446,13 +441,13 @@ class Store extends \Magento\Backend\App\Action $this->_eventManager->dispatch('store_delete', array('store' => $model)); - $this->_getSession()->addSuccess(__('The store view has been deleted.')); + $this->messageManager->addSuccess(__('The store view has been deleted.')); $this->_redirect('adminhtml/*/'); return ; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException($e, __('Unable to delete store view. Please, try again later.')); + $this->messageManager->addException($e, __('Unable to delete store view. Please, try again later.')); } $this->_redirect('adminhtml/*/editStore', array('store_id' => $itemId)); } @@ -479,16 +474,18 @@ class Store extends \Magento\Backend\App\Action $backup = $this->_objectManager->create('Magento\Backup\Model\Backup') ->setTime(time()) ->setType('db') - ->setPath($this->_objectManager->get('Magento\App\Dir')->getDir('var') . DS . 'backups'); + ->setPath( + $this->_objectManager->get('Magento\Filesystem')->getPath(\Magento\Filesystem::VAR_DIR) . '/backups' + ); $backupDb->createBackup($backup); - $this->_getSession()->addSuccess(__('The database was backed up.')); + $this->messageManager->addSuccess(__('The database was backed up.')); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect($failPath, $arguments); return ; } catch (\Exception $e) { - $this->_getSession()->addException($e, __('We couldn\'t create a backup right now. Please try again later.')); + $this->messageManager->addException($e, __('We couldn\'t create a backup right now. Please try again later.')); $this->_redirect($failPath, $arguments); return ; } @@ -503,7 +500,7 @@ class Store extends \Magento\Backend\App\Action */ protected function _addDeletionNotice($typeTitle) { - $this->_getSession()->addNotice( + $this->messageManager->addNotice( __('Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.), but the %1 will not be able to be restored. It is suggested that you create a database backup before deleting the %1.', $typeTitle) ); return $this; diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Variable.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Variable.php index d7203803eb7..78ef40ef4d4 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Variable.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Variable.php @@ -136,8 +136,8 @@ class Variable extends \Magento\Backend\App\Action $variable->addData($this->getRequest()->getPost('variable')); $result = $variable->validate(); if ($result !== true && is_string($result)) { - $this->_getSession()->addError($result); - $this->_view->getLayout()->initMessages('Magento\Adminhtml\Model\Session'); + $this->messageManager->addError($result); + $this->_view->getLayout()->initMessages(); $response->setError(true); $response->setMessage($this->_view->getLayout()->getMessagesBlock()->getGroupedHtml()); } @@ -157,7 +157,7 @@ class Variable extends \Magento\Backend\App\Action $variable->setData($data); try { $variable->save(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('You saved the custom variable.') ); if ($back) { @@ -167,7 +167,7 @@ class Variable extends \Magento\Backend\App\Action } return; } catch (\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('adminhtml/*/edit', array('_current' => true, )); return; } @@ -185,11 +185,11 @@ class Variable extends \Magento\Backend\App\Action if ($variable->getId()) { try { $variable->delete(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('You deleted the customer.') ); } catch (\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('adminhtml/*/edit', array('_current' => true, )); return; } diff --git a/app/code/Magento/Adminhtml/Controller/Urlrewrite.php b/app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php similarity index 90% rename from app/code/Magento/Adminhtml/Controller/Urlrewrite.php rename to app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php index 712e86affb5..0474b59aa8c 100644 --- a/app/code/Magento/Adminhtml/Controller/Urlrewrite.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php @@ -31,7 +31,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller; +namespace Magento\Backend\Controller\Adminhtml; class Urlrewrite extends \Magento\Backend\App\Action { @@ -88,7 +88,7 @@ class Urlrewrite extends \Magento\Backend\App\Action switch ($mode) { case self::PRODUCT_MODE: $editBlock = $this->_view->getLayout() - ->createBlock('Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit', '', array('data' => array( + ->createBlock('Magento\Backend\Block\Urlrewrite\Catalog\Product\Edit', '', array('data' => array( 'category' => $this->_getCategory(), 'product' => $this->_getProduct(), 'is_category_mode' => $this->getRequest()->has('category'), @@ -97,7 +97,7 @@ class Urlrewrite extends \Magento\Backend\App\Action break; case self::CATEGORY_MODE: $editBlock = $this->_view->getLayout() - ->createBlock('Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Edit', '', array('data' => array( + ->createBlock('Magento\Backend\Block\Urlrewrite\Catalog\Category\Edit', '', array('data' => array( 'category' => $this->_getCategory(), 'url_rewrite' => $this->_getUrlRewrite() ))); @@ -105,7 +105,7 @@ class Urlrewrite extends \Magento\Backend\App\Action case self::CMS_PAGE_MODE: $editBlock = $this->_view->getLayout() ->createBlock( - 'Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit', '', + 'Magento\Backend\Block\Urlrewrite\Cms\Page\Edit', '', array( 'data' => array( 'cms_page' => $this->_getCmsPage(), @@ -117,7 +117,7 @@ class Urlrewrite extends \Magento\Backend\App\Action case self::ID_MODE: default: $editBlock = $this->_view->getLayout()->createBlock( - 'Magento\Adminhtml\Block\Urlrewrite\Edit', '', array( + 'Magento\Backend\Block\Urlrewrite\Edit', '', array( 'data' => array('url_rewrite' => $this->_getUrlRewrite()) )); break; @@ -146,7 +146,7 @@ class Urlrewrite extends \Magento\Backend\App\Action } elseif ($this->getRequest()->has('id')) { $mode = self::ID_MODE; } else { - $mode = $this->_objectManager->get('Magento\Adminhtml\Block\Urlrewrite\Selector')->getDefaultMode(); + $mode = $this->_objectManager->get('Magento\Backend\Block\Urlrewrite\Selector')->getDefaultMode(); } return $mode; } @@ -157,7 +157,7 @@ class Urlrewrite extends \Magento\Backend\App\Action public function productGridAction() { $this->getResponse()->setBody( - $this->_view->getLayout()->createBlock('Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Grid')->toHtml() + $this->_view->getLayout()->createBlock('Magento\Backend\Block\Urlrewrite\Catalog\Product\Grid')->toHtml() ); } @@ -168,7 +168,7 @@ class Urlrewrite extends \Magento\Backend\App\Action { $categoryId = $this->getRequest()->getParam('id', null); $this->getResponse()->setBody( - $this->_objectManager->get('Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree') + $this->_objectManager->get('Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree') ->getTreeArray($categoryId, true, 1) ); } @@ -179,7 +179,7 @@ class Urlrewrite extends \Magento\Backend\App\Action public function cmsPageGridAction() { $this->getResponse()->setBody( - $this->_view->getLayout()->createBlock('Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Grid')->toHtml() + $this->_view->getLayout()->createBlock('Magento\Backend\Block\Urlrewrite\Cms\Page\Grid')->toHtml() ); } @@ -189,8 +189,8 @@ class Urlrewrite extends \Magento\Backend\App\Action public function saveAction() { if ($data = $this->getRequest()->getPost()) { - /** @var $session \Magento\Adminhtml\Model\Session */ - $session = $this->_objectManager->get('Magento\Adminhtml\Model\Session'); + /** @var $session \Magento\Backend\Model\Session */ + $session = $this->_objectManager->get('Magento\Backend\Model\Session'); try { // set basic urlrewrite data /** @var $model \Magento\Core\Model\Url\Rewrite */ @@ -221,16 +221,15 @@ class Urlrewrite extends \Magento\Backend\App\Action $this->_onUrlRewriteSaveAfter($model); - $session->addSuccess(__('The URL Rewrite has been saved.')); + $this->messageManager->addSuccess(__('The URL Rewrite has been saved.')); $this->_redirect('adminhtml/*/'); return; } catch (\Magento\Core\Exception $e) { - $session->addError($e->getMessage()) - ->setUrlrewriteData($data); + $this->messageManager->addError($e->getMessage()); + $session->setUrlrewriteData($data); } catch (\Exception $e) { - $session->addException($e, - __('An error occurred while saving URL Rewrite.')) - ->setUrlrewriteData($data); + $this->messageManager->addException($e, __('An error occurred while saving URL Rewrite.')); + $session->setUrlrewriteData($data); } } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); @@ -406,14 +405,9 @@ class Urlrewrite extends \Magento\Backend\App\Action if ($this->_getUrlRewrite()->getId()) { try { $this->_getUrlRewrite()->delete(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('The URL Rewrite has been deleted.') - ); + $this->messageManager->addSuccess(__('The URL Rewrite has been deleted.')); } catch (\Exception $e) { - $errorMessage = - __('An error occurred while deleting URL Rewrite.'); - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addException($e, $errorMessage); + $this->messageManager->addException($e, __('An error occurred while deleting URL Rewrite.')); $this->_redirect('adminhtml/*/edit/', array('id' => $this->_getUrlRewrite()->getId())); return; } diff --git a/app/code/Magento/Adminhtml/Helper/Addresses.php b/app/code/Magento/Backend/Helper/Addresses.php similarity index 97% rename from app/code/Magento/Adminhtml/Helper/Addresses.php rename to app/code/Magento/Backend/Helper/Addresses.php index ddbf8e4943f..d8a450b98b3 100644 --- a/app/code/Magento/Adminhtml/Helper/Addresses.php +++ b/app/code/Magento/Backend/Helper/Addresses.php @@ -31,7 +31,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Helper; +namespace Magento\Backend\Helper; class Addresses extends \Magento\App\Helper\AbstractHelper { diff --git a/app/code/Magento/Adminhtml/Helper/Js.php b/app/code/Magento/Backend/Helper/Js.php similarity index 98% rename from app/code/Magento/Adminhtml/Helper/Js.php rename to app/code/Magento/Backend/Helper/Js.php index 29e86ec558a..45893036575 100644 --- a/app/code/Magento/Adminhtml/Helper/Js.php +++ b/app/code/Magento/Backend/Helper/Js.php @@ -31,7 +31,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Helper; +namespace Magento\Backend\Helper; class Js extends \Magento\Core\Helper\Js { diff --git a/app/code/Magento/Adminhtml/Helper/Media/Js.php b/app/code/Magento/Backend/Helper/Media/Js.php similarity index 98% rename from app/code/Magento/Adminhtml/Helper/Media/Js.php rename to app/code/Magento/Backend/Helper/Media/Js.php index 0189e26daa2..9a1108c8827 100644 --- a/app/code/Magento/Adminhtml/Helper/Media/Js.php +++ b/app/code/Magento/Backend/Helper/Media/Js.php @@ -33,7 +33,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Helper\Media; +namespace Magento\Backend\Helper\Media; class Js extends \Magento\Core\Helper\Js { diff --git a/app/code/Magento/Backend/Model/Auth/Session.php b/app/code/Magento/Backend/Model/Auth/Session.php index fb023198b7c..9b21e4e7d35 100644 --- a/app/code/Magento/Backend/Model/Auth/Session.php +++ b/app/code/Magento/Backend/Model/Auth/Session.php @@ -30,9 +30,10 @@ namespace Magento\Backend\Model\Auth; * Backend Auth session model * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @todo implement solution that keeps is_first_visit flag in session during redirects */ class Session - extends \Magento\Core\Model\Session\AbstractSession + extends \Magento\Session\SessionManager implements \Magento\Backend\Model\Auth\StorageInterface { const XML_PATH_SESSION_LIFETIME = 'admin/security/session_lifetime'; @@ -62,48 +63,32 @@ class Session protected $_config; /** - * @param \Magento\Core\Model\Session\Context $context + * @param \Magento\App\RequestInterface $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig + * @param \Magento\Session\SaveHandlerInterface $saveHandler + * @param \Magento\Session\ValidatorInterface $validator + * @param \Magento\Session\StorageInterface $storage * @param \Magento\Acl\Builder $aclBuilder * @param \Magento\Backend\Model\Url $backendUrl * @param \Magento\Backend\App\ConfigInterface $config - * @param array $data */ public function __construct( - \Magento\Core\Model\Session\Context $context, + \Magento\App\RequestInterface $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, + \Magento\Session\SaveHandlerInterface $saveHandler, + \Magento\Session\ValidatorInterface $validator, + \Magento\Session\StorageInterface $storage, \Magento\Acl\Builder $aclBuilder, \Magento\Backend\Model\Url $backendUrl, - \Magento\Backend\App\ConfigInterface $config, - array $data = array() + \Magento\Backend\App\ConfigInterface $config ) { $this->_config = $config; $this->_aclBuilder = $aclBuilder; $this->_backendUrl = $backendUrl; - parent::__construct($context, $sidResolver, $sessionConfig, $data); - $this->start('admin'); - } - - /** - * Pull out information from session whether there is currently the first page after log in - * - * The idea is to set this value on login(), then redirect happens, - * after that on next request the value is grabbed once the session is initialized - * Since the session is used as a singleton, the value will be in $_isFirstPageAfterLogin until the end of request, - * unless it is reset intentionally from somewhere - * - * @param string $namespace - * @param string $sessionName - * @return \Magento\Backend\Model\Auth\Session - * @see self::login() - */ - public function start($namespace = 'default', $sessionName = null) - { - parent::start($namespace, $sessionName); - // @todo implement solution that keeps is_first_visit flag in session during redirects - return $this; + parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage); + $this->start(); } /** 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 43ab9de7865..cc0e4140368 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php @@ -32,14 +32,14 @@ namespace Magento\Backend\Model\Config\Backend\Admin; class Robots extends \Magento\Core\Model\Config\Value { /** - * @var \Magento\Filesystem + * @var \Magento\Filesystem\Directory\Write */ - protected $_filesystem; + protected $_directory; /** * @var string */ - protected $_filePath; + protected $_file; /** * @param \Magento\Core\Model\Context $context @@ -47,7 +47,6 @@ class Robots extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Config $config * @param \Magento\Filesystem $filesystem - * @param \Magento\App\Dir $dir * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -58,7 +57,6 @@ class Robots extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Config $config, \Magento\Filesystem $filesystem, - \Magento\App\Dir $dir, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -72,8 +70,8 @@ class Robots extends \Magento\Core\Model\Config\Value $resourceCollection, $data ); - $this->_filesystem = $filesystem; - $this->_filePath = $dir->getDir(\Magento\App\Dir::ROOT) . '/robots.txt'; + $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $this->_file = 'robots.txt'; } /** @@ -83,9 +81,8 @@ class Robots extends \Magento\Core\Model\Config\Value */ protected function _getDefaultValue() { - $file = $this->_filePath; - if ($this->_filesystem->isFile($file)) { - return $this->_filesystem->read($file); + if ($this->_directory->isFile($this->_file)) { + return $this->_directory->readFile($this->_file); } return false; } @@ -97,7 +94,7 @@ class Robots extends \Magento\Core\Model\Config\Value */ protected function _afterLoad() { - if (!(string) $this->getValue()) { + if (!(string)$this->getValue()) { $this->setValue($this->_getDefaultValue()); } @@ -112,7 +109,7 @@ class Robots extends \Magento\Core\Model\Config\Value protected function _afterSave() { if ($this->getValue()) { - $this->_filesystem->write($this->_filePath, $this->getValue()); + $this->_directory->writeFile($this->_file, $this->getValue()); } return parent::_afterSave(); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Email/Logo.php b/app/code/Magento/Backend/Model/Config/Backend/Email/Logo.php index eac479fc862..d2063f33cc1 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Email/Logo.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Email/Logo.php @@ -40,11 +40,6 @@ class Logo extends \Magento\Backend\Model\Config\Backend\Image */ const UPLOAD_DIR = 'email/logo'; - /** - * Token for the root part of directory path for uploading - */ - const UPLOAD_ROOT_TOKEN = 'system/filesystem/media'; - /** * Upload max file size in kilobytes * @@ -59,10 +54,7 @@ class Logo extends \Magento\Backend\Model\Config\Backend\Image */ protected function _getUploadDir() { - $uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR); - $uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT_TOKEN); - $uploadDir = $uploadRoot . DS . $uploadDir; - return $uploadDir; + return $this->_mediaDirectory->getAbsolutePath($this->_appendScopeInfo(self::UPLOAD_DIR)); } /** @@ -89,8 +81,7 @@ class Logo extends \Magento\Backend\Model\Config\Backend\Image $fileTmpName = $_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value']; if ($this->getOldValue() && ($fileTmpName || $deleteFlag)) { - $uploadPath = $this->_getUploadRoot(self::UPLOAD_ROOT_TOKEN) . DS . self::UPLOAD_DIR; - $this->_filesystem->delete($uploadPath . DS . $this->getOldValue(), $uploadPath); + $this->_mediaDirectory->delete(self::UPLOAD_DIR . '/' . $this->getOldValue()); } return parent::_beforeSave(); } diff --git a/app/code/Magento/Backend/Model/Config/Backend/File.php b/app/code/Magento/Backend/Model/Config/Backend/File.php index ba08ac5b49f..53d5caed72d 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/File.php +++ b/app/code/Magento/Backend/Model/Config/Backend/File.php @@ -51,14 +51,14 @@ class File extends \Magento\Core\Model\Config\Value protected $_filesystem; /** - * @var \Magento\Core\Model\File\UploaderFactory + * @var \Magento\Filesystem\Directory\WriteInterface */ - protected $_uploaderFactory; + protected $_mediaDirectory; /** - * @var \Magento\App\Dir + * @var \Magento\Core\Model\File\UploaderFactory */ - protected $_dir; + protected $_uploaderFactory; /** * @param \Magento\Core\Model\Context $context @@ -68,7 +68,6 @@ class File extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\File\UploaderFactory $uploaderFactory * @param \Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface $requestData * @param \Magento\Filesystem $filesystem - * @param \Magento\App\Dir $dir * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -81,7 +80,6 @@ class File extends \Magento\Core\Model\Config\Value \Magento\Core\Model\File\UploaderFactory $uploaderFactory, \Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface $requestData, \Magento\Filesystem $filesystem, - \Magento\App\Dir $dir, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -89,7 +87,7 @@ class File extends \Magento\Core\Model\Config\Value $this->_uploaderFactory = $uploaderFactory; $this->_requestData = $requestData; $this->_filesystem = $filesystem; - $this->_dir = $dir; + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); } @@ -149,8 +147,11 @@ class File extends \Magento\Core\Model\Config\Value */ public function validateMaxSize($filePath) { - if ($this->_maxFileSize > 0 - && $this->_filesystem->getFileSize($filePath, dirname($filePath)) > ($this->_maxFileSize * 1024)) { + $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::SYS_TMP); + if ( + $this->_maxFileSize > 0 && + $directory->stat($directory->getRelativePath($filePath))['size'] > ($this->_maxFileSize * 1024) + ) { throw new \Magento\Core\Exception( __('The file you\'re uploading exceeds the server size limit of %1 kilobytes.', $this->_maxFileSize) ); @@ -195,8 +196,7 @@ class File extends \Magento\Core\Model\Config\Value } if (array_key_exists('config', $fieldConfig['upload_dir'])) { - $uploadRoot = $this->_getUploadRoot($fieldConfig['upload_dir']['config']); - $uploadDir = $uploadRoot . '/' . $uploadDir; + $uploadDir = $this->_mediaDirectory->getAbsolutePath($uploadDir); } } else { $uploadDir = (string) $fieldConfig['upload_dir']; @@ -205,18 +205,6 @@ class File extends \Magento\Core\Model\Config\Value return $uploadDir; } - /** - * Return the root part of directory path for uploading - * - * @var string - * @return string - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _getUploadRoot($token) - { - return $this->_dir->getDir(\Magento\App\Dir::MEDIA); - } - /** * Prepend path with scope info * diff --git a/app/code/Magento/Backend/Model/Config/Backend/Image/Favicon.php b/app/code/Magento/Backend/Model/Config/Backend/Image/Favicon.php index 65888f0b804..716196f0b1e 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Image/Favicon.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Image/Favicon.php @@ -37,12 +37,6 @@ class Favicon extends \Magento\Backend\Model\Config\Backend\Image */ const UPLOAD_DIR = 'favicon'; - /** - * Token for the root part of directory path for uploading - * - */ - const UPLOAD_ROOT = 'media'; - /** * Return path to directory for upload file * @@ -51,10 +45,7 @@ class Favicon extends \Magento\Backend\Model\Config\Backend\Image */ protected function _getUploadDir() { - $uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR); - $uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT); - $uploadDir = $uploadRoot . '/' . $uploadDir; - return $uploadDir; + return $this->_mediaDirectory->getAbsolutePath($this->_appendScopeInfo(self::UPLOAD_DIR)); } /** @@ -76,15 +67,4 @@ class Favicon extends \Magento\Backend\Model\Config\Backend\Image { return array('ico', 'png', 'gif', 'jpg', 'jpeg', 'apng', 'svg'); } - - /** - * Get real media dir path - * - * @param $token - * @return string - */ - protected function _getUploadRoot($token) - { - return $this->_dir->getDir($token); - } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Image/Logo.php b/app/code/Magento/Backend/Model/Config/Backend/Image/Logo.php index da5578d499b..48f1c4ce605 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Image/Logo.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Image/Logo.php @@ -37,12 +37,6 @@ class Logo extends \Magento\Backend\Model\Config\Backend\Image */ const UPLOAD_DIR = 'logo'; - /** - * Token for the root part of directory path for uploading - * - */ - const UPLOAD_ROOT = 'media'; - /** * Return path to directory for upload file * @@ -51,10 +45,7 @@ class Logo extends \Magento\Backend\Model\Config\Backend\Image */ protected function _getUploadDir() { - $uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR); - $uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT); - $uploadDir = $uploadRoot . DIRECTORY_SEPARATOR . $uploadDir; - return $uploadDir; + return $this->_mediaDirectory->getAbsolutePath($this->_appendScopeInfo(self::UPLOAD_DIR)); } /** @@ -66,15 +57,4 @@ class Logo extends \Magento\Backend\Model\Config\Backend\Image { return true; } - - /** - * Get real media dir path - * - * @param $token - * @return string - */ - protected function _getUploadRoot($token) - { - return $this->_dir->getDir($token); - } } diff --git a/app/code/Magento/Backend/Model/Config/SchemaLocator.php b/app/code/Magento/Backend/Model/Config/SchemaLocator.php index c5b8ef2a80a..e13067739b9 100644 --- a/app/code/Magento/Backend/Model/Config/SchemaLocator.php +++ b/app/code/Magento/Backend/Model/Config/SchemaLocator.php @@ -46,11 +46,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface */ public function __construct(\Magento\Module\Dir\Reader $moduleReader) { - $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Backend') - . DIRECTORY_SEPARATOR . 'system.xsd'; + $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Backend') . '/system.xsd'; - $this->_perFileSchema = $moduleReader->getModuleDir('etc', 'Magento_Backend') - . DIRECTORY_SEPARATOR . 'system_file.xsd'; + $this->_perFileSchema = $moduleReader->getModuleDir('etc', 'Magento_Backend') . '/system_file.xsd'; } /** diff --git a/app/code/Magento/Backend/Model/Menu/Config/SchemaLocator.php b/app/code/Magento/Backend/Model/Menu/Config/SchemaLocator.php index 11236d78ae4..81cf059d7ba 100644 --- a/app/code/Magento/Backend/Model/Menu/Config/SchemaLocator.php +++ b/app/code/Magento/Backend/Model/Menu/Config/SchemaLocator.php @@ -46,7 +46,7 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface */ public function __construct(\Magento\Module\Dir\Reader $moduleReader) { - $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Backend') . DIRECTORY_SEPARATOR . 'menu.xsd'; + $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Backend') . '/menu.xsd'; } /** diff --git a/app/code/Magento/Backend/Model/Menu/Item.php b/app/code/Magento/Backend/Model/Menu/Item.php index 7b3e40b6392..62810a2787a 100644 --- a/app/code/Magento/Backend/Model/Menu/Item.php +++ b/app/code/Magento/Backend/Model/Menu/Item.php @@ -50,16 +50,9 @@ class Item /** * Module of menu item * - * @var \Magento\App\Helper\AbstractHelper - */ - protected $_moduleHelper; - - /** - * Module helper name - * * @var string */ - protected $_moduleHelperName; + protected $_moduleName; /** * Menu item sort index in list @@ -166,13 +159,18 @@ class Item protected $_moduleList; /** - * @param \Magento\Backend\Model\Menu\Item\Validator $validator + * @var \Magento\Module\Manager + */ + private $_moduleManager; + + /** + * @param Item\Validator $validator * @param \Magento\AuthorizationInterface $authorization * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\Backend\Model\MenuFactory $menuFactory * @param \Magento\Backend\Model\Url $urlModel - * @param \Magento\App\Helper\AbstractHelper $helper * @param \Magento\Module\ModuleListInterface $moduleList + * @param \Magento\Module\Manager $moduleManager * @param array $data */ public function __construct( @@ -181,18 +179,19 @@ class Item \Magento\Core\Model\Store\Config $storeConfig, \Magento\Backend\Model\MenuFactory $menuFactory, \Magento\Backend\Model\Url $urlModel, - \Magento\App\Helper\AbstractHelper $helper, \Magento\Module\ModuleListInterface $moduleList, + \Magento\Module\Manager $moduleManager, array $data = array() ) { $this->_validator = $validator; $this->_validator->validate($data); + $this->_moduleManager = $moduleManager; $this->_acl = $authorization; $this->_storeConfig = $storeConfig; $this->_menuFactory = $menuFactory; $this->_urlModel = $urlModel; - $this->_moduleHelper = $helper; + $this->_moduleName = isset($data['module']) ? $data['module'] : 'Magento_Backend'; $this->_moduleList = $moduleList; $this->_id = $data['id']; @@ -288,7 +287,7 @@ class Item } /** - * Chechk whether item has javascript callback on click + * Check whether item has javascript callback on click * * @return bool */ @@ -371,14 +370,14 @@ class Item /** * Set Item module * - * @param \Magento\App\Helper\AbstractHelper $helper + * @param string $module * @return \Magento\Backend\Model\Menu\Item * @throws \InvalidArgumentException */ - public function setModuleHelper(\Magento\App\Helper\AbstractHelper $helper) + public function setModule($module) { - $this->_validator->validateParam('module', $helper); - $this->_moduleHelper = $helper; + $this->_validator->validateParam('module', $module); + $this->_moduleName = $module; return $this; } @@ -405,7 +404,7 @@ class Item */ public function setConfigDependency($configPath) { - $this->_validator->validateParam('depenedsOnConfig', $configPath); + $this->_validator->validateParam('dependsOnConfig', $configPath); $this->_dependsOnConfig = $configPath; return $this; } @@ -417,7 +416,7 @@ class Item */ public function isDisabled() { - return !$this->_moduleHelper->isModuleOutputEnabled() + return !$this->_moduleManager->isOutputEnabled($this->_moduleName) || !$this->_isModuleDependenciesAvailable() || !$this->_isConfigDependenciesAvailable(); } @@ -465,18 +464,12 @@ class Item public function __sleep() { - $helperClass = get_class($this->_moduleHelper); - // Save original class name of the helper - if (substr($helperClass, -1 * strlen('Interceptor')) === 'Interceptor') { - $helperClass = get_parent_class($helperClass); - } - $this->_moduleHelperName = $helperClass; if ($this->_submenu) { $this->_serializedSubmenu = $this->_submenu->serialize(); } return array( '_parentId', - '_moduleHelperName', + '_moduleName', '_sortIndex', '_dependsOnConfig', '_id', @@ -493,7 +486,7 @@ class Item public function __wakeup() { $objectManager = \Magento\App\ObjectManager::getInstance(); - $this->_moduleHelper = $objectManager->get($this->_moduleHelperName); + $this->_moduleManager = $objectManager->get('Magento\Module\Manager'); $this->_validator = $objectManager->get('Magento\Backend\Model\Menu\Item\Validator'); $this->_acl = $objectManager->get('Magento\AuthorizationInterface'); $this->_storeConfig = $objectManager->get('Magento\Core\Model\Store\Config'); diff --git a/app/code/Magento/Backend/Model/Menu/Item/Factory.php b/app/code/Magento/Backend/Model/Menu/Item/Factory.php index e9200060fb9..259409fb5be 100644 --- a/app/code/Magento/Backend/Model/Menu/Item/Factory.php +++ b/app/code/Magento/Backend/Model/Menu/Item/Factory.php @@ -32,21 +32,12 @@ class Factory */ protected $_objectManager; - /** - * @var \Magento\App\Helper\HelperFactory - */ - protected $_helperFactory; - /** * @param \Magento\ObjectManager $objectManager - * @param \Magento\App\Helper\HelperFactory $helperFactory */ - public function __construct( - \Magento\ObjectManager $objectManager, - \Magento\App\Helper\HelperFactory $helperFactory - ) { + public function __construct(\Magento\ObjectManager $objectManager) + { $this->_objectManager = $objectManager; - $this->_helperFactory = $helperFactory; } /** @@ -57,13 +48,6 @@ class Factory */ public function create(array $data = array()) { - $module = 'Magento\Backend\Helper\Data'; - if (isset($data['module'])) { - $module = $data['module']; - unset($data['module']); - } - $data = array('data' => $data); - $data['helper'] = $this->_helperFactory->get($module); - return $this->_objectManager->create('Magento\Backend\Model\Menu\Item', $data); + return $this->_objectManager->create('Magento\Backend\Model\Menu\Item', array('data' => $data)); } } diff --git a/app/code/Magento/Backend/Model/Session.php b/app/code/Magento/Backend/Model/Session.php index 5f0e0863a50..4e18d11b64e 100644 --- a/app/code/Magento/Backend/Model/Session.php +++ b/app/code/Magento/Backend/Model/Session.php @@ -25,22 +25,26 @@ */ namespace Magento\Backend\Model; -class Session extends \Magento\Core\Model\Session\AbstractSession +class Session extends \Magento\Session\SessionManager { /** - * @param \Magento\Core\Model\Session\Context $context + * @param \Magento\App\RequestInterface $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param array $data + * @param \Magento\Session\SaveHandlerInterface $saveHandler + * @param \Magento\Session\ValidatorInterface $validator + * @param \Magento\Session\StorageInterface $storage */ public function __construct( - \Magento\Core\Model\Session\Context $context, + \Magento\App\RequestInterface $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, - array $data = array() + \Magento\Session\SaveHandlerInterface $saveHandler, + \Magento\Session\ValidatorInterface $validator, + \Magento\Session\StorageInterface $storage ) { - parent::__construct($context, $sidResolver, $sessionConfig, $data); - $this->start('adminhtml'); + parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage); + $this->start(); } /** diff --git a/app/code/Magento/Adminhtml/Model/Session/Quote.php b/app/code/Magento/Backend/Model/Session/Quote.php similarity index 81% rename from app/code/Magento/Adminhtml/Model/Session/Quote.php rename to app/code/Magento/Backend/Model/Session/Quote.php index 9676de45bb8..cc2fde259c6 100644 --- a/app/code/Magento/Adminhtml/Model/Session/Quote.php +++ b/app/code/Magento/Backend/Model/Session/Quote.php @@ -24,12 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Model\Session; +namespace Magento\Backend\Model\Session; /** * Adminhtml quote session */ -class Quote extends \Magento\Core\Model\Session\AbstractSession +class Quote extends \Magento\Session\SessionManager { const XML_PATH_DEFAULT_CREATEACCOUNT_GROUP = 'customer/create_account/default_group'; @@ -77,28 +77,48 @@ class Quote extends \Magento\Core\Model\Session\AbstractSession protected $_quoteFactory; /** - * @param \Magento\Core\Model\Session\Context $context + * @var \Magento\Core\Model\StoreManagerInterface + */ + protected $_storeManager; + + /** + * @var \Magento\Core\Model\Store\Config + */ + protected $_coreStoreConfig; + + /** + * @param \Magento\App\RequestInterface $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig + * @param \Magento\Session\SaveHandlerInterface $saveHandler + * @param \Magento\Session\ValidatorInterface $validator + * @param \Magento\Session\StorageInterface $storage * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param array $data + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\Model\Store\Config $coreStoreConfig */ public function __construct( - \Magento\Core\Model\Session\Context $context, + \Magento\App\RequestInterface $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, + \Magento\Session\SaveHandlerInterface $saveHandler, + \Magento\Session\ValidatorInterface $validator, + \Magento\Session\StorageInterface $storage, \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Sales\Model\OrderFactory $orderFactory, - array $data = array() + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\Model\Store\Config $coreStoreConfig ) { $this->_quoteFactory = $quoteFactory; $this->_customerFactory = $customerFactory; $this->_orderFactory = $orderFactory; - parent::__construct($context, $sidResolver, $sessionConfig, $data); - $this->start('adminhtml_quote'); + $this->_storeManager = $storeManager; + $this->_coreStoreConfig = $coreStoreConfig; + parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage); + $this->start(); if ($this->_storeManager->hasSingleStore()) { $this->setStoreId($this->_storeManager->getStore(true)->getId()); } @@ -134,7 +154,7 @@ class Quote extends \Magento\Core\Model\Session\AbstractSession * Set customer model object * To enable quick switch of preconfigured customer * @param \Magento\Customer\Model\Customer $customer - * @return \Magento\Adminhtml\Model\Session\Quote + * @return \Magento\Backend\Model\Session\Quote */ public function setCustomer(\Magento\Customer\Model\Customer $customer) { diff --git a/app/code/Magento/Backend/Model/Translate/Inline/ConfigFactory.php b/app/code/Magento/Backend/Model/Translate/Inline/ConfigFactory.php index ac9b647c741..387327146e1 100644 --- a/app/code/Magento/Backend/Model/Translate/Inline/ConfigFactory.php +++ b/app/code/Magento/Backend/Model/Translate/Inline/ConfigFactory.php @@ -31,36 +31,13 @@ namespace Magento\Backend\Model\Translate\Inline; class ConfigFactory extends \Magento\Core\Model\Translate\Inline\ConfigFactory { - /** - * @var \Magento\App\State - */ - protected $_appState; - - /** - * @param \Magento\ObjectManager $objectManager - * @param \Magento\App\State $appState - */ - public function __construct(\Magento\ObjectManager $objectManager, \Magento\App\State $appState) - { - $this->_appState = $appState; - parent::__construct($objectManager); - } - /** * Create instance of inline translate config * - * @param string|null $area * @return \Magento\Core\Model\Translate\Inline\ConfigInterface */ - public function create($area = null) + public function create() { - if (!isset($area)) { - $area = $this->_appState->getAreaCode(); - } - if ($area == \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { - return $this->_objectManager->create('Magento\Backend\Model\Translate\Inline\Config'); - } - - return parent::create(); + return $this->_objectManager->create('Magento\Backend\Model\Translate\Inline\Config'); } } diff --git a/app/code/Magento/Backend/Model/View.php b/app/code/Magento/Backend/Model/View.php index 394ae973d1e..831af0027d3 100644 --- a/app/code/Magento/Backend/Model/View.php +++ b/app/code/Magento/Backend/Model/View.php @@ -67,8 +67,8 @@ class View extends \Magento\App\View $this->generateLayoutBlocks(); $this->_isLayoutLoaded = true; } - $this->getLayout()->initMessages('Magento\Backend\Model\Session'); + $this->getLayout()->initMessages(); return $this; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Backend/etc/adminhtml/di.xml b/app/code/Magento/Backend/etc/adminhtml/di.xml index 7d5fcda93e3..92398cd5469 100644 --- a/app/code/Magento/Backend/etc/adminhtml/di.xml +++ b/app/code/Magento/Backend/etc/adminhtml/di.xml @@ -131,4 +131,9 @@ <type name="Magento\App\Action\Action"> <plugin name="storeCheck" disabled="true" /> </type> + <type name="Magento\Message\Manager"> + <param name="defaultGroup"> + <value>backend</value> + </param> + </type> </config> diff --git a/app/code/Magento/Backend/etc/adminhtml/menu.xml b/app/code/Magento/Backend/etc/adminhtml/menu.xml index ab157e5e4ab..941ef407817 100644 --- a/app/code/Magento/Backend/etc/adminhtml/menu.xml +++ b/app/code/Magento/Backend/etc/adminhtml/menu.xml @@ -27,27 +27,27 @@ --> <config> <menu> - <add id="Magento_Adminhtml::system_design_schedule" title="Schedule" module="Magento_Adminhtml" sortOrder="30" parent="Magento_Adminhtml::system_design" action="adminhtml/system_design" resource="Magento_Adminhtml::schedule"/> - <add id="Magento_Adminhtml::system_currency" title="Currency" module="Magento_Adminhtml" sortOrder="30" parent="Magento_Adminhtml::stores" action="adminhtml/system_currency" resource="Magento_CurrencySymbol::system_currency"/> - <add id="Magento_Adminhtml::system_variable" title="Custom Variables" module="Magento_Adminhtml" sortOrder="20" parent="Magento_Adminhtml::system_other_settings" action="adminhtml/system_variable" resource="Magento_Adminhtml::variable"/> - <add id="Magento_Adminhtml::system_store" title="All Stores" module="Magento_Core" sortOrder="10" parent="Magento_Adminhtml::stores_settings" action="adminhtml/system_store/" resource="Magento_Adminhtml::store"/> - <add id="Magento_Adminhtml::system_config" title="Configuration" module="Magento_Adminhtml" sortOrder="20" parent="Magento_Adminhtml::stores_settings" action="adminhtml/system_config" resource="Magento_Adminhtml::config"/> - <add id="Magento_Adminhtml::dashboard" title="Dashboard" module="Magento_Adminhtml" sortOrder="10" action="adminhtml/dashboard" resource="Magento_Adminhtml::dashboard"/> - <add id="Magento_Adminhtml::system" title="System" module="Magento_Adminhtml" sortOrder="80" resource="Magento_Adminhtml::system"/> - <add id="Magento_Adminhtml::system_tools" title="Tools" module="Magento_Adminhtml" sortOrder="50" parent="Magento_Adminhtml::system" resource="Magento_Adminhtml::tools"/> - <add id="Magento_Adminhtml::system_design" title="Design" module="Magento_Adminhtml" sortOrder="20" parent="Magento_Adminhtml::content" resource="Magento_Adminhtml::design"/> - <add id="Magento_Adminhtml::system_convert" title="Data Transfer" module="Magento_Adminhtml" sortOrder="10" parent="Magento_Adminhtml::system" resource="Magento_Adminhtml::convert"/> - <add id="Magento_Adminhtml::system_cache" title="Cache Management" module="Magento_Adminhtml" sortOrder="10" parent="Magento_Adminhtml::system_tools" action="adminhtml/cache" resource="Magento_Adminhtml::cache"/> - <add id="Magento_Adminhtml::marketing" title="Marketing" module="Magento_Adminhtml" sortOrder="40" resource="Magento_Adminhtml::marketing"/> - <add id="Magento_Adminhtml::marketing_communications" title="Communications" module="Magento_Adminhtml" sortOrder="30" parent="Magento_Adminhtml::marketing" resource="Magento_Adminhtml::marketing_communications"/> - <add id="Magento_Adminhtml::marketing_seo" title="SEO & Search" module="Magento_Adminhtml" sortOrder="40" parent="Magento_Adminhtml::marketing" resource="Magento_Adminhtml::marketing_seo"/> - <add id="Magento_Adminhtml::marketing_user_content" title="User Content" module="Magento_Adminhtml" sortOrder="50" parent="Magento_Adminhtml::marketing" resource="Magento_Adminhtml::marketing_user_content"/> - <add id="Magento_Adminhtml::content" title="Content" module="Magento_Adminhtml" sortOrder="50" resource="Magento_Adminhtml::content"/> - <add id="Magento_Adminhtml::content_elements" title="Elements" module="Magento_Adminhtml" sortOrder="10" parent="Magento_Adminhtml::content" resource="Magento_Adminhtml::content_elements"/> - <add id="Magento_Adminhtml::stores" title="Stores" module="Magento_Adminhtml" sortOrder="70" resource="Magento_Adminhtml::stores"/> - <add id="Magento_Adminhtml::stores_settings" title="Settings" module="Magento_Adminhtml" sortOrder="10" parent="Magento_Adminhtml::stores" resource="Magento_Adminhtml::stores_settings"/> - <add id="Magento_Adminhtml::stores_attributes" title="Attributes" module="Magento_Adminhtml" sortOrder="40" parent="Magento_Adminhtml::stores" resource="Magento_Adminhtml::stores_attributes"/> - <add id="Magento_Adminhtml::other_settings" title="Other Settings" module="Magento_Adminhtml" sortOrder="50" parent="Magento_Adminhtml::stores" resource="Magento_Adminhtml::stores_other_settings"/> - <add id="Magento_Adminhtml::system_other_settings" title="Other Settings" module="Magento_Adminhtml" sortOrder="80" parent="Magento_Adminhtml::system" resource="Magento_Adminhtml::system_other_settings"/> + <add id="Magento_Backend::system_design_schedule" title="Schedule" module="Magento_Backend" sortOrder="30" parent="Magento_Backend::system_design" action="adminhtml/system_design" resource="Magento_Adminhtml::schedule"/> + <add id="Magento_Backend::system_currency" title="Currency" module="Magento_Backend" sortOrder="30" parent="Magento_Backend::stores" action="adminhtml/system_currency" resource="Magento_CurrencySymbol::system_currency"/> + <add id="Magento_Backend::system_variable" title="Custom Variables" module="Magento_Backend" sortOrder="20" parent="Magento_Backend::system_other_settings" action="adminhtml/system_variable" resource="Magento_Adminhtml::variable"/> + <add id="Magento_Backend::system_store" title="All Stores" module="Magento_Core" sortOrder="10" parent="Magento_Backend::stores_settings" action="adminhtml/system_store/" resource="Magento_Adminhtml::store"/> + <add id="Magento_Backend::system_config" title="Configuration" module="Magento_Backend" sortOrder="20" parent="Magento_Backend::stores_settings" action="adminhtml/system_config" resource="Magento_Adminhtml::config"/> + <add id="Magento_Backend::dashboard" title="Dashboard" module="Magento_Backend" sortOrder="10" action="adminhtml/dashboard" resource="Magento_Adminhtml::dashboard"/> + <add id="Magento_Backend::system" title="System" module="Magento_Backend" sortOrder="80" resource="Magento_Adminhtml::system"/> + <add id="Magento_Backend::system_tools" title="Tools" module="Magento_Backend" sortOrder="50" parent="Magento_Backend::system" resource="Magento_Adminhtml::tools"/> + <add id="Magento_Backend::system_design" title="Design" module="Magento_Backend" sortOrder="20" parent="Magento_Backend::content" resource="Magento_Adminhtml::design"/> + <add id="Magento_Backend::system_convert" title="Data Transfer" module="Magento_Backend" sortOrder="10" parent="Magento_Backend::system" resource="Magento_Adminhtml::convert"/> + <add id="Magento_Backend::system_cache" title="Cache Management" module="Magento_Backend" sortOrder="10" parent="Magento_Backend::system_tools" action="adminhtml/cache" resource="Magento_Adminhtml::cache"/> + <add id="Magento_Backend::marketing" title="Marketing" module="Magento_Backend" sortOrder="40" resource="Magento_Adminhtml::marketing"/> + <add id="Magento_Backend::marketing_communications" title="Communications" module="Magento_Backend" sortOrder="30" parent="Magento_Backend::marketing" resource="Magento_Adminhtml::marketing_communications"/> + <add id="Magento_Backend::marketing_seo" title="SEO & Search" module="Magento_Backend" sortOrder="40" parent="Magento_Backend::marketing" resource="Magento_Adminhtml::marketing_seo"/> + <add id="Magento_Backend::marketing_user_content" title="User Content" module="Magento_Backend" sortOrder="50" parent="Magento_Backend::marketing" resource="Magento_Adminhtml::marketing_user_content"/> + <add id="Magento_Backend::content" title="Content" module="Magento_Backend" sortOrder="50" resource="Magento_Adminhtml::content"/> + <add id="Magento_Backend::content_elements" title="Elements" module="Magento_Backend" sortOrder="10" parent="Magento_Backend::content" resource="Magento_Adminhtml::content_elements"/> + <add id="Magento_Backend::stores" title="Stores" module="Magento_Backend" sortOrder="70" resource="Magento_Adminhtml::stores"/> + <add id="Magento_Backend::stores_settings" title="Settings" module="Magento_Backend" sortOrder="10" parent="Magento_Backend::stores" resource="Magento_Adminhtml::stores_settings"/> + <add id="Magento_Backend::stores_attributes" title="Attributes" module="Magento_Backend" sortOrder="40" parent="Magento_Backend::stores" resource="Magento_Adminhtml::stores_attributes"/> + <add id="Magento_Backend::other_settings" title="Other Settings" module="Magento_Backend" sortOrder="50" parent="Magento_Backend::stores" resource="Magento_Adminhtml::stores_other_settings"/> + <add id="Magento_Backend::system_other_settings" title="Other Settings" module="Magento_Backend" sortOrder="80" parent="Magento_Backend::system" resource="Magento_Adminhtml::system_other_settings"/> </menu> </config> diff --git a/app/code/Magento/Backend/etc/di.xml b/app/code/Magento/Backend/etc/di.xml index 550e9ec0cdf..36d15309f05 100644 --- a/app/code/Magento/Backend/etc/di.xml +++ b/app/code/Magento/Backend/etc/di.xml @@ -83,6 +83,11 @@ <instance type="Magento\Backend\Model\Url\Proxy" /> </param> </type> + <type name="\Magento\Backend\Model\Observer"> + <param name="backendSession"> + <instance type="Magento\Backend\Model\Session\Proxy" /> + </param> + </type> <type name="Magento\Backend\Model\Url"> <param name="authSession"> <instance type="Magento\Backend\Model\Auth\Session\Proxy" /> @@ -150,4 +155,34 @@ </value> </param> </type> + <virtualType name="Magento\Backend\Model\Auth\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> + <value>admin</value> + </param> + </virtualType> + <type name="Magento\Backend\Model\Auth\Session"> + <param name="storage"> + <instance type="Magento\Backend\Model\Auth\Session\Storage" /> + </param> + </type> + <virtualType name="Magento\Backend\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> + <value>adminhtml</value> + </param> + </virtualType> + <type name="Magento\Backend\Model\Session"> + <param name="storage"> + <instance type="Magento\Backend\Model\Session\Storage" /> + </param> + </type> + <virtualType name="Magento\Backend\Model\Session\Quote\Storage" type="Magento\Session\Storage"> + <param name="namespace"> + <value>adminhtml_quote</value> + </param> + </virtualType> + <type name="Magento\Backend\Model\Session\Quote"> + <param name="storage"> + <instance type="Magento\Backend\Model\Session\Quote\Storage" /> + </param> + </type> </config> diff --git a/app/code/Magento/Backend/etc/module.xml b/app/code/Magento/Backend/etc/module.xml index 1b227ac2789..81fb552d4fc 100755 --- a/app/code/Magento/Backend/etc/module.xml +++ b/app/code/Magento/Backend/etc/module.xml @@ -31,12 +31,12 @@ <depends> <module name="Magento_Directory"/> <module name="Magento_Core"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Eav"/> <module name="Magento_AdminNotification"/> <module name="Magento_Cron"/> <module name="Magento_Sendfriend"/> <module name="Magento_Theme"/> + <module name="Magento_Weee"/> </depends> </module> </config> diff --git a/app/code/Magento/Backend/view/adminhtml/admin/popup.phtml b/app/code/Magento/Backend/view/adminhtml/admin/popup.phtml index ef930159ab7..be03cb09123 100644 --- a/app/code/Magento/Backend/view/adminhtml/admin/popup.phtml +++ b/app/code/Magento/Backend/view/adminhtml/admin/popup.phtml @@ -30,7 +30,7 @@ "children":{ "header":{ "label":"Header", "type":"Magento\Backend\Block\Page\Header" }, "menu":{ "label":"Top navigation", "type":"Magento\Backend\Block\Menu" }, - "breadcrumbs":{ "label":"Breadcrumbs", "type":"Magento\Adminhtml\Block\Widget\Breadcrumbs" }, + "breadcrumbs":{ "label":"Breadcrumbs", "type":"Magento\Backend\Block\Widget\Breadcrumbs" }, "content":{ "label":"Content block", "type":"Magento\View\Element\Template" }, "left":{ "label":"Left navigation", "type":"Magento\View\Element\Template" }, "footer":{ "label":"Footer", "type":"Magento\Backend\Block\Page\Footer" } diff --git a/app/code/Magento/Adminhtml/view/adminhtml/email/order/items.phtml b/app/code/Magento/Backend/view/adminhtml/email/order/items.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/email/order/items.phtml rename to app/code/Magento/Backend/view/adminhtml/email/order/items.phtml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/images/btn_bg.gif b/app/code/Magento/Backend/view/adminhtml/images/btn_bg.gif similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/images/btn_bg.gif rename to app/code/Magento/Backend/view/adminhtml/images/btn_bg.gif diff --git a/app/code/Magento/Adminhtml/view/adminhtml/images/btn_on_bg.gif b/app/code/Magento/Backend/view/adminhtml/images/btn_on_bg.gif similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/images/btn_on_bg.gif rename to app/code/Magento/Backend/view/adminhtml/images/btn_on_bg.gif diff --git a/app/code/Magento/Adminhtml/view/adminhtml/images/btn_over_bg.gif b/app/code/Magento/Backend/view/adminhtml/images/btn_over_bg.gif similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/images/btn_over_bg.gif rename to app/code/Magento/Backend/view/adminhtml/images/btn_over_bg.gif diff --git a/app/code/Magento/Adminhtml/view/adminhtml/images/error_msg_icon.gif b/app/code/Magento/Backend/view/adminhtml/images/error_msg_icon.gif similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/images/error_msg_icon.gif rename to app/code/Magento/Backend/view/adminhtml/images/error_msg_icon.gif diff --git a/app/code/Magento/Adminhtml/view/adminhtml/images/fam_bullet_error.gif b/app/code/Magento/Backend/view/adminhtml/images/fam_bullet_error.gif similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/images/fam_bullet_error.gif rename to app/code/Magento/Backend/view/adminhtml/images/fam_bullet_error.gif diff --git a/app/code/Magento/Adminhtml/view/adminhtml/images/fam_bullet_success.gif b/app/code/Magento/Backend/view/adminhtml/images/fam_bullet_success.gif similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/images/fam_bullet_success.gif rename to app/code/Magento/Backend/view/adminhtml/images/fam_bullet_success.gif diff --git a/app/code/Magento/Adminhtml/view/adminhtml/images/image-placeholder.png b/app/code/Magento/Backend/view/adminhtml/images/image-placeholder.png similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/images/image-placeholder.png rename to app/code/Magento/Backend/view/adminhtml/images/image-placeholder.png diff --git a/app/code/Magento/Adminhtml/view/adminhtml/images/note_msg_icon.gif b/app/code/Magento/Backend/view/adminhtml/images/note_msg_icon.gif similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/images/note_msg_icon.gif rename to app/code/Magento/Backend/view/adminhtml/images/note_msg_icon.gif diff --git a/app/code/Magento/Adminhtml/view/adminhtml/images/success_msg_icon.gif b/app/code/Magento/Backend/view/adminhtml/images/success_msg_icon.gif similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/images/success_msg_icon.gif rename to app/code/Magento/Backend/view/adminhtml/images/success_msg_icon.gif diff --git a/app/code/Magento/Adminhtml/view/adminhtml/images/warning_msg_icon.gif b/app/code/Magento/Backend/view/adminhtml/images/warning_msg_icon.gif similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/images/warning_msg_icon.gif rename to app/code/Magento/Backend/view/adminhtml/images/warning_msg_icon.gif diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_urlrewrite_index.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_urlrewrite_index.xml similarity index 98% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_urlrewrite_index.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_urlrewrite_index.xml index 7e3a897c56a..b248692afc7 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_urlrewrite_index.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_urlrewrite_index.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Urlrewrite" name="adminhtml.block.urlrewrite.grid.container"> + <block class="Magento\Backend\Block\Urlrewrite" name="adminhtml.block.urlrewrite.grid.container"> <block class="Magento\Backend\Block\Widget\Grid" name="adminhtml.block.urlrewrite.grid" as="grid"> <arguments> <argument name="id" xsi:type="string">urlrewriteGrid</argument> diff --git a/app/code/Magento/Backend/view/adminhtml/layout/default.xml b/app/code/Magento/Backend/view/adminhtml/layout/default.xml index 7cae9191af9..488e6e96e74 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/default.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/default.xml @@ -279,7 +279,7 @@ <block class="Magento\Backend\Block\Page\Header" name="header" as="header"> <block class="Magento\Backend\Block\GlobalSearch" as="search" acl="Magento_Adminhtml::global_search"/> </block> - <block class="Magento\Adminhtml\Block\Widget\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/> + <block class="Magento\Backend\Block\Widget\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/> <!--<update handle="formkey"/> this won't work, see the try/catch and a jammed exception in \Magento\Core\Model\Layout::createBlock() --> <block class="Magento\Backend\Block\Admin\Formkey" name="formkey" as="formkey" template="Magento_Backend::admin/formkey.phtml"/> <!-- deprecated since 1.7.0.0 see \Magento\Theme\Block\Js\Translate --> diff --git a/app/code/Magento/Backend/view/adminhtml/page/notices.phtml b/app/code/Magento/Backend/view/adminhtml/page/notices.phtml index bf388f2a561..0ea3fe18002 100644 --- a/app/code/Magento/Backend/view/adminhtml/page/notices.phtml +++ b/app/code/Magento/Backend/view/adminhtml/page/notices.phtml @@ -26,7 +26,7 @@ ?> <?php /** - * @see \Magento\Adminhtml\Page\Block\Notices + * @see \Magento\Backend\Block\Page\Notices */ ?> <?php if ($this->displayNoscriptNotice()): ?> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/urlrewrite/categories.phtml b/app/code/Magento/Backend/view/adminhtml/urlrewrite/categories.phtml similarity index 95% rename from app/code/Magento/Adminhtml/view/adminhtml/urlrewrite/categories.phtml rename to app/code/Magento/Backend/view/adminhtml/urlrewrite/categories.phtml index 58e3f4248e1..6019f9d79aa 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/urlrewrite/categories.phtml +++ b/app/code/Magento/Backend/view/adminhtml/urlrewrite/categories.phtml @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2013 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\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree */ +/** @var $this \Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree */ ?> <fieldset class="fieldset" data-ui-id="category-selector"> <legend class="legend"><span><?php echo __('Select Category') ?></span></legend> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/urlrewrite/edit.phtml b/app/code/Magento/Backend/view/adminhtml/urlrewrite/edit.phtml similarity index 96% rename from app/code/Magento/Adminhtml/view/adminhtml/urlrewrite/edit.phtml rename to app/code/Magento/Backend/view/adminhtml/urlrewrite/edit.phtml index 0805bbdeb5e..8c4caa61414 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/urlrewrite/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/urlrewrite/edit.phtml @@ -27,7 +27,7 @@ /** * Urlrewrites edit container * - * @see \Magento\Adminhtml\Block\Urlrewrite\Edit + * @see \Magento\Backend\Block\Urlrewrite\Edit */ ?> <div class="page-actions"><?php echo $this->getButtonsHtml() ?></div> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/urlrewrite/selector.phtml b/app/code/Magento/Backend/view/adminhtml/urlrewrite/selector.phtml similarity index 97% rename from app/code/Magento/Adminhtml/view/adminhtml/urlrewrite/selector.phtml rename to app/code/Magento/Backend/view/adminhtml/urlrewrite/selector.phtml index 26f397b91dc..4c6ed8d6e67 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/urlrewrite/selector.phtml +++ b/app/code/Magento/Backend/view/adminhtml/urlrewrite/selector.phtml @@ -27,7 +27,7 @@ /** * Urlrewrites edit mode selector * - * @see \Magento\Adminhtml\Block\Urlrewrite\Selector + * @see \Magento\Backend\Block\Urlrewrite\Selector */ ?> <div class="form-inline"> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/widget/tabshoriz.phtml b/app/code/Magento/Backend/view/adminhtml/widget/tabshoriz.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/widget/tabshoriz.phtml rename to app/code/Magento/Backend/view/adminhtml/widget/tabshoriz.phtml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/widget/tabsleft.phtml b/app/code/Magento/Backend/view/adminhtml/widget/tabsleft.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/widget/tabsleft.phtml rename to app/code/Magento/Backend/view/adminhtml/widget/tabsleft.phtml diff --git a/app/code/Magento/Backup/Block/Adminhtml/Backup.php b/app/code/Magento/Backup/Block/Adminhtml/Backup.php index 3657272cab5..d24ae81142d 100644 --- a/app/code/Magento/Backup/Block/Adminhtml/Backup.php +++ b/app/code/Magento/Backup/Block/Adminhtml/Backup.php @@ -45,17 +45,17 @@ class Backup extends \Magento\Backend\Block\Template protected function _prepareLayout() { parent::_prepareLayout(); - $this->addChild('createButton', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('createButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Database Backup'), 'onclick' => "return backup.backup('" . \Magento\Backup\Factory::TYPE_DB . "')", 'class' => 'task' )); - $this->addChild('createSnapshotButton', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('createSnapshotButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('System Backup'), 'onclick' => "return backup.backup('" . \Magento\Backup\Factory::TYPE_SYSTEM_SNAPSHOT . "')", 'class' => '' )); - $this->addChild('createMediaBackupButton', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('createMediaBackupButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Database and Media Backup'), 'onclick' => "return backup.backup('" . \Magento\Backup\Factory::TYPE_MEDIA . "')", 'class' => '' diff --git a/app/code/Magento/Backup/Block/Adminhtml/Grid/Column/Rollback.php b/app/code/Magento/Backup/Block/Adminhtml/Grid/Column/Rollback.php index 1d6cf4d58e2..81ecec9909f 100644 --- a/app/code/Magento/Backup/Block/Adminhtml/Grid/Column/Rollback.php +++ b/app/code/Magento/Backup/Block/Adminhtml/Grid/Column/Rollback.php @@ -35,6 +35,25 @@ namespace Magento\Backup\Block\Adminhtml\Grid\Column; class Rollback extends \Magento\Backend\Block\Widget\Grid\Column { + /** + * @var \Magento\Backup\Helper\Data + */ + protected $_backupHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Backup\Helper\Data $backupHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Backup\Helper\Data $backupHelper, + array $data = array() + ) { + $this->_backupHelper = $backupHelper; + parent::__construct($context, $data); + } + /** * Check permission for rollback * @@ -42,6 +61,6 @@ class Rollback extends \Magento\Backend\Block\Widget\Grid\Column */ public function isDisplayed() { - return $this->helper('Magento\Backup\Helper\Data')->isRollbackAllowed(); + return $this->_backupHelper->isRollbackAllowed(); } } diff --git a/app/code/Magento/Backup/Controller/Adminhtml/Index.php b/app/code/Magento/Backup/Controller/Adminhtml/Index.php index 9a4c21242a3..334e199cbcf 100644 --- a/app/code/Magento/Backup/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Backup/Controller/Adminhtml/Index.php @@ -52,21 +52,29 @@ class Index extends \Magento\Backend\App\Action */ protected $_fileFactory; + /** + * @var \Magento\Backup\Model\BackupFactory + */ + protected $_backupModelFactory; + /** * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Backup\Factory $backupFactory * @param \Magento\App\Response\Http\FileFactory $fileFactory + * @param \Magento\Backup\Model\BackupFactory $backupModelFactory */ public function __construct( \Magento\Backend\App\Action\Context $context, \Magento\Core\Model\Registry $coreRegistry, \Magento\Backup\Factory $backupFactory, - \Magento\App\Response\Http\FileFactory $fileFactory + \Magento\App\Response\Http\FileFactory $fileFactory, + \Magento\Backup\Model\BackupFactory $backupModelFactory ) { $this->_coreRegistry = $coreRegistry; $this->_backupFactory = $backupFactory; $this->_fileFactory = $fileFactory; + $this->_backupModelFactory = $backupModelFactory; parent::__construct($context); } @@ -108,7 +116,7 @@ class Index extends \Magento\Backend\App\Action public function createAction() { if (!$this->getRequest()->isAjax()) { - return $this->getUrl('*/*/index'); + return $this->_redirect('*/*/index'); } $response = new \Magento\Object(); @@ -151,7 +159,7 @@ class Index extends \Magento\Backend\App\Action } if ($type != \Magento\Backup\Factory::TYPE_DB) { - $backupManager->setRootDir($this->_objectManager->get('Magento\App\Dir')->getDir()) + $backupManager->setRootDir($this->_objectManager->get('Magento\Filesystem')->getPath()) ->addIgnorePaths($helper->getBackupIgnorePaths()); } @@ -159,7 +167,7 @@ class Index extends \Magento\Backend\App\Action $backupManager->create(); - $this->_getSession()->addSuccess($successMessage); + $this->messageManager->addSuccess($successMessage); $response->setRedirectUrl($this->getUrl('*/*/index')); } catch (\Magento\Backup\Exception\NotEnoughFreeSpace $e) { @@ -192,13 +200,13 @@ class Index extends \Magento\Backend\App\Action public function downloadAction() { /* @var $backup \Magento\Backup\Model\Backup */ - $backup = $this->_objectManager->create('Magento\Backup\Model\Backup')->loadByTimeAndType( + $backup = $this->_backupModelFactory->create( $this->getRequest()->getParam('time'), $this->getRequest()->getParam('type') ); if (!$backup->getTime() || !$backup->exists()) { - return $this->_redirect('adminhtml/*'); + return $this->_redirect('backup/*'); } $fileName = $this->_objectManager->get('Magento\Backup\Helper\Data') @@ -220,11 +228,11 @@ class Index extends \Magento\Backend\App\Action public function rollbackAction() { if (!$this->_objectManager->get('Magento\Backup\Helper\Data')->isRollbackAllowed()) { - return $this->_forward('denied'); + $this->_forward('denied'); } if (!$this->getRequest()->isAjax()) { - return $this->getUrl('*/*/index'); + return $this->_redirect('*/*/index'); } $helper = $this->_objectManager->get('Magento\Backup\Helper\Data'); @@ -232,13 +240,13 @@ class Index extends \Magento\Backend\App\Action try { /* @var $backup \Magento\Backup\Model\Backup */ - $backup = $this->_objectManager->create('Magento\Backup\Model\Backup')->loadByTimeAndType( + $backup = $this->_backupModelFactory->create( $this->getRequest()->getParam('time'), $this->getRequest()->getParam('type') ); if (!$backup->getTime() || !$backup->exists()) { - return $this->_redirect('adminhtml/*'); + return $this->_redirect('backup/*'); } if (!$backup->getTime()) { @@ -282,7 +290,7 @@ class Index extends \Magento\Backend\App\Action if ($type != \Magento\Backup\Factory::TYPE_DB) { - $backupManager->setRootDir($this->_objectManager->get('Magento\App\Dir')->getDir()) + $backupManager->setRootDir($this->_objectManager->get('Magento\Filesystem')->getPath()) ->addIgnorePaths($helper->getRollbackIgnorePaths()); if ($this->getRequest()->getParam('use_ftp', false)) { @@ -311,7 +319,7 @@ class Index extends \Magento\Backend\App\Action $errorMsg = __('Failed to validate FTP'); } catch (\Magento\Backup\Exception\NotEnoughPermissions $e) { $this->_objectManager->get('Magento\Logger')->log($e->getMessage()); - $errorMsg = __('You need more permissions to create a backup.'); + $errorMsg = __('Not enough permissions to perform rollback.'); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->log($e->getMessage()); $errorMsg = __('Failed to rollback'); @@ -339,11 +347,9 @@ class Index extends \Magento\Backend\App\Action $backupIds = $this->getRequest()->getParam('ids', array()); if (!is_array($backupIds) || !count($backupIds)) { - return $this->_redirect('adminhtml/*/index'); + return $this->_redirect('backup/*/index'); } - /** @var $backupModel \Magento\Backup\Model\Backup */ - $backupModel = $this->_objectManager->create('Magento\Backup\Model\Backup'); $resultData = new \Magento\Object(); $resultData->setIsSuccess(false); $resultData->setDeleteResult(array()); @@ -356,8 +362,8 @@ class Index extends \Magento\Backend\App\Action foreach ($backupIds as $id) { list($time, $type) = explode('_', $id); - $backupModel - ->loadByTimeAndType($time, $type) + $backupModel = $this->_backupModelFactory + ->create($time, $type) ->deleteFile(); if ($backupModel->exists()) { @@ -374,7 +380,7 @@ class Index extends \Magento\Backend\App\Action $resultData->setIsSuccess(true); if ($allBackupsDeleted) { - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('The selected backup(s) has been deleted.') ); } else { @@ -382,10 +388,10 @@ class Index extends \Magento\Backend\App\Action } } catch (\Exception $e) { $resultData->setIsSuccess(false); - $this->_getSession()->addError($deleteFailMessage); + $this->messageManager->addError($deleteFailMessage); } - return $this->_redirect('adminhtml/*/index'); + return $this->_redirect('backup/*/index'); } /** diff --git a/app/code/Magento/Backup/Helper/Data.php b/app/code/Magento/Backup/Helper/Data.php index 3c66947ae84..f32fd15ce41 100644 --- a/app/code/Magento/Backup/Helper/Data.php +++ b/app/code/Magento/Backup/Helper/Data.php @@ -43,13 +43,6 @@ class Data extends \Magento\App\Helper\AbstractHelper * @var \Magento\App\Cache\TypeListInterface */ protected $_cacheTypeList; - - /** - * Directory model - * - * @var \Magento\App\Dir - */ - protected $_dir; /** * Index resource process collection factory @@ -65,7 +58,6 @@ class Data extends \Magento\App\Helper\AbstractHelper * @param \Magento\Filesystem $filesystem * @param \Magento\AuthorizationInterface $authorization * @param \Magento\App\Cache\TypeListInterface $cacheTypeList - * @param \Magento\App\Dir $dir * @param \Magento\Index\Model\Resource\Process\CollectionFactory $processFactory */ public function __construct( @@ -73,14 +65,12 @@ class Data extends \Magento\App\Helper\AbstractHelper \Magento\Filesystem $filesystem, \Magento\AuthorizationInterface $authorization, \Magento\App\Cache\TypeListInterface $cacheTypeList, - \Magento\App\Dir $dir, \Magento\Index\Model\Resource\Process\CollectionFactory $processFactory ) { parent::__construct($context); $this->_authorization = $authorization; $this->_filesystem = $filesystem; $this->_cacheTypeList = $cacheTypeList; - $this->_dir = $dir; } /** @@ -130,7 +120,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getBackupsDir() { - return $this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'backups'; + return $this->_filesystem->getPath(\Magento\Filesystem::VAR_DIR) . '/backups'; } /** @@ -194,12 +184,12 @@ class Data extends \Magento\App\Helper\AbstractHelper '.git', '.svn', 'maintenance.flag', - $this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'session', - $this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'cache', - $this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'full_page_cache', - $this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'locks', - $this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'log', - $this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'report', + $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', ); } @@ -214,12 +204,12 @@ class Data extends \Magento\App\Helper\AbstractHelper '.svn', '.git', 'maintenance.flag', - $this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'session', - $this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'locks', - $this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'log', - $this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'report', - $this->_dir->getDir() . DS . 'errors', - $this->_dir->getDir() . DS . 'index.php', + $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', ); } @@ -231,11 +221,9 @@ class Data extends \Magento\App\Helper\AbstractHelper public function turnOnMaintenanceMode() { $maintenanceFlagFile = $this->getMaintenanceFlagFilePath(); - $result = $this->_filesystem->write( - $maintenanceFlagFile, - 'maintenance', - $this->_dir->getDir() - ); + $result = $this->_filesystem + ->getDirectoryWrite(\Magento\Filesystem::ROOT) + ->writeFile($maintenanceFlagFile, 'maintenance'); return $result !== false; } @@ -246,7 +234,7 @@ class Data extends \Magento\App\Helper\AbstractHelper public function turnOffMaintenanceMode() { $maintenanceFlagFile = $this->getMaintenanceFlagFilePath(); - $this->_filesystem->delete($maintenanceFlagFile, $this->_dir->getDir()); + $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT)->delete($maintenanceFlagFile); } /** @@ -278,7 +266,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ protected function getMaintenanceFlagFilePath() { - return $this->_dir->getDir() . DS . 'maintenance.flag'; + return 'maintenance.flag'; } /** diff --git a/app/code/Magento/Backup/Model/Backup.php b/app/code/Magento/Backup/Model/Backup.php index 5f18b3b5aa0..7dab49ed3ad 100644 --- a/app/code/Magento/Backup/Model/Backup.php +++ b/app/code/Magento/Backup/Model/Backup.php @@ -49,7 +49,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa /** * Gz file pointer * - * @var \Magento\Filesystem\Stream\Zlib + * @var \Magento\Filesystem\File\WriteInterface */ protected $_stream = null; @@ -82,11 +82,17 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa */ protected $_encryptor; + /** + * @var \Magento\Filesystem\Directory\WriteInterface + */ + protected $varDirectory; + /** * @param \Magento\Backup\Helper\Data $helper * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Backend\Model\Auth\Session $authSession * @param \Magento\Encryption\EncryptorInterface $encryptor + * @param \Magento\Filesystem $filesystem * @param array $data */ public function __construct( @@ -94,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, $data = array() ) { $this->_encryptor = $encryptor; parent::__construct($data); - $adapter = new \Magento\Filesystem\Adapter\Zlib(self::COMPRESS_RATE); - $this->_filesystem = new \Magento\Filesystem($adapter); - $this->_filesystem->setIsAllowCreateDirectories(true); + $this->_filesystem = $filesystem; + $this->varDirectory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); $this->_helper = $helper; $this->_locale = $locale; $this->_backendAuthSession = $authSession; @@ -156,7 +162,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa $backupData = $this->_helper->extractDataFromFilename($fileName); $this->addData(array( - 'id' => $filePath . DS . $fileName, + 'id' => $filePath . '/' . $fileName, 'time' => (int)$backupData->getTime(), 'path' => $filePath, 'extension' => $this->_helper->getExtensionByType($backupData->getType()), @@ -176,7 +182,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa */ public function exists() { - return $this->_filesystem->isFile($this->_getFilePath()); + return $this->varDirectory->isFile($this->_getFilePath()); } /** @@ -240,7 +246,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa throw new \Magento\Core\Exception(__('Please correct the order of creation for a new backup.')); } - $this->_filesystem->write($this->_getFilePath(), $content); + $this->varDirectory->writeFile($this->_getFilePath(), $content); return $this; } @@ -256,7 +262,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa throw new \Magento\Core\Exception(__("The backup file does not exist.")); } - return $this->_filesystem->read($this->_getFilePath()); + return $this->varDirectory->read($this->_getFilePath()); } /** @@ -271,7 +277,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa throw new \Magento\Core\Exception(__("The backup file does not exist.")); } - $this->_filesystem->delete($this->_getFilePath()); + $this->varDirectory->delete($this->_getFilePath()); return $this; } @@ -289,22 +295,25 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa throw new \Magento\Backup\Exception(__('The backup file path was not specified.')); } - if ($write && $this->_filesystem->isFile($this->_getFilePath())) { - $this->_filesystem->delete($this->_getFilePath()); + if ($write && $this->varDirectory->isFile($this->_getFilePath())) { + $this->varDirectory->delete($this->_getFilePath()); } - if (!$write && !$this->_filesystem->isFile($this->_getFilePath())) { + if (!$write && !$this->varDirectory->isFile($this->_getFilePath())) { throw new \Magento\Backup\Exception(__('The backup file "%1" does not exist.', $this->getFileName())); } $mode = $write ? 'wb' . self::COMPRESS_RATE : 'rb'; try { - $compressStream = 'compress.zlib://'; - $workingDirectory = $this->_filesystem->getWorkingDirectory(); - $this->_stream = $this->_filesystem->createAndOpenStream($compressStream . $this->_getFilePath(), $mode, - $compressStream . $workingDirectory); + /** @var \Magento\Filesystem\Directory\WriteInterface $varDirectory */ + $varDirectory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->_stream = $varDirectory->openFile( + $this->_getFilePath(), + $mode, + \Magento\Filesystem::WRAPPER_CONTENT_ZLIB + ); } - catch (\Magento\Filesystem\Exception $e) { + catch (\Magento\Filesystem\FilesystemException $e) { throw new \Magento\Backup\Exception\NotEnoughPermissions( __('Sorry, but we cannot read from or write to backup file "%1".', $this->getFileName()) ); @@ -316,7 +325,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa /** * Get zlib handler * - * @return \Magento\Filesystem\Stream\Zlib + * @return \Magento\Filesystem\File\WriteInterface * @throws \Magento\Backup\Exception */ protected function _getStream() @@ -360,7 +369,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa try { $this->_getStream()->write($string); } - catch (\Magento\Filesystem\Exception $e) { + catch (\Magento\Filesystem\FilesystemException $e) { throw new \Magento\Backup\Exception(__('Something went wrong writing to the backup file "%1".', $this->getFileName())); } @@ -390,11 +399,11 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa return ; } - $stream = $this->_filesystem->createAndOpenStream($this->_getFilePath(), 'r'); - while ($buffer = $stream->read(1024)) { - echo $buffer; - } - $stream->close(); + /** @var \Magento\Filesystem\Directory\ReadInterface $zlibDirectory */ + $zlibDirectory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ZLIB); + $zlibDirectory = $zlibDirectory->readFile($this->_getFilePath()); + + echo $zlibDirectory; } /** @@ -407,7 +416,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa } if ($this->exists()) { - $this->setData('size', $this->_filesystem->getFileSize($this->_getFilePath())); + $this->setData('size', $this->varDirectory->stat($this->_getFilePath())['size']); return $this->getData('size'); } @@ -426,30 +435,6 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa return $this->_encryptor->validateHash($password, $userPasswordHash); } - /** - * Load backup by it's type and creation timestamp - * - * @param int $timestamp - * @param string $type - * @return \Magento\Backup\Model\Backup - */ - public function loadByTimeAndType($timestamp, $type) - { - $backupId = $timestamp . '_' . $type; - - foreach ($this->_fsCollection as $backup) { - if ($backup->getId() == $backupId) { - $this->setType($backup->getType()) - ->setTime($backup->getTime()) - ->setName($backup->getName()) - ->setPath($backup->getPath()); - break; - } - } - - return $this; - } - /** * Get file path. * @@ -457,6 +442,6 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa */ protected function _getFilePath() { - return $this->getPath() . DS . $this->getFileName(); + return $this->varDirectory->getRelativePath($this->getPath() . '/' . $this->getFileName()); } } diff --git a/lib/Magento/App/Helper/HelperFactory.php b/app/code/Magento/Backup/Model/BackupFactory.php similarity index 53% rename from lib/Magento/App/Helper/HelperFactory.php rename to app/code/Magento/Backup/Model/BackupFactory.php index c78e8cd452c..7e56b711996 100644 --- a/lib/Magento/App/Helper/HelperFactory.php +++ b/app/code/Magento/Backup/Model/BackupFactory.php @@ -23,11 +23,13 @@ */ /** - * Helper factory model. Used to get helper objects + * Backup model factory + * + * @method \Magento\Backup\Model\Backup create($timestamp, $type) */ -namespace Magento\App\Helper; +namespace Magento\Backup\Model; -class HelperFactory +class BackupFactory { /** * @var \Magento\ObjectManager @@ -37,35 +39,33 @@ class HelperFactory /** * @param \Magento\ObjectManager $objectManager */ - public function __construct(\Magento\ObjectManager $objectManager) - { + public function __construct( + \Magento\ObjectManager $objectManager + ) { $this->_objectManager = $objectManager; } /** - * Get helper singleton + * Load backup by it's type and creation timestamp * - * @param string $className - * @param array $arguments - * @return \Magento\App\Helper\AbstractHelper - * @throws \LogicException + * @param int $timestamp + * @param string $type + * @return \Magento\Backup\Model\Backup */ - public function get($className, array $arguments = array()) + public function create($timestamp, $type) { - $className = str_replace('_', '\\', $className); - /* Default helper class for a module */ - if (strpos($className, '\Helper\\') === false) { - $className .= '\Helper\Data'; - } - - $helper = $this->_objectManager->get($className, $arguments); - - if (false === ($helper instanceof \Magento\App\Helper\AbstractHelper)) { - throw new \LogicException( - $className . ' doesn\'t extends Magento\App\Helper\AbstractHelper' - ); + $backupId = $timestamp . '_' . $type; + $fsCollection = $this->_objectManager->get('Magento\Backup\Model\Fs\Collection'); + $backupInstance = $this->_objectManager->get('Magento\Backup\Model\Backup'); + foreach ($fsCollection as $backup) { + if ($backup->getId() == $backupId) { + $backupInstance->setType($backup->getType()) + ->setTime($backup->getTime()) + ->setName($backup->getName()) + ->setPath($backup->getPath()); + break; + } } - - return $helper; + return $backupInstance; } } diff --git a/app/code/Magento/Backup/Model/Fs/Collection.php b/app/code/Magento/Backup/Model/Fs/Collection.php index 73272361df0..f9a82a347fc 100644 --- a/app/code/Magento/Backup/Model/Fs/Collection.php +++ b/app/code/Magento/Backup/Model/Fs/Collection.php @@ -30,16 +30,16 @@ namespace Magento\Backup\Model\Fs; class Collection extends \Magento\Data\Collection\Filesystem { /** - * Folder, where all backups are stored - * - * @var string + * @var \Magento\Filesystem\Directory\WriteInterface */ - protected $_baseDir; + protected $_varDirectory; /** - * @var \Magento\Filesystem + * Folder, where all backups are stored + * + * @var string */ - protected $_filesystem; + protected $_path; /** * Backup data @@ -48,13 +48,6 @@ class Collection extends \Magento\Data\Collection\Filesystem */ protected $_backupData = null; - /** - * Directory model - * - * @var \Magento\App\Dir - */ - protected $_dir; - /** * Backup model * @@ -66,14 +59,12 @@ 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\Dir $dir * @param \Magento\Backup\Model\Backup $backup */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Backup\Helper\Data $backupData, \Magento\Filesystem $filesystem, - \Magento\App\Dir $dir, \Magento\Backup\Model\Backup $backup ) { $this->_backupData = $backupData; @@ -81,13 +72,10 @@ class Collection extends \Magento\Data\Collection\Filesystem $this->_backupData = $backupData; $this->_filesystem = $filesystem; - $this->_dir = $dir; $this->_backup = $backup; - $this->_baseDir = $this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'backups'; + $this->_varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); - $this->_filesystem->setIsAllowCreateDirectories(true); - $this->_filesystem->ensureDirectoryExists($this->_baseDir); - $this->_filesystem->setWorkingDirectory($this->_baseDir); + $this->_varDirectory->create($this->_path); $this->_hideBackupsForApache(); // set collection specific params @@ -98,8 +86,10 @@ class Collection extends \Magento\Data\Collection\Filesystem } $extensions = implode('|', $extensions); + $this->_varDirectory->create('backups'); + $path = rtrim($this->_varDirectory->getAbsolutePath($this->_path), '/') . '/backups'; $this->setOrder('time', self::SORT_ORDER_DESC) - ->addTargetDir($this->_baseDir) + ->addTargetDir($path) ->setFilesFilter('/^[a-z0-9\-\_]+\.' . $extensions . '$/') ->setCollectRecursively(false); } @@ -109,10 +99,10 @@ class Collection extends \Magento\Data\Collection\Filesystem */ protected function _hideBackupsForApache() { - $htaccessPath = $this->_baseDir . DS . '.htaccess'; - if (!$this->_filesystem->isFile($htaccessPath)) { - $this->_filesystem->write($htaccessPath, 'deny from all'); - $this->_filesystem->changePermissions($htaccessPath, 0644); + $filename = '.htaccess'; + if (!$this->_varDirectory->isFile($filename)) { + $this->_varDirectory->writeFile($filename, 'deny from all'); + $this->_varDirectory->changePermissions($filename, 0644); } } @@ -125,11 +115,11 @@ class Collection extends \Magento\Data\Collection\Filesystem protected function _generateRow($filename) { $row = parent::_generateRow($filename); - foreach ($this->_backup->load($row['basename'], $this->_baseDir) + foreach ($this->_backup->load($row['basename'], $this->_varDirectory->getAbsolutePath($this->_path)) ->getData() as $key => $value) { $row[$key] = $value; } - $row['size'] = $this->_filesystem->getFileSize($filename); + $row['size'] = $this->_varDirectory->stat($this->_varDirectory->getRelativePath($filename))['size']; $row['id'] = $row['time'] . '_' . $row['type']; return $row; } diff --git a/app/code/Magento/Backup/Model/Observer.php b/app/code/Magento/Backup/Model/Observer.php index d9685dd0b48..18df0fe0aa9 100644 --- a/app/code/Magento/Backup/Model/Observer.php +++ b/app/code/Magento/Backup/Model/Observer.php @@ -73,11 +73,11 @@ class Observer protected $_coreStoreConfig; /** - * Directory model + * Filesystem facade * - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_dir; + protected $_filesystem; /** * @var \Magento\Backup\Factory @@ -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\App\Dir $dir + * @param \Magento\Filesystem $filesystem * @param \Magento\Backup\Factory $backupFactory */ public function __construct( @@ -97,14 +97,14 @@ class Observer \Magento\Core\Model\Registry $coreRegistry, \Magento\Logger $logger, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\Dir $dir, + \Magento\Filesystem $filesystem, \Magento\Backup\Factory $backupFactory ) { $this->_backupData = $backupData; $this->_coreRegistry = $coreRegistry; $this->_logger = $logger; $this->_coreStoreConfig = $coreStoreConfig; - $this->_dir = $dir; + $this->_filesystem = $filesystem; $this->_backupFactory = $backupFactory; } @@ -135,7 +135,7 @@ class Observer $this->_coreRegistry->register('backup_manager', $backupManager); if ($type != \Magento\Backup\Factory::TYPE_DB) { - $backupManager->setRootDir($this->_dir->getDir()) + $backupManager->setRootDir($this->_filesystem->getPath(\Magento\Filesystem::ROOT)) ->addIgnorePaths($this->_backupData->getBackupIgnorePaths()); } diff --git a/app/code/Magento/Backup/etc/adminhtml/menu.xml b/app/code/Magento/Backup/etc/adminhtml/menu.xml index 55bee83779e..d5f99aa550e 100644 --- a/app/code/Magento/Backup/etc/adminhtml/menu.xml +++ b/app/code/Magento/Backup/etc/adminhtml/menu.xml @@ -27,6 +27,6 @@ --> <config> <menu> - <add id="Magento_Backup::system_tools_backup" title="Backups" module="Magento_Backup" sortOrder="30" parent="Magento_Adminhtml::system_tools" action="backup/index" resource="Magento_Backup::backup"/> + <add id="Magento_Backup::system_tools_backup" title="Backups" module="Magento_Backup" sortOrder="30" parent="Magento_Backend::system_tools" action="backup/index" resource="Magento_Backup::backup"/> </menu> </config> diff --git a/app/code/Magento/Backup/view/adminhtml/layout/backup_index_block.xml b/app/code/Magento/Backup/view/adminhtml/layout/backup_index_block.xml index 1456601804b..e35a1ddeafc 100644 --- a/app/code/Magento/Backup/view/adminhtml/layout/backup_index_block.xml +++ b/app/code/Magento/Backup/view/adminhtml/layout/backup_index_block.xml @@ -40,7 +40,7 @@ <argument name="options" xsi:type="array"> <item name="delete" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Delete</item> - <item name="url" xsi:type="string">adminhtml/*/massDelete</item> + <item name="url" xsi:type="string">backup/*/massDelete</item> <item name="confirm" xsi:type="string" translate="true">Are you sure you want to delete the selected backup(s)?</item> </item> </argument> diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php index 6c4f564d711..a4acd598cdb 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php @@ -33,8 +33,8 @@ */ namespace Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab; -class Bundle extends \Magento\Adminhtml\Block\Widget - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface +class Bundle extends \Magento\Backend\Block\Widget + implements \Magento\Backend\Block\Widget\Tab\TabInterface { protected $_product = null; @@ -78,7 +78,7 @@ class Bundle extends \Magento\Adminhtml\Block\Widget */ protected function _prepareLayout() { - $this->addChild('add_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('add_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Create New Option'), 'class' => 'add', 'id' => 'add_new_option', diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php index 2a2faf272a4..8c6d61ddd92 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php @@ -163,20 +163,20 @@ class Option extends \Magento\Backend\Block\Widget protected function _prepareLayout() { - $this->addChild('add_selection_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('add_selection_button', 'Magento\Backend\Block\Widget\Button', array( 'id' => $this->getFieldId() . '_{{index}}_add_button', 'label' => __('Add Products to Option'), 'class' => 'add add-selection' )); - $this->addChild('close_search_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('close_search_button', 'Magento\Backend\Block\Widget\Button', array( 'id' => $this->getFieldId().'_{{index}}_close_button', 'label' => __('Close'), 'on_click' => 'bSelection.closeSearch(event)', 'class' => 'back no-display' )); - $this->addChild('option_delete_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('option_delete_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete Option'), 'class' => 'action-delete', 'on_click' => 'bOption.remove(event)' diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php index c465b692a0d..ae4c0af7ad8 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php @@ -34,7 +34,7 @@ namespace Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option; -class Search extends \Magento\Adminhtml\Block\Widget +class Search extends \Magento\Backend\Block\Widget { /** * @var string diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php index 6407e722154..e4349b26cb5 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php @@ -51,6 +51,7 @@ class Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Bundle\Helper\Data $bundleData * @param array $data @@ -58,13 +59,14 @@ class Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Bundle\Helper\Data $bundleData, array $data = array() ) { $this->_bundleData = $bundleData; $this->_productFactory = $productFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php index 1cd874a223a..0467eb599ba 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php @@ -122,7 +122,7 @@ class Selection */ protected function _prepareLayout() { - $this->addChild('selection_delete_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('selection_delete_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete'), 'class' => 'delete icon-btn', 'on_click' => 'bSelection.remove(event)' diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php index 1decc537fe1..cd670a8ed2b 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php @@ -48,6 +48,7 @@ class Price extends \Magento\Catalog\Block\Product\Price * @param \Magento\Core\Model\Registry $registry * @param \Magento\Stdlib\String $string * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper * @param \Magento\Tax\Model\Calculation $taxCalc * @param array $data */ @@ -59,10 +60,21 @@ class Price extends \Magento\Catalog\Block\Product\Price \Magento\Core\Model\Registry $registry, \Magento\Stdlib\String $string, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, \Magento\Tax\Model\Calculation $taxCalc, array $data = array() ) { - parent::__construct($context, $jsonEncoder, $catalogData, $taxData, $registry, $string, $mathRandom, $data); + parent::__construct( + $context, + $jsonEncoder, + $catalogData, + $taxData, + $registry, + $string, + $mathRandom, + $cartHelper, + $data + ); $this->_taxCalc = $taxCalc; } @@ -92,7 +104,7 @@ class Price extends \Magento\Catalog\Block\Product\Price $product->getPriceModel()->getIsPricesCalculatedByIndex() !== false) { return false; } - return $this->helper('Magento\Tax\Helper\Data')->displayBothPrices(); + return $this->_taxData->displayBothPrices(); } /** 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 7c85978d31c..a63722af902 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 @@ -74,12 +74,19 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param \Magento\Catalog\Helper\Product $catalogProduct * @param \Magento\Bundle\Model\Product\PriceFactory $productPrice * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Json\EncoderInterface $jsonEncoder * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -88,6 +95,11 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Catalog\Helper\Product $catalogProduct, \Magento\Bundle\Model\Product\PriceFactory $productPrice, @@ -106,6 +118,11 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView $taxData, $catalogData, $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, $arrayUtils, $data ); diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php index d6c2d611d95..0db6c9ec5fe 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php @@ -50,6 +50,54 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price */ protected $_showSingle = null; + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Json\EncoderInterface $jsonEncoder + * @param \Magento\Catalog\Helper\Data $catalogData + * @param \Magento\Tax\Helper\Data $taxData + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Stdlib\String $string + * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Tax\Model\Calculation $taxCalc + * @param \Magento\Core\Helper\Data $coreHelper + * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Json\EncoderInterface $jsonEncoder, + \Magento\Catalog\Helper\Data $catalogData, + \Magento\Tax\Helper\Data $taxData, + \Magento\Core\Model\Registry $registry, + \Magento\Stdlib\String $string, + \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Tax\Model\Calculation $taxCalc, + \Magento\Core\Helper\Data $coreHelper, + array $data = array() + ) { + $this->_coreHelper = $coreHelper; + parent::__construct( + $context, + $jsonEncoder, + $catalogData, + $taxData, + $registry, + $string, + $mathRandom, + $cartHelper, + $taxCalc, + $data + ); + } + /** * Check if option has a single selection * @@ -205,7 +253,7 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price $price = $this->getProduct()->getPriceModel() ->getSelectionPreFinalPrice($this->getProduct(), $_selection, 1); if (is_numeric($price)) { - $price = $this->helper('Magento\Core\Helper\Data')->currencyByStore($price, $store, false); + $price = $this->_coreHelper->currencyByStore($price, $store, false); } } return is_numeric($price) ? $price : 0; @@ -251,7 +299,7 @@ class Option extends \Magento\Bundle\Block\Catalog\Product\Price public function formatPriceString($price, $includeContainer = true) { $taxHelper = $this->_taxData; - $coreHelper = $this->helper('Magento\Core\Helper\Data'); + $coreHelper = $this->_coreHelper; $currentProduct = $this->getProduct(); if ($currentProduct->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC && $this->getFormatProduct() 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 14a2ac636af..e86ca4d9fd7 100644 --- a/app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php +++ b/app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php @@ -48,6 +48,9 @@ class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer * @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 \Magento\Bundle\Helper\Catalog\Product\Configuration $bundleProdConfigur * @param array $data */ @@ -55,11 +58,16 @@ class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer \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, \Magento\Bundle\Helper\Catalog\Product\Configuration $bundleProdConfigur, array $data = array() ) { $this->_bundleProdConfigur = $bundleProdConfigur; - parent::__construct($context, $productConfig, $checkoutSession, $data); + parent::__construct( + $context, $productConfig, $checkoutSession, $imageHelper, $urlHelper, $messageManager, $data + ); } protected function _construct() 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 ec2eda68e64..a23879e4c31 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\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -56,14 +56,14 @@ 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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->string = $string; - parent::__construct($context, $registry, $taxData, $coreDir, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $taxData, $filesystem, $resource, $resourceCollection, $data); } /** 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 0e3c4b2254c..70d74b5fd0e 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\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem * @param \Magento\Stdlib\String $coreString * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -54,14 +54,14 @@ 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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Stdlib\String $coreString, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->string = $coreString; - parent::__construct($context, $registry, $taxData, $coreDir, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $taxData, $filesystem, $resource, $resourceCollection, $data); } /** 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 cbf54f49749..eef7622f3e8 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\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -54,14 +54,14 @@ 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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->string = $string; - parent::__construct($context, $registry, $taxData, $coreDir, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $taxData, $filesystem, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Bundle/etc/adminhtml/routes.xml b/app/code/Magento/Bundle/etc/adminhtml/routes.xml index 667eb8af1bc..71f9da97850 100644 --- a/app/code/Magento/Bundle/etc/adminhtml/routes.xml +++ b/app/code/Magento/Bundle/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Bundle_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Bundle" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Bundle/etc/module.xml b/app/code/Magento/Bundle/etc/module.xml index ca2aecc74c3..4a149e6e1c7 100755 --- a/app/code/Magento/Bundle/etc/module.xml +++ b/app/code/Magento/Bundle/etc/module.xml @@ -30,7 +30,6 @@ </sequence> <depends> <module name="Magento_Catalog"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Tax"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> 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 db18251e599..90af8f4d193 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 @@ -24,13 +24,16 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -$installFile = __DIR__ . DS . 'upgrade-1.6.0.0-1.6.0.0.1.php'; -if (file_exists($installFile)) { +/** @var $this \Magento\Catalog\Model\Resource\Setup */ +$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); + +if ($modulesDirectory->isExist($modulesDirectory->getRelativePath($installFile))) { include $installFile; } -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ -$installer = $this; /** @var $connection \Magento\DB\Adapter\Pdo\Mysql */ $connection = $installer->getConnection(); $memoryTables = array( @@ -40,5 +43,5 @@ $memoryTables = array( ); foreach ($memoryTables as $table) { - $connection->changeTableEngine($installer->getTable($table), \Magento\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY); + $connection->changeTableEngine($this->getTable($table), \Magento\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY); } diff --git a/app/code/Magento/Captcha/Helper/Adminhtml/Data.php b/app/code/Magento/Captcha/Helper/Adminhtml/Data.php index fa81278fd7c..ffacbb26290 100644 --- a/app/code/Magento/Captcha/Helper/Adminhtml/Data.php +++ b/app/code/Magento/Captcha/Helper/Adminhtml/Data.php @@ -42,7 +42,6 @@ class Data extends \Magento\Captcha\Helper\Data /** * @param \Magento\App\Helper\Context $context - * @param \Magento\App\Dir $dirs * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Config $config * @param \Magento\Filesystem $filesystem @@ -51,7 +50,6 @@ class Data extends \Magento\Captcha\Helper\Data */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\App\Dir $dirs, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Config $config, \Magento\Filesystem $filesystem, @@ -59,7 +57,7 @@ class Data extends \Magento\Captcha\Helper\Data \Magento\Backend\App\ConfigInterface $backendConfig ) { $this->_backendConfig = $backendConfig; - parent::__construct($context, $dirs, $storeManager, $config, $filesystem, $factory); + parent::__construct($context, $storeManager, $config, $filesystem, $factory); } diff --git a/app/code/Magento/Captcha/Helper/Data.php b/app/code/Magento/Captcha/Helper/Data.php index 21d0ccb1d70..3904fa601e6 100644 --- a/app/code/Magento/Captcha/Helper/Data.php +++ b/app/code/Magento/Captcha/Helper/Data.php @@ -72,11 +72,6 @@ class Data extends \Magento\App\Helper\AbstractHelper */ protected $_filesystem; - /** - * @var \Magento\App\Dir - */ - protected $_dirs = null; - /** * @var \Magento\Core\Model\StoreManagerInterface */ @@ -89,7 +84,6 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\App\Dir $dirs * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Config $config * @param \Magento\Filesystem $filesystem @@ -97,13 +91,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\App\Dir $dirs, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Config $config, \Magento\Filesystem $filesystem, \Magento\Captcha\Model\CaptchaFactory $factory ) { - $this->_dirs = $dirs; $this->_storeManager = $storeManager; $this->_config = $config; $this->_filesystem = $filesystem; @@ -158,11 +150,11 @@ 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->_dirs->getDir(\Magento\App\Dir::LIB); + $libDir = $this->_filesystem->getPath(\Magento\Filesystem::LIB); foreach ($fontsConfig as $fontName => $fontConfig) { $fonts[$fontName] = array( 'label' => $fontConfig['label'], - 'path' => $libDir . DIRECTORY_SEPARATOR . $fontConfig['path'] + 'path' => $libDir . '/' . $fontConfig['path'] ); } } @@ -177,12 +169,12 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getImgDir($website = null) { - $mediaDir = $this->_dirs->getDir(\Magento\App\Dir::MEDIA); - $captchaDir = $mediaDir . '/captcha/' . $this->_getWebsiteCode($website); - $this->_filesystem->setWorkingDirectory($mediaDir); - $this->_filesystem->setIsAllowCreateDirectories(true); - $this->_filesystem->ensureDirectoryExists($captchaDir, 0775); - return $captchaDir . '/'; + $mediaDir = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $captchaDir = '/captcha/' . $this->_getWebsiteCode($website); + $mediaDir->create($captchaDir); + $mediaDir->changePermissions($captchaDir, 0775); + + return $mediaDir->getAbsolutePath($captchaDir) . '/'; } /** @@ -195,7 +187,7 @@ class Data extends \Magento\App\Helper\AbstractHelper { return $this->_storeManager->getWebsite($website)->getCode(); } - + /** * Get captcha image base URL * @@ -204,7 +196,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getImgUrl($website = null) { - return $this->_storeManager->getStore()->getBaseUrl(\Magento\App\Dir::MEDIA) . 'captcha' - . '/' . $this->_storeManager->getWebsite($website)->getCode() . '/'; + return $this->_storeManager->getStore()->getBaseUrl(\Magento\Filesystem::MEDIA) . 'captcha' + . '/' . $this->_getWebsiteCode($website) . '/'; } } diff --git a/app/code/Magento/Captcha/Model/Cron.php b/app/code/Magento/Captcha/Model/Cron.php index 5efbe7caa5c..5c3702c8532 100644 --- a/app/code/Magento/Captcha/Model/Cron.php +++ b/app/code/Magento/Captcha/Model/Cron.php @@ -46,9 +46,9 @@ class Cron protected $_adminHelper; /** - * @var \Magento\Filesystem + * @var \Magento\Filesystem\Directory\WriteInterface */ - protected $_filesystem; + protected $_mediaDirectory; /** * @var \Magento\Core\Model\StoreManager @@ -77,7 +77,7 @@ class Cron $this->_resLogFactory = $resLogFactory; $this->_helper = $helper; $this->_adminHelper = $adminHelper; - $this->_filesystem = $filesystem; + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); $this->_storeManager = $storeManager; } @@ -120,12 +120,13 @@ class Cron \Magento\Core\Model\Store $store = null ) { $expire = time() - $helper->getConfig('timeout', $store) * 60; - $imageDirectory = $helper->getImgDir($website); - foreach ($this->_filesystem->getNestedKeys($imageDirectory) as $filePath) { - if ($this->_filesystem->isFile($filePath) + $imageDirectory = $this->_mediaDirectory->getRelativePath($helper->getImgDir($website)); + foreach ($this->_mediaDirectory->read($imageDirectory) as $filePath) { + if ($this->_mediaDirectory->isFile($filePath) && pathinfo($filePath, PATHINFO_EXTENSION) == 'png' - && $this->_filesystem->getMTime($filePath) < $expire) { - $this->_filesystem->delete($filePath); + && $this->_mediaDirectory->stat($filePath)['mtime'] < $expire + ) { + $this->_mediaDirectory->delete($filePath); } } } diff --git a/app/code/Magento/Captcha/Model/DefaultModel.php b/app/code/Magento/Captcha/Model/DefaultModel.php index 5768f5ce64c..6bd49f4197d 100644 --- a/app/code/Magento/Captcha/Model/DefaultModel.php +++ b/app/code/Magento/Captcha/Model/DefaultModel.php @@ -87,18 +87,18 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model protected $_keepSession = true; /** - * @var \Magento\Core\Model\Session\AbstractSession + * @var \Magento\Session\SessionManagerInterface */ protected $_session; /** - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Captcha\Helper\Data $captchaData * @param \Magento\Captcha\Model\Resource\LogFactory $resLogFactory * @param string $formId */ public function __construct( - \Magento\Core\Model\Session\AbstractSession $session, + \Magento\Session\SessionManagerInterface $session, \Magento\Captcha\Helper\Data $captchaData, \Magento\Captcha\Model\Resource\LogFactory $resLogFactory, $formId diff --git a/app/code/Magento/Captcha/Model/Observer.php b/app/code/Magento/Captcha/Model/Observer.php index d08a7782c92..59105886db4 100644 --- a/app/code/Magento/Captcha/Model/Observer.php +++ b/app/code/Magento/Captcha/Model/Observer.php @@ -74,7 +74,7 @@ class Observer protected $_typeOnepage; /** - * @var \Magento\Core\Model\Session\AbstractSession + * @var \Magento\Session\SessionManagerInterface */ protected $_session; @@ -88,9 +88,14 @@ class Observer */ protected $_actionFlag; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param Resource\LogFactory $resLogFactory - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Checkout\Model\Type\Onepage $typeOnepage * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Customer\Helper\Data $customerData @@ -98,17 +103,19 @@ class Observer * @param \Magento\Core\Model\Url $urlManager * @param \Magento\App\RequestInterface $request * @param \Magento\App\ActionFlag $actionFlag + * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( \Magento\Captcha\Model\Resource\LogFactory $resLogFactory, - \Magento\Core\Model\Session\AbstractSession $session, + \Magento\Session\SessionManagerInterface $session, \Magento\Checkout\Model\Type\Onepage $typeOnepage, \Magento\Core\Helper\Data $coreData, \Magento\Customer\Helper\Data $customerData, \Magento\Captcha\Helper\Data $helper, \Magento\Core\Model\Url $urlManager, \Magento\App\RequestInterface $request, - \Magento\App\ActionFlag $actionFlag + \Magento\App\ActionFlag $actionFlag, + \Magento\Message\ManagerInterface $messageManager ) { $this->_resLogFactory = $resLogFactory; $this->_session = $session; @@ -119,6 +126,7 @@ class Observer $this->_urlManager = $urlManager; $this->_request = $request; $this->_actionFlag = $actionFlag; + $this->messageManager = $messageManager; } /** @@ -135,7 +143,7 @@ class Observer /** @var \Magento\App\Action\Action $controller */ $controller = $observer->getControllerAction(); if (!$captchaModel->isCorrect($this->_getCaptchaString($controller->getRequest(), $formId))) { - $this->_session->addError(__('Incorrect CAPTCHA')); + $this->messageManager->addError(__('Incorrect CAPTCHA')); $this->_actionFlag->set('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); $controller->getResponse()->setRedirect($this->_urlManager->getUrl('*/*/forgotpassword')); } @@ -155,7 +163,7 @@ class Observer if ($captcha->isRequired()) { $controller = $observer->getControllerAction(); if (!$captcha->isCorrect($this->_getCaptchaString($controller->getRequest(), $formId))) { - $this->_session->addError(__('Incorrect CAPTCHA.')); + $this->messageManager->addError(__('Incorrect CAPTCHA.')); $this->_actionFlag->set('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); $controller->getResponse()->setRedirect($this->_urlManager->getUrl('contacts/index/index')); } @@ -178,7 +186,7 @@ class Observer if ($captchaModel->isRequired($login)) { $word = $this->_getCaptchaString($controller->getRequest(), $formId); if (!$captchaModel->isCorrect($word)) { - $this->_session->addError(__('Incorrect CAPTCHA')); + $this->messageManager->addError(__('Incorrect CAPTCHA')); $this->_actionFlag->set('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); $this->_session->setUsername($login); $beforeUrl = $this->_session->getBeforeAuthUrl(); @@ -203,7 +211,7 @@ class Observer if ($captchaModel->isRequired()) { $controller = $observer->getControllerAction(); if (!$captchaModel->isCorrect($this->_getCaptchaString($controller->getRequest(), $formId))) { - $this->_session->addError(__('Incorrect CAPTCHA')); + $this->messageManager->addError(__('Incorrect CAPTCHA')); $this->_actionFlag->set('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); $this->_session->setCustomerFormData($controller->getRequest()->getPost()); $controller->getResponse()->setRedirect($this->_urlManager->getUrl('*/*/create')); @@ -303,7 +311,7 @@ class Observer if (!$captchaModel->isCorrect($this->_getCaptchaString($controller->getRequest(), $formId))) { $this->_session->setEmail((string) $controller->getRequest()->getPost('email')); $this->_actionFlag->set('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); - $this->_session->addError(__('Incorrect CAPTCHA')); + $this->messageManager->addError(__('Incorrect CAPTCHA')); $controller->getResponse() ->setRedirect($controller->getUrl('*/*/forgotpassword', array('_nosecret' => true))); } diff --git a/app/code/Magento/Captcha/etc/adminhtml/routes.xml b/app/code/Magento/Captcha/etc/adminhtml/routes.xml index 9d32c7db666..9ee05f195fd 100644 --- a/app/code/Magento/Captcha/etc/adminhtml/routes.xml +++ b/app/code/Magento/Captcha/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Captcha_Adminhtml" /> + <module name="Magento_Captcha" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit.php index 3a135da1b70..3ae84e174e2 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Category; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * @var string diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php index ffec774c2c3..d479d1197ac 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php @@ -93,7 +93,7 @@ class Form extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory // Save button if (!$category->isReadonly()) { - $this->addChild('save_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save Category'), 'onclick' => "categorySubmit('" . $this->getSaveUrl() . "', true)", 'class' => 'save' @@ -102,7 +102,7 @@ class Form extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory // Delete button if (!in_array($categoryId, $this->getRootIds()) && $category->isDeleteable()) { - $this->addChild('delete_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('delete_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete Category'), 'onclick' => "categoryDelete('" . $this->getUrl('catalog/*/delete', array('_current' => true)) . "', true, {$categoryId})", 'class' => 'delete' @@ -112,7 +112,7 @@ class Form extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory // Reset button if (!$category->isReadonly()) { $resetPath = $categoryId ? 'catalog/*/edit' : 'catalog/*/add'; - $this->addChild('reset_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('reset_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Reset'), 'onclick' => "categoryReset('".$this->getUrl($resetPath, array('_current'=>true))."',true)" )); @@ -182,7 +182,7 @@ class Form extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory $config['element_name'] = $config['name']; } $this->setChild($alias . '_button', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button')->addData($config)); + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button')->addData($config)); $this->_additionalButtons[$alias] = $alias . '_button'; return $this; } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php index 9328febd433..fe2561636ce 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php @@ -50,6 +50,7 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Extended /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data @@ -57,13 +58,14 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Extended public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Core\Model\Registry $coreRegistry, array $data = array() ) { $this->_productFactory = $productFactory; $this->_coreRegistry = $coreRegistry; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() @@ -169,7 +171,7 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Extended 'type' => 'number', 'index' => 'position', 'editable' => !$this->getCategory()->getProductsReadonly() - //'renderer' => 'Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Input' + //'renderer' => 'Magento\Backend\Block\Widget\Grid\Column\Renderer\Input' )); return parent::_prepareColumns(); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tabs.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tabs.php index 64a0f1c7558..8dc3bb1d97c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tabs.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tabs.php @@ -38,7 +38,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs */ protected $_attributeTabBlock = 'Magento\Catalog\Block\Adminhtml\Category\Tab\Attributes'; - protected $_template = 'Magento_Adminhtml::widget/tabshoriz.phtml'; + protected $_template = 'Magento_Backend::widget/tabshoriz.phtml'; /** * Core registry diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php index 5c0e0a17a84..3ec421fd126 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php @@ -102,7 +102,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory '_query' => false )); - $this->addChild('add_sub_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('add_sub_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add Subcategory'), 'onclick' => "addNew('".$addUrl."', false)", 'class' => 'add', @@ -111,7 +111,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory )); if ($this->canAddRootCategory()) { - $this->addChild('add_root_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('add_root_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add Root Category'), 'onclick' => "addNew('".$addUrl."', true)", 'class' => 'add', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Form.php b/app/code/Magento/Catalog/Block/Adminhtml/Form.php index e01a49b8da1..4240c3c9b7b 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Form.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Form.php @@ -39,13 +39,13 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { \Magento\Data\Form::setElementRenderer( $this->getLayout()->createBlock( - 'Magento\Adminhtml\Block\Widget\Form\Renderer\Element', + 'Magento\Backend\Block\Widget\Form\Renderer\Element', $this->getNameInLayout() . '_element' ) ); \Magento\Data\Form::setFieldsetRenderer( $this->getLayout()->createBlock( - 'Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset', + 'Magento\Backend\Block\Widget\Form\Renderer\Fieldset', $this->getNameInLayout() . '_fieldset' ) ); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Fieldset/Element.php b/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Fieldset/Element.php index 95d8fb7364d..80d3ba0ac5b 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Fieldset/Element.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Fieldset/Element.php @@ -34,7 +34,7 @@ namespace Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset; class Element - extends \Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset\Element + extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element { /** * Initialize block template diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php index 39768756a3e..bd401ef6c9c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php @@ -96,7 +96,7 @@ class Wysiwyg extends \Magento\Data\Form\Element\Textarea $html = parent::getAfterElementHtml(); if ($this->getIsWysiwygEnabled()) { $disabled = ($this->getDisabled() || $this->getReadonly()); - $html .= $this->_layout->createBlock('Magento\Adminhtml\Block\Widget\Button', '', array('data' => array( + $html .= $this->_layout->createBlock('Magento\Backend\Block\Widget\Button', '', array('data' => array( 'label' => __('WYSIWYG Editor'), 'type' => 'button', 'disabled' => $disabled, diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product.php b/app/code/Magento/Catalog/Block/Adminhtml/Product.php index 35898e4a6d0..b9983f6aa5d 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Block\Adminhtml; -class Product extends \Magento\Adminhtml\Block\Widget\Container +class Product extends \Magento\Backend\Block\Widget\Container { protected $_template = 'catalog/product.phtml'; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute.php index 530f6721a07..fa8b8d9f173 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute.php @@ -34,7 +34,7 @@ namespace Magento\Catalog\Block\Adminhtml\Product; -class Attribute extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Attribute extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php index 70e77923466..ccb18dc29ae 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php @@ -190,7 +190,7 @@ class Front extends \Magento\Backend\Block\Widget\Form\Generic // define field dependencies $this->setChild( 'form_after', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Form\Element\Dependence') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Form\Element\Dependence') ->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled') ->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front') ->addFieldMap("frontend_input", 'frontend_input_type') diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tabs.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tabs.php index ef859959e98..02e8fac6151 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tabs.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tabs.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit; -class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs +class Tabs extends \Magento\Backend\Block\Widget\Tabs { protected function _construct() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Grid.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Grid.php index 60203086445..588af9580df 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Grid.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Grid.php @@ -43,18 +43,20 @@ class Grid extends \Magento\Eav\Block\Adminhtml\Attribute\Grid\AbstractGrid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory, array $data = array() ) { $this->_collectionFactory = $collectionFactory; $this->_module = 'catalog'; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php index 3d558d56e81..af357bbe6cd 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php @@ -121,42 +121,42 @@ class Main extends \Magento\Backend\Block\Template $this->addChild('edit_set_form', 'Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main\Formset'); - $this->addChild('delete_group_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('delete_group_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete Selected Group'), 'onclick' => 'editSet.submit();', 'class' => 'delete' )); - $this->addChild('add_group_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('add_group_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add New'), 'onclick' => 'editSet.addGroup();', 'class' => 'add' )); - $this->addChild('back_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('back_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Back'), 'onclick' => 'setLocation(\''.$this->getUrl('catalog/*/').'\')', 'class' => 'back' )); - $this->addChild('reset_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('reset_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Reset'), 'onclick' => 'window.location.reload()' )); - $this->addChild('save_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save Attribute Set'), 'onclick' => 'editSet.save();', 'class' => 'save' )); - $this->addChild('delete_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('delete_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete Attribute Set'), 'onclick' => 'deleteConfirm(\''. $this->escapeJsQuote(__('You are about to delete all products in this set. Are you sure you want to delete this attribute set?')) . '\', \'' . $this->getUrl('catalog/*/delete', array('id' => $setId)) . '\')', 'class' => 'delete' )); - $this->addChild('rename_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('rename_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('New Set Name'), 'onclick' => 'editSet.rename()' )); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formattribute.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formattribute.php index 068dd0879ee..79f837b1365 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formattribute.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formattribute.php @@ -51,7 +51,7 @@ class Formattribute extends \Magento\Backend\Block\Widget\Form\Generic $fieldset->addField('submit', 'note', array( - 'text' => $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + 'text' => $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => __('Add Attribute'), 'onclick' => 'this.form.submit();', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php index 4de91ca8c57..bdb251db7bc 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php @@ -75,7 +75,7 @@ class Formgroup $fieldset->addField('submit', 'note', array( - 'text' => $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + 'text' => $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => __('Add Group'), 'onclick' => 'this.form.submit();', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php index 9fb3987400d..e1687458939 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php @@ -40,7 +40,7 @@ class Add extends \Magento\Backend\Block\Template protected function _prepareLayout() { - $this->addChild('save_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save Attribute Set'), 'class' => 'save', 'data_attribute' => array( @@ -49,7 +49,7 @@ class Add extends \Magento\Backend\Block\Template ), ), )); - $this->addChild('back_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('back_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Back'), 'onclick' => 'setLocation(\''.$this->getUrl('catalog/*/').'\')', 'class' => 'back' diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php index 65973c4a7e6..6029d69e39c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php @@ -43,7 +43,7 @@ class Main extends \Magento\Backend\Block\Template protected function _prepareLayout() { - $this->addChild('addButton', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('addButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add New Set'), 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/add') . '\')', 'class' => 'add', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Configure.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Configure.php index e1e6a0ccdcf..e2eecad3ff9 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Configure.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Configure.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Composite; -class Configure extends \Magento\Adminhtml\Block\Widget +class Configure extends \Magento\Backend\Block\Widget { /** * @var \Magento\Catalog\Model\Product diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php index a62df00c006..163f9833d9b 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php @@ -39,6 +39,11 @@ class Grouped protected $_priceBlockDefaultTemplate = 'catalog/product/price.phtml'; + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Catalog\Model\Config $catalogConfig @@ -46,9 +51,17 @@ class Grouped * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @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\Core\Helper\Data $coreHelper * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -57,13 +70,32 @@ class Grouped \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Tax\Model\Calculation $taxCalculation, + \Magento\Core\Helper\Data $coreHelper, array $data = array() ) { + $this->_coreHelper = $coreHelper; $this->_taxCalculation = $taxCalculation; parent::__construct( - $context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $arrayUtils, $data + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $arrayUtils, + $data ); } @@ -177,6 +209,6 @@ class Grouped public function getCurrencyPrice($price) { $store = $this->getProduct()->getStore(); - return $this->helper('Magento\Core\Helper\Data')->currencyByStore($price, $store, false); + return $this->_coreHelper->currencyByStore($price, $store, false); } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Update/Result.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Update/Result.php index 1a93e57ce42..e80a0e942a9 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Update/Result.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Update/Result.php @@ -40,7 +40,7 @@ class Result extends \Magento\View\Element\Template /** * Adminhtml js * - * @var \Magento\Adminhtml\Helper\Js + * @var \Magento\Backend\Helper\Js */ protected $_adminhtmlJs = null; @@ -59,14 +59,14 @@ class Result extends \Magento\View\Element\Template /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Json\EncoderInterface $jsonEncoder - * @param \Magento\Adminhtml\Helper\Js $adminhtmlJs + * @param \Magento\Backend\Helper\Js $adminhtmlJs * @param \Magento\Core\Model\Registry $registry * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Json\EncoderInterface $jsonEncoder, - \Magento\Adminhtml\Helper\Js $adminhtmlJs, + \Magento\Backend\Helper\Js $adminhtmlJs, \Magento\Core\Model\Registry $registry, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Created.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Created.php index 96625c7af42..caa3c088b4f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Created.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Created.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product; -class Created extends \Magento\Adminhtml\Block\Widget +class Created extends \Magento\Backend\Block\Widget { protected $_configurableProduct; protected $_product; @@ -72,7 +72,7 @@ class Created extends \Magento\Adminhtml\Block\Widget protected function _prepareLayout() { - $this->addChild('close_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('close_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Close Window'), 'onclick' => 'addProduct(true)' )); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php index 42eed0e0272..1bb59a1db9c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php @@ -54,11 +54,17 @@ class Edit extends \Magento\Backend\Block\Widget */ protected $jsonEncoder; + /** + * @var \Magento\Catalog\Helper\Product + */ + protected $_productHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $attributeSetFactory * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Catalog\Helper\Product $productHelper * @param array $data */ public function __construct( @@ -66,8 +72,10 @@ class Edit extends \Magento\Backend\Block\Widget \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Eav\Model\Entity\Attribute\SetFactory $attributeSetFactory, \Magento\Core\Model\Registry $registry, + \Magento\Catalog\Helper\Product $productHelper, array $data = array() ) { + $this->_productHelper = $productHelper; $this->_attributeSetFactory = $attributeSetFactory; $this->_coreRegistry = $registry; $this->jsonEncoder = $jsonEncoder; @@ -99,7 +107,7 @@ class Edit extends \Magento\Backend\Block\Widget protected function _prepareLayout() { if (!$this->getRequest()->getParam('popup')) { - $this->addChild('back_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('back_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Back'), 'title' => __('Back'), 'onclick' => 'setLocation(\'' @@ -107,7 +115,7 @@ class Edit extends \Magento\Backend\Block\Widget 'class' => 'action-back' )); } else { - $this->addChild('back_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('back_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Close Window'), 'onclick' => 'window.close()', 'class' => 'cancel' @@ -115,7 +123,7 @@ class Edit extends \Magento\Backend\Block\Widget } if (!$this->getProduct()->isReadonly()) { - $this->addChild('reset_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('reset_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Reset'), 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/*', array('_current' => true)) . '\')' )); @@ -262,7 +270,7 @@ class Edit extends \Magento\Backend\Block\Widget */ public function getFieldsAutogenerationMasks() { - return $this->helper('Magento\Catalog\Helper\Product')->getFieldsAutogenerationMasks(); + return $this->_productHelper->getFieldsAutogenerationMasks(); } /** @@ -272,7 +280,7 @@ class Edit extends \Magento\Backend\Block\Widget */ public function getAttributesAllowedForAutogeneration() { - return $this->helper('Magento\Catalog\Helper\Product')->getAttributesAllowedForAutogeneration(); + return $this->_productHelper->getAttributesAllowedForAutogeneration(); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute.php index 685fd157858..2b91a136365 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute.php @@ -34,7 +34,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Action; -class Attribute extends \Magento\Adminhtml\Block\Widget +class Attribute extends \Magento\Backend\Block\Widget { /** @@ -60,18 +60,18 @@ class Attribute extends \Magento\Adminhtml\Block\Widget protected function _prepareLayout() { - $this->addChild('back_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('back_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Back'), 'onclick' => 'setLocation(\''.$this->getUrl('catalog/product/', array('store'=>$this->getRequest()->getParam('store', 0))).'\')', 'class' => 'back' )); - $this->addChild('reset_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('reset_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Reset'), 'onclick' => 'setLocation(\''.$this->getUrl('catalog/*/*', array('_current'=>true)).'\')' )); - $this->addChild('save_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save'), 'class' => 'save', 'data_attribute' => array( @@ -99,7 +99,7 @@ class Attribute extends \Magento\Adminhtml\Block\Widget */ protected function _getHelper() { - return $this->helper('Magento\Catalog\Helper\Product\Edit\Action\Attribute'); + return $this->_helperActionAttribute; } /** @@ -117,7 +117,7 @@ class Attribute extends \Magento\Adminhtml\Block\Widget * * @return string */ - public function getCancelButtonHtml() + public function getCancelButtonHtml() { return $this->getChildHtml('reset_button'); } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php index 466c38c56b8..359117e133b 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php @@ -43,11 +43,17 @@ class Attributes */ protected $_productFactory; + /** + * @var \Magento\Catalog\Helper\Product\Edit\Action\Attribute + */ + protected $_attributeAction; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory + * @param \Magento\Catalog\Helper\Product\Edit\Action\Attribute $attributeAction * @param array $data */ public function __construct( @@ -55,8 +61,10 @@ class Attributes \Magento\Core\Model\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Catalog\Model\ProductFactory $productFactory, + \Magento\Catalog\Helper\Product\Edit\Action\Attribute $attributeAction, array $data = array() ) { + $this->_attributeAction = $attributeAction; $this->_productFactory = $productFactory; parent::__construct($context, $registry, $formFactory, $data); } @@ -106,7 +114,7 @@ class Attributes */ public function getAttributes() { - return $this->helper('Magento\Catalog\Helper\Product\Edit\Action\Attribute') + return $this->_attributeAction ->getAttributes()->getItems(); } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php index d457b006777..7f8efd34dde 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php @@ -34,8 +34,8 @@ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab; class Inventory - extends \Magento\Adminhtml\Block\Widget - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + extends \Magento\Backend\Block\Widget + implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** * @var \Magento\CatalogInventory\Model\Source\Backorders diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Websites.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Websites.php index 34fb5ab8d32..4e63a39c0b7 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Websites.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Websites.php @@ -34,8 +34,8 @@ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab; class Websites - extends \Magento\Adminhtml\Block\Widget - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + extends \Magento\Backend\Block\Widget + implements \Magento\Backend\Block\Widget\Tab\TabInterface { public function getWebsiteCollection() { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tabs.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tabs.php index 11e253dd11d..ce903197b89 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tabs.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tabs.php @@ -34,7 +34,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute; -class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs +class Tabs extends \Magento\Backend\Block\Widget\Tabs { protected function _construct() { 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 56c85c43983..01785764b04 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 @@ -41,9 +41,9 @@ class Alerts extends \Magento\Backend\Block\Template protected function _prepareLayout() { - $accordion = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Accordion') + $accordion = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Accordion') ->setId('productAlerts'); - /* @var $accordion \Magento\Adminhtml\Block\Widget\Accordion */ + /* @var $accordion \Magento\Backend\Block\Widget\Accordion */ $alertPriceAllow = $this->_storeConfig->getConfig('catalog/productalert/allow_price'); $alertStockAllow = $this->_storeConfig->getConfig('catalog/productalert/allow_stock'); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Price.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Price.php index 569314d9513..7d11d604c0b 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Price.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Price.php @@ -34,7 +34,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Alerts; -class Price extends \Magento\Adminhtml\Block\Widget\Grid +class Price extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Catalog data @@ -51,6 +51,7 @@ class Price extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\ProductAlert\Model\PriceFactory $priceFactory * @param \Magento\Catalog\Helper\Data $catalogData * @param array $data @@ -58,13 +59,14 @@ class Price extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\ProductAlert\Model\PriceFactory $priceFactory, \Magento\Catalog\Helper\Data $catalogData, array $data = array() ) { $this->_priceFactory = $priceFactory; $this->_catalogData = $catalogData; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Stock.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Stock.php index 4e74526cffe..ea0cbf60334 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Stock.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Stock.php @@ -34,7 +34,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Alerts; -class Stock extends \Magento\Adminhtml\Block\Widget\Grid +class Stock extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Catalog data @@ -51,6 +51,7 @@ class Stock extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\ProductAlert\Model\StockFactory $stockFactory * @param \Magento\Catalog\Helper\Data $catalogData * @param array $data @@ -58,13 +59,14 @@ class Stock extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\ProductAlert\Model\StockFactory $stockFactory, \Magento\Catalog\Helper\Data $catalogData, array $data = array() ) { $this->_stockFactory = $stockFactory; $this->_catalogData = $catalogData; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php index 88a7ddf792a..4a8acdc0f07 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab; -class Crosssell extends \Magento\Adminhtml\Block\Widget\Grid +class Crosssell extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Core registry @@ -75,6 +75,7 @@ class Crosssell extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Catalog\Model\Product\LinkFactory $linkFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory @@ -83,10 +84,13 @@ class Crosssell extends \Magento\Adminhtml\Block\Widget\Grid * @param \Magento\Catalog\Model\Product\Visibility $visibility * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Catalog\Model\Product\LinkFactory $linkFactory, \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory, \Magento\Catalog\Model\ProductFactory $productFactory, @@ -103,7 +107,7 @@ class Crosssell extends \Magento\Adminhtml\Block\Widget\Grid $this->_status = $status; $this->_visibility = $visibility; $this->_coreRegistry = $coreRegistry; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** @@ -164,7 +168,7 @@ class Crosssell extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare collection * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { @@ -201,7 +205,7 @@ class Crosssell extends \Magento\Adminhtml\Block\Widget\Grid /** * Add columns to grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php index b3e920e85c1..84fc46c870b 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php @@ -31,7 +31,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab; -class Inventory extends \Magento\Adminhtml\Block\Widget +class Inventory extends \Magento\Backend\Block\Widget { protected $_template = 'catalog/product/tab/inventory.phtml'; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options.php index 550e3a4e4d7..e601d2847b3 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options.php @@ -34,13 +34,13 @@ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab; -class Options extends \Magento\Adminhtml\Block\Widget +class Options extends \Magento\Backend\Block\Widget { protected $_template = 'catalog/product/edit/options.phtml'; protected function _prepareLayout() { - $this->addChild('add_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('add_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add New Option'), 'class' => 'add', 'id' => 'add_new_defined_option' @@ -48,7 +48,7 @@ class Options extends \Magento\Adminhtml\Block\Widget $this->addChild('options_box', 'Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Option'); - $this->addChild('import_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('import_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Import Options'), 'class' => 'add', 'id' => 'import_new_defined_option' diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php index 3a121f5a9ce..2caabb448f9 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php @@ -29,7 +29,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options; -class Option extends \Magento\Adminhtml\Block\Widget +class Option extends \Magento\Backend\Block\Widget { protected $_productInstance; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/AbstractType.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/AbstractType.php index 7088ded311e..c00a1f88682 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/AbstractType.php @@ -34,7 +34,7 @@ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type; -class AbstractType extends \Magento\Adminhtml\Block\Widget +class AbstractType extends \Magento\Backend\Block\Widget { protected $_name = 'abstract'; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/Select.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/Select.php index 15f01c6b401..0b0b8fee2f9 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/Select.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/Select.php @@ -53,13 +53,13 @@ class Select extends protected function _prepareLayout() { - $this->addChild('add_select_row_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('add_select_row_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add New Row'), 'class' => 'add add-select-row', 'id' => 'product_option_${option_id}_add_select_row' )); - $this->addChild('delete_select_row_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('delete_select_row_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete Row'), 'class' => 'delete delete-select-row icon-btn', 'id' => 'product_option_${id}_select_${select_id}_delete' diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group.php index 65a597c451e..c3de653ca25 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group.php @@ -78,7 +78,7 @@ class Group */ protected function _prepareLayout() { - $button = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $button = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => __('Add Group Price'), 'onclick' => 'return groupPriceControl.addItem()', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php index a2df4e71d90..7ba8062f3a9 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php @@ -34,7 +34,7 @@ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group; abstract class AbstractGroup - extends \Magento\Adminhtml\Block\Widget + extends \Magento\Backend\Block\Widget implements \Magento\Data\Form\Element\Renderer\RendererInterface { /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php index d5382d62b06..be00625ef88 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php @@ -91,7 +91,7 @@ class Tier */ protected function _prepareLayout() { - $button = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $button = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => __('Add Tier'), 'onclick' => 'return tierPriceControl.addItem()', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php index 9954522f20b..18f10631785 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab; -class Related extends \Magento\Adminhtml\Block\Widget\Grid +class Related extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Core registry @@ -75,6 +75,7 @@ class Related extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Catalog\Model\Product\LinkFactory $linkFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory @@ -83,10 +84,13 @@ class Related extends \Magento\Adminhtml\Block\Widget\Grid * @param \Magento\Catalog\Model\Product\Visibility $visibility * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Catalog\Model\Product\LinkFactory $linkFactory, \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory, \Magento\Catalog\Model\ProductFactory $productFactory, @@ -103,7 +107,7 @@ class Related extends \Magento\Adminhtml\Block\Widget\Grid $this->_status = $status; $this->_visibility = $visibility; $this->_coreRegistry = $coreRegistry; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** @@ -164,7 +168,7 @@ class Related extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare collection * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { @@ -198,7 +202,7 @@ class Related extends \Magento\Adminhtml\Block\Widget\Grid /** * Add columns to grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config.php index 22d6816d061..4ac25db6398 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config.php @@ -147,7 +147,7 @@ class Config */ protected function _prepareLayout() { - $this->addChild('create_empty', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('create_empty', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Create Empty'), 'class' => 'add', 'onclick' => 'superProduct.createEmptyProduct()' diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php index 606c95a1bf4..dbecc7ea3b8 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php @@ -34,7 +34,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Super\Config\Grid\Filter; -class Inventory extends \Magento\Adminhtml\Block\Widget\Grid\Column\Filter\Select +class Inventory extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select { protected function _getOptions() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php index e24433fa4d4..9133983b962 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php @@ -34,7 +34,7 @@ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Super\Config\Grid\Renderer; -class Checkbox extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Checkbox +class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Checkbox { /** * @var \Magento\Json\EncoderInterface diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php index 6f252d26789..06aab228ceb 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php @@ -34,7 +34,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Super\Config\Grid\Renderer; -class Inventory extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Inventory extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * Renders grid column value diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Settings.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Settings.php index 6b2d70030df..42630986663 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Settings.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Settings.php @@ -40,11 +40,17 @@ class Settings extends \Magento\Backend\Block\Widget\Form\Generic */ protected $_configurableType; + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Catalog\Model\Product\Type\Configurable $configurableType + * @param \Magento\Core\Helper\Data $coreHelper * @param array $data */ public function __construct( @@ -52,8 +58,10 @@ class Settings extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Core\Model\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Catalog\Model\Product\Type\Configurable $configurableType, + \Magento\Core\Helper\Data $coreHelper, array $data = array() ) { + $this->_coreHelper = $coreHelper; $this->_configurableType = $configurableType; parent::__construct($context, $registry, $formFactory, $data); } @@ -65,7 +73,7 @@ class Settings extends \Magento\Backend\Block\Widget\Form\Generic protected function _prepareLayout() { $onclick = "jQuery('[data-form=edit-product]').attr('action', " - . $this->helper('Magento\Core\Helper\Data')->jsonEncode($this->getContinueUrl()) + . $this->_coreHelper->jsonEncode($this->getContinueUrl()) . ").addClass('ignore-validate').submit();"; $this->addChild('continue_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Generate Variations'), diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php index bef3f2227e0..d63d16440ff 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab; -class Upsell extends \Magento\Adminhtml\Block\Widget\Grid +class Upsell extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Core registry @@ -75,6 +75,7 @@ class Upsell extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Catalog\Model\Product\LinkFactory $linkFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory @@ -83,10 +84,13 @@ class Upsell extends \Magento\Adminhtml\Block\Widget\Grid * @param \Magento\Catalog\Model\Product\Visibility $visibility * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Catalog\Model\Product\LinkFactory $linkFactory, \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory, \Magento\Catalog\Model\ProductFactory $productFactory, @@ -103,7 +107,7 @@ class Upsell extends \Magento\Adminhtml\Block\Widget\Grid $this->_status = $status; $this->_visibility = $visibility; $this->_coreRegistry = $coreRegistry; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** @@ -174,7 +178,7 @@ class Upsell extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare collection * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { @@ -198,7 +202,7 @@ class Upsell extends \Magento\Adminhtml\Block\Widget\Grid /** * Add columns to grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php index c53988ec880..85f8931c337 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php @@ -75,6 +75,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Core\Model\WebsiteFactory $websiteFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory @@ -83,10 +84,13 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended * @param \Magento\Catalog\Model\Product\Visibility $visibility * @param \Magento\Catalog\Helper\Data $catalogData * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Core\Model\WebsiteFactory $websiteFactory, \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory, \Magento\Catalog\Model\ProductFactory $productFactory, @@ -103,7 +107,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended $this->_status = $status; $this->_visibility = $visibility; $this->_catalogData = $catalogData; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php index f8e437c4969..ae01fa7d16f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Widget; -class Chooser extends \Magento\Adminhtml\Block\Widget\Grid +class Chooser extends \Magento\Backend\Block\Widget\Grid\Extended { protected $_selectedProducts = array(); @@ -60,6 +60,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $collectionFactory * @param \Magento\Catalog\Model\Resource\Category $resourceCategory @@ -69,6 +70,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Resource\Product\CollectionFactory $collectionFactory, \Magento\Catalog\Model\Resource\Category $resourceCategory, @@ -79,7 +81,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid $this->_collectionFactory = $collectionFactory; $this->_resourceCategory = $resourceCategory; $this->_resourceProduct = $resourceProduct; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** @@ -206,7 +208,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid /** * Filter checked/unchecked rows in grid * - * @param \Magento\Adminhtml\Block\Widget\Grid\Column $column + * @param \Magento\Backend\Block\Widget\Grid\Column $column * @return \Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser */ protected function _addColumnFilterToCollection($column) @@ -227,7 +229,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare products collection, defined collection filters (category, product type) * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { @@ -260,7 +262,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare columns for products grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Search.php b/app/code/Magento/Catalog/Block/Adminhtml/Search.php index 020fe1a5b7b..6be143a237f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Search.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Search.php @@ -35,7 +35,7 @@ namespace Magento\Catalog\Block\Adminhtml; -class Search extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Search extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit.php index 4e22a3db0b6..e5e2a2bc9e3 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit.php @@ -30,7 +30,7 @@ namespace Magento\Catalog\Block\Adminhtml\Search; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Catalog/Block/Adminhtml/System/Config/Form/Field/Select/Flatcatalog.php b/app/code/Magento/Catalog/Block/Adminhtml/System/Config/Form/Field/Select/Flatcatalog.php index b79ff808cd7..87cc44e0b9a 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/System/Config/Form/Field/Select/Flatcatalog.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/System/Config/Form/Field/Select/Flatcatalog.php @@ -37,9 +37,28 @@ namespace Magento\Catalog\Block\Adminhtml\System\Config\Form\Field\Select; class Flatcatalog extends \Magento\Backend\Block\System\Config\Form\Field { + /** + * @var \Magento\Catalog\Helper\Category\Flat + */ + protected $_flatCategory; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Catalog\Helper\Category\Flat $flatCategory + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Catalog\Helper\Category\Flat $flatCategory, + array $data = array() + ) { + $this->_flatCategory = $flatCategory; + parent::__construct($context, $data); + } + protected function _getElementHtml(\Magento\Data\Form\Element\AbstractElement $element) { - if (!$this->helper('Magento\Catalog\Helper\Category\Flat')->isBuilt()) { + if (!$this->_flatCategory->isBuilt()) { $element->setDisabled(true) ->setValue(0); } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/System/Config/Form/Field/Select/Flatproduct.php b/app/code/Magento/Catalog/Block/Adminhtml/System/Config/Form/Field/Select/Flatproduct.php index 81cc72115e7..02f676caa42 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/System/Config/Form/Field/Select/Flatproduct.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/System/Config/Form/Field/Select/Flatproduct.php @@ -37,6 +37,25 @@ namespace Magento\Catalog\Block\Adminhtml\System\Config\Form\Field\Select; class Flatproduct extends \Magento\Backend\Block\System\Config\Form\Field { + /** + * @var \Magento\Catalog\Helper\Product\Flat + */ + protected $_flatProduct; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Catalog\Helper\Product\Flat $flatProduct + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Catalog\Helper\Product\Flat $flatProduct, + array $data = array() + ) { + $this->_flatProduct = $flatProduct; + parent::__construct($context, $data); + } + /** * Retrieve Element HTML * @@ -44,7 +63,7 @@ class Flatproduct * @return string */ protected function _getElementHtml(\Magento\Data\Form\Element\AbstractElement $element) { - if (!$this->helper('Magento\Catalog\Helper\Product\Flat')->isBuilt()) { + if (!$this->_flatProduct->isBuilt()) { $element->setDisabled(true) ->setValue(0); } diff --git a/app/code/Magento/Catalog/Block/Category/View.php b/app/code/Magento/Catalog/Block/Category/View.php index b35ce907683..64ded63d644 100644 --- a/app/code/Magento/Catalog/Block/Category/View.php +++ b/app/code/Magento/Catalog/Block/Category/View.php @@ -49,18 +49,26 @@ class View extends \Magento\View\Element\Template */ protected $_catalogLayer; + /** + * @var \Magento\Catalog\Helper\Category + */ + protected $_categoryHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Catalog\Model\Layer $catalogLayer * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Catalog\Helper\Category $categoryHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Catalog\Model\Layer $catalogLayer, \Magento\Core\Model\Registry $registry, + \Magento\Catalog\Helper\Category $categoryHelper, array $data = array() ) { + $this->_categoryHelper = $categoryHelper; $this->_catalogLayer = $catalogLayer; $this->_coreRegistry = $registry; parent::__construct($context, $data); @@ -88,7 +96,7 @@ class View extends \Magento\View\Element\Template $headBlock->setKeywords($keywords); } //@todo: move canonical link to separate block - if ($this->helper('Magento\Catalog\Helper\Category')->canUseCanonicalTag() + if ($this->_categoryHelper->canUseCanonicalTag() && !$headBlock->getChildBlock('magento-page-head-category-canonical-link') ) { $headBlock->addChild( diff --git a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php index 3c8a24302c2..34a53c8ee89 100644 --- a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php @@ -114,6 +114,31 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ protected $mathRandom; + /** + * @var \Magento\Checkout\Helper\Cart + */ + protected $_cartHelper; + + /** + * @var \Magento\Wishlist\Helper\Data + */ + protected $_wishlistHelper; + + /** + * @var \Magento\Catalog\Helper\Product\Compare + */ + protected $_compareProduct; + + /** + * @var \Magento\Theme\Helper\Layout + */ + protected $_layoutHelper; + + /** + * @var \Magento\Catalog\Helper\Image + */ + protected $_imageHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Catalog\Model\Config $catalogConfig @@ -121,7 +146,14 @@ abstract class AbstractProduct extends \Magento\View\Element\Template * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -130,8 +162,18 @@ abstract class AbstractProduct extends \Magento\View\Element\Template \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, array $data = array() ) { + $this->_imageHelper = $imageHelper; + $this->_layoutHelper = $layoutHelper; + $this->_compareProduct = $compareProduct; + $this->_wishlistHelper = $wishlistHelper; + $this->_cartHelper = $cartHelper; $this->_catalogConfig = $catalogConfig; $this->_coreRegistry = $registry; $this->_taxData = $taxData; @@ -161,7 +203,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template return $this->getProductUrl($product, $additional); } - return $this->helper('Magento\Checkout\Helper\Cart')->getAddUrl($product, $additional); + return $this->_cartHelper->getAddUrl($product, $additional); } /** @@ -194,7 +236,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ public function getAddToWishlistUrl($product) { - return $this->helper('Magento\Wishlist\Helper\Data')->getAddUrl($product); + return $this->_wishlistHelper->getAddUrl($product); } /** @@ -205,7 +247,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ public function getAddToCompareUrl($product) { - return $this->helper('Magento\Catalog\Helper\Product\Compare')->getAddUrl($product); + return $this->_compareProduct->getAddUrl($product); } /** @@ -597,7 +639,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ public function getPageLayout() { - return $this->helper('Magento\Theme\Helper\Layout')->getCurrentPageLayout(); + return $this->_layoutHelper->getCurrentPageLayout(); } /** @@ -651,7 +693,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ public function getThumbnailUrl($product) { - return (string)$this->helper('Magento\Catalog\Helper\Image')->init($product, 'thumbnail') + return (string)$this->_imageHelper->init($product, 'thumbnail') ->resize($this->getThumbnailSize()); } @@ -673,7 +715,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ public function getThumbnailSidebarUrl($product) { - return (string) $this->helper('Magento\Catalog\Helper\Image')->init($product, 'thumbnail') + return (string) $this->_imageHelper->init($product, 'thumbnail') ->resize($this->getThumbnailSidebarSize()); } @@ -695,7 +737,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ public function getSmallImageUrl($product) { - return (string) $this->helper('Magento\Catalog\Helper\Image')->init($product, 'small_image') + return (string) $this->_imageHelper->init($product, 'small_image') ->resize($this->getSmallImageSize()); } @@ -717,7 +759,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ public function getSmallImageSidebarUrl($product) { - return (string) $this->helper('Magento\Catalog\Helper\Image')->init($product, 'small_image') + return (string) $this->_imageHelper->init($product, 'small_image') ->resize($this->getSmallImageSidebarSize()); } @@ -739,7 +781,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ public function getBaseImageUrl($product) { - return (string)$this->helper('Magento\Catalog\Helper\Image')->init($product, 'image') + return (string)$this->_imageHelper->init($product, 'image') ->resize($this->getBaseImageSize()); } @@ -761,7 +803,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ public function getBaseImageIconUrl($product) { - return (string)$this->helper('Magento\Catalog\Helper\Image')->init($product, 'image') + return (string)$this->_imageHelper->init($product, 'image') ->resize($this->getBaseImageIconSize()); } diff --git a/app/code/Magento/Catalog/Block/Product/Compare/AbstractCompare.php b/app/code/Magento/Catalog/Block/Product/Compare/AbstractCompare.php index d4f59eca800..dffea620967 100644 --- a/app/code/Magento/Catalog/Block/Product/Compare/AbstractCompare.php +++ b/app/code/Magento/Catalog/Block/Product/Compare/AbstractCompare.php @@ -36,36 +36,6 @@ namespace Magento\Catalog\Block\Product\Compare; abstract class AbstractCompare extends \Magento\Catalog\Block\Product\AbstractProduct { - /** - * Catalog product compare - * - * @var \Magento\Catalog\Helper\Product\Compare - */ - protected $_catalogProductCompare = null; - - /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Catalog\Helper\Product\Compare $catalogProductCompare - * @param array $data - */ - public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Core\Model\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Catalog\Helper\Product\Compare $catalogProductCompare, - array $data = array() - ) { - $this->_catalogProductCompare = $catalogProductCompare; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); - } /** * Retrieve Product Compare Helper @@ -74,7 +44,7 @@ abstract class AbstractCompare extends \Magento\Catalog\Block\Product\AbstractPr */ protected function _getHelper() { - return $this->_catalogProductCompare; + return $this->_compareProduct; } /** diff --git a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php index bc85b4255a0..e38241abd31 100644 --- a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php +++ b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php @@ -104,20 +104,31 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare */ protected $_coreData; + /** + * @var \Magento\Wishlist\Helper\Data + */ + protected $_wishlistHelper; + /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Catalog\Model\Config $catalogConfig * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom - * @param \Magento\Catalog\Helper\Product\Compare $catalogProductCompare + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\Customer\Model\Session $customerSession * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -126,7 +137,11 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, - \Magento\Catalog\Helper\Product\Compare $catalogProductCompare, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Core\Helper\Data $coreData, \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, @@ -134,6 +149,7 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare \Magento\Customer\Model\Session $customerSession, array $data = array() ) { + $this->_wishlistHelper = $wishlistHelper; $this->_coreData = $coreData; $this->_itemCollectionFactory = $itemCollectionFactory; $this->_catalogProductVisibility = $catalogProductVisibility; @@ -146,7 +162,11 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare $taxData, $catalogData, $mathRandom, - $catalogProductCompare, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, $data ); } @@ -166,7 +186,7 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare $urlParamName => $continueUrl ); - return $this->helper('Magento\Wishlist\Helper\Data')->getAddUrlWithParams($product, $params); + return $this->_wishlistHelper->getAddUrlWithParams($product, $params); } /** @@ -191,7 +211,7 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare public function getItems() { if (is_null($this->_items)) { - $this->_catalogProductCompare->setAllowUsedFlat(false); + $this->_compareProduct->setAllowUsedFlat(false); $this->_items = $this->_itemCollectionFactory->create(); $this->_items->useProductItem(true) diff --git a/app/code/Magento/Catalog/Block/Product/Configurable/AssociatedSelector/Renderer/Id.php b/app/code/Magento/Catalog/Block/Product/Configurable/AssociatedSelector/Renderer/Id.php index 8ebfb556cfc..af064644010 100644 --- a/app/code/Magento/Catalog/Block/Product/Configurable/AssociatedSelector/Renderer/Id.php +++ b/app/code/Magento/Catalog/Block/Product/Configurable/AssociatedSelector/Renderer/Id.php @@ -37,6 +37,26 @@ namespace Magento\Catalog\Block\Product\Configurable\AssociatedSelector\Renderer class Id extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { + + /** + * @var \Magento\Catalog\Helper\Product + */ + protected $_productHelper; + + /** + * @param \Magento\Backend\Block\Context $context + * @param \Magento\Catalog\Helper\Product $productHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Context $context, + \Magento\Catalog\Helper\Product $productHelper, + array $data = array() + ) { + $this->_productHelper = $productHelper; + parent::__construct($context, $data); + } + /** * Render grid row * @@ -46,7 +66,7 @@ class Id public function render(\Magento\Object $row) { $imageUrl = $row->getImage() && $row->getImage() != 'no_selection' - ? $this->escapeHtml($this->_helperFactory->get('Magento\Catalog\Helper\Product')->getImageUrl($row)) + ? $this->escapeHtml($this->_productHelper->getImageUrl($row)) : ''; return $this->_getValue($row) . '<input type="hidden" data-role="image-url" value="' . $imageUrl . '"/>'; } diff --git a/app/code/Magento/Catalog/Block/Product/Gallery.php b/app/code/Magento/Catalog/Block/Product/Gallery.php index f3f8942bf68..1edc523063d 100644 --- a/app/code/Magento/Catalog/Block/Product/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/Gallery.php @@ -107,7 +107,8 @@ class Gallery extends \Magento\View\Element\Template public function getImageWidth() { $file = $this->getCurrentImage()->getPath(); - if ($this->_filesystem->isFile($file)) { + + if ($this->_filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA)->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 9768e0bfb93..7fbbd44f349 100644 --- a/app/code/Magento/Catalog/Block/Product/ListProduct.php +++ b/app/code/Magento/Catalog/Block/Product/ListProduct.php @@ -71,9 +71,16 @@ class ListProduct extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Layer $catalogLayer * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -82,13 +89,31 @@ class ListProduct extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Layer $catalogLayer, array $data = array() ) { $this->_categoryFactory = $categoryFactory; $this->_catalogLayer = $catalogLayer; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); } /** diff --git a/app/code/Magento/Catalog/Block/Product/NewProduct.php b/app/code/Magento/Catalog/Block/Product/NewProduct.php index fc59f8cd370..d00b3ec7681 100644 --- a/app/code/Magento/Catalog/Block/Product/NewProduct.php +++ b/app/code/Magento/Catalog/Block/Product/NewProduct.php @@ -73,10 +73,17 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Customer\Model\Session $customerSession * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -85,6 +92,11 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Customer\Model\Session $customerSession, @@ -93,7 +105,20 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct $this->_productCollectionFactory = $productCollectionFactory; $this->_catalogProductVisibility = $catalogProductVisibility; $this->_customerSession = $customerSession; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); } /** diff --git a/app/code/Magento/Catalog/Block/Product/Price.php b/app/code/Magento/Catalog/Block/Product/Price.php index 563ade07089..5cebb97e6b3 100644 --- a/app/code/Magento/Catalog/Block/Product/Price.php +++ b/app/code/Magento/Catalog/Block/Product/Price.php @@ -74,6 +74,11 @@ class Price extends \Magento\View\Element\Template */ protected $_jsonEncoder; + /** + * @var \Magento\Checkout\Helper\Cart + */ + protected $_cartHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Json\EncoderInterface $jsonEncoder @@ -82,6 +87,7 @@ class Price extends \Magento\View\Element\Template * @param \Magento\Core\Model\Registry $registry * @param \Magento\Stdlib\String $string * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper * @param array $data */ public function __construct( @@ -92,8 +98,10 @@ class Price extends \Magento\View\Element\Template \Magento\Core\Model\Registry $registry, \Magento\Stdlib\String $string, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, array $data = array() ) { + $this->_cartHelper = $cartHelper; $this->_jsonEncoder = $jsonEncoder; $this->_coreRegistry = $registry; $this->_catalogData = $catalogData; @@ -205,7 +213,7 @@ class Price extends \Magento\View\Element\Template */ public function getAddToCartUrl($product, $additional = array()) { - return $this->helper('Magento\Checkout\Helper\Cart')->getAddUrl($product, $additional); + return $this->_cartHelper->getAddUrl($product, $additional); } /** diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php index 13d6c1e5d20..47103f2a45e 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php @@ -48,11 +48,18 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Layer $catalogLayer * @param \Magento\Catalog\Model\LayerFactory $layerFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -61,6 +68,11 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Layer $catalogLayer, \Magento\Catalog\Model\LayerFactory $layerFactory, @@ -76,6 +88,11 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct $taxData, $catalogData, $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, $categoryFactory, $catalogLayer, $data diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php index 91a17a6c020..63513d1003e 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php @@ -54,11 +54,18 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Layer $catalogLayer * @param \Magento\Catalog\Model\LayerFactory $layerFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -67,6 +74,11 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Layer $catalogLayer, \Magento\Catalog\Model\LayerFactory $layerFactory, @@ -82,6 +94,11 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct $taxData, $catalogData, $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, $categoryFactory, $catalogLayer, $data diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php index 4681f1e428c..92e1d4400bd 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php @@ -70,10 +70,17 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Checkout\Model\Resource\Cart $checkoutCart * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -82,6 +89,11 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Checkout\Model\Resource\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, @@ -90,7 +102,20 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct $this->_checkoutCart = $checkoutCart; $this->_catalogProductVisibility = $catalogProductVisibility; $this->_checkoutSession = $checkoutSession; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); } protected function _prepareData() diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index 976d021cc74..2e483ac781a 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -76,10 +76,17 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Checkout\Model\Resource\Cart $checkoutCart * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -88,6 +95,11 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Checkout\Model\Resource\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, @@ -96,7 +108,20 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct $this->_checkoutCart = $checkoutCart; $this->_catalogProductVisibility = $catalogProductVisibility; $this->_checkoutSession = $checkoutSession; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); } protected function _prepareData() diff --git a/app/code/Magento/Catalog/Block/Product/Send.php b/app/code/Magento/Catalog/Block/Product/Send.php index 4f4c43e406f..1e945b91a13 100644 --- a/app/code/Magento/Catalog/Block/Product/Send.php +++ b/app/code/Magento/Catalog/Block/Product/Send.php @@ -50,8 +50,15 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Customer\Model\Session $customerSession * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -60,11 +67,29 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Customer\Model\Session $customerSession, array $data = array() ) { $this->_customerSession = $customerSession; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); } /** diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index f22be4c5d39..a1c8bf97d4b 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -69,19 +69,32 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct */ protected $_coreData; + /** + * @var \Magento\Catalog\Helper\Product + */ + protected $_productHelper; + /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\Config $catalogConfig * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Tax\Model\Calculation $taxCalculation * @param \Magento\Stdlib\String $string + * @param \Magento\Catalog\Helper\Product $productHelper * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -90,19 +103,39 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Tax\Model\Calculation $taxCalculation, \Magento\Stdlib\String $string, + \Magento\Catalog\Helper\Product $productHelper, array $data = array() ) { + $this->_productHelper = $productHelper; $this->_coreData = $coreData; $this->_jsonEncoder = $jsonEncoder; $this->_productFactory = $productFactory; $this->_taxCalculation = $taxCalculation; $this->string = $string; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); } /** @@ -134,7 +167,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct $headBlock->setDescription($this->string->substr($product->getDescription(), 0, 255)); } //@todo: move canonical link to separate block - if ($this->helper('Magento\Catalog\Helper\Product')->canUseCanonicalTag() + if ($this->_productHelper->canUseCanonicalTag() && !$headBlock->getChildBlock('magento-page-head-product-canonical-link') ) { $params = array('_ignore_category'=>true); @@ -202,7 +235,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct $addUrlValue = $this->_urlBuilder->getUrl('*/*/*', array('_use_rewrite' => true, '_current' => true)); $additional[$addUrlKey] = $this->_coreData->urlEncode($addUrlValue); - return $this->helper('Magento\Checkout\Helper\Cart')->getAddUrl($product, $additional); + return $this->_cartHelper->getAddUrl($product, $additional); } /** diff --git a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php index 820cc588046..3d6d48a3c5b 100644 --- a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php +++ b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php @@ -47,8 +47,15 @@ abstract class AbstractView extends \Magento\Catalog\Block\Product\AbstractProdu * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -57,11 +64,29 @@ abstract class AbstractView extends \Magento\Catalog\Block\Product\AbstractProdu \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Stdlib\ArrayUtils $arrayUtils, array $data = array() ) { $this->arrayUtils = $arrayUtils; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); } diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php b/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php index a6ac246acf9..14c03b42979 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php @@ -57,16 +57,24 @@ abstract class AbstractOptions extends \Magento\View\Element\Template */ protected $_taxData = null; + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Tax\Helper\Data $taxData + * @param \Magento\Core\Helper\Data $coreHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Tax\Helper\Data $taxData, + \Magento\Core\Helper\Data $coreHelper, array $data = array() ) { + $this->_coreHelper = $coreHelper; $this->_taxData = $taxData; parent::__construct($context, $data); } @@ -150,13 +158,13 @@ abstract class AbstractOptions extends \Magento\View\Element\Template $_priceInclTax = $this->getPrice($value['pricing_value'], true); $_priceExclTax = $this->getPrice($value['pricing_value']); if ($this->_taxData->displayPriceIncludingTax()) { - $priceStr .= $this->helper('Magento\Core\Helper\Data')->currencyByStore($_priceInclTax, $store, true, $flag); + $priceStr .= $this->_coreHelper->currencyByStore($_priceInclTax, $store, true, $flag); } elseif ($this->_taxData->displayPriceExcludingTax()) { - $priceStr .= $this->helper('Magento\Core\Helper\Data')->currencyByStore($_priceExclTax, $store, true, $flag); + $priceStr .= $this->_coreHelper->currencyByStore($_priceExclTax, $store, true, $flag); } elseif ($this->_taxData->displayBothPrices()) { - $priceStr .= $this->helper('Magento\Core\Helper\Data')->currencyByStore($_priceExclTax, $store, true, $flag); + $priceStr .= $this->_coreHelper->currencyByStore($_priceExclTax, $store, true, $flag); if ($_priceInclTax != $_priceExclTax) { - $priceStr .= ' ('.$sign.$this->helper('Magento\Core\Helper\Data') + $priceStr .= ' ('.$sign.$this->_coreHelper ->currencyByStore($_priceInclTax, $store, true, $flag).' '.__('Incl. Tax').')'; } } @@ -194,6 +202,6 @@ abstract class AbstractOptions extends \Magento\View\Element\Template public function getCurrencyPrice($price) { $store = $this->getProduct()->getStore(); - return $this->helper('Magento\Core\Helper\Data')->currencyByStore($price, $store, false); + return $this->_coreHelper->currencyByStore($price, $store, false); } } diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php index 3fa0a3ce257..fe6ca7c537b 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php @@ -51,17 +51,19 @@ class Date extends \Magento\Catalog\Block\Product\View\Options\AbstractOptions /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Tax\Helper\Data $taxData + * @param \Magento\Core\Helper\Data $coreHelper * @param \Magento\Catalog\Model\Product\Option\Type\Date $catalogProductOptionTypeDate * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Tax\Helper\Data $taxData, + \Magento\Core\Helper\Data $coreHelper, \Magento\Catalog\Model\Product\Option\Type\Date $catalogProductOptionTypeDate, array $data = array() ) { $this->_catalogProductOptionTypeDate = $catalogProductOptionTypeDate; - parent::__construct($context, $taxData, $data); + parent::__construct($context, $taxData, $coreHelper, $data); } protected function _prepareLayout() diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php index e578727a43e..a48d904212c 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php @@ -37,6 +37,27 @@ namespace Magento\Catalog\Block\Product\View\Options\Type; class Select extends \Magento\Catalog\Block\Product\View\Options\AbstractOptions { + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Tax\Helper\Data $taxData + * @param \Magento\Core\Helper\Data $coreHelper + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Tax\Helper\Data $taxData, + \Magento\Core\Helper\Data $coreHelper, + array $data = array() + ) { + $this->_coreHelper = $coreHelper; + parent::__construct($context, $taxData, $coreHelper, $data); + } + /** * Return html for control element * @@ -75,7 +96,7 @@ class Select $_value->getOptionTypeId(), $_value->getTitle() . ' ' . $priceStr . '', array( - 'price' => $this->helper('Magento\Core\Helper\Data')->currencyByStore( + 'price' => $this->_coreHelper->currencyByStore( $_value->getPrice(true), $store, false @@ -143,7 +164,7 @@ class Select . ($this->getSkipJsReloadPrice() ? '' : ' onclick="opConfig.reloadPrice()"') . ' name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $htmlValue . '" ' . $checked . ' price="' - . $this->helper('Magento\Core\Helper\Data')->currencyByStore($_value->getPrice(true), $store, false) . '" />' + . $this->_coreHelper->currencyByStore($_value->getPrice(true), $store, false) . '" />' . '<label class="label" for="options_' . $_option->getId() . '_' . $count . '"><span>' . $_value->getTitle() . '</span>' . $priceStr . '</label>'; $selectHtml .= '</div>'; 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 dca71d03499..b25fa2cb2e9 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Type/Configurable.php +++ b/app/code/Magento/Catalog/Block/Product/View/Type/Configurable.php @@ -69,18 +69,30 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView */ protected $_jsonEncoder; + /** + * @var \Magento\Catalog\Helper\Image + */ + protected $_imageHelper; + /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\Config $catalogConfig * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @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 array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -89,17 +101,35 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \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() ) { + $this->_imageHelper = $imageHelper; $this->_taxCalculation = $taxCalculation; $this->_catalogProduct = $catalogProduct; $this->_jsonEncoder = $jsonEncoder; parent::__construct( - $context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $arrayUtils, $data + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $arrayUtils, + $data ); } @@ -196,7 +226,7 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView foreach ($this->getAllowProducts() as $product) { $productId = $product->getId(); - $image = $this->helper('Magento\Catalog\Helper\Image')->init($product, 'image'); + $image = $this->_imageHelper->init($product, 'image'); foreach ($this->getAllowAttributes() as $attribute) { $productAttribute = $attribute->getProductAttribute(); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php index 75052a3faa5..19043ae5ed8 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php @@ -352,10 +352,11 @@ class Category extends \Magento\Backend\App\Action } $category->save(); - $this->_getSession()->addSuccess(__('You saved the category.')); + $this->messageManager->addSuccess(__('You saved the category.')); $refreshTree = 'true'; } catch (\Exception $e){ - $this->_getSession()->addError($e->getMessage())->setCategoryData($data); + $this->messageManager->addError($e->getMessage()); + $this->_getSession()->setCategoryData($data); $refreshTree = 'false'; } } @@ -365,7 +366,7 @@ class Category extends \Magento\Backend\App\Action /** @var $block \Magento\View\Element\Messages */ $block = $this->_objectManager->get('Magento\View\Element\Messages'); - $block->setMessages($this->_getSession()->getMessages(true)); + $block->setMessages($this->messageManager->getMessages(true)); $body = $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode(array( 'messages' => $block->getGroupedHtml(), 'error' => $refreshTree !== 'true', @@ -444,13 +445,13 @@ class Category extends \Magento\Backend\App\Action $this->_objectManager->get('Magento\Backend\Model\Auth\Session')->setDeletedPath($category->getPath()); $category->delete(); - $this->_getSession()->addSuccess(__('You deleted the category.')); + $this->messageManager->addSuccess(__('You deleted the category.')); } catch (\Magento\Core\Exception $e){ - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->getResponse()->setRedirect($this->getUrl('catalog/*/edit', array('_current' => true))); return; } catch (\Exception $e){ - $this->_getSession()->addError(__('Something went wrong while trying to delete the category.')); + $this->messageManager->addError(__('Something went wrong while trying to delete the category.')); $this->getResponse()->setRedirect($this->getUrl('catalog/*/edit', array('_current' => true))); return; } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php index 510b8883b4f..41ac1941e5f 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php @@ -172,13 +172,13 @@ class Product extends \Magento\Backend\App\Action * Create serializer block for a grid * * @param string $inputName - * @param \Magento\Adminhtml\Block\Widget\Grid $gridBlock + * @param \Magento\Backend\Block\Widget\Grid $gridBlock * @param array $productsArray * @return \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Ajax\Serializer */ protected function _createSerializerBlock( $inputName, - \Magento\Adminhtml\Block\Widget\Grid $gridBlock, + \Magento\Backend\Block\Widget\Grid $gridBlock, $productsArray ) { return $this->_view->getLayout()->createBlock('Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Ajax\Serializer') @@ -269,7 +269,7 @@ class Product extends \Magento\Backend\App\Action $product = $this->_initProduct(); if ($productId && !$product->getId()) { - $this->_getSession()->addError( + $this->messageManager->addError( __('This product no longer exists.') ); $this->_redirect('catalog/*/'); @@ -646,8 +646,8 @@ class Product extends \Magento\Backend\App\Action $response->setError(true); $response->setMessage($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError($e->getMessage()); - $this->_view->getLayout()->initMessages('Magento\Adminhtml\Model\Session'); + $this->messageManager->addError($e->getMessage()); + $this->_view->getLayout()->initMessages(); $response->setError(true); $response->setMessage($this->_view->getLayout()->getMessagesBlock()->getGroupedHtml()); } @@ -764,16 +764,16 @@ class Product extends \Magento\Backend\App\Action $links = $this->getRequest()->getPost('links'); if (isset($links['related']) && !$product->getRelatedReadonly()) { $product->setRelatedLinkData( - $this->_objectManager->get('Magento\Adminhtml\Helper\Js')->decodeGridSerializedInput($links['related']) + $this->_objectManager->get('Magento\Backend\Helper\Js')->decodeGridSerializedInput($links['related']) ); } if (isset($links['upsell']) && !$product->getUpsellReadonly()) { $product->setUpSellLinkData( - $this->_objectManager->get('Magento\Adminhtml\Helper\Js')->decodeGridSerializedInput($links['upsell']) + $this->_objectManager->get('Magento\Backend\Helper\Js')->decodeGridSerializedInput($links['upsell']) ); } if (isset($links['crosssell']) && !$product->getCrosssellReadonly()) { - $product->setCrossSellLinkData($this->_objectManager->get('Magento\Adminhtml\Helper\Js') + $product->setCrossSellLinkData($this->_objectManager->get('Magento\Backend\Helper\Js') ->decodeGridSerializedInput($links['crosssell'])); } @@ -893,9 +893,9 @@ class Product extends \Magento\Backend\App\Action $this->_objectManager->create('Magento\CatalogRule\Model\Rule')->applyAllRulesToProduct($productId); - $this->_getSession()->addSuccess(__('You saved the product.')); + $this->messageManager->addSuccess(__('You saved the product.')); if ($product->getSku() != $originalSku) { - $this->_getSession()->addNotice(__('SKU for product %1 has been changed to %2.', + $this->messageManager->addNotice(__('SKU for product %1 has been changed to %2.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getName()), $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getSku())) ); @@ -908,16 +908,16 @@ class Product extends \Magento\Backend\App\Action if ($redirectBack === 'duplicate') { $newProduct = $product->duplicate(); - $this->_getSession()->addSuccess(__('You duplicated the product.')); + $this->messageManager->addSuccess(__('You duplicated the product.')); } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()) - ->setProductData($data); + $this->messageManager->addError($e->getMessage()); + $this->_session->setProductData($data); $redirectBack = true; } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $redirectBack = true; } } @@ -960,11 +960,11 @@ class Product extends \Magento\Backend\App\Action $product = $this->_initProduct(); try { $newProduct = $product->duplicate(); - $this->_getSession()->addSuccess(__('You duplicated the product.')); + $this->messageManager->addSuccess(__('You duplicated the product.')); $this->_redirect('catalog/*/edit', array('_current'=>true, 'id'=>$newProduct->getId())); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('catalog/*/edit', array('_current'=>true)); } } @@ -1010,7 +1010,7 @@ class Product extends \Magento\Backend\App\Action { $productIds = $this->getRequest()->getParam('product'); if (!is_array($productIds)) { - $this->_getSession()->addError(__('Please select product(s).')); + $this->messageManager->addError(__('Please select product(s).')); } else { if (!empty($productIds)) { try { @@ -1018,11 +1018,11 @@ class Product extends \Magento\Backend\App\Action $product = $this->_objectManager->get('Magento\Catalog\Model\Product')->load($productId); $product->delete(); } - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('A total of %1 record(s) have been deleted.', count($productIds)) ); } catch (\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } } } @@ -1044,13 +1044,13 @@ class Product extends \Magento\Backend\App\Action $this->_objectManager->get('Magento\Catalog\Model\Product\Action') ->updateAttributes($productIds, array('status' => $status), $storeId); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('A total of %1 record(s) have been updated.', count($productIds)) ); } catch (\Magento\Core\Model\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession() ->addException($e, __('Something went wrong while updating the product(s) status.')); @@ -1095,7 +1095,7 @@ class Product extends \Magento\Backend\App\Action */ public function showUpdateResultAction() { - $session = $this->_objectManager->get('Magento\Adminhtml\Model\Session'); + $session = $this->_objectManager->get('Magento\Backend\Model\Session'); if ($session->hasCompositeProductResult() && $session->getCompositeProductResult() instanceof \Magento\Object) { $this->_objectManager->get('Magento\Catalog\Helper\Product\Composite') diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php index d33d51f6798..1d730ba3d77 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php @@ -173,22 +173,24 @@ class Attribute extends \Magento\Backend\App\Action 'products' => $productIds )); - $this->_getSession()->addNotice( + $this->messageManager->addNotice( __('Please refresh "Catalog URL Rewrites" and "Product Attributes" in System -> ' . '<a href="%1">Index Management</a>.', $this->getUrl('adminhtml/process/list')) ); } - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('A total of %1 record(s) were updated.', count($this->_helper->getProductIds())) ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession() - ->addException($e, __('Something went wrong while updating the product(s) attributes.')); + $this->messageManager->addException( + $e, + __('Something went wrong while updating the product(s) attributes.') + ); } $this->_redirect('catalog/product/', array('store'=>$this->_helper->getSelectedStoreId())); @@ -210,7 +212,7 @@ class Attribute extends \Magento\Backend\App\Action } if ($error) { - $this->_getSession()->addError($error); + $this->messageManager->addError($error); $this->_redirect('catalog/product/', array('_current'=>true)); } @@ -254,9 +256,9 @@ class Attribute extends \Magento\Backend\App\Action $response->setError(true); $response->setMessage($e->getMessage()); } catch (\Exception $e) { - $this->_getSession() + $this->messageManager ->addException($e, __('Something went wrong while updating the product(s) attributes.')); - $this->_view->getLayout()->initMessages('Magento\Adminhtml\Model\Session'); + $this->_view->getLayout()->initMessages(); $response->setError(true); $response->setMessage($this->_view->getLayout()->getMessagesBlock()->getGroupedHtml()); } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php index fa36b4dc8e6..dd7af148ad9 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php @@ -67,7 +67,7 @@ class Attribute extends \Magento\Backend\App\Action * Dispatch request * * @param \Magento\App\RequestInterface $request - * @return $this|mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(\Magento\App\RequestInterface $request) { @@ -126,23 +126,21 @@ class Attribute extends \Magento\Backend\App\Action $model->load($id); if (! $model->getId()) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('This attribute no longer exists.')); + $this->messageManager->addError(__('This attribute no longer exists.')); $this->_redirect('catalog/*/'); return; } // entity type check if ($model->getEntityTypeId() != $this->_entityTypeId) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('This attribute cannot be edited.')); + $this->messageManager->addError(__('This attribute cannot be edited.')); $this->_redirect('catalog/*/'); return; } } // set entered data if was error when we do save - $data = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getAttributeData(true); + $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getAttributeData(true); if (! empty($data)) { $model->addData($data); } @@ -204,11 +202,11 @@ class Attribute extends \Magento\Backend\App\Action $attributeSet->setEntityTypeId($this->_entityTypeId)->load($setName, 'attribute_set_name'); if ($attributeSet->getId()) { $setName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($setName); - $this->_getSession()->addError( + $this->messageManager->addError( __('Attribute Set with name \'%1\' already exists.', $setName) ); - $this->_view->getLayout()->initMessages('Magento\Adminhtml\Model\Session'); + $this->_view->getLayout()->initMessages(); $response->setError(true); $response->setMessage($this->_view->getLayout()->getMessagesBlock()->getGroupedHtml()); } @@ -241,7 +239,7 @@ class Attribute extends \Magento\Backend\App\Action $data = $this->getRequest()->getPost(); if ($data) { /** @var $session \Magento\Backend\Model\Auth\Session */ - $session = $this->_objectManager->get('Magento\Adminhtml\Model\Session'); + $session = $this->_objectManager->get('Magento\Backend\Model\Session'); $isNewAttributeSet = false; if (!empty($data['new_attribute_set_name'])) { @@ -254,10 +252,10 @@ class Attribute extends \Magento\Backend\App\Action ->load($name, 'attribute_set_name'); if ($attributeSet->getId()) { - $session->addError( + $this->messageManager->addError( __('Attribute Set with name \'%1\' already exists.', $name) ); - $session->setAttributeData($data); + $this->messageManager->setAttributeData($data); $this->_redirect('catalog/*/edit', array('_current' => true)); return; } @@ -268,9 +266,9 @@ class Attribute extends \Magento\Backend\App\Action $attributeSet->initFromSkeleton($this->getRequest()->getParam('set'))->save(); $isNewAttributeSet = true; } catch (\Magento\Core\Exception $e) { - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $session->addException($e, __('Something went wrong saving the attribute.')); + $this->messageManager->addException($e, __('Something went wrong saving the attribute.')); } } @@ -288,7 +286,7 @@ class Attribute extends \Magento\Backend\App\Action if (strlen($this->getRequest()->getParam('attribute_code')) > 0) { $validatorAttrCode = new \Zend_Validate_Regex(array('pattern' => '/^[a-z][a-z_0-9]{0,30}$/')); if (!$validatorAttrCode->isValid($attributeCode)) { - $session->addError(__('Attribute code "%1" is invalid. Please use only letters (a-z), ' + $this->messageManager->addError(__('Attribute code "%1" is invalid. Please use only letters (a-z), ' . 'numbers (0-9) or underscore(_) in this field, first character should be a letter.', $attributeCode) ); @@ -304,7 +302,7 @@ class Attribute extends \Magento\Backend\App\Action $inputType = $this->_objectManager->create('Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\Validator'); if (!$inputType->isValid($data['frontend_input'])) { foreach ($inputType->getMessages() as $message) { - $session->addError($message); + $this->messageManager->addError($message); } $this->_redirect('catalog/*/edit', array('attribute_id' => $id, '_current' => true)); return; @@ -314,14 +312,14 @@ class Attribute extends \Magento\Backend\App\Action if ($id) { $model->load($id); if (!$model->getId()) { - $session->addError( + $this->messageManager->addError( __('This attribute no longer exists.')); $this->_redirect('catalog/*/'); return; } // entity type check if ($model->getEntityTypeId() != $this->_entityTypeId) { - $session->addError( + $this->messageManager->addError( __('You can\'t update your attribute.')); $session->setAttributeData($data); $this->_redirect('catalog/*/'); @@ -387,7 +385,7 @@ class Attribute extends \Magento\Backend\App\Action try { $model->save(); - $session->addSuccess(__('You saved the product attribute.')); + $this->messageManager->addSuccess(__('You saved the product attribute.')); $this->_attributeLabelCache->clean(); $session->setAttributeData(false); @@ -409,7 +407,7 @@ class Attribute extends \Magento\Backend\App\Action } return; } catch (\Exception $e) { - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $session->setAttributeData($data); $this->_redirect('catalog/*/edit', array('attribute_id' => $id, '_current' => true)); return; @@ -427,26 +425,26 @@ class Attribute extends \Magento\Backend\App\Action // entity type check $model->load($id); if ($model->getEntityTypeId() != $this->_entityTypeId) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('This attribute cannot be deleted.')); + $this->messageManager->addError(__('This attribute cannot be deleted.')); $this->_redirect('catalog/*/'); return; } try { $model->delete(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('The product attribute has been deleted.')); + $this->messageManager->addSuccess(__('The product attribute has been deleted.')); $this->_redirect('catalog/*/'); return; } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); - $this->_redirect('catalog/*/edit', array('attribute_id' => $this->getRequest()->getParam('attribute_id'))); + $this->messageManager->addError($e->getMessage()); + $this->_redirect( + 'catalog/*/edit', + array('attribute_id' => $this->getRequest()->getParam('attribute_id')) + ); return; } } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('We can\'t find an attribute to delete.')); + $this->messageManager->addError(__('We can\'t find an attribute to delete.')); $this->_redirect('catalog/*/'); } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery.php index 7123f488ce0..c49d8f41851 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery.php @@ -45,9 +45,10 @@ class Gallery extends \Magento\Backend\App\Action $uploader->addValidateCallback('catalog_product_image', $imageAdapter, 'validateUploadFile'); $uploader->setAllowRenameFiles(true); $uploader->setFilesDispersion(true); - $result = $uploader->save( - $this->_objectManager->get('Magento\Catalog\Model\Product\Media\Config')->getBaseTmpMediaPath() - ); + /** @var \Magento\Filesystem\Directory\Read $mediaDirectory */ + $mediaDirectory = $this->_objectManager->get('Magento\Filesystem')->getDirectoryRead(\Magento\Filesystem::MEDIA); + $config = $this->_objectManager->get('Magento\Catalog\Model\Product\Media\Config'); + $result = $uploader->save($mediaDirectory->getAbsolutePath($config->getBaseTmpMediaPath())); $this->_eventManager->dispatch('catalog_product_gallery_upload_image_after', array( 'result' => $result, diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Group.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Group.php index a31e87935f2..aada4d365d1 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Group.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Group.php @@ -35,13 +35,13 @@ class Group extends \Magento\Backend\App\Action $model->setAttributeGroupName($this->getRequest()->getParam('attribute_group_name')) ->setAttributeSetId($this->getRequest()->getParam('attribute_set_id')); - if( $model->itemExists() ) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('A group with the same name already exists.')); + if ($model->itemExists()) { + $this->messageManager->addError(__('A group with the same name already exists.')); } else { try { $model->save(); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('Something went wrong while saving this group.')); + $this->messageManager->addError(__('Something went wrong while saving this group.')); } } } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php index f48ec1dbdf4..dc4f438ecfc 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php @@ -129,9 +129,8 @@ class Review extends \Magento\Backend\App\Action { if (($data = $this->getRequest()->getPost()) && ($reviewId = $this->getRequest()->getParam('id'))) { $review = $this->_objectManager->create('Magento\Review\Model\Review')->load($reviewId); - $session = $this->_objectManager->get('Magento\Adminhtml\Model\Session'); if (! $review->getId()) { - $session->addError(__('The review was removed by another user or does not exist.')); + $this->messageManager->addError(__('The review was removed by another user or does not exist.')); } else { try { $review->addData($data)->save(); @@ -159,11 +158,11 @@ class Review extends \Magento\Backend\App\Action $review->aggregate(); - $session->addSuccess(__('You saved the review.')); + $this->messageManager->addSuccess(__('You saved the review.')); } catch (\Magento\Core\Exception $e) { - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e){ - $session->addException($e, __('Something went wrong while saving this review.')); + $this->messageManager->addException($e, __('Something went wrong while saving this review.')); } } @@ -180,14 +179,12 @@ class Review extends \Magento\Backend\App\Action public function deleteAction() { $reviewId = $this->getRequest()->getParam('id', false); - $session = $this->_objectManager->get('Magento\Adminhtml\Model\Session'); - try { $this->_objectManager->create('Magento\Review\Model\Review')->setId($reviewId) ->aggregate() ->delete(); - $session->addSuccess(__('The review has been deleted.')); + $this->messageManager->addSuccess(__('The review has been deleted.')); if( $this->getRequest()->getParam('ret') == 'pending' ) { $this->getResponse()->setRedirect($this->getUrl('adminhtml/*/pending')); } else { @@ -195,9 +192,9 @@ class Review extends \Magento\Backend\App\Action } return; } catch (\Magento\Core\Exception $e) { - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e){ - $session->addException($e, __('Something went wrong deleting this review.')); + $this->messageManager->addException($e, __('Something went wrong deleting this review.')); } $this->_redirect('catalog/*/edit/',array('id'=>$reviewId)); @@ -206,23 +203,22 @@ class Review extends \Magento\Backend\App\Action public function massDeleteAction() { $reviewsIds = $this->getRequest()->getParam('reviews'); - $session = $this->_objectManager->get('Magento\Adminhtml\Model\Session'); - if(!is_array($reviewsIds)) { - $session->addError(__('Please select review(s).')); + if (!is_array($reviewsIds)) { + $this->messageManager->addError(__('Please select review(s).')); } else { try { foreach ($reviewsIds as $reviewId) { $model = $this->_objectManager->create('Magento\Review\Model\Review')->load($reviewId); $model->delete(); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( + $this->messageManager->addSuccess( __('A total of %1 record(s) have been deleted.', count($reviewsIds)) ); } catch (\Magento\Core\Exception $e) { - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e){ - $session->addException($e, __('An error occurred while deleting record(s).')); + $this->messageManager->addException($e, __('An error occurred while deleting record(s).')); } } @@ -232,12 +228,9 @@ class Review extends \Magento\Backend\App\Action public function massUpdateStatusAction() { $reviewsIds = $this->getRequest()->getParam('reviews'); - $session = $this->_objectManager->get('Magento\Adminhtml\Model\Session'); - - if(!is_array($reviewsIds)) { - $session->addError(__('Please select review(s).')); + if (!is_array($reviewsIds)) { + $this->messageManager->addError(__('Please select review(s).')); } else { - /* @var $session \Magento\Adminhtml\Model\Session */ try { $status = $this->getRequest()->getParam('status'); foreach ($reviewsIds as $reviewId) { @@ -246,13 +239,13 @@ class Review extends \Magento\Backend\App\Action ->save() ->aggregate(); } - $session->addSuccess( + $this->messageManager->addSuccess( __('A total of %1 record(s) have been updated.', count($reviewsIds)) ); } catch (\Magento\Core\Exception $e) { - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $session->addException($e, __('An error occurred while updating the selected review(s).')); + $this->messageManager->addException($e, __('An error occurred while updating the selected review(s).')); } } @@ -262,13 +255,10 @@ class Review extends \Magento\Backend\App\Action public function massVisibleInAction() { $reviewsIds = $this->getRequest()->getParam('reviews'); - $session = $this->_objectManager->get('Magento\Adminhtml\Model\Session'); - if(!is_array($reviewsIds)) { - $session->addError(__('Please select review(s).')); + if (!is_array($reviewsIds)) { + $this->messageManager->addError(__('Please select review(s).')); } else { - $session = $this->_objectManager->get('Magento\Adminhtml\Model\Session'); - /* @var $session \Magento\Adminhtml\Model\Session */ try { $stores = $this->getRequest()->getParam('stores'); foreach ($reviewsIds as $reviewId) { @@ -276,13 +266,13 @@ class Review extends \Magento\Backend\App\Action $model->setSelectStores($stores); $model->save(); } - $session->addSuccess( + $this->messageManager->addSuccess( __('A total of %1 record(s) have been updated.', count($reviewsIds)) ); } catch (\Magento\Core\Exception $e) { - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $session->addException($e, __('An error occurred while updating the selected review(s).')); + $this->messageManager->addException($e, __('An error occurred while updating the selected review(s).')); } } @@ -324,7 +314,6 @@ class Review extends \Magento\Backend\App\Action public function postAction() { $productId = $this->getRequest()->getParam('product_id', false); - $session = $this->_objectManager->get('Magento\Adminhtml\Model\Session'); if ($data = $this->getRequest()->getPost()) { if ($this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->hasSingleStore()) { @@ -358,7 +347,7 @@ class Review extends \Magento\Backend\App\Action $review->aggregate(); - $session->addSuccess(__('You saved the review.')); + $this->messageManager->addSuccess(__('You saved the review.')); if( $this->getRequest()->getParam('ret') == 'pending' ) { $this->getResponse()->setRedirect($this->getUrl('catalog/*/pending')); } else { @@ -367,9 +356,9 @@ class Review extends \Magento\Backend\App\Action return; } catch (\Magento\Core\Exception $e) { - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $session->addException($e, __('An error occurred while saving review.')); + $this->messageManager->addException($e, __('An error occurred while saving review.')); } } $this->getResponse()->setRedirect($this->getUrl('catalog/*/')); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php index 65ca47f0ef2..47ff9719550 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php @@ -160,12 +160,12 @@ class Set extends \Magento\Backend\App\Action $model->initFromSkeleton($this->getRequest()->getParam('skeleton_set')); } $model->save(); - $this->_getSession()->addSuccess(__('You saved the attribute set.')); + $this->messageManager->addSuccess(__('You saved the attribute set.')); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $hasError = true; } catch (\Exception $e) { - $this->_getSession()->addException($e, + $this->messageManager->addException($e, __('An error occurred while saving the attribute set.')); $hasError = true; } @@ -174,7 +174,7 @@ class Set extends \Magento\Backend\App\Action if ($this->getRequest()->getPost('return_session_messages_only')) { /** @var $block \Magento\View\Element\Messages */ $block = $this->_objectManager->get('Magento\View\Element\Messages'); - $block->setMessages($this->_getSession()->getMessages(true)); + $block->setMessages($this->messageManager->getMessages(true)); $body = $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode(array( 'messages' => $block->getGroupedHtml(), 'error' => $hasError, @@ -191,7 +191,7 @@ class Set extends \Magento\Backend\App\Action } else { $response = array(); if ($hasError) { - $this->_view->getLayout()->initMessages('Magento\Adminhtml\Model\Session'); + $this->_view->getLayout()->initMessages(); $response['error'] = 1; $response['message'] = $this->_view->getLayout()->getMessagesBlock()->getGroupedHtml(); } else { @@ -228,10 +228,10 @@ class Set extends \Magento\Backend\App\Action ->setId($setId) ->delete(); - $this->_getSession()->addSuccess(__('The attribute set has been removed.')); + $this->messageManager->addSuccess(__('The attribute set has been removed.')); $this->getResponse()->setRedirect($this->getUrl('catalog/*/')); } catch (\Exception $e) { - $this->_getSession()->addError(__('An error occurred while deleting this set.')); + $this->messageManager->addError(__('An error occurred while deleting this set.')); $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); } } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Search.php b/app/code/Magento/Catalog/Controller/Adminhtml/Search.php index 0ff8a401edb..dd90f010ac2 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Search.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Search.php @@ -82,14 +82,14 @@ class Search extends \Magento\Backend\App\Action if ($id) { $model->load($id); if (! $model->getId()) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('This search no longer exists.')); + $this->messageManager->addError(__('This search no longer exists.')); $this->_redirect('catalog/*'); return; } } // set entered data if was error when we do save - $data = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getPageData(true); + $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getPageData(true); if (!empty($data)) { $model->addData($data); } @@ -105,8 +105,7 @@ class Search extends \Magento\Backend\App\Action $this->_view->getLayout()->getBlock('adminhtml.catalog.search.edit') ->setData('action', $this->getUrl('catalog/search/save')); - $this - ->_addBreadcrumb($id ? __('Edit Search') : __('New Search'), $id ? __('Edit Search') : __('New Search')); + $this->_addBreadcrumb($id ? __('Edit Search') : __('New Search'), $id ? __('Edit Search') : __('New Search')); $this->_view->renderLayout(); } @@ -148,10 +147,11 @@ class Search extends \Magento\Backend\App\Action $model->save(); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $hasError = true; } catch (\Exception $e) { - $this->_getSession()->addException($e, + $this->messageManager->addException( + $e, __('Something went wrong while saving the search query.') ); $hasError = true; @@ -174,16 +174,16 @@ class Search extends \Magento\Backend\App\Action $model = $this->_objectManager->create('Magento\CatalogSearch\Model\Query'); $model->setId($id); $model->delete(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('You deleted the search.')); + $this->messageManager->addSuccess(__('You deleted the search.')); $this->_redirect('catalog/*/'); return; } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('catalog/*/edit', array('id' => $this->getRequest()->getParam('id'))); return; } } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('We can\'t find a search term to delete.')); + $this->messageManager->addError(__('We can\'t find a search term to delete.')); $this->_redirect('catalog/*/'); } @@ -191,21 +191,18 @@ class Search extends \Magento\Backend\App\Action { $searchIds = $this->getRequest()->getParam('search'); if (!is_array($searchIds)) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('Please select catalog searches.')); + $this->messageManager->addError(__('Please select catalog searches.')); } else { try { foreach ($searchIds as $searchId) { $model = $this->_objectManager->create('Magento\CatalogSearch\Model\Query')->load($searchId); $model->delete(); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('Total of %1 record(s) were deleted', count($searchIds)) - ); + $this->messageManager->addSuccess(__('Total of %1 record(s) were deleted', count($searchIds))); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } } - $this->_redirect('catalog/*/index'); } diff --git a/app/code/Magento/Catalog/Controller/Category.php b/app/code/Magento/Catalog/Controller/Category.php index 81ce0199561..f5ed0c0d1c9 100644 --- a/app/code/Magento/Catalog/Controller/Category.php +++ b/app/code/Magento/Catalog/Controller/Category.php @@ -183,7 +183,7 @@ class Category extends \Magento\App\Action\Action ->addBodyClass('category-' . $category->getUrlKey()); } - $this->_view->getLayout()->initMessages(array('Magento\Catalog\Model\Session', 'Magento\Checkout\Model\Session')); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } elseif (!$this->getResponse()->isRedirect()) { $this->_forward('noroute'); diff --git a/app/code/Magento/Catalog/Controller/Product/Compare.php b/app/code/Magento/Catalog/Controller/Product/Compare.php index 3c202c60e69..13521974c5c 100644 --- a/app/code/Magento/Catalog/Controller/Product/Compare.php +++ b/app/code/Magento/Catalog/Controller/Product/Compare.php @@ -181,7 +181,7 @@ class Compare extends \Magento\App\Action\Action if ($product->getId()/* && !$product->isSuper()*/) { $this->_catalogProductCompareList->addProduct($product); $productName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getName()); - $this->_catalogSession->addSuccess( + $this->messageManager->addSuccess( __('You added product %1 to the comparison list.', $productName) ); $this->_eventManager->dispatch('catalog_product_compare_add_product', array('product'=>$product)); @@ -223,7 +223,7 @@ class Compare extends \Magento\App\Action\Action if ($item->getId()) { $item->delete(); $productName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getName()); - $this->_catalogSession->addSuccess( + $this->messageManager->addSuccess( __('You removed product %1 from the comparison list.', $productName) ); $this->_eventManager->dispatch('catalog_product_compare_remove_product', array('product' => $item)); @@ -255,12 +255,12 @@ class Compare extends \Magento\App\Action\Action try { $items->clear(); - $this->_catalogSession->addSuccess(__('You cleared the comparison list.')); + $this->messageManager->addSuccess(__('You cleared the comparison list.')); $this->_objectManager->get('Magento\Catalog\Helper\Product\Compare')->calculate(); } catch (\Magento\Core\Exception $e) { - $this->_catalogSession->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_catalogSession->addException($e, __('Something went wrong clearing the comparison list.')); + $this->messageManager->addException($e, __('Something went wrong clearing the comparison list.')); } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); diff --git a/app/code/Magento/Catalog/Helper/Data.php b/app/code/Magento/Catalog/Helper/Data.php index 68ee6885eb3..84417376e59 100644 --- a/app/code/Magento/Catalog/Helper/Data.php +++ b/app/code/Magento/Catalog/Helper/Data.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Helper; /** * Catalog data helper - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Helper; - class Data extends \Magento\App\Helper\AbstractHelper { const PRICE_SCOPE_GLOBAL = 0; @@ -73,28 +68,28 @@ class Data extends \Magento\App\Helper\AbstractHelper * * @var int */ - protected $_storeId = null; + protected $_storeId; /** * Core registry * * @var \Magento\Core\Model\Registry */ - protected $_coreRegistry = null; + protected $_coreRegistry; /** * Catalog product * * @var \Magento\Catalog\Helper\Product */ - protected $_catalogProduct = null; + protected $_catalogProduct; /** * Catalog category * * @var \Magento\Catalog\Helper\Category */ - protected $_catalogCategory = null; + protected $_catalogCategory; /** * @var \Magento\Stdlib\String diff --git a/app/code/Magento/Catalog/Helper/Product/ConfigurationPool.php b/app/code/Magento/Catalog/Helper/Product/ConfigurationPool.php index 07f1d384e9e..8053288e32d 100644 --- a/app/code/Magento/Catalog/Helper/Product/ConfigurationPool.php +++ b/app/code/Magento/Catalog/Helper/Product/ConfigurationPool.php @@ -38,9 +38,8 @@ class ConfigurationPool /** * @param \Magento\ObjectManager $objectManager */ - public function __construct( - \Magento\ObjectManager $objectManager - ) { + public function __construct(\Magento\ObjectManager $objectManager) + { $this->_objectManager = $objectManager; } diff --git a/app/code/Magento/Catalog/Helper/Product/Options.php b/app/code/Magento/Catalog/Helper/Product/Options.php index 0520e2ebe72..eb3a35c3c6a 100644 --- a/app/code/Magento/Catalog/Helper/Product/Options.php +++ b/app/code/Magento/Catalog/Helper/Product/Options.php @@ -37,9 +37,9 @@ namespace Magento\Catalog\Helper\Product; class Options extends \Magento\App\Helper\AbstractHelper { /** - * @var \Magento\Filesystem + * @var \Magento\Filesystem\Directory\ReadInterface */ - protected $_filesystem; + protected $directory; /** * @param \Magento\App\Helper\Context $context @@ -48,7 +48,7 @@ class Options extends \Magento\App\Helper\AbstractHelper public function __construct(\Magento\App\Helper\Context $context, \Magento\Filesystem $filesystem) { parent::__construct($context); - $this->_filesystem = $filesystem; + $this->directory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); } /** @@ -76,7 +76,7 @@ class Options extends \Magento\App\Helper\AbstractHelper ->clearBody(); $response->sendHeaders(); - echo $this->_filesystem->read($filePath); + echo $this->directory->readFile($this->directory->getRelativePath($filePath)); } catch (\Exception $e) { return false; } diff --git a/app/code/Magento/Catalog/Helper/Product/View.php b/app/code/Magento/Catalog/Helper/Product/View.php index 76a2a24f779..d2e62c53b90 100644 --- a/app/code/Magento/Catalog/Helper/Product/View.php +++ b/app/code/Magento/Catalog/Helper/Product/View.php @@ -40,11 +40,11 @@ class View extends \Magento\App\Helper\AbstractHelper public $ERR_BAD_CONTROLLER_INTERFACE = 2; /** - * List of catalog product session message models name + * List of catalog product session message groups * * @var array */ - protected $_messageModels; + protected $messageGroups; /** * Core registry @@ -86,6 +86,11 @@ class View extends \Magento\App\Helper\AbstractHelper */ protected $_view; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\App\Helper\Context $context * @param \Magento\Catalog\Model\Session $catalogSession @@ -94,7 +99,8 @@ class View extends \Magento\App\Helper\AbstractHelper * @param \Magento\Theme\Helper\Layout $pageLayout * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\App\ViewInterface $view - * @param array $messageModels + * @param \Magento\Message\ManagerInterface $messageManager + * @param array $messageGroups */ public function __construct( \Magento\App\Helper\Context $context, @@ -104,7 +110,8 @@ class View extends \Magento\App\Helper\AbstractHelper \Magento\Theme\Helper\Layout $pageLayout, \Magento\Core\Model\Registry $coreRegistry, \Magento\App\ViewInterface $view, - array $messageModels = array() + \Magento\Message\ManagerInterface $messageManager, + array $messageGroups = array() ) { $this->_catalogSession = $catalogSession; $this->_catalogDesign = $catalogDesign; @@ -112,8 +119,9 @@ class View extends \Magento\App\Helper\AbstractHelper $this->_pageLayout = $pageLayout; $this->_coreRegistry = $coreRegistry; $this->_view = $view; + $this->messageGroups = $messageGroups; + $this->messageManager = $messageManager; parent::__construct($context); - $this->_messageModels = $messageModels; } /** @@ -216,7 +224,7 @@ class View extends \Magento\App\Helper\AbstractHelper if ($params->getSpecifyOptions()) { $notice = $product->getTypeInstance()->getSpecifyOptionMessage(); - $this->_catalogSession->addNotice($notice); + $this->messageManager->addNotice($notice); } $this->_catalogSession->setLastViewedProductId($product->getId()); @@ -224,9 +232,7 @@ class View extends \Magento\App\Helper\AbstractHelper $this->initProductLayout($product, $controller); if ($controller instanceof \Magento\Catalog\Controller\Product\View\ViewInterface) { - foreach ($this->_messageModels as $sessionModel) { - $this->_view->getLayout()->initMessages($sessionModel); - } + $this->_view->getLayout()->initMessages($this->messageGroups); } else { throw new \Magento\Core\Exception( __('Bad controller interface for showing product'), 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 222c0136f2e..1aaa64a0da5 100644 --- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php @@ -42,11 +42,11 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend protected $_uploaderFactory; /** - * Dir model + * Filesystem facade * - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_dir; + protected $_filesystem; /** * File Uploader factory @@ -59,15 +59,15 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * Construct * * @param \Magento\Logger $logger - * @param \Magento\App\Dir $dir + * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory */ public function __construct( \Magento\Logger $logger, - \Magento\App\Dir $dir, + \Magento\Filesystem $filesystem, \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory ) { - $this->_dir = $dir; + $this->_filesystem = $filesystem; $this->_fileUploaderFactory = $fileUploaderFactory; parent::__construct($logger); } @@ -94,7 +94,7 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend return $this; } - $path = $this->_dir->getDir(\Magento\App\Dir::MEDIA) . DS . 'catalog' . DS . 'category' . DS; + $path = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA)->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 5fbcd68df72..0d317aba925 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -205,6 +205,18 @@ class Product extends \Magento\Catalog\Model\AbstractModel */ protected $_itemOptionFactory; + /** + * @var \Magento\App\State + */ + protected $_appState; + + /** + * Filesystem facade + * + * @var \Magento\Filesystem + */ + protected $_filesystem; + /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -227,6 +239,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 array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -253,6 +266,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, array $data = array() ) { $this->_itemOptionFactory = $itemOptionFactory; @@ -271,6 +285,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel $this->_collectionFactory = $collectionFactory; $this->_urlModel = $url; $this->_linkInstance = $productLink; + $this->_filesystem = $filesystem; parent::__construct($context, $registry, $storeManager, $resource, $resourceCollection, $data); } @@ -1101,6 +1116,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel */ public function getMediaGalleryImages() { + $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); if(!$this->hasData('media_gallery_images') && is_array($this->getMediaGallery('images'))) { $images = $this->_collectionFactory->create(); foreach ($this->getMediaGallery('images') as $image) { @@ -1109,7 +1125,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel } $image['url'] = $this->getMediaConfig()->getMediaUrl($image['file']); $image['id'] = isset($image['value_id']) ? $image['value_id'] : null; - $image['path'] = $this->getMediaConfig()->getMediaPath($image['file']); + $image['path'] = $directory->getAbsolutePath($this->getMediaConfig()->getMediaPath($image['file'])); $images->addItem(new \Magento\Object($image)); } $this->setData('media_gallery_images', $images); 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 2a3f327cfd7..37aade372f5 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php @@ -50,19 +50,9 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend protected $_mediaConfig; /** - * @var \Magento\Filesystem $filesystem + * @var \Magento\Filesystem\Directory\WriteInterface */ - protected $_filesystem; - - /** - * @var string - */ - protected $_baseMediaPath; - - /** - * @var string - */ - protected $_baseTmpMediaPath; + protected $_mediaDirectory; /** * Core data @@ -101,7 +91,6 @@ 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\App\Dir $dirs * @param \Magento\Filesystem $filesystem * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media $resourceProductAttribute */ @@ -112,7 +101,6 @@ 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\App\Dir $dirs, \Magento\Filesystem $filesystem, \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media $resourceProductAttribute ) { @@ -122,13 +110,10 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $this->_coreData = $coreData; $this->_resourceModel = $resourceProductAttribute; $this->_mediaConfig = $mediaConfig; - $this->_filesystem = $filesystem; - $this->_filesystem->setIsAllowCreateDirectories(true); - $this->_filesystem->setWorkingDirectory($dirs->getDir(\Magento\App\Dir::MEDIA)); - $this->_baseMediaPath = $this->_mediaConfig->getBaseMediaPath(); - $this->_baseTmpMediaPath = $this->_mediaConfig->getBaseTmpMediaPath(); - $this->_filesystem->ensureDirectoryExists($this->_baseMediaPath); - $this->_filesystem->ensureDirectoryExists($this->_baseTmpMediaPath); + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + + $this->_mediaDirectory->create($this->_mediaConfig->getBaseMediaPath()); + $this->_mediaDirectory->create($this->_mediaConfig->getBaseTmpMediaPath()); parent::__construct($logger); } @@ -361,11 +346,13 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * @param boolean $move if true, it will move source file * @param boolean $exclude mark image as disabled in product page view * @return string + * @throws \Magento\Core\Exception */ public function addImage(\Magento\Catalog\Model\Product $product, $file, $mediaAttribute = null, $move = false, $exclude = true ) { - if (!$this->_filesystem->isFile($file, $this->_baseTmpMediaPath)) { + $file = $this->_mediaDirectory->getRelativePath($file); + if (!$this->_mediaDirectory->isFile($file)) { throw new \Magento\Core\Exception(__('The image does not exist.')); } @@ -377,7 +364,7 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $fileName = \Magento\Core\Model\File\Uploader::getCorrectFileName($pathinfo['basename']); $dispretionPath = \Magento\Core\Model\File\Uploader::getDispretionPath($fileName); - $fileName = $dispretionPath . DS . $fileName; + $fileName = $dispretionPath . '/' . $fileName; $fileName = $this->_getNotDuplicatedFilename($fileName, $dispretionPath); @@ -387,15 +374,15 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** @var $storageHelper \Magento\Core\Helper\File\Storage\Database */ $storageHelper = $this->_fileStorageDb; if ($move) { - $this->_filesystem->rename($file, $destinationFile, $this->_baseTmpMediaPath); + $this->_mediaDirectory->renameFile($file, $destinationFile); //If this is used, filesystem should be configured properly $storageHelper->saveFile($this->_mediaConfig->getTmpMediaShortUrl($fileName)); } else { - $this->_filesystem->copy($file, $destinationFile, $this->_baseTmpMediaPath); + $this->_mediaDirectory->copyFile($file, $destinationFile); $storageHelper->saveFile($this->_mediaConfig->getTmpMediaShortUrl($fileName)); - $this->_filesystem->changePermissions($destinationFile, 0777, false, $this->_baseTmpMediaPath); + $this->_mediaDirectory->changePermissions($destinationFile, 0777); } } catch (\Exception $e) { throw new \Magento\Core\Exception( @@ -403,7 +390,7 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend ); } - $fileName = str_replace(DS, '/', $fileName); + $fileName = str_replace('\\', '/', $fileName); $attrCode = $this->getAttribute()->getAttributeCode(); $mediaGalleryData = $product->getData($attrCode); @@ -645,18 +632,16 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $this->_mediaConfig->getMediaShortUrl($destinationFile) ); - $this->_filesystem->delete($this->_mediaConfig->getTmpMediaPath($file), $this->_baseTmpMediaPath); - $this->_filesystem->delete($this->_mediaConfig->getMediaPath($destinationFile), $this->_baseMediaPath); + $this->_mediaDirectory->delete($this->_mediaConfig->getTmpMediaPath($file)); + $this->_mediaDirectory->delete($this->_mediaConfig->getMediaPath($destinationFile)); } else { - $this->_filesystem->rename( + $this->_mediaDirectory->renameFile( $this->_mediaConfig->getTmpMediaPath($file), - $this->_mediaConfig->getMediaPath($destinationFile), - $this->_baseTmpMediaPath, - $this->_baseMediaPath + $this->_mediaConfig->getMediaPath($destinationFile) ); } - return str_replace(DS, '/', $destinationFile); + return str_replace('\\', '/', $destinationFile); } /** @@ -668,14 +653,12 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend protected function _getUniqueFileName($file) { if ($this->_fileStorageDb->checkDbUsage()) { - $destFile = $this->_fileStorageDb - ->getUniqueFilename( - $this->_mediaConfig->getBaseMediaUrlAddition(), - $file - ); + $destFile = $this->_fileStorageDb->getUniqueFilename($this->_mediaConfig->getBaseMediaUrlAddition(), $file); } else { - $destFile = dirname($file) . DS - . \Magento\Core\Model\File\Uploader::getNewFileName($this->_mediaConfig->getMediaPath($file)); + $destFile = dirname($file) . '/' + . \Magento\Core\Model\File\Uploader::getNewFileName( + $this->_mediaDirectory->getAbsolutePath($this->_mediaConfig->getMediaPath($file)) + ); } return $destFile; @@ -692,25 +675,24 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend try { $destinationFile = $this->_getUniqueFileName($file); - if (!$this->_filesystem->isFile($this->_mediaConfig->getMediaPath($file), $this->_baseMediaPath)) { + if (!$this->_mediaDirectory->isFile($this->_mediaConfig->getMediaPath($file))) { throw new \Exception(); } if ($this->_fileStorageDb->checkDbUsage()) { - $this->_fileStorageDb - ->copyFile($this->_mediaConfig->getMediaShortUrl($file), - $this->_mediaConfig->getMediaShortUrl($destinationFile)); - - $this->_filesystem->delete($this->_mediaConfig->getMediaPath($destinationFile), $this->_baseMediaPath); + $this->_fileStorageDb->copyFile( + $this->_mediaDirectory->getAbsolutePath($this->_mediaConfig->getMediaShortUrl($file)), + $this->_mediaConfig->getMediaShortUrl($destinationFile) + ); + $this->_mediaDirectory->delete($this->_mediaConfig->getMediaPath($destinationFile)); } else { - $this->_filesystem->copy( + $this->_mediaDirectory->copyFile( $this->_mediaConfig->getMediaPath($file), - $this->_mediaConfig->getMediaPath($destinationFile), - $this->_baseMediaPath + $this->_mediaConfig->getMediaPath($destinationFile) ); } - return str_replace(DS, '/', $destinationFile); + return str_replace('\\', '/', $destinationFile); } catch (\Exception $e) { $file = $this->_mediaConfig->getMediaPath($file); throw new \Magento\Core\Exception( @@ -747,9 +729,9 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */ protected function _getNotDuplicatedFilename($fileName, $dispretionPath) { - $fileMediaName = $dispretionPath . DS + $fileMediaName = $dispretionPath . '/' . \Magento\Core\Model\File\Uploader::getNewFileName($this->_mediaConfig->getMediaPath($fileName)); - $fileTmpMediaName = $dispretionPath . DS + $fileTmpMediaName = $dispretionPath . '/' . \Magento\Core\Model\File\Uploader::getNewFileName($this->_mediaConfig->getTmpMediaPath($fileName)); if ($fileMediaName != $fileTmpMediaName) { diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 672b074bf35..4f3c7bf86c2 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -33,6 +33,8 @@ */ namespace Magento\Catalog\Model\Product; +use Magento\Core\Model\Store; + class Image extends \Magento\Core\Model\AbstractModel { protected $_width; @@ -59,9 +61,9 @@ class Image extends \Magento\Core\Model\AbstractModel protected $_watermarkImageOpacity = 70; /** - * @var \Magento\Filesystem $filesystem + * @var \Magento\Filesystem\Directory\WriteInterface */ - protected $_filesystem; + protected $_mediaDirectory; /** * @var \Magento\Image\Factory @@ -99,13 +101,6 @@ class Image extends \Magento\Core\Model\AbstractModel */ protected $_catalogProductMediaConfig; - /** - * Dir - * - * @var \Magento\App\Dir - */ - protected $_dir; - /** * Store manager * @@ -117,7 +112,6 @@ class Image extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\Dir $dir * @param \Magento\Catalog\Model\Product\Media\Config $catalogProductMediaConfig * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase * @param \Magento\Filesystem $filesystem @@ -133,7 +127,6 @@ class Image extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\Dir $dir, \Magento\Catalog\Model\Product\Media\Config $catalogProductMediaConfig, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, \Magento\Filesystem $filesystem, @@ -146,16 +139,11 @@ class Image extends \Magento\Core\Model\AbstractModel array $data = array() ) { $this->_storeManager = $storeManager; - $this->_dir = $dir; $this->_catalogProductMediaConfig = $catalogProductMediaConfig; $this->_coreFileStorageDatabase = $coreFileStorageDatabase; parent::__construct($context, $registry, $resource, $resourceCollection, $data); - $baseDir = $this->_catalogProductMediaConfig->getBaseMediaPath(); - $this->_filesystem = $filesystem; - $this->_filesystem->setIsAllowCreateDirectories(true); - $this->_filesystem->ensureDirectoryExists($baseDir); - $this->_filesystem->setIsAllowCreateDirectories(false); - $this->_filesystem->setWorkingDirectory($baseDir); + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_mediaDirectory->create($this->_catalogProductMediaConfig->getBaseMediaPath()); $this->_imageFactory = $imageFactory; $this->_viewUrl = $viewUrl; $this->_viewFileSystem = $viewFileSystem; @@ -319,11 +307,11 @@ class Image extends \Magento\Core\Model\AbstractModel return 0; } - if (!$this->_filesystem->isFile($file)) { + if (!$this->_mediaDirectory->isExist($file)) { return 0; } - $imageInfo = getimagesize($file); + $imageInfo = getimagesize($this->_mediaDirectory->getAbsolutePath($file)); if (!isset($imageInfo[0]) || !isset($imageInfo[1])) { return 0; @@ -400,7 +388,7 @@ class Image extends \Magento\Core\Model\AbstractModel $baseFile = $baseDir . $file; - if (!$file || !$this->_filesystem->isFile($baseFile)) { + if (!$file || !$this->_mediaDirectory->isFile($baseFile)) { throw new \Exception(__('We can\'t find the image file.')); } @@ -470,7 +458,8 @@ class Image extends \Magento\Core\Model\AbstractModel public function getImageProcessor() { if (!$this->_processor) { - $this->_processor = $this->_imageFactory->create($this->getBaseFile()); + $filename = $this->getBaseFile() ? $this->_mediaDirectory->getAbsolutePath($this->getBaseFile()) : null; + $this->_processor = $this->_imageFactory->create($filename); } $this->_processor->keepAspectRatio($this->_keepAspectRatio); $this->_processor->keepFrame($this->_keepFrame); @@ -579,7 +568,7 @@ class Image extends \Magento\Core\Model\AbstractModel if ($this->_isBaseFilePlaceholder && $this->_newFile === true) { return $this; } - $filename = $this->getNewFile(); + $filename = $this->_mediaDirectory->getAbsolutePath($this->getNewFile()); $this->getImageProcessor()->save($filename); $this->_coreFileStorageDatabase->saveFile($filename); return $this; @@ -595,9 +584,7 @@ class Image extends \Magento\Core\Model\AbstractModel "Magento_Catalog::images/product/placeholder/{$this->getDestinationSubdir()}.jpg" ); } else { - $baseDir = $this->_dir->getDir(\Magento\App\Dir::MEDIA); - $path = str_replace($baseDir . DS, "", $this->_newFile); - $url = $this->_storeManager->getStore()->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_MEDIA) . str_replace(DS, '/', $path);; + $url = $this->_storeManager->getStore()->getBaseUrl(Store::URL_TYPE_MEDIA) . $this->_newFile; } return $url; @@ -662,20 +649,23 @@ class Image extends \Magento\Core\Model\AbstractModel if (!$file = $this->getWatermarkFile()) { return $filePath; } - $baseDir = $this->_catalogProductMediaConfig->getBaseMediaPath(); - if ($this->_fileExists($baseDir . '/watermark/stores/' . $this->_storeManager->getStore()->getId() . $file)) { - $filePath = $baseDir . '/watermark/stores/' . $this->_storeManager->getStore()->getId() . $file; - } elseif ($this->_fileExists($baseDir . '/watermark/websites/' . $this->_storeManager->getWebsite()->getId() . $file)) { - $filePath = $baseDir . '/watermark/websites/' . $this->_storeManager->getWebsite()->getId() . $file; - } elseif ($this->_fileExists($baseDir . '/watermark/default/' . $file)) { - $filePath = $baseDir . '/watermark/default/' . $file; - } elseif ($this->_fileExists($baseDir . '/watermark/' . $file)) { - $filePath = $baseDir . '/watermark/' . $file; - } else { + $candidates = array( + $baseDir . '/watermark/stores/' . $this->_storeManager->getStore()->getId() . $file, + $baseDir . '/watermark/websites/' . $this->_storeManager->getWebsite()->getId() . $file, + $baseDir . '/watermark/default/' . $file, + $baseDir . '/watermark/' . $file + ); + foreach ($candidates as $candidate) { + if ($this->_mediaDirectory->isExist($candidate)) { + $filePath = $this->_mediaDirectory->getAbsolutePath($candidate); + break; + } + } + if (!$filePath) { $viewFile = $this->_viewFileSystem->getViewFile($file); - if ($this->_filesystem->isFile($viewFile)) { + if ($this->_mediaDirectory->isFile($this->_mediaDirectory->getRelativePath($viewFile))) { $filePath = $viewFile; } } @@ -788,11 +778,10 @@ class Image extends \Magento\Core\Model\AbstractModel public function clearCache() { - $directory = $this->_dir->getDir(\Magento\App\Dir::MEDIA) . DS . 'catalog' . DS . 'product' - . DS . 'cache' . DS; - $this->_filesystem->delete($directory); + $directory = $this->_catalogProductMediaConfig->getBaseMediaPath() . '/cache'; + $this->_mediaDirectory->delete($directory); - $this->_coreFileStorageDatabase->deleteFolder($directory); + $this->_coreFileStorageDatabase->deleteFolder($this->_mediaDirectory->getAbsolutePath($directory)); } /** @@ -804,10 +793,12 @@ class Image extends \Magento\Core\Model\AbstractModel */ protected function _fileExists($filename) { - if ($this->_filesystem->isFile($filename)) { + if ($this->_mediaDirectory->isFile($filename)) { return true; } else { - return $this->_coreFileStorageDatabase->saveFileToFilesystem($filename); + return $this->_coreFileStorageDatabase->saveFileToFilesystem( + $this->_mediaDirectory->getAbsolutePath($filename) + ); } } } diff --git a/app/code/Magento/Catalog/Model/Product/Media/Config.php b/app/code/Magento/Catalog/Model/Product/Media/Config.php index 8f5690c6c86..f25b60b1dbf 100644 --- a/app/code/Magento/Catalog/Model/Product/Media/Config.php +++ b/app/code/Magento/Catalog/Model/Product/Media/Config.php @@ -36,32 +36,18 @@ namespace Magento\Catalog\Model\Product\Media; class Config implements ConfigInterface { - /** - * Dir - * - * @var \Magento\App\Dir - */ - protected $_dir; - /** * Store manager * * @var \Magento\Core\Model\StoreManagerInterface */ - protected $_storeManager; + protected $storeManager; /** - * Construct - * * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\Dir $dir */ - public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\Dir $dir - ) { - $this->_storeManager = $storeManager; - $this->_dir = $dir; + public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager) { + $this->storeManager = $storeManager; } /** @@ -72,7 +58,7 @@ class Config implements ConfigInterface */ public function getBaseMediaPathAddition() { - return 'catalog' . DIRECTORY_SEPARATOR . 'product'; + return 'catalog/product'; } /** @@ -87,135 +73,107 @@ class Config implements ConfigInterface } /** - * Filesystem directory path of temporary product images - * relatively to media folder - * * @return string */ - public function getBaseTmpMediaPathAddition() + public function getBaseMediaPath() { - return 'tmp' . DIRECTORY_SEPARATOR . $this->getBaseMediaPathAddition(); + return 'catalog/product'; } /** - * Web-based directory path of temporary product images - * relatively to media folder - * * @return string */ - public function getBaseTmpMediaUrlAddition() - { - return 'tmp/' . $this->getBaseMediaUrlAddition(); - } - - public function getBaseMediaPath() - { - return $this->_dir->getDir(\Magento\App\Dir::MEDIA) . DIRECTORY_SEPARATOR - . 'catalog' . DIRECTORY_SEPARATOR . 'product'; - } - public function getBaseMediaUrl() { - return $this->_storeManager->getStore() + return $this->storeManager->getStore() ->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_MEDIA) . 'catalog/product'; } + /** + * Filesystem directory path of temporary product images + * relatively to media folder + * + * @return string + */ public function getBaseTmpMediaPath() { - return $this->_dir->getDir(\Magento\App\Dir::MEDIA) . DIRECTORY_SEPARATOR - . $this->getBaseTmpMediaPathAddition(); + return 'tmp/' . $this->getBaseMediaPathAddition(); } + /** + * @return string + */ public function getBaseTmpMediaUrl() { - return $this->_storeManager->getStore() - ->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_MEDIA) . $this->getBaseTmpMediaUrlAddition(); + return $this->storeManager->getStore() + ->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_MEDIA) . 'tmp/' . $this->getBaseMediaUrlAddition(); } + /** + * @param string $file + * @return string + */ public function getMediaUrl($file) { - $file = $this->_prepareFileForUrl($file); - - if(substr($file, 0, 1) == '/') { - return $this->getBaseMediaUrl() . $file; - } - - return $this->getBaseMediaUrl() . '/' . $file; + return $this->getBaseMediaUrl() . '/' . $this->_prepareFile($file); } + /** + * @param string $file + * @return string + */ public function getMediaPath($file) { - $file = $this->_prepareFileForPath($file); - - if(substr($file, 0, 1) == DIRECTORY_SEPARATOR) { - return $this->getBaseMediaPath() . DIRECTORY_SEPARATOR . substr($file, 1); - } - - return $this->getBaseMediaPath() . DIRECTORY_SEPARATOR . $file; + return $this->getBaseMediaPath() . '/' . $this->_prepareFile($file); } + /** + * @param $file + * @return string + */ public function getTmpMediaUrl($file) { - $file = $this->_prepareFileForUrl($file); - - if(substr($file, 0, 1) == '/') { - $file = substr($file, 1); - } - - return $this->getBaseTmpMediaUrl() . '/' . $file; + return $this->getBaseTmpMediaUrl() . '/' . $this->_prepareFile($file); } /** * Part of URL of temporary product images * relatively to media folder * + * @param string $file * @return string */ public function getTmpMediaShortUrl($file) { - $file = $this->_prepareFileForUrl($file); - - if(substr($file, 0, 1) == '/') { - $file = substr($file, 1); - } - - return $this->getBaseTmpMediaUrlAddition() . '/' . $file; + return 'tmp/' . $this->getBaseMediaUrlAddition() . '/' . $this->_prepareFile($file); } /** * Part of URL of product images relatively to media folder * + * @param string $file * @return string */ public function getMediaShortUrl($file) { - $file = $this->_prepareFileForUrl($file); - - if(substr($file, 0, 1) == '/') { - $file = substr($file, 1); - } - - return $this->getBaseMediaUrlAddition() . '/' . $file; + return $this->getBaseMediaUrlAddition() . '/' . $this->_prepareFile($file); } + /** + * @param $file + * @return string + */ public function getTmpMediaPath($file) { - $file = $this->_prepareFileForPath($file); - - if(substr($file, 0, 1) == DIRECTORY_SEPARATOR) { - return $this->getBaseTmpMediaPath() . DIRECTORY_SEPARATOR . substr($file, 1); - } - - return $this->getBaseTmpMediaPath() . DIRECTORY_SEPARATOR . $file; - } - - protected function _prepareFileForUrl($file) - { - return str_replace(DIRECTORY_SEPARATOR, '/', $file); + return $this->getBaseTmpMediaPath() . '/' . $this->_prepareFile($file); } - protected function _prepareFileForPath($file) + /** + * @param $file + * @return string + */ + protected function _prepareFile($file) { - return str_replace('/', DIRECTORY_SEPARATOR, $file); + return ltrim(str_replace('\\', '/', $file), '/'); } } 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 c9fcc3e8d55..7201ee094e1 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -51,6 +51,37 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ protected $_filesystem; + /** + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $_rootDirectory; + + /** + * @var \Magento\Filesystem\Directory\WriteInterface + */ + protected $_mediaDirectory; + + /** + * Relative path for main destination folder + * + * @var string + */ + protected $_path = '/custom_options'; + + /** + * Relative path for quote folder + * + * @var string + */ + protected $_quotePath = '/custom_options/quote'; + + /** + * Relative path for order folder + * + * @var string + */ + protected $_orderPath = '/custom_options/order'; + /** * @var \Magento\File\Size */ @@ -68,13 +99,6 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ protected $_escaper; - /** - * Dir - * - * @var \Magento\App\Dir - */ - protected $_dir; - /** * Url * @@ -94,7 +118,6 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Sales\Model\Quote\Item\OptionFactory $itemOptionFactory * @param \Magento\UrlInterface $url - * @param \Magento\App\Dir $dir * @param \Magento\Escaper $escaper * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase * @param \Magento\Filesystem $filesystem @@ -106,7 +129,6 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Sales\Model\Quote\Item\OptionFactory $itemOptionFactory, \Magento\UrlInterface $url, - \Magento\App\Dir $dir, \Magento\Escaper $escaper, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, \Magento\Filesystem $filesystem, @@ -115,10 +137,11 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType ) { $this->_itemOptionFactory = $itemOptionFactory; $this->_url = $url; - $this->_dir = $dir; $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->_fileSize = $fileSize; $this->_data = $data; parent::__construct($checkoutSession, $coreStoreConfig, $data); @@ -348,10 +371,11 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType $dispersion = \Magento\Core\Model\File\Uploader::getDispretionPath($fileName); $filePath = $dispersion; - $dirName = dirname($fileInfo['tmp_name']); - $fileHash = md5($this->_filesystem->read($fileInfo['tmp_name'], $dirName)); - $filePath .= DS . $fileHash . '.' . $extension; - $fileFullPath = $this->getQuoteTargetDir() . $filePath; + + $tmpDirectory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::SYS_TMP); + $fileHash = md5($tmpDirectory->readFile($tmpDirectory->getRelativePath($fileInfo['tmp_name']))); + $filePath .= '/' . $fileHash . '.' . $extension; + $fileFullPath = $this->_mediaDirectory->getAbsolutePath($this->_quotePath . $filePath); $upload->addFilter('Rename', array( 'target' => $fileFullPath, @@ -368,19 +392,20 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType $_width = 0; $_height = 0; - if ($this->_filesystem->isReadable($fileInfo['tmp_name'], $dirName)) { + + if ($tmpDirectory->isReadable($tmpDirectory->getRelativePath($fileInfo['tmp_name']))) { $_imageSize = getimagesize($fileInfo['tmp_name']); if ($_imageSize) { $_width = $_imageSize[0]; $_height = $_imageSize[1]; } } - + $uri = $this->_filesystem->getUri(\Magento\Filesystem::MEDIA); $this->setUserValue(array( 'type' => $fileInfo['type'], 'title' => $fileInfo['name'], - 'quote_path' => $this->getQuoteTargetDir(true) . $filePath, - 'order_path' => $this->getOrderTargetDir(true) . $filePath, + 'quote_path' => $uri . $this->_quotePath . $filePath, + 'order_path' => $uri . $this->_orderPath . $filePath, 'fullpath' => $fileFullPath, 'size' => $fileInfo['size'], 'width' => $_width, @@ -420,20 +445,21 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ $checkPaths = array(); if (isset($optionValue['quote_path'])) { - $checkPaths[] = $this->_dir->getDir() . $optionValue['quote_path']; + $checkPaths[] = $optionValue['quote_path']; } if (isset($optionValue['order_path']) && !$this->getUseQuotePath()) { - $checkPaths[] = $this->_dir->getDir() . $optionValue['order_path']; + $checkPaths[] = $optionValue['order_path']; } - $fileFullPath = null; + $fileRelativePath = null; foreach ($checkPaths as $path) { - if (!$this->_filesystem->isFile($path)) { + if (!$this->_rootDirectory->isFile($path)) { if (!$this->_coreFileStorageDatabase->saveFileToFilesystem($fileFullPath)) { continue; } } - $fileFullPath = $path; + $fileFullPath = $this->_rootDirectory->getAbsolutePath($path); + $fileRelativePath = $path; break; } @@ -479,9 +505,9 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType if ($validatorChain->isValid($fileFullPath)) { - $ok = $this->_filesystem->isReadable($fileFullPath) + $ok = $this->_rootDirectory->isReadable($fileRelativePath) && isset($optionValue['secret_key']) - && substr(md5($this->_filesystem->read($fileFullPath)), 0, 20) == $optionValue['secret_key']; + && substr(md5($this->_rootDirectory->readFile($fileRelativePath)), 0, 20) == $optionValue['secret_key']; return $ok; } elseif ($validatorChain->getErrors()) { @@ -732,57 +758,23 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType if (!isset($value['quote_path'])) { throw new \Exception(); } - $quoteFileFullPath = $this->_dir->getDir() . $value['quote_path']; - if (!$this->_filesystem->isFile($quoteFileFullPath) - || !$this->_filesystem->isReadable($quoteFileFullPath) - ) { + $quotePath = $value['quote_path']; + $orderPath = $value['order_path']; + + if (!$this->_rootDirectory->isFile($quotePath) || !$this->_rootDirectory->isReadable($quotePath)) { throw new \Exception(); } - $orderFileFullPath = $this->_dir->getDir() . $value['order_path']; - $dir = pathinfo($orderFileFullPath, PATHINFO_DIRNAME); - $this->_createWritableDir($dir); - $this->_coreFileStorageDatabase->copyFile($quoteFileFullPath, $orderFileFullPath); - $this->_filesystem->copy($quoteFileFullPath, $orderFileFullPath); + $this->_coreFileStorageDatabase->copyFile( + $this->_rootDirectory->getAbsolutePath($quotePath), + $this->_rootDirectory->getAbsolutePath($orderPath) + ); + $this->_rootDirectory->copyFile($quotePath, $orderPath); } catch (\Exception $e) { return $this; } return $this; } - /** - * Main Destination directory - * - * @param boolean $relative If true - returns relative path to the webroot - * @return string - */ - public function getTargetDir($relative = false) - { - $fullPath = $this->_dir->getDir(\Magento\App\Dir::MEDIA) . DS . 'custom_options'; - return $relative ? str_replace($this->_dir->getDir(), '', $fullPath) : $fullPath; - } - - /** - * Quote items destination directory - * - * @param boolean $relative If true - returns relative path to the webroot - * @return string - */ - public function getQuoteTargetDir($relative = false) - { - return $this->getTargetDir($relative) . DS . 'quote'; - } - - /** - * Order items destination directory - * - * @param boolean $relative If true - returns relative path to the webroot - * @return string - */ - public function getOrderTargetDir($relative = false) - { - return $this->getTargetDir($relative) . DS . 'order'; - } - /** * Set url to custom option download controller * @@ -800,34 +792,14 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ protected function _initFilesystem() { - $this->_createWritableDir($this->getTargetDir()); - $this->_createWritableDir($this->getQuoteTargetDir()); - $this->_createWritableDir($this->getOrderTargetDir()); + $this->_mediaDirectory->create($this->_path); + $this->_mediaDirectory->create($this->_quotePath); + $this->_mediaDirectory->create($this->_orderPath); // Directory listing and hotlink secure - if (!$this->_filesystem->isFile($this->getTargetDir() . DS . '.htaccess')) { - $stream = $this->_filesystem->createStream($this->getTargetDir() . DS . '.htaccess'); - $stream->open('w+'); - $stream->write("Order deny,allow\nDeny from all"); - $stream->close(); - } - } - - /** - * Create Writable directory if it doesn't exist - * - * @param string Absolute directory path - * @return void - * @throws \Magento\Core\Exception - */ - protected function _createWritableDir($path) - { - try { - if (!$this->_filesystem->isWritable($path)) { - $this->_filesystem->createDirectory($path, 0777); - } - } catch (\Magento\Filesystem\Exception $e) { - throw new \Magento\Core\Exception(__("Cannot create writable directory '%1'.", $path)); + $path = $this->_path . '/.htaccess'; + if (!$this->_mediaDirectory->isFile($path)) { + $this->_mediaDirectory->writeFile($path, "Order deny,allow\nDeny from all"); } } @@ -872,7 +844,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType } // File path came in - check the physical file - if (!$this->_filesystem->isReadable($fileInfo)) { + if (!$this->_rootDirectory->isReadable($this->_rootDirectory->getRelativePath($fileInfo))) { return false; } $imageInfo = getimagesize($fileInfo); diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index 2e8eaa7711a..e61902ac18c 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -505,7 +505,7 @@ abstract class AbstractType $path = dirname($dst); try { - $this->_filesystem->createDirectory($path, 0777); + $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT)->create($path); } catch (\Magento\Filesystem\Exception $e) { throw new \Magento\Core\Exception( __("We can't create writeable directory \"%1\".", $path) @@ -525,12 +525,6 @@ abstract class AbstractType } $this->_fileStorageDb->saveFile($dst); break; - case 'move_uploaded_file': - $src = $queueOptions['src_name']; - $dst = $queueOptions['dst_name']; - move_uploaded_file($src, $dst); - $this->_fileStorageDb->saveFile($dst); - break; default: break; } diff --git a/app/code/Magento/Catalog/Model/ProductOptions/Config/SchemaLocator.php b/app/code/Magento/Catalog/Model/ProductOptions/Config/SchemaLocator.php index fe7fae5ce51..240458249c1 100644 --- a/app/code/Magento/Catalog/Model/ProductOptions/Config/SchemaLocator.php +++ b/app/code/Magento/Catalog/Model/ProductOptions/Config/SchemaLocator.php @@ -45,8 +45,8 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $etcDir = $moduleReader->getModuleDir('etc', 'Magento_Catalog'); - $this->_schema = $etcDir . DIRECTORY_SEPARATOR . 'product_options_merged.xsd'; - $this->_perFileSchema = $etcDir . DIRECTORY_SEPARATOR . 'product_options.xsd'; + $this->_schema = $etcDir . '/product_options_merged.xsd'; + $this->_perFileSchema = $etcDir . '/product_options.xsd'; } /** diff --git a/app/code/Magento/Catalog/Model/ProductTypes/Config/SchemaLocator.php b/app/code/Magento/Catalog/Model/ProductTypes/Config/SchemaLocator.php index 71e831d56a3..35052773eab 100644 --- a/app/code/Magento/Catalog/Model/ProductTypes/Config/SchemaLocator.php +++ b/app/code/Magento/Catalog/Model/ProductTypes/Config/SchemaLocator.php @@ -45,8 +45,8 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $etcDir = $moduleReader->getModuleDir('etc', 'Magento_Catalog'); - $this->_schema = $etcDir . DIRECTORY_SEPARATOR . 'product_types_merged.xsd'; - $this->_perFileSchema = $etcDir . DIRECTORY_SEPARATOR . 'product_types.xsd'; + $this->_schema = $etcDir . '/product_types_merged.xsd'; + $this->_perFileSchema = $etcDir . '/product_types.xsd'; } /** diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Indexer/Product.php b/app/code/Magento/Catalog/Model/Resource/Category/Indexer/Product.php index 54a7572a873..582ec278909 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Indexer/Product.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Indexer/Product.php @@ -417,8 +417,8 @@ class Product extends \Magento\Index\Model\Resource\AbstractResource . " AND sv.store_id = " . (int)$storeId, array()) ->join( - array('ds' => $statusInfo['table']), - "ds.entity_id = pw.product_id AND ds.attribute_id = {$statusInfo['id']} AND ds.store_id = 0", + array('dss' => $statusInfo['table']), + "dss.entity_id = pw.product_id AND dss.attribute_id = {$statusInfo['id']} AND dss.store_id = 0", array()) ->joinLeft( array('ss' => $statusInfo['table']), @@ -428,7 +428,7 @@ class Product extends \Magento\Index\Model\Resource\AbstractResource ->where('i.product_id IS NULL') ->where('pw.website_id=?', $websiteId) ->where( - $this->_getWriteAdapter()->getCheckSql('ss.value_id IS NOT NULL', 'ss.value', 'ds.value') . ' = ?', + $this->_getWriteAdapter()->getCheckSql('ss.value_id IS NOT NULL', 'ss.value', 'dss.value') . ' = ?', \Magento\Catalog\Model\Product\Status::STATUS_ENABLED) ->columns(array( 'category_id' => new \Zend_Db_Expr($rootId), @@ -501,8 +501,8 @@ class Product extends \Magento\Index\Model\Resource\AbstractResource )) ) ->joinLeft( - array('ds'=>$statusInfo['table']), - "ds.entity_id=cp.product_id AND ds.attribute_id={$statusInfo['id']} AND ds.store_id=0", + array('dss'=>$statusInfo['table']), + "dss.entity_id=cp.product_id AND dss.attribute_id={$statusInfo['id']} AND dss.store_id=0", array()) ->joinLeft( array('ss'=>$statusInfo['table']), @@ -511,7 +511,7 @@ class Product extends \Magento\Index\Model\Resource\AbstractResource ->where( $adapter->getCheckSql('ss.value_id IS NOT NULL', $adapter->quoteIdentifier('ss.value'), - $adapter->quoteIdentifier('ds.value') + $adapter->quoteIdentifier('dss.value') ) . ' = ?', \Magento\Catalog\Model\Product\Status::STATUS_ENABLED ); @@ -600,8 +600,8 @@ class Product extends \Magento\Index\Model\Resource\AbstractResource )) ) ->joinLeft( - array('ds'=>$statusInfo['table']), - "ds.entity_id=pw.product_id AND ds.attribute_id={$statusInfo['id']} AND ds.store_id=0", + array('dss'=>$statusInfo['table']), + "dss.entity_id=pw.product_id AND dss.attribute_id={$statusInfo['id']} AND dss.store_id=0", array()) ->joinLeft( array('ss'=>$statusInfo['table']), @@ -618,7 +618,7 @@ class Product extends \Magento\Index\Model\Resource\AbstractResource $adapter->quoteIdentifier('dca.value')) . '=1) OR ce.entity_id=rc.entity_id' ) ->where( - $adapter->getCheckSql('ss.value_id IS NOT NULL', 'ss.value', 'ds.value') . '=?', + $adapter->getCheckSql('ss.value_id IS NOT NULL', 'ss.value', 'dss.value') . '=?', \Magento\Catalog\Model\Product\Status::STATUS_ENABLED ) ->group(array('ce.entity_id', 'cp.product_id', 's.store_id')); @@ -672,8 +672,8 @@ class Product extends \Magento\Index\Model\Resource\AbstractResource )) ) ->joinLeft( - array('ds'=>$statusInfo['table']), - "ds.entity_id=pw.product_id AND ds.attribute_id={$statusInfo['id']} AND ds.store_id=0", + array('dss'=>$statusInfo['table']), + "dss.entity_id=pw.product_id AND dss.attribute_id={$statusInfo['id']} AND dss.store_id=0", array()) ->joinLeft( array('ss'=>$statusInfo['table']), @@ -686,7 +686,7 @@ class Product extends \Magento\Index\Model\Resource\AbstractResource ->where( $adapter->getCheckSql('ss.value_id IS NOT NULL', $adapter->quoteIdentifier('ss.value'), - $adapter->quoteIdentifier('ds.value') + $adapter->quoteIdentifier('dss.value') ) . ' = ?', \Magento\Catalog\Model\Product\Status::STATUS_ENABLED) ->where('pw.product_id IN(?)', $productIds); @@ -710,8 +710,8 @@ class Product extends \Magento\Index\Model\Resource\AbstractResource . " AND sv.store_id = s.store_id", array()) ->join( - array('ds' => $statusInfo['table']), - "ds.entity_id = pw.product_id AND ds.attribute_id = {$statusInfo['id']} AND ds.store_id = 0", + array('dss' => $statusInfo['table']), + "dss.entity_id = pw.product_id AND dss.attribute_id = {$statusInfo['id']} AND dss.store_id = 0", array()) ->joinLeft( array('ss' => $statusInfo['table']), @@ -719,7 +719,7 @@ class Product extends \Magento\Index\Model\Resource\AbstractResource array()) ->where('i.product_id IS NULL') ->where( - $adapter->getCheckSql('ss.value_id IS NOT NULL', 'ss.value', 'ds.value') . '=?', + $adapter->getCheckSql('ss.value_id IS NOT NULL', 'ss.value', 'dss.value') . '=?', \Magento\Catalog\Model\Product\Status::STATUS_ENABLED) ->where('pw.product_id IN(?)', $productIds) ->columns(array( 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 4da0fb68e36..05fef669c70 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 @@ -38,11 +38,11 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend { /** - * Dir model + * Filesystem facade * - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_dir; + protected $_filesystem; /** * File Uploader factory @@ -53,15 +53,15 @@ class Image /** * @param \Magento\Logger $logger - * @param \Magento\App\Dir $dir + * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory */ public function __construct( \Magento\Logger $logger, - \Magento\App\Dir $dir, + \Magento\Filesystem $filesystem, \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory ) { - $this->_dir = $dir; + $this->_filesystem = $filesystem; $this->_fileUploaderFactory = $fileUploaderFactory; parent::__construct($logger); } @@ -92,7 +92,8 @@ class Image } catch (\Exception $e){ return $this; } - $uploader->save($this->_dir->getDir(\Magento\App\Dir::MEDIA) . '/catalog/product'); + $path = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA)->getAbsolutePath('catalog/product/'); + $uploader->save($path); $fileName = $uploader->getUploadedFileName(); if ($fileName) { diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php index 3cd9ce1b61c..5808d1c464d 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Model\Resource\Product; /** * Product collection - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Model\Resource\Product; - class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractCollection { /** @@ -843,14 +838,13 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl $tableAlias = $attributeCode . '_max_value'; $fieldAlias = 'max_' . $attributeCode; $condition = 'e.entity_id = ' . $tableAlias . '.entity_id - AND '.$this->_getConditionSql($tableAlias . '.attribute_id', $attribute->getId()); + AND ' . $this->_getConditionSql($tableAlias . '.attribute_id', $attribute->getId()); $select->join( - array($tableAlias => $attribute->getBackend()->getTable()), - $condition, - array($fieldAlias => new \Zend_Db_Expr('MAX('.$tableAlias.'.value)')) - ) - ->group('e.entity_type_id'); + array($tableAlias => $attribute->getBackend()->getTable()), + $condition, + array($fieldAlias => new \Zend_Db_Expr('MAX(' . $tableAlias . '.value)')) + )->group('e.entity_type_id'); $data = $this->getConnection()->fetchRow($select); if (isset($data[$fieldAlias])) { diff --git a/app/code/Magento/Catalog/Model/Session.php b/app/code/Magento/Catalog/Model/Session.php index 7d9a489b944..e8938aa27d2 100644 --- a/app/code/Magento/Catalog/Model/Session.php +++ b/app/code/Magento/Catalog/Model/Session.php @@ -24,37 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Model; + /** * Catalog session model - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Model; - -class Session extends \Magento\Core\Model\Session\AbstractSession +class Session extends \Magento\Session\Generic { - /** - * @param \Magento\Core\Model\Session\Context $context - * @param \Magento\Session\SidResolverInterface $sidResolver - * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param null $sessionName - * @param array $data - */ - public function __construct( - \Magento\Core\Model\Session\Context $context, - \Magento\Session\SidResolverInterface $sidResolver, - \Magento\Session\Config\ConfigInterface $sessionConfig, - $sessionName = null, - array $data = array() - ) { - parent::__construct($context, $sidResolver, $sessionConfig, $data); - $this->start('catalog', $sessionName); - } - - public function getDisplayMode() - { - return $this->_getData('display_mode'); - } } diff --git a/app/code/Magento/Catalog/etc/adminhtml/menu.xml b/app/code/Magento/Catalog/etc/adminhtml/menu.xml index 77c1023fed0..22dced33bf5 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/menu.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/menu.xml @@ -30,9 +30,9 @@ <add id="Magento_Catalog::catalog" title="Products" module="Magento_Catalog" sortOrder="20" dependsOnModule="Magento_Catalog" resource="Magento_Catalog::catalog"/> <add id="Magento_Catalog::catalog_products" title="Catalog" module="Magento_Catalog" sortOrder="10" parent="Magento_Catalog::inventory" action="catalog/product/" resource="Magento_Catalog::products"/> <add id="Magento_Catalog::catalog_categories" title="Categories" module="Magento_Catalog" sortOrder="20" parent="Magento_Catalog::inventory" action="catalog/category/" resource="Magento_Catalog::categories"/> - <add id="Magento_Catalog::catalog_attributes_attributes" title="Product" module="Magento_Catalog" sortOrder="30" parent="Magento_Adminhtml::stores_attributes" action="catalog/product_attribute/" resource="Magento_Catalog::attributes_attributes"/> - <add id="Magento_Catalog::catalog_attributes_sets" title="Product Template" module="Magento_Catalog" sortOrder="40" parent="Magento_Adminhtml::stores_attributes" action="catalog/product_set/" resource="Magento_Catalog::sets"/> - <add id="Magento_Catalog::catalog_urlrewrite" title="URL Redirects" module="Magento_Catalog" sortOrder="20" parent="Magento_Adminhtml::marketing_seo" action="adminhtml/urlrewrite/index" resource="Magento_Catalog::urlrewrite"/> + <add id="Magento_Catalog::catalog_attributes_attributes" title="Product" module="Magento_Catalog" sortOrder="30" parent="Magento_Backend::stores_attributes" action="catalog/product_attribute/" resource="Magento_Catalog::attributes_attributes"/> + <add id="Magento_Catalog::catalog_attributes_sets" title="Product Template" module="Magento_Catalog" sortOrder="40" parent="Magento_Backend::stores_attributes" action="catalog/product_set/" resource="Magento_Catalog::sets"/> + <add id="Magento_Catalog::catalog_urlrewrite" title="URL Redirects" module="Magento_Catalog" sortOrder="20" parent="Magento_Backend::marketing_seo" action="adminhtml/urlrewrite/index" resource="Magento_Catalog::urlrewrite"/> <add id="Magento_Catalog::inventory" title="Inventory" module="Magento_Catalog" sortOrder="10" parent="Magento_Catalog::catalog" dependsOnModule="Magento_Catalog" resource="Magento_Catalog::catalog"/> </menu> diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 65741871b75..3c2319dd65c 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -29,18 +29,13 @@ <type name="Magento\Log\Model\Resource\Log"> <plugin name="catalogLog" type="Magento\Catalog\Model\Plugin\Log" /> </type> - <type name="Magento\Catalog\Helper\Product\View"> - <param name="messageModels"> - <value> - <catalog>Magento\Catalog\Model\Session</catalog> - <checkout>Magento\Checkout\Model\Session</checkout> - </value> - </param> - </type> <type name="Magento\Catalog\Helper\Product"> <param name="typeSwitcherLabel"> <value>Virtual</value> </param> + <param name="catalogSession"> + <instance type="Magento\Catalog\Model\Session\Proxy" /> + </param> </type> <type name="Magento\Catalog\Model\Product"> <param name="catalogProductStatus"> @@ -66,6 +61,9 @@ <param name="catalogUrl"> <instance type="Magento\Catalog\Model\Resource\Url\Proxy" /> </param> + <param name="customerSession"> + <instance type="Magento\Customer\Model\Session\Proxy" /> + </param> </type> <type name="Magento\Catalog\Model\Entity\Product\Attribute\Design\Options\Container"> <param name="options"> @@ -93,6 +91,9 @@ <param name="templateFilterModel"> <value>Magento\Catalog\Model\Template\Filter</value> </param> + <param name="catalogSession"> + <instance type="Magento\Catalog\Model\Session\Proxy" /> + </param> </type> <type name="Magento\Catalog\Model\Config\Source\GridPerPage"> <param name="perPageValues"> @@ -124,4 +125,14 @@ <instance type="Magento\Catalog\Model\Session\Proxy" /> </param> </type> + <virtualType name="Magento\Catalog\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> + <value>catalog</value> + </param> + </virtualType> + <type name="Magento\Catalog\Model\Session"> + <param name="storage"> + <instance type="Magento\Catalog\Model\Session\Storage" /> + </param> + </type> </config> diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml index 03dcc5b2b7c..506036eb49f 100755 --- a/app/code/Magento/Catalog/etc/module.xml +++ b/app/code/Magento/Catalog/etc/module.xml @@ -48,7 +48,6 @@ <module name="Magento_Bundle"/> <module name="Magento_CatalogInventory"/> <module name="Magento_Cron"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Directory"/> <module name="Magento_CatalogRule"/> <module name="Magento_Sales"/> 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 a253b154c5a..8e4e1b6a959 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 @@ -24,13 +24,16 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -$installFile = __DIR__ . DS . 'upgrade-1.6.0.0.8-1.6.0.0.9.php'; -if (file_exists($installFile)) { +/** @var $this \Magento\Catalog\Model\Resource\Setup */ +$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); + +if ($modulesDirectory->isExist($modulesDirectory->getRelativePath($installFile))) { include $installFile; } -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ -$installer = $this; /** @var $connection \Magento\DB\Adapter\Pdo\Mysql */ $connection = $installer->getConnection(); $memoryTables = array( @@ -49,5 +52,5 @@ $memoryTables = array( ); foreach ($memoryTables as $table) { - $connection->changeTableEngine($installer->getTable($table), \Magento\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY); + $connection->changeTableEngine($this->getTable($table), \Magento\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY); } diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml index 10edc0b1511..9ae7c8734bd 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml @@ -26,7 +26,7 @@ <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <container name="root" label="Root" output="1"> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Crosssell" name="catalog.product.edit.tab.crosssell"/> - <block class="Magento\Adminhtml\Block\Widget\Grid\Serializer" name="crosssell_grid_serializer"> + <block class="Magento\Backend\Block\Widget\Grid\Serializer" name="crosssell_grid_serializer"> <arguments> <argument name="input_names" xsi:type="string">position</argument> <argument name="grid_block" xsi:type="string">catalog.product.edit.tab.crosssell</argument> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml index 6f867353d45..248254eae3d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml @@ -26,7 +26,7 @@ <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <container name="root" label="Root" output="1"> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Related" name="catalog.product.edit.tab.related"/> - <block class="Magento\Adminhtml\Block\Widget\Grid\Serializer" name="related_grid_serializer"> + <block class="Magento\Backend\Block\Widget\Grid\Serializer" name="related_grid_serializer"> <arguments> <argument name="input_names" xsi:type="string">position</argument> <argument name="grid_block" xsi:type="string">catalog.product.edit.tab.related</argument> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml index 1e6e631b560..bccbc47068f 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml @@ -26,7 +26,7 @@ <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <container name="root" label="Root" output="1"> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Upsell" name="catalog.product.edit.tab.upsell"/> - <block class="Magento\Adminhtml\Block\Widget\Grid\Serializer" name="upsell_grid_serializer"> + <block class="Magento\Backend\Block\Widget\Grid\Serializer" name="upsell_grid_serializer"> <arguments> <argument name="input_names" xsi:type="string">position</argument> <argument name="grid_block" xsi:type="string">catalog.product.edit.tab.upsell</argument> diff --git a/app/code/Magento/Catalog/view/adminhtml/product/product.css b/app/code/Magento/Catalog/view/adminhtml/product/product.css index 7b8fa7ac903..205199fc30f 100644 --- a/app/code/Magento/Catalog/view/adminhtml/product/product.css +++ b/app/code/Magento/Catalog/view/adminhtml/product/product.css @@ -240,7 +240,7 @@ .image-placeholder { position: relative; - background: #fff url(Magento_Adminhtml::images/image-placeholder.png) no-repeat 50% 0; + background: #fff url(Magento_Backend::images/image-placeholder.png) no-repeat 50% 0; } .image-placeholder .fileinput-button { diff --git a/app/code/Magento/Catalog/view/frontend/js/configurable.js b/app/code/Magento/Catalog/view/frontend/js/configurable.js index a4bf7504f63..b79e6c0c611 100644 --- a/app/code/Magento/Catalog/view/frontend/js/configurable.js +++ b/app/code/Magento/Catalog/view/frontend/js/configurable.js @@ -330,7 +330,10 @@ var allowedProducts = []; if (prevConfig) { for (var j = 0; j < options[i].products.length; j++) { - if (prevConfig.config.allowedProducts && prevConfig.config.allowedProducts.indexOf(options[i].products[j]) > -1) { + // prevConfig.config can be undefined + if (prevConfig.config && + prevConfig.config.allowedProducts && + prevConfig.config.allowedProducts.indexOf(options[i].products[j]) > -1) { allowedProducts.push(options[i].products[j]); } } diff --git a/app/code/Magento/Catalog/view/frontend/product/price_msrp.phtml b/app/code/Magento/Catalog/view/frontend/product/price_msrp.phtml index c27bb93222a..5565758df50 100644 --- a/app/code/Magento/Catalog/view/frontend/product/price_msrp.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/price_msrp.phtml @@ -34,6 +34,8 @@ /** @var $_product \Magento\Catalog\Model\Product */ $_product = $this->getProduct(); $_msrpPrice = ""; + $priceElementIdPrefix = $this->getPriceElementIdPrefix() ? $this->getPriceElementIdPrefix() : 'product-price-'; + $priceElementId = $priceElementIdPrefix . $_product->getId() . $this->getIdSuffix(); ?> <div class="price-box map info"> <?php $_price = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_product->getMsrp()) ?> diff --git a/app/code/Magento/Catalog/view/frontend/product/view/type/options/configurable.phtml b/app/code/Magento/Catalog/view/frontend/product/view/type/options/configurable.phtml index 419fd11e1ab..0fbd567d834 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/type/options/configurable.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/type/options/configurable.phtml @@ -40,7 +40,7 @@ $_attributes = $this->decorateArray($this->getAllowAttributes()); data-validate="{required:true}" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="super-attribute-select"> - <option><?php echo __('Choose an Option...') ?></option> + <option value=""><?php echo __('Choose an Option...') ?></option> </select> </div> </div> diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit.php index dcc2db0676d..f760314e2f4 100644 --- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit.php @@ -30,7 +30,7 @@ namespace Magento\CatalogRule\Block\Adminhtml\Promo\Catalog; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tabs.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tabs.php index 0d96ff0d576..33890edccc4 100644 --- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tabs.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tabs.php @@ -34,7 +34,7 @@ */ namespace Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit; -class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs +class Tabs extends \Magento\Backend\Block\Widget\Tabs { protected function _construct() diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser.php index 98aedc05629..b12b1af442f 100644 --- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser.php @@ -39,17 +39,19 @@ class Chooser extends \Magento\Backend\Block\Widget\Grid\Extended /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\SalesRule\Model\RuleFactory $salesRule * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\SalesRule\Model\RuleFactory $salesRule, array $data = array() ) { $this->_salesRule = $salesRule; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** @@ -116,7 +118,7 @@ class Chooser extends \Magento\Backend\Block\Widget\Grid\Extended /** * Prepare rules collection * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { @@ -133,7 +135,7 @@ class Chooser extends \Magento\Backend\Block\Widget\Grid\Extended /** * Prepare columns for rules grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php index c9113b11007..dd4b5fd3776 100644 --- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php @@ -58,6 +58,7 @@ class Sku extends \Magento\Backend\Block\Widget\Grid\Extended /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Catalog\Model\ProductFactory $catalogProduct * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $eavAttSetCollection * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $cpCollection @@ -67,6 +68,7 @@ class Sku extends \Magento\Backend\Block\Widget\Grid\Extended public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Catalog\Model\ProductFactory $catalogProduct, \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $eavAttSetCollection, \Magento\Catalog\Model\Resource\Product\CollectionFactory $cpCollection, @@ -77,7 +79,7 @@ class Sku extends \Magento\Backend\Block\Widget\Grid\Extended $this->_cpCollection = $cpCollection; $this->_eavAttSetCollection = $eavAttSetCollection; $this->_catalogProduct = $catalogProduct; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php index a308eb102a6..55aa24b444b 100644 --- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php +++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php @@ -87,7 +87,7 @@ class Catalog extends \Magento\Backend\App\Action $dirtyRules = $this->_objectManager->create('Magento\CatalogRule\Model\Flag')->loadSelf(); if ($dirtyRules->getState()) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addNotice($this->getDirtyRulesNoticeMessage()); + $this->messageManager->addNotice($this->getDirtyRulesNoticeMessage()); } $this->_initAction() @@ -113,9 +113,7 @@ class Catalog extends \Magento\Backend\App\Action if ($id) { $model->load($id); if (! $model->getRuleId()) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('This rule no longer exists.') - ); + $this->messageManager->addError(__('This rule no longer exists.')); $this->_redirect('catalog_rule/*'); return; } @@ -124,7 +122,7 @@ class Catalog extends \Magento\Backend\App\Action $this->_title->add($model->getRuleId() ? $model->getName() : __('New Catalog Price Rule')); // set entered data if was error when we do save - $data = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getPageData(true); + $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getPageData(true); if (!empty($data)) { $model->addData($data); } @@ -165,7 +163,7 @@ class Catalog extends \Magento\Backend\App\Action $validateResult = $model->validateData(new \Magento\Object($data)); if ($validateResult !== true) { foreach ($validateResult as $errorMessage) { - $this->_getSession()->addError($errorMessage); + $this->messageManager->addError($errorMessage); } $this->_getSession()->setPageData($data); $this->_redirect('catalog_rule/*/edit', array('id'=>$model->getId())); @@ -177,14 +175,12 @@ class Catalog extends \Magento\Backend\App\Action $model->loadPost($data); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setPageData($model->getData()); + $this->_objectManager->get('Magento\Backend\Model\Session')->setPageData($model->getData()); $model->save(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('The rule has been saved.') - ); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setPageData(false); + $this->messageManager->addSuccess(__('The rule has been saved.')); + $this->_objectManager->get('Magento\Backend\Model\Session')->setPageData(false); if ($this->getRequest()->getParam('auto_apply')) { $this->getRequest()->setParam('rule_id', $model->getId()); $this->_forward('applyRules'); @@ -200,13 +196,13 @@ class Catalog extends \Magento\Backend\App\Action } return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError( + $this->messageManager->addError( __('An error occurred while saving the rule data. Please review the log and try again.') ); $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setPageData($data); + $this->_objectManager->get('Magento\Backend\Model\Session')->setPageData($data); $this->_redirect('catalog_rule/*/edit', array('id' => $this->getRequest()->getParam('rule_id'))); return; } @@ -225,15 +221,13 @@ class Catalog extends \Magento\Backend\App\Action $this->_objectManager->create('Magento\CatalogRule\Model\Flag')->loadSelf() ->setState(1) ->save(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('The rule has been deleted.') - ); + $this->messageManager->addSuccess(__('The rule has been deleted.')); $this->_redirect('catalog_rule/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError( + $this->messageManager->addError( __('An error occurred while deleting the rule. Please review the log and try again.') ); $this->_objectManager->get('Magento\Logger')->logException($e); @@ -241,9 +235,7 @@ class Catalog extends \Magento\Backend\App\Action return; } } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('Unable to find a rule to delete.') - ); + $this->messageManager->addError(__('Unable to find a rule to delete.')); $this->_redirect('catalog_rule/*/'); } @@ -320,15 +312,15 @@ class Catalog extends \Magento\Backend\App\Action $ruleJob->applyAll(); if ($ruleJob->hasSuccess()) { - $this->_getSession()->addSuccess($ruleJob->getSuccess()); + $this->messageManager->addSuccess($ruleJob->getSuccess()); $this->_objectManager->create('Magento\CatalogRule\Model\Flag')->loadSelf() ->setState(0) ->save(); } elseif ($ruleJob->hasError()) { - $this->_getSession()->addError($errorMessage . ' ' . $ruleJob->getError()); + $this->messageManager->addError($errorMessage . ' ' . $ruleJob->getError()); } } catch (\Exception $e) { - $this->_getSession()->addError($errorMessage); + $this->messageManager->addError($errorMessage); } $this->_redirect('catalog_rule/*'); } diff --git a/app/code/Magento/CatalogRule/Model/Observer.php b/app/code/Magento/CatalogRule/Model/Observer.php index 36d84488952..dd06d8f4534 100644 --- a/app/code/Magento/CatalogRule/Model/Observer.php +++ b/app/code/Magento/CatalogRule/Model/Observer.php @@ -96,6 +96,11 @@ class Observer */ protected $_resourceRule; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param Resource\RuleFactory $resourceRuleFactory * @param Resource\Rule $resourceRule @@ -109,6 +114,7 @@ class Observer * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Message\ManagerInterface $messageManager * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -124,7 +130,8 @@ class Observer \Magento\Customer\Model\Session $customerSession, \Magento\Backend\Model\Session $backendSession, \Magento\Core\Model\Registry $coreRegistry, - \Magento\Stdlib\DateTime $dateTime + \Magento\Stdlib\DateTime $dateTime, + \Magento\Message\ManagerInterface $messageManager ) { $this->_resourceRuleFactory = $resourceRuleFactory; $this->_resourceRule = $resourceRule; @@ -138,6 +145,7 @@ class Observer $this->_backendSession = $backendSession; $this->_coreRegistry = $coreRegistry; $this->dateTime = $dateTime; + $this->messageManager = $messageManager; } /** @@ -393,8 +401,12 @@ class Observer if ($disabledRulesCount) { $this->_ruleFactory->create()->applyAll(); - $this->_backendSession->addWarning( - __('%1 Catalog Price Rules based on "%2" attribute have been disabled.', $disabledRulesCount, $attributeCode) + $this->messageManager->addWarning( + __( + '%1 Catalog Price Rules based on "%2" attribute have been disabled.', + $disabledRulesCount, + $attributeCode + ) ); } diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml b/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml index 84ae05cc481..5bea1e13da7 100644 --- a/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml +++ b/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml @@ -27,7 +27,7 @@ --> <config> <menu> - <add id="Magento_CatalogRule::promo" title="Promotions" module="Magento_CatalogRule" parent="Magento_Adminhtml::marketing" sortOrder="10" resource="Magento_CatalogRule::promo"/> + <add id="Magento_CatalogRule::promo" title="Promotions" module="Magento_CatalogRule" parent="Magento_Backend::marketing" sortOrder="10" resource="Magento_CatalogRule::promo"/> <add id="Magento_CatalogRule::promo_catalog" title="Catalog Price Rules" sortOrder="10" module="Magento_CatalogRule" parent="Magento_CatalogRule::promo" action="catalog_rule/promo_catalog/" dependsOnModule="Magento_Catalog" resource="Magento_CatalogRule::promo_catalog"/> </menu> </config> diff --git a/app/code/Magento/CatalogSearch/Block/Autocomplete.php b/app/code/Magento/CatalogSearch/Block/Autocomplete.php index 3acebfb3e7d..c0f88bb0d8c 100644 --- a/app/code/Magento/CatalogSearch/Block/Autocomplete.php +++ b/app/code/Magento/CatalogSearch/Block/Autocomplete.php @@ -33,6 +33,25 @@ class Autocomplete extends \Magento\View\Element\AbstractBlock { protected $_suggestData = null; + /** + * @var \Magento\CatalogSearch\Helper\Data + */ + protected $_catalogsearchHelper; + + /** + * @param \Magento\View\Element\Context $context + * @param \Magento\CatalogSearch\Helper\Data $catalogsearchHelper + * @param array $data + */ + public function __construct( + \Magento\View\Element\Context $context, + \Magento\CatalogSearch\Helper\Data $catalogsearchHelper, + array $data = array() + ) { + $this->_catalogsearchHelper = $catalogsearchHelper; + parent::__construct($context, $data); + } + protected function _toHtml() { $html = ''; @@ -71,8 +90,8 @@ class Autocomplete extends \Magento\View\Element\AbstractBlock public function getSuggestData() { if (!$this->_suggestData) { - $collection = $this->helper('Magento\CatalogSearch\Helper\Data')->getSuggestCollection(); - $query = $this->helper('Magento\CatalogSearch\Helper\Data')->getQueryText(); + $collection = $this->_catalogsearchHelper->getSuggestCollection(); + $query = $this->_catalogsearchHelper->getQueryText(); $counter = 0; $data = array(); foreach ($collection as $item) { diff --git a/app/code/Magento/CatalogSearch/Block/Result.php b/app/code/Magento/CatalogSearch/Block/Result.php index 7454929c560..fe4f6245cb4 100644 --- a/app/code/Magento/CatalogSearch/Block/Result.php +++ b/app/code/Magento/CatalogSearch/Block/Result.php @@ -81,7 +81,7 @@ class Result extends \Magento\View\Element\Template */ protected function _getQuery() { - return $this->helper('Magento\CatalogSearch\Helper\Data')->getQuery(); + return $this->_catalogSearchData->getQuery(); } /** @@ -94,7 +94,7 @@ class Result extends \Magento\View\Element\Template // add Home breadcrumb $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs'); if ($breadcrumbs) { - $title = __("Search results for: '%1'", $this->helper('Magento\CatalogSearch\Helper\Data')->getQueryText()); + $title = __("Search results for: '%1'", $this->_catalogSearchData->getQueryText()); $breadcrumbs->addCrumb('home', array( 'label' => __('Home'), @@ -107,7 +107,7 @@ class Result extends \Magento\View\Element\Template } // modify page title - $title = __("Search results for: '%1'", $this->helper('Magento\CatalogSearch\Helper\Data')->getEscapedQueryText()); + $title = __("Search results for: '%1'", $this->_catalogSearchData->getEscapedQueryText()); $this->getLayout()->getBlock('head')->setTitle($title); return parent::_prepareLayout(); diff --git a/app/code/Magento/CatalogSearch/Controller/Advanced.php b/app/code/Magento/CatalogSearch/Controller/Advanced.php index 79e66db657c..e17f1f8e5dd 100644 --- a/app/code/Magento/CatalogSearch/Controller/Advanced.php +++ b/app/code/Magento/CatalogSearch/Controller/Advanced.php @@ -53,7 +53,7 @@ class Advanced extends \Magento\App\Action\Action /** * Catalog search session * - * @var \Magento\Core\Model\Session\Generic + * @var \Magento\Session\Generic */ protected $_catalogSearchSession; @@ -61,13 +61,13 @@ class Advanced extends \Magento\App\Action\Action * Construct * * @param \Magento\App\Action\Context $context - * @param \Magento\Core\Model\Session\Generic $catalogSearchSession + * @param \Magento\Session\Generic $catalogSearchSession * @param \Magento\CatalogSearch\Model\Advanced $catalogSearchAdvanced * @param \Magento\Core\Model\UrlFactory $urlFactory */ public function __construct( \Magento\App\Action\Context $context, - \Magento\Core\Model\Session\Generic $catalogSearchSession, + \Magento\Session\Generic $catalogSearchSession, \Magento\CatalogSearch\Model\Advanced $catalogSearchAdvanced, \Magento\Core\Model\UrlFactory $urlFactory ) { @@ -80,7 +80,7 @@ class Advanced extends \Magento\App\Action\Action public function indexAction() { $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\CatalogSearch\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -90,13 +90,13 @@ class Advanced extends \Magento\App\Action\Action try { $this->_catalogSearchAdvanced->addFilters($this->getRequest()->getQuery()); } catch (\Magento\Core\Exception $e) { - $this->_catalogSearchSession->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $defaultUrl = $this->_urlFactory->create() ->setQueryParams($this->getRequest()->getQuery()) ->getUrl('*/*/'); $this->getResponse()->setRedirect($this->_redirect->error($defaultUrl)); } - $this->_view->getLayout()->initMessages('Magento\Catalog\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } } diff --git a/app/code/Magento/CatalogSearch/Controller/Result.php b/app/code/Magento/CatalogSearch/Controller/Result.php index 0fe3a2ac615..17df42f08ba 100644 --- a/app/code/Magento/CatalogSearch/Controller/Result.php +++ b/app/code/Magento/CatalogSearch/Controller/Result.php @@ -102,8 +102,7 @@ class Result extends \Magento\App\Action\Action $this->_objectManager->get('Magento\CatalogSearch\Helper\Data')->checkNotes(); $this->_view->loadLayout(); - $this->_view->getLayout() - ->initMessages(array('Magento\Catalog\Model\Session', 'Magento\Checkout\Model\Session')); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); if (!$this->_objectManager->get('Magento\CatalogSearch\Helper\Data')->isMinQueryLength()) { diff --git a/app/code/Magento/CatalogSearch/Controller/Term.php b/app/code/Magento/CatalogSearch/Controller/Term.php index 23c2cacddfb..d57c86c1745 100644 --- a/app/code/Magento/CatalogSearch/Controller/Term.php +++ b/app/code/Magento/CatalogSearch/Controller/Term.php @@ -33,8 +33,10 @@ use Magento\App\RequestInterface; class Term extends \Magento\App\Action\Action { /** + * Dispatch request + * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { diff --git a/app/code/Magento/CatalogSearch/Model/Fulltext/Observer.php b/app/code/Magento/CatalogSearch/Model/Fulltext/Observer.php index 92f8866be67..b965484b112 100644 --- a/app/code/Magento/CatalogSearch/Model/Fulltext/Observer.php +++ b/app/code/Magento/CatalogSearch/Model/Fulltext/Observer.php @@ -70,6 +70,11 @@ class Observer */ protected $_backendSession; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * Construct * @@ -78,19 +83,22 @@ class Observer * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\CatalogSearch\Model\Fulltext $catalogSearchFulltext * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( \Magento\Backend\Model\Session $backendSession, \Magento\Backend\Model\Url $backendUrl, \Magento\Eav\Model\Config $eavConfig, \Magento\CatalogSearch\Model\Fulltext $catalogSearchFulltext, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Message\ManagerInterface $messageManager ) { $this->_backendSession = $backendSession; $this->_backendUrl = $backendUrl; $this->_eavConfig = $eavConfig; $this->_catalogSearchFulltext = $catalogSearchFulltext; $this->_storeManager = $storeManager; + $this->messageManager = $messageManager; } /** @@ -173,7 +181,7 @@ class Observer if ($showNotice) { $url = $this->_backendUrl->getUrl('adminhtml/system_cache'); - $this->_backendSession->addNotice( + $this->messageManager->addNotice( __('Attribute setting change related with Search Index. Please run <a href="%1">Rebuild Search Index</a> process.', $url) ); } diff --git a/app/code/Magento/CatalogSearch/etc/adminhtml/di.xml b/app/code/Magento/CatalogSearch/etc/adminhtml/di.xml index e11ec1cb2ce..5ecd4ff7408 100644 --- a/app/code/Magento/CatalogSearch/etc/adminhtml/di.xml +++ b/app/code/Magento/CatalogSearch/etc/adminhtml/di.xml @@ -24,10 +24,15 @@ */ --> <config> - <virtualType name="Magento\CatalogSearch\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\CatalogSearch\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>catalogsearch</value> </param> + </virtualType> + <virtualType name="Magento\CatalogSearch\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\CatalogSearch\Model\Session\Storage" /> + </param> <param name="sessionName"> <value>adminhtml</value> </param> diff --git a/app/code/Magento/CatalogSearch/etc/adminhtml/menu.xml b/app/code/Magento/CatalogSearch/etc/adminhtml/menu.xml index 9787c8ab7ae..ef437742efc 100644 --- a/app/code/Magento/CatalogSearch/etc/adminhtml/menu.xml +++ b/app/code/Magento/CatalogSearch/etc/adminhtml/menu.xml @@ -27,6 +27,6 @@ --> <config> <menu> - <add id="Magento_CatalogSearch::catalog_search" title="Search Terms" module="Magento_CatalogSearch" sortOrder="10" parent="Magento_Adminhtml::marketing_seo" action="catalog/search/" resource="Magento_CatalogSearch::search"/> + <add id="Magento_CatalogSearch::catalog_search" title="Search Terms" module="Magento_CatalogSearch" sortOrder="10" parent="Magento_Backend::marketing_seo" action="catalog/search/" resource="Magento_CatalogSearch::search"/> </menu> </config> diff --git a/app/code/Magento/CatalogSearch/etc/frontend/di.xml b/app/code/Magento/CatalogSearch/etc/frontend/di.xml index 5121db27fdb..4e36793e50d 100644 --- a/app/code/Magento/CatalogSearch/etc/frontend/di.xml +++ b/app/code/Magento/CatalogSearch/etc/frontend/di.xml @@ -24,10 +24,15 @@ */ --> <config> - <virtualType name="Magento\CatalogSearch\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\CatalogSearch\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>catalogsearch</value> </param> + </virtualType> + <virtualType name="Magento\CatalogSearch\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\CatalogSearch\Model\Session\Storage" /> + </param> <param name="sessionName"> <value>frontend</value> </param> diff --git a/app/code/Magento/CatalogSearch/etc/module.xml b/app/code/Magento/CatalogSearch/etc/module.xml index d03b82e3a52..a581b026f65 100755 --- a/app/code/Magento/CatalogSearch/etc/module.xml +++ b/app/code/Magento/CatalogSearch/etc/module.xml @@ -32,7 +32,6 @@ <module name="Magento_Catalog"/> <module name="Magento_Customer"/> <module name="Magento_Core"/> - <module name="Magento_Checkout"/> <module name="Magento_Directory"/> <module name="Magento_Index"/> <module name="Magento_Eav"/> diff --git a/app/code/Magento/Centinel/Model/AbstractState.php b/app/code/Magento/Centinel/Model/AbstractState.php index de4b2c23d74..2909d5dad26 100644 --- a/app/code/Magento/Centinel/Model/AbstractState.php +++ b/app/code/Magento/Centinel/Model/AbstractState.php @@ -67,7 +67,7 @@ abstract class AbstractState extends \Magento\Object * Otherwise it will return value of the attribute specified by $key * * $index parameter is ignored - * @see \Magento\Core\Model\Session\AbstractSession::getData() + * @see \Magento\Session\SessionManager::getData() * * @param string $key * @param string|int $index diff --git a/app/code/Magento/Centinel/Model/Service.php b/app/code/Magento/Centinel/Model/Service.php index 68c2943c139..16325bc0684 100644 --- a/app/code/Magento/Centinel/Model/Service.php +++ b/app/code/Magento/Centinel/Model/Service.php @@ -24,11 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Centinel\Model; + /** * 3D Secure Validation Model */ -namespace Magento\Centinel\Model; - class Service extends \Magento\Object { /** @@ -85,7 +85,7 @@ class Service extends \Magento\Object /** * Centinel session * - * @var \Magento\Core\Model\Session\AbstractSession + * @var \Magento\Session\SessionManagerInterface */ protected $_centinelSession; @@ -117,7 +117,7 @@ class Service extends \Magento\Object * @param \Magento\Centinel\Model\Config $config * @param \Magento\Centinel\Model\Api $api * @param \Magento\UrlInterface $url - * @param \Magento\Core\Model\Session\AbstractSession $centinelSession + * @param \Magento\Session\SessionManagerInterface $centinelSession * @param \Magento\Centinel\Model\StateFactory $stateFactory * @param \Magento\Data\Form\FormKey $formKey * @param string $urlPrefix @@ -127,7 +127,7 @@ class Service extends \Magento\Object \Magento\Centinel\Model\Config $config, \Magento\Centinel\Model\Api $api, \Magento\UrlInterface $url, - \Magento\Core\Model\Session\AbstractSession $centinelSession, + \Magento\Session\SessionManagerInterface $centinelSession, \Magento\Centinel\Model\StateFactory $stateFactory, \Magento\Data\Form\FormKey $formKey, $urlPrefix = 'centinel/index/', diff --git a/app/code/Magento/Centinel/etc/adminhtml/di.xml b/app/code/Magento/Centinel/etc/adminhtml/di.xml index 0d312b21fca..66979342bb8 100644 --- a/app/code/Magento/Centinel/etc/adminhtml/di.xml +++ b/app/code/Magento/Centinel/etc/adminhtml/di.xml @@ -24,10 +24,15 @@ */ --> <config> - <virtualType name="Magento\Centinel\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\Centinel\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>centinel_validator</value> </param> + </virtualType> + <virtualType name="Magento\Centinel\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\Centinel\Model\Session\Storage" /> + </param> <param name="sessionName"> <value>adminhtml</value> </param> diff --git a/app/code/Magento/Centinel/etc/adminhtml/routes.xml b/app/code/Magento/Centinel/etc/adminhtml/routes.xml index 3bee88693b2..c07cbc5af49 100644 --- a/app/code/Magento/Centinel/etc/adminhtml/routes.xml +++ b/app/code/Magento/Centinel/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Centinel_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Centinel" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Centinel/etc/frontend/di.xml b/app/code/Magento/Centinel/etc/frontend/di.xml index 4edf75ae690..ee660c6c408 100644 --- a/app/code/Magento/Centinel/etc/frontend/di.xml +++ b/app/code/Magento/Centinel/etc/frontend/di.xml @@ -24,10 +24,15 @@ */ --> <config> - <virtualType name="Magento\Centinel\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\Centinel\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>centinel_validator</value> </param> + </virtualType> + <virtualType name="Magento\Centinel\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\Centinel\Model\Session\Storage" /> + </param> <param name="sessionName"> <value>frontend</value> </param> diff --git a/app/code/Magento/Checkout/Block/Adminhtml/Agreement.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement.php index 9f1da0aecd8..8a2a7476880 100644 --- a/app/code/Magento/Checkout/Block/Adminhtml/Agreement.php +++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement.php @@ -34,7 +34,7 @@ namespace Magento\Checkout\Block\Adminhtml; -class Agreement extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Agreement extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() { diff --git a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit.php index b58d5854f3c..3b4bb561696 100644 --- a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit.php +++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit.php @@ -26,7 +26,7 @@ namespace Magento\Checkout\Block\Adminhtml\Agreement; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php index 474938fed3d..5e4957c9886 100644 --- a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php +++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php @@ -65,7 +65,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * - * return \Magento\Adminhtml\Block\Widget\Form + * return \Magento\Backend\Block\Widget\Form */ protected function _prepareForm() { diff --git a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Grid.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Grid.php index e28f317418f..fe03e38a3d0 100644 --- a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Grid.php +++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Grid.php @@ -25,7 +25,7 @@ */ namespace Magento\Checkout\Block\Adminhtml\Agreement; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * @var \Magento\Checkout\Model\Resource\Agreement\CollectionFactory @@ -35,17 +35,19 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $collectionFactory, array $data = array() ) { $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Checkout/Block/Cart.php b/app/code/Magento/Checkout/Block/Cart.php index 78a918cefeb..9ddaded6e57 100644 --- a/app/code/Magento/Checkout/Block/Cart.php +++ b/app/code/Magento/Checkout/Block/Cart.php @@ -40,12 +40,18 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart */ protected $_catalogUrlBuilder; + /** + * @var \Magento\Checkout\Helper\Cart + */ + protected $_cartHelper; + /** * @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 \Magento\Catalog\Model\Resource\Url $catalogUrlBuilder + * @param \Magento\Checkout\Helper\Cart $cartHelper * @param array $data */ public function __construct( @@ -54,8 +60,10 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Catalog\Model\Resource\Url $catalogUrlBuilder, + \Magento\Checkout\Helper\Cart $cartHelper, array $data = array() ) { + $this->_cartHelper = $cartHelper; $this->_catalogUrlBuilder = $catalogUrlBuilder; parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); } @@ -168,7 +176,7 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart */ public function getIsVirtual() { - return $this->helper('Magento\Checkout\Helper\Cart')->getIsVirtualQuote(); + return $this->_cartHelper->getIsVirtualQuote(); } /** diff --git a/app/code/Magento/Checkout/Block/Cart/Crosssell.php b/app/code/Magento/Checkout/Block/Cart/Crosssell.php index 5dd3441363c..008408c04e6 100644 --- a/app/code/Magento/Checkout/Block/Cart/Crosssell.php +++ b/app/code/Magento/Checkout/Block/Cart/Crosssell.php @@ -69,6 +69,11 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\CatalogInventory\Model\Stock $stock @@ -84,6 +89,11 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\CatalogInventory\Model\Stock $stock, @@ -94,7 +104,20 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct $this->_productVisibility = $productVisibility; $this->_stock = $stock; $this->_productLinkFactory = $productLinkFactory; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); } /** diff --git a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php index 5f566c2feab..ac5e7c93085 100644 --- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php +++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php @@ -65,20 +65,44 @@ class Renderer extends \Magento\View\Element\Template */ protected $_productConfig = null; + /** + * @var \Magento\Catalog\Helper\Image + */ + protected $_imageHelper; + + /** + * @var \Magento\Core\Helper\Url + */ + protected $_urlHelper; + + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @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() ) { + $this->_urlHelper = $urlHelper; + $this->_imageHelper = $imageHelper; $this->_productConfig = $productConfig; $this->_checkoutSession = $checkoutSession; + $this->messageManager = $messageManager; parent::__construct($context, $data); } @@ -138,7 +162,7 @@ class Renderer extends \Magento\View\Element\Template $product = $children[0]->getProduct(); } } - $thumbnail = $this->helper('Magento\Catalog\Helper\Image')->init($product, 'thumbnail'); + $thumbnail = $this->_imageHelper->init($product, 'thumbnail'); } else { $thumbnail = $this->_productThumbnail; } @@ -309,7 +333,7 @@ class Renderer extends \Magento\View\Element\Template return $this->getData('delete_url'); } - $encodedUrl = $this->helper('Magento\Core\Helper\Url')->getEncodedUrl(); + $encodedUrl = $this->_urlHelper->getEncodedUrl(); return $this->getUrl( 'checkout/cart/delete', array( @@ -356,7 +380,7 @@ class Renderer extends \Magento\View\Element\Template $messages = array(); $quoteItem = $this->getItem(); - // Add basic messages occuring during this page load + // Add basic messages occurring during this page load $baseMessages = $quoteItem->getMessage(false); if ($baseMessages) { foreach ($baseMessages as $message) { @@ -367,22 +391,19 @@ class Renderer extends \Magento\View\Element\Template } } - // Add messages saved previously in checkout session - $checkoutSession = $this->getCheckoutSession(); - if ($checkoutSession) { - /* @var $collection \Magento\Message\Collection */ - $collection = $checkoutSession->getQuoteItemMessages($quoteItem->getId(), true); - if ($collection) { - $additionalMessages = $collection->getItems(); - foreach ($additionalMessages as $message) { - /* @var $message \Magento\Message\AbstractMessage */ - $messages[] = array( - 'text' => $message->getCode(), - 'type' => ($message->getType() == \Magento\Message\Factory::ERROR) ? 'error' : 'notice' - ); - } + /* @var $collection \Magento\Message\Collection */ + $collection = $this->messageManager->getMessages('quote_item' . $quoteItem->getId()); + if ($collection) { + $additionalMessages = $collection->getItems(); + foreach ($additionalMessages as $message) { + /* @var $message \Magento\Message\MessageInterface */ + $messages[] = array( + 'text' => $message->getText(), + 'type' => $message->getType() + ); } } + $this->messageManager->getMessages('quote_item' . $quoteItem->getId())->clear(); return $messages; } 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 9e68d55c65b..b1d07b28f04 100644 --- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer/Configurable.php +++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer/Configurable.php @@ -77,7 +77,7 @@ class Configurable extends \Magento\Checkout\Block\Cart\Item\Renderer || ($this->_storeConfig->getConfig(self::CONFIGURABLE_PRODUCT_IMAGE) == self::USE_PARENT_IMAGE)) { $product = $this->getProduct(); } - return $this->helper('Magento\Catalog\Helper\Image')->init($product, 'thumbnail'); + return $this->_imageHelper->init($product, 'thumbnail'); } /** 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 b38efed7f32..6ebd93f06f8 100644 --- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer/Grouped.php +++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer/Grouped.php @@ -61,11 +61,11 @@ class Grouped extends \Magento\Checkout\Block\Cart\Item\Renderer { $product = $this->getProduct(); if (!$product->getData('thumbnail') - ||($product->getData('thumbnail') == 'no_selection') + || ($product->getData('thumbnail') == 'no_selection') || ($this->_storeConfig->getConfig(self::GROUPED_PRODUCT_IMAGE) == self::USE_PARENT_IMAGE)) { $product = $this->getGroupedProduct(); } - return $this->helper('Magento\Catalog\Helper\Image')->init($product, 'thumbnail'); + return $this->_imageHelper->init($product, 'thumbnail'); } /** @@ -79,10 +79,8 @@ class Grouped extends \Magento\Checkout\Block\Cart\Item\Renderer { $renderer = $this->getRenderedBlock()->getItemRenderer($this->getItem()->getRealProductType()); $renderer->setItem($this->getItem()); -// $renderer->overrideProductUrl($this->getProductUrl()); $renderer->overrideProductThumbnail($this->getProductThumbnail()); $rendererHtml = $renderer->toHtml(); -// $renderer->overrideProductUrl(null); $renderer->overrideProductThumbnail(null); return $rendererHtml; } diff --git a/app/code/Magento/Checkout/Block/Cart/Link.php b/app/code/Magento/Checkout/Block/Cart/Link.php index def77100868..e8dfbcdefe9 100644 --- a/app/code/Magento/Checkout/Block/Cart/Link.php +++ b/app/code/Magento/Checkout/Block/Cart/Link.php @@ -34,16 +34,24 @@ class Link extends \Magento\View\Element\Html\Link */ protected $_moduleManager; + /** + * @var \Magento\Checkout\Helper\Cart + */ + protected $_cartHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Module\Manager $moduleManager + * @param \Magento\Checkout\Helper\Cart $cartHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Module\Manager $moduleManager, + \Magento\Checkout\Helper\Cart $cartHelper, array $data = array() ) { + $this->_cartHelper = $cartHelper; parent::__construct($context, $data); $this->_moduleManager = $moduleManager; } @@ -85,7 +93,7 @@ class Link extends \Magento\View\Element\Html\Link protected function _getItemCount() { $count = $this->getSummaryQty(); - return $count ? $count : $this->helper('Magento\Checkout\Helper\Cart')->getSummaryCount(); + return $count ? $count : $this->_cartHelper->getSummaryCount(); } /** diff --git a/app/code/Magento/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php index 69db0dc5968..26d092f3697 100644 --- a/app/code/Magento/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php @@ -52,12 +52,18 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart */ protected $_directoryBlock; + /** + * @var \Magento\Tax\Helper\Data + */ + protected $_taxHelper; + /** * @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 \Magento\Directory\Block\Data $directoryBlock + * @param \Magento\Tax\Helper\Data $taxHelper * @param array $data */ public function __construct( @@ -66,8 +72,10 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Directory\Block\Data $directoryBlock, + \Magento\Tax\Helper\Data $taxHelper, array $data = array() ) { + $this->_taxHelper = $taxHelper; $this->_directoryBlock = $directoryBlock; parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); } @@ -235,7 +243,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart */ public function getShippingPrice($price, $flag) { - return $this->formatPrice($this->helper('Magento\Tax\Helper\Data')->getShippingPrice( + return $this->formatPrice($this->_taxHelper->getShippingPrice( $price, $flag, $this->getAddress(), diff --git a/app/code/Magento/Checkout/Block/Cart/Sidebar.php b/app/code/Magento/Checkout/Block/Cart/Sidebar.php index 987a42c6271..32807c3eb69 100644 --- a/app/code/Magento/Checkout/Block/Cart/Sidebar.php +++ b/app/code/Magento/Checkout/Block/Cart/Sidebar.php @@ -60,6 +60,16 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart */ protected $_checkoutCart; + /** + * @var \Magento\Checkout\Helper\Data + */ + protected $_checkoutHelper; + + /** + * @var \Magento\Checkout\Helper\Url + */ + protected $_urlHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Catalog\Helper\Data $catalogData @@ -69,7 +79,11 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Tax\Model\Config $taxConfig * @param \Magento\Checkout\Model\Cart $checkoutCart + * @param \Magento\Checkout\Helper\Data $checkoutHelper + * @param \Magento\Checkout\Helper\Url $urlHelper * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -80,8 +94,12 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Tax\Model\Config $taxConfig, \Magento\Checkout\Model\Cart $checkoutCart, + \Magento\Checkout\Helper\Data $checkoutHelper, + \Magento\Checkout\Helper\Url $urlHelper, array $data = array() ) { + $this->_urlHelper = $urlHelper; + $this->_checkoutHelper = $checkoutHelper; $this->_taxData = $taxData; $this->_catalogUrl = $catalogUrl; $this->_taxConfig = $taxConfig; @@ -251,7 +269,7 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart */ public function isPossibleOnepageCheckout() { - return $this->helper('Magento\Checkout\Helper\Data')->canOnepageCheckout() && !$this->getQuote()->getHasError(); + return $this->_checkoutHelper->canOnepageCheckout() && !$this->getQuote()->getHasError(); } /** @@ -261,7 +279,7 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart */ public function getCheckoutUrl() { - return $this->helper('Magento\Checkout\Helper\Url')->getCheckoutUrl(); + return $this->_urlHelper->getCheckoutUrl(); } /** diff --git a/app/code/Magento/Checkout/Block/Link.php b/app/code/Magento/Checkout/Block/Link.php index 514e179730e..6e549ee9cc8 100644 --- a/app/code/Magento/Checkout/Block/Link.php +++ b/app/code/Magento/Checkout/Block/Link.php @@ -34,16 +34,24 @@ class Link extends \Magento\View\Element\Html\Link */ protected $_moduleManager; + /** + * @var \Magento\Checkout\Helper\Data + */ + protected $_checkoutHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Module\Manager $moduleManager + * @param \Magento\Checkout\Helper\Data $checkoutHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Module\Manager $moduleManager, + \Magento\Checkout\Helper\Data $checkoutHelper, array $data = array() ) { + $this->_checkoutHelper = $checkoutHelper; parent::__construct($context, $data); $this->_moduleManager = $moduleManager; } @@ -63,7 +71,7 @@ class Link extends \Magento\View\Element\Html\Link */ protected function _toHtml() { - if (!$this->helper('Magento\Checkout\Helper\Data')->canOnepageCheckout() + if (!$this->_checkoutHelper->canOnepageCheckout() || !$this->_moduleManager->isOutputEnabled('Magento_Checkout') ) { return ''; diff --git a/app/code/Magento/Checkout/Block/Multishipping/Billing.php b/app/code/Magento/Checkout/Block/Multishipping/Billing.php index b20101e87c1..dbd4b1214b8 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Billing.php +++ b/app/code/Magento/Checkout/Block/Multishipping/Billing.php @@ -47,19 +47,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\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\Checkout\Model\Session $checkoutSession, array $data = array() ) { $this->_multishipping = $multishipping; $this->_checkoutSession = $checkoutSession; - parent::__construct($context, $data); + parent::__construct($context, $paymentHelper, $data); } /** diff --git a/app/code/Magento/Checkout/Block/Multishipping/Overview.php b/app/code/Magento/Checkout/Block/Multishipping/Overview.php index c802ed645d5..22cff2ccb57 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Overview.php +++ b/app/code/Magento/Checkout/Block/Multishipping/Overview.php @@ -45,16 +45,24 @@ class Overview extends \Magento\Sales\Block\Items\AbstractItems */ protected $_multishipping; + /** + * @var \Magento\Tax\Helper\Data + */ + protected $_taxHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Checkout\Model\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\Tax\Helper\Data $taxHelper, array $data = array() ) { + $this->_taxHelper = $taxHelper; $this->_multishipping = $multishipping; parent::__construct($context, $data); } @@ -335,7 +343,7 @@ class Overview extends \Magento\Sales\Block\Items\AbstractItems public function renderTotals($totals, $colspan = null) { if ($colspan === null) { - $colspan = $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices() ? 5 : 3; + $colspan = $this->_taxHelper->displayCartBothPrices() ? 5 : 3; } $totals = $this->getChildBlock('totals')->setTotals($totals)->renderTotals('', $colspan) . $this->getChildBlock('totals')->setTotals($totals)->renderTotals('footer', $colspan); diff --git a/app/code/Magento/Checkout/Block/Multishipping/Shipping.php b/app/code/Magento/Checkout/Block/Multishipping/Shipping.php index 0296a7268da..524c87b9200 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Shipping.php +++ b/app/code/Magento/Checkout/Block/Multishipping/Shipping.php @@ -40,18 +40,26 @@ class Shipping extends \Magento\Sales\Block\Items\AbstractItems */ protected $_filterGridFactory; + /** + * @var \Magento\Tax\Helper\Data + */ + protected $_taxHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Filter\Object\GridFactory $filterGridFactory * @param \Magento\Checkout\Model\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\Tax\Helper\Data $taxHelper, array $data = array() ) { + $this->_taxHelper = $taxHelper; $this->_filterGridFactory = $filterGridFactory; $this->_multishipping = $multishipping; parent::__construct($context, $data); @@ -146,6 +154,6 @@ class Shipping extends \Magento\Sales\Block\Items\AbstractItems public function getShippingPrice($address, $price, $flag) { - return $address->getQuote()->getStore()->convertPrice($this->helper('Magento\Tax\Helper\Data')->getShippingPrice($price, $flag, $address), true); + return $address->getQuote()->getStore()->convertPrice($this->_taxHelper->getShippingPrice($price, $flag, $address), true); } } diff --git a/app/code/Magento/Checkout/Block/Onepage/Link.php b/app/code/Magento/Checkout/Block/Onepage/Link.php index 8dc1f7aed72..e75c1024fb6 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Link.php +++ b/app/code/Magento/Checkout/Block/Onepage/Link.php @@ -40,16 +40,24 @@ class Link extends \Magento\View\Element\Template */ protected $_checkoutSession; + /** + * @var \Magento\Checkout\Helper\Data + */ + protected $_checkoutHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Checkout\Helper\Data $checkoutHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Checkout\Helper\Data $checkoutHelper, array $data = array() ) { + $this->_checkoutHelper = $checkoutHelper; $this->_checkoutSession = $checkoutSession; parent::__construct($context, $data); } @@ -75,6 +83,6 @@ class Link extends \Magento\View\Element\Template */ public function isPossibleOnepageCheckout() { - return $this->helper('Magento\Checkout\Helper\Data')->canOnepageCheckout(); + return $this->_checkoutHelper->canOnepageCheckout(); } } diff --git a/app/code/Magento/Checkout/Block/Onepage/Login.php b/app/code/Magento/Checkout/Block/Onepage/Login.php index 014b453f18c..06964ac102a 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Login.php +++ b/app/code/Magento/Checkout/Block/Onepage/Login.php @@ -43,6 +43,11 @@ class Login extends \Magento\Checkout\Block\Onepage\AbstractOnepage */ protected $_checkoutData = null; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Helper\Data $coreData @@ -52,6 +57,7 @@ class Login extends \Magento\Checkout\Block\Onepage\AbstractOnepage * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory * @param \Magento\Checkout\Helper\Data $checkoutData + * @param \Magento\Message\ManagerInterface $messageManager * @param array $data */ public function __construct( @@ -63,10 +69,12 @@ class Login extends \Magento\Checkout\Block\Onepage\AbstractOnepage \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory, \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, \Magento\Checkout\Helper\Data $checkoutData, + \Magento\Message\ManagerInterface $messageManager, array $data = array() ) { $this->_checkoutData = $checkoutData; + $this->messageManager = $messageManager; parent::__construct( $context, $coreData, @@ -89,7 +97,7 @@ class Login extends \Magento\Checkout\Block\Onepage\AbstractOnepage public function getMessages() { - return $this->_customerSession->getMessages(true); + return $this->messageManager->getMessages(true); } public function getPostAction() diff --git a/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php b/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php index d3fe6ff7250..53df60c3097 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php +++ b/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php @@ -43,16 +43,18 @@ class Methods extends \Magento\Payment\Block\Form\Container /** * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Payment\Helper\Data $paymentHelper * @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\Session $checkoutSession, array $data = array() ) { $this->_checkoutSession = $checkoutSession; - parent::__construct($context, $data); + parent::__construct($context, $paymentHelper, $data); } /** diff --git a/app/code/Magento/Checkout/Controller/Action.php b/app/code/Magento/Checkout/Controller/Action.php index 134ef1794b1..ea1a2c5f0a7 100644 --- a/app/code/Magento/Checkout/Controller/Action.php +++ b/app/code/Magento/Checkout/Controller/Action.php @@ -65,7 +65,7 @@ abstract class Action extends \Magento\App\Action\Action if ((true !== $validationResult) && is_array($validationResult)) { if ($addErrors) { foreach ($validationResult as $error) { - $this->_customerSession->addError($error); + $this->messageManager->addError($error); } } if ($redirect) { diff --git a/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php b/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php index 533ad31afa8..05a58fea136 100644 --- a/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php +++ b/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php @@ -56,7 +56,6 @@ class Agreement extends \Magento\Backend\App\Action $this->_view->getLayout()->createBlock('Magento\Checkout\Block\Adminhtml\Agreement') ); $this->_view->renderLayout(); - return $this; } public function newAction() @@ -74,9 +73,7 @@ class Agreement extends \Magento\Backend\App\Action if ($id) { $agreementModel->load($id); if (!$agreementModel->getId()) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('This condition no longer exists.') - ); + $this->messageManager->addError(__('This condition no longer exists.')); $this->_redirect('checkout/*/'); return; } @@ -84,7 +81,7 @@ class Agreement extends \Magento\Backend\App\Action $this->_title->add($agreementModel->getId() ? $agreementModel->getName() : __('New Condition')); - $data = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getAgreementData(true); + $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getAgreementData(true); if (!empty($data)) { $agreementModel->setData($data); } @@ -114,17 +111,17 @@ class Agreement extends \Magento\Backend\App\Action try { $model->save(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('The condition has been saved.')); + $this->messageManager->addSuccess(__('The condition has been saved.')); $this->_redirect('checkout/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('Something went wrong while saving this condition.')); + $this->messageManager->addError(__('Something went wrong while saving this condition.')); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setAgreementData($postData); + $this->_objectManager->get('Magento\Backend\Model\Session')->setAgreementData($postData); $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); } } @@ -135,20 +132,20 @@ class Agreement extends \Magento\Backend\App\Action $model = $this->_objectManager->get('Magento\Checkout\Model\Agreement') ->load($id); if (!$model->getId()) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('This condition no longer exists.')); + $this->messageManager->addError(__('This condition no longer exists.')); $this->_redirect('checkout/*/'); return; } try { $model->delete(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('The condition has been deleted.')); + $this->messageManager->addSuccess(__('The condition has been deleted.')); $this->_redirect('checkout/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('Something went wrong while deleting this condition.')); + $this->messageManager->addError(__('Something went wrong while deleting this condition.')); } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); diff --git a/app/code/Magento/Checkout/Controller/Cart.php b/app/code/Magento/Checkout/Controller/Cart.php index abc32c9735e..b20c725d99c 100644 --- a/app/code/Magento/Checkout/Controller/Cart.php +++ b/app/code/Magento/Checkout/Controller/Cart.php @@ -48,6 +48,11 @@ class Cart */ protected $_storeManager; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\App\Action\Context $context * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig @@ -95,7 +100,7 @@ class Cart { $returnUrl = $this->getRequest()->getParam('return_url'); if ($returnUrl && $this->_isInternalUrl($returnUrl)) { - $this->_checkoutSession->getMessages(true); + $this->messageManager->getMessages()->clear(); $this->getResponse()->setRedirect($returnUrl); } elseif (!$this->_storeConfig->getConfig('checkout/cart/redirect_to_cart') && !$this->getRequest()->getParam('in_cart') @@ -152,20 +157,21 @@ class Cart ? $this->_storeConfig->getConfig('sales/minimum_order/description') : __('Minimum order amount is %1', $minimumAmount); - $cart->getCheckoutSession()->addNotice($warning); + $this->messageManager->addNotice($warning); } } // Compose array of messages to add $messages = array(); + /** @var \Magento\Message\MessageInterface $message */ foreach ($cart->getQuote()->getMessages() as $message) { if ($message) { // Escape HTML entities in quote message to prevent XSS - $message->setCode($this->_objectManager->get('Magento\Escaper')->escapeHtml($message->getCode())); + $message->setText($this->_objectManager->get('Magento\Escaper')->escapeHtml($message->getText())); $messages[] = $message; } } - $cart->getCheckoutSession()->addUniqueMessages($messages); + $this->messageManager->addUniqueMessages($messages); /** * if customer enteres shopping cart we should mark quote @@ -174,11 +180,10 @@ class Cart $this->_checkoutSession->setCartWasUpdated(true); \Magento\Profiler::start(__METHOD__ . 'cart_display'); - $messageStores = array('Magento\Checkout\Model\Session', 'Magento\Catalog\Model\Session'); $this->_view->loadLayout(); $layout = $this->_view->getLayout(); - $layout->initMessages($messageStores); + $layout->initMessages(); $layout->getBlock('head')->setTitle(__('Shopping Cart')); $this->_view->renderLayout(); \Magento\Profiler::stop(__METHOD__ . 'cart_display'); @@ -229,17 +234,19 @@ class Cart if (!$this->_checkoutSession->getNoCartRedirect(true)) { if (!$cart->getQuote()->getHasError()){ $message = __('You added %1 to your shopping cart.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getName())); - $this->_checkoutSession->addSuccess($message); + $this->messageManager->addSuccess($message); } $this->_goBack(); } } catch (\Magento\Core\Exception $e) { if ($this->_checkoutSession->getUseNotice(true)) { - $this->_checkoutSession->addNotice($this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage())); + $this->messageManager->addNotice( + $this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage()) + ); } else { $messages = array_unique(explode("\n", $e->getMessage())); foreach ($messages as $message) { - $this->_checkoutSession->addError( + $this->messageManager->addError( $this->_objectManager->get('Magento\Escaper')->escapeHtml($message) ); } @@ -253,7 +260,7 @@ class Cart $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($cartUrl)); } } catch (\Exception $e) { - $this->_checkoutSession->addException($e, __('We cannot add this item to your shopping cart')); + $this->messageManager->addException($e, __('We cannot add this item to your shopping cart')); $this->_objectManager->get('Magento\Logger')->logException($e); $this->_goBack(); } @@ -274,12 +281,12 @@ class Cart $cart->addOrderItem($item, 1); } catch (\Magento\Core\Exception $e) { if ($this->_checkoutSession->getUseNotice(true)) { - $this->_checkoutSession->addNotice($e->getMessage()); + $this->messageManager->addNotice($e->getMessage()); } else { - $this->_checkoutSession->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } } catch (\Exception $e) { - $this->_checkoutSession->addException($e, __('We cannot add this item to your shopping cart')); + $this->messageManager->addException($e, __('We cannot add this item to your shopping cart')); $this->_objectManager->get('Magento\Logger')->logException($e); $this->_goBack(); } @@ -304,7 +311,7 @@ class Cart } if (!$quoteItem) { - $this->_checkoutSession->addError(__("We can't find the quote item.")); + $this->messageManager->addError(__("We can't find the quote item.")); $this->_redirect('checkout/cart'); return; } @@ -319,7 +326,7 @@ class Cart $quoteItem->getProduct()->getId(), $this, $params ); } catch (\Exception $e) { - $this->_checkoutSession->addError(__('We cannot configure the product.')); + $this->messageManager->addError(__('We cannot configure the product.')); $this->_objectManager->get('Magento\Logger')->logException($e); $this->_goBack(); return; @@ -373,18 +380,21 @@ class Cart ); if (!$this->_checkoutSession->getNoCartRedirect(true)) { if (!$cart->getQuote()->getHasError()){ - $message = __('%1 was updated in your shopping cart.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($item->getProduct()->getName())); - $this->_checkoutSession->addSuccess($message); + $message = __( + '%1 was updated in your shopping cart.', + $this->_objectManager->get('Magento\Escaper')->escapeHtml($item->getProduct()->getName()) + ); + $this->messageManager->addSuccess($message); } $this->_goBack(); } } catch (\Magento\Core\Exception $e) { if ($this->_checkoutSession->getUseNotice(true)) { - $this->_checkoutSession->addNotice($e->getMessage()); + $this->messageManager->addNotice($e->getMessage()); } else { $messages = array_unique(explode("\n", $e->getMessage())); foreach ($messages as $message) { - $this->_checkoutSession->addError($message); + $this->messageManager->addError($message); } } @@ -396,7 +406,7 @@ class Cart $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($cartUrl)); } } catch (\Exception $e) { - $this->_checkoutSession->addException($e, __('We cannot update the item.')); + $this->messageManager->addException($e, __('We cannot update the item.')); $this->_objectManager->get('Magento\Logger')->logException($e); $this->_goBack(); } @@ -451,9 +461,9 @@ class Cart } $this->_checkoutSession->setCartWasUpdated(true); } catch (\Magento\Core\Exception $e) { - $this->_checkoutSession->addError($this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage())); + $this->messageManager->addError($this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage())); } catch (\Exception $e) { - $this->_checkoutSession->addException($e, __('We cannot update the shopping cart.')); + $this->messageManager->addException($e, __('We cannot update the shopping cart.')); $this->_objectManager->get('Magento\Logger')->logException($e); } } @@ -467,9 +477,9 @@ class Cart $this->_getCart()->truncate()->save(); $this->_checkoutSession->setCartWasUpdated(true); } catch (\Magento\Core\Exception $exception) { - $this->_checkoutSession->addError($exception->getMessage()); + $this->messageManager->addError($exception->getMessage()); } catch (\Exception $exception) { - $this->_checkoutSession->addException($exception, __('We cannot update the shopping cart.')); + $this->messageManager->addException($exception, __('We cannot update the shopping cart.')); } } @@ -484,7 +494,7 @@ class Cart $this->_getCart()->removeItem($id) ->save(); } catch (\Exception $e) { - $this->_checkoutSession->addError(__('We cannot remove the item.')); + $this->messageManager->addError(__('We cannot remove the item.')); $this->_objectManager->get('Magento\Logger')->logException($e); } } @@ -557,22 +567,28 @@ class Cart if ($codeLength) { if ($isCodeLengthValid && $couponCode == $this->_getQuote()->getCouponCode()) { - $this->_checkoutSession->addSuccess( - __('The coupon code "%1" was applied.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($couponCode)) + $this->messageManager->addSuccess( + __( + 'The coupon code "%1" was applied.', + $this->_objectManager->get('Magento\Escaper')->escapeHtml($couponCode) + ) ); } else { - $this->_checkoutSession->addError( - __('The coupon code "%1" is not valid.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($couponCode)) + $this->messageManager->addError( + __( + 'The coupon code "%1" is not valid.', + $this->_objectManager->get('Magento\Escaper')->escapeHtml($couponCode) + ) ); } } else { - $this->_checkoutSession->addSuccess(__('The coupon code was canceled.')); + $this->messageManager->addSuccess(__('The coupon code was canceled.')); } } catch (\Magento\Core\Exception $e) { - $this->_checkoutSession->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_checkoutSession->addError(__('We cannot apply the coupon code.')); + $this->messageManager->addError(__('We cannot apply the coupon code.')); $this->_objectManager->get('Magento\Logger')->logException($e); } diff --git a/app/code/Magento/Checkout/Controller/Multishipping.php b/app/code/Magento/Checkout/Controller/Multishipping.php index cc24334a6ee..3b9a4a0b35b 100644 --- a/app/code/Magento/Checkout/Controller/Multishipping.php +++ b/app/code/Magento/Checkout/Controller/Multishipping.php @@ -95,12 +95,12 @@ class Multishipping extends \Magento\Checkout\Controller\Action parent::__construct($context, $customerSession); $this->_urlBuilder = $urlBuilder; } - + /** * Dispatch request * * @param RequestInterface $request - * @return $this|mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { @@ -136,7 +136,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action if (!$this->_objectManager->get('Magento\Checkout\Helper\Data')->isMultishippingCheckoutAvailable()) { $error = $this->_getCheckout()->getMinimumAmountError(); - $this->_getCheckoutSession()->addError($error); + $this->messageManager->addError($error); $this->getResponse()->setRedirect($this->_getHelper()->getCartUrl()); $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); return parent::dispatch($request); @@ -144,7 +144,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action } if (!$this->_preDispatchValidateCustomer()) { - return $this; + return $this->getResponse(); } if ($this->_getCheckoutSession()->getCartWasUpdated(true) @@ -188,10 +188,10 @@ class Multishipping extends \Magento\Checkout\Controller\Action } $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); // set account create url - $loginForm = $this->_view->getLayout()->getBlock('customer_form_login'); + $loginForm = $this->_view->getLayout()->getBlock('customer.new'); if ($loginForm) { $loginForm->setCreateAccountUrl($this->_getHelper()->getMSRegisterUrl()); } @@ -209,7 +209,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action } $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); $registerForm = $this->_view->getLayout()->getBlock('customer_form_register'); if ($registerForm) { @@ -242,11 +242,10 @@ class Multishipping extends \Magento\Checkout\Controller\Action ); if (!$this->_getCheckout()->validateMinimumAmount()) { $message = $this->_getCheckout()->getMinimumAmountDescription(); - $this->_getCheckout()->getCheckoutSession()->addNotice($message); + $this->messageManager->addNotice($message); } $this->_view->loadLayout(); - $messageStores = array('Magento\Customer\Model\Session', 'Magento\Checkout\Model\Session'); - $this->_view->getLayout()->initMessages($messageStores); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -278,10 +277,10 @@ class Multishipping extends \Magento\Checkout\Controller\Action $this->_getCheckout()->setShippingItemsInformation($shipToInfo); } } catch (\Magento\Core\Exception $e) { - $this->_getCheckoutSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/addresses'); } catch (\Exception $e) { - $this->_getCheckoutSession()->addException( + $this->messageManager->addException( $e, __('Data saving problem') ); @@ -323,7 +322,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action { if (!$this->_getCheckout()->validateMinimumAmount()) { $error = $this->_getCheckout()->getMinimumAmountError(); - $this->_getCheckout()->getCheckoutSession()->addError($error); + $this->messageManager->addError($error); $this->_forward('backToAddresses'); return false; } @@ -340,16 +339,14 @@ class Multishipping extends \Magento\Checkout\Controller\Action } if (!$this->_getState()->getCompleteStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_SELECT_ADDRESSES)) { - $this->_redirect('*/*/addresses'); - return $this; + return $this->_redirect('*/*/addresses'); } $this->_getState()->setActiveStep( \Magento\Checkout\Model\Type\Multishipping\State::STEP_SHIPPING ); $this->_view->loadLayout(); - $messageStores = array('Magento\Customer\Model\Session', 'Magento\Checkout\Model\Session'); - $this->_view->getLayout()->initMessages($messageStores); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -381,7 +378,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action ); $this->_redirect('*/*/billing'); } catch (\Exception $e) { - $this->_getCheckoutSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/shipping'); } } @@ -400,8 +397,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action } if (!$this->_getState()->getCompleteStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_SHIPPING)) { - $this->_redirect('*/*/shipping'); - return $this; + return $this->_redirect('*/*/shipping'); } $this->_getState()->setActiveStep( @@ -409,8 +405,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action ); $this->_view->loadLayout(); - $messageStores = array('Magento\Customer\Model\Session', 'Magento\Checkout\Model\Session'); - $this->_view->getLayout()->initMessages($messageStores); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -448,7 +443,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action public function overviewAction() { if (!$this->_validateMinimumAmount()) { - return $this; + return; } $this->_getState()->setActiveStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_OVERVIEW); @@ -467,15 +462,14 @@ class Multishipping extends \Magento\Checkout\Controller\Action ); $this->_view->loadLayout(); - $messageStores = array('Magento\Customer\Model\Session', 'Magento\Checkout\Model\Session'); - $this->_view->getLayout()->initMessages($messageStores); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } catch (\Magento\Core\Exception $e) { - $this->_getCheckoutSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/billing'); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getCheckoutSession()->addException($e, __('We cannot open the overview page.')); + $this->messageManager->addException($e, __('We cannot open the overview page.')); $this->_redirect('*/*/billing'); } } @@ -495,7 +489,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array())); $diff = array_diff($requiredAgreements, $postedAgreements); if ($diff) { - $this->_getCheckoutSession()->addError( + $this->messageManager->addError( __('Please agree to all Terms and Conditions before placing the order.') ); $this->_redirect('*/*/billing'); @@ -524,25 +518,25 @@ class Multishipping extends \Magento\Checkout\Controller\Action } catch (\Magento\Payment\Model\Info\Exception $e) { $message = $e->getMessage(); if (!empty($message)) { - $this->_getCheckoutSession()->addError($message); + $this->messageManager->addError($message); } $this->_redirect('*/*/billing'); } catch (\Magento\Checkout\Exception $e) { $this->_objectManager->get('Magento\Checkout\Helper\Data') ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping'); $this->_getCheckout()->getCheckoutSession()->clearQuote(); - $this->_getCheckoutSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('*/cart'); } catch (\Magento\Core\Exception $e) { $this->_objectManager->get('Magento\Checkout\Helper\Data') ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping'); - $this->_getCheckoutSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/billing'); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); $this->_objectManager->get('Magento\Checkout\Helper\Data') ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping'); - $this->_getCheckoutSession()->addError(__('Order place error')); + $this->messageManager->addError(__('Order place error')); $this->_redirect('*/*/billing'); } } @@ -554,11 +548,11 @@ class Multishipping extends \Magento\Checkout\Controller\Action { if (!$this->_getState()->getCompleteStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_OVERVIEW)) { $this->_redirect('*/*/addresses'); - return $this; + return; } $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Checkout\Model\Session'); + $this->_view->getLayout()->initMessages(); $ids = $this->_getCheckout()->getOrderIds(); $this->_eventManager->dispatch('checkout_multishipping_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/Checkout/Controller/Multishipping/Address.php index 7bf410342f9..af3ddc5631c 100644 --- a/app/code/Magento/Checkout/Controller/Multishipping/Address.php +++ b/app/code/Magento/Checkout/Controller/Multishipping/Address.php @@ -63,7 +63,7 @@ class Address extends \Magento\App\Action\Action { $this->_getState()->setActiveStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_SELECT_ADDRESSES); $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); if ($addressForm = $this->_view->getLayout()->getBlock('customer_address_edit')) { $addressForm->setTitle(__('Create Shipping Address')) ->setSuccessUrl($this->_url->getUrl('*/*/shippingSaved')) @@ -97,7 +97,7 @@ class Address extends \Magento\App\Action\Action { $this->_getState()->setActiveStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_SHIPPING); $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); if ($addressForm = $this->_view->getLayout()->getBlock('customer_address_edit')) { $addressForm->setTitle(__('Edit Shipping Address')) ->setSuccessUrl($this->_url->getUrl('*/*/editShippingPost', array('id'=>$this->getRequest()->getParam('id')))) @@ -127,15 +127,14 @@ class Address extends \Magento\App\Action\Action { $this->_getState()->setActiveStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_BILLING); $this->_view->loadLayout(); - $messageStores = array('Magento\Customer\Model\Session', 'Magento\Catalog\Model\Session'); - $this->_view->getLayout()->initMessages($messageStores); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } public function newBillingAction() { $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); if ($addressForm = $this->_view->getLayout()->getBlock('customer_address_edit')) { $addressForm->setTitle(__('Create Billing Address')) ->setSuccessUrl($this->_url->getUrl('*/*/selectBilling')) @@ -152,7 +151,7 @@ class Address extends \Magento\App\Action\Action public function editAddressAction() { $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); if ($addressForm = $this->_view->getLayout()->getBlock('customer_address_edit')) { $addressForm->setTitle(__('Edit Address')) ->setSuccessUrl($this->_url->getUrl('*/*/selectBilling')) @@ -172,7 +171,7 @@ class Address extends \Magento\App\Action\Action \Magento\Checkout\Model\Type\Multishipping\State::STEP_BILLING ); $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); if ($addressForm = $this->_view->getLayout()->getBlock('customer_address_edit')) { $addressForm->setTitle(__('Edit Billing Address')) ->setSuccessUrl($this->_url->getUrl('*/*/saveBilling', array('id'=>$this->getRequest()->getParam('id')))) diff --git a/app/code/Magento/Checkout/Controller/Onepage.php b/app/code/Magento/Checkout/Controller/Onepage.php index cda03409c4f..a4c77489187 100644 --- a/app/code/Magento/Checkout/Controller/Onepage.php +++ b/app/code/Magento/Checkout/Controller/Onepage.php @@ -70,7 +70,7 @@ class Onepage extends \Magento\Checkout\Controller\Action * Dispatch request * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface * @throws \Magento\App\Action\NotFoundException */ public function dispatch(RequestInterface $request) @@ -198,7 +198,7 @@ class Onepage extends \Magento\Checkout\Controller\Action public function indexAction() { if (!$this->_objectManager->get('Magento\Checkout\Helper\Data')->canOnepageCheckout()) { - $this->_objectManager->get('Magento\Checkout\Model\Session')->addError(__('The onepage checkout is disabled.')); + $this->messageManager->addError(__('The onepage checkout is disabled.')); $this->_redirect('checkout/cart'); return; } @@ -212,7 +212,7 @@ class Onepage extends \Magento\Checkout\Controller\Action $this->_objectManager->get('Magento\Core\Model\Store\Config')->getConfig('sales/minimum_order/error_message') : __('Subtotal must exceed minimum order amount'); - $this->_objectManager->get('Magento\Checkout\Model\Session')->addError($error); + $this->messageManager->addError($error); $this->_redirect('checkout/cart'); return; } @@ -223,7 +223,7 @@ class Onepage extends \Magento\Checkout\Controller\Action $this->getOnepage()->initCheckout(); $this->_view->loadLayout(); $layout = $this->_view->getLayout(); - $layout->initMessages('Magento\Customer\Model\Session'); + $layout->initMessages(); $layout->getBlock('head')->setTitle(__('Checkout')); $this->_view->renderLayout(); } @@ -282,9 +282,10 @@ class Onepage extends \Magento\Checkout\Controller\Action $session->clearQuote(); $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Checkout\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_eventManager->dispatch( - 'checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)) + 'checkout_onepage_controller_success_action', + array('order_ids' => array($lastOrderId)) ); $this->_view->renderLayout(); } diff --git a/app/code/Magento/Checkout/Model/Cart.php b/app/code/Magento/Checkout/Model/Cart.php index 8ec67fb6c1d..a921cb2464d 100644 --- a/app/code/Magento/Checkout/Model/Cart.php +++ b/app/code/Magento/Checkout/Model/Cart.php @@ -89,9 +89,9 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI protected $_customerSession; /** - * @var \Magento\Message\Factory + * @var \Magento\Message\ManagerInterface */ - protected $messageFactory; + protected $messageManager; /** * @param \Magento\Event\ManagerInterface $eventManager @@ -101,7 +101,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI * @param \Magento\Checkout\Model\Resource\Cart $resourceCart * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Message\Factory $messageFactory + * @param \Magento\Message\ManagerInterface $messageManager * @param array $data */ public function __construct( @@ -112,7 +112,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI \Magento\Checkout\Model\Resource\Cart $resourceCart, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Customer\Model\Session $customerSession, - \Magento\Message\Factory $messageFactory, + \Magento\Message\ManagerInterface $messageManager, array $data = array() ) { $this->_eventManager = $eventManager; @@ -122,7 +122,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI $this->_resourceCart = $resourceCart; $this->_checkoutSession = $checkoutSession; $this->_customerSession = $customerSession; - $this->messageFactory = $messageFactory; + $this->messageManager = $messageManager; parent::__construct($data); } @@ -241,7 +241,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI * @param mixed $qtyFlag if is null set product qty like in order * @return \Magento\Checkout\Model\Cart */ - public function addOrderItem($orderItem, $qtyFlag=null) + public function addOrderItem($orderItem, $qtyFlag = null) { /* @var $orderItem \Magento\Sales\Model\Order\Item */ if (is_null($orderItem->getParentItem())) { @@ -324,7 +324,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI * @return \Magento\Checkout\Model\Cart * @throws \Magento\Core\Exception */ - public function addProduct($productInfo, $requestInfo=null) + public function addProduct($productInfo, $requestInfo = null) { $product = $this->_getProduct($productInfo); $request = $this->_getProductRequest($requestInfo); @@ -334,9 +334,11 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI if ($product->getStockItem()) { $minimumQty = $product->getStockItem()->getMinSaleQty(); //If product was not found in cart and there is set minimal qty for it - if ($minimumQty && $minimumQty > 0 && $request->getQty() < $minimumQty + if ($minimumQty + && $minimumQty > 0 + && $request->getQty() < $minimumQty && !$this->getQuote()->hasProductId($productId) - ){ + ) { $request->setQty($minimumQty); } } @@ -397,7 +399,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI if ($product->getId() && $product->isVisibleInCatalog()) { try { $this->getQuote()->addProduct($product); - } catch (\Exception $e){ + } catch (\Exception $e) { $allAdded = false; } } else { @@ -406,14 +408,10 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI } if (!$allAvailable) { - $this->_checkoutSession->addError( - __("We don't have some of the products you want.") - ); + $this->messageManager->addError(__("We don't have some of the products you want.")); } if (!$allAdded) { - $this->_checkoutSession->addError( - __("We don't have as many of some products as you want.") - ); + $this->messageManager->addError(__("We don't have as many of some products as you want.")); } } return $this; @@ -474,7 +472,6 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI { $this->_eventManager->dispatch('checkout_cart_update_items_before', array('cart'=>$this, 'info'=>$data)); - $session = $this->_checkoutSession; $qtyRecalculatedFlag = false; foreach ($data as $itemId => $itemInfo) { $item = $this->getQuote()->getItemById($itemId); @@ -499,21 +496,21 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI if (isset($itemInfo['before_suggest_qty']) && ($itemInfo['before_suggest_qty'] != $qty)) { $qtyRecalculatedFlag = true; - $message = $this->messageFactory->notice( - __('Quantity was recalculated from %1 to %2', $itemInfo['before_suggest_qty'], $qty) + $this->messageManager->addNotice( + __('Quantity was recalculated from %1 to %2', $itemInfo['before_suggest_qty'], $qty), + 'quote_item' . $item->getId() ); - $session->addQuoteItemMessage($item->getId(), $message); } } } if ($qtyRecalculatedFlag) { - $session->addNotice( + $this->messageManager->addNotice( __('Some products quantities were recalculated because of quantity increment mismatch.') ); } - $this->_eventManager->dispatch('checkout_cart_update_items_after', array('cart'=>$this, 'info'=>$data)); + $this->_eventManager->dispatch('checkout_cart_update_items_after', array('cart' => $this, 'info' => $data)); return $this; } diff --git a/app/code/Magento/Checkout/Model/Observer.php b/app/code/Magento/Checkout/Model/Observer.php index f01ad4cd352..6bb6e434cba 100644 --- a/app/code/Magento/Checkout/Model/Observer.php +++ b/app/code/Magento/Checkout/Model/Observer.php @@ -40,12 +40,21 @@ class Observer */ protected $_checkoutSession; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Message\ManagerInterface $messageManager */ - public function __construct(\Magento\Checkout\Model\Session $checkoutSession) - { + public function __construct( + \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Message\ManagerInterface $messageManager + ) { $this->_checkoutSession = $checkoutSession; + $this->messageManager = $messageManager; } public function unsetAll() @@ -57,15 +66,10 @@ class Observer { try { $this->_checkoutSession->loadCustomerQuote(); - } - catch (\Magento\Core\Exception $e) { - $this->_checkoutSession->addError($e->getMessage()); - } - catch (\Exception $e) { - $this->_checkoutSession->addException( - $e, - __('Load customer quote error') - ); + } catch (\Magento\Core\Exception $e) { + $this->messageManager->addError($e->getMessage()); + } catch (\Exception $e) { + $this->messageManager->addException($e, __('Load customer quote error')); } } diff --git a/app/code/Magento/Checkout/Model/Session.php b/app/code/Magento/Checkout/Model/Session.php index c6ae9a38b3b..e104753418e 100644 --- a/app/code/Magento/Checkout/Model/Session.php +++ b/app/code/Magento/Checkout/Model/Session.php @@ -24,17 +24,19 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Checkout\Model; -class Session extends \Magento\Core\Model\Session\AbstractSession +class Session extends \Magento\Session\SessionManager { + /** + * Checkout state begin + */ const CHECKOUT_STATE_BEGIN = 'begin'; /** * Quote instance * - * @var null|\Magento\Sales\Model\Quote + * @var \Magento\Sales\Model\Quote */ protected $_quote; @@ -80,33 +82,53 @@ class Session extends \Magento\Core\Model\Session\AbstractSession protected $_remoteAddress; /** - * @param \Magento\Core\Model\Session\Context $context + * @var \Magento\Event\ManagerInterface + */ + protected $_eventManager; + + /** + * @var \Magento\Core\Model\StoreManagerInterface + */ + protected $_storeManager; + + /** + * @param \Magento\App\RequestInterface $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig + * @param \Magento\Session\SaveHandlerInterface $saveHandler + * @param \Magento\Session\ValidatorInterface $validator + * @param \Magento\Session\StorageInterface $storage * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param null $sessionName - * @param array $data */ public function __construct( - \Magento\Core\Model\Session\Context $context, + \Magento\App\RequestInterface $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, + \Magento\Session\SaveHandlerInterface $saveHandler, + \Magento\Session\ValidatorInterface $validator, + \Magento\Session\StorageInterface $storage, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress, - $sessionName = null, - array $data = array() + \Magento\Event\ManagerInterface $eventManager, + \Magento\Core\Model\StoreManagerInterface $storeManager, + $sessionName = null ) { $this->_orderFactory = $orderFactory; $this->_customerSession = $customerSession; $this->_quoteFactory = $quoteFactory; $this->_remoteAddress = $remoteAddress; - parent::__construct($context, $sidResolver, $sessionConfig, $data); - $this->start('checkout', $sessionName); + $this->_eventManager = $eventManager; + $this->_storeManager = $storeManager; + parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage); + $this->start($sessionName); } /** @@ -206,7 +228,7 @@ class Session extends \Magento\Core\Model\Session\AbstractSession if ($remoteAddr = $this->_remoteAddress->getRemoteAddress()) { $this->_quote->setRemoteIp($remoteAddr); - $xForwardIp = $this->_request->getServer('HTTP_X_FORWARDED_FOR'); + $xForwardIp = $this->request->getServer('HTTP_X_FORWARDED_FOR'); $this->_quote->setXForwardedFor($xForwardIp); } return $this->_quote; @@ -306,97 +328,6 @@ class Session extends \Magento\Core\Model\Session\AbstractSession return $steps[$step][$data]; } - /** - * Retrieves list of all saved additional messages for different instances (e.g. quote items) in checkout session - * Returned: array(itemKey => messageCollection, ...) - * where itemKey is a unique hash (e.g 'quote_item17') to distinguish item messages among message collections - * - * @param bool $clear - * - * @return array - */ - public function getAdditionalMessages($clear = false) - { - $additionalMessages = $this->getData('additional_messages'); - if (!$additionalMessages) { - return array(); - } - if ($clear) { - $this->setData('additional_messages', null); - } - return $additionalMessages; - } - - /** - * Retrieves list of item additional messages - * itemKey is a unique hash (e.g 'quote_item17') to distinguish item messages among message collections - * - * @param string $itemKey - * @param bool $clear - * - * @return null|\Magento\Message\Collection - */ - public function getItemAdditionalMessages($itemKey, $clear = false) - { - $allMessages = $this->getAdditionalMessages(); - if (!isset($allMessages[$itemKey])) { - return null; - } - - $messages = $allMessages[$itemKey]; - if ($clear) { - unset($allMessages[$itemKey]); - $this->setAdditionalMessages($allMessages); - } - return $messages; - } - - /** - * Adds new message in this session to a list of additional messages for some item - * itemKey is a unique hash (e.g 'quote_item17') to distinguish item messages among message collections - * - * @param string $itemKey - * @param \Magento\Message\AbstractMessage $message - * - * @return \Magento\Checkout\Model\Session - */ - public function addItemAdditionalMessage($itemKey, $message) - { - $allMessages = $this->getAdditionalMessages(); - if (!isset($allMessages[$itemKey])) { - $allMessages[$itemKey] = $this->messagesFactory->create(); - } - $allMessages[$itemKey]->add($message); - $this->setAdditionalMessages($allMessages); - - return $this; - } - - /** - * Retrieves list of quote item messages - * @param int $itemId - * @param bool $clear - * - * @return null|\Magento\Message\Collection - */ - public function getQuoteItemMessages($itemId, $clear = false) - { - return $this->getItemAdditionalMessages('quote_item' . $itemId, $clear); - } - - /** - * Adds new message to a list of quote item messages, saved in this session - * - * @param int $itemId - * @param \Magento\Message\AbstractMessage $message - * - * @return \Magento\Checkout\Model\Session - */ - public function addQuoteItemMessage($itemId, $message) - { - return $this->addItemAdditionalMessage('quote_item' . $itemId, $message); - } - /** * Destroy/end a session * Unset all data associated with object diff --git a/app/code/Magento/Checkout/Model/Type/Onepage.php b/app/code/Magento/Checkout/Model/Type/Onepage.php index 4b5fd891d57..b7e0eb93fdf 100644 --- a/app/code/Magento/Checkout/Model/Type/Onepage.php +++ b/app/code/Magento/Checkout/Model/Type/Onepage.php @@ -124,6 +124,11 @@ class Onepage */ protected $_objectCopyService; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Checkout\Helper\Data $helper @@ -139,6 +144,7 @@ class Onepage * @param \Magento\Sales\Model\Service\QuoteFactory $serviceQuoteFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Object\Copy $objectCopyService + * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( \Magento\Event\ManagerInterface $eventManager, @@ -154,7 +160,8 @@ class Onepage \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Sales\Model\Service\QuoteFactory $serviceQuoteFactory, \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Object\Copy $objectCopyService + \Magento\Object\Copy $objectCopyService, + \Magento\Message\ManagerInterface $messageManager ) { $this->_eventManager = $eventManager; $this->_customerData = $customerData; @@ -171,6 +178,7 @@ class Onepage $this->_serviceQuoteFactory = $serviceQuoteFactory; $this->_orderFactory = $orderFactory; $this->_objectCopyService = $objectCopyService; + $this->messageManager = $messageManager; } /** @@ -765,7 +773,7 @@ class Onepage if ($customer->isConfirmationRequired()) { $customer->sendNewAccountEmail('confirmation', '', $this->getQuote()->getStoreId()); $url = $this->_customerData->getEmailConfirmationUrl($customer->getEmail()); - $this->getCustomerSession()->addSuccess( + $this->messageManager->addSuccess( __('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%1">click here</a>.', $url) ); } else { diff --git a/app/code/Magento/Checkout/etc/adminhtml/menu.xml b/app/code/Magento/Checkout/etc/adminhtml/menu.xml index fabe4fb08a1..66339bdb1d9 100644 --- a/app/code/Magento/Checkout/etc/adminhtml/menu.xml +++ b/app/code/Magento/Checkout/etc/adminhtml/menu.xml @@ -27,6 +27,6 @@ --> <config> <menu> - <add id="Magento_Checkout::sales_checkoutagreement" title="Terms and Conditions" module="Magento_Checkout" sortOrder="30" parent="Magento_Adminhtml::stores_settings" action="checkout/agreement/" resource="Magento_Checkout::checkoutagreement"/> + <add id="Magento_Checkout::sales_checkoutagreement" title="Terms and Conditions" module="Magento_Checkout" sortOrder="30" parent="Magento_Backend::stores_settings" action="checkout/agreement/" resource="Magento_Checkout::checkoutagreement"/> </menu> </config> diff --git a/app/code/Magento/Checkout/etc/di.xml b/app/code/Magento/Checkout/etc/di.xml index 023a7768da4..b43b0ae75f7 100644 --- a/app/code/Magento/Checkout/etc/di.xml +++ b/app/code/Magento/Checkout/etc/di.xml @@ -31,4 +31,14 @@ </value> </param> </type> + <virtualType name="Magento\Checkout\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> + <value>checkout</value> + </param> + </virtualType> + <type name="Magento\Checkout\Model\Session"> + <param name="storage"> + <instance type="Magento\Checkout\Model\Session\Storage" /> + </param> + </type> </config> diff --git a/app/code/Magento/Checkout/etc/email_templates.xml b/app/code/Magento/Checkout/etc/email_templates.xml index 7582bc9f64a..ed61c92ba11 100644 --- a/app/code/Magento/Checkout/etc/email_templates.xml +++ b/app/code/Magento/Checkout/etc/email_templates.xml @@ -24,5 +24,5 @@ */ --> <config> - <template id="checkout_payment_failed_template" label="Payment Failed" file="failed_payment.html" type="html"/> + <template id="checkout_payment_failed_template" label="Payment Failed" file="failed_payment.html" type="html" module="Magento_Checkout"/> </config> diff --git a/app/code/Magento/Cms/Block/Adminhtml/Block.php b/app/code/Magento/Cms/Block/Adminhtml/Block.php index 7710c16dabd..cfaf3e4ce5c 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Block.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Block.php @@ -33,7 +33,7 @@ */ namespace Magento\Cms\Block\Adminhtml; -class Block extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Block extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() diff --git a/app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php index 8d47dc6f1fb..a7895703763 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php @@ -33,7 +33,7 @@ */ namespace Magento\Cms\Block\Adminhtml\Block; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php b/app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php index 8a6635aabba..a91e69f6628 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php @@ -33,7 +33,7 @@ */ namespace Magento\Cms\Block\Adminhtml\Block\Widget; -class Chooser extends \Magento\Adminhtml\Block\Widget\Grid +class Chooser extends \Magento\Backend\Block\Widget\Grid\Extended { /** * @var \Magento\Cms\Model\BlockFactory @@ -48,6 +48,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Cms\Model\BlockFactory $blockFactory * @param \Magento\Cms\Model\Resource\Block\CollectionFactory $collectionFactory * @param array $data @@ -55,13 +56,14 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Cms\Model\BlockFactory $blockFactory, \Magento\Cms\Model\Resource\Block\CollectionFactory $collectionFactory, array $data = array() ) { $this->_blockFactory = $blockFactory; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** @@ -130,7 +132,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare Cms static blocks collection * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { @@ -141,7 +143,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare columns for Cms blocks grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page.php b/app/code/Magento/Cms/Block/Adminhtml/Page.php index 9b18263f7fa..e44ce25af87 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page.php @@ -34,7 +34,7 @@ */ namespace Magento\Cms\Block\Adminhtml; -class Page extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Page extends \Magento\Backend\Block\Widget\Grid\Container { /** * Block constructor diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit.php index 88bb13e2711..b3ff09414fe 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit.php @@ -33,7 +33,7 @@ */ namespace Magento\Cms\Block\Adminhtml\Page; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php index b5bf1229ccb..b18dfd98a3a 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php @@ -109,7 +109,7 @@ class Content )); // Setting custom renderer for content field to remove label column - $renderer = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset\Element') + $renderer = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element') ->setTemplate('Magento_Cms::page/edit/form/renderer/content.phtml'); $contentField->setRenderer($renderer); diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tabs.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tabs.php index 178be6c9132..f25c0897088 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tabs.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tabs.php @@ -33,7 +33,7 @@ */ namespace Magento\Cms\Block\Adminhtml\Page\Edit; -class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs +class Tabs extends \Magento\Backend\Block\Widget\Tabs { protected function _construct() diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Grid.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid.php index 41c021bf3ad..01e6b9b39ab 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Grid.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid.php @@ -33,7 +33,7 @@ */ namespace Magento\Cms\Block\Adminhtml\Page; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * @var \Magento\Cms\Model\Resource\Page\CollectionFactory @@ -53,6 +53,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Theme\Model\Layout\Source\Layout $pageLayout * @param \Magento\Cms\Model\Page $cmsPage * @param \Magento\Cms\Model\Resource\Page\CollectionFactory $collectionFactory @@ -61,6 +62,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Theme\Model\Layout\Source\Layout $pageLayout, \Magento\Cms\Model\Page $cmsPage, \Magento\Cms\Model\Resource\Page\CollectionFactory $collectionFactory, @@ -69,7 +71,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid $this->_collectionFactory = $collectionFactory; $this->_cmsPage = $cmsPage; $this->_pageLayout = $pageLayout; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php index aa36e49e7e3..8c4a7fb6050 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php @@ -27,23 +27,23 @@ namespace Magento\Cms\Block\Adminhtml\Page\Grid\Renderer; class Action - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer + extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * @var \Magento\Core\Model\UrlFactory */ protected $_urlFactory; - /** - * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\UrlFactory $urlFactory - * @param array $data + /** + * @param \Magento\Backend\Block\Context $context + * @param \Magento\Core\Model\UrlFactory $urlFactory + * @param array $data */ - public function __construct( - \Magento\Backend\Block\Context $context, - \Magento\Core\Model\UrlFactory $urlFactory, - array $data = array() - ) { + public function __construct( + \Magento\Backend\Block\Context $context, + \Magento\Core\Model\UrlFactory $urlFactory, + array $data = array() + ) { $this->_urlFactory = $urlFactory; parent::__construct($context, $data); } diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php index 74c75c4ad20..df2713228f7 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php @@ -33,7 +33,7 @@ */ namespace Magento\Cms\Block\Adminhtml\Page\Widget; -class Chooser extends \Magento\Adminhtml\Block\Widget\Grid +class Chooser extends \Magento\Backend\Block\Widget\Grid\Extended { /** * @var \Magento\Theme\Model\Layout\Source\Layout @@ -58,6 +58,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Theme\Model\Layout\Source\Layout $pageLayout * @param \Magento\Cms\Model\Page $cmsPage * @param \Magento\Cms\Model\PageFactory $pageFactory @@ -67,6 +68,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Theme\Model\Layout\Source\Layout $pageLayout, \Magento\Cms\Model\Page $cmsPage, \Magento\Cms\Model\PageFactory $pageFactory, @@ -77,7 +79,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid $this->_cmsPage = $cmsPage; $this->_pageFactory = $pageFactory; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** @@ -145,7 +147,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare pages collection * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { @@ -160,7 +162,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare columns for pages grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php index 312cc732030..b7c0654c6c7 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php @@ -35,7 +35,7 @@ namespace Magento\Cms\Block\Adminhtml\Wysiwyg\Images; use Magento\View\Element\Template; -class Content extends \Magento\Adminhtml\Block\Widget\Container +class Content extends \Magento\Backend\Block\Widget\Container { /** * @var \Magento\Json\EncoderInterface diff --git a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php index cbe9639379c..98c9ab485f8 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php @@ -119,10 +119,10 @@ class Tree extends \Magento\Backend\Block\Template if ($path = $this->_coreRegistry->registry('storage')->getSession()->getCurrentPath()) { $path = str_replace($this->_cmsWysiwygImages->getStorageRoot(), '', $path); $relative = array(); - foreach (explode(DIRECTORY_SEPARATOR, $path) as $dirName) { + foreach (explode('/', $path) as $dirName) { if ($dirName) { $relative[] = $dirName; - $treePath[] = $this->_cmsWysiwygImages->idEncode(implode(DIRECTORY_SEPARATOR, $relative)); + $treePath[] = $this->_cmsWysiwygImages->idEncode(implode('/', $relative)); } } } diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Block.php b/app/code/Magento/Cms/Controller/Adminhtml/Block.php index b70a1e50b95..b9e9e68ebac 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Block.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Block.php @@ -105,7 +105,7 @@ class Block extends \Magento\Backend\App\Action if ($id) { $model->load($id); if (! $model->getId()) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('This block no longer exists.')); + $this->messageManager->addError(__('This block no longer exists.')); $this->_redirect('*/*/'); return; } @@ -114,7 +114,7 @@ class Block extends \Magento\Backend\App\Action $this->_title->add($model->getId() ? $model->getTitle() : __('New Block')); // 3. Set entered data if was error when we do save - $data = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getFormData(true); + $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getFormData(true); if (! empty($data)) { $model->setData($data); } @@ -139,7 +139,7 @@ class Block extends \Magento\Backend\App\Action $id = $this->getRequest()->getParam('block_id'); $model = $this->_objectManager->create('Magento\Cms\Model\Block')->load($id); if (!$model->getId() && $id) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('This block no longer exists.')); + $this->messageManager->addError(__('This block no longer exists.')); $this->_redirect('*/*/'); return; } @@ -153,9 +153,9 @@ class Block extends \Magento\Backend\App\Action // save the data $model->save(); // display success message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('The block has been saved.')); + $this->messageManager->addSuccess(__('The block has been saved.')); // clear previously saved data from session - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setFormData(false); + $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData(false); // check if 'Save and Continue' if ($this->getRequest()->getParam('back')) { @@ -168,9 +168,9 @@ class Block extends \Magento\Backend\App\Action } catch (\Exception $e) { // display error message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); // save data in session - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setFormData($data); + $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData($data); // redirect to edit form $this->_redirect('*/*/edit', array('block_id' => $this->getRequest()->getParam('block_id'))); return; @@ -193,20 +193,20 @@ class Block extends \Magento\Backend\App\Action $model->load($id); $model->delete(); // display success message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('The block has been deleted.')); + $this->messageManager->addSuccess(__('The block has been deleted.')); // go to grid $this->_redirect('*/*/'); return; } catch (\Exception $e) { // display error message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); // go back to edit form $this->_redirect('*/*/edit', array('block_id' => $id)); return; } } // display error message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('We can\'t find a block to delete.')); + $this->messageManager->addError(__('We can\'t find a block to delete.')); // go to grid $this->_redirect('*/*/'); } diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Page.php b/app/code/Magento/Cms/Controller/Adminhtml/Page.php index 12cdfe8a41f..cb9953c07c4 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Page.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Page.php @@ -114,8 +114,7 @@ class Page extends \Magento\Backend\App\Action if ($id) { $model->load($id); if (! $model->getId()) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('This page no longer exists.')); + $this->messageManager->addError(__('This page no longer exists.')); $this->_redirect('*/*/'); return; } @@ -124,7 +123,7 @@ class Page extends \Magento\Backend\App\Action $this->_title->add($model->getId() ? $model->getTitle() : __('New Page')); // 3. Set entered data if was error when we do save - $data = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getFormData(true); + $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getFormData(true); if (! empty($data)) { $model->setData($data); } @@ -175,10 +174,9 @@ class Page extends \Magento\Backend\App\Action $model->save(); // display success message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('The page has been saved.')); + $this->messageManager->addSuccess(__('The page has been saved.')); // clear previously saved data from session - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setFormData(false); + $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData(false); // check if 'Save and Continue' if ($this->getRequest()->getParam('back')) { $this->_redirect('*/*/edit', array('page_id' => $model->getId(), '_current'=>true)); @@ -189,10 +187,9 @@ class Page extends \Magento\Backend\App\Action return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException($e, - __('Something went wrong while saving the page.')); + $this->messageManager->addException($e, __('Something went wrong while saving the page.')); } $this->_getSession()->setFormData($data); @@ -218,8 +215,7 @@ class Page extends \Magento\Backend\App\Action $title = $model->getTitle(); $model->delete(); // display success message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('The page has been deleted.')); + $this->messageManager->addSuccess(__('The page has been deleted.')); // go to grid $this->_eventManager->dispatch('adminhtml_cmspage_on_delete', array('title' => $title, 'status' => 'success')); $this->_redirect('*/*/'); @@ -228,14 +224,14 @@ class Page extends \Magento\Backend\App\Action } catch (\Exception $e) { $this->_eventManager->dispatch('adminhtml_cmspage_on_delete', array('title' => $title, 'status' => 'fail')); // display error message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); // go back to edit form $this->_redirect('*/*/edit', array('page_id' => $id)); return; } } // display error message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('We can\'t find a page to delete.')); + $this->messageManager->addError(__('We can\'t find a page to delete.')); // go to grid $this->_redirect('*/*/'); } @@ -293,7 +289,7 @@ class Page extends \Magento\Backend\App\Action $errorNo = false; } foreach ($validatorCustomLayout->getMessages() as $message) { - $this->_getSession()->addError($message); + $this->messageManager->addError($message); } } return $errorNo; diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php index 1ab03e2482e..fcbb947c225 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php @@ -72,7 +72,7 @@ class Images extends \Magento\Backend\App\Action try { $this->_objectManager->get('Magento\Cms\Helper\Wysiwyg\Images')->getCurrentPath(); } catch (\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } $this->_initAction(); $this->_view->loadLayout('overlay_popup'); @@ -151,13 +151,13 @@ class Images extends \Magento\Backend\App\Action $path = $this->getStorage()->getSession()->getCurrentPath(); foreach ($files as $file) { $file = $helper->idDecode($file); - $_filePath = $path . DS . $file; /** @var \Magento\Filesystem $filesystem */ $filesystem = $this->_objectManager->get('Magento\Filesystem'); - $filesystem->setWorkingDirectory($helper->getStorageRoot()); - if ($filesystem->isFile($_filePath)) { - $this->getStorage()->deleteFile($_filePath); - } + $dir = $filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); + $filePath = $path . '/' . $file; + if ($dir->isFile($dir->getRelativePath($filePath))) { + $this->getStorage()->deleteFile($filePath); + } } } catch (\Exception $e) { $result = array('error' => true, 'message' => $e->getMessage()); diff --git a/app/code/Magento/Cms/Helper/Page.php b/app/code/Magento/Cms/Helper/Page.php index c8967f89ebb..6cc11fe83a8 100644 --- a/app/code/Magento/Cms/Helper/Page.php +++ b/app/code/Magento/Cms/Helper/Page.php @@ -60,9 +60,9 @@ class Page extends \Magento\App\Helper\AbstractHelper protected $_page; /** - * @var \Magento\Core\Model\Session\Pool + * @var \Magento\Message\ManagerInterface */ - protected $_sessionPool; + protected $messageManager; /** * Locale @@ -97,7 +97,7 @@ class Page extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Session\Pool $sessionFactory + * @param \Magento\Message\ManagerInterface $messageManager * @param \Magento\Cms\Model\Page $page * @param \Magento\Theme\Helper\Layout $pageLayout * @param \Magento\View\DesignInterface $design @@ -109,7 +109,7 @@ class Page extends \Magento\App\Helper\AbstractHelper */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Session\Pool $sessionFactory, + \Magento\Message\ManagerInterface $messageManager, \Magento\Cms\Model\Page $page, \Magento\Theme\Helper\Layout $pageLayout, \Magento\View\DesignInterface $design, @@ -119,7 +119,7 @@ class Page extends \Magento\App\Helper\AbstractHelper \Magento\Escaper $escaper, \Magento\App\ViewInterface $view ) { - $this->_sessionPool = $sessionFactory; + $this->messageManager = $messageManager; $this->_view = $view; $this->_page = $page; $this->_pageLayout = $pageLayout; @@ -215,18 +215,10 @@ class Page extends \Magento\App\Helper\AbstractHelper /* @TODO: Move catalog and checkout storage types to appropriate modules */ $messageBlock = $this->_view->getLayout()->getMessagesBlock(); - $sessions = array( - 'Magento\Catalog\Model\Session', - 'Magento\Checkout\Model\Session', - 'Magento\Customer\Model\Session' + $messageBlock->addStorageType($this->messageManager->getDefaultGroup()); + $messageBlock->addMessages( + $this->messageManager->getMessages(true) ); - foreach ($sessions as $storageType) { - $storage = $this->_sessionPool->get($storageType); - if ($storage) { - $messageBlock->addStorageType($storageType); - $messageBlock->addMessages($storage->getMessages(true)); - } - } if ($renderLayout) { $this->_view->renderLayout(); diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php index 8739d10493e..668c45aabb5 100644 --- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php @@ -52,9 +52,9 @@ class Images extends \Magento\App\Helper\AbstractHelper protected $_storeId = null; /** - * @var \Magento\Filesystem + * @var \Magento\Filesystem\Directory\Write */ - protected $_filesystem; + protected $_directory; /** * Core data @@ -78,45 +78,36 @@ class Images extends \Magento\App\Helper\AbstractHelper protected $_storeManager; /** - * Dir + * Construct * - * @var \Magento\App\Dir - */ - protected $_dir; - - /** * @param \Magento\App\Helper\Context $context * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\Dir $dir */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Backend\Helper\Data $backendData, \Magento\Core\Helper\Data $coreData, \Magento\Filesystem $filesystem, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\Dir $dir + \Magento\Core\Model\StoreManagerInterface $storeManager ) { parent::__construct($context); $this->_backendData = $backendData; $this->_coreData = $coreData; - $this->_filesystem = $filesystem; - $this->_dir = $dir; $this->_storeManager = $storeManager; - $this->_filesystem->setIsAllowCreateDirectories(true); - $this->_filesystem->ensureDirectoryExists($this->getStorageRoot()); - $this->_filesystem->setWorkingDirectory($this->getStorageRoot()); + $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_directory->create(\Magento\Cms\Model\Wysiwyg\Config::IMAGE_DIRECTORY); } /** * Set a specified store ID value * - * @param <type> $store + * @param int $store + * @return \Magento\Cms\Helper\Wysiwyg\Images */ public function setStoreId($store) { @@ -131,8 +122,7 @@ class Images extends \Magento\App\Helper\AbstractHelper */ public function getStorageRoot() { - return $this->_dir->getDir(\Magento\App\Dir::MEDIA) . DS - . \Magento\Cms\Model\Wysiwyg\Config::IMAGE_DIRECTORY . DS; + return $this->_directory->getAbsolutePath(\Magento\Cms\Model\Wysiwyg\Config::IMAGE_DIRECTORY); } /** @@ -142,7 +132,7 @@ class Images extends \Magento\App\Helper\AbstractHelper */ public function getBaseUrl() { - return $this->_storeManager->getStore()->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_MEDIA) . '/'; + return $this->_storeManager->getStore()->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_MEDIA); } /** @@ -175,41 +165,14 @@ class Images extends \Magento\App\Helper\AbstractHelper */ public function convertIdToPath($id) { - $path = $this->idDecode($id); - if (!strstr($path, $this->getStorageRoot())) { - $path = $this->getStorageRoot() . $path; - } - return $path; - } - - /** - * File system path correction - * - * @param string $path Original path - * @param boolean $trim Trim slashes or not - * @return string - */ - public function correctPath($path, $trim = true) - { - $path = strtr($path, "\\\/", DS . DS); - if ($trim) { - $path = trim($path, DS); + if ($id === \Magento\Theme\Helper\Storage::NODE_ROOT) { + return $this->getStorageRoot(); + } else { + return $this->getStorageRoot() . $this->idDecode($id); } - return $path; - } - - /** - * Return file system path as Url string - * - * @param string $path - * @return string - */ - public function convertPathToUrl($path) - { - return str_replace(DS, '/', $path); } - - /** + + /* * Check whether using static URLs is allowed * * @return boolean @@ -264,17 +227,18 @@ class Images extends \Magento\App\Helper\AbstractHelper public function getCurrentPath() { if (!$this->_currentPath) { - $currentPath = $this->getStorageRoot(); + $currentPath = $this->_directory->getAbsolutePath() . \Magento\Cms\Model\Wysiwyg\Config::IMAGE_DIRECTORY; $path = $this->_getRequest()->getParam($this->getTreeNodeName()); if ($path) { $path = $this->convertIdToPath($path); - if ($this->_filesystem->isDirectory($path)) { + if ($this->_directory->isDirectory($this->_directory->getRelativePath($path))) { $currentPath = $path; } } try { - if (!$this->_filesystem->isWritable($currentPath)) { - $this->_filesystem->createDirectory($currentPath); + $currentDir = $this->_directory->getRelativePath($currentPath); + if (!$this->_directory->isExist($currentDir)) { + $this->_directory->create($currentDir); } } catch (\Magento\Filesystem\FilesystemException $e) { $message = __('The directory %1 is not writable by server.', $currentPath); @@ -293,11 +257,10 @@ class Images extends \Magento\App\Helper\AbstractHelper public function getCurrentUrl() { if (!$this->_currentUrl) { - $path = str_replace($this->_dir->getDir(\Magento\App\Dir::MEDIA), '', $this->getCurrentPath()); - $path = trim($path, DS); + $path = $this->getCurrentPath(); $mediaUrl = $this->_storeManager->getStore($this->_storeId) ->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_MEDIA); - $this->_currentUrl = $mediaUrl . $this->convertPathToUrl($path) . '/'; + $this->_currentUrl = $mediaUrl . $this->_directory->getRelativePath($path) . '/'; } return $this->_currentUrl; } diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php index 6bec71b42b9..b9044f2fd35 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php @@ -52,9 +52,9 @@ class Storage extends \Magento\Object protected $_configAsArray; /** - * @var \Magento\Filesystem + * @var \Magento\Filesystem\Directory\Write */ - protected $_filesystem; + protected $_directory; /** * @var \Magento\Image\AdapterFactory @@ -133,13 +133,6 @@ class Storage extends \Magento\Object */ protected $_storageCollectionFactory; - /** - * Dir - * - * @var \Magento\App\Dir - */ - protected $_dir; - /** * Uploader factory * @@ -157,7 +150,6 @@ class Storage extends \Magento\Object * @param \Magento\Filesystem $filesystem * @param \Magento\Image\AdapterFactory $imageFactory * @param \Magento\View\Url $viewUrl - * @param \Magento\App\Dir $dir * @param \Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory $storageCollectionFactory * @param \Magento\Core\Model\File\Storage\FileFactory $storageFileFactory * @param \Magento\Core\Model\File\Storage\DatabaseFactory $storageDatabaseFactory @@ -178,7 +170,6 @@ class Storage extends \Magento\Object \Magento\Filesystem $filesystem, \Magento\Image\AdapterFactory $imageFactory, \Magento\View\Url $viewUrl, - \Magento\App\Dir $dir, \Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory $storageCollectionFactory, \Magento\Core\Model\File\Storage\FileFactory $storageFileFactory, \Magento\Core\Model\File\Storage\DatabaseFactory $storageDatabaseFactory, @@ -193,12 +184,9 @@ class Storage extends \Magento\Object $this->_backendUrl = $backendUrl; $this->_cmsWysiwygImages = $cmsWysiwygImages; $this->_coreFileStorageDb = $coreFileStorageDb; - $this->_filesystem = $filesystem; - $this->_filesystem->setIsAllowCreateDirectories(true); - $this->_filesystem->setWorkingDirectory($cmsWysiwygImages->getStorageRoot()); + $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); $this->_imageFactory = $imageFactory; $this->_viewUrl = $viewUrl; - $this->_dir = $dir; $this->_storageCollectionFactory = $storageCollectionFactory; $this->_storageFileFactory = $storageFileFactory; $this->_storageDatabaseFactory = $storageDatabaseFactory; @@ -223,8 +211,8 @@ class Storage extends \Magento\Object $subDirectories = $this->_directoryDatabaseFactory->create(); $subDirectories->getSubdirectories($path); foreach ($subDirectories as $directory) { - $fullPath = rtrim($path, DS) . DS . $directory['name']; - $this->_filesystem->ensureDirectoryExists($fullPath, 0777, $path); + $fullPath = rtrim($path, '/') . '/' . $directory['name']; + $this->_directory->create($fullPath); } } @@ -251,7 +239,7 @@ class Storage extends \Magento\Object $storageRootLength = strlen($this->_cmsWysiwygImages->getStorageRoot()); foreach ($collection as $key => $value) { - $rootChildParts = explode(DIRECTORY_SEPARATOR, substr($value->getFilename(), $storageRootLength)); + $rootChildParts = explode('/', substr($value->getFilename(), $storageRootLength)); if (array_key_exists($rootChildParts[0], $conditions['plain']) || ($regExp && preg_match($regExp, $value->getFilename()))) { @@ -352,18 +340,20 @@ class Storage extends \Magento\Object throw new \Magento\Core\Exception( __('Please correct the folder name. Use only letters, numbers, underscores and dashes.')); } - if (!$this->_filesystem->isDirectory($path) || !$this->_filesystem->isWritable($path)) { + + $relativePath = $this->_directory->getRelativePath($path); + if (!$this->_directory->isDirectory($relativePath) || !$this->_directory->isWritable($relativePath)) { $path = $this->_cmsWysiwygImages->getStorageRoot(); } - $newPath = $path . DS . $name; - - if ($this->_filesystem->isDirectory($newPath, $path)) { + $newPath = $path . '/' . $name; + $relativeNewPath = $this->_directory->getRelativePath($newPath); + if ($this->_directory->isDirectory($relativeNewPath)) { throw new \Magento\Core\Exception( __('We found a directory with the same name. Please try another folder name.')); } - $this->_filesystem->createDirectory($newPath); + $this->_directory->create($relativeNewPath); try { if ($this->_coreFileStorageDb->checkDbUsage()) { $relativePath = $this->_coreFileStorageDb->getMediaRelativePath($newPath); @@ -392,8 +382,9 @@ class Storage extends \Magento\Object public function deleteDirectory($path) { // prevent accidental root directory deleting - $rootCmp = rtrim($this->_cmsWysiwygImages->getStorageRoot(), DS); - $pathCmp = rtrim($path, DS); + $rootCmp = rtrim($this->_cmsWysiwygImages->getStorageRoot(), '/'); + $rootCmp = preg_replace('~[/\\\]+~', '/', $rootCmp); + $pathCmp = rtrim($path, '/'); if ($rootCmp == $pathCmp) { throw new \Magento\Core\Exception( @@ -401,19 +392,20 @@ class Storage extends \Magento\Object ); } - if ($this->_coreFileStorageDb->checkDbUsage()) { $this->_directoryDatabaseFactory->create()->deleteDirectory($path); } try { - $this->_filesystem->delete($path); + $this->_directory->delete($this->_directory->getRelativePath($path)); } catch (\Magento\Filesystem\FilesystemException $e) { throw new \Magento\Core\Exception(__('We cannot delete directory %1.', $path)); } if (strpos($pathCmp, $rootCmp) === 0) { - $this->_filesystem->delete( - $this->getThumbnailRoot() . DS . ltrim(substr($pathCmp, strlen($rootCmp)), '\\/') + $this->_directory->delete( + $this->_directory->getRelativePath( + $this->getThumbnailRoot() . substr($pathCmp, strlen($rootCmp)) + ) ); } } @@ -426,15 +418,17 @@ class Storage extends \Magento\Object */ public function deleteFile($target) { - if ($this->_filesystem->isFile($target)) { - $this->_filesystem->delete($target); + $relativePath = $this->_directory->getRelativePath($target); + if ($this->_directory->isFile($relativePath)) { + $this->_directory->delete($relativePath); } $this->_coreFileStorageDb->deleteFile($target); $thumb = $this->getThumbnailPath($target, true); + $relativePathThumb = $this->_directory->getRelativePath($thumb); if ($thumb) { - if ($this->_filesystem->isFile($thumb)) { - $this->_filesystem->delete($thumb); + if ($this->_directory->isFile($relativePathThumb)) { + $this->_directory->delete($relativePathThumb); } $this->_coreFileStorageDb->deleteFile($thumb); } @@ -467,7 +461,7 @@ class Storage extends \Magento\Object } // create thumbnail - $this->resizeFile($targetPath . DS . $uploader->getUploadedFileName(), true); + $this->resizeFile($targetPath . '/' . $uploader->getUploadedFileName(), true); $result['cookie'] = array( 'name' => $this->getSession()->getName(), @@ -492,9 +486,9 @@ class Storage extends \Magento\Object $mediaRootDir = $this->_cmsWysiwygImages->getStorageRoot(); if (strpos($filePath, $mediaRootDir) === 0) { - $thumbPath = $this->getThumbnailRoot() . DS . substr($filePath, strlen($mediaRootDir)); + $thumbPath = $this->getThumbnailRoot() . substr($filePath, strlen($mediaRootDir)); - if (!$checkFile || $this->_filesystem->isReadable($thumbPath)) { + if (!$checkFile || $this->_directory->isExist($this->_directory->getRelativePath($thumbPath))) { return $thumbPath; } } @@ -514,9 +508,10 @@ class Storage extends \Magento\Object $mediaRootDir = $this->_cmsWysiwygImages->getStorageRoot(); if (strpos($filePath, $mediaRootDir) === 0) { - $thumbSuffix = self::THUMBS_DIRECTORY_NAME . DS . substr($filePath, strlen($mediaRootDir)); - - if (! $checkFile || $this->_filesystem->isReadable($mediaRootDir . $thumbSuffix)) { + $thumbSuffix = self::THUMBS_DIRECTORY_NAME . substr($filePath, strlen($mediaRootDir)); + if (!$checkFile || $this->_directory->isExist( + $this->_directory->getRelativePath($mediaRootDir . '/' . $thumbSuffix))) { + $thumbSuffix = substr($mediaRootDir, strlen($this->_directory->getAbsolutePath())) . '/' . $thumbSuffix; $randomIndex = '?rand=' . time(); return str_replace('\\', '/', $this->_cmsWysiwygImages->getBaseUrl() . $thumbSuffix) . $randomIndex; } @@ -534,26 +529,26 @@ class Storage extends \Magento\Object */ public function resizeFile($source, $keepRation = true) { - if (!$this->_filesystem->isFile($source) - || !$this->_filesystem->isReadable($source) - ) { + $realPath = $this->_directory->getRelativePath($source); + if (!$this->_directory->isFile($realPath) || !$this->_directory->isExist($realPath)) { return false; } $targetDir = $this->getThumbsPath($source); - if (!$this->_filesystem->isWritable($targetDir)) { - $this->_filesystem->createDirectory($targetDir); + $pathTargetDir = $this->_directory->getRelativePath($targetDir); + if (!$this->_directory->isExist($pathTargetDir)) { + $this->_directory->create($pathTargetDir); } - if (!$this->_filesystem->isWritable($targetDir)) { + if (!$this->_directory->isExist($pathTargetDir)) { return false; } $image = $this->_imageFactory->create(); $image->open($source); $image->keepAspectRatio($keepRation); $image->resize($this->_resizeParameters['width'], $this->_resizeParameters['height']); - $dest = $targetDir . DS . pathinfo($source, PATHINFO_BASENAME); + $dest = $targetDir . '/' . pathinfo($source, PATHINFO_BASENAME); $image->save($dest); - if ($this->_filesystem->isFile($dest)) { + if ($this->_directory->isFile($this->_directory->getRelativePath($dest))) { return $dest; } return false; @@ -571,7 +566,7 @@ class Storage extends \Magento\Object if (!$path) { $path = $this->_cmsWysiwygImages->getCurrentPath(); } - return $this->resizeFile($path . DS . $filename); + return $this->resizeFile($path . '/' . $filename); } /** @@ -582,11 +577,11 @@ class Storage extends \Magento\Object */ public function getThumbsPath($filePath = false) { - $mediaRootDir = $this->_dir->getDir(\Magento\App\Dir::MEDIA); + $mediaRootDir = $this->_cmsWysiwygImages->getStorageRoot(); $thumbnailDir = $this->getThumbnailRoot(); if ($filePath && strpos($filePath, $mediaRootDir) === 0) { - $thumbnailDir .= DS . dirname(substr($filePath, strlen($mediaRootDir))); + $thumbnailDir .= dirname(substr($filePath, strlen($mediaRootDir))); } return $thumbnailDir; @@ -595,7 +590,7 @@ class Storage extends \Magento\Object /** * Storage session * - * @return \Magento\Adminhtml\Model\Session + * @return \Magento\Backend\Model\Session */ public function getSession() { @@ -626,7 +621,7 @@ class Storage extends \Magento\Object */ public function getThumbnailRoot() { - return $this->_cmsWysiwygImages->getStorageRoot() . self::THUMBS_DIRECTORY_NAME; + return $this->_cmsWysiwygImages->getStorageRoot() . '/' . self::THUMBS_DIRECTORY_NAME; } /** 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 7aafdae4b7c..0e2322a1515 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php @@ -52,12 +52,12 @@ class Collection extends \Magento\Data\Collection\Filesystem protected function _generateRow($filename) { - $filename = preg_replace('~[/\\\]+~', DIRECTORY_SEPARATOR, $filename); - + $filename = preg_replace('~[/\\\]+~', '/', $filename); + $path = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); return array( 'filename' => $filename, 'basename' => basename($filename), - 'mtime' => $this->_filesystem->getMTime($filename) + 'mtime' => $path->stat($path->getRelativePath($filename))['mtime'] ); } } diff --git a/app/code/Magento/Cms/etc/adminhtml/menu.xml b/app/code/Magento/Cms/etc/adminhtml/menu.xml index 81982bc3066..730660b1571 100644 --- a/app/code/Magento/Cms/etc/adminhtml/menu.xml +++ b/app/code/Magento/Cms/etc/adminhtml/menu.xml @@ -27,7 +27,7 @@ --> <config> <menu> - <add id="Magento_Cms::cms_page" title="Pages" module="Magento_Cms" sortOrder="0" parent="Magento_Adminhtml::content_elements" action="cms/page" resource="Magento_Cms::page"/> - <add id="Magento_Cms::cms_block" title="Blocks" module="Magento_Cms" sortOrder="30" parent="Magento_Adminhtml::content_elements" action="cms/block" resource="Magento_Cms::block"/> + <add id="Magento_Cms::cms_page" title="Pages" module="Magento_Cms" sortOrder="0" parent="Magento_Backend::content_elements" action="cms/page" resource="Magento_Cms::page"/> + <add id="Magento_Cms::cms_block" title="Blocks" module="Magento_Cms" sortOrder="30" parent="Magento_Backend::content_elements" action="cms/block" resource="Magento_Cms::block"/> </menu> </config> diff --git a/app/code/Magento/Cms/etc/module.xml b/app/code/Magento/Cms/etc/module.xml index 88ded907c2f..91a105f2edc 100644 --- a/app/code/Magento/Cms/etc/module.xml +++ b/app/code/Magento/Cms/etc/module.xml @@ -35,8 +35,6 @@ <module name="Magento_Widget"/> <module name="Magento_Backend"/> <module name="Magento_Catalog"/> - <module name="Magento_Checkout"/> - <module name="Magento_Customer"/> </depends> </module> </config> diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit.php index c30152131a6..fa3e9943bb3 100644 --- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit.php +++ b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit.php @@ -33,7 +33,7 @@ */ namespace Magento\Connect\Block\Adminhtml\Extension\Custom; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Constructor diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php index c67a3db5cf0..ddfc024a4cc 100644 --- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php +++ b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php @@ -110,7 +110,7 @@ abstract class AbstractTab { if (!isset($this->_addRowButtonHtml[$container])) { $this->_addRowButtonHtml[$container] = $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Widget\Button') + ->createBlock('Magento\Backend\Block\Widget\Button') ->setType('button') ->setClass('add') ->setLabel(__($title)) @@ -127,7 +127,7 @@ abstract class AbstractTab { if (!$this->_removeRowButtonHtml) { $this->_removeRowButtonHtml = $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Widget\Button') + ->createBlock('Magento\Backend\Block\Widget\Button') ->setType('button') ->setClass('delete') ->setLabel(__('Remove')) @@ -141,7 +141,7 @@ abstract class AbstractTab { if (!$this->_addFileDepButtonHtml) { $this->_addFileDepButtonHtml = $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Widget\Button') + ->createBlock('Magento\Backend\Block\Widget\Button') ->setType('button') ->setClass('add') ->setLabel(__('Add files')) diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Authors.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Authors.php index 9f0426dcf0f..7b75fafcc3b 100644 --- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Authors.php +++ b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Authors.php @@ -90,7 +90,7 @@ class Authors */ public function getAddAuthorButtonHtml() { - return $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + return $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setType('button') ->setClass('add') ->setLabel(__('Add Author')) diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Grid.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Grid.php index 5fc9e8e49c2..1c3499a658c 100644 --- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Grid.php +++ b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Grid.php @@ -33,7 +33,7 @@ */ namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Extension collection factory @@ -45,17 +45,19 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Connect\Model\Extension\CollectionFactory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Connect\Model\Extension\CollectionFactory $collectionFactory, array $data = array() ) { $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tabs.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tabs.php index 28ec8af8096..2ac8b7d44ce 100644 --- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tabs.php +++ b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tabs.php @@ -33,7 +33,7 @@ */ namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit; -class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs +class Tabs extends \Magento\Backend\Block\Widget\Tabs { /** * Constructor diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php b/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php index be4be85923a..2b88544c264 100644 --- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php +++ b/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php @@ -85,11 +85,11 @@ class Custom extends \Magento\Backend\App\Action } $data = array_merge($data, array('file_name' => $packageName)); $session->setCustomExtensionPackageFormData($data); - $session->addSuccess( + $this->messageManager->addSuccess( __('The package %1 data has been loaded.', $packageName) ); } catch (\Exception $e) { - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } } $this->_redirect('adminhtml/*/edit'); @@ -119,9 +119,9 @@ class Custom extends \Magento\Backend\App\Action /** @var $ext \Magento\Connect\Model\Extension */ $ext->setData($p); if ($ext->savePackage()) { - $session->addSuccess(__('The package data has been saved.')); + $this->messageManager->addSuccess(__('The package data has been saved.')); } else { - $session->addError(__('Something went wrong saving the package data.')); + $this->messageManager->addError(__('Something went wrong saving the package data.')); $this->_redirect('adminhtml/*/edit'); } if (empty($create)) { @@ -130,10 +130,10 @@ class Custom extends \Magento\Backend\App\Action $this->_forward('create'); } } catch (\Magento\Core\Exception $e){ - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('adminhtml/*'); } catch (\Exception $e){ - $session->addException($e, __('Something went wrong saving the package.')); + $this->messageManager->addException($e, __('Something went wrong saving the package.')); $this->_redirect('adminhtml/*'); } } @@ -161,10 +161,10 @@ class Custom extends \Magento\Backend\App\Action } $this->_redirect('adminhtml/*'); } catch(\Magento\Core\Exception $e){ - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('adminhtml/*'); } catch(\Exception $e){ - $session->addException($e, __('Something went wrong creating the package.')); + $this->messageManager->addException($e, __('Something went wrong creating the package.')); $this->_redirect('adminhtml/*'); } } diff --git a/app/code/Magento/Connect/Helper/Data.php b/app/code/Magento/Connect/Helper/Data.php index 7438729beca..0b4c4b8969f 100644 --- a/app/code/Magento/Connect/Helper/Data.php +++ b/app/code/Magento/Connect/Helper/Data.php @@ -33,20 +33,18 @@ class Data extends \Magento\Core\Helper\Data /** * @var \Magento\Filesystem */ - protected $_filesystem; - - /** - * Application dirs - * - * @var \Magento\App\Dir - */ - protected $_dirs; + protected $filesystem; /** * @var \Magento\Convert\Xml */ protected $_xmlConverter; + /** + * @var \Magento\Filesystem\Directory\Read + */ + protected $readDirectory; + /** * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Model\Store\Config $coreStoreConfig @@ -55,7 +53,6 @@ class Data extends \Magento\Core\Helper\Data * @param \Magento\App\State $appState * @param \Magento\Filesystem $filesystem * @param \Magento\Convert\Xml $xmlConverter - * @param \Magento\App\Dir $dirs * @param bool $dbCompatibleMode */ public function __construct( @@ -66,11 +63,10 @@ class Data extends \Magento\Core\Helper\Data \Magento\App\State $appState, \Magento\Filesystem $filesystem, \Magento\Convert\Xml $xmlConverter, - \Magento\App\Dir $dirs, $dbCompatibleMode = true ) { - $this->_filesystem = $filesystem; - $this->_dirs = $dirs; + $this->filesystem = $filesystem; + $this->readDirectory = $this->filesystem->getDirectoryRead(\Magento\Filesystem::VAR_DIR); $this->_xmlConverter = $xmlConverter; parent::__construct( $context, @@ -82,28 +78,6 @@ class Data extends \Magento\Core\Helper\Data ); } - /** - * Retrieve file system path for local extension packages - * Return path with last directory separator - * - * @return string - */ - public function getLocalPackagesPath() - { - return $this->_dirs->getDir('var') . DS . 'connect' . DS; - } - - /** - * Retrieve file system path for local extension packages (for version 1 packages only) - * Return path with last directory separator - * - * @return string - */ - public function getLocalPackagesPathV1x() - { - return $this->_dirs->getDir('var') . DS . 'pear' . DS; - } - /** * Retrieve a map to convert a channel from previous version of Magento Connect Manager * @@ -165,24 +139,21 @@ class Data extends \Magento\Core\Helper\Data * Load local package data array * * @param string $packageName without extension - * @return array|false + * @return array|boolean */ public function loadLocalPackage($packageName) { - //check LFI protection - $this->_filesystem->checkLfiProtection($packageName); - $path = $this->getLocalPackagesPath(); - $xmlFile = $path . $packageName . '.xml'; - $serFile = $path . $packageName . '.ser'; - if ($this->_filesystem->isFile($xmlFile) && $this->_filesystem->isReadable($xmlFile)) { - $xml = simplexml_load_string($this->_filesystem->read($xmlFile)); + $xmlFile = sprintf('connect/%.xml', $packageName); + $serFile = sprintf('connect/%.ser', $packageName); + if ($this->readDirectory->isFile($xmlFile) && $this->readDirectory->isReadable($xmlFile)) { + $xml = simplexml_load_string($this->readDirectory->readFile($xmlFile)); $data = $this->_xmlConverter->xmlToAssoc($xml); if (!empty($data)) { return $data; } } - if ($this->_filesystem->isFile($serFile) && $this->_filesystem->isReadable($xmlFile)) { - $data = unserialize($this->_filesystem->read($serFile)); + if ($this->readDirectory->isFile($serFile) && $this->readDirectory->isReadable($xmlFile)) { + $data = unserialize($this->readDirectory->readFile($serFile)); if (!empty($data)) { return $data; } diff --git a/app/code/Magento/Connect/Model/Extension.php b/app/code/Magento/Connect/Model/Extension.php index 6eb6cf76e7f..a4bb758b250 100644 --- a/app/code/Magento/Connect/Model/Extension.php +++ b/app/code/Magento/Connect/Model/Extension.php @@ -48,14 +48,7 @@ class Extension extends \Magento\Object /** * @var \Magento\Filesystem $filesystem */ - protected $_filesystem; - - /** - * Connect data - * - * @var \Magento\Connect\Helper\Data - */ - protected $_connectData; + protected $filesystem; /** * @var \Magento\Convert\ConvertArray @@ -70,24 +63,38 @@ class Extension extends \Magento\Object protected $_session; /** + * @var \Magento\Filesystem\Directory\Write + */ + protected $writeDirectory; + + /** + * @var \Magento\Logger + */ + protected $logger; + + /** + * Constructor + * * @param \Magento\Convert\ConvertArray $convertArray - * @param \Magento\Connect\Helper\Data $connectData - * @param \Magento\Filesystem $filesystem - * @param \Magento\Connect\Model\Session $session - * @param array $data + * @param \Magento\Filesystem $filesystem + * @param Session $session + * @param \Magento\Logger $logger + * @param array $data */ public function __construct( - \Magento\Convert\ConvertArray $convertArray, - \Magento\Connect\Helper\Data $connectData, - \Magento\Filesystem $filesystem, - \Magento\Connect\Model\Session $session, + \Magento\Convert\ConvertArray $convertArray, + \Magento\Filesystem $filesystem, + \Magento\Connect\Model\Session $session, + \Magento\Logger $logger, array $data = array() ) { - $this->_convertArray = $convertArray; - $this->_connectData = $connectData; - $this->_session = $session; + $this->_convertArray = $convertArray; + $this->_session = $session; + $this->filesystem = $filesystem; + $this->writeDirectory = $this->filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->logger = $logger; parent::__construct($data); - $this->_filesystem = $filesystem; + } /** @@ -185,7 +192,7 @@ class Extension extends \Magento\Object $filesArray = preg_split("/[\n\r]+/", $filesString); foreach ($filesArray as $file) { $file = trim($file, "/"); - $res = explode(DIRECTORY_SEPARATOR, $file, 2); + $res = explode('/', $file, 2); array_map('trim', $res); if (2 == count($res)) { $packageFiles[] = array('target' => $res[0], 'path' => $res[1]); @@ -296,24 +303,25 @@ class Extension extends \Magento\Object } try { - $path = $this->_connectData->getLocalPackagesPath(); - $this->_filesystem->write($path . 'package.xml', $this->getPackageXml()); - +// $path = $this->writeDirectory->getAbsolutePath(); + $this->writeDirectory->writeFile(sprintf('connect/%s','package.xml'), $this->getPackageXml()); $this->unsPackageXml(); $this->unsTargets(); $xml = $this->_convertArray->assocToXml($this->getData()); $xml = new \Magento\Simplexml\Element($xml->asXML()); // prepare dir to save - $parts = explode(DS, $fileName); + $parts = explode('/', $fileName); array_pop($parts); - $newDir = implode(DS, $parts); + $directoryPath = implode('/', $parts); - if (!empty($newDir) && !$this->_filesystem->isDirectory($path . $newDir)) { - $this->_filesystem->ensureDirectoryExists($path, $newDir, 0777); + if (!empty($directoryPath)) { + $this->writeDirectory->create(sprintf('connect/%s', $directoryPath)); } - $this->_filesystem->write($path . $fileName . '.xml', $xml->asNiceXml()); + $this->writeDirectory->writeFile(sprintf('connect/%s.xml', $fileName), $xml->asNiceXml()); } catch (\Magento\Filesystem\FilesystemException $e) { + $this->logger->addStreamLog(\Magento\Logger::LOGGER_EXCEPTION); + $this->logger->log($e->getMessage()); return false; } return true; @@ -326,16 +334,17 @@ class Extension extends \Magento\Object */ public function createPackage() { - $path = $this->_connectData->getLocalPackagesPath(); - if (!is_dir($path)) { - if (!mkdir($path)) { - return false; - } + try { + $this->writeDirectory->create('connect/'); + } catch (\Magento\Filesystem\FilesystemException $e) { + $this->logger->addStreamLog(\Magento\Logger::LOGGER_EXCEPTION); + $this->logger->log($e->getMessage()); + return false; } if (!$this->getPackageXml()) { $this->generatePackageXml(); } - $this->getPackage()->save($path); + $this->getPackage()->save($this->writeDirectory->getAbsolutePath('connect/')); return true; } @@ -346,16 +355,18 @@ class Extension extends \Magento\Object */ public function createPackageV1x() { - $path = $this->_connectData->getLocalPackagesPathV1x(); - if (!is_dir($path)) { - if (!mkdir($path)) { - return false; - } + try { + $this->writeDirectory->create('pear/'); + } catch (\Magento\Filesystem\FilesystemException $e) { + $this->logger->addStreamLog(\Magento\Logger::LOGGER_EXCEPTION); + $this->logger->log($e->getMessage()); + return false; } + if (!$this->getPackageXml()) { $this->generatePackageXml(); } - $this->getPackage()->saveV1x($path); + $this->getPackage()->saveV1x($this->writeDirectory->getAbsolutePath('pear/')); return true; } diff --git a/app/code/Magento/Connect/Model/Extension/Collection.php b/app/code/Magento/Connect/Model/Extension/Collection.php index 86ff827a742..50a735c5740 100644 --- a/app/code/Magento/Connect/Model/Extension/Collection.php +++ b/app/code/Magento/Connect/Model/Extension/Collection.php @@ -45,23 +45,28 @@ class Collection extends \Magento\Data\Collection\Filesystem protected $_disallowedFilesMask = '/^package\.xml$/i'; /** - * Base dir where packages are located - * - * @var string + * @var \Magento\Filesystem + */ + protected $filesystem; + + /** + * @var \Magento\Filesystem\Directory\Write */ - protected $_baseDir = ''; + protected $connectDirectory; /** + * Set base dir + * * @param \Magento\Core\Model\EntityFactory $entityFactory - * @param \Magento\App\Dir $dirs + * @param \Magento\Filesystem $filesystem */ - public function __construct(\Magento\Core\Model\EntityFactory $entityFactory, \Magento\App\Dir $dirs) + public function __construct(\Magento\Core\Model\EntityFactory $entityFactory, \Magento\Filesystem $filesystem) { parent::__construct($entityFactory); - $this->_baseDir = $dirs->getDir('var') . DS . 'connect'; - $io = new \Magento\Io\File(); - $io->setAllowCreateFolders(true)->createDestinationDir($this->_baseDir); - $this->addTargetDir($this->_baseDir); + $this->filesystem = $filesystem; + $this->connectDirectory = $this->filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->connectDirectory->create('connect'); + $this->addTargetDir($this->connectDirectory->getAbsolutePath('connect')); } /** @@ -73,13 +78,14 @@ class Collection extends \Magento\Data\Collection\Filesystem protected function _generateRow($filename) { $row = parent::_generateRow($filename); - $row['package'] = preg_replace('/\.(xml|ser)$/', '', str_replace($this->_baseDir . DS, '', $filename)); + $row['package'] = preg_replace('/\.(xml|ser)$/', '', + str_replace($this->connectDirectory->getAbsolutePath('connect/'), '', $filename)); $row['filename_id'] = $row['package']; - $folder = explode(DS, $row['package']); + $folder = explode('/', $row['package']); array_pop($folder); - $row['folder'] = DS; + $row['folder'] = '/'; if (!empty($folder)) { - $row['folder'] = implode(DS, $folder) . DS; + $row['folder'] = implode('/', $folder) . '/'; } return $row; } @@ -95,10 +101,10 @@ class Collection extends \Magento\Data\Collection\Filesystem $collectDirs = $this->_collectDirs; $this->setCollectFiles(false)->setCollectDirs(true); - $this->_collectRecursive($this->_baseDir); - $result = array(DS => DS); + $this->_collectRecursive($this->connectDirectory->getAbsolutePath('connect')); + $result = array('/' => '/'); foreach ($this->_collectedDirs as $dir) { - $dir = str_replace($this->_baseDir . DS, '', $dir) . DS; + $dir = substr($this->connectDirectory->getRelativePath($dir), strlen('connect/')) . '/'; $result[$dir] = $dir; } diff --git a/app/code/Magento/Connect/Model/Session.php b/app/code/Magento/Connect/Model/Session.php index ea9b6530139..4b61479f092 100644 --- a/app/code/Magento/Connect/Model/Session.php +++ b/app/code/Magento/Connect/Model/Session.php @@ -24,17 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Connect\Model; /** * Auth session model - * - * @category Magento - * @package Magento_Connect - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Connect\Model; - -class Session extends \Magento\Core\Model\Session\AbstractSession +class Session extends \Magento\Session\SessionManager { /** * Connect data @@ -44,22 +39,26 @@ class Session extends \Magento\Core\Model\Session\AbstractSession protected $_connectData; /** - * @param \Magento\Core\Model\Session\Context $context + * @param \Magento\App\RequestInterface $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig + * @param \Magento\Session\SaveHandlerInterface $saveHandler + * @param \Magento\Session\ValidatorInterface $validator + * @param \Magento\Session\StorageInterface $storage * @param \Magento\Connect\Helper\Data $connectData - * @param array $data */ public function __construct( - \Magento\Core\Model\Session\Context $context, + \Magento\App\RequestInterface $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, - \Magento\Connect\Helper\Data $connectData, - array $data = array() + \Magento\Session\SaveHandlerInterface $saveHandler, + \Magento\Session\ValidatorInterface $validator, + \Magento\Session\StorageInterface $storage, + \Magento\Connect\Helper\Data $connectData ) { $this->_connectData = $connectData; - parent::__construct($context, $sidResolver, $sessionConfig, $data); - $this->start('adminhtml'); + parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage); + $this->start(); } /** diff --git a/app/code/Magento/Connect/etc/adminhtml/menu.xml b/app/code/Magento/Connect/etc/adminhtml/menu.xml index 1921a0c5588..e6e40c5a8b0 100644 --- a/app/code/Magento/Connect/etc/adminhtml/menu.xml +++ b/app/code/Magento/Connect/etc/adminhtml/menu.xml @@ -27,7 +27,7 @@ --> <config> <menu> - <add id="Magento_Connect::system_extensions" title="Magento Connect" module="Magento_Connect" sortOrder="20" parent="Magento_Adminhtml::system" resource="Magento_Adminhtml::extensions"/> + <add id="Magento_Connect::system_extensions" title="Magento Connect" module="Magento_Connect" sortOrder="20" parent="Magento_Backend::system" resource="Magento_Adminhtml::extensions"/> <add id="Magento_Connect::system_extensions_local" title="Connect Manager" module="Magento_Connect" sortOrder="10" parent="Magento_Connect::system_extensions" action="adminhtml/extension_local" resource="Magento_Adminhtml::local"/> <add id="Magento_Connect::system_extensions_custom" title="Package Extensions" module="Magento_Connect" sortOrder="20" parent="Magento_Connect::system_extensions" action="adminhtml/extension_custom" resource="Magento_Adminhtml::custom"/> </menu> diff --git a/app/code/Magento/Connect/etc/adminhtml/routes.xml b/app/code/Magento/Connect/etc/adminhtml/routes.xml index 2e2336e4ab3..fd5d7747f25 100644 --- a/app/code/Magento/Connect/etc/adminhtml/routes.xml +++ b/app/code/Magento/Connect/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Connect_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Connect" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Email/etc/email_templates_file.xsd b/app/code/Magento/Connect/etc/di.xml similarity index 65% rename from app/code/Magento/Email/etc/email_templates_file.xsd rename to app/code/Magento/Connect/etc/di.xml index 8f227833055..0a845f4b601 100644 --- a/app/code/Magento/Email/etc/email_templates_file.xsd +++ b/app/code/Magento/Connect/etc/di.xml @@ -1,8 +1,6 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0"?> <!-- /** - * Format of individual files of email templates configuration - * * Magento * * NOTICE OF LICENSE @@ -25,14 +23,15 @@ * @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:include schemaLocation="email_templates_types.xsd"/> - - <xs:element name="config"> - <xs:complexType> - <xs:sequence> - <xs:element name="template" type="emailTemplateType" minOccurs="1" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> -</xs:schema> +<config> + <virtualType name="Magento\Connect\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> + <value>adminhtml</value> + </param> + </virtualType> + <type name="Magento\Connect\Model\Session"> + <param name="storage"> + <instance type="Magento\Connect\Model\Session\Storage" /> + </param> + </type> +</config> diff --git a/app/code/Magento/Connect/etc/module.xml b/app/code/Magento/Connect/etc/module.xml index 70f5c1dab48..6e739263a72 100755 --- a/app/code/Magento/Connect/etc/module.xml +++ b/app/code/Magento/Connect/etc/module.xml @@ -26,7 +26,6 @@ <config> <module name="Magento_Connect" version="1.6.0.0" active="true"> <depends> - <module name="Magento_Adminhtml"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> </depends> diff --git a/app/code/Magento/Contacts/Controller/Index.php b/app/code/Magento/Contacts/Controller/Index.php index d3037b115fa..35c1f28a825 100644 --- a/app/code/Magento/Contacts/Controller/Index.php +++ b/app/code/Magento/Contacts/Controller/Index.php @@ -47,7 +47,7 @@ class Index extends \Magento\App\Action\Action * Dispatch request * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface * @throws \Magento\App\Action\NotFoundException */ public function dispatch(RequestInterface $request) @@ -67,8 +67,7 @@ class Index extends \Magento\App\Action\Action $this->_view->getLayout()->getBlock('contactForm') ->setFormAction($this->_objectManager->create('Magento\Core\Model\Url')->getUrl('*/*/post')); - $messageStores = array('Magento\Customer\Model\Session', 'Magento\Catalog\Model\Session'); - $this->_view->getLayout()->initMessages($messageStores); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -135,7 +134,7 @@ class Index extends \Magento\App\Action\Action $translate->setTranslateInline(true); - $this->_objectManager->get('Magento\Customer\Model\Session')->addSuccess( + $this->messageManager->addSuccess( __('Thanks for contacting us with your comments and questions. We\'ll respond to you very soon.') ); $this->_redirect('*/*/'); @@ -143,10 +142,7 @@ class Index extends \Magento\App\Action\Action return; } catch (\Exception $e) { $translate->setTranslateInline(true); - - $this->_objectManager->get('Magento\Customer\Model\Session')->addError( - __('Something went wrong submitting your request.') - ); + $this->messageManager->addError(__('Something went wrong submitting your request.')); $this->_redirect('*/*/'); return; } diff --git a/app/code/Magento/Contacts/etc/email_templates.xml b/app/code/Magento/Contacts/etc/email_templates.xml index ec626af611a..4369abe0f03 100644 --- a/app/code/Magento/Contacts/etc/email_templates.xml +++ b/app/code/Magento/Contacts/etc/email_templates.xml @@ -24,5 +24,5 @@ */ --> <config> - <template id="contacts_email_email_template" label="Contact Form" file="submitted_form.html" type="text"/> + <template id="contacts_email_email_template" label="Contact Form" file="submitted_form.html" type="text" module="Magento_Contacts"/> </config> diff --git a/app/code/Magento/Core/App/Action/Plugin/Install.php b/app/code/Magento/Core/App/Action/Plugin/Install.php index f70abd41b31..d95391ec48d 100644 --- a/app/code/Magento/Core/App/Action/Plugin/Install.php +++ b/app/code/Magento/Core/App/Action/Plugin/Install.php @@ -71,6 +71,7 @@ class Install * * @param array $arguments * @param \Magento\Code\Plugin\InvocationChain $invocationChain + * @return \Magento\App\ResponseInterface */ public function aroundDispatch(array $arguments, \Magento\Code\Plugin\InvocationChain $invocationChain) { @@ -79,8 +80,8 @@ class Install $this->_response->setRedirect( $this->_url->getUrl('install') ); - return; + return $this->_response; } - $invocationChain->proceed($arguments); + return $invocationChain->proceed($arguments); } } diff --git a/app/code/Magento/Core/App/Action/Plugin/Session.php b/app/code/Magento/Core/App/Action/Plugin/Session.php index 70c7a250899..1801244c661 100644 --- a/app/code/Magento/Core/App/Action/Plugin/Session.php +++ b/app/code/Magento/Core/App/Action/Plugin/Session.php @@ -66,8 +66,14 @@ class Session */ protected $_storeConfig; + /** + * @var \Magento\App\ResponseInterface + */ + protected $_response; + /** * @param \Magento\App\ActionFlag $flag + * @param \Magento\App\ResponseInterface $response * @param \Magento\Core\Model\Session $session * @param \Magento\Stdlib\Cookie $cookie * @param \Magento\Core\Model\Url $url @@ -78,6 +84,7 @@ class Session */ public function __construct( \Magento\App\ActionFlag $flag, + \Magento\App\ResponseInterface $response, \Magento\Core\Model\Session $session, \Magento\Stdlib\Cookie $cookie, \Magento\Core\Model\Url $url, @@ -87,6 +94,7 @@ class Session array $cookieCheckActions = array() ) { $this->_session = $session; + $this->_response = $response; $this->_sidResolver = $sidResolver; $this->_cookie = $cookie; $this->_cookieCheckActions = $cookieCheckActions; @@ -114,7 +122,7 @@ class Session $this->_session->unsCookieShouldBeReceived(); if ($this->_storeConfig->getConfig('web/browser_capabilities/cookies')) { $this->_forward($request); - return null; + return $this->_response; } } elseif ($checkCookie) { if ($request->getQuery($this->_sidResolver->getSessionIdQueryParam($this->_session), false) @@ -124,7 +132,7 @@ class Session $this->_session->setCookieShouldBeReceived(true); } else { $this->_forward($request); - return null; + return $this->_response; } } } diff --git a/app/code/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandler.php b/app/code/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandler.php index 697085bde97..2c94a6d68a7 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\App\Dir; + Magento\Filesystem; class DispatchExceptionHandler { @@ -35,22 +35,23 @@ class DispatchExceptionHandler */ protected $_storeManager; - /** - * @var \Magento\App\Dir + * Filesystem instance + * + * @var \Magento\Filesystem */ - protected $_dir; + protected $filesystem; /** * @param StoreManager $storeManager - * @param Dir $dir + * @param Filesystem $filesystem */ public function __construct( StoreManager $storeManager, - Dir $dir + Filesystem $filesystem ) { $this->_storeManager = $storeManager; - $this->_dir = $dir; + $this->filesystem = $filesystem; } /** @@ -64,11 +65,11 @@ class DispatchExceptionHandler { try { return $invocationChain->proceed($arguments); - } catch (\Magento\Core\Model\Session\Exception $e) { + } catch (\Magento\Session\Exception $e) { header('Location: ' . $this->_storeManager->getStore()->getBaseUrl()); exit; } catch (\Magento\Core\Model\Store\Exception $e) { - require $this->_dir->getDir(Dir::PUB) . DS . 'errors' . DS . '404.php'; + require $this->filesystem->getPath(Filesystem::PUB) . '/errors/404.php'; exit; } } diff --git a/app/code/Magento/Core/App/Media.php b/app/code/Magento/Core/App/Media.php index 08743890f8a..910d41562be 100644 --- a/app/code/Magento/Core/App/Media.php +++ b/app/code/Magento/Core/App/Media.php @@ -88,16 +88,27 @@ class Media implements AppInterface */ protected $_response; + /** + * @var \Magento\Filesystem $filesystem + */ + protected $filesystem; + + /** + * @var \Magento\Filesystem\Directory\Read $directory + */ + protected $directory; + /** * @param State $applicationState * @param ObjectManager $objectManager * @param Request $request * @param Response $response * @param callable $isAllowed - * @param string $workingDirectory - * @param string $mediaDirectory - * @param string $configCacheFile - * @param string $relativeFileName + * @param $workingDirectory + * @param $mediaDirectory + * @param $configCacheFile + * @param $relativeFileName + * @param \Magento\Filesystem $filesytem */ public function __construct( State $applicationState, @@ -108,7 +119,8 @@ class Media implements AppInterface $workingDirectory, $mediaDirectory, $configCacheFile, - $relativeFileName + $relativeFileName, + \Magento\Filesystem $filesystem ) { $this->_applicationState = $applicationState; $this->_objectManager = $objectManager; @@ -119,6 +131,8 @@ class Media implements AppInterface $this->_mediaDirectory = $mediaDirectory; $this->_configCacheFile = $configCacheFile; $this->_relativeFileName = $relativeFileName; + $this->filesystem = $filesystem; + $this->directory = $this->filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); } /** @@ -158,7 +172,7 @@ class Media implements AppInterface $sync = $this->_objectManager->get('Magento\Core\Model\File\Storage\Synchronization'); $sync->synchronize($this->_relativeFileName, $this->_request->getFilePath()); - if (is_readable($this->_request->getFilePath())) { + if ($this->directory->isReadable($this->directory->getRelativePath($this->_request->getFilePath()))) { $this->_response->sendFile($this->_request->getFilePath()); return 0; } else { diff --git a/app/code/Magento/Core/App/Response/Redirect.php b/app/code/Magento/Core/App/Response/Redirect.php index ef8f1e54e1c..a359627665c 100644 --- a/app/code/Magento/Core/App/Response/Redirect.php +++ b/app/code/Magento/Core/App/Response/Redirect.php @@ -43,7 +43,7 @@ class Redirect implements \Magento\App\Response\RedirectInterface protected $_urlCoder; /** - * @var \Magento\Core\Model\Session\AbstractSession + * @var \Magento\Session\SessionManagerInterface */ protected $_session; @@ -66,7 +66,7 @@ class Redirect implements \Magento\App\Response\RedirectInterface * @param \Magento\App\RequestInterface $request * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Encryption\UrlCoder $urlCoder - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Core\Model\Url $urlBuilder * @param bool $canUseSessionIdInParam @@ -75,7 +75,7 @@ class Redirect implements \Magento\App\Response\RedirectInterface \Magento\App\RequestInterface $request, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Encryption\UrlCoder $urlCoder, - \Magento\Core\Model\Session\AbstractSession $session, + \Magento\Session\SessionManagerInterface $session, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Core\Model\Url $urlBuilder, $canUseSessionIdInParam = true diff --git a/app/code/Magento/Core/App/Router/Base.php b/app/code/Magento/Core/App/Router/Base.php index 5b87daa0ced..75c2c3c5c30 100644 --- a/app/code/Magento/Core/App/Router/Base.php +++ b/app/code/Magento/Core/App/Router/Base.php @@ -354,14 +354,14 @@ class Base extends \Magento\App\Router\AbstractRouter /** * Build controller class name * - * @param string $realModule + * @param string $module * @param string $controller * @return string */ - public function getControllerClassName($realModule, $controller) + public function getControllerClassName($module, $controller) { return \Magento\Core\Helper\String::buildClassName(array( - $realModule, + $module, 'Controller', $controller )); diff --git a/app/code/Magento/Core/Controller/Index.php b/app/code/Magento/Core/Controller/Index.php index af5fa03247f..53728c8f396 100644 --- a/app/code/Magento/Core/Controller/Index.php +++ b/app/code/Magento/Core/Controller/Index.php @@ -28,7 +28,7 @@ namespace Magento\Core\Controller; class Index extends \Magento\App\Action\Action { - function indexAction() + public function indexAction() { } diff --git a/app/code/Magento/Core/Helper/File/Media.php b/app/code/Magento/Core/Helper/File/Media.php index 4e2facdd14b..f53184a8001 100644 --- a/app/code/Magento/Core/Helper/File/Media.php +++ b/app/code/Magento/Core/Helper/File/Media.php @@ -36,18 +36,26 @@ class Media extends \Magento\App\Helper\AbstractHelper */ protected $_date; + /** + * @var \Magento\Filesystem + */ + protected $filesystem; + /** * Constructor * * @param \Magento\App\Helper\Context $context + * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\Date $date */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Date $date + \Magento\Core\Model\Date $date, + \Magento\Filesystem $filesystem ) { parent::__construct($context); $this->_date = $date; + $this->filesystem = $filesystem; } /** @@ -67,12 +75,14 @@ class Media extends \Magento\App\Helper\AbstractHelper public function collectFileInfo($mediaDirectory, $path) { $path = ltrim($path, '\\/'); - $fullPath = $mediaDirectory . DS . $path; + $fullPath = $mediaDirectory . '/' . $path; - if (!file_exists($fullPath) || !is_file($fullPath)) { + $dir = $this->filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); + $relativePath = $dir->getRelativePath($fullPath); + if (!$dir->isFile($relativePath)) { throw new \Magento\Core\Exception(__('File %1 does not exist', $fullPath)); } - if (!is_readable($fullPath)) { + if (!$dir->isReadable($relativePath)) { throw new \Magento\Core\Exception(__('File %1 is not readable', $fullPath)); } @@ -84,7 +94,7 @@ class Media extends \Magento\App\Helper\AbstractHelper return array( 'filename' => basename($path), - 'content' => @file_get_contents($fullPath), + 'content' => $dir->readFile($relativePath), 'update_time' => $this->_date->date(), 'directory' => $directory ); diff --git a/app/code/Magento/Core/Helper/File/Storage/Database.php b/app/code/Magento/Core/Helper/File/Storage/Database.php index c920f39b5bb..9e0e1567b77 100644 --- a/app/code/Magento/Core/Helper/File/Storage/Database.php +++ b/app/code/Magento/Core/Helper/File/Storage/Database.php @@ -76,21 +76,15 @@ class Database extends \Magento\App\Helper\AbstractHelper */ protected $_fileStorage; - /** - * @var \Magento\App\Dir - */ - protected $_dir; - /** * @var \Magento\Core\Model\ConfigInterface */ protected $config; - + /** * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Model\File\Storage\DatabaseFactory $dbStorageFactory * @param \Magento\Core\Model\File\Storage\File $fileStorage - * @param \Magento\App\Dir $dir * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\ConfigInterface $config */ @@ -98,14 +92,12 @@ class Database extends \Magento\App\Helper\AbstractHelper \Magento\App\Helper\Context $context, \Magento\Core\Model\File\Storage\DatabaseFactory $dbStorageFactory, \Magento\Core\Model\File\Storage\File $fileStorage, - \Magento\App\Dir $dir, \Magento\Filesystem $filesystem, \Magento\Core\Model\ConfigInterface $config ) { $this->_filesystem = $filesystem; $this->_dbStorageFactory = $dbStorageFactory; $this->_fileStorage = $fileStorage; - $this->_dir = $dir; $this->config = $config; parent::__construct($context); } @@ -271,7 +263,7 @@ class Database extends \Magento\App\Helper\AbstractHelper public function getMediaRelativePath($fullPath) { $relativePath = ltrim(str_replace($this->getMediaBaseDir(), '', $fullPath), '\\/'); - return str_replace(DS, '/', $relativePath); + return str_replace('\\', '/', $relativePath); } /** @@ -311,17 +303,17 @@ class Database extends \Magento\App\Helper\AbstractHelper * @param array $result * @return string */ - public function saveUploadedFile($result = array()) + public function saveUploadedFile($result) { if ($this->checkDbUsage()) { - $path = rtrim(str_replace(array('\\', '/'), DS, $result['path']), DS); + $path = rtrim(str_replace(array('\\', '/'), '/', $result['path']), '/'); $file = '/' . ltrim($result['file'], '\\/'); $uniqueResultFile = $this->getUniqueFilename($path, $file); if ($uniqueResultFile !== $file) { - $this->_filesystem->setWorkingDirectory($path); - $this->_filesystem->rename($path . $file, $path . $uniqueResultFile); + $dirWrite = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $dirWrite->renameFile($path . $file, $path . $uniqueResultFile); } $this->saveFile($path . $uniqueResultFile); @@ -351,7 +343,8 @@ class Database extends \Magento\App\Helper\AbstractHelper public function getMediaBaseDir() { if (null === $this->_mediaBaseDirectory) { - $this->_mediaBaseDirectory = rtrim($this->_dir->getDir('media'), '\\/'); + $mediaDir = $this->_filesystem->getPath(\Magento\Filesystem::MEDIA); + $this->_mediaBaseDirectory = rtrim($mediaDir, '\\/'); } return $this->_mediaBaseDirectory; } diff --git a/app/code/Magento/Core/Helper/Js.php b/app/code/Magento/Core/Helper/Js.php index 0c7af2a7ba6..20f4205601c 100644 --- a/app/code/Magento/Core/Helper/Js.php +++ b/app/code/Magento/Core/Helper/Js.php @@ -198,7 +198,9 @@ class Js extends \Magento\App\Helper\AbstractHelper //various files $this->_addTranslation('Allow', __('Allow')); $this->_addTranslation('Activate', __('Activate')); + $this->_addTranslation('Reauthorize', __('Reauthorize')); $this->_addTranslation('Cancel', __('Cancel')); + $this->_addTranslation('Done', __('Done')); $this->_addTranslation('Save', __('Save')); $this->_addTranslation('File extension not known or unsupported type.', __('File extension not known or unsupported type.')); $this->_addTranslation('Configure Product', __('Configure Product')); @@ -280,17 +282,17 @@ class Js extends \Magento\App\Helper\AbstractHelper /** * Adds some translated text to the translated data array as long as the key and text don't match. - * + * * There is no point in having translated text added if the key is already representing the translated text. - * + * * @param $key * @param $translatedText */ - protected function _addTranslation($key, $translatedText) + protected function _addTranslation($key, $translatedText) { if ($key !== $translatedText) { $this->_translateData[$key] = $translatedText; } } - + } diff --git a/app/code/Magento/Core/Helper/Theme.php b/app/code/Magento/Core/Helper/Theme.php index f3d3306ba44..e10cfbc3e64 100644 --- a/app/code/Magento/Core/Helper/Theme.php +++ b/app/code/Magento/Core/Helper/Theme.php @@ -32,11 +32,11 @@ namespace Magento\Core\Helper; class Theme extends \Magento\App\Helper\AbstractHelper { /** - * Directories + * Filesystem facade * - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_dirs; + protected $_filesystem; /** * Layout merge factory @@ -58,20 +58,20 @@ class Theme extends \Magento\App\Helper\AbstractHelper protected $_viewFileSystem; /** - * @param Context $context - * @param \Magento\App\Dir $dirs + * @param \Magento\App\Helper\Context $context + * @param \Magento\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\App\Dir $dirs, + \Magento\Filesystem $filesystem, \Magento\View\Layout\ProcessorFactory $layoutProcessorFactory, \Magento\Core\Model\Resource\Theme\Collection $themeCollection, \Magento\View\FileSystem $viewFileSystem ) { - $this->_dirs = $dirs; + $this->_filesystem = $filesystem; $this->_layoutProcessorFactory = $layoutProcessorFactory; $this->_themeCollection = $themeCollection; $this->_viewFileSystem = $viewFileSystem; @@ -118,16 +118,16 @@ class Theme extends \Magento\App\Helper\AbstractHelper 'skipProxy' => true ); - $basePath = $this->_dirs->getDir(\Magento\App\Dir::ROOT); + $rootDirectory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); $files = array(); foreach ($elements as $fileId) { $fileId = (string)$fileId; $path = $this->_viewFileSystem->getViewFile($fileId, $params); $file = array( 'id' => $fileId, - 'path' => \Magento\Filesystem::fixSeparator($path), + 'path' => $path, ); - $file['safePath'] = $this->getSafePath($file['path'], $basePath); + $file['safePath'] = $rootDirectory->getRelativePath($file['path']); //keys are used also to remove duplicates $files[$fileId] = $file; @@ -145,9 +145,9 @@ class Theme extends \Magento\App\Helper\AbstractHelper */ public function getGroupedCssFiles($theme) { - $jsDir = \Magento\Filesystem::fixSeparator($this->_dirs->getDir(\Magento\App\Dir::PUB_LIB)); - $codeDir = \Magento\Filesystem::fixSeparator($this->_dirs->getDir(\Magento\App\Dir::MODULES)); - $designDir = \Magento\Filesystem::fixSeparator($this->_dirs->getDir(\Magento\App\Dir::THEMES)); + $jsDir = $this->_filesystem->getPath(\Magento\Filesystem::PUB_LIB); + $codeDir = $this->_filesystem->getPath(\Magento\Filesystem::MODULES); + $designDir = $this->_filesystem->getPath(\Magento\Filesystem::THEMES); $groups = array(); $themes = array(); @@ -210,8 +210,8 @@ class Theme extends \Magento\App\Helper\AbstractHelper $relativePath = substr($file['path'], strlen($designDir)); - $area = strtok($relativePath, \Magento\Filesystem::DIRECTORY_SEPARATOR); - $theme = strtok(\Magento\Filesystem::DIRECTORY_SEPARATOR); + $area = strtok($relativePath, '/'); + $theme = strtok('/'); if ($area === false || $theme === false) { throw new \LogicException(__('Theme path "%1/%2" is incorrect', $area, $theme)); @@ -371,18 +371,4 @@ class Theme extends \Magento\App\Helper\AbstractHelper } return 1; } - - /** - * Get relative file path cut to be safe for public sharing - * - * Path is considered from the base Magento directory - * - * @param string $filePath - * @param string $basePath - * @return string - */ - public function getSafePath($filePath, $basePath) - { - return ltrim(str_ireplace($basePath, '', $filePath), '\\/'); - } } diff --git a/app/code/Magento/Core/Helper/Translate.php b/app/code/Magento/Core/Helper/Translate.php index 499bc21b661..387c0fba1d8 100644 --- a/app/code/Magento/Core/Helper/Translate.php +++ b/app/code/Magento/Core/Helper/Translate.php @@ -83,11 +83,13 @@ class Translate extends \Magento\App\Helper\AbstractHelper /** * This method initializes the Translate object for this instance. - * @param $localeCode string - * @param $forceReload bool + * + * @param string $localeCode + * @param bool $forceReload + * @param null $area * @return \Magento\Core\Model\Translate */ - public function initTranslate($localeCode, $forceReload) + public function initTranslate($localeCode, $forceReload, $area = null) { $this->translator->setLocale($localeCode); @@ -98,7 +100,8 @@ class Translate extends \Magento\App\Helper\AbstractHelper 'translate_object' => $this->translator, 'result' => $dispatchResult )); - $this->translator->init(null, $dispatchResult, $forceReload); + $area = isset($area) ? $area : $this->_design->getArea(); + $this->translator->init($area, $dispatchResult, $forceReload); return $this; } } diff --git a/app/code/Magento/Core/Model/AbstractModel.php b/app/code/Magento/Core/Model/AbstractModel.php index 92892941e13..b0ed804c025 100644 --- a/app/code/Magento/Core/Model/AbstractModel.php +++ b/app/code/Magento/Core/Model/AbstractModel.php @@ -153,12 +153,12 @@ abstract class AbstractModel extends \Magento\Object array $data = array() ) { $this->_coreRegistry = $registry; + $this->_appState = $context->getAppState(); $this->_eventManager = $context->getEventDispatcher(); $this->_cacheManager = $context->getCacheManager(); $this->_resource = $resource; $this->_resourceCollection = $resourceCollection; $this->_logger = $context->getLogger(); - $this->_appState = $context->getAppState(); if (method_exists($this->_resource, 'getIdFieldName') || $this->_resource instanceof \Magento\Object) { $this->_idFieldName = $this->_getResource()->getIdFieldName(); diff --git a/app/code/Magento/Core/Model/AbstractShell.php b/app/code/Magento/Core/Model/AbstractShell.php index 85e60e2b30c..beb7e762681 100644 --- a/app/code/Magento/Core/Model/AbstractShell.php +++ b/app/code/Magento/Core/Model/AbstractShell.php @@ -33,6 +33,8 @@ */ namespace Magento\Core\Model; +use Magento\Filesystem\Directory\ReadInterface; + abstract class AbstractShell { /** @@ -57,32 +59,25 @@ abstract class AbstractShell protected $_entryPoint = null; /** - * @var \Magento\Filesystem - */ - protected $_filesystem; - - /** - * @var \Magento\App\Dir + * @var ReadInterface */ - protected $_dir; + protected $rootDirectory; /** * Initializes application and parses input parameters * * @param \Magento\Filesystem $filesystem * @param string $entryPoint - * @param \Magento\App\Dir $dir * @throws \Exception */ - public function __construct(\Magento\Filesystem $filesystem, $entryPoint, \Magento\App\Dir $dir) + public function __construct(\Magento\Filesystem $filesystem, $entryPoint) { if (isset($_SERVER['REQUEST_METHOD'])) { throw new \Exception('This script cannot be run from Browser. This is the shell script.'); } - $this->_filesystem = $filesystem; + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); $this->_entryPoint = $entryPoint; - $this->_dir = $dir; $this->_rawArgs = $_SERVER['argv']; $this->_applyPhpVariables(); $this->_parseArgs(); @@ -101,17 +96,6 @@ abstract class AbstractShell return $this; } - - /** - * Gets Magento root path (with last directory separator) - * - * @return string - */ - protected function _getRootPath() - { - return $this->_dir->getDir(\Magento\App\Dir::ROOT); - } - /** * Parses .htaccess file and apply php settings to shell script * @@ -119,10 +103,10 @@ abstract class AbstractShell */ protected function _applyPhpVariables() { - $htaccess = $this->_getRootPath() . '.htaccess'; - if ($this->_filesystem->isFile($htaccess)) { + $htaccess = '.htaccess'; + if ($this->rootDirectory->isFile($htaccess)) { // parse htaccess file - $data = $this->_filesystem->read($htaccess); + $data = $this->rootDirectory->readFile($htaccess); $matches = array(); preg_match_all('#^\s+?php_value\s+([a-z_]+)\s+(.+)$#siUm', $data, $matches, PREG_SET_ORDER); if ($matches) { diff --git a/app/code/Magento/Core/Model/App.php b/app/code/Magento/Core/Model/App.php index edf27a95d8e..4c45870ff7b 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-dev56'; + const VERSION = '2.0.0.0-dev57'; /** @@ -425,7 +425,10 @@ class App implements \Magento\Core\Model\AppInterface if (session_module_name() == 'files') { /** @var \Magento\Filesystem $filesystem */ $filesystem = $this->_objectManager->create('Magento\Filesystem'); - $filesystem->delete(session_save_path()); + $sessionDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::SESSION); + foreach ($sessionDirectory->read() as $path) { + $sessionDirectory->delete($path); + } } return $this; } @@ -801,7 +804,7 @@ class App implements \Magento\Core\Model\AppInterface 'revision' => '0', 'patch' => '0', 'stability' => 'dev', - 'number' => '56', + 'number' => '57', ); } } diff --git a/app/code/Magento/Core/Model/App/Emulation.php b/app/code/Magento/Core/Model/App/Emulation.php index 32fda75c306..28ee619348a 100644 --- a/app/code/Magento/Core/Model/App/Emulation.php +++ b/app/code/Magento/Core/Model/App/Emulation.php @@ -234,7 +234,7 @@ class Emulation extends \Magento\Object $storeId ); $this->_locale->setLocaleCode($newLocaleCode); - $this->_helperTranslate->initTranslate($newLocaleCode, true); + $this->_helperTranslate->initTranslate($newLocaleCode, true, $area); return $initialLocaleCode; } diff --git a/app/code/Magento/Core/Model/Asset/Plugin/CleanMergedJsCss.php b/app/code/Magento/Core/Model/Asset/Plugin/CleanMergedJsCss.php index aef7bd92e3b..1cd69034ceb 100644 --- a/app/code/Magento/Core/Model/Asset/Plugin/CleanMergedJsCss.php +++ b/app/code/Magento/Core/Model/Asset/Plugin/CleanMergedJsCss.php @@ -32,20 +32,20 @@ class CleanMergedJsCss protected $database; /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $dirs; + protected $filesystem; /** * @param \Magento\Core\Helper\File\Storage\Database $database - * @param \Magento\App\Dir $dirs + * @param \Magento\Filesystem $filesystem */ public function __construct( \Magento\Core\Helper\File\Storage\Database $database, - \Magento\App\Dir $dirs + \Magento\Filesystem $filesystem ) { $this->database = $database; - $this->dirs = $dirs; + $this->filesystem = $filesystem; } /** @@ -58,8 +58,9 @@ class CleanMergedJsCss { $invocationChain->proceed($arguments); - $mergedDir = $this->dirs->getDir(\Magento\App\Dir::PUB_VIEW_CACHE) - . '/' . \Magento\View\Asset\Merged::PUBLIC_MERGE_DIR; + /** @var \Magento\Filesystem\Directory\ReadInterface $pubCacheDirectory */ + $pubCacheDirectory = $this->filesystem->getDirectoryRead(\Magento\Filesystem::PUB_VIEW_CACHE); + $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 ec042016b96..ea38c20537b 100644 --- a/app/code/Magento/Core/Model/Config/FileResolver.php +++ b/app/code/Magento/Core/Model/Config/FileResolver.php @@ -35,20 +35,23 @@ class FileResolver implements \Magento\Config\FileResolverInterface protected $_moduleReader; /** - * @var \Magento\App\Dir + * @var \Magento\Config\FileIteratorFactory */ - protected $_applicationDirs; + protected $iteratorFactory; /** * @param \Magento\Module\Dir\Reader $moduleReader - * @param \Magento\App\Dir $applicationDirs + * @param \Magento\Filesystem $filesystem + * @param \Magento\Config\FileIteratorFactory $iteratorFactory */ public function __construct( \Magento\Module\Dir\Reader $moduleReader, - \Magento\App\Dir $applicationDirs + \Magento\Filesystem $filesystem, + \Magento\Config\FileIteratorFactory $iteratorFactory ) { + $this->iteratorFactory = $iteratorFactory; + $this->filesystem = $filesystem; $this->_moduleReader = $moduleReader; - $this->_applicationDirs = $applicationDirs; } /** @@ -58,19 +61,19 @@ class FileResolver implements \Magento\Config\FileResolverInterface { switch ($scope) { case 'primary': - $appConfigDir = $this->_applicationDirs->getDir(\Magento\App\Dir::CONFIG); - // Create pattern similar to app/etc/{*config.xml,*/*config.xml} - $filePattern = $appConfigDir . DIRECTORY_SEPARATOR - . '{*' . $filename . ',*' . DIRECTORY_SEPARATOR . '*' . $filename . '}'; - $fileList = glob($filePattern, GLOB_BRACE); + $directory = $this->filesystem->getDirectoryRead(\Magento\Filesystem::CONFIG); + $iterator = $this->iteratorFactory->create( + $directory, + $directory->search('#' . preg_quote($filename) . '$#') + ); break; case 'global': - $fileList = $this->_moduleReader->getConfigurationFiles($filename); + $iterator = $this->_moduleReader->getConfigurationFiles($filename); break; default: - $fileList = $this->_moduleReader->getConfigurationFiles($scope . DIRECTORY_SEPARATOR . $filename); + $iterator = $this->_moduleReader->getConfigurationFiles($scope . '/' . $filename); break; } - return $fileList; + return $iterator; } } diff --git a/app/code/Magento/Core/Model/Config/Initial/Reader.php b/app/code/Magento/Core/Model/Config/Initial/Reader.php index d507e71f53e..ef06c28f346 100644 --- a/app/code/Magento/Core/Model/Config/Initial/Reader.php +++ b/app/code/Magento/Core/Model/Config/Initial/Reader.php @@ -103,7 +103,10 @@ class Reader { $fileList = array(); foreach ($this->_scopePriorityScheme as $scope) { - $fileList = array_merge($fileList, $this->_fileResolver->get($this->_fileName, $scope)); + $directories = $this->_fileResolver->get($this->_fileName, $scope); + foreach ($directories as $key => $directory) { + $fileList[$key] = $directory; + } } if (!count($fileList)) { @@ -117,12 +120,12 @@ class Reader if (is_null($domDocument)) { $class = $this->_domDocumentClass; $domDocument = new $class( - file_get_contents($file), + $file, array(), $this->_schemaFile ); } else { - $domDocument->merge(file_get_contents($file)); + $domDocument->merge($file); } } catch (\Magento\Config\Dom\ValidationException $e) { throw new \Magento\Exception("Invalid XML in file " . $file . ":\n" . $e->getMessage()); diff --git a/app/code/Magento/Core/Model/DataService/Config/Reader.php b/app/code/Magento/Core/Model/DataService/Config/Reader.php index f714a3308d3..fa5313694bc 100644 --- a/app/code/Magento/Core/Model/DataService/Config/Reader.php +++ b/app/code/Magento/Core/Model/DataService/Config/Reader.php @@ -33,10 +33,10 @@ class Reader extends \Magento\Config\AbstractXml private $_modulesReader; /** - * @param array $configFiles + * @param \Magento\Config\FileIterator $configFiles * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(array $configFiles, \Magento\Module\Dir\Reader $moduleReader) + public function __construct(\Magento\Config\FileIterator $configFiles, \Magento\Module\Dir\Reader $moduleReader) { if (count($configFiles)) { parent::__construct($configFiles); diff --git a/app/code/Magento/Core/Model/DataService/Config/Reader/Factory.php b/app/code/Magento/Core/Model/DataService/Config/Reader/Factory.php index f2c5adf2dd1..9dbf0ac0bab 100644 --- a/app/code/Magento/Core/Model/DataService/Config/Reader/Factory.php +++ b/app/code/Magento/Core/Model/DataService/Config/Reader/Factory.php @@ -46,7 +46,7 @@ class Factory * @param array $configFiles * @return \Magento\Core\Model\DataService\Config\Reader */ - public function createReader(array $configFiles) + public function createReader($configFiles) { return $this->_objectManager->create('Magento\Core\Model\DataService\Config\Reader', array('configFiles' => $configFiles)); diff --git a/app/code/Magento/Core/Model/File/Storage.php b/app/code/Magento/Core/Model/File/Storage.php index 3b076dcaa2a..3ae3e1f056f 100644 --- a/app/code/Magento/Core/Model/File/Storage.php +++ b/app/code/Magento/Core/Model/File/Storage.php @@ -26,6 +26,8 @@ namespace Magento\Core\Model\File; +use \Magento\Filesystem; + /** * Class Storage */ @@ -92,9 +94,11 @@ class Storage extends \Magento\Core\Model\AbstractModel protected $_databaseFactory; /** - * @var \Magento\App\Dir + * Filesystem instance + * + * @var \Magento\Filesystem */ - protected $_dir; + protected $filesystem; /** * @param \Magento\Core\Model\Context $context @@ -105,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\App\Dir $dir + * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -119,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\App\Dir $dir, + \Magento\Filesystem $filesystem, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -130,7 +134,7 @@ class Storage extends \Magento\Core\Model\AbstractModel $this->_fileFlag = $fileFlag; $this->_fileFactory = $fileFactory; $this->_databaseFactory = $databaseFactory; - $this->_dir = $dir; + $this->filesystem = $filesystem; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -294,7 +298,7 @@ class Storage extends \Magento\Core\Model\AbstractModel public function getScriptConfig() { $config = array(); - $config['media_directory'] = $this->_dir->getDir('media'); + $config['media_directory'] = $this->filesystem->getPath(Filesystem::MEDIA); $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 b0d89a8bbb2..3770514d2b6 100644 --- a/app/code/Magento/Core/Model/File/Storage/Config.php +++ b/app/code/Magento/Core/Model/File/Storage/Config.php @@ -23,6 +23,10 @@ */ namespace Magento\Core\Model\File\Storage; +use Magento\Filesystem\Directory\WriteInterface as DirectoryWrite, + Magento\Filesystem\File\Write, + Magento\Filesystem\FilesystemException; + class Config { /** @@ -30,33 +34,35 @@ class Config * * @var string */ - protected $_cacheFile; + protected $cacheFilePath; /** * Loaded config * * @var array */ - protected $_config; + protected $config; /** * File stream handler * - * @var \Magento\Io\File + * @var DirectoryWrite */ - protected $_streamFactory; + protected $pubDirectory; /** * @param \Magento\Core\Model\File\Storage $storage - * @param \Magento\Filesystem\Stream\LocalFactory $streamFactory + * @param \Magento\Filesystem $filesystem * @param string $cacheFile */ public function __construct( - \Magento\Core\Model\File\Storage $storage, \Magento\Filesystem\Stream\LocalFactory $streamFactory, $cacheFile + \Magento\Core\Model\File\Storage $storage, + \Magento\Filesystem $filesystem, + $cacheFile ) { - $this->_config = $storage->getScriptConfig(); - $this->_streamFactory = $streamFactory; - $this->_cacheFile = $cacheFile; + $this->config = $storage->getScriptConfig(); + $this->pubDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::PUB); + $this->cacheFilePath = $cacheFile; } /** @@ -66,7 +72,7 @@ class Config */ public function getMediaDirectory() { - return $this->_config['media_directory']; + return $this->config['media_directory']; } /** @@ -76,7 +82,7 @@ class Config */ public function getAllowedResources() { - return $this->_config['allowed_resources']; + return $this->config['allowed_resources']; } /** @@ -84,16 +90,15 @@ class Config */ public function save() { - /** @var \Magento\Filesystem\StreamInterface $stream */ - $stream = $this->_streamFactory->create(array('path' => $this->_cacheFile)); + /** @var Write $file */ + $file = $this->pubDirectory->openFile($this->pubDirectory->getRelativePath($this->cacheFilePath), 'w'); try{ - $stream->open('w'); - $stream->lock(true); - $stream->write(json_encode($this->_config)); - $stream->unlock(); - $stream->close(); - } catch (\Magento\Filesystem\FilesystemException $e) { - $stream->close(); + $file->lock(); + $file->write(json_encode($this->config)); + $file->unlock(); + $file->close(); + } catch (FilesystemException $e) { + $file->close(); } } } diff --git a/app/code/Magento/Core/Model/File/Storage/File.php b/app/code/Magento/Core/Model/File/Storage/File.php index 4d2c6ed91e8..ddad0b3f069 100644 --- a/app/code/Magento/Core/Model/File/Storage/File.php +++ b/app/code/Magento/Core/Model/File/Storage/File.php @@ -298,7 +298,7 @@ class File ) { try { $filename = (isset($file['directory']) && !empty($file['directory'])) - ? $file['directory'] . DS . $file['filename'] + ? $file['directory'] . '/' . $file['filename'] : $file['filename']; return $this->_fileUtility diff --git a/app/code/Magento/Core/Model/File/Storage/Request.php b/app/code/Magento/Core/Model/File/Storage/Request.php index d98e12280ee..4049b3e6858 100644 --- a/app/code/Magento/Core/Model/File/Storage/Request.php +++ b/app/code/Magento/Core/Model/File/Storage/Request.php @@ -47,7 +47,7 @@ class Request { $request = $request ? : new \Zend_Controller_Request_Http(); $this->_pathInfo = str_replace('..', '', ltrim($request->getPathInfo(), '/')); - $this->_filePath = str_replace('/', DS, $workingDir . DS . $this->_pathInfo); + $this->_filePath = $workingDir . '/' . $this->_pathInfo; } /** diff --git a/app/code/Magento/Core/Model/File/Storage/Synchronization.php b/app/code/Magento/Core/Model/File/Storage/Synchronization.php index b5067292b05..53fea4019a5 100644 --- a/app/code/Magento/Core/Model/File/Storage/Synchronization.php +++ b/app/code/Magento/Core/Model/File/Storage/Synchronization.php @@ -24,6 +24,10 @@ namespace Magento\Core\Model\File\Storage; +use Magento\Filesystem\Directory\WriteInterface as DirectoryWrite, + Magento\Filesystem\File\Write, + Magento\Filesystem\FilesystemException; + /** * Class Synchronization */ @@ -34,25 +38,25 @@ class Synchronization * * @var \Magento\Core\Model\File\Storage\DatabaseFactory */ - protected $_storageFactory; + protected $storageFactory; /** * File stream handler * - * @var \Magento\Io\File + * @var DirectoryWrite */ - protected $_streamFactory; + protected $pubDirectory; /** * @param \Magento\Core\Model\File\Storage\DatabaseFactory $storageFactory - * @param \Magento\Filesystem\Stream\LocalFactory $streamFactory + * @param \Magento\Filesystem $filesystem */ public function __construct( \Magento\Core\Model\File\Storage\DatabaseFactory $storageFactory, - \Magento\Filesystem\Stream\LocalFactory $streamFactory + \Magento\Filesystem $filesystem ) { - $this->_storageFactory = $storageFactory; - $this->_streamFactory = $streamFactory; + $this->storageFactory = $storageFactory; + $this->pubDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::PUB); } /** @@ -65,27 +69,21 @@ class Synchronization public function synchronize($relativeFileName, $filePath) { /** @var $storage \Magento\Core\Model\File\Storage\Database */ - $storage = $this->_storageFactory->create(); + $storage = $this->storageFactory->create(); try { $storage->loadByFilename($relativeFileName); } catch (\Exception $e) { } if ($storage->getId()) { - $directory = dirname($filePath); - if (!is_dir($directory) && !mkdir($directory, 0777, true)) { - throw new \LogicException('Could not create directory'); - } - - /** @var \Magento\Filesystem\StreamInterface $stream */ - $stream = $this->_streamFactory->create(array('path' => $filePath)); + /** @var Write $file */ + $file = $this->pubDirectory->openFile($this->pubDirectory->getRelativePath($filePath), 'w'); try{ - $stream->open('w'); - $stream->lock(true); - $stream->write($storage->getContent()); - $stream->unlock(); - $stream->close(); - } catch (\Magento\Filesystem\FilesystemException $e) { - $stream->close(); + $file->lock(); + $file->write($storage->getContent()); + $file->unlock(); + $file->close(); + } catch (FilesystemException $e) { + $file->close(); } } } diff --git a/app/code/Magento/Core/Model/File/Validator/AvailablePath.php b/app/code/Magento/Core/Model/File/Validator/AvailablePath.php index 6c26f145bd2..f29d7b67d0b 100644 --- a/app/code/Magento/Core/Model/File/Validator/AvailablePath.php +++ b/app/code/Magento/Core/Model/File/Validator/AvailablePath.php @@ -232,9 +232,9 @@ class AvailablePath extends \Zend_Validate_Abstract } //validation - $value = str_replace(array('/', '\\'), DS, $this->_value); + $value = str_replace('\\', '/', $this->_value); $valuePathInfo = pathinfo(ltrim($value, '\\/')); - if ($valuePathInfo['dirname'] == '.' || $valuePathInfo['dirname'] == DS) { + if ($valuePathInfo['dirname'] == '.' || $valuePathInfo['dirname'] == '/') { $valuePathInfo['dirname'] = ''; } @@ -265,10 +265,10 @@ class AvailablePath extends \Zend_Validate_Abstract if (!isset($this->_pathsData[$path]['regFilename'])) { $pathInfo = pathinfo($path); $options['file_mask'] = $pathInfo['basename']; - if ($pathInfo['dirname'] == '.' || $pathInfo['dirname'] == DS) { + if ($pathInfo['dirname'] == '.' || $pathInfo['dirname'] == '/') { $pathInfo['dirname'] = ''; } else { - $pathInfo['dirname'] = str_replace(array('/', '\\'), DS, $pathInfo['dirname']); + $pathInfo['dirname'] = str_replace('\\', '/', $pathInfo['dirname']); } $options['dir_mask'] = $pathInfo['dirname']; $this->_pathsData[$path]['options'] = $options; @@ -293,21 +293,21 @@ class AvailablePath extends \Zend_Validate_Abstract } //directory mask - $reg = $options['dir_mask'] . DS; + $reg = $options['dir_mask'] . '/'; if (!isset($this->_pathsData[$path]['regDir'])) { //make regular $reg = str_replace('.', '\.', $reg); $reg = str_replace('*\\', '||', $reg); $reg = str_replace('*/', '||', $reg); //$reg = str_replace('*', '||', $reg); - $reg = str_replace(DS, '[\\' . DS . ']', $reg); - $reg = str_replace('?', '([^\\' . DS . ']+)', $reg); - $reg = str_replace('||', '(.*[\\' . DS . '])?', $reg); + $reg = str_replace('/', '[\\/]', $reg); + $reg = str_replace('?', '([^\\/]+)', $reg); + $reg = str_replace('||', '(.*[\\/])?', $reg); $reg = "/^$reg$/"; } else { $reg = $this->_pathsData[$path]['regDir']; } - $resultDir = preg_match($reg, $valuePathInfo['dirname'] . DS); + $resultDir = preg_match($reg, $valuePathInfo['dirname'] . '/'); if ($protected && ($resultDir && $resultFile)) { return false; diff --git a/app/code/Magento/Core/Model/Input/Filter.php b/app/code/Magento/Core/Model/Input/Filter.php index f4a3052d3c8..666942f5b00 100644 --- a/app/code/Magento/Core/Model/Input/Filter.php +++ b/app/code/Magento/Core/Model/Input/Filter.php @@ -100,25 +100,16 @@ namespace Magento\Core\Model\Input; class Filter implements \Zend_Filter_Interface { - /** - * @var \Magento\App\Helper\HelperFactory - */ - protected $_helperFactory; - /** * @var \Magento\ObjectManager */ protected $_objectManager; /** - * @param \Magento\App\Helper\HelperFactory $helperFactory * @param \Magento\ObjectManager $objectManager */ - function __construct( - \Magento\App\Helper\HelperFactory $helperFactory, - \Magento\ObjectManager $objectManager - ) { - $this->_helperFactory = $helperFactory; + public function __construct(\Magento\ObjectManager $objectManager) + { $this->_objectManager = $objectManager; } @@ -301,7 +292,7 @@ class Filter implements \Zend_Filter_Interface if (isset($filterData['helper'])) { $helper = $filterData['helper']; if (is_string($helper)) { - $helper = $this->_helperFactory->get($helper); + $helper = $this->_objectManager->get($helper); } elseif (!($helper instanceof \Magento\App\Helper\AbstractHelper)) { throw new \Exception("Filter '{$helper}' not found"); } diff --git a/app/code/Magento/Core/Model/Layout.php b/app/code/Magento/Core/Model/Layout.php index dabdb6ffe58..d32868c3745 100644 --- a/app/code/Magento/Core/Model/Layout.php +++ b/app/code/Magento/Core/Model/Layout.php @@ -24,19 +24,14 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -/** - * Layout model - * - * @category Magento - * @package Magento_Core - */ namespace Magento\Core\Model; use Magento\View\Element\BlockFactory; use Magento\View\Layout\Element; /** + * Layout model + * * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyFields) @@ -169,6 +164,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn /** * Renderers registered for particular name + * * @var array */ protected $_renderers = array(); @@ -178,21 +174,14 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn * * @var \Magento\Core\Helper\Data */ - protected $_coreData = null; - - /** - * Core data - * - * @var \Magento\App\Helper\HelperFactory - */ - protected $_factoryHelper = null; + protected $_coreData; /** * Core event manager proxy * * @var \Magento\Event\ManagerInterface */ - protected $_eventManager = null; + protected $_eventManager; /** * Core store config @@ -222,16 +211,15 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn protected $_appState; /** - * @var \Magento\ObjectManager + * @var \Magento\Message\ManagerInterface */ - protected $_objectManager; + protected $messageManager; /** * @param \Magento\View\Layout\ProcessorFactory $processorFactory * @param Resource\Theme\CollectionFactory $themeFactory * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\App\Helper\HelperFactory $factoryHelper * @param \Magento\Core\Helper\Data $coreData * @param \Magento\View\DesignInterface $design * @param BlockFactory $blockFactory @@ -241,7 +229,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn * @param DataService\Graph $dataServiceGraph * @param Store\Config $coreStoreConfig * @param \Magento\App\State $appState - * @param \Magento\ObjectManager $objectManager + * @param \Magento\Message\ManagerInterface $messageManager * @param string $area */ public function __construct( @@ -249,7 +237,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn \Magento\Core\Model\Resource\Theme\CollectionFactory $themeFactory, \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, - \Magento\App\Helper\HelperFactory $factoryHelper, \Magento\Core\Helper\Data $coreData, \Magento\View\DesignInterface $design, \Magento\View\Element\BlockFactory $blockFactory, @@ -259,11 +246,10 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn \Magento\Core\Model\DataService\Graph $dataServiceGraph, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\App\State $appState, - \Magento\ObjectManager $objectManager, + \Magento\Message\ManagerInterface $messageManager, $area = \Magento\View\DesignInterface::DEFAULT_AREA ) { $this->_eventManager = $eventManager; - $this->_factoryHelper = $factoryHelper; $this->_coreData = $coreData; $this->_coreStoreConfig = $coreStoreConfig; $this->_design = $design; @@ -280,7 +266,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn $this->_processorFactory = $processorFactory; $this->themeFactory = $themeFactory; $this->_logger = $logger; - $this->_objectManager = $objectManager; + $this->messageManager = $messageManager; } /** @@ -1646,25 +1632,30 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn * Init messages by message storage(s), loading and adding messages to layout messages block * * @throws \UnexpectedValueException - * @param string|array $messages + * @param string|array $messageGroups */ - public function initMessages($messages) + public function initMessages($messageGroups = array()) { - if (!is_array($messages)) { - $messages = array($messages); + foreach ($this->_prepareMessageGroup($messageGroups) as $group) { + $block = $this->getMessagesBlock(); + $block->addMessages($this->messageManager->getMessages(true, $group)); + $block->addStorageType($group); } - foreach ($messages as $storageName) { - $storage = $this->_objectManager->get($storageName); - if ($storage) { - $block = $this->getMessagesBlock(); - $block->addMessages($storage->getMessages(true)); - $block->setEscapeMessageFlag($storage->getEscapeMessages(true)); - $block->addStorageType($storageName); - } else { - throw new \UnexpectedValueException( - __('Invalid messages storage "%1" for layout messages initialization', (string)$storageName) - ); - } + } + + /** + * Validate message groups + * + * @param array $messageGroups + * @return array + */ + protected function _prepareMessageGroup($messageGroups) + { + if (!is_array($messageGroups)) { + $messageGroups = array($messageGroups); + } elseif (empty($messageGroups)) { + $messageGroups[] = $this->messageManager->getDefaultGroup(); } + return $messageGroups; } } diff --git a/app/code/Magento/Core/Model/Layout/Merge.php b/app/code/Magento/Core/Model/Layout/Merge.php index f7c1d46684a..5834ec3b59c 100644 --- a/app/code/Magento/Core/Model/Layout/Merge.php +++ b/app/code/Magento/Core/Model/Layout/Merge.php @@ -123,6 +123,11 @@ class Merge implements \Magento\View\Layout\ProcessorInterface */ protected $_logger; + /** + * @var \Magento\Filesystem + */ + protected $filesystem; + /** * Init merge model * @@ -134,6 +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\View\Design\ThemeInterface $theme Non-injectable theme instance */ public function __construct( @@ -145,6 +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\View\Design\ThemeInterface $theme = null ) { $this->_theme = $theme ?: $design->getDesignTheme(); @@ -155,6 +162,7 @@ class Merge implements \Magento\View\Layout\ProcessorInterface $this->_cache = $cache; $this->_layoutValidator = $validator; $this->_logger = $logger; + $this->filesystem = $filesystem; } /** @@ -370,11 +378,12 @@ class Merge implements \Magento\View\Layout\ProcessorInterface } $layout = $this->asString(); + $layoutStr = '<handle id="handle">' . $layout . '</handle>'; if ($this->_appState->getMode() === \Magento\App\State::MODE_DEVELOPER) { if (!$this->_layoutValidator->isValid( - $layout, - \Magento\Core\Model\Layout\Update\Validator::LAYOUT_SCHEMA_MERGED, - false + $layoutStr, + \Magento\Core\Model\Layout\Update\Validator::LAYOUT_SCHEMA_MERGED, + false )) { $messages = $this->_layoutValidator->getMessages(); //Add first message to exception @@ -592,9 +601,11 @@ 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); $useErrors = libxml_use_internal_errors(true); foreach ($updateFiles as $file) { - $fileStr = (string)file_get_contents($file->getFilename()); + $filename = $dir->getRelativePath($file->getFilename()); + $fileStr = $dir->readFile($filename); $fileStr = $this->_substitutePlaceholders($fileStr); /** @var $fileXml \Magento\View\Layout\Element */ $fileXml = $this->_loadXmlString($fileStr); diff --git a/app/code/Magento/Core/Model/Layout/Update/Validator.php b/app/code/Magento/Core/Model/Layout/Update/Validator.php index cbef69f550a..c6a319f66c4 100644 --- a/app/code/Magento/Core/Model/Layout/Update/Validator.php +++ b/app/code/Magento/Core/Model/Layout/Update/Validator.php @@ -94,9 +94,9 @@ class Validator extends \Zend_Validate_Abstract $this->_initMessageTemplates(); $this->_xsdSchemas = array( self::LAYOUT_SCHEMA_SINGLE_HANDLE => $this->_modulesReader->getModuleDir('etc', 'Magento_Core') - . DIRECTORY_SEPARATOR . 'layout_single.xsd', + . '/layout_single.xsd', self::LAYOUT_SCHEMA_MERGED => $this->_modulesReader->getModuleDir('etc', 'Magento_Core') - . DIRECTORY_SEPARATOR . 'layout_merged.xsd', + . '/layout_merged.xsd', ); } 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 59c603adf84..6ea0555b87f 100644 --- a/app/code/Magento/Core/Model/Locale/Hierarchy/Config/FileResolver.php +++ b/app/code/Magento/Core/Model/Locale/Hierarchy/Config/FileResolver.php @@ -27,18 +27,26 @@ namespace Magento\Core\Model\Locale\Hierarchy\Config; class FileResolver implements \Magento\Config\FileResolverInterface { + /** + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $directoryRead; /** - * @var \Magento\App\Dir + * @var \Magento\Config\FileIteratorFactory */ - protected $_applicationDirs; + protected $iteratorFactory; /** - * @param \Magento\App\Dir $applicationDirs + * @param \Magento\Filesystem $filesystem + * @param \Magento\Config\FileIteratorFactory $iteratorFactory */ - public function __construct(\Magento\App\Dir $applicationDirs) - { - $this->_applicationDirs = $applicationDirs; + public function __construct( + \Magento\Filesystem $filesystem, + \Magento\Config\FileIteratorFactory $iteratorFactory + ) { + $this->directoryRead = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $this->iteratorFactory = $iteratorFactory; } /** @@ -46,10 +54,13 @@ class FileResolver implements \Magento\Config\FileResolverInterface */ public function get($filename, $scope) { - $appLocaleDir = $this->_applicationDirs->getDir(\Magento\App\Dir::LOCALE); - // Create pattern similar to app/locale/*/config.xml - $filePattern = $appLocaleDir . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . $filename; - $fileList = glob($filePattern, GLOB_BRACE); - return $fileList; + $result = array(); + if ($this->directoryRead->isExist('locale')) { + $result = $this->iteratorFactory->create( + $this->directoryRead, + $this->directoryRead->search('#' . preg_quote($filename) . '$#', 'locale') + ); + } + return $result; } } diff --git a/app/code/Magento/Core/Model/Locale/Hierarchy/Config/SchemaLocator.php b/app/code/Magento/Core/Model/Locale/Hierarchy/Config/SchemaLocator.php index 6e9c8ce18eb..3d6538254a4 100644 --- a/app/code/Magento/Core/Model/Locale/Hierarchy/Config/SchemaLocator.php +++ b/app/code/Magento/Core/Model/Locale/Hierarchy/Config/SchemaLocator.php @@ -46,7 +46,7 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface */ public function __construct(\Magento\Module\Dir\Reader $moduleReader) { - $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Core') . DIRECTORY_SEPARATOR . 'locale.xsd'; + $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Core') . '/' . 'locale.xsd'; } /** diff --git a/app/code/Magento/Core/Model/Observer.php b/app/code/Magento/Core/Model/Observer.php index c196d1d923d..45975988bdf 100644 --- a/app/code/Magento/Core/Model/Observer.php +++ b/app/code/Magento/Core/Model/Observer.php @@ -118,10 +118,9 @@ class Observer */ public function themeRegistration(\Magento\Event\Observer $observer) { - $baseDir = $observer->getEvent()->getBaseDir(); $pathPattern = $observer->getEvent()->getPathPattern(); try { - $this->_registration->register($baseDir, $pathPattern); + $this->_registration->register($pathPattern); } catch (\Magento\Core\Exception $e) { $this->_logger->logException($e); } 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 d65e2714edd..1f2963a003d 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/File.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/File.php @@ -31,23 +31,11 @@ namespace Magento\Core\Model\Resource\File\Storage; */ class File { - /** - * Prefix of model events names - * - * @var string - */ - protected $_mediaBaseDirectory = null; - /** * @var \Magento\Filesystem */ protected $_filesystem; - /** - * @var \Magento\Core\Helper\File\Storage\Database - */ - protected $_dbHelper; - /** * @var \Magento\Logger */ @@ -55,35 +43,14 @@ class File /** * @param \Magento\Filesystem $filesystem - * @param \Magento\Core\Helper\File\Storage\Database $dbHelper * @param \Magento\Logger $log */ public function __construct( \Magento\Filesystem $filesystem, - \Magento\Core\Helper\File\Storage\Database $dbHelper, \Magento\Logger $log ) { - $this->_dbHelper = $dbHelper; $this->_logger = $log; - $this->_filesystem = $filesystem; - $this->_filesystem->setIsAllowCreateDirectories(true); - $this->_filesystem->ensureDirectoryExists($this->getMediaBaseDirectory()); - $this->_filesystem->setWorkingDirectory($this->getMediaBaseDirectory()); - } - - /** - * Files at storage - * - * @return string - */ - public function getMediaBaseDirectory() - { - if (is_null($this->_mediaBaseDirectory)) { - $this->_mediaBaseDirectory = $this->_dbHelper->getMediaBaseDir(); - } - - return $this->_mediaBaseDirectory; } /** @@ -96,23 +63,22 @@ class File { $files = array(); $directories = array(); - $currentDir = $this->getMediaBaseDirectory() . $dir; - if ($this->_filesystem->isDirectory($currentDir)) { - foreach ($this->_filesystem->getNestedKeys($currentDir) as $fullPath) { - $itemName = basename($fullPath); + $directoryInstance = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); + if ($directoryInstance->isDirectory($dir)) { + foreach ($directoryInstance->read($dir) as $path) { + $itemName = basename($path); if ($itemName == '.svn' || $itemName == '.htaccess') { continue; } - $relativePath = $this->_getRelativePath($fullPath); - if ($this->_filesystem->isDirectory($fullPath)) { + if ($directoryInstance->isDirectory($path)) { $directories[] = array( 'name' => $itemName, - 'path' => dirname($relativePath) + 'path' => dirname($path) ); } else { - $files[] = $relativePath; + $files[] = $path; } } } @@ -128,13 +94,10 @@ class File */ public function clear($dir = '') { - if (strpos($dir, $this->getMediaBaseDirectory()) !== 0) { - $dir = $this->getMediaBaseDirectory() . $dir; - } - - if ($this->_filesystem->isDirectory($dir)) { - foreach ($this->_filesystem->getNestedKeys($dir) as $path) { - $this->_filesystem->delete($path); + $directoryInstance = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + if ($directoryInstance->isDirectory($dir)) { + foreach ($directoryInstance->read($dir) as $path) { + $directoryInstance->delete($path); } } @@ -155,15 +118,16 @@ class File } $path = (strlen($dir['path'])) - ? $dir['path'] . DS . $dir['name'] + ? $dir['path'] . '/' . $dir['name'] : $dir['name']; - $path = $this->getMediaBaseDirectory() . DS . $path; try { - $this->_filesystem->ensureDirectoryExists($path); + $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA)->create($path); } catch (\Exception $e) { $this->_logger->log($e->getMessage()); - throw new \Magento\Core\Exception(__('Unable to create directory: %1', $path)); + throw new \Magento\Core\Exception( + __('Unable to create directory: %1', \Magento\Filesystem::MEDIA . '/' . $path) + ); } return true; @@ -180,31 +144,17 @@ class File */ public function saveFile($filePath, $content, $overwrite = false) { - if (strpos($filePath, $this->getMediaBaseDirectory()) !== 0) { - $filePath = $this->getMediaBaseDirectory() . DS . $filePath; - } - try { - if (!$this->_filesystem->isFile($filePath) || ($overwrite && $this->_filesystem->delete($filePath))) { - $this->_filesystem->write($filePath, $content); + $directoryInstance = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + if (!$directoryInstance->isFile($filePath) || ($overwrite && $directoryInstance->delete($filePath))) { + $directoryInstance->writeFile($filePath, $content); return true; } - } catch (\Magento\Filesystem\Exception $e) { + } catch (\Magento\Filesystem\FilesystemException $e) { $this->_logger->log($e->getMessage()); throw new \Magento\Core\Exception(__('Unable to save file: %1', $filePath)); } return false; } - - /** - * Get path relative to media base directory - * - * @param string $path - * @return string - */ - protected function _getRelativePath($path) - { - return ltrim(str_replace($this->getMediaBaseDirectory(), '', $path), \Magento\Filesystem::DIRECTORY_SEPARATOR); - } } diff --git a/app/code/Magento/Core/Model/Resource/Setup.php b/app/code/Magento/Core/Model/Resource/Setup.php index 5fb3a2d6ad1..4abe5dfd0ce 100644 --- a/app/code/Magento/Core/Model/Resource/Setup.php +++ b/app/code/Magento/Core/Model/Resource/Setup.php @@ -117,6 +117,18 @@ class Setup implements \Magento\Module\Updater\SetupInterface */ protected $_connectionName = 'core_setup'; + /** + * Filesystem instance + * + * @var \Magento\Filesystem + */ + protected $filesystem; + + /** + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $modulesDir; + /** * @param \Magento\Core\Model\Resource\Setup\Context $context * @param $resourceName @@ -139,6 +151,8 @@ class Setup implements \Magento\Module\Updater\SetupInterface $this->_themeFactory = $context->getThemeFactory(); $this->_themeResourceFactory = $context->getThemeResourceFactory(); $this->_moduleConfig = $context->getModuleList()->getModule($moduleName); + $this->filesystem = $context->getFilesystem(); + $this->modulesDir = $this->filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $this->_connectionName = $connectionName ?: $this->_connectionName; } @@ -346,25 +360,24 @@ class Setup implements \Magento\Module\Updater\SetupInterface { $modName = (string)$this->_moduleConfig['name']; - $filesDir = $this->_modulesReader->getModuleDir('sql', $modName) . DS . $this->_resourceName; - if (!is_dir($filesDir) || !is_readable($filesDir)) { + $filesDir = $this->_modulesReader->getModuleDir('sql', $modName) . '/' . $this->_resourceName; + $modulesDirPath = $this->modulesDir->getRelativePath($filesDir); + if (!$this->modulesDir->isDirectory($modulesDirPath) || !$this->modulesDir->isReadable($modulesDirPath)) { return array(); } $dbFiles = array(); $typeFiles = array(); - $regExpDb = sprintf('#^%s-(.*)\.(php|sql)$#i', $actionType); - $regExpType = sprintf('#^%s-%s-(.*)\.(php|sql)$#i', 'mysql4', $actionType); - $handlerDir = dir($filesDir); - while (false !== ($file = $handlerDir->read())) { + $regExpDb = sprintf('#%s-(.*)\.(php|sql)$#i', $actionType); + $regExpType = sprintf('#%s-%s-(.*)\.(php|sql)$#i', 'mysql4', $actionType); + foreach ($this->modulesDir->read($modulesDirPath) as $file) { $matches = array(); if (preg_match($regExpDb, $file, $matches)) { - $dbFiles[$matches[1]] = $filesDir . DS . $file; + $dbFiles[$matches[1]] = $this->modulesDir->getAbsolutePath($file); } else if (preg_match($regExpType, $file, $matches)) { - $typeFiles[$matches[1]] = $filesDir . DS . $file; + $typeFiles[$matches[1]] = $this->modulesDir->getAbsolutePath($file); } } - $handlerDir->close(); if (empty($typeFiles) && empty($dbFiles)) { return array(); @@ -390,17 +403,16 @@ class Setup implements \Magento\Module\Updater\SetupInterface $modName = (string)$this->_moduleConfig['name']; $files = array(); - $filesDir = $this->_modulesReader->getModuleDir('data', $modName) . DS . $this->_resourceName; - if (is_dir($filesDir) && is_readable($filesDir)) { - $regExp = sprintf('#^%s-(.*)\.php$#i', $actionType); - $handlerDir = dir($filesDir); - while (false !== ($file = $handlerDir->read())) { + $filesDir = $this->_modulesReader->getModuleDir('data', $modName) . '/' . $this->_resourceName; + $modulesDirPath = $this->modulesDir->getRelativePath($filesDir); + if ($this->modulesDir->isDirectory($modulesDirPath) && $this->modulesDir->isReadable($modulesDirPath)) { + $regExp = sprintf('#%s-(.*)\.php$#i', $actionType); + foreach ($this->modulesDir->read($modulesDirPath) as $file) { $matches = array(); if (preg_match($regExp, $file, $matches)) { - $files[$matches[1]] = $filesDir . DS . $file; + $files[$matches[1]] = $this->modulesDir->getAbsolutePath($file); } } - $handlerDir->close(); } if (empty($files)) { @@ -474,7 +486,7 @@ class Setup implements \Magento\Module\Updater\SetupInterface $result = include $fileName; break; case 'sql': - $sql = file_get_contents($fileName); + $sql = $this->modulesDir->readFile($this->modulesDir->getRelativePath($fileName)); if (!empty($sql)) { $result = $this->run($sql); @@ -807,4 +819,12 @@ class Setup implements \Magento\Module\Updater\SetupInterface { return $this->_eventManager; } + + /** + * @return \Magento\Filesystem + */ + public function getFilesystem() + { + return $this->filesystem; + } } diff --git a/app/code/Magento/Core/Model/Resource/Setup/Context.php b/app/code/Magento/Core/Model/Resource/Setup/Context.php index ec0d15c0c9f..f62a7e7b47d 100644 --- a/app/code/Magento/Core/Model/Resource/Setup/Context.php +++ b/app/code/Magento/Core/Model/Resource/Setup/Context.php @@ -76,16 +76,24 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_encryptor; /** + * @var \Magento\Filesystem + */ + protected $filesystem; + + /** + * Constructor + * * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\App\Resource $resource * @param \Magento\Module\Dir\Reader $modulesReader * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Core\Model\Resource\Resource $resourceResource - * @param \Magento\Core\Model\Resource\Setup\MigrationFactory $migrationFactory + * @param MigrationFactory $migrationFactory * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory * @param \Magento\Core\Model\Theme\CollectionFactory $themeFactory * @param \Magento\Encryption\EncryptorInterface $encryptor + * @param \Magento\Filesystem $filesystem */ public function __construct( \Magento\Logger $logger, @@ -97,7 +105,8 @@ class Context implements \Magento\ObjectManager\ContextInterface \Magento\Core\Model\Resource\Setup\MigrationFactory $migrationFactory, \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory, \Magento\Core\Model\Theme\CollectionFactory $themeFactory, - \Magento\Encryption\EncryptorInterface $encryptor + \Magento\Encryption\EncryptorInterface $encryptor, + \Magento\Filesystem $filesystem ) { $this->_logger = $logger; $this->_eventManager = $eventManager; @@ -109,6 +118,7 @@ class Context implements \Magento\ObjectManager\ContextInterface $this->_themeResourceFactory = $themeResourceFactory; $this->_themeFactory = $themeFactory; $this->_encryptor = $encryptor; + $this->filesystem = $filesystem; } /** @@ -190,4 +200,12 @@ class Context implements \Magento\ObjectManager\ContextInterface { return $this->_encryptor; } + + /** + * @return \Magento\Filesystem + */ + public function getFilesystem() + { + return $this->filesystem; + } } diff --git a/app/code/Magento/Core/Model/Resource/Setup/Migration.php b/app/code/Magento/Core/Model/Resource/Setup/Migration.php index 2e2d6b85431..7e49d751c69 100644 --- a/app/code/Magento/Core/Model/Resource/Setup/Migration.php +++ b/app/code/Magento/Core/Model/Resource/Setup/Migration.php @@ -123,13 +123,6 @@ class Migration extends \Magento\Core\Model\Resource\Setup */ protected $_coreHelper; - /** - * Application root absolute path - * - * @var string - */ - protected $_baseDir; - /** * Path to map file from config * @@ -145,21 +138,14 @@ class Migration extends \Magento\Core\Model\Resource\Setup protected $_compositeModules; /** - * @var \Magento\Filesystem - */ - protected $_filesystem; - - /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem\Directory\Read */ - protected $_dir; + protected $_directory; /** * @param \Magento\Core\Model\Resource\Setup\Context $context * @param string $resourceName - * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Helper\Data $helper - * @param \Magento\App\Dir $dir * @param string $confPathToMapFile * @param string $moduleName * @param string $connectionName @@ -167,16 +153,13 @@ class Migration extends \Magento\Core\Model\Resource\Setup public function __construct( \Magento\Core\Model\Resource\Setup\Context $context, $resourceName, - \Magento\Filesystem $filesystem, \Magento\Core\Helper\Data $helper, - \Magento\App\Dir $dir, $confPathToMapFile, $moduleName = 'Magento_Core', $connectionName = '' ) { - $this->_filesystem = $filesystem; + $this->_directory = $context->getFilesystem()->getDirectoryRead(\Magento\Filesystem::ROOT); $this->_coreHelper = $helper; - $this->_baseDir = $dir->getDir(); $this->_pathToMapFile = $confPathToMapFile; parent::__construct($context, $resourceName, $moduleName, $connectionName); } @@ -645,9 +628,8 @@ class Migration extends \Magento\Core\Model\Resource\Setup */ protected function _loadMap($pathToMapFile) { - $pathToMapFile = $this->_baseDir . DS . $pathToMapFile; - if ($this->_filesystem->isFile($pathToMapFile)) { - return $this->_filesystem->read($pathToMapFile); + if ($this->_directory->isFile($pathToMapFile)) { + return $this->_directory->readFile($pathToMapFile); } return ''; 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 fb2c95f9738..6b5ed9b1bc8 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 @@ -27,11 +27,11 @@ class Mysql extends \Magento\Core\Model\Resource\Type\Db implements \Magento\App\Resource\ConnectionAdapterInterface { /** - * Dirs instance + * Filesystem class * - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_dirs; + protected $_filesystem; /** * @var \Magento\Stdlib\String @@ -59,7 +59,7 @@ class Mysql extends \Magento\Core\Model\Resource\Type\Db protected $_isActive; /** - * @param \Magento\App\Dir $dirs + * @param \Magento\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\App\Dir $dirs, + \Magento\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Stdlib\DateTime $dateTime, $host, @@ -84,7 +84,7 @@ class Mysql extends \Magento\Core\Model\Resource\Type\Db $type = 'pdo_mysql', $active = false ) { - $this->_dirs = $dirs; + $this->_filesystem = $filesystem; $this->string = $string; $this->dateTime = $dateTime; $this->_connectionConfig = array( @@ -136,7 +136,12 @@ class Mysql extends \Magento\Core\Model\Resource\Type\Db protected function _getDbAdapterInstance() { $className = $this->_getDbAdapterClassName(); - $adapter = new $className($this->_dirs, $this->string, $this->dateTime, $this->_connectionConfig); + $adapter = new $className( + $this->_filesystem, + $this->string, + $this->dateTime, + $this->_connectionConfig + ); return $adapter; } diff --git a/app/code/Magento/Core/Model/Session.php b/app/code/Magento/Core/Model/Session.php index dc9c435b5a9..b775a96a824 100644 --- a/app/code/Magento/Core/Model/Session.php +++ b/app/code/Magento/Core/Model/Session.php @@ -29,29 +29,10 @@ namespace Magento\Core\Model; /** * Core session model * - * @todo extend from \Magento\Core\Model\Session\AbstractSession - * * @method null|bool getCookieShouldBeReceived() * @method \Magento\Core\Model\Session setCookieShouldBeReceived(bool $flag) * @method \Magento\Core\Model\Session unsCookieShouldBeReceived() */ -class Session extends \Magento\Core\Model\Session\AbstractSession +class Session extends \Magento\Session\Generic { - /** - * @param Session\Context $context - * @param \Magento\Session\SidResolverInterface $sidResolver - * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param null $sessionName - * @param array $data - */ - public function __construct( - \Magento\Core\Model\Session\Context $context, - \Magento\Session\SidResolverInterface $sidResolver, - \Magento\Session\Config\ConfigInterface $sessionConfig, - $sessionName = null, - array $data = array() - ) { - parent::__construct($context, $sidResolver, $sessionConfig, $data); - $this->start('core', $sessionName); - } } diff --git a/app/code/Magento/Core/Model/Session/AbstractSession.php b/app/code/Magento/Core/Model/Session/AbstractSession.php deleted file mode 100644 index a69e21a4808..00000000000 --- a/app/code/Magento/Core/Model/Session/AbstractSession.php +++ /dev/null @@ -1,715 +0,0 @@ -<?php -/** - * Core Session Abstract model - * - * 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) 2013 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\Session; - -class AbstractSession extends \Magento\Object -{ - /** - * Configuration path to log exception file - */ - const XML_PATH_LOG_EXCEPTION_FILE = 'dev/log/exception_file'; - - /** - * Session key for list of hosts - */ - const HOST_KEY = '_session_hosts'; - - /** - * Default options when a call destroy() - * - * - send_expire_cookie: whether or not to send a cookie expiring the current session cookie - * - clear_storage: whether or not to empty the storage object of any stored values - * - * @var array - */ - protected $defaultDestroyOptions = array( - 'send_expire_cookie' => true, - 'clear_storage' => true, - ); - - /** - * URL host cache - * - * @var array - */ - protected static $_urlHostCache = array(); - - /** - * @var \Magento\Logger - */ - protected $_logger; - - /** - * Core event manager proxy - * - * @var \Magento\Event\ManagerInterface - */ - protected $_eventManager; - - /** - * @var \Magento\Core\Model\Session\Validator - */ - protected $_validator; - - /** - * @var \Magento\Core\Model\Store\Config - */ - protected $_coreStoreConfig; - - /** - * @var string - */ - protected $_saveMethod; - - /** - * Core message - * - * @var \Magento\Message\Factory - */ - protected $messageFactory; - - /** - * Core message collection factory - * - * @var \Magento\Message\CollectionFactory - */ - protected $messagesFactory; - - /** - * @var \Magento\App\RequestInterface - */ - protected $_request; - - /** - * @var \Magento\App\State - */ - protected $_appState; - - /** - * @var \Magento\Core\Model\StoreManagerInterface - */ - protected $_storeManager; - - /** - * @var \Magento\Session\SidResolverInterface - */ - protected $_sidResolver; - - /** - * @var \Magento\Session\Config\ConfigInterface - */ - protected $_sessionConfig; - - /** - * @param \Magento\Core\Model\Session\Context $context - * @param \Magento\Session\SidResolverInterface $sidResolver - * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param array $data - */ - public function __construct( - \Magento\Core\Model\Session\Context $context, - \Magento\Session\SidResolverInterface $sidResolver, - \Magento\Session\Config\ConfigInterface $sessionConfig, - array $data = array() - ) { - $this->_validator = $context->getValidator(); - $this->_eventManager = $context->getEventManager(); - $this->_logger = $context->getLogger(); - $this->_coreStoreConfig = $context->getStoreConfig(); - $this->_saveMethod = $this->_saveMethod ?: $context->getSaveMethod(); - $this->messagesFactory = $context->getMessagesFactory(); - $this->messageFactory = $context->getMessageFactory(); - $this->_request = $context->getRequest(); - $this->_appState = $context->getAppState(); - $this->_storeManager = $context->getStoreManager(); - $this->_sidResolver = $sidResolver; - $this->_sessionConfig = $sessionConfig; - parent::__construct($data); - } - - /** - * Init session handler - */ - protected function _initSessionHandler() - { - \Magento\Profiler::start('session_start'); - switch($this->getSessionSaveMethod()) { - case 'db': - ini_set('session.save_handler', 'user'); - /* @var $sessionResource \Magento\Core\Model\Resource\Session */ - $sessionResource = \Magento\App\ObjectManager::getInstance() - ->get('Magento\Core\Model\Resource\Session'); - $sessionResource->setSaveHandler(); - break; - case 'memcache': - ini_set('session.save_handler', 'memcache'); - break; - case 'memcached': - ini_set('session.save_handler', 'memcached'); - break; - case 'eaccelerator': - ini_set('session.save_handler', 'eaccelerator'); - break; - default: - session_module_name($this->getSessionSaveMethod()); - break; - } - - // potential custom logic for session id (ex. switching between hosts) - $this->setSessionId($this->_sidResolver->getSid($this)); - - session_start(); - register_shutdown_function(array($this, 'writeClose')); - - \Magento\Profiler::stop('session_start'); - } - - /** - * This method needs to support sessions with APC enabled - */ - public function writeClose() - { - session_write_close(); - } - - /** - * Configure session handler and start session - * - * @param string $namespace - * @param string $sessionName - * @return \Magento\Core\Model\Session\AbstractSession - */ - public function start($namespace = 'default', $sessionName = null) - { - if (!$this->isSessionExists()) { - if (!empty($sessionName)) { - $this->setSessionName($sessionName); - } - $this->_initSessionHandler(); - $this->_validator->validate($this); - $this->_addHost(); - } - - if (!isset($_SESSION[$namespace])) { - $_SESSION[$namespace] = array(); - } - $this->_data = &$_SESSION[$namespace]; - return $this; - } - - /** - * Does a session exist - * - * @return bool - */ - public function isSessionExists() - { - if (session_status() === PHP_SESSION_NONE && !headers_sent()) { - return false; - } - return true; - } - - /** - * Additional get data with clear mode - * - * @param string $key - * @param bool $clear - * @return mixed - */ - public function getData($key = '', $clear = false) - { - $data = parent::getData($key); - if ($clear && isset($this->_data[$key])) { - unset($this->_data[$key]); - } - return $data; - } - - /** - * Retrieve session Id - * - * @return string - */ - public function getSessionId() - { - return session_id(); - } - - /** - * Retrieve session name - * - * @return string - */ - public function getName() - { - return session_name(); - } - - /** - * Set session name - * - * @param string $name - * @return \Magento\Core\Model\Session\AbstractSession - */ - public function setSessionName($name) - { - session_name($name); - return $this; - } - - /** - * Destroy/end a session - * - * @param array $options - */ - public function destroy(array $options = null) - { - if (null === $options) { - $options = $this->defaultDestroyOptions; - } else { - $options = array_merge($this->defaultDestroyOptions, $options); - } - - if ($options['clear_storage']) { - $this->clearStorage(); - } - - if (session_status() !== PHP_SESSION_ACTIVE) { - return; - } - - session_destroy(); - if ($options['send_expire_cookie']) { - $this->expireSessionCookie(); - } - } - - /** - * Unset all session data - * - * @return $this - */ - public function clearStorage() - { - $this->unsetData(); - return $this; - } - - /** - * Retrieve Cookie domain - * - * @return string - */ - public function getCookieDomain() - { - return $this->_sessionConfig->getCookieDomain(); - } - - /** - * Retrieve cookie path - * - * @return string - */ - public function getCookiePath() - { - return $this->_sessionConfig->getCookiePath(); - } - - /** - * Retrieve cookie lifetime - * - * @return int - */ - public function getCookieLifetime() - { - return $this->_sessionConfig->getCookieLifetime(); - } - - /** - * Retrieve messages from session - * - * @param bool $clear - * @return \Magento\Message\Collection - */ - public function getMessages($clear = false) - { - if (!$this->getData('messages')) { - $this->setMessages($this->messagesFactory->create()); - } - - if ($clear) { - $messages = clone $this->getData('messages'); - $this->getData('messages')->clear(); - $this->_eventManager->dispatch('core_session_abstract_clear_messages'); - return $messages; - } - return $this->getData('messages'); - } - - /** - * Not Magento exception handling - * - * @param \Exception $exception - * @param string $alternativeText - * @return \Magento\Core\Model\Session\AbstractSession - */ - public function addException(\Exception $exception, $alternativeText) - { - // log exception to exceptions log - $message = sprintf('Exception message: %s%sTrace: %s', - $exception->getMessage(), - "\n", - $exception->getTraceAsString()); - $file = $this->_coreStoreConfig->getConfig(self::XML_PATH_LOG_EXCEPTION_FILE); - $this->_logger->logFile($message, \Zend_Log::DEBUG, $file); - - $this->addMessage($this->messageFactory->error($alternativeText)); - return $this; - } - - /** - * Adding new message to message collection - * - * @param \Magento\Message\AbstractMessage $message - * @return \Magento\Core\Model\Session\AbstractSession - */ - public function addMessage(\Magento\Message\AbstractMessage $message) - { - $this->getMessages()->add($message); - $this->_eventManager->dispatch('core_session_abstract_add_message'); - return $this; - } - - /** - * Adding new error message - * - * @param string $message - * @return \Magento\Core\Model\Session\AbstractSession - */ - public function addError($message) - { - $this->addMessage($this->messageFactory->error($message)); - return $this; - } - - /** - * Adding new warning message - * - * @param string $message - * @return \Magento\Core\Model\Session\AbstractSession - */ - public function addWarning($message) - { - $this->addMessage($this->messageFactory->warning($message)); - return $this; - } - - /** - * Adding new notice message - * - * @param string $message - * @return \Magento\Core\Model\Session\AbstractSession - */ - public function addNotice($message) - { - $this->addMessage($this->messageFactory->notice($message)); - return $this; - } - - /** - * Adding new success message - * - * @param string $message - * @return \Magento\Core\Model\Session\AbstractSession - */ - public function addSuccess($message) - { - $this->addMessage($this->messageFactory->success($message)); - return $this; - } - - /** - * Adding messages array to message collection - * - * @param array $messages - * @return \Magento\Core\Model\Session\AbstractSession - */ - public function addMessages($messages) - { - if (is_array($messages)) { - foreach ($messages as $message) { - $this->addMessage($message); - } - } - return $this; - } - - /** - * Adds messages array to message collection, but doesn't add duplicates to it - * - * @param array|string|\Magento\Message\AbstractMessage $messages - * @return \Magento\Core\Model\Session\AbstractSession - */ - public function addUniqueMessages($messages) - { - if (!is_array($messages)) { - $messages = array($messages); - } - if (!$messages) { - return $this; - } - - $messagesAlready = array(); - $items = $this->getMessages()->getItems(); - foreach ($items as $item) { - if ($item instanceof \Magento\Message\AbstractMessage) { - $text = $item->getText(); - } elseif (is_string($item)) { - $text = $item; - } else { - continue; // Some unknown object, do not put it in already existing messages - } - $messagesAlready[$text] = true; - } - - foreach ($messages as $message) { - if ($message instanceof \Magento\Message\AbstractMessage) { - $text = $message->getText(); - } elseif (is_string($message)) { - $text = $message; - } else { - $text = null; // Some unknown object, add it anyway - } - - // Check for duplication - if ($text !== null) { - if (isset($messagesAlready[$text])) { - continue; - } - $messagesAlready[$text] = true; - } - $this->addMessage($message); - } - - return $this; - } - - /** - * Specify session identifier - * - * @param string|null $sessionId - * @return \Magento\Core\Model\Session\AbstractSession - */ - public function setSessionId($sessionId) - { - $this->_addHost(); - if (!is_null($sessionId) && preg_match('#^[0-9a-zA-Z,-]+$#', $sessionId)) { - session_id($sessionId); - } - return $this; - } - - /** - * If session cookie is not applicable due to host or path mismatch - add session id to query - * - * @param string $urlHost can be host or url - * @return string {session_id_key}={session_id_encrypted} - */ - public function getSessionIdForHost($urlHost) - { - $httpHost = $this->_request->getHttpHost(); - if (!$httpHost) { - return ''; - } - - $urlHostArr = explode('/', $urlHost, 4); - if (!empty($urlHostArr[2])) { - $urlHost = $urlHostArr[2]; - } - $urlPath = empty($urlHostArr[3]) ? '' : $urlHostArr[3]; - - if (!isset(self::$_urlHostCache[$urlHost])) { - $urlHostArr = explode(':', $urlHost); - $urlHost = $urlHostArr[0]; - $sessionId = $httpHost !== $urlHost && !$this->isValidForHost($urlHost) - ? $this->getSessionId() : ''; - self::$_urlHostCache[$urlHost] = $sessionId; - } - - return $this->isValidForPath($urlPath) ? self::$_urlHostCache[$urlHost] : $this->getSessionId(); - } - - /** - * Check if session is valid for given hostname - * - * @param string $host - * @return bool - */ - public function isValidForHost($host) - { - $hostArr = explode(':', $host); - $hosts = $this->_getHosts(); - return (!empty($hosts[$hostArr[0]])); - } - - /** - * Check if session is valid for given path - * - * @param string $path - * @return bool - */ - public function isValidForPath($path) - { - $cookiePath = trim($this->getCookiePath(), '/') . '/'; - if ($cookiePath == '/') { - return true; - } - - $urlPath = trim($path, '/') . '/'; - return strpos($urlPath, $cookiePath) === 0; - } - - /** - * Register request host name as used with session - * - * @return \Magento\Core\Model\Session\AbstractSession - */ - protected function _addHost() - { - $host = $this->_request->getHttpHost(); - if (!$host) { - return $this; - } - - $hosts = $this->_getHosts(); - $hosts[$host] = true; - $_SESSION[self::HOST_KEY] = $hosts; - return $this; - } - - /** - * Get all host names where session was used - * - * @return array - */ - protected function _getHosts() - { - return isset($_SESSION[self::HOST_KEY]) ? $_SESSION[self::HOST_KEY] : array(); - } - - /** - * Clean all host names that were registered with session - * - * @return \Magento\Core\Model\Session\AbstractSession - */ - protected function _cleanHosts() - { - unset($_SESSION[self::HOST_KEY]); - return $this; - } - - /** - * Retrieve session save method - * - * @return string - */ - public function getSessionSaveMethod() - { - if ($this->_appState->isInstalled() && $this->_saveMethod) { - return $this->_saveMethod; - } - return 'files'; - } - - /** - * Renew session id and update session cookie - * - * @param bool $deleteOldSession - * @return \Magento\Core\Model\Session\AbstractSession - * @throws \LogicException - */ - public function regenerateId($deleteOldSession = true) - { - if ($this->isSessionExists()) { - return $this; - } - session_regenerate_id($deleteOldSession); - - if ($this->_sessionConfig->getUseCookies()) { - $this->clearSubDomainSessionCookie(); - } - return $this; - } - - /** - * Expire the session cookie for sub domains - */ - protected function clearSubDomainSessionCookie() - { - foreach (array_keys($this->_getHosts()) as $host) { - // Delete cookies with the same name for parent domains - if (strpos($this->_sessionConfig->getCookieDomain(), $host) > 0) { - setcookie( - $this->getName(), - '', - 0, - $this->_sessionConfig->getCookiePath(), - $host, - $this->_sessionConfig->getCookieSecure(), - $this->_sessionConfig->getCookieHttpOnly() - ); - } - } - } - - /** - * Expire the session cookie - * - * Sends a session cookie with no value, and with an expiry in the past. - * - * @return void - */ - public function expireSessionCookie() - { - if (!$this->_sessionConfig->getUseCookies()) { - return; - } - - setcookie( - $this->getName(), // session name - '', // value - 0, // TTL for cookie - $this->_sessionConfig->getCookiePath(), - $this->_sessionConfig->getCookieDomain(), - $this->_sessionConfig->getCookieSecure(), - $this->_sessionConfig->getCookieHttpOnly() - ); - $this->clearSubDomainSessionCookie(); - } -} diff --git a/app/code/Magento/Core/Model/Session/Config.php b/app/code/Magento/Core/Model/Session/Config.php index f8d493cea25..97cc35f947e 100644 --- a/app/code/Magento/Core/Model/Session/Config.php +++ b/app/code/Magento/Core/Model/Session/Config.php @@ -27,6 +27,8 @@ namespace Magento\Core\Model\Session; /** * Magento session configuration + * + * @method Config setSaveHandler() */ class Config implements \Magento\Session\Config\ConfigInterface { @@ -115,9 +117,9 @@ class Config implements \Magento\Session\Config\ConfigInterface protected $_appState; /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_dir; + protected $_filesystem; /** * @param \Magento\Core\Model\Store\Config $storeConfig @@ -125,7 +127,8 @@ class Config implements \Magento\Session\Config\ConfigInterface * @param \Magento\Stdlib\String $stringHelper * @param \Magento\App\RequestInterface $request * @param \Magento\App\State $appState - * @param \Magento\App\Dir $dir + * @param \Magento\Filesystem $filesystem + * @param string $saveMethod * @param null|string $savePath * @param null|string $cacheLimiter */ @@ -135,7 +138,8 @@ class Config implements \Magento\Session\Config\ConfigInterface \Magento\Stdlib\String $stringHelper, \Magento\App\RequestInterface $request, \Magento\App\State $appState, - \Magento\App\Dir $dir, + \Magento\Filesystem $filesystem, + $saveMethod = \Magento\Session\SaveHandlerInterface::DEFAULT_HANDLER, $savePath = null, $cacheLimiter = null ) { @@ -144,10 +148,12 @@ class Config implements \Magento\Session\Config\ConfigInterface $this->_stringHelper = $stringHelper; $this->_httpRequest = $request; $this->_appState = $appState; - $this->_dir = $dir; + $this->_filesystem = $filesystem; + + $this->setSaveHandler($saveMethod === 'db' ? 'user' : $saveMethod); if (!$this->_appState->isInstalled() || !$savePath) { - $savePath = $this->_dir->getDir('session'); + $savePath = $this->_filesystem->getPath('session'); } $this->setSavePath($savePath); @@ -265,6 +271,8 @@ class Config implements \Magento\Session\Config\ConfigInterface } /** + * Convert config to array + * * @return array */ public function toArray() @@ -304,17 +312,9 @@ class Config implements \Magento\Session\Config\ConfigInterface * * @param string $savePath * @return $this - * @throws \InvalidArgumentException */ public function setSavePath($savePath) { - if (!is_dir($savePath)) { - throw new \InvalidArgumentException('Invalid save_path provided; not a directory'); - } - if (!is_writable($savePath)) { - throw new \InvalidArgumentException('Invalid save_path provided; not writable'); - } - $this->setOption('session.save_path', $savePath); return $this; } @@ -500,38 +500,6 @@ class Config implements \Magento\Session\Config\ConfigInterface return (bool) $this->getOption('session.use_cookies'); } - /** - * Set remember_me_seconds - * - * @param int $rememberMeSeconds - * @return $this - * @throws \InvalidArgumentException - */ - public function setRememberMeSeconds($rememberMeSeconds) - { - if (!is_numeric($rememberMeSeconds)) { - throw new \InvalidArgumentException('Invalid remember_me_seconds; must be numeric'); - } - - $rememberMeSeconds = (int) $rememberMeSeconds; - if ($rememberMeSeconds < 1) { - throw new \InvalidArgumentException('Invalid remember_me_seconds; must be a positive integer'); - } - - $this->options['remember_me_seconds'] = $rememberMeSeconds; - return $this; - } - - /** - * Get remember_me_seconds - * - * @return int - */ - public function getRememberMeSeconds() - { - return (int) isset($this->options['remember_me_seconds']) ? $this->options['remember_me_seconds'] : 1209600; - } - /** * Set storage option in backend configuration store * @@ -577,9 +545,6 @@ class Config implements \Magento\Session\Config\ConfigInterface $option = strtolower($option); switch ($option) { - case 'remember_me_seconds': - // do nothing; not an INI option - return; case 'url_rewriter_tags': $option = 'url_rewriter.tags'; break; diff --git a/app/code/Magento/Core/Model/Session/Context.php b/app/code/Magento/Core/Model/Session/Context.php deleted file mode 100644 index 1c19fdc7a7e..00000000000 --- a/app/code/Magento/Core/Model/Session/Context.php +++ /dev/null @@ -1,199 +0,0 @@ -<?php -/** - * Core Session Context Model - * - * 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) 2013 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\Session; - -class Context implements \Magento\ObjectManager\ContextInterface -{ - /** - * @var \Magento\Core\Model\Session\Validator - */ - protected $_validator; - - /** - * @var \Magento\Logger - */ - protected $_logger; - - /** - * @var \Magento\Event\ManagerInterface - */ - protected $_eventManager; - - /** - * @var \Magento\Core\Model\Store\Config - */ - protected $_storeConfig; - - /** - * @var string - */ - protected $_saveMethod; - - /** - * Core message - * - * @var \Magento\Message\Factory - */ - protected $messageFactory; - - /** - * Core message collection factory - * - * @var \Magento\Message\CollectionFactory - */ - protected $messagesFactory; - - /** - * @var \Magento\App\RequestInterface - */ - protected $_request; - - /** - * @var \Magento\App\State - */ - protected $_appState; - - /** - * @var \Magento\Core\Model\StoreManagerInterface - */ - protected $_storeManager; - - /** - * @param \Magento\Core\Model\Session\Validator $validator - * @param \Magento\Logger $logger - * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Message\CollectionFactory $messagesFactory - * @param \Magento\Message\Factory $messageFactory - * @param \Magento\App\RequestInterface $request - * @param \Magento\App\State $appState - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param string $saveMethod - */ - public function __construct( - \Magento\Core\Model\Session\Validator $validator, - \Magento\Logger $logger, - \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Message\CollectionFactory $messagesFactory, - \Magento\Message\Factory $messageFactory, - \Magento\App\RequestInterface $request, - \Magento\App\State $appState, - \Magento\Core\Model\StoreManagerInterface $storeManager, - $saveMethod = 'files' - ) { - $this->_validator = $validator; - $this->_logger = $logger; - $this->_eventManager = $eventManager; - $this->_storeConfig = $coreStoreConfig; - $this->_saveMethod = $saveMethod; - $this->messagesFactory = $messagesFactory; - $this->messageFactory = $messageFactory; - $this->_request = $request; - $this->_appState = $appState; - $this->_storeManager = $storeManager; - } - - /** - * @return \Magento\Event\ManagerInterface - */ - public function getEventManager() - { - return $this->_eventManager; - } - - /** - * @return \\Magento\Logger - */ - public function getLogger() - { - return $this->_logger; - } - - /** - * @return \Magento\Core\Model\Store\Config - */ - public function getStoreConfig() - { - return $this->_storeConfig; - } - - /** - * @return \Magento\Core\Model\Session\Validator - */ - public function getValidator() - { - return $this->_validator; - } - - /** - * @return string - */ - public function getSaveMethod() - { - return $this->_saveMethod; - } - - /** - * @return \Magento\App\State - */ - public function getAppState() - { - return $this->_appState; - } - - /** - * @return \Magento\Message\Factory - */ - public function getMessageFactory() - { - return $this->messageFactory; - } - - /** - * @return \Magento\Message\CollectionFactory - */ - public function getMessagesFactory() - { - return $this->messagesFactory; - } - - /** - * @return \Magento\App\RequestInterface - */ - public function getRequest() - { - return $this->_request; - } - - /** - * @return \Magento\Core\Model\StoreManagerInterface - */ - public function getStoreManager() - { - return $this->_storeManager; - } -} diff --git a/app/code/Magento/Core/Model/Session/Pool.php b/app/code/Magento/Core/Model/Session/Pool.php index 7ab714f7a7c..75d6107f59a 100644 --- a/app/code/Magento/Core/Model/Session/Pool.php +++ b/app/code/Magento/Core/Model/Session/Pool.php @@ -24,12 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -/** - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> - */ namespace Magento\Core\Model\Session; class Pool @@ -53,13 +47,13 @@ class Pool * @param string $instanceName * @param array $data * @throws \LogicException - * @return \Magento\Core\Model\Session\AbstractSession + * @return \Magento\Session\SessionManagerInterface */ public function get($instanceName, $data = array()) { $object = $this->_objectManager->get($instanceName, array('data' => $data)); - if (!$object instanceof \Magento\Core\Model\Session\AbstractSession) { - throw new \LogicException($instanceName . ' doesn\'t extend \Magento\Core\Model\Session\AbstractSession'); + if (!$object instanceof \Magento\Session\SessionManagerInterface) { + throw new \LogicException($instanceName . ' doesn\'t implement \Magento\Session\SessionManagerInterface'); } return $object; diff --git a/app/code/Magento/Core/Model/Session/SidResolver.php b/app/code/Magento/Core/Model/Session/SidResolver.php index f99b7c1ae2a..65d5673551e 100644 --- a/app/code/Magento/Core/Model/Session/SidResolver.php +++ b/app/code/Magento/Core/Model/Session/SidResolver.php @@ -34,11 +34,6 @@ class SidResolver implements \Magento\Session\SidResolverInterface */ const XML_PATH_USE_FRONTEND_SID = 'web/session/use_frontend_sid'; - /** - * @var \Magento\Core\Model\StoreManagerInterface - */ - protected $storeManager; - /** * @var \Magento\Core\Model\Store\ConfigInterface */ @@ -60,20 +55,17 @@ class SidResolver implements \Magento\Session\SidResolverInterface protected $sidNameMap; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\UrlInterface $urlBuilder * @param \Magento\App\RequestInterface $request * @param array $sidNameMap */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\UrlInterface $urlBuilder, \Magento\App\RequestInterface $request, array $sidNameMap = array() ) { - $this->storeManager = $storeManager; $this->coreStoreConfig = $coreStoreConfig; $this->urlBuilder = $urlBuilder; $this->request = $request; @@ -81,10 +73,10 @@ class SidResolver implements \Magento\Session\SidResolverInterface } /** - * @param AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session * @return string */ - public function getSid(AbstractSession $session) + public function getSid(\Magento\Session\SessionManagerInterface $session) { $sidKey = null; if ($this->coreStoreConfig->getConfig(self::XML_PATH_USE_FRONTEND_SID) @@ -99,10 +91,10 @@ class SidResolver implements \Magento\Session\SidResolverInterface /** * Get session id query param * - * @param AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session * @return string */ - public function getSessionIdQueryParam(AbstractSession $session) + public function getSessionIdQueryParam(\Magento\Session\SessionManagerInterface $session) { $sessionName = $session->getName(); if ($sessionName && isset($this->sidNameMap[$sessionName])) { diff --git a/app/code/Magento/Core/Model/Session/Validator.php b/app/code/Magento/Core/Model/Session/Validator.php index 89a1ee56f21..49ba17ea331 100644 --- a/app/code/Magento/Core/Model/Session/Validator.php +++ b/app/code/Magento/Core/Model/Session/Validator.php @@ -23,7 +23,10 @@ */ namespace Magento\Core\Model\Session; -class Validator +/** + * Session Validator + */ +class Validator implements \Magento\Session\ValidatorInterface { const VALIDATOR_KEY = '_session_validator_data'; const VALIDATOR_HTTP_USER_AGENT_KEY = 'http_user_agent'; @@ -69,10 +72,10 @@ class Validator /** * Validate session * - * @param \Magento\Core\Model\Session\AbstractSession $session - * @throws \Magento\Core\Model\Session\Exception + * @param \Magento\Session\SessionManagerInterface $session + * @throws \Magento\Session\Exception */ - public function validate(\Magento\Core\Model\Session\AbstractSession $session) + public function validate(\Magento\Session\SessionManagerInterface $session) { if (!isset($_SESSION[self::VALIDATOR_KEY])) { $_SESSION[self::VALIDATOR_KEY] = $this->_getSessionEnvironment(); @@ -80,7 +83,7 @@ class Validator if (!$this->_validate()) { $session->destroy(array('clear_storage' => false)); // throw core session exception - throw new \Magento\Core\Model\Session\Exception(''); + throw new \Magento\Session\Exception(''); } } } diff --git a/app/code/Magento/Core/Model/Store.php b/app/code/Magento/Core/Model/Store.php index 37e0e982129..e84aa810f40 100644 --- a/app/code/Magento/Core/Model/Store.php +++ b/app/code/Magento/Core/Model/Store.php @@ -212,7 +212,7 @@ class Store extends \Magento\Core\Model\AbstractModel /** * Session entity * - * @var \Magento\Core\Model\Session\AbstractSession + * @var \Magento\Session\SessionManagerInterface */ protected $_session; @@ -274,9 +274,11 @@ class Store extends \Magento\Core\Model\AbstractModel protected $_coreFileStorageDatabase = null; /** - * @var \Magento\App\Dir + * Filesystem instance + * + * @var \Magento\Filesystem */ - protected $_dir; + protected $filesystem; /** * Core store config @@ -310,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\App\Dir $dir + * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\Core\Model\Resource\Store $resource @@ -329,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\App\Dir $dir, + \Magento\Filesystem $filesystem, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Config $coreConfig, \Magento\Core\Model\Resource\Store $resource, @@ -347,7 +349,7 @@ class Store extends \Magento\Core\Model\AbstractModel $this->_request = $request; $this->_configDataResource = $configDataResource; $this->_isCustomEntryPoint = $isCustomEntryPoint; - $this->_dir = $dir; + $this->filesystem = $filesystem; $this->_config = $coreConfig; $this->_storeManager = $storeManager; $this->_sidResolver = $sidResolver; @@ -393,13 +395,13 @@ class Store extends \Magento\Core\Model\AbstractModel /** * Retrieve store session object * - * @return \Magento\Core\Model\Session\AbstractSession + * @return \Magento\Session\SessionManagerInterface */ protected function _getSession() { if (!$this->_session) { $this->_session = \Magento\App\ObjectManager::getInstance() - ->create('Magento\Core\Model\Session') + ->create('Magento\Session\SessionManagerInterface') ->start('store_' . $this->getCode()); } return $this->_session; @@ -566,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->_dir->getUri(\Magento\App\Dir::PUB_LIB); + . $this->filesystem->getUri(\Magento\Filesystem::PUB_LIB); } break; @@ -575,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->_dir->getUri(\Magento\App\Dir::STATIC_VIEW); + . $this->filesystem->getUri(\Magento\Filesystem::STATIC_VIEW); } break; @@ -584,18 +586,18 @@ class Store extends \Magento\Core\Model\AbstractModel $url = $this->getConfig($path); if (!$url) { $url = $this->getBaseUrl(self::URL_TYPE_WEB, $secure) - . $this->_dir->getUri(\Magento\App\Dir::PUB_VIEW_CACHE); + . $this->filesystem->getUri(\Magento\Filesystem::PUB_VIEW_CACHE); } break; case self::URL_TYPE_MEDIA: - $url = $this->_getMediaScriptUrl($this->_dir, $secure); + $url = $this->_getMediaScriptUrl($this->filesystem, $secure); if (!$url) { $path = $secure ? self::XML_PATH_SECURE_BASE_MEDIA_URL : self::XML_PATH_UNSECURE_BASE_MEDIA_URL; $url = $this->getConfig($path); if (!$url) { $url = $this->getBaseUrl(self::URL_TYPE_WEB, $secure) - . $this->_dir->getUri(\Magento\App\Dir::MEDIA); + . $this->filesystem->getUri(\Magento\Filesystem::MEDIA); } } break; @@ -653,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\App\Dir $dirs + * @param \Magento\Filesystem $filesystem * @param bool $secure * @return string|bool */ - protected function _getMediaScriptUrl(\Magento\App\Dir $dirs, $secure) + protected function _getMediaScriptUrl(\Magento\Filesystem $filesystem, $secure) { if (!$this->getConfig(self::XML_PATH_USE_REWRITES) && $this->_coreFileStorageDatabase->checkDbUsage() ) { - return $this->getBaseUrl(self::URL_TYPE_WEB, $secure) . $dirs->getUri(\Magento\App\Dir::PUB) + return $this->getBaseUrl(self::URL_TYPE_WEB, $secure) . $filesystem->getUri(\Magento\Filesystem::PUB) . '/' . self::MEDIA_REWRITE_SCRIPT; } return false; @@ -690,8 +692,8 @@ class Store extends \Magento\Core\Model\AbstractModel public function isUseStoreInUrl() { return !($this->hasDisableStoreInUrl() && $this->getDisableStoreInUrl()) - && $this->_appState->isInstalled() - && $this->getConfig(self::XML_PATH_STORE_IN_URL); + && $this->_appState->isInstalled() + && $this->getConfig(self::XML_PATH_STORE_IN_URL); } /** diff --git a/app/code/Magento/Core/Model/StoreManager.php b/app/code/Magento/Core/Model/StoreManager.php index e473bac8c7e..9fc6d567d71 100644 --- a/app/code/Magento/Core/Model/StoreManager.php +++ b/app/code/Magento/Core/Model/StoreManager.php @@ -75,23 +75,21 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface protected $_scopeType; /** - * Helper factory - * - * @var \Magento\App\Helper\HelperFactory + * @var \Magento\Core\Helper\Data */ - protected $_helperFactory; + protected $_helper; /** - * @param \Magento\Core\Model\Store\StorageFactory $factory + * @param Store\StorageFactory $factory * @param \Magento\App\RequestInterface $request - * @param \Magento\App\Helper\HelperFactory $helperFactory + * @param \Magento\Core\Helper\Data $helper * @param string $scopeCode * @param string $scopeType */ public function __construct( \Magento\Core\Model\Store\StorageFactory $factory, \Magento\App\RequestInterface $request, - \Magento\App\Helper\HelperFactory $helperFactory, + \Magento\Core\Helper\Data $helper, $scopeCode = '', $scopeType = 'store' ) { @@ -99,7 +97,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface $this->_request = $request; $this->_scopeCode = $scopeCode; $this->_scopeType = $scopeType ?: self::SCOPE_TYPE_STORE; - $this->_helperFactory = $helperFactory; + $this->_helper = $helper; } /** @@ -186,9 +184,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface */ public function isSingleStoreMode() { - /** @var $helper \Magento\Core\Helper\Data */ - $helper = $this->_helperFactory->get('Magento\Core\Helper\Data'); - return $this->hasSingleStore() && $helper->isSingleStoreModeEnabled(); + return $this->hasSingleStore() && $this->_helper->isSingleStoreModeEnabled(); } /** diff --git a/app/code/Magento/Core/Model/Theme.php b/app/code/Magento/Core/Model/Theme.php index 708f584b851..24bdab8aa5b 100644 --- a/app/code/Magento/Core/Model/Theme.php +++ b/app/code/Magento/Core/Model/Theme.php @@ -106,9 +106,10 @@ class Theme extends \Magento\Core\Model\AbstractModel implements \Magento\View\D */ protected $_customFactory; + /** * Initialize dependencies - * + * * @param Context $context * @param Registry $registry * @param \Magento\View\Design\Theme\FlyweightFactory $themeFactory @@ -116,7 +117,6 @@ class Theme extends \Magento\Core\Model\AbstractModel implements \Magento\View\D * @param \Magento\View\Design\Theme\ImageFactory $imageFactory * @param \Magento\View\Design\Theme\Validator $validator * @param \Magento\View\Design\Theme\CustomizationFactory $customizationFactory - * @param \Magento\App\State $appState * @param Resource\Theme $resource * @param Resource\Theme\Collection $resourceCollection * @param array $data @@ -301,7 +301,9 @@ class Theme extends \Magento\Core\Model\AbstractModel implements \Magento\View\D */ public function getFullPath() { - return $this->getThemePath() ? $this->getArea() . self::PATH_SEPARATOR . $this->getThemePath() : null; + return $this->getThemePath() + ? $this->getArea() . self::PATH_SEPARATOR . $this->getThemePath() + : null; } /** diff --git a/app/code/Magento/Core/Model/Theme/Collection.php b/app/code/Magento/Core/Model/Theme/Collection.php index 6f5896b0470..7d20d247aaa 100644 --- a/app/code/Magento/Core/Model/Theme/Collection.php +++ b/app/code/Magento/Core/Model/Theme/Collection.php @@ -32,9 +32,9 @@ namespace Magento\Core\Model\Theme; class Collection extends \Magento\Data\Collection implements \Magento\View\Design\Theme\ListInterface { /** - * @var \Magento\Filesystem + * @var \Magento\Filesystem\Directory\Read */ - protected $_filesystem; + protected $_directory; /** * Model of collection item @@ -43,13 +43,6 @@ class Collection extends \Magento\Data\Collection implements \Magento\View\Desig */ protected $_itemObjectClass = 'Magento\Core\Model\Theme'; - /** - * Base directory with design - * - * @var string - */ - protected $_baseDir; - /** * Target directory * @@ -57,44 +50,24 @@ class Collection extends \Magento\Data\Collection implements \Magento\View\Desig */ protected $_targetDirs = array(); + /** + * @var \Magento\Config\FileIteratorFactory + */ + protected $fileIteratorFactory; + /** * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Filesystem $filesystem - * @param \Magento\App\Dir $dirs + * @param \Magento\Config\FileIteratorFactory $fileIteratorFactory */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Filesystem $filesystem, - \Magento\App\Dir $dirs + \Magento\Config\FileIteratorFactory $fileIteratorFactory ) { parent::__construct($entityFactory); - $this->_filesystem = $filesystem; - $this->setBaseDir($dirs->getDir(\Magento\App\Dir::THEMES)); - } - - /** - * Set base directory path of design - * - * @param string $path - * @return \Magento\Core\Model\Theme\Collection - */ - public function setBaseDir($path) - { - if ($this->isLoaded() && $this->_baseDir) { - $this->clearTargetPatterns()->clear(); - } - $this->_baseDir = rtrim($path, DIRECTORY_SEPARATOR); - return $this; - } - - /** - * Get base directory path - * - * @return string - */ - public function getBaseDir() - { - return $this->_baseDir; + $this->_directory = $filesystem->getDirectoryRead(\Magento\Filesystem::THEMES); + $this->fileIteratorFactory = $fileIteratorFactory; } /** @@ -105,7 +78,7 @@ class Collection extends \Magento\Data\Collection implements \Magento\View\Desig */ public function addDefaultPattern($area = \Magento\Core\Model\App\Area::AREA_FRONTEND) { - $this->addTargetPattern(implode(DIRECTORY_SEPARATOR, array($area, '*', 'theme.xml'))); + $this->addTargetPattern(implode('/', array($area, '*', 'theme.xml'))); return $this; } @@ -166,8 +139,22 @@ class Collection extends \Magento\Data\Collection implements \Magento\View\Desig $pathsToThemeConfig = array(); foreach ($this->getTargetPatterns() as $directoryPath) { - $themeConfigs = $this->_filesystem->searchKeys($this->getBaseDir(), $directoryPath); - $themeConfigs = str_replace('/', DIRECTORY_SEPARATOR, $themeConfigs); + + $directoryPath = preg_replace_callback('/[\\\\^$.[\\]|()?*+{}\\-\\/]/', function ($matches) { + switch ($matches[0]) { + case '*': + return '.*'; + case '?': + return '.'; + default: + return '\\' . $matches[0]; + } + }, $directoryPath); + + $themeConfigs = $this->_directory->search('#' . $directoryPath . '#'); + foreach ($themeConfigs as &$relPathToTheme) { + $relPathToTheme = $this->_directory->getAbsolutePath($relPathToTheme); + } $pathsToThemeConfig = array_merge($pathsToThemeConfig, $themeConfigs); } @@ -227,8 +214,8 @@ class Collection extends \Magento\Data\Collection implements \Magento\View\Desig protected function _preparePathData($configPath) { $themeDirectory = dirname($configPath); - $fullPath = trim(substr($themeDirectory, strlen($this->getBaseDir())), DIRECTORY_SEPARATOR); - $pathPieces = explode(DIRECTORY_SEPARATOR, $fullPath); + $fullPath = trim(substr($themeDirectory, strlen($this->_directory->getAbsolutePath())), '/'); + $pathPieces = explode('/', $fullPath); $area = array_shift($pathPieces); return array('area' => $area, 'theme_path_pieces' => $pathPieces); } @@ -241,7 +228,13 @@ class Collection extends \Magento\Data\Collection implements \Magento\View\Desig */ public function _prepareConfigurationData($configPath) { - $themeConfig = $this->_getConfigModel(array($configPath)); + + $themeConfig = $this->_getConfigModel( + $this->fileIteratorFactory->create( + $this->_directory, + array($this->_directory->getRelativePath($configPath)) + ) + ); $pathData = $this->_preparePathData($configPath); $media = $themeConfig->getMedia(); @@ -308,10 +301,10 @@ class Collection extends \Magento\Data\Collection implements \Magento\View\Desig /** * Return configuration model for themes * - * @param array $configPaths + * @param $configPaths * @return \Magento\Config\Theme */ - protected function _getConfigModel(array $configPaths) + protected function _getConfigModel($configPaths) { return new \Magento\Config\Theme($configPaths); } diff --git a/app/code/Magento/Core/Model/Theme/Image/Path.php b/app/code/Magento/Core/Model/Theme/Image/Path.php index 2f0f430b695..dc59f36fef4 100644 --- a/app/code/Magento/Core/Model/Theme/Image/Path.php +++ b/app/code/Magento/Core/Model/Theme/Image/Path.php @@ -35,9 +35,11 @@ class Path implements \Magento\View\Design\Theme\Image\PathInterface const DEFAULT_PREVIEW_IMAGE = 'Magento_Core::theme/default_preview.jpg'; /** - * @var \Magento\App\Dir + * Filesystem instance + * + * @var \Magento\Filesystem */ - protected $dir; + protected $filesystem; /** * @var \Magento\View\Url @@ -50,16 +52,18 @@ class Path implements \Magento\View\Design\Theme\Image\PathInterface protected $_storeManager; /** - * @param \Magento\App\Dir $dir + * Initialize dependencies + * + * @param \Magento\Filesystem $filesystem * @param \Magento\View\Url $viewUrl * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( - \Magento\App\Dir $dir, + \Magento\Filesystem $filesystem, \Magento\View\Url $viewUrl, \Magento\Core\Model\StoreManagerInterface $storeManager ) { - $this->dir = $dir; + $this->filesystem = $filesystem; $this->viewUrl = $viewUrl; $this->_storeManager = $storeManager; } @@ -92,8 +96,7 @@ class Path implements \Magento\View\Design\Theme\Image\PathInterface */ public function getImagePreviewDirectory() { - return $this->dir->getDir(\Magento\App\Dir::MEDIA) . DIRECTORY_SEPARATOR - . str_replace('/', DIRECTORY_SEPARATOR, self::PREVIEW_DIRECTORY_PATH); + return $this->filesystem->getPath(\Magento\Filesystem::MEDIA) . '/' . self::PREVIEW_DIRECTORY_PATH; } /** @@ -103,8 +106,6 @@ class Path implements \Magento\View\Design\Theme\Image\PathInterface */ public function getTemporaryDirectory() { - return implode(DIRECTORY_SEPARATOR, array( - $this->dir->getDir(\Magento\App\Dir::MEDIA), 'theme', 'origin' - )); + return $this->filesystem->getPath(\Magento\Filesystem::MEDIA) . '/theme/origin'; } } diff --git a/app/code/Magento/Core/Model/Theme/Registration.php b/app/code/Magento/Core/Model/Theme/Registration.php index 75da923844c..b8474a64124 100644 --- a/app/code/Magento/Core/Model/Theme/Registration.php +++ b/app/code/Magento/Core/Model/Theme/Registration.php @@ -65,33 +65,36 @@ class Registration array(ThemeInterface::TYPE_PHYSICAL, ThemeInterface::TYPE_STAGING) ); + /** + * @var \Magento\Filesystem\Directory\Read + */ + protected $directoryRead; + /** * Initialize dependencies * * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $collectionFactory - * @param \Magento\Core\Model\Theme\Collection $filesystemCollection + * @param Collection $filesystemCollection + * @param \Magento\Filesystem $filesystem */ public function __construct( - \Magento\Core\Model\Resource\Theme\CollectionFactory $collectionFactory, - \Magento\Core\Model\Theme\Collection $filesystemCollection + \Magento\Core\Model\Resource\Theme\CollectionFactory $collectionFactory, + \Magento\Core\Model\Theme\Collection $filesystemCollection, + \Magento\Filesystem $filesystem ) { - $this->_collectionFactory = $collectionFactory; - $this->_themeCollection = $filesystemCollection; + $this->_collectionFactory = $collectionFactory; + $this->_themeCollection = $filesystemCollection; + $this->directoryRead = $filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); } /** * Theme registration * - * @param string $baseDir * @param string $pathPattern * @return \Magento\View\Design\ThemeInterface */ - public function register($baseDir = '', $pathPattern = '') + public function register($pathPattern = '') { - if (!empty($baseDir)) { - $this->_themeCollection->setBaseDir($baseDir); - } - if (empty($pathPattern)) { $this->_themeCollection->addDefaultPattern('*'); } else { @@ -157,7 +160,7 @@ class Registration if (!$theme->getPreviewImage() || !$themeDirectory) { return $this; } - $imagePath = realpath($themeDirectory . DIRECTORY_SEPARATOR . $theme->getPreviewImage()); + $imagePath = $this->directoryRead->getAbsolutePath($themeDirectory . '/' . $theme->getPreviewImage()); if (0 === strpos($imagePath, $themeDirectory)) { $theme->getThemeImage()->createPreviewImage($imagePath); } diff --git a/app/code/Magento/Core/Model/Translate.php b/app/code/Magento/Core/Model/Translate.php index 3efb28bbc3c..55d44290e64 100644 --- a/app/code/Magento/Core/Model/Translate.php +++ b/app/code/Magento/Core/Model/Translate.php @@ -25,6 +25,7 @@ */ namespace Magento\Core\Model; + use Magento\TranslateInterface; @@ -195,6 +196,16 @@ class Translate implements TranslateInterface */ protected $_appState; + /** + * @var \Magento\Filesystem + */ + protected $filesystem; + + /** + * @var \Magento\Filesystem\Directory\Read + */ + protected $directory; + /** * @param \Magento\View\DesignInterface $viewDesign * @param \Magento\Core\Model\Locale\Hierarchy\Config $config @@ -209,6 +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 * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -225,7 +237,8 @@ class Translate implements TranslateInterface \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Resource\Translate $translate, \Magento\Core\Model\App $app, - \Magento\App\State $appState + \Magento\App\State $appState, + \Magento\Filesystem $filesystem ) { $this->_viewDesign = $viewDesign; $this->_localeHierarchy = $config->getHierarchy(); @@ -240,6 +253,8 @@ class Translate implements TranslateInterface $this->_translateResource = $translate; $this->_app = $app; $this->_appState = $appState; + $this->filesystem = $filesystem; + $this->directory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); } /** @@ -271,7 +286,7 @@ class Translate implements TranslateInterface $this->_loadModuleTranslation($module['name']); } - $this->_loadThemeTranslation($forceReload); + $this->_loadThemeTranslation($forceReload, $area); $this->_loadDbTranslation($forceReload); if (!$forceReload) { @@ -440,15 +455,16 @@ class Translate implements TranslateInterface * @param boolean $forceReload * @return \Magento\Core\Model\Translate */ - protected function _loadThemeTranslation($forceReload = false) + protected function _loadThemeTranslation($forceReload = false, $area = null) { if (!$this->_config[self::CONFIG_KEY_DESIGN_THEME]) { return $this; } + $area = isset($area) ? $area : $this->_appState->getAreaCode(); $requiredLocaleList = $this->_composeRequiredLocaleList($this->getLocale()); foreach ($requiredLocaleList as $locale) { - $file = $this->_getThemeTranslationFile($locale); + $file = $this->_getThemeTranslationFile($locale, $area); $this->_addData( $this->_getFileData($file), self::CONFIG_KEY_DESIGN_THEME . $this->_config[self::CONFIG_KEY_DESIGN_THEME], @@ -483,8 +499,8 @@ class Translate implements TranslateInterface */ protected function _getModuleTranslationFile($moduleName, $locale) { - $file = $this->_modulesReader->getModuleDir(\Magento\App\Dir::LOCALE, $moduleName); - $file .= DS . $locale . '.csv'; + $file = $this->_modulesReader->getModuleDir(\Magento\Filesystem::LOCALE, $moduleName); + $file .= '/' . $locale . '.csv'; return $file; } @@ -494,9 +510,11 @@ class Translate implements TranslateInterface * @param string $locale * @return string */ - protected function _getThemeTranslationFile($locale) + protected function _getThemeTranslationFile($locale, $area = null) { - return $this->_viewFileSystem->getFilename(\Magento\App\Dir::LOCALE . DS . $locale . '.csv'); + $area = isset($area) ? $area : $this->_appState->getAreaCode(); + return $this->_viewFileSystem + ->getFilename(\Magento\Filesystem::LOCALE . '/' . $locale . '.csv', array('area' => $area)); } /** @@ -508,7 +526,7 @@ class Translate implements TranslateInterface protected function _getFileData($file) { $data = array(); - if (file_exists($file)) { + if ($this->directory->isExist($this->directory->getRelativePath($file))) { $parser = new \Magento\File\Csv(); $parser->setDelimiter(self::CSV_SEPARATOR); $data = $parser->getDataPairs($file); diff --git a/app/code/Magento/Core/Model/Translate/Factory.php b/app/code/Magento/Core/Model/Translate/Factory.php index 280253a59f0..7d4f050e018 100644 --- a/app/code/Magento/Core/Model/Translate/Factory.php +++ b/app/code/Magento/Core/Model/Translate/Factory.php @@ -34,7 +34,7 @@ class Factory /** * Default translate inline class name */ - const DEFAULT_CLASS_NAME = 'Magento\Core\Model\Translate\Inline'; + const DEFAULT_CLASS_NAME = 'Magento\Core\Model\Translate\InlineInterface'; /** * Object Manager diff --git a/app/code/Magento/Core/Model/Translate/Inline.php b/app/code/Magento/Core/Model/Translate/Inline.php index 184ce74f845..045577fed03 100644 --- a/app/code/Magento/Core/Model/Translate/Inline.php +++ b/app/code/Magento/Core/Model/Translate/Inline.php @@ -130,6 +130,14 @@ class Inline implements \Magento\Core\Model\Translate\InlineInterface return $this->_translator->getTranslateInline() && $this->_isAllowed; } + /** + * Disable inline translation functionality + */ + public function disable() + { + $this->_isAllowed = false; + } + /** * Replace translation templates with HTML fragments * diff --git a/app/code/Magento/Core/Model/Translate/Inline/ConfigFactory.php b/app/code/Magento/Core/Model/Translate/Inline/ConfigFactory.php index 317f06cf572..67bb4fea438 100644 --- a/app/code/Magento/Core/Model/Translate/Inline/ConfigFactory.php +++ b/app/code/Magento/Core/Model/Translate/Inline/ConfigFactory.php @@ -48,10 +48,9 @@ class ConfigFactory /** * Create instance of inline translate config * - * @param string|null $area * @return \Magento\Core\Model\Translate\Inline\ConfigInterface */ - public function create($area = null) + public function create() { return $this->_objectManager->create('Magento\Core\Model\Translate\Inline\Config'); } diff --git a/app/code/Magento/Core/Model/Url/Rewrite.php b/app/code/Magento/Core/Model/Url/Rewrite.php index 9bc77da3cde..41ea05ec1cd 100644 --- a/app/code/Magento/Core/Model/Url/Rewrite.php +++ b/app/code/Magento/Core/Model/Url/Rewrite.php @@ -320,7 +320,7 @@ class Rewrite extends \Magento\Core\Model\AbstractModel } if ($this->_coreStoreConfig->getConfig('web/url/use_store') && $storeCode = $this->_storeManager->getStore()->getCode()) { - $targetUrl = $request->getBaseUrl(). '/' . $storeCode . '/' .$this->getTargetPath(); + $targetUrl = $request->getBaseUrl(). '/' . $storeCode . '/' .$this->getTargetPath(); } $queryString = $this->_getQueryString(); diff --git a/app/code/Magento/Core/Model/View/Design.php b/app/code/Magento/Core/Model/View/Design.php index 9079857446a..121630d135b 100644 --- a/app/code/Magento/Core/Model/View/Design.php +++ b/app/code/Magento/Core/Model/View/Design.php @@ -240,7 +240,7 @@ class Design implements \Magento\View\DesignInterface public function getDesignParams() { $params = array( - 'area' => $this->_appState->getAreaCode(), + 'area' => $this->getArea(), 'themeModel' => $this->getDesignTheme(), 'locale' => $this->_app->getLocale()->getLocaleCode() ); diff --git a/app/code/Magento/Core/etc/config.xml b/app/code/Magento/Core/etc/config.xml index ebf0803954d..7e5010ae6de 100644 --- a/app/code/Magento/Core/etc/config.xml +++ b/app/code/Magento/Core/etc/config.xml @@ -88,104 +88,107 @@ </media_storage_configuration> <filesystem> <directory> - <base> - <read_only>true</read_only> - <path/> - </base> - <app> - <read_only>true</read_only> - <path>app</path> - </app> - <code> - <read_only>true</read_only> - <path>app/code</path> - </code> <design> - <read_only>true</read_only> + <read_only>1</read_only> <path>app/design</path> </design> - <etc> - <read_only>false</read_only> - <path>app/etc</path> - <allow_create_dirs>false</allow_create_dirs> - <permissions>777</permissions> - </etc> - <lib> - <read_only>true</read_only> - <path>lib</path> - </lib> <var> - <read_only>false</read_only> + <read_only>0</read_only> <path>var</path> - <allow_create_dirs>true</allow_create_dirs> - <permissions>777</permissions> + <allow_create_dirs>1</allow_create_dirs> + <permissions>511</permissions> </var> <tmp> - <read_only>false</read_only> + <read_only>0</read_only> <path>var/tmp</path> - <allow_create_dirs>true</allow_create_dirs> - <permissions>777</permissions> + <allow_create_dirs>1</allow_create_dirs> + <permissions>511</permissions> </tmp> <cache> - <read_only>false</read_only> + <read_only>0</read_only> <path>var/cache</path> - <allow_create_dirs>true</allow_create_dirs> - <permissions>777</permissions> + <allow_create_dirs>1</allow_create_dirs> + <permissions>511</permissions> </cache> <log> - <read_only>false</read_only> + <read_only>0</read_only> <path>var/log</path> - <allow_create_dirs>true</allow_create_dirs> - <permissions>777</permissions> + <allow_create_dirs>1</allow_create_dirs> + <permissions>511</permissions> </log> <session> - <read_only>false</read_only> + <read_only>0</read_only> <path>var/session</path> - <allow_create_dirs>true</allow_create_dirs> - <permissions>777</permissions> + <allow_create_dirs>1</allow_create_dirs> + <permissions>511</permissions> </session> - <di> - <read_only>false</read_only> - <path>var/di</path> - <allow_create_dirs>true</allow_create_dirs> - <permissions>777</permissions> - </di> - <generation> - <read_only>false</read_only> - <path>var/generation</path> - <allow_create_dirs>true</allow_create_dirs> - <permissions>777</permissions> - </generation> <pub> - <read_only>true</read_only> + <read_only>0</read_only> <path>pub</path> - <permissions>777</permissions> + <uri>pub</uri> + <permissions>511</permissions> </pub> <pub_lib> - <read_only>true</read_only> + <read_only>1</read_only> <path>pub/lib</path> + <uri>pub/lib</uri> </pub_lib> <media> - <read_only>false</read_only> + <read_only>0</read_only> <path>pub/media</path> - <permissions>777</permissions> + <uri>pub/media</uri> + <permissions>511</permissions> </media> <upload> - <read_only>false</read_only> + <read_only>0</read_only> <path>pub/media/upload</path> - <permissions>777</permissions> + <uri>pub/media/upload</uri> + <permissions>511</permissions> </upload> <static> - <read_only>false</read_only> + <read_only>0</read_only> <path>pub/static</path> - <permissions>777</permissions> + <uri>pub/static</uri> + <permissions>511</permissions> </static> <view_cache> - <read_only>false</read_only> + <read_only>0</read_only> <path>pub/cache</path> - <permissions>777</permissions> + <uri>pub/cache</uri> + <permissions>511</permissions> </view_cache> + <ftp> + <read_only>0</read_only> + <permissions>511</permissions> + <driver>Magento\Filesystem\Driver\File</driver> + </ftp> + <ftps> + <read_only>0</read_only> + <permissions>511</permissions> + <driver>Magento\Filesystem\Driver\File</driver> + </ftps> + <ssh2> + <read_only>0</read_only> + <permissions>511</permissions> + <driver>Magento\Filesystem\Driver\File</driver> + </ssh2> </directory> + <protocol> + <zlib> + <driver>Magento\Filesystem\Driver\Zlib</driver> + <protocol>compress.zlib</protocol> + </zlib> + <http> + <read_only>1</read_only> + <driver>Magento\Filesystem\Driver\Http</driver> + <protocol>http</protocol> + </http> + <https> + <read_only>1</read_only> + <driver>Magento\Filesystem\Driver\Https</driver> + <protocol>https</protocol> + </https> + </protocol> </filesystem> </system> <web> diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index 992533f8b1c..500e66db60f 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -30,7 +30,7 @@ <preference for="Magento\AuthorizationInterface" type="Magento\Authorization" /> <preference for="Magento\Authorization\Policy" type="Magento\Authorization\Policy\DefaultPolicy" /> <preference for="Magento\Authorization\RoleLocator" type="Magento\Authorization\RoleLocator\DefaultRoleLocator" /> - <preference for="Magento\Core\Model\Session\AbstractSession" type="Magento\Core\Model\Session" /> + <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" /> @@ -46,7 +46,7 @@ <preference for="Magento\Core\Model\Url\SecurityInfoInterface" type="Magento\Core\Model\Url\SecurityInfo\Proxy" /> <preference for="Magento\App\DefaultPathInterface" type="Magento\App\DefaultPath\DefaultPath" /> <preference for="Magento\Encryption\EncryptorInterface" type="Magento\Encryption\Encryptor" /> - <preference for="Magento\Filter\Encrypt\AdapterInterface" type=" Magento\Filter\Encrypt\Basic" /> + <preference for="Magento\Filter\Encrypt\AdapterInterface" type="Magento\Filter\Encrypt\Basic" /> <preference for="Magento\Cache\ConfigInterface" type="Magento\Cache\Config" /> <preference for="Magento\View\Design\Theme\ThemeProviderInterface" type="Magento\Core\Model\Theme\ThemeProvider" /> <preference for="Magento\View\Design\Theme\FileProviderInterface" type="Magento\Core\Model\Theme\FileProvider" /> @@ -56,6 +56,9 @@ <preference for="Magento\TranslateInterface" type="Magento\Core\Model\Translate" /> <preference for="Magento\App\Response\RedirectInterface" type="Magento\Core\App\Response\Redirect" /> <preference for="Magento\Data\Collection\EntityFactoryInterface" type="Magento\Core\Model\EntityFactory" /> + <preference for="Magento\Core\Model\Translate\InlineInterface" type="Magento\Core\Model\Translate\Inline" /> + <preference for="Magento\Session\ValidatorInterface" type="Magento\Core\Model\Session\Validator" /> + <preference for="Magento\Session\StorageInterface" type="Magento\Session\Storage" /> <type name="Magento\App\DefaultPath\DefaultPath"> <param name="parts"> <value> @@ -95,7 +98,7 @@ <value type="argument">Magento\Core\Model\Store::CUSTOM_ENTRY_POINT_PARAM</value> </param> <param name="url"> - <instance type="Magento\Core\Model\Url\Proxy" /> + <instance type="Magento\Core\Model\Url" shared="false"/> </param> </type> <type name="Magento\Core\Model\Acl\Cache"> @@ -361,11 +364,6 @@ <value type="argument">Magento\Encryption\Encryptor::PARAM_CRYPT_KEY</value> </param> </type> - <type name="Magento\Core\Model\Session\Context"> - <param name="saveMethod"> - <value type="argument">Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD</value> - </param> - </type> <type name="Magento\Core\Model\Session\Config"> <param name="savePath"> <value type="argument">Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_PATH</value> @@ -373,11 +371,17 @@ <param name="cacheLimiter"> <value type="argument">Magento\Core\Model\Session\Config::PARAM_SESSION_CACHE_LIMITER</value> </param> + <param name="saveMethod"> + <value type="argument">Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD</value> + </param> </type> <type name="Magento\Core\Model\StoreManager"> <param name="request"> <instance type="Magento\App\Request\Http\Proxy" /> </param> + <param name="helper"> + <instance type="Magento\Core\Helper\Data\Proxy" /> + </param> </type> <type name="Magento\Core\Model\Config\Section\Processor\Placeholder"> <param name="request"> @@ -476,6 +480,26 @@ <instance type="Magento\Core\Model\Date\Proxy" /> </param> </type> + <virtualType name="Magento\Core\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> + <value>core</value> + </param> + </virtualType> + <type name="Magento\Core\Model\Session"> + <param name="storage"> + <instance type="Magento\Core\Model\Session\Storage" /> + </param> + </type> + <virtualType name="Magento\Message\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> + <value>message</value> + </param> + </virtualType> + <type name="Magento\Message\Session"> + <param name="storage"> + <instance type="Magento\Message\Session\Storage" /> + </param> + </type> <type name="Magento\View\Asset\MergeService"> <plugin name="cleanMergedJsCss" type="Magento\Core\Model\Asset\Plugin\CleanMergedJsCss"/> </type> diff --git a/app/code/Magento/Core/etc/module.xml b/app/code/Magento/Core/etc/module.xml index 05c7ebe25be..df832a21c1d 100755 --- a/app/code/Magento/Core/etc/module.xml +++ b/app/code/Magento/Core/etc/module.xml @@ -26,7 +26,6 @@ <config> <module name="Magento_Core" version="1.6.0.15" active="true"> <depends> - <module name="Magento_Adminhtml"/> <module name="Magento_Backend"/> <module name="Magento_Directory"/> <module name="Magento_Index"/> diff --git a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency.php b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency.php index fcfd964fc01..6fadb7ee57e 100644 --- a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency.php +++ b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency.php @@ -40,7 +40,7 @@ class Currency extends \Magento\Backend\Block\Template protected function _prepareLayout() { - $this->addChild('save_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save Currency Rates'), 'class' => 'save', 'data_attribute' => array( @@ -48,13 +48,13 @@ class Currency extends \Magento\Backend\Block\Template 'button' => array('event' => 'save', 'target' => '#rate-form'), )))); - $this->addChild('reset_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('reset_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Reset'), 'onclick' => 'document.location.reload()', 'class' => 'reset' )); - $this->addChild('import_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('import_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Import'), 'class' => 'add', 'type' => 'submit', diff --git a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currencysymbol.php b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currencysymbol.php index 3aeab5c6733..8245376181c 100644 --- a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currencysymbol.php +++ b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currencysymbol.php @@ -99,7 +99,7 @@ class Currencysymbol extends \Magento\Backend\Block\Widget\Form public function getSaveButtonHtml() { /** @var $block \Magento\View\Element\AbstractBlock */ - $block = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button'); + $block = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button'); $block->setData(array( 'label' => __('Save Currency Symbols'), 'class' => 'save', diff --git a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php index 5bd33244b93..c8a2879e7ad 100644 --- a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php +++ b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php @@ -102,17 +102,17 @@ class Currency extends \Magento\Backend\App\Action $errors = $importModel->getMessages(); if (sizeof($errors) > 0) { foreach ($errors as $error) { - $backendSession->addWarning($error); + $this->messageManager->addWarning($error); } - $backendSession->addWarning(__('All possible rates were fetched, please click on "Save" to apply')); + $this->messageManager->addWarning(__('All possible rates were fetched, please click on "Save" to apply')); } else { - $backendSession->addSuccess(__('All rates were fetched, please click on "Save" to apply')); + $this->messageManager->addSuccess(__('All rates were fetched, please click on "Save" to apply')); } $backendSession->setRates($rates); } catch (\Exception $e){ - $backendSession->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } $this->_redirect('adminhtml/*/'); } @@ -121,8 +121,6 @@ class Currency extends \Magento\Backend\App\Action { $data = $this->getRequest()->getParam('rate'); if (is_array($data)) { - /** @var \Magento\Backend\Model\Session $backendSession */ - $backendSession = $this->_objectManager->get('Magento\Backend\Model\Session'); try { foreach ($data as $currencyCode => $rate) { foreach( $rate as $currencyTo => $value ) { @@ -132,7 +130,7 @@ class Currency extends \Magento\Backend\App\Action ); $data[$currencyCode][$currencyTo] = $value; if( $value == 0 ) { - $backendSession->addWarning( + $this->messageManager->addWarning( __('Please correct the input data for %1 => %2 rate', $currencyCode, $currencyTo) ); } @@ -140,9 +138,9 @@ class Currency extends \Magento\Backend\App\Action } $this->_objectManager->create('Magento\Directory\Model\Currency')->saveRates($data); - $backendSession->addSuccess(__('All valid rates have been saved.')); + $this->messageManager->addSuccess(__('All valid rates have been saved.')); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Backend\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } } diff --git a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol.php b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol.php index 2331e01dab5..bca189c367d 100644 --- a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol.php +++ b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol.php @@ -70,14 +70,12 @@ class Currencysymbol extends \Magento\Backend\App\Action } } - /** @var \Magento\Backend\Model\Session $backendSession */ - $backendSession = $this->_objectManager->get('Magento\Backend\Model\Session'); try { $this->_objectManager->create('Magento\CurrencySymbol\Model\System\Currencysymbol') ->setCurrencySymbolsData($symbolsDataArray); - $backendSession->addSuccess(__('The custom currency symbols were applied.')); + $this->messageManager->addSuccess(__('The custom currency symbols were applied.')); } catch (\Exception $e) { - $backendSession->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); diff --git a/app/code/Magento/CurrencySymbol/etc/adminhtml/menu.xml b/app/code/Magento/CurrencySymbol/etc/adminhtml/menu.xml index 3eda623b80a..82b633ee674 100644 --- a/app/code/Magento/CurrencySymbol/etc/adminhtml/menu.xml +++ b/app/code/Magento/CurrencySymbol/etc/adminhtml/menu.xml @@ -27,8 +27,8 @@ --> <config> <menu> - <remove id="Magento_Adminhtml::system_currency" /> - <add id="Magento_CurrencySymbol::system_currency" title="Currency" module="Magento_CurrencySymbol" sortOrder="30" parent="Magento_Adminhtml::stores" resource="Magento_CurrencySymbol::system_currency" /> + <remove id="Magento_Backend::system_currency" /> + <add id="Magento_CurrencySymbol::system_currency" title="Currency" module="Magento_CurrencySymbol" sortOrder="30" parent="Magento_Backend::stores" resource="Magento_CurrencySymbol::system_currency" /> <add id="Magento_CurrencySymbol::system_currency_rates" title="Currency Rates" module="Magento_CurrencySymbol" sortOrder="10" parent="Magento_CurrencySymbol::system_currency" action="adminhtml/system_currency" resource="Magento_CurrencySymbol::currency_rates"/> <add id="Magento_CurrencySymbol::system_currency_symbols" title="Currency Symbols" module="Magento_CurrencySymbol" sortOrder="20" parent="Magento_CurrencySymbol::system_currency" action="adminhtml/system_currencysymbol" resource="Magento_CurrencySymbol::symbols"/> </menu> diff --git a/app/code/Magento/CurrencySymbol/etc/adminhtml/routes.xml b/app/code/Magento/CurrencySymbol/etc/adminhtml/routes.xml index 85cab4006b1..fcf6b8739f0 100644 --- a/app/code/Magento/CurrencySymbol/etc/adminhtml/routes.xml +++ b/app/code/Magento/CurrencySymbol/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_CurrencySymbol_Adminhtml" /> + <module name="Magento_CurrencySymbol" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/CurrencySymbol/etc/module.xml b/app/code/Magento/CurrencySymbol/etc/module.xml index 0d9bdb0586f..739add69b70 100755 --- a/app/code/Magento/CurrencySymbol/etc/module.xml +++ b/app/code/Magento/CurrencySymbol/etc/module.xml @@ -29,7 +29,6 @@ <module name="Magento_Widget"/> </sequence> <depends> - <module name="Magento_Adminhtml"/> <module name="Magento_Directory"/> <module name="Magento_Backend"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/Customer/Block/Account/AuthorizationLink.php b/app/code/Magento/Customer/Block/Account/AuthorizationLink.php index f36ee8ecbf6..d7ae093696d 100644 --- a/app/code/Magento/Customer/Block/Account/AuthorizationLink.php +++ b/app/code/Magento/Customer/Block/Account/AuthorizationLink.php @@ -36,18 +36,26 @@ class AuthorizationLink extends \Magento\View\Element\Html\Link */ protected $_customerSession; + /** + * @var \Magento\Customer\Helper\Data + */ + protected $_customerHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $session + * @param \Magento\Customer\Helper\Data $customerHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Customer\Model\Session $session, + \Magento\Customer\Helper\Data $customerHelper, array $data = array() ) { parent::__construct($context, $data); $this->_customerSession = $session; + $this->_customerHelper = $customerHelper; } /** @@ -55,8 +63,9 @@ class AuthorizationLink extends \Magento\View\Element\Html\Link */ public function getHref() { - $helper = $this->_helperFactory->get('Magento\Customer\Helper\Data'); - return $this->_customerSession->isLoggedIn() ? $helper->getLogoutUrl() : $helper->getLoginUrl(); + return $this->_customerSession->isLoggedIn() + ? $this->_customerHelper->getLogoutUrl() + : $this->_customerHelper->getLoginUrl(); } /** diff --git a/app/code/Magento/Customer/Block/Account/Customer.php b/app/code/Magento/Customer/Block/Account/Customer.php index 3876569063c..ce7224319d9 100644 --- a/app/code/Magento/Customer/Block/Account/Customer.php +++ b/app/code/Magento/Customer/Block/Account/Customer.php @@ -33,18 +33,26 @@ class Customer extends \Magento\View\Element\Template */ protected $_customerSession; + /** + * @var \Magento\Customer\Helper\Data + */ + protected $_customerHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $session + * @param \Magento\Customer\Helper\Data $customerHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Customer\Model\Session $session, + \Magento\Customer\Helper\Data $customerHelper, array $data = array() ) { parent::__construct($context, $data); $this->_customerSession = $session; + $this->_customerHelper = $customerHelper; } /** @@ -63,6 +71,6 @@ class Customer extends \Magento\View\Element\Template */ public function getCustomerName() { - return $this->_helperFactory->get('Magento_Customer_Helper_Data')->getCustomerName(); + return $this->_customerHelper->getCustomerName(); } } diff --git a/app/code/Magento/Customer/Block/Account/Link.php b/app/code/Magento/Customer/Block/Account/Link.php index 3375ac23f6c..a0023dba0ad 100644 --- a/app/code/Magento/Customer/Block/Account/Link.php +++ b/app/code/Magento/Customer/Block/Account/Link.php @@ -26,11 +26,30 @@ namespace Magento\Customer\Block\Account; class Link extends \Magento\View\Element\Html\Link { + /** + * @var \Magento\Customer\Helper\Data + */ + protected $_customerHelper; + + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Customer\Helper\Data $customerHelper + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Customer\Helper\Data $customerHelper, + array $data = array() + ) { + $this->_customerHelper = $customerHelper; + parent::__construct($context, $data); + } + /** * @return string */ public function getHref() { - return $this->helper('Magento\Customer\Helper\Data')->getAccountUrl(); + return $this->_customerHelper->getAccountUrl(); } } diff --git a/app/code/Magento/Customer/Block/Account/RegisterLink.php b/app/code/Magento/Customer/Block/Account/RegisterLink.php index 17922920e20..6b49473b99d 100644 --- a/app/code/Magento/Customer/Block/Account/RegisterLink.php +++ b/app/code/Magento/Customer/Block/Account/RegisterLink.php @@ -36,18 +36,26 @@ class RegisterLink extends \Magento\View\Element\Html\Link */ protected $_customerSession; + /** + * @var \Magento\Customer\Helper\Data + */ + protected $_customerHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $session + * @param \Magento\Customer\Helper\Data $customerHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Customer\Model\Session $session, + \Magento\Customer\Helper\Data $customerHelper, array $data = array() ) { parent::__construct($context, $data); $this->_customerSession = $session; + $this->_customerHelper = $customerHelper; } /** @@ -55,7 +63,7 @@ class RegisterLink extends \Magento\View\Element\Html\Link */ public function getHref() { - return $this->_helperFactory->get('Magento\Customer\Helper\Data')->getRegisterUrl(); + return $this->_customerHelper->getRegisterUrl(); } /** diff --git a/app/code/Magento/Customer/Block/Adminhtml/Customer.php b/app/code/Magento/Customer/Block/Adminhtml/Customer.php index a0cbb466196..ad6a27c008a 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Customer.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Customer.php @@ -34,7 +34,7 @@ namespace Magento\Customer\Block\Adminhtml; -class Customer extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Customer extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit.php b/app/code/Magento/Customer/Block/Adminhtml/Edit.php index 31e709eedad..7c1ab26c847 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Attribute/Group.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Attribute/Group.php index 966bcd80b14..35abeed7086 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Attribute/Group.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Attribute/Group.php @@ -34,7 +34,7 @@ namespace Magento\Customer\Block\Adminhtml\Edit\Renderer\Attribute; class Group - extends \Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset\Element + extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element { protected $_template = 'edit/tab/account/form/renderer/group.phtml'; diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php index c95fd8e2ae3..376ef603793 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php @@ -35,6 +35,25 @@ class Region extends \Magento\Backend\Block\AbstractBlock implements \Magento\Data\Form\Element\Renderer\RendererInterface { + /** + * @var \Magento\Directory\Helper\Data + */ + protected $_directoryHelper; + + /** + * @param \Magento\Backend\Block\Context $context + * @param \Magento\Directory\Helper\Data $directoryHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Context $context, + \Magento\Directory\Helper\Data $directoryHelper, + array $data = array() + ) { + $this->_directoryHelper = $directoryHelper; + parent::__construct($context, $data); + } + /** * Output the region element and javasctipt that makes it dependent from country element * @@ -68,7 +87,7 @@ class Region $html .= '<script type="text/javascript">' . "\n"; $html .= '$("' . $selectId . '").setAttribute("defaultValue", "' . $regionId.'");' . "\n"; $html .= 'new regionUpdater("' . $country->getHtmlId() . '", "' . $element->getHtmlId() - . '", "' . $selectId . '", ' . $this->helper('Magento\Directory\Helper\Data')->getRegionJson() . ');' . "\n"; + . '", "' . $selectId . '", ' . $this->_directoryHelper->getRegionJson() . ');' . "\n"; $html .= '</script>' . "\n"; $html .= '</div></div>' . "\n"; diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php index 55d2a9ed7af..045629884cc 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php @@ -60,13 +60,19 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic */ protected $_jsonEncoder; + /** + * @var \Magento\Customer\Helper\Data + */ + protected $_customerHelper; + /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory + * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Customer\Model\FormFactory $customerFactory * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Customer\Helper\Data $customerHelper * @param array $data */ public function __construct( @@ -76,8 +82,10 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Customer\Model\FormFactory $customerFactory, \Magento\Core\Model\System\Store $systemStore, + \Magento\Customer\Helper\Data $customerHelper, array $data = array() ) { + $this->_customerHelper = $customerHelper; $this->_jsonEncoder = $jsonEncoder; $this->_systemStore = $systemStore; $this->_customerFactory = $customerFactory; @@ -117,7 +125,7 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic $prefixElement = $form->getElement('prefix'); if ($prefixElement) { - $prefixOptions = $this->helper('Magento\Customer\Helper\Data')->getNamePrefixOptions($customerStoreId); + $prefixOptions = $this->_customerHelper->getNamePrefixOptions($customerStoreId); if (!empty($prefixOptions)) { $fieldset->removeField($prefixElement->getId()); $prefixField = $fieldset->addField($prefixElement->getId(), @@ -134,7 +142,7 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic $suffixElement = $form->getElement('suffix'); if ($suffixElement) { - $suffixOptions = $this->helper('Magento\Customer\Helper\Data')->getNameSuffixOptions($customerStoreId); + $suffixOptions = $this->_customerHelper->getNameSuffixOptions($customerStoreId); if (!empty($suffixOptions)) { $fieldset->removeField($suffixElement->getId()); $suffixField = $fieldset->addField($suffixElement->getId(), diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php index 4d5619f63b0..c35f5c48446 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php @@ -40,7 +40,7 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic /** * Adminhtml addresses * - * @var \Magento\Adminhtml\Helper\Addresses + * @var \Magento\Backend\Helper\Addresses */ protected $_adminhtmlAddresses = null; @@ -54,18 +54,26 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic */ protected $_coreData; + /** + * @var \Magento\Customer\Helper\Data + */ + protected $_customerHelper; + /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Customer\Model\Renderer\RegionFactory $regionFactory * @param \Magento\Customer\Model\AddressFactory $addressFactory * @param \Magento\Customer\Model\FormFactory $customerFactory * @param \Magento\Core\Model\System\Store $systemStore - * @param \Magento\Adminhtml\Helper\Addresses $adminhtmlAddresses + * @param \Magento\Backend\Helper\Addresses $adminhtmlAddresses + * @param \Magento\Customer\Helper\Data $customerHelper * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Backend\Block\Template\Context $context, @@ -77,9 +85,11 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Customer\Model\AddressFactory $addressFactory, \Magento\Customer\Model\FormFactory $customerFactory, \Magento\Core\Model\System\Store $systemStore, - \Magento\Adminhtml\Helper\Addresses $adminhtmlAddresses, + \Magento\Backend\Helper\Addresses $adminhtmlAddresses, + \Magento\Customer\Helper\Data $customerHelper, array $data = array() ) { + $this->_customerHelper = $customerHelper; $this->_coreData = $coreData; $this->_jsonEncoder = $jsonEncoder; $this->_adminhtmlAddresses = $adminhtmlAddresses; @@ -97,14 +107,14 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic protected function _prepareLayout() { - $this->addChild('delete_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('delete_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete Address'), 'name' => 'delete_address', 'element_name' => 'delete_address', 'disabled' => $this->isReadonly(), 'class' => 'delete' . ($this->isReadonly() ? ' disabled' : '') )); - $this->addChild('add_address_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('add_address_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add New Address'), 'id' => 'add_address_button', 'name' => 'add_address_button', @@ -112,7 +122,7 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic 'disabled' => $this->isReadonly(), 'class' => 'add' . ($this->isReadonly() ? ' disabled' : '') )); - $this->addChild('cancel_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('cancel_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Cancel'), 'id' => 'cancel_add_address'.$this->getTemplatePrefix(), 'name' => 'cancel_address', @@ -209,7 +219,7 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic $prefixElement = $form->getElement('prefix'); if ($prefixElement) { - $prefixOptions = $this->helper('Magento\Customer\Helper\Data')->getNamePrefixOptions($customerStoreId); + $prefixOptions = $this->_customerHelper->getNamePrefixOptions($customerStoreId); if (!empty($prefixOptions)) { $fieldset->removeField($prefixElement->getId()); $prefixField = $fieldset->addField($prefixElement->getId(), @@ -223,7 +233,7 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic $suffixElement = $form->getElement('suffix'); if ($suffixElement) { - $suffixOptions = $this->helper('Magento\Customer\Helper\Data')->getNameSuffixOptions($customerStoreId); + $suffixOptions = $this->_customerHelper->getNameSuffixOptions($customerStoreId); if (!empty($suffixOptions)) { $fieldset->removeField($suffixElement->getId()); $suffixField = $fieldset->addField($suffixElement->getId(), diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php index 0b58d9a45ed..f3279bb4ff9 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php @@ -36,7 +36,7 @@ namespace Magento\Customer\Block\Adminhtml\Edit\Tab; /** * @SuppressWarnings(PHPMD.LongVariable) */ -class Cart extends \Magento\Adminhtml\Block\Widget\Grid +class Cart extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Core registry @@ -58,6 +58,7 @@ class Cart extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\Data\CollectionFactory $dataCollectionFactory * @param \Magento\Core\Model\Registry $coreRegistry @@ -66,6 +67,7 @@ class Cart extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\Data\CollectionFactory $dataCollectionFactory, \Magento\Core\Model\Registry $coreRegistry, @@ -74,7 +76,7 @@ class Cart extends \Magento\Adminhtml\Block\Widget\Grid $this->_dataCollectionFactory = $dataCollectionFactory; $this->_coreRegistry = $coreRegistry; $this->_quoteFactory = $quoteFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php index 90670db2e31..2464e5b10be 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Core registry @@ -50,6 +50,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Newsletter\Model\Resource\Queue\CollectionFactory $collectionFactory * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data @@ -57,13 +58,14 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Newsletter\Model\Resource\Queue\CollectionFactory $collectionFactory, \Magento\Core\Model\Registry $coreRegistry, array $data = array() ) { $this->_coreRegistry = $coreRegistry; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Filter/Status.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Filter/Status.php index 1595d4fc3e8..030bb91a9f9 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Filter/Status.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Filter/Status.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Filter; -class Status extends \Magento\Adminhtml\Block\Widget\Grid\Column\Filter\Select +class Status extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select { protected static $_statuses; diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php index 475c1d330b9..e59f4d4f3fa 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Renderer; -class Action extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * Core registry diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Status.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Status.php index 0c59248c495..1c06cec9a4c 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Status.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Status.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Renderer; -class Status extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Status extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { protected static $_statuses; diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php index 404889eccac..ac85cf0e13b 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab; -class Orders extends \Magento\Adminhtml\Block\Widget\Grid +class Orders extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Sales reorder @@ -57,6 +57,7 @@ class Orders extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory $collectionFactory * @param \Magento\Sales\Helper\Reorder $salesReorder * @param \Magento\Core\Model\Registry $coreRegistry @@ -65,6 +66,7 @@ class Orders extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory $collectionFactory, \Magento\Sales\Helper\Reorder $salesReorder, \Magento\Core\Model\Registry $coreRegistry, @@ -73,7 +75,7 @@ class Orders extends \Magento\Adminhtml\Block\Widget\Grid $this->_coreRegistry = $coreRegistry; $this->_salesReorder = $salesReorder; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php index 8593c87dd8a..7725cf55fe3 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php @@ -31,7 +31,7 @@ namespace Magento\Customer\Block\Adminhtml\Edit\Tab; */ class View extends \Magento\Backend\Block\Template - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** * @var \Magento\Log\Model\Customer diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Accordion.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Accordion.php index 43157102b4a..ba0ef3bfc95 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Accordion.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Accordion.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View; -class Accordion extends \Magento\Adminhtml\Block\Widget\Accordion +class Accordion extends \Magento\Backend\Block\Widget\Accordion { /** * Core registry diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php index b793e9e8027..9dda5be286e 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php @@ -36,7 +36,7 @@ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View; /** * @SuppressWarnings(PHPMD.LongVariable) */ -class Cart extends \Magento\Adminhtml\Block\Widget\Grid +class Cart extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Core registry @@ -58,6 +58,7 @@ class Cart extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\Data\CollectionFactory $dataCollectionFactory * @param \Magento\Core\Model\Registry $coreRegistry @@ -66,6 +67,7 @@ class Cart extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\Data\CollectionFactory $dataCollectionFactory, \Magento\Core\Model\Registry $coreRegistry, @@ -74,7 +76,7 @@ class Cart extends \Magento\Adminhtml\Block\Widget\Grid $this->_dataCollectionFactory = $dataCollectionFactory; $this->_coreRegistry = $coreRegistry; $this->_quoteFactory = $quoteFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Grid/Renderer/Item.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Grid/Renderer/Item.php index eeda163bb5f..6af3d6d7ff9 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Grid/Renderer/Item.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Grid/Renderer/Item.php @@ -43,16 +43,24 @@ class Item */ protected $_productConfig = null; - /** - * @param \Magento\Backend\Block\Context $context - * @param \Magento\Catalog\Helper\Product\Configuration $productConfig - * @param array $data + /** + * @var \Magento\Catalog\Helper\Product\ConfigurationPool */ - public function __construct( - \Magento\Backend\Block\Context $context, - \Magento\Catalog\Helper\Product\Configuration $productConfig, - array $data = array() - ) { + protected $_productConfigPool; + + /** + * @param \Magento\Backend\Block\Context $context + * @param \Magento\Catalog\Helper\Product\Configuration $productConfig + * @param \Magento\Catalog\Helper\Product\ConfigurationPool $productConfigPool + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Context $context, + \Magento\Catalog\Helper\Product\Configuration $productConfig, + \Magento\Catalog\Helper\Product\ConfigurationPool $productConfigPool, + array $data = array() + ) { + $this->_productConfigPool = $productConfigPool; $this->_productConfig = $productConfig; parent::__construct($context, $data); } @@ -88,11 +96,7 @@ class Item $helperName = 'Magento\Catalog\Helper\Product\Configuration'; } - $helper = $this->_helperFactory->get($helperName); - if (!($helper instanceof \Magento\Catalog\Helper\Product\Configuration\ConfigurationInterface)) { - throw new \Magento\Core\Exception(__("Helper for options rendering doesn't implement required interface.")); - } - return $helper; + return $this->_productConfigPool->get($helperName); } /* diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Orders.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Orders.php index a61367ecd2a..c28fb3786eb 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Orders.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Orders.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View; -class Orders extends \Magento\Adminhtml\Block\Widget\Grid +class Orders extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Core registry @@ -50,6 +50,7 @@ class Orders extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory $collectionFactory * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data @@ -57,13 +58,14 @@ class Orders extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory $collectionFactory, \Magento\Core\Model\Registry $coreRegistry, array $data = array() ) { $this->_coreRegistry = $coreRegistry; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Wishlist.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Wishlist.php index 4eb80968e07..9f5218af31f 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Wishlist.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Wishlist.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View; -class Wishlist extends \Magento\Adminhtml\Block\Widget\Grid +class Wishlist extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Core registry @@ -50,6 +50,7 @@ class Wishlist extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Wishlist\Model\Resource\Item\CollectionFactory $collectionFactory * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data @@ -57,13 +58,14 @@ class Wishlist extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Wishlist\Model\Resource\Item\CollectionFactory $collectionFactory, \Magento\Core\Model\Registry $coreRegistry, array $data = array() ) { $this->_coreRegistry = $coreRegistry; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php index c80dc646ccd..7891a6c46f1 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Wishlist\Grid\Renderer; -class Description extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Description extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { public function render(\Magento\Object $row) diff --git a/app/code/Magento/Customer/Block/Adminhtml/Grid.php b/app/code/Magento/Customer/Block/Adminhtml/Grid.php index d1df9b86122..3e10ed001ae 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Grid.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * @var \Magento\Core\Model\System\Store @@ -50,26 +50,36 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid */ protected $_groupsFactory; + /** + * @var \Magento\Customer\Helper\Data + */ + protected $_customerHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Core\Model\System\Store $systemStore * @param \Magento\Customer\Model\Resource\Customer\CollectionFactory $customersFactory * @param \Magento\Customer\Model\Resource\Group\CollectionFactory $groupsFactory + * @param \Magento\Customer\Helper\Data $customerHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Core\Model\System\Store $systemStore, \Magento\Customer\Model\Resource\Customer\CollectionFactory $customersFactory, \Magento\Customer\Model\Resource\Group\CollectionFactory $groupsFactory, + \Magento\Customer\Helper\Data $customerHelper, array $data = array() ) { + $this->_customerHelper = $customerHelper; $this->_systemStore = $systemStore; $this->_customersFactory = $customersFactory; $this->_groupsFactory = $groupsFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() @@ -227,7 +237,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid 'url' => $this->getUrl('customer/*/massUnsubscribe') )); - $groups = $this->helper('Magento\Customer\Helper\Data')->getGroups()->toOptionArray(); + $groups = $this->_customerHelper->getGroups()->toOptionArray(); array_unshift($groups, array('label'=> '', 'value'=> '')); $this->getMassactionBlock()->addItem('assign_group', array( diff --git a/app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php b/app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php index 00c2f72708e..4663a0b9d46 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php @@ -34,25 +34,25 @@ namespace Magento\Customer\Block\Adminhtml\Grid\Filter; class Country - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Filter\Select + extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select { /** * @var \Magento\Directory\Model\Resource\Country\CollectionFactory */ protected $_collectionFactory; - /** - * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $collectionFactory - * @param array $data + /** + * @param \Magento\Backend\Block\Context $context + * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $collectionFactory + * @param array $data */ - public function __construct( - \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, - \Magento\Directory\Model\Resource\Country\CollectionFactory $collectionFactory, - array $data = array() - ) { + public function __construct( + \Magento\Backend\Block\Context $context, + \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\Directory\Model\Resource\Country\CollectionFactory $collectionFactory, + array $data = array() + ) { $this->_collectionFactory = $collectionFactory; parent::__construct($context, $resourceHelper, $data); } diff --git a/app/code/Magento/Customer/Block/Adminhtml/Grid/Renderer/Multiaction.php b/app/code/Magento/Customer/Block/Adminhtml/Grid/Renderer/Multiaction.php index 57c4c46fd90..3413c5d4826 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Grid/Renderer/Multiaction.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Grid/Renderer/Multiaction.php @@ -34,7 +34,7 @@ namespace Magento\Customer\Block\Adminhtml\Grid\Renderer; class Multiaction - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Action + extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action { /** * Renders column diff --git a/app/code/Magento/Customer/Block/Adminhtml/Group.php b/app/code/Magento/Customer/Block/Adminhtml/Group.php index a56c5b90b82..3963523e151 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Group.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Group.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml; -class Group extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Group extends \Magento\Backend\Block\Widget\Grid\Container { /** diff --git a/app/code/Magento/Customer/Block/Adminhtml/Group/Edit.php b/app/code/Magento/Customer/Block/Adminhtml/Group/Edit.php index 59def1cfbe5..e9a111c2178 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Group/Edit.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Group/Edit.php @@ -29,7 +29,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Group; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Ip.php b/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Ip.php index f836a2c3861..6501488eeab 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Ip.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Ip.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Online\Grid\Renderer; -class Ip extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Ip extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { public function render(\Magento\Object $row) diff --git a/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Type.php b/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Type.php index 3c735d69368..3df537bd726 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Type.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Type.php @@ -33,7 +33,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Online\Grid\Renderer; -class Type extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Type extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { public function render(\Magento\Object $row) diff --git a/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Url.php b/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Url.php index 45616587846..ba21d222feb 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Url.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Url.php @@ -34,7 +34,7 @@ */ namespace Magento\Customer\Block\Adminhtml\Online\Grid\Renderer; -class Url extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Url extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * Renders grid column diff --git a/app/code/Magento/Customer/Block/Adminhtml/Sales/Order/Address/Form/Renderer/Vat.php b/app/code/Magento/Customer/Block/Adminhtml/Sales/Order/Address/Form/Renderer/Vat.php index 2c7a6df869d..1e0c0c42f2f 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Sales/Order/Address/Form/Renderer/Vat.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Sales/Order/Address/Form/Renderer/Vat.php @@ -36,12 +36,12 @@ namespace Magento\Customer\Block\Adminhtml\Sales\Order\Address\Form\Renderer; use Magento\View\Element\Template; class Vat - extends \Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset\Element + extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element { /** * Validate button block * - * @var null|\Magento\Adminhtml\Block\Widget\Button + * @var null|\Magento\Backend\Block\Widget\Button */ protected $_validateButton = null; @@ -69,7 +69,7 @@ class Vat /** * Retrieve validate button block * - * @return \Magento\Adminhtml\Block\Widget\Button + * @return \Magento\Backend\Block\Widget\Button */ public function getValidateButton() { @@ -107,7 +107,7 @@ class Vat $beforeHtml = '<script type="text/javascript">var ' . $optionsVarName . ' = ' . $vatValidateOptions . ';</script>'; $this->_validateButton = $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Widget\Button')->setData(array( + ->createBlock('Magento\Backend\Block\Widget\Button')->setData(array( 'label' => __('Validate VAT Number'), 'before_html' => $beforeHtml, 'onclick' => 'order.validateVat(' . $optionsVarName . ')' diff --git a/app/code/Magento/Customer/Block/Form/Login.php b/app/code/Magento/Customer/Block/Form/Login.php index 3801a2dfda1..785ae00f6df 100644 --- a/app/code/Magento/Customer/Block/Form/Login.php +++ b/app/code/Magento/Customer/Block/Form/Login.php @@ -42,16 +42,24 @@ class Login extends \Magento\View\Element\Template */ protected $_customerSession; + /** + * @var \Magento\Customer\Helper\Data + */ + protected $_customerHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Customer\Helper\Data $customerHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, + \Magento\Customer\Helper\Data $customerHelper, array $data = array() ) { + $this->_customerHelper = $customerHelper; $this->_customerSession = $customerSession; parent::__construct($context, $data); } @@ -69,7 +77,7 @@ class Login extends \Magento\View\Element\Template */ public function getPostActionUrl() { - return $this->helper('Magento\Customer\Helper\Data')->getLoginPostUrl(); + return $this->_customerHelper->getLoginPostUrl(); } /** @@ -81,7 +89,7 @@ class Login extends \Magento\View\Element\Template { $url = $this->getData('create_account_url'); if (is_null($url)) { - $url = $this->helper('Magento\Customer\Helper\Data')->getRegisterUrl(); + $url = $this->_customerHelper->getRegisterUrl(); } return $url; } @@ -93,7 +101,7 @@ class Login extends \Magento\View\Element\Template */ public function getForgotPasswordUrl() { - return $this->helper('Magento\Customer\Helper\Data')->getForgotPasswordUrl(); + return $this->_customerHelper->getForgotPasswordUrl(); } /** diff --git a/app/code/Magento/Customer/Block/Form/Register.php b/app/code/Magento/Customer/Block/Form/Register.php index 2be14928a0b..dc743633a7c 100644 --- a/app/code/Magento/Customer/Block/Form/Register.php +++ b/app/code/Magento/Customer/Block/Form/Register.php @@ -48,17 +48,25 @@ class Register extends \Magento\Directory\Block\Data */ protected $_moduleManager; + /** + * @var \Magento\Customer\Helper\Data + */ + protected $_customerHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Json\EncoderInterface $jsonEncoder - * @param \Magento\Module\Manager $moduleManager * @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\Module\Manager $moduleManager * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Model\AddressFactory $addressFactory + * @param \Magento\Customer\Helper\Data $customerHelper * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -70,13 +78,21 @@ class Register extends \Magento\Directory\Block\Data \Magento\Module\Manager $moduleManager, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\AddressFactory $addressFactory, + \Magento\Customer\Helper\Data $customerHelper, array $data = array() ) { + $this->_customerHelper = $customerHelper; $this->_moduleManager = $moduleManager; $this->_customerSession = $customerSession; $this->_addressFactory = $addressFactory; parent::__construct( - $context, $coreData, $jsonEncoder, $configCacheType, $regionCollFactory, $countryCollFactory, $data + $context, + $coreData, + $jsonEncoder, + $configCacheType, + $regionCollFactory, + $countryCollFactory, + $data ); } @@ -104,7 +120,7 @@ class Register extends \Magento\Directory\Block\Data */ public function getPostActionUrl() { - return $this->helper('Magento\Customer\Helper\Data')->getRegisterPostUrl(); + return $this->_customerHelper->getRegisterPostUrl(); } /** @@ -116,7 +132,7 @@ class Register extends \Magento\Directory\Block\Data { $url = $this->getData('back_url'); if (is_null($url)) { - $url = $this->helper('Magento\Customer\Helper\Data')->getLoginUrl(); + $url = $this->_customerHelper->getLoginUrl(); } return $url; } diff --git a/app/code/Magento/Customer/Block/Widget/AbstractWidget.php b/app/code/Magento/Customer/Block/Widget/AbstractWidget.php index cbd4e442848..18fdddac016 100644 --- a/app/code/Magento/Customer/Block/Widget/AbstractWidget.php +++ b/app/code/Magento/Customer/Block/Widget/AbstractWidget.php @@ -33,23 +33,31 @@ class AbstractWidget extends \Magento\View\Element\Template */ protected $_eavConfig; + /** + * @var \Magento\Customer\Helper\Address + */ + protected $_addressHelper; + /** * @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() ) { + $this->_addressHelper = $addressHelper; $this->_eavConfig = $eavConfig; parent::__construct($context, $data); } public function getConfig($key) { - return $this->helper('Magento\Customer\Helper\Address')->getConfig($key); + return $this->_addressHelper->getConfig($key); } public function getFieldIdFormat() diff --git a/app/code/Magento/Customer/Block/Widget/Gender.php b/app/code/Magento/Customer/Block/Widget/Gender.php index f3a5dcad08a..70ada1d395c 100644 --- a/app/code/Magento/Customer/Block/Widget/Gender.php +++ b/app/code/Magento/Customer/Block/Widget/Gender.php @@ -48,6 +48,7 @@ class Gender extends \Magento\Customer\Block\Widget\AbstractWidget /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Eav\Model\Config $eavConfig + * @param \Magento\Customer\Helper\Address $addressHelper * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Model\Resource\Customer $customerResource * @param array $data @@ -55,13 +56,14 @@ class Gender extends \Magento\Customer\Block\Widget\AbstractWidget public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Eav\Model\Config $eavConfig, + \Magento\Customer\Helper\Address $addressHelper, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\Resource\Customer $customerResource, array $data = array() ) { $this->_customerSession = $customerSession; $this->_customerResource = $customerResource; - parent::__construct($context, $eavConfig, $data); + parent::__construct($context, $eavConfig, $addressHelper, $data); } /** diff --git a/app/code/Magento/Customer/Block/Widget/Name.php b/app/code/Magento/Customer/Block/Widget/Name.php index bf42dc590b9..38b7e8a2207 100644 --- a/app/code/Magento/Customer/Block/Widget/Name.php +++ b/app/code/Magento/Customer/Block/Widget/Name.php @@ -28,6 +28,29 @@ namespace Magento\Customer\Block\Widget; class Name extends \Magento\Customer\Block\Widget\AbstractWidget { + /** + * @var \Magento\Customer\Helper\Data + */ + protected $_customerHelper; + + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Eav\Model\Config $eavConfig + * @param \Magento\Customer\Helper\Address $addressHelper + * @param \Magento\Customer\Helper\Data $customerHelper + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Eav\Model\Config $eavConfig, + \Magento\Customer\Helper\Address $addressHelper, + \Magento\Customer\Helper\Data $customerHelper, + array $data = array() + ) { + $this->_customerHelper = $customerHelper; + parent::__construct($context, $eavConfig, $addressHelper, $data); + } + public function _construct() { parent::_construct(); @@ -74,7 +97,7 @@ class Name extends \Magento\Customer\Block\Widget\AbstractWidget */ public function getPrefixOptions() { - $prefixOptions = $this->helper('Magento\Customer\Helper\Data')->getNamePrefixOptions(); + $prefixOptions = $this->_customerHelper->getNamePrefixOptions(); if ($this->getObject() && !empty($prefixOptions)) { $oldPrefix = $this->escapeHtml(trim($this->getObject()->getPrefix())); @@ -130,7 +153,7 @@ class Name extends \Magento\Customer\Block\Widget\AbstractWidget */ public function getSuffixOptions() { - $suffixOptions = $this->helper('Magento\Customer\Helper\Data')->getNameSuffixOptions(); + $suffixOptions = $this->_customerHelper->getNameSuffixOptions(); if ($this->getObject() && !empty($suffixOptions)) { $oldSuffix = $this->escapeHtml(trim($this->getObject()->getSuffix())); $suffixOptions[$oldSuffix] = $oldSuffix; diff --git a/app/code/Magento/Customer/Block/Widget/Taxvat.php b/app/code/Magento/Customer/Block/Widget/Taxvat.php index 53e9ef3291f..e5bd7040fb3 100644 --- a/app/code/Magento/Customer/Block/Widget/Taxvat.php +++ b/app/code/Magento/Customer/Block/Widget/Taxvat.php @@ -36,17 +36,19 @@ class Taxvat extends \Magento\Customer\Block\Widget\AbstractWidget /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Eav\Model\Config $eavConfig + * @param \Magento\Customer\Helper\Address $addressHelper * @param \Magento\Customer\Model\Session $customerSession * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Eav\Model\Config $eavConfig, + \Magento\Customer\Helper\Address $addressHelper, \Magento\Customer\Model\Session $customerSession, array $data = array() ) { $this->_customerSession = $customerSession; - parent::__construct($context, $eavConfig, $data); + parent::__construct($context, $eavConfig, $addressHelper, $data); } public function _construct() diff --git a/app/code/Magento/Customer/Controller/Account.php b/app/code/Magento/Customer/Controller/Account.php index e99725ec32c..56088595c44 100644 --- a/app/code/Magento/Customer/Controller/Account.php +++ b/app/code/Magento/Customer/Controller/Account.php @@ -96,6 +96,11 @@ class Account extends \Magento\App\Action\Action */ protected $_formKeyValidator; + /** + * @var \Magento\Escaper + */ + protected $escaper; + /** * @param \Magento\App\Action\Context $context * @param \Magento\Core\Model\Registry $coreRegistry @@ -107,6 +112,7 @@ class Account extends \Magento\App\Action\Action * @param \Magento\Stdlib\String $string * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Escaper $escaper */ public function __construct( \Magento\App\Action\Context $context, @@ -118,7 +124,8 @@ class Account extends \Magento\App\Action\Action \Magento\Customer\Model\AddressFactory $addressFactory, \Magento\Stdlib\String $string, \Magento\Core\App\Action\FormKeyValidator $formKeyValidator, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Escaper $escaper ) { $this->_storeManager = $storeManager; $this->_coreRegistry = $coreRegistry; @@ -129,6 +136,7 @@ class Account extends \Magento\App\Action\Action $this->_addressFactory = $addressFactory; $this->string = $string; $this->_formKeyValidator = $formKeyValidator; + $this->escaper = $escaper; parent::__construct($context); } @@ -156,7 +164,7 @@ class Account extends \Magento\App\Action\Action * Dispatch request * * @param RequestInterface $request - * @return mixed|void + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { @@ -189,8 +197,7 @@ class Account extends \Magento\App\Action\Action public function indexAction() { $this->_view->loadLayout(); - $messageStores = array('Magento\Customer\Model\Session', 'Magento\Catalog\Model\Session'); - $this->_view->getLayout()->initMessages($messageStores); + $this->_view->getLayout()->initMessages(); $this->_view->getLayout()->getBlock('head')->setTitle(__('My Account')); $this->_view->renderLayout(); } @@ -206,8 +213,7 @@ class Account extends \Magento\App\Action\Action } $this->getResponse()->setHeader('Login-Required', 'true'); $this->_view->loadLayout(); - $messageStores = array('Magento\Customer\Model\Session', 'Magento\Catalog\Model\Session'); - $this->_view->getLayout()->initMessages($messageStores); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -220,15 +226,14 @@ class Account extends \Magento\App\Action\Action $this->_redirect('*/*/'); return; } - $session = $this->_getSession(); if ($this->getRequest()->isPost()) { $login = $this->getRequest()->getPost('login'); if (!empty($login['username']) && !empty($login['password'])) { try { - $session->login($login['username'], $login['password']); - if ($session->getCustomer()->getIsJustConfirmed()) { - $this->_welcomeCustomer($session->getCustomer(), true); + $this->_getSession()->login($login['username'], $login['password']); + if ($this->_getSession()->getCustomer()->getIsJustConfirmed()) { + $this->_welcomeCustomer($this->_getSession()->getCustomer(), true); } } catch (\Magento\Core\Exception $e) { switch ($e->getCode()) { @@ -245,13 +250,13 @@ class Account extends \Magento\App\Action\Action $message = $e->getMessage(); break; } - $session->addError($message); - $session->setUsername($login['username']); + $this->messageManager->addError($message); + $this->_getSession()->setUsername($login['username']); } catch (\Exception $e) { // $this->_objectManager->get('Magento\Logger')->logException($e); // PA DSS violation: this exception log can disclose customer password } } else { - $session->addError(__('Login and password are required.')); + $this->messageManager->addError(__('Login and password are required.')); } } @@ -263,19 +268,18 @@ class Account extends \Magento\App\Action\Action */ protected function _loginPostRedirect() { - $session = $this->_getSession(); - $lastCustomerId = $session->getLastCustomerId(); - if (isset($lastCustomerId) && $session->isLoggedIn() && $lastCustomerId != $session->getId()) { - $session->unsBeforeAuthUrl() - ->setLastCustomerId($session->getId()); + $lastCustomerId = $this->_getSession()->getLastCustomerId(); + if (isset($lastCustomerId) && $this->_getSession()->isLoggedIn() && $lastCustomerId != $this->_getSession()->getId()) { + $this->_getSession()->unsBeforeAuthUrl() + ->setLastCustomerId($this->_getSession()->getId()); } - if (!$session->getBeforeAuthUrl() - || $session->getBeforeAuthUrl() == $this->_storeManager->getStore()->getBaseUrl() + if (!$this->_getSession()->getBeforeAuthUrl() + || $this->_getSession()->getBeforeAuthUrl() == $this->_storeManager->getStore()->getBaseUrl() ) { // Set default URL to redirect customer to - $session->setBeforeAuthUrl($this->_objectManager->get('Magento\Customer\Helper\Data')->getAccountUrl()); + $this->_getSession()->setBeforeAuthUrl($this->_objectManager->get('Magento\Customer\Helper\Data')->getAccountUrl()); // Redirect customer to the last page visited after logging in - if ($session->isLoggedIn()) { + if ($this->_getSession()->isLoggedIn()) { if (!$this->_objectManager->get('Magento\Core\Model\Store\Config')->getConfigFlag( \Magento\Customer\Helper\Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD )) { @@ -283,26 +287,26 @@ class Account extends \Magento\App\Action\Action if ($referer) { $referer = $this->_objectManager->get('Magento\Core\Helper\Data')->urlDecode($referer); if ($this->_url->isInternal($referer)) { - $session->setBeforeAuthUrl($referer); + $this->_getSession()->setBeforeAuthUrl($referer); } } - } elseif ($session->getAfterAuthUrl()) { - $session->setBeforeAuthUrl($session->getAfterAuthUrl(true)); + } elseif ($this->_getSession()->getAfterAuthUrl()) { + $this->_getSession()->setBeforeAuthUrl($this->_getSession()->getAfterAuthUrl(true)); } } else { - $session->setBeforeAuthUrl($this->_objectManager->get('Magento\Customer\Helper\Data')->getLoginUrl()); + $this->_getSession()->setBeforeAuthUrl($this->_objectManager->get('Magento\Customer\Helper\Data')->getLoginUrl()); } - } elseif ($session->getBeforeAuthUrl() == $this->_objectManager->get('Magento\Customer\Helper\Data')->getLogoutUrl()) { - $session->setBeforeAuthUrl($this->_objectManager->get('Magento\Customer\Helper\Data')->getDashboardUrl()); + } elseif ($this->_getSession()->getBeforeAuthUrl() == $this->_objectManager->get('Magento\Customer\Helper\Data')->getLogoutUrl()) { + $this->_getSession()->setBeforeAuthUrl($this->_objectManager->get('Magento\Customer\Helper\Data')->getDashboardUrl()); } else { - if (!$session->getAfterAuthUrl()) { - $session->setAfterAuthUrl($session->getBeforeAuthUrl()); + if (!$this->_getSession()->getAfterAuthUrl()) { + $this->_getSession()->setAfterAuthUrl($this->_getSession()->getBeforeAuthUrl()); } - if ($session->isLoggedIn()) { - $session->setBeforeAuthUrl($session->getAfterAuthUrl(true)); + if ($this->_getSession()->isLoggedIn()) { + $this->_getSession()->setBeforeAuthUrl($this->_getSession()->getAfterAuthUrl(true)); } } - $this->getResponse()->setRedirect($session->getBeforeAuthUrl(true)); + $this->getResponse()->setRedirect($this->_getSession()->getBeforeAuthUrl(true)); } /** @@ -312,7 +316,6 @@ class Account extends \Magento\App\Action\Action { $lastCustomerId = $this->_getSession()->getId(); $this->_getSession()->logout() - ->regenerateId() ->setBeforeAuthUrl($this->_redirect->getRefererUrl()) ->setLastCustomerId($lastCustomerId); @@ -339,7 +342,7 @@ class Account extends \Magento\App\Action\Action } $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -348,12 +351,10 @@ class Account extends \Magento\App\Action\Action */ public function createPostAction() { - $session = $this->_getSession(); - if ($session->isLoggedIn()) { + if ($this->_getSession()->isLoggedIn()) { $this->_redirect('*/*/'); return; } - $session->setEscapeMessages(true); // prevent XSS injection in user input if (!$this->getRequest()->isPost()) { $url = $this->_createUrl()->getUrl('*/*/create', array('_secure' => true)); @@ -378,17 +379,17 @@ class Account extends \Magento\App\Action\Action if ($customer->isConfirmationRequired()) { $customer->sendNewAccountEmail( 'confirmation', - $session->getBeforeAuthUrl(), + $this->_getSession()->getBeforeAuthUrl(), $this->_storeManager->getStore()->getId() ); $email = $this->_objectManager->get('Magento\Customer\Helper\Data')->getEmailConfirmationUrl($customer->getEmail()); - $session->addSuccess( + $this->messageManager->addSuccess( __('Account confirmation is required. Please, check your email for the confirmation link. To resend the confirmation email please <a href="%1">click here</a>.', $email) ); $url = $this->_createUrl()->getUrl('*/*/index', array('_secure' => true)); $this->getResponse()->setRedirect($this->_redirect->success($url)); } else { - $session->setCustomerAsLoggedIn($customer); + $this->_getSession()->setCustomerAsLoggedIn($customer); $url = $this->_welcomeCustomer($customer); $this->getResponse()->setRedirect($this->_redirect->success($url)); } @@ -397,22 +398,21 @@ class Account extends \Magento\App\Action\Action if ($e->getCode() === \Magento\Customer\Model\Customer::EXCEPTION_EMAIL_EXISTS) { $url = $this->_createUrl()->getUrl('customer/account/forgotpassword'); $message = __('There is already an account with this email address. If you are sure that it is your email address, <a href="%1">click here</a> to get your password and access your account.', $url); - $session->setEscapeMessages(false); } else { $message = $e->getMessage(); } - $session->addError($message); + $this->messageManager->addError($message); } catch (\Magento\Validator\ValidatorException $e) { foreach ($e->getMessages() as $messages) { foreach ($messages as $message) { - $session->addError($message); + $this->messageManager->addError($this->escaper->escapeHtml($message)); } } } catch (\Exception $e) { - $session->addException($e, __('Cannot save the customer.')); + $this->messageManager->addException($e, __('Cannot save the customer.')); } - $session->setCustomerFormData($this->getRequest()->getPost()); + $this->_getSession()->setCustomerFormData($this->getRequest()->getPost()); $defaultUrl = $this->_createUrl()->getUrl('*/*/create', array('_secure' => true)); $this->getResponse()->setRedirect($this->_redirect->error($defaultUrl)); } @@ -510,7 +510,7 @@ class Account extends \Magento\App\Action\Action */ protected function _welcomeCustomer(\Magento\Customer\Model\Customer $customer, $isJustConfirmed = false) { - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('Thank you for registering with %1.', $this->_storeManager->getStore()->getFrontendName()) ); if ($this->_isVatValidationEnabled()) { @@ -525,7 +525,7 @@ class Account extends \Magento\App\Action\Action $userPrompt = __('If you are a registered VAT customer, please click <a href="%1">here</a> to enter you billing address for proper VAT calculation', $editAddersUrl); break; } - $this->_getSession()->addSuccess($userPrompt); + $this->messageManager->addSuccess($userPrompt); } $customer->sendNewAccountEmail( @@ -631,7 +631,7 @@ class Account extends \Magento\App\Action\Action return; } catch (\Exception $e) { // die unhappy - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $url = $this->_createUrl()->getUrl('*/*/index', array('_secure' => true)); $this->getResponse()->setRedirect($this->_redirect->error($url)); return; @@ -651,15 +651,15 @@ class Account extends \Magento\App\Action\Action } if ($customer->getConfirmation()) { $customer->sendNewAccountEmail('confirmation', '', $this->_storeManager->getStore()->getId()); - $this->_getSession()->addSuccess(__('Please, check your email for confirmation key.')); + $this->messageManager->addSuccess(__('Please, check your email for confirmation key.')); } else { - $this->_getSession()->addSuccess(__('This email does not require confirmation.')); + $this->messageManager->addSuccess(__('This email does not require confirmation.')); } $this->_getSession()->setUsername($email); $url = $this->_createUrl()->getUrl('*/*/index', array('_secure' => true)); $this->getResponse()->setRedirect($this->_redirect->success($url)); } catch (\Exception $e) { - $this->_getSession()->addException($e, __('Wrong email.')); + $this->messageManager->addException($e, __('Wrong email.')); $url = $this->_createUrl()->getUrl('*/*/*', array('email' => $email, '_secure' => true)); $this->getResponse()->setRedirect($this->_redirect->error($url)); } @@ -689,7 +689,7 @@ class Account extends \Magento\App\Action\Action $this->_view->getLayout()->getBlock('accountConfirmation') ->setEmail($this->getRequest()->getParam('email', $email)); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -705,7 +705,7 @@ class Account extends \Magento\App\Action\Action ); $this->_getSession()->unsForgottenEmail(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -718,7 +718,7 @@ class Account extends \Magento\App\Action\Action if ($email) { if (!\Zend_Validate::is($email, 'EmailAddress')) { $this->_getSession()->setForgottenEmail($email); - $this->_getSession()->addError(__('Please correct the email address.')); + $this->messageManager->addError(__('Please correct the email address.')); $this->_redirect('*/*/forgotpassword'); return; } @@ -735,19 +735,19 @@ class Account extends \Magento\App\Action\Action $customer->changeResetPasswordLinkToken($newPasswordToken); $customer->sendPasswordResetConfirmationEmail(); } catch (\Exception $exception) { - $this->_getSession()->addError($exception->getMessage()); + $this->messageManager->addError($exception->getMessage()); $this->_redirect('*/*/forgotpassword'); return; } } $email = $this->_objectManager->get('Magento\Escaper')->escapeHtml($email); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('If there is an account associated with %1 you will receive an email with a link to reset your password.', $email) ); $this->_redirect('*/*/'); return; } else { - $this->_getSession()->addError(__('Please enter your email.')); + $this->messageManager->addError(__('Please enter your email.')); $this->_redirect('*/*/forgotpassword'); return; } @@ -780,7 +780,7 @@ class Account extends \Magento\App\Action\Action ->setResetPasswordLinkToken($resetPasswordToken); $this->_view->renderLayout(); } catch (\Exception $exception) { - $this->_getSession()->addError( + $this->messageManager->addError( __('Your password reset link has expired.') ); $this->_redirect('*/*/forgotpassword'); @@ -803,7 +803,7 @@ class Account extends \Magento\App\Action\Action try { $this->_validateResetPasswordLinkToken($customerId, $resetPasswordToken); } catch (\Exception $exception) { - $this->_getSession()->addError( + $this->messageManager->addError( __('Your password reset link has expired.') ); $this->_redirect('*/*/'); @@ -827,7 +827,7 @@ class Account extends \Magento\App\Action\Action if (!empty($errorMessages)) { $this->_getSession()->setCustomerFormData($this->getRequest()->getPost()); foreach ($errorMessages as $errorMessage) { - $this->_getSession()->addError($errorMessage); + $this->messageManager->addError($errorMessage); } $this->_redirect('*/*/createpassword', array( 'id' => $customerId, @@ -842,12 +842,12 @@ class Account extends \Magento\App\Action\Action $customer->setRpTokenCreatedAt(null); $customer->setConfirmation(null); $customer->save(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('Your password has been updated.') ); $this->_redirect('*/*/login'); } catch (\Exception $exception) { - $this->_getSession()->addException($exception, __('Cannot save a new password.')); + $this->messageManager->addException($exception, __('Cannot save a new password.')); $this->_redirect('*/*/createpassword', array( 'id' => $customerId, 'token' => $resetPasswordToken @@ -892,8 +892,7 @@ class Account extends \Magento\App\Action\Action public function editAction() { $this->_view->loadLayout(); - $messageStores = array('Magento\Customer\Model\Session', 'Magento\Catalog\Model\Session'); - $this->_view->getLayout()->initMessages($messageStores); + $this->_view->getLayout()->initMessages(); $block = $this->_view->getLayout()->getBlock('customer_edit'); if ($block) { @@ -975,7 +974,7 @@ class Account extends \Magento\App\Action\Action if (!empty($errors)) { $this->_getSession()->setCustomerFormData($this->getRequest()->getPost()); foreach ($errors as $message) { - $this->_getSession()->addError($message); + $this->messageManager->addError($message); } $this->_redirect('*/*/edit'); return; @@ -987,17 +986,17 @@ class Account extends \Magento\App\Action\Action $customer->sendPasswordResetNotificationEmail('reset_frontend'); - $this->_getSession()->setCustomer($customer) - ->addSuccess(__('The account information has been saved.')); + $this->_getSession()->setCustomer($customer); + $this->messageManager->addSuccess(__('The account information has been saved.')); $this->_redirect('customer/account'); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->setCustomerFormData($this->getRequest()->getPost()) - ->addError($e->getMessage()); + $this->_getSession()->setCustomerFormData($this->getRequest()->getPost()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->setCustomerFormData($this->getRequest()->getPost()) - ->addException($e, __('Cannot save the customer.')); + $this->_getSession()->setCustomerFormData($this->getRequest()->getPost()); + $this->messageManager->addException($e, __('Cannot save the customer.')); } } diff --git a/app/code/Magento/Customer/Controller/Address.php b/app/code/Magento/Customer/Controller/Address.php index 042c7f0fc15..57f3c4bc113 100644 --- a/app/code/Magento/Customer/Controller/Address.php +++ b/app/code/Magento/Customer/Controller/Address.php @@ -100,8 +100,10 @@ class Address extends \Magento\App\Action\Action } /** + * Check customer authentication + * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { @@ -118,8 +120,7 @@ class Address extends \Magento\App\Action\Action { if (count($this->_getSession()->getCustomer()->getAddresses())) { $this->_view->loadLayout(); - $this->_view->getLayout() - ->initMessages(array('Magento\Customer\Model\Session', 'Magento\Catalog\Model\Session')); + $this->_view->getLayout()->initMessages(); $block = $this->_view->getLayout()->getBlock('address_book'); if ($block) { @@ -147,7 +148,7 @@ class Address extends \Magento\App\Action\Action public function formAction() { $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); $navigationBlock = $this->_view->getLayout()->getBlock('customer_account_navigation'); if ($navigationBlock) { $navigationBlock->setActive('customer/address'); @@ -183,24 +184,24 @@ class Address extends \Magento\App\Action\Action $address->getVatValidationResult() ); $validationMessage->getIsError() - ? $this->_getSession()->addError($validationMessage->getMessage()) - : $this->_getSession()->addSuccess($validationMessage->getMessage()); + ? $this->messageManager->addError($validationMessage->getMessage()) + : $this->messageManager->addSuccess($validationMessage->getMessage()); } - $this->_getSession()->addSuccess(__('The address has been saved.')); + $this->messageManager->addSuccess(__('The address has been saved.')); $url = $this->_buildUrl('*/*/index', array('_secure'=>true)); $this->getResponse()->setRedirect($this->_redirect->success($url)); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addException($e, $e->getMessage()); + $this->messageManager->addException($e, $e->getMessage()); } catch (\Magento\Validator\ValidatorException $e) { foreach ($e->getMessages() as $messages) { foreach ($messages as $message) { - $this->_getSession()->addError($message); + $this->messageManager->addError($message); } } } catch (\Exception $e) { - $this->_getSession()->addException($e, __('Cannot save address.')); + $this->messageManager->addException($e, __('Cannot save address.')); } $this->_getSession()->setAddressFormData($this->getRequest()->getPost()); @@ -261,16 +262,16 @@ class Address extends \Magento\App\Action\Action // Validate address_id <=> customer_id if ($address->getCustomerId() != $this->_getSession()->getCustomerId()) { - $this->_getSession()->addError(__('The address does not belong to this customer.')); + $this->messageManager->addError(__('The address does not belong to this customer.')); $this->getResponse()->setRedirect($this->_buildUrl('*/*/index')); return; } try { $address->delete(); - $this->_getSession()->addSuccess(__('The address has been deleted.')); + $this->messageManager->addSuccess(__('The address has been deleted.')); } catch (\Exception $e){ - $this->_getSession()->addException($e, __('An error occurred while deleting the address.')); + $this->messageManager->addException($e, __('An error occurred while deleting the address.')); } } $this->getResponse()->setRedirect($this->_buildUrl('*/*/index')); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php index 0678f1862bf..893bdea5791 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php @@ -116,8 +116,6 @@ class Cart extends \Magento\Backend\App\Action $this->_objectManager->get('Magento\Catalog\Helper\Product\Composite') ->renderConfigureResult($configureResult); - - return $this; } /** @@ -143,10 +141,8 @@ class Cart extends \Magento\Backend\App\Action } $updateResult->setJsVarName($this->getRequest()->getParam('as_js_varname')); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setCompositeProductResult($updateResult); + $this->_objectManager->get('Magento\Backend\Model\Session')->setCompositeProductResult($updateResult); $this->_redirect('catalog/product/showUpdateResult'); - - return $this; } /** diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Group.php b/app/code/Magento/Customer/Controller/Adminhtml/Group.php index 0e3c0147d66..0500860c5ef 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Group.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Group.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Customer\Controller\Adminhtml; + /** * Customer groups controller - * - * @category Magento - * @package Magento_Customer - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Customer\Controller\Adminhtml; - class Group extends \Magento\Backend\App\Action { /** @@ -136,13 +132,13 @@ class Group extends \Magento\Backend\App\Action } $customerGroup->setTaxClassId($taxClass)->save(); - $this->_objectManager->get('Magento\Core\Model\Session\AbstractSession') - ->addSuccess(__('The customer group has been saved.')); + $this->messageManager->addSuccess(__('The customer group has been saved.')); $this->getResponse()->setRedirect($this->getUrl('customer/group')); return; } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Session\AbstractSession')->addError($e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Session\AbstractSession')->setCustomerGroupData($customerGroup->getData()); + $this->messageManager->addError($e->getMessage()); + $this->_objectManager->get('Magento\Session\SessionManagerInterface') + ->setCustomerGroupData($customerGroup->getData()); $this->getResponse()->setRedirect($this->getUrl('customer/group/edit', array('id' => $id))); return; } @@ -161,19 +157,17 @@ class Group extends \Magento\Backend\App\Action /** @var \Magento\Customer\Model\Group $customerGroup */ $customerGroup = $this->_objectManager->create('Magento\Customer\Model\Group')->load($id); if (!$customerGroup->getId()) { - $this->_objectManager->get('Magento\Core\Model\Session\AbstractSession') - ->addError(__('The customer group no longer exists.')); + $this->messageManager->addError(__('The customer group no longer exists.')); $this->_redirect('customer/*/'); return; } try { $customerGroup->delete(); - $this->_objectManager->get('Magento\Core\Model\Session\AbstractSession') - ->addSuccess(__('The customer group has been deleted.')); + $this->messageManager->addSuccess(__('The customer group has been deleted.')); $this->getResponse()->setRedirect($this->getUrl('customer/group')); return; } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Session\AbstractSession')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->getResponse()->setRedirect($this->getUrl('customer/group/edit', array('id' => $id))); return; } diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index.php b/app/code/Magento/Customer/Controller/Adminhtml/Index.php index 1eacfaea36f..910413b3370 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index.php @@ -138,7 +138,7 @@ class Index extends \Magento\Backend\App\Action $customer = $this->_coreRegistry->registry('current_customer'); // set entered data if was error when we do save - $data = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getCustomerData(true); + $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getCustomerData(true); // restore data from SESSION if ($data) { @@ -216,10 +216,10 @@ class Index extends \Magento\Backend\App\Action if ($customer->getId()) { try { $customer->delete(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('You deleted the customer.')); } catch (\Exception $exception){ - $this->_getSession()->addError($exception->getMessage()); + $this->messageManager->addError($exception->getMessage()); } } $this->_redirect('customer/index'); @@ -269,7 +269,7 @@ class Index extends \Magento\Backend\App\Action } $this->_objectManager->get('Magento\Core\Model\Registry')->register('current_customer', $customer); - $this->_getSession()->addSuccess(__('You saved the customer.')); + $this->messageManager->addSuccess(__('You saved the customer.')); $returnToEdit = (bool)$this->getRequest()->getParam('back', false); $customerId = $customer->getId(); @@ -278,7 +278,7 @@ class Index extends \Magento\Backend\App\Action $this->_getSession()->setCustomerData($originalRequestData); $returnToEdit = true; } catch (\Magento\Core\Exception $exception) { - $messages = $exception->getMessages(\Magento\Message\Factory::ERROR); + $messages = $exception->getMessages(\Magento\Message\MessageInterface::TYPE_ERROR); if (!count($messages)) { $messages = $exception->getMessage(); } @@ -286,7 +286,7 @@ class Index extends \Magento\Backend\App\Action $this->_getSession()->setCustomerData($originalRequestData); $returnToEdit = true; } catch (\Exception $exception) { - $this->_getSession()->addException($exception, + $this->messageManager->addException($exception, __('An error occurred while saving the customer.')); $this->_getSession()->setCustomerData($originalRequestData); $returnToEdit = true; @@ -331,16 +331,15 @@ class Index extends \Magento\Backend\App\Action ); $customer->setResetPasswordUrl($resetUrl); $customer->sendPasswordReminderEmail(); - $this->_getSession() - ->addSuccess(__('Customer will receive an email with a link to reset password.')); + $this->messageManager->addSuccess(__('Customer will receive an email with a link to reset password.')); } catch (\Magento\Core\Exception $exception) { - $messages = $exception->getMessages(\Magento\Message\Factory::ERROR); + $messages = $exception->getMessages(\Magento\Message\MessageInterface::TYPE_ERROR); if (!count($messages)) { $messages = $exception->getMessage(); } $this->_addSessionErrorMessages($messages); } catch (\Exception $exception) { - $this->_getSession()->addException($exception, + $this->messageManager->addException($exception, __('An error occurred while resetting customer password.')); } @@ -361,7 +360,7 @@ class Index extends \Magento\Backend\App\Action if (!($error instanceof \Magento\Message\Error)) { $error = new \Magento\Message\Error($error); } - $session->addMessage($error); + $this->messageManager->addMessage($error); }; array_walk_recursive($messages, $callback); } @@ -632,7 +631,7 @@ class Index extends \Magento\Backend\App\Action } if ($response->getError()) { - $this->_view->getLayout()->initMessages('Magento\Adminhtml\Model\Session'); + $this->_view->getLayout()->initMessages(); $response->setMessage($this->_view->getLayout()->getMessagesBlock()->getGroupedHtml()); } @@ -680,14 +679,14 @@ class Index extends \Magento\Backend\App\Action $errors = $customer->validate(); } catch (\Magento\Core\Exception $exception) { /* @var $error \Magento\Message\Error */ - foreach ($exception->getMessages(\Magento\Message\Factory::ERROR) as $error) { - $errors[] = $error->getCode(); + foreach ($exception->getMessages(\Magento\Message\MessageInterface::TYPE_ERROR) as $error) { + $errors[] = $error->getText(); } } if ($errors !== true && !empty($errors)) { foreach ($errors as $error) { - $this->_getSession()->addError($error); + $this->messageManager->addError($error); } $response->setError(1); } @@ -724,7 +723,7 @@ class Index extends \Magento\Backend\App\Action $errors = $addressForm->validateData($formData); if ($errors !== true) { foreach ($errors as $error) { - $this->_getSession()->addError($error); + $this->messageManager->addError($error); } $response->setError(1); } @@ -739,7 +738,7 @@ class Index extends \Magento\Backend\App\Action { $customersIds = $this->getRequest()->getParam('customer'); if (!is_array($customersIds)) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('Please select customer(s).')); + $this->messageManager->addError(__('Please select customer(s).')); } else { try { foreach ($customersIds as $customerId) { @@ -747,11 +746,9 @@ class Index extends \Magento\Backend\App\Action $customer->setIsSubscribed(true); $customer->save(); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('A total of %1 record(s) were updated.', count($customersIds)) - ); + $this->messageManager->addSuccess(__('A total of %1 record(s) were updated.', count($customersIds))); } catch (\Exception $exception) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($exception->getMessage()); + $this->messageManager->addError($exception->getMessage()); } } $this->_redirect('customer/*/index'); @@ -764,7 +761,7 @@ class Index extends \Magento\Backend\App\Action { $customersIds = $this->getRequest()->getParam('customer'); if (!is_array($customersIds)) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('Please select customer(s).')); + $this->messageManager->addError(__('Please select customer(s).')); } else { try { foreach ($customersIds as $customerId) { @@ -772,11 +769,9 @@ class Index extends \Magento\Backend\App\Action $customer->setIsSubscribed(false); $customer->save(); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('A total of %1 record(s) were updated.', count($customersIds)) - ); + $this->messageManager->addSuccess(__('A total of %1 record(s) were updated.', count($customersIds))); } catch (\Exception $exception) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($exception->getMessage()); + $this->messageManager->addError($exception->getMessage()); } } @@ -790,7 +785,7 @@ class Index extends \Magento\Backend\App\Action { $customersIds = $this->getRequest()->getParam('customer'); if (!is_array($customersIds)) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('Please select customer(s).')); + $this->messageManager->addError(__('Please select customer(s).')); } else { try { $customer = $this->_objectManager->create('Magento\Customer\Model\Customer'); @@ -799,11 +794,9 @@ class Index extends \Magento\Backend\App\Action ->load($customerId) ->delete(); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('A total of %1 record(s) were deleted.', count($customersIds)) - ); + $this->messageManager->addSuccess(__('A total of %1 record(s) were deleted.', count($customersIds))); } catch (\Exception $exception) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($exception->getMessage()); + $this->messageManager->addError($exception->getMessage()); } } @@ -817,7 +810,7 @@ class Index extends \Magento\Backend\App\Action { $customersIds = $this->getRequest()->getParam('customer'); if (!is_array($customersIds)) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('Please select customer(s).')); + $this->messageManager->addError(__('Please select customer(s).')); } else { try { foreach ($customersIds as $customerId) { @@ -825,11 +818,9 @@ class Index extends \Magento\Backend\App\Action $customer->setGroupId($this->getRequest()->getParam('group')); $customer->save(); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('A total of %1 record(s) were updated.', count($customersIds)) - ); + $this->messageManager->addSuccess(__('A total of %1 record(s) were updated.', count($customersIds))); } catch (\Exception $exception) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($exception->getMessage()); + $this->messageManager->addError($exception->getMessage()); } } @@ -858,21 +849,20 @@ class Index extends \Magento\Backend\App\Action throw new NotFoundException(); } - $path = $this->_objectManager->get('Magento\App\Dir')->getDir('media') . DS . 'customer'; - /** @var \Magento\Filesystem $filesystem */ $filesystem = $this->_objectManager->get('Magento\Filesystem'); - $filesystem->setWorkingDirectory($path); - $fileName = $path . $file; - if (!$filesystem->isFile($fileName) + $directory = $filesystem->getDirectoryRead(\Magento\Filesystem:: MEDIA); + $fileName = 'customer/' . $file; + $path = $directory->getAbsolutePath($fileName); + if (!$directory->isFile($fileName) && !$this->_objectManager->get('Magento\Core\Helper\File\Storage') - ->processStorageFile(str_replace('/', DS, $fileName)) + ->processStorageFile($path) ) { throw new NotFoundException(); } if ($plain) { - $extension = pathinfo($fileName, PATHINFO_EXTENSION); + $extension = pathinfo($path, PATHINFO_EXTENSION); switch (strtolower($extension)) { case 'gif': $contentType = 'image/gif'; @@ -887,9 +877,9 @@ class Index extends \Magento\Backend\App\Action $contentType = 'application/octet-stream'; break; } - - $contentLength = $filesystem->getFileSize($fileName); - $contentModify = $filesystem->getMTime($fileName); + $stat = $directory->stat($fileName); + $contentLength = $stat['size']; + $contentModify = $stat['mtime']; $this->getResponse() ->setHttpResponseCode(200) @@ -900,13 +890,13 @@ class Index extends \Magento\Backend\App\Action ->clearBody(); $this->getResponse()->sendHeaders(); - echo $filesystem->read($fileName); + echo $directory->readFile($fileName); } else { - $name = pathinfo($fileName, PATHINFO_BASENAME); + $name = pathinfo($path, PATHINFO_BASENAME); $this->_fileFactory->create($name, array( 'type' => 'filename', 'value' => $fileName - )); + ))->sendResponse(); } exit(); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist.php b/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist.php index 900d5604c5f..5b392a52f98 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist.php @@ -102,8 +102,6 @@ class Wishlist $this->_objectManager->get('Magento\Catalog\Helper\Product\Composite') ->renderConfigureResult($configureResult); - - return $this; } /** @@ -130,7 +128,7 @@ class Wishlist $updateResult->setMessage($e->getMessage()); } $updateResult->setJsVarName($this->getRequest()->getParam('as_js_varname')); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setCompositeProductResult($updateResult); + $this->_objectManager->get('Magento\Backend\Model\Session')->setCompositeProductResult($updateResult); $this->_redirect('catalog/product/showUpdateResult'); return false; diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php index 467ef6584f8..61845a9316e 100644 --- a/app/code/Magento/Customer/Model/Session.php +++ b/app/code/Magento/Customer/Model/Session.php @@ -24,12 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Customer\Model; + /** * Customer session model */ -namespace Magento\Customer\Model; - -class Session extends \Magento\Core\Model\Session\AbstractSession +class Session extends \Magento\Session\SessionManager { /** * Customer object @@ -85,9 +85,22 @@ class Session extends \Magento\Core\Model\Session\AbstractSession protected $_urlFactory; /** - * @param \Magento\Core\Model\Session\Context $context + * @var \Magento\Event\ManagerInterface + */ + protected $_eventManager; + + /** + * @var \Magento\Core\Model\Store\StorageInterface + */ + protected $_storeManager; + + /** + * @param \Magento\App\RequestInterface $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig + * @param \Magento\Session\SaveHandlerInterface $saveHandler + * @param \Magento\Session\ValidatorInterface $validator + * @param \Magento\Session\StorageInterface $storage * @param Config\Share $configShare * @param \Magento\Core\Helper\Url $coreUrl * @param \Magento\Customer\Helper\Data $customerData @@ -95,13 +108,18 @@ class Session extends \Magento\Core\Model\Session\AbstractSession * @param CustomerFactory $customerFactory * @param \Magento\Core\Model\UrlFactory $urlFactory * @param \Magento\Core\Model\Session $session + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param null $sessionName * @param array $data */ public function __construct( - \Magento\Core\Model\Session\Context $context, + \Magento\App\RequestInterface $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, + \Magento\Session\SaveHandlerInterface $saveHandler, + \Magento\Session\ValidatorInterface $validator, + \Magento\Session\StorageInterface $storage, \Magento\Customer\Model\Config\Share $configShare, \Magento\Core\Helper\Url $coreUrl, \Magento\Customer\Helper\Data $customerData, @@ -109,8 +127,10 @@ class Session extends \Magento\Core\Model\Session\AbstractSession \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Core\Model\UrlFactory $urlFactory, \Magento\Core\Model\Session $session, + \Magento\Event\ManagerInterface $eventManager, + \Magento\Core\Model\StoreManagerInterface $storeManager, $sessionName = null, - array $data = array() + array $data = array() ) { $this->_coreUrl = $coreUrl; $this->_customerData = $customerData; @@ -119,13 +139,10 @@ class Session extends \Magento\Core\Model\Session\AbstractSession $this->_customerFactory = $customerFactory; $this->_urlFactory = $urlFactory; $this->_session = $session; - parent::__construct($context, $sidResolver, $sessionConfig, $data); - $namespace = 'customer'; - if ($configShare->isWebsiteScope()) { - $namespace .= '_' . ($this->_storeManager->getWebsite()->getCode()); - } - - $this->start($namespace, $sessionName); + $this->_eventManager = $eventManager; + $this->_storeManager = $storeManager; + parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage); + $this->start($sessionName); $this->_eventManager->dispatch('customer_session_init', array('customer_session' => $this)); } @@ -191,7 +208,7 @@ class Session extends \Magento\Core\Model\Session\AbstractSession */ public function setCustomerId($id) { - $this->setData('customer_id', $id); + $this->storage->setData('customer_id', $id); return $this; } @@ -202,8 +219,8 @@ class Session extends \Magento\Core\Model\Session\AbstractSession */ public function getCustomerId() { - if ($this->getData('customer_id')) { - return $this->getData('customer_id'); + if ($this->storage->getData('customer_id')) { + return $this->storage->getData('customer_id'); } return ($this->isLoggedIn()) ? $this->getId() : null; } @@ -216,7 +233,7 @@ class Session extends \Magento\Core\Model\Session\AbstractSession */ public function setCustomerGroupId($id) { - $this->setData('customer_group_id', $id); + $this->storage->setData('customer_group_id', $id); return $this; } @@ -228,8 +245,8 @@ class Session extends \Magento\Core\Model\Session\AbstractSession */ public function getCustomerGroupId() { - if ($this->getData('customer_group_id')) { - return $this->getData('customer_group_id'); + if ($this->storage->getData('customer_group_id')) { + return $this->storage->getData('customer_group_id'); } if ($this->isLoggedIn() && $this->getCustomer()) { return $this->getCustomer()->getGroupId(); @@ -284,7 +301,7 @@ class Session extends \Magento\Core\Model\Session\AbstractSession public function setCustomerAsLoggedIn($customer) { $this->setCustomer($customer); - $this->_eventManager->dispatch('customer_login', array('customer'=>$customer)); + $this->_eventManager->dispatch('customer_login', array('customer' => $customer)); return $this; } @@ -299,6 +316,7 @@ class Session extends \Magento\Core\Model\Session\AbstractSession $customer = $this->_createCustomer()->load($customerId); if ($customer->getId()) { $this->setCustomerAsLoggedIn($customer); + $this->regenerateId(); return true; } return false; @@ -312,7 +330,7 @@ class Session extends \Magento\Core\Model\Session\AbstractSession public function logout() { if ($this->isLoggedIn()) { - $this->_eventManager->dispatch('customer_logout', array('customer' => $this->getCustomer()) ); + $this->_eventManager->dispatch('customer_logout', array('customer' => $this->getCustomer())); $this->_logout(); } return $this; @@ -337,7 +355,7 @@ class Session extends \Magento\Core\Model\Session\AbstractSession $arguments = $this->_customerData->getLoginUrlParams(); if ($this->_session->getCookieShouldBeReceived() && $this->_createUrl()->getUseSession()) { $arguments += array('_query' => array( - $this->_sidResolver->getSessionIdQueryParam($this->_session) => $this->_session->getSessionId() + $this->sidResolver->getSessionIdQueryParam($this->_session) => $this->_session->getSessionId() )); } $action->getResponse()->setRedirect( @@ -357,10 +375,10 @@ class Session extends \Magento\Core\Model\Session\AbstractSession */ protected function _setAuthUrl($key, $url) { - $url = $this->_coreUrl->removeRequestParam($url, $this->_sidResolver->getSessionIdQueryParam($this)); + $url = $this->_coreUrl->removeRequestParam($url, $this->sidResolver->getSessionIdQueryParam($this)); // Add correct session ID to URL if needed $url = $this->_createUrl()->getRebuiltUrl($url); - return $this->setData($key, $url); + return $this->storage->setData($key, $url); } /** diff --git a/app/code/Magento/Customer/Model/Session/Storage.php b/app/code/Magento/Customer/Model/Session/Storage.php new file mode 100644 index 00000000000..38da34dc924 --- /dev/null +++ b/app/code/Magento/Customer/Model/Session/Storage.php @@ -0,0 +1,51 @@ +<?php +/** + * Customer session storage + * + * 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_Customer + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Customer\Model\Session; + +class Storage extends \Magento\Session\Storage +{ + /** + * @param \Magento\Customer\Model\Config\Share $configShare + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param string $namespace + * @param array $data + */ + public function __construct( + \Magento\Customer\Model\Config\Share $configShare, + \Magento\Core\Model\StoreManagerInterface $storeManager, + $namespace = 'customer', + array $data = array() + ) { + if ($configShare->isWebsiteScope()) { + $namespace .= '_' . ($storeManager->getWebsite()->getCode()); + } + parent::__construct($namespace, $data); + } +} + diff --git a/app/code/Magento/Customer/etc/adminhtml/menu.xml b/app/code/Magento/Customer/etc/adminhtml/menu.xml index dcdecec3c07..50f581e69d5 100644 --- a/app/code/Magento/Customer/etc/adminhtml/menu.xml +++ b/app/code/Magento/Customer/etc/adminhtml/menu.xml @@ -29,7 +29,7 @@ <menu> <add id="Magento_Customer::customer" title="Customers" module="Magento_Customer" sortOrder="30" resource="Magento_Customer::customer"/> <add id="Magento_Customer::customer_manage" title="All Customers" module="Magento_Customer" sortOrder="10" parent="Magento_Customer::customer" action="customer/index/" resource="Magento_Customer::manage"/> - <add id="Magento_Customer::customer_group" title="Customer Groups" module="Magento_Customer" sortOrder="10" parent="Magento_Adminhtml::other_settings" action="customer/group" resource="Magento_Customer::group"/> + <add id="Magento_Customer::customer_group" title="Customer Groups" module="Magento_Customer" sortOrder="10" parent="Magento_Backend::other_settings" action="customer/group" resource="Magento_Customer::group"/> <add id="Magento_Customer::customer_online" title="Now Online" module="Magento_Customer" sortOrder="30" parent="Magento_Customer::customer" action="customer/online" resource="Magento_Customer::online"/> </menu> </config> diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index 5a3fef8c872..edae82bbe1a 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -34,6 +34,9 @@ <param name="customerResource"> <instance type="Magento\Customer\Model\Resource\Customer\Proxy" /> </param> + <param name="storage"> + <instance type="Magento\Customer\Model\Session\Storage" /> + </param> </type> <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> diff --git a/app/code/Magento/Customer/etc/email_templates.xml b/app/code/Magento/Customer/etc/email_templates.xml index 92488a6e531..e8a6c6afe62 100644 --- a/app/code/Magento/Customer/etc/email_templates.xml +++ b/app/code/Magento/Customer/etc/email_templates.xml @@ -24,10 +24,10 @@ */ --> <config> - <template id="customer_create_account_email_template" label="New Account" file="account_new.html" type="html"/> - <template id="customer_create_account_email_confirmation_template" label="New Account Confirmation Key" file="account_new_confirmation.html" type="html"/> - <template id="customer_create_account_email_confirmed_template" label="New Account Confirmed" file="account_new_confirmed.html" type="html"/> - <template id="customer_password_forgot_email_template" label="Forgot Password" file="password_reset_confirmation.html" type="html"/> - <template id="customer_password_remind_email_template" label="Remind Password" file="password_new.html" type="html"/> - <template id="customer_password_reset_password_template" label="Reset Password" file="password_reset.html" type="html"/> + <template id="customer_create_account_email_template" label="New Account" file="account_new.html" type="html" module="Magento_Customer"/> + <template id="customer_create_account_email_confirmation_template" label="New Account Confirmation Key" file="account_new_confirmation.html" type="html" module="Magento_Customer"/> + <template id="customer_create_account_email_confirmed_template" label="New Account Confirmed" file="account_new_confirmed.html" type="html" module="Magento_Customer"/> + <template id="customer_password_forgot_email_template" label="Forgot Password" file="password_reset_confirmation.html" type="html" module="Magento_Customer"/> + <template id="customer_password_remind_email_template" label="Remind Password" file="password_new.html" type="html" module="Magento_Customer"/> + <template id="customer_password_reset_password_template" label="Reset Password" file="password_reset.html" type="html" module="Magento_Customer"/> </config> diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons.php index 19363fc1272..390220b54c3 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons.php @@ -42,6 +42,25 @@ class Buttons */ protected $_themeId; + /** + * @var \Magento\Backend\Helper\Data + */ + protected $_backendHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Backend\Helper\Data $backendHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Backend\Helper\Data $backendHelper, + array $data = array() + ) { + $this->_backendHelper = $backendHelper; + parent::__construct($context, $data); + } + /** * Get current theme id * @@ -72,6 +91,6 @@ class Buttons */ public function getHomeLink() { - return $this->helper('Magento\Backend\Helper\Data')->getHomePageUrl(); + return $this->_backendHelper->getHomePageUrl(); } } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Css/Group.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Css/Group.php index 620d166b038..3d835e84e99 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Css/Group.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Css/Group.php @@ -31,6 +31,25 @@ namespace Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Code\Css; class Group extends \Magento\Backend\Block\Widget\Form { + /** + * @var \Magento\DesignEditor\Helper\Data + */ + protected $_designEditorHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\DesignEditor\Helper\Data $designEditorHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\DesignEditor\Helper\Data $designEditorHelper, + array $data = array() + ) { + $this->_designEditorHelper = $designEditorHelper; + parent::__construct($context, $data); + } + /** * Get url to download CSS file * @@ -42,7 +61,7 @@ class Group extends \Magento\Backend\Block\Widget\Form { return $this->getUrl('adminhtml/system_design_theme/downloadCss', array( 'theme_id' => $themeId, - 'file' => $this->_helperFactory->get('Magento\DesignEditor\Helper\Data')->urlEncode($fileId) + 'file' => $this->_designEditorHelper->urlEncode($fileId) )); } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php index 44a78d00eed..3e61a733651 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php @@ -43,12 +43,18 @@ class Js extends \Magento\Backend\Block\Widget\Form\Generic */ protected $_themeContext; + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Theme\Model\Config\Customization $customizationConfig * @param \Magento\DesignEditor\Model\Theme\Context $themeContext + * @param \Magento\Core\Helper\Data $coreHelper * @param array $data */ public function __construct( @@ -57,8 +63,10 @@ class Js extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Data\FormFactory $formFactory, \Magento\Theme\Model\Config\Customization $customizationConfig, \Magento\DesignEditor\Model\Theme\Context $themeContext, + \Magento\Core\Helper\Data $coreHelper, array $data = array() ) { + $this->_coreHelper = $coreHelper; parent::__construct($context, $registry, $formFactory, $data); $this->_customizationConfig = $customizationConfig; $this->_themeContext = $themeContext; @@ -154,7 +162,7 @@ class Js extends \Magento\Backend\Block\Widget\Form\Generic { $customization = $this->_themeContext->getStagingTheme()->getCustomization(); $jsFiles = $customization->getFilesByType(\Magento\View\Design\Theme\Customization\File\Js::TYPE); - return $this->helper('Magento\Core\Helper\Data')->jsonEncode($customization->generateFileInfo($jsFiles)); + return $this->_coreHelper->jsonEncode($customization->generateFileInfo($jsFiles)); } /** diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Content.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Content.php index 489a7b08da9..5df1230dd29 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Content.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Content.php @@ -41,7 +41,7 @@ class Content */ public function getHeaderText() { - return __('CSS Editor ') . __($this->helper('Magento\Theme\Helper\Storage')->getStorageTypeName()); + return __('CSS Editor ') . __($this->_storageHelper->getStorageTypeName()); } /** * Javascript setup object for filebrowser instance @@ -66,6 +66,6 @@ class Content 'showBreadcrumbs' => false )); - return $this->helper('Magento\Core\Helper\Data')->jsonEncode($setupObject); + return $this->_coreHelper->jsonEncode($setupObject); } } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Content/Files.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Content/Files.php index e28ea41d9ad..f87ea1725a1 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Content/Files.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Content/Files.php @@ -36,12 +36,31 @@ namespace Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Files\Content; class Files extends \Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content\Files { + /** + * @var \Magento\Theme\Helper\Storage + */ + protected $_storageHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Theme\Helper\Storage $storageHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Theme\Helper\Storage $storageHelper, + array $data = array() + ) { + $this->_storageHelper = $storageHelper; + parent::__construct($context, $data); + } + /** * @return string */ public function getStorageType() { - return __($this->helper('Magento\Theme\Helper\Storage')->getStorageType()); + return __($this->_storageHelper->getStorageType()); } } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Tree.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Tree.php index 8f25b63fb4d..fab92a023c0 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Tree.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/Tree.php @@ -39,6 +39,6 @@ class Tree */ public function getRootNodeName() { - return __('CSS Editor ') . __($this->helper('Magento\Theme\Helper\Storage')->getStorageTypeName()); + return __('CSS Editor ') . __($this->_storageHelper->getStorageTypeName()); } } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Theme.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Theme.php index 535cd5d7834..0ed4d5a48ac 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Theme.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Theme.php @@ -41,6 +41,25 @@ class Theme extends \Magento\Backend\Block\Template */ protected $_buttons = array(); + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Core\Helper\Data $coreHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Core\Helper\Data $coreHelper, + array $data = array() + ) { + $this->_coreHelper = $coreHelper; + parent::__construct($context, $data); + } + /** * Add button * @@ -108,7 +127,7 @@ class Theme extends \Magento\Backend\Block\Template ); /** @var $helper \Magento\Core\Helper\Data */ - $helper = $this->helper('Magento\Core\Helper\Data'); + $helper = $this->_coreHelper; return $helper->jsonEncode($options); } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/StoreView.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/StoreView.php index 7a6d7e65543..0380f1ae628 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/StoreView.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/StoreView.php @@ -47,18 +47,26 @@ class StoreView extends \Magento\Backend\Block\Template */ protected $_customizationConfig; + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Resource\Website\Collection $websiteCollection * @param \Magento\Theme\Model\Config\Customization $customizationConfig + * @param \Magento\Core\Helper\Data $coreHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Resource\Website\Collection $websiteCollection, \Magento\Theme\Model\Config\Customization $customizationConfig, + \Magento\Core\Helper\Data $coreHelper, array $data = array() ) { + $this->_coreHelper = $coreHelper; $this->_websiteCollection = $websiteCollection; $this->_customizationConfig = $customizationConfig; @@ -212,7 +220,7 @@ class StoreView extends \Magento\Backend\Block\Template $options['afterAssignOpen'] = false; /** @var $helper \Magento\Core\Helper\Data */ - $helper = $this->helper('Magento\Core\Helper\Data'); + $helper = $this->_coreHelper; return $helper->jsonEncode($options); } diff --git a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php index 6176e5fb196..6f20be2668c 100644 --- a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php +++ b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php @@ -138,12 +138,12 @@ class Editor extends \Magento\Backend\App\Action $this->_view->renderLayout(); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addException($e, $e->getMessage()); + $this->messageManager->addException($e, $e->getMessage()); $this->_objectManager->get('Magento\Logger')->logException($e); $this->_redirect('adminhtml/*/'); return; } catch (\Exception $e) { - $this->_getSession()->addException($e, __('Sorry, there was an unknown error.')); + $this->messageManager->addException($e, __('Sorry, there was an unknown error.')); $this->_objectManager->get('Magento\Logger')->logException($e); $this->_redirect('adminhtml/*/'); return; @@ -178,7 +178,7 @@ class Editor extends \Magento\Backend\App\Action ? __('You assigned a new theme to your store view.') : __('You assigned a theme to your live store.'); if ($reportToSession) { - $this->_getSession()->addSuccess($successMessage); + $this->messageManager->addSuccess($successMessage); } $response = array( 'message' => $successMessage, @@ -285,15 +285,15 @@ class Editor extends \Magento\Backend\App\Action $themeCopy->getThemeImage()->createPreviewImageCopy($theme->getPreviewImage()); $themeCopy->save(); $copyService->copy($theme, $themeCopy); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('You saved a duplicate copy of this theme in "My Customizations."') ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError(__('You cannot duplicate this theme.')); + $this->messageManager->addError(__('You cannot duplicate this theme.')); } $this->getResponse()->setRedirect($this->_redirect->getRefererUrl()); } @@ -500,7 +500,7 @@ class Editor extends \Magento\Backend\App\Action $storeViewBlock->setData('actionOnAssign', 'refresh'); $this->_view->renderLayout(); } catch (\Exception $e) { - $this->_getSession()->addError(__('We can\'t load the list of themes.')); + $this->messageManager->addError(__('We can\'t load the list of themes.')); $this->getResponse()->setRedirect($this->_redirect->getRefererUrl()); $this->_objectManager->get('Magento\Logger')->logException($e); } diff --git a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php index e31ac5cd87c..20a9650520b 100644 --- a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php +++ b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php @@ -255,7 +255,7 @@ class Tools extends \Magento\Backend\App\Action $response = array('error' => false, 'content' => $result); } catch (\Magento\Core\Exception $e) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $response = array('error' => true, 'message' => $e->getMessage()); $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { diff --git a/app/code/Magento/DesignEditor/Model/Config/Control/ImageSizing.php b/app/code/Magento/DesignEditor/Model/Config/Control/ImageSizing.php index af23b4e7d12..a1e6b7b9dae 100644 --- a/app/code/Magento/DesignEditor/Model/Config/Control/ImageSizing.php +++ b/app/code/Magento/DesignEditor/Model/Config/Control/ImageSizing.php @@ -44,11 +44,13 @@ class ImageSizing extends \Magento\DesignEditor\Model\Config\Control\AbstractCon protected $_moduleReader; /** + * @param $configFiles * @param \Magento\Module\Dir\Reader $moduleReader - * @param array $configFiles */ - public function __construct(\Magento\Module\Dir\Reader $moduleReader, array $configFiles) - { + public function __construct( + $configFiles, + \Magento\Module\Dir\Reader $moduleReader + ) { $this->_moduleReader = $moduleReader; parent::__construct($configFiles); } @@ -60,7 +62,6 @@ class ImageSizing extends \Magento\DesignEditor\Model\Config\Control\AbstractCon */ public function getSchemaFile() { - return $this->_moduleReader->getModuleDir('etc', 'Magento_DesignEditor') . DIRECTORY_SEPARATOR - . 'image_sizing.xsd'; + return $this->_moduleReader->getModuleDir('etc', 'Magento_DesignEditor') . '/image_sizing.xsd'; } } diff --git a/app/code/Magento/DesignEditor/Model/Config/Control/QuickStyles.php b/app/code/Magento/DesignEditor/Model/Config/Control/QuickStyles.php index d7a4c9d8e76..9e91a793d06 100644 --- a/app/code/Magento/DesignEditor/Model/Config/Control/QuickStyles.php +++ b/app/code/Magento/DesignEditor/Model/Config/Control/QuickStyles.php @@ -44,11 +44,13 @@ class QuickStyles extends \Magento\DesignEditor\Model\Config\Control\AbstractCon protected $_moduleReader; /** + * @param $configFiles * @param \Magento\Module\Dir\Reader $moduleReader - * @param array $configFiles */ - public function __construct(\Magento\Module\Dir\Reader $moduleReader, array $configFiles) - { + public function __construct( + $configFiles, + \Magento\Module\Dir\Reader $moduleReader + ) { $this->_moduleReader = $moduleReader; parent::__construct($configFiles); } @@ -60,8 +62,6 @@ class QuickStyles extends \Magento\DesignEditor\Model\Config\Control\AbstractCon */ public function getSchemaFile() { - return $this->_moduleReader->getModuleDir('etc', 'Magento_DesignEditor') - . \Magento\Filesystem::DIRECTORY_SEPARATOR - . 'quick_styles.xsd'; + return $this->_moduleReader->getModuleDir('etc', 'Magento_DesignEditor') . '/quick_styles.xsd'; } } 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 be61a865b4b..ba0444f47eb 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Configuration.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Configuration.php @@ -304,7 +304,8 @@ class Configuration protected function _saveViewConfiguration(\DOMDocument $config) { $targetPath = $this->_theme->getCustomization()->getCustomViewConfigPath(); - $this->_filesystem->setIsAllowCreateDirectories(true)->write($targetPath, $config->saveXML()); + $directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $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 1da6b44c4a1..ef41ea7a32b 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Factory.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Factory.php @@ -58,16 +58,32 @@ class Factory */ protected $_viewFileSystem; + /** + * @var \Magento\Config\FileIteratorFactory + */ + protected $fileIteratorFactory; + + /** + * @var \Magento\Filesystem + */ + protected $filesystem; + /** * @param \Magento\ObjectManager $objectManager * @param \Magento\View\FileSystem $viewFileSystem + * @param \Magento\Config\FileIteratorFactory $fileIteratorFactory + * @param \Magento\Filesystem $filesystem */ public function __construct( \Magento\ObjectManager $objectManager, - \Magento\View\FileSystem $viewFileSystem + \Magento\View\FileSystem $viewFileSystem, + \Magento\Config\FileIteratorFactory $fileIteratorFactory, + \Magento\Filesystem $filesystem ) { $this->_objectManager = $objectManager; $this->_viewFileSystem = $viewFileSystem; + $this->fileIteratorFactory = $fileIteratorFactory; + $this->filesystem = $filesystem; } /** @@ -117,8 +133,15 @@ class Factory throw new \Magento\Exception("Unknown control configuration type: \"{$type}\""); break; } + $rootDirectory = $this->filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $paths = array(); + foreach ($files as $file) { + $paths[] = $rootDirectory->getRelativePath($file); + } + $fileIterator = $this->fileIteratorFactory->create($rootDirectory, $paths); /** @var $config \Magento\DesignEditor\Model\Config\Control\AbstractControl */ - $config = $this->_objectManager->create($class, array('configFiles' => $files)); + $config = $this->_objectManager->create($class, array('configFiles' => $fileIterator)); + return $this->_objectManager->create( 'Magento\DesignEditor\Model\Editor\Tools\Controls\Configuration', array( 'configuration' => $config, 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 675ded3a017..7ebdc851869 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php @@ -86,10 +86,8 @@ class ImageUploader extends \Magento\Object public function getStoragePath() { if (null === $this->_storagePath) { - $this->_storagePath = implode(\Magento\Filesystem::DIRECTORY_SEPARATOR, array( - \Magento\Filesystem::fixSeparator($this->_getTheme()->getCustomization()->getCustomizationPath()), - self::PATH_PREFIX_QUICK_STYLE, - )); + $this->_storagePath = $this->_getTheme()->getCustomization()->getCustomizationPath() . '/' + . self::PATH_PREFIX_QUICK_STYLE; } return $this->_storagePath; } @@ -156,13 +154,10 @@ class ImageUploader extends \Magento\Object */ public function removeFile($file) { - $path = $this->getStoragePath(); - $filePath = $this->_filesystem->normalizePath($path . '/' . $file); - - if ($this->_filesystem->isPathInDirectory($filePath, $path) - && $this->_filesystem->isPathInDirectory($filePath, $this->getStoragePath()) - ) { - $this->_filesystem->delete($filePath); + $directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $path = $directory->getRelativePath($this->getStoragePath() . '/' . $file); + if ($directory->isExist($path)) { + $directory->delete($path); } return $this; diff --git a/app/code/Magento/Adminhtml/etc/adminhtml/routes.xml b/app/code/Magento/DesignEditor/etc/adminhtml/di.xml similarity index 80% rename from app/code/Magento/Adminhtml/etc/adminhtml/routes.xml rename to app/code/Magento/DesignEditor/etc/adminhtml/di.xml index 40e121a79a0..8da1f5452a3 100644 --- a/app/code/Magento/Adminhtml/etc/adminhtml/routes.xml +++ b/app/code/Magento/DesignEditor/etc/adminhtml/di.xml @@ -24,9 +24,9 @@ */ --> <config> - <router id="admin"> - <route id="adminhtml"> - <module name="Magento_Adminhtml" /> - </route> - </router> -</config> \ No newline at end of file + <type name="Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Files\Content\Files"> + <param name="storageHelper"> + <instance type="Magento\Theme\Helper\Storage\Proxy" /> + </param> + </type> +</config> diff --git a/app/code/Magento/DesignEditor/etc/adminhtml/menu.xml b/app/code/Magento/DesignEditor/etc/adminhtml/menu.xml index bc5ab11b07f..fea2f308cf2 100644 --- a/app/code/Magento/DesignEditor/etc/adminhtml/menu.xml +++ b/app/code/Magento/DesignEditor/etc/adminhtml/menu.xml @@ -27,6 +27,6 @@ --> <config> <menu> - <add id="Magento_DesignEditor::system_design_editor" title="Store Designer" module="Magento_DesignEditor" sortOrder="20" parent="Magento_Adminhtml::system_design" action="adminhtml/system_design_editor" resource="Magento_DesignEditor::editor"/> + <add id="Magento_DesignEditor::system_design_editor" title="Store Designer" module="Magento_DesignEditor" sortOrder="20" parent="Magento_Backend::system_design" action="adminhtml/system_design_editor" resource="Magento_DesignEditor::editor"/> </menu> </config> diff --git a/app/code/Magento/DesignEditor/etc/adminhtml/routes.xml b/app/code/Magento/DesignEditor/etc/adminhtml/routes.xml index eb71d7ff446..750e17010f0 100644 --- a/app/code/Magento/DesignEditor/etc/adminhtml/routes.xml +++ b/app/code/Magento/DesignEditor/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_DesignEditor_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_DesignEditor" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Directory/Block/Adminhtml/Frontend/Region/Updater.php b/app/code/Magento/Directory/Block/Adminhtml/Frontend/Region/Updater.php index 5ac52e2add1..2c3c2bc1c75 100644 --- a/app/code/Magento/Directory/Block/Adminhtml/Frontend/Region/Updater.php +++ b/app/code/Magento/Directory/Block/Adminhtml/Frontend/Region/Updater.php @@ -29,12 +29,31 @@ namespace Magento\Directory\Block\Adminhtml\Frontend\Region; class Updater extends \Magento\Backend\Block\System\Config\Form\Field { + /** + * @var \Magento\Directory\Helper\Data + */ + protected $_directoryHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Directory\Helper\Data $directoryHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Directory\Helper\Data $directoryHelper, + array $data = array() + ) { + $this->_directoryHelper = $directoryHelper; + parent::__construct($context, $data); + } + protected function _getElementHtml(\Magento\Data\Form\Element\AbstractElement $element) { $html = parent::_getElementHtml($element); $html .= "<script type=\"text/javascript\">var updater = new RegionUpdater('tax_defaults_country'," . " 'tax_region', 'tax_defaults_region', " - . $this->helper('Magento\Directory\Helper\Data')->getRegionJson() + . $this->_directoryHelper->getRegionJson() . ", 'disable');</script>"; return $html; diff --git a/app/code/Magento/Directory/etc/email_templates.xml b/app/code/Magento/Directory/etc/email_templates.xml index d4ab9385521..e48498a56b2 100644 --- a/app/code/Magento/Directory/etc/email_templates.xml +++ b/app/code/Magento/Directory/etc/email_templates.xml @@ -24,5 +24,5 @@ */ --> <config> - <template id="currency_import_error_email_template" label="Currency Update Warnings" file="currency_update_notification.html" type="text"/> + <template id="currency_import_error_email_template" label="Currency Update Warnings" file="currency_update_notification.html" type="text" module="Magento_Directory"/> </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 a96a790eeda..66f5f46799b 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 @@ -34,7 +34,7 @@ namespace Magento\Downloadable\Block\Adminhtml\Catalog\Product\Edit\Tab; class Downloadable - extends \Magento\Adminhtml\Block\Widget implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + extends \Magento\Backend\Block\Widget implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** * Reference to product objects that is being edited @@ -143,7 +143,7 @@ class Downloadable */ protected function _toHtml() { - $accordion = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Accordion') + $accordion = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Accordion') ->setId('downloadableInfo'); $accordion->addItem('samples', array( diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php index 1c5d025c5c6..9e41a80f8c5 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php @@ -195,7 +195,7 @@ class Links */ public function getAddButtonHtml() { - $addButton = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $addButton = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData([ 'label' => __('Add New Row'), 'id' => 'add_link_item', @@ -269,40 +269,50 @@ class Links 'sample_type' => $item->getSampleType(), 'sort_order' => $item->getSortOrder(), ); - $file = $fileHelper->getFilePath( - $this->_link->getBasePath(), $item->getLinkFile() - ); - if ($item->getLinkFile() && !is_file($file)) { - $this->_coreFileStorageDb->saveFileToFilesystem($file); + $linkFile = $item->getLinkFile(); + if ($linkFile) { + $file = $fileHelper->getFilePath( + $this->_link->getBasePath(), $linkFile + ); + + $fileExist = $fileHelper->ensureFileInFilesystem($file); + + if ($fileExist) { + $name = '<a href="' + . $this->getUrl('adminhtml/downloadable_product_edit/link', array( + 'id' => $item->getId(), + '_secure' => true + )) . '">' . $fileHelper->getFileFromPathFile($linkFile) . '</a>'; + $tmpLinkItem['file_save'] = array( + array( + 'file' => $linkFile, + 'name' => $name, + 'size' => $fileHelper->getFileSize($file), + 'status' => 'old' + )); + } } - if ($item->getLinkFile() && is_file($file)) { - $name = '<a href="' - . $this->getUrl('adminhtml/downloadable_product_edit/link', array( - 'id' => $item->getId(), - '_secure' => true - )) . '">' . $fileHelper->getFileFromPathFile($item->getLinkFile()) . '</a>'; - $tmpLinkItem['file_save'] = array( - array( - 'file' => $item->getLinkFile(), - 'name' => $name, - 'size' => filesize($file), - 'status' => 'old' - )); - } - $sampleFile = $fileHelper->getFilePath( - $this->_link->getBaseSamplePath(), $item->getSampleFile() - ); - if ($item->getSampleFile() && is_file($sampleFile)) { - $tmpLinkItem['sample_file_save'] = array( - array( - 'file' => $item->getSampleFile(), - 'name' => $fileHelper->getFileFromPathFile($item->getSampleFile()), - 'size' => filesize($sampleFile), - 'status' => 'old' - )); + $sampleFile = $item->getSampleFile(); + if ($sampleFile) { + $file = $fileHelper->getFilePath( + $this->_link->getBaseSamplePath(), $sampleFile + ); + + $fileExist = $fileHelper->ensureFileInFilesystem($file); + + if ($fileExist) { + $tmpLinkItem['sample_file_save'] = array( + array( + 'file' => $item->getSampleFile(), + 'name' => $fileHelper->getFileFromPathFile($sampleFile), + 'size' => $fileHelper->getFileSize($file), + 'status' => 'old' + )); + } } + if ($item->getNumberOfDownloads() == '0') { $tmpLinkItem['is_unlimited'] = ' checked="checked"'; } @@ -344,7 +354,7 @@ class Links */ protected function _prepareLayout() { - $this->addChild('upload_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('upload_button', 'Magento\Backend\Block\Widget\Button', array( 'id' => '', 'label' => __('Upload Files'), 'type' => 'button', diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php index 0f6c00ab1e6..ad2e2c92dc9 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php @@ -139,7 +139,7 @@ class Samples */ public function getAddButtonHtml() { - $addButton = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $addButton = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData([ 'label' => __('Add New Row'), 'id' => 'add_sample_item', @@ -170,21 +170,26 @@ class Samples 'sample_type' => $item->getSampleType(), 'sort_order' => $item->getSortOrder(), ); - $file = $fileHelper->getFilePath( - $this->_sampleModel->getBasePath(), $item->getSampleFile() - ); - if ($item->getSampleFile() && !is_file($file)) { - $this->_coreFileStorageDb->saveFileToFilesystem($file); - } - if ($item->getSampleFile() && is_file($file)) { - $tmpSampleItem['file_save'] = array( - array( - 'file' => $item->getSampleFile(), - 'name' => $fileHelper->getFileFromPathFile($item->getSampleFile()), - 'size' => filesize($file), - 'status' => 'old' - )); + + $sampleFile = $item->getSampleFile(); + if ($sampleFile) { + $file = $fileHelper->getFilePath( + $this->_sampleModel->getBasePath(), $sampleFile + ); + + $fileExist = $fileHelper->ensureFileInFilesystem($file); + + if ($fileExist) { + $tmpSampleItem['file_save'] = array( + array( + 'file' => $sampleFile, + 'name' => $fileHelper->getFileFromPathFile($sampleFile), + 'size' => $fileHelper->getFileSize($file), + 'status' => 'old' + )); + } } + if ($this->getProduct() && $item->getStoreTitle()) { $tmpSampleItem['store_title'] = $item->getStoreTitle(); } @@ -222,7 +227,7 @@ class Samples */ protected function _prepareLayout() { - $this->addChild('upload_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('upload_button', 'Magento\Backend\Block\Widget\Button', array( 'id' => '', 'label' => __('Upload Files'), 'type' => 'button', diff --git a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php index 36a856f28d4..391bf02e852 100644 --- a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php +++ b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php @@ -57,9 +57,17 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Tax\Model\Calculation $calculationModel * @param \Magento\Json\EncoderInterface $jsonEncoder + * @param \Magento\Core\Helper\Data $coreData * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -68,6 +76,11 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Tax\Model\Calculation $calculationModel, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Core\Helper\Data $coreData, @@ -76,7 +89,20 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct $this->_calculationModel = $calculationModel; $this->jsonEncoder = $jsonEncoder; $this->coreData = $coreData; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); } /** @@ -135,7 +161,7 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct } $taxHelper = $this->_taxData; - $coreHelper = $this->helper('Magento\Core\Helper\Data'); + $coreHelper = $this->coreData; $_priceInclTax = $taxHelper->getPrice($link->getProduct(), $price, true); $_priceExclTax = $taxHelper->getPrice($link->getProduct(), $price); @@ -165,7 +191,7 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct public function getCurrencyPrice($price) { $store = $this->getProduct()->getStore(); - return $this->helper('Magento\Core\Helper\Data')->currencyByStore($price, $store, false); + return $this->coreData->currencyByStore($price, $store, false); } /** diff --git a/app/code/Magento/Downloadable/Block/Checkout/Cart/Item/Renderer.php b/app/code/Magento/Downloadable/Block/Checkout/Cart/Item/Renderer.php index 78fa6dc2e57..4c1edffc342 100644 --- a/app/code/Magento/Downloadable/Block/Checkout/Cart/Item/Renderer.php +++ b/app/code/Magento/Downloadable/Block/Checkout/Cart/Item/Renderer.php @@ -47,6 +47,9 @@ class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer * @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 \Magento\Downloadable\Helper\Catalog\Product\Configuration $dwnCtlgProdConfig * @param array $data */ @@ -54,11 +57,16 @@ class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer \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, \Magento\Downloadable\Helper\Catalog\Product\Configuration $dwnCtlgProdConfig, array $data = array() ) { $this->_downloadProdConfig = $dwnCtlgProdConfig; - parent::__construct($context, $productConfig, $checkoutSession, $data); + parent::__construct( + $context, $productConfig, $checkoutSession, $imageHelper, $urlHelper, $messageManager, $data + ); } /** diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/File.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/File.php index 8b3b68a24fd..07d73d83de1 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/File.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/File.php @@ -45,18 +45,28 @@ class File extends \Magento\Backend\App\Action */ protected $_sample; + /** + * Downloadable file helper. + * + * @var \Magento\Downloadable\Helper\File + */ + protected $_fileHelper; + /** * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Downloadable\Model\Link $link * @param \Magento\Downloadable\Model\Sample $sample + * @param \Magento\Downloadable\Helper\File $fileHelper */ public function __construct( \Magento\Backend\App\Action\Context $context, \Magento\Downloadable\Model\Link $link, - \Magento\Downloadable\Model\Sample $sample + \Magento\Downloadable\Model\Sample $sample, + \Magento\Downloadable\Helper\File $fileHelper ) { $this->_link = $link; $this->_sample = $sample; + $this->_fileHelper = $fileHelper; parent::__construct($context); } @@ -74,22 +84,25 @@ class File extends \Magento\Backend\App\Action } elseif ($type == 'link_samples') { $tmpPath = $this->_link->getBaseSampleTmpPath(); } - $result = array(); + try { $uploader = $this->_objectManager->create('Magento\Core\Model\File\Uploader', array('fileId' => $type)); - $uploader->setAllowRenameFiles(true); - $uploader->setFilesDispersion(true); - $result = $uploader->save($tmpPath); + + $result = $this->_fileHelper->uploadFromTmp($tmpPath, $uploader); + + if (!$result) { + throw new \Exception('File can not be moved from temporary folder to the destination folder.'); + } /** * Workaround for prototype 1.7 methods "isJSON", "evalJSON" on Windows OS */ - $result['tmp_name'] = str_replace(DS, "/", $result['tmp_name']); - $result['path'] = str_replace(DS, "/", $result['path']); + $result['tmp_name'] = str_replace('\\', '/', $result['tmp_name']); + $result['path'] = str_replace('\\', '/', $result['path']); if (isset($result['file'])) { - $fullPath = rtrim($tmpPath, DS) . DS . ltrim($result['file'], DS); - $this->_objectManager->get('Magento\Core\Helper\File\Storage\Database')->saveFile($fullPath); + $relativePath = rtrim($tmpPath, '/') . '/' . ltrim($result['file'], '/'); + $this->_objectManager->get('Magento\Core\Helper\File\Storage\Database')->saveFile($relativePath); } $result['cookie'] = array( @@ -100,7 +113,7 @@ class File extends \Magento\Backend\App\Action 'domain' => $this->_getSession()->getCookieDomain() ); } catch (\Exception $e) { - $result = array('error'=>$e->getMessage(), 'errorcode'=>$e->getCode()); + $result = array('error' => $e->getMessage(), 'errorcode' => $e->getCode()); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit.php index cb473f3e445..fd6256d048a 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit.php @@ -116,7 +116,7 @@ class Edit extends \Magento\Catalog\Controller\Adminhtml\Product try { $this->_processDownload($resource, $resourceType); } catch (\Magento\Core\Exception $e) { - $this->_getCustomerSession()->addError(__('Something went wrong while getting the requested content.')); + $this->messageManager->addError(__('Something went wrong while getting the requested content.')); } } exit(0); diff --git a/app/code/Magento/Downloadable/Controller/Customer.php b/app/code/Magento/Downloadable/Controller/Customer.php index b9e844e63ac..030a8f176bc 100644 --- a/app/code/Magento/Downloadable/Controller/Customer.php +++ b/app/code/Magento/Downloadable/Controller/Customer.php @@ -59,7 +59,7 @@ class Customer extends \Magento\App\Action\Action * Check customer authentication * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { @@ -78,7 +78,7 @@ class Customer extends \Magento\App\Action\Action public function productsAction() { $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); if ($block = $this->_view->getLayout()->getBlock('downloadable_customer_products_list')) { $block->setRefererUrl($this->_redirect->getRefererUrl()); } diff --git a/app/code/Magento/Downloadable/Controller/Download.php b/app/code/Magento/Downloadable/Controller/Download.php index b432855005d..c9e00d98b22 100644 --- a/app/code/Magento/Downloadable/Controller/Download.php +++ b/app/code/Magento/Downloadable/Controller/Download.php @@ -117,7 +117,7 @@ class Download extends \Magento\App\Action\Action $this->_processDownload($resource, $resourceType); exit(0); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError(__('Sorry, there was an error getting requested content. Please contact the store owner.')); + $this->messageManager->addError(__('Sorry, there was an error getting requested content. Please contact the store owner.')); } } return $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); @@ -147,7 +147,7 @@ class Download extends \Magento\App\Action\Action $this->_processDownload($resource, $resourceType); exit(0); } catch (\Magento\Core\Exception $e) { - $this->_getCustomerSession()->addError(__('Sorry, there was an error getting requested content. Please contact the store owner.')); + $this->messageManager->addError(__('Sorry, there was an error getting requested content. Please contact the store owner.')); } } return $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); @@ -165,7 +165,7 @@ class Download extends \Magento\App\Action\Action $linkPurchasedItem = $this->_objectManager->create('Magento\Downloadable\Model\Link\Purchased\Item') ->load($id, 'link_hash'); if (! $linkPurchasedItem->getId() ) { - $session->addNotice(__("We can't find the link you requested.")); + $this->messageManager->addNotice(__("We can't find the link you requested.")); return $this->_redirect('*/customer/products'); } if (!$this->_objectManager->get('Magento\Downloadable\Helper\Data')->getIsShareable($linkPurchasedItem)) { @@ -182,7 +182,7 @@ class Download extends \Magento\App\Action\Action } else { $notice = __('Please log in to download your product.'); } - $session->addNotice($notice); + $this->messageManager->addNotice($notice); $session->authenticate($this); $session->setBeforeAuthUrl( $this->_objectManager->create('Magento\Core\Model\Url')->getUrl( @@ -196,7 +196,7 @@ class Download extends \Magento\App\Action\Action $linkPurchased = $this->_objectManager->create('Magento\Downloadable\Model\Link\Purchased') ->load($linkPurchasedItem->getPurchasedId()); if ($linkPurchased->getCustomerId() != $customerId) { - $session->addNotice(__("We can't find the link you requested.")); + $this->messageManager->addNotice(__("We can't find the link you requested.")); return $this->_redirect('*/customer/products'); } } @@ -230,18 +230,18 @@ class Download extends \Magento\App\Action\Action exit(0); } catch (\Exception $e) { - $session->addError( + $this->messageManager->addError( __('Something went wrong while getting the requested content.') ); } } elseif ($status == \Magento\Downloadable\Model\Link\Purchased\Item::LINK_STATUS_EXPIRED) { - $session->addNotice(__('The link has expired.')); + $this->messageManager->addNotice(__('The link has expired.')); } elseif ($status == \Magento\Downloadable\Model\Link\Purchased\Item::LINK_STATUS_PENDING || $status == \Magento\Downloadable\Model\Link\Purchased\Item::LINK_STATUS_PAYMENT_REVIEW ) { - $session->addNotice(__('The link is not available.')); + $this->messageManager->addNotice(__('The link is not available.')); } else { - $session->addError( + $this->messageManager->addError( __('Something went wrong while getting the requested content.') ); } diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index f7836508d02..dbf46192785 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -26,6 +26,8 @@ namespace Magento\Downloadable\Helper; +use Magento\Filesystem; + /** * Downloadable Products Download Helper */ @@ -79,14 +81,14 @@ class Download extends \Magento\App\Helper\AbstractHelper * * @var string */ - protected $_contentType = 'application/octet-stream'; + protected $_contentType = 'application/octet-stream'; /** * File name * * @var string */ - protected $_fileName = 'download'; + protected $_fileName = 'download'; /** * Core file storage database @@ -117,22 +119,27 @@ class Download extends \Magento\App\Helper\AbstractHelper protected $_coreStoreConfig; /** - * @var \Magento\App\Dir + * @var \Magento\Core\Model\App */ - protected $_dirModel; + protected $_app; /** * @var \Magento\Filesystem */ protected $_filesystem; + /** + * Working Directory (Could be MEDIA or HTTP). + * @var \Magento\Filesystem\Directory\Read + */ + protected $_workingDirectory; + /** * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Downloadable\Helper\File $downloadableFile * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\Dir $dirModel * @param \Magento\Filesystem $filesystem */ public function __construct( @@ -141,22 +148,22 @@ 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\App\Dir $dirModel, \Magento\Filesystem $filesystem ) { $this->_coreData = $coreData; $this->_downloadableFile = $downloadableFile; $this->_coreFileStorageDb = $coreFileStorageDb; $this->_coreStoreConfig = $coreStoreConfig; - $this->_dirModel = $dirModel; + $this->_app = $context->getApp(); $this->_filesystem = $filesystem; + parent::__construct($context); } /** * Retrieve Resource file handle (socket, file pointer etc) * - * @return resource + * @return \Magento\Filesystem\File\ReadInterface * @throws \Magento\Core\Exception|\Exception */ protected function _getHandle() @@ -167,84 +174,16 @@ class Download extends \Magento\App\Helper\AbstractHelper if (is_null($this->_handle)) { if ($this->_linkType == self::LINK_TYPE_URL) { - $port = 80; - - /** - * Validate URL - */ - $urlProp = parse_url($this->_resourceFile); - if (!isset($urlProp['scheme']) || strtolower($urlProp['scheme'] != 'http')) { - throw new \Magento\Core\Exception(__('Please correct the download URL scheme.')); - } - if (!isset($urlProp['host'])) { - throw new \Magento\Core\Exception(__('Please correct the download URL host.')); - } - $hostname = $urlProp['host']; - - if (isset($urlProp['port'])) { - $port = (int)$urlProp['port']; - } - - $path = '/'; - if (isset($urlProp['path'])) { - $path = $urlProp['path']; - } - $query = ''; - if (isset($urlProp['query'])) { - $query = '?' . $urlProp['query']; - } - - try { - $this->_handle = fsockopen($hostname, $port, $errno, $errstr); - } catch (\Exception $e) { - throw $e; - } - - if ($this->_handle === false) { - throw new \Magento\Core\Exception( - __('Something went wrong connecting to the host. Error#%1 - %2.', $errno, $errstr) - ); - } - - $headers = 'GET ' . $path . $query . ' HTTP/1.0' . "\r\n" - . 'Host: ' . $hostname . "\r\n" - . 'User-Agent: Magento ver/' . \Magento\Core\Model\App::VERSION . "\r\n" - . 'Connection: close' . "\r\n" - . "\r\n"; - fwrite($this->_handle, $headers); - - while (!feof($this->_handle)) { - $str = fgets($this->_handle, 1024); - if ($str == "\r\n") { - break; - } - $match = array(); - if (preg_match('#^([^:]+): (.*)\s+$#', $str, $match)) { - $k = strtolower($match[1]); - if ($k == 'set-cookie') { - continue; - } else { - $this->_urlHeaders[$k] = trim($match[2]); - } - } elseif (preg_match('#^HTTP/[0-9\.]+ (\d+) (.*)\s$#', $str, $match)) { - $this->_urlHeaders['code'] = $match[1]; - $this->_urlHeaders['code-string'] = trim($match[2]); - } - } - - if (!isset($this->_urlHeaders['code']) || $this->_urlHeaders['code'] != 200) { - throw new \Magento\Core\Exception(__('Something went wrong while getting the requested content.')); - } + $this->_workingDirectory = $this->_filesystem->getDirectoryRead(Filesystem::HTTP); + $this->_handle = $this->_workingDirectory->openFile($this->_resourceFile); } elseif ($this->_linkType == self::LINK_TYPE_FILE) { - $this->_handle = new \Magento\Io\File(); - if (!is_file($this->_resourceFile)) { - $this->_coreFileStorageDb->saveFileToFilesystem($this->_resourceFile); - } - $this->_handle->open(array('path' => $this->_dirModel->getDir(\Magento\App\Dir::VAR_DIR))); - if (!$this->_handle->fileExists($this->_resourceFile, true)) { - throw new \Magento\Core\Exception(__("We can't find this file.")); + $this->_workingDirectory = $this->_filesystem->getDirectoryRead(Filesystem::MEDIA); + $fileExists = $this->_downloadableFile->ensureFileInFilesystem($this->_resourceFile); + if ($fileExists) { + $this->_handle = $this->_workingDirectory->openFile($this->_resourceFile, '???'); + } else { + throw new \Magento\Core\Exception(__('Invalid download link type.')); } - $this->_handle->streamOpen($this->_resourceFile, 'r'); } else { throw new \Magento\Core\Exception(__('Invalid download link type.')); } @@ -257,15 +196,7 @@ class Download extends \Magento\App\Helper\AbstractHelper */ public function getFilesize() { - $handle = $this->_getHandle(); - if ($this->_linkType == self::LINK_TYPE_FILE) { - return $handle->streamStat('size'); - } elseif ($this->_linkType == self::LINK_TYPE_URL) { - if (isset($this->_urlHeaders['content-length'])) { - return $this->_urlHeaders['content-length']; - } - } - return null; + return $this->_workingDirectory->stat($this->_resourceFile)['size']; } /** @@ -281,10 +212,7 @@ class Download extends \Magento\App\Helper\AbstractHelper return $this->_downloadableFile->getFileType($this->_resourceFile); } } elseif ($this->_linkType == self::LINK_TYPE_URL) { - if (isset($this->_urlHeaders['content-type'])) { - $contentType = explode('; ', $this->_urlHeaders['content-type']); - return $contentType[0]; - } + return $this->_workingDirectory->stat($this->_resourceFile)['type']; } return $this->_contentType; } @@ -298,8 +226,9 @@ class Download extends \Magento\App\Helper\AbstractHelper if ($this->_linkType == self::LINK_TYPE_FILE) { return pathinfo($this->_resourceFile, PATHINFO_BASENAME); } elseif ($this->_linkType == self::LINK_TYPE_URL) { - if (isset($this->_urlHeaders['content-disposition'])) { - $contentDisposition = explode('; ', $this->_urlHeaders['content-disposition']); + $stat = $this->_workingDirectory->stat($this->_resourceFile); + if (isset($stat['disposition'])) { + $contentDisposition = explode('; ', $stat['disposition']); if (!empty($contentDisposition[1]) && strpos($contentDisposition[1], 'filename=') !== false) { return substr($contentDisposition[1], 9); } @@ -323,7 +252,11 @@ class Download extends \Magento\App\Helper\AbstractHelper { if (self::LINK_TYPE_FILE == $linkType) { //check LFI protection - $this->_filesystem->checkLfiProtection($resourceFile); + if (preg_match('#\.\.[\\\/]#', $resourceFile)) { + throw new \InvalidArgumentException( + 'Requested file may not include parent directory traversal ("../", "..\\" notation)' + ); + } } $this->_resourceFile = $resourceFile; @@ -336,12 +269,12 @@ class Download extends \Magento\App\Helper\AbstractHelper { $handle = $this->_getHandle(); if ($this->_linkType == self::LINK_TYPE_FILE) { - while (true == ($buffer = $handle->streamRead())) { + while (true == ($buffer = $handle->read(1024))) { print $buffer; } } elseif ($this->_linkType == self::LINK_TYPE_URL) { - while (!feof($handle)) { - print fgets($handle, 1024); + while (!$handle->eof()) { + print $handle->read(1024); } } } diff --git a/app/code/Magento/Downloadable/Helper/File.php b/app/code/Magento/Downloadable/Helper/File.php index bb53143f047..bff1427f9bd 100644 --- a/app/code/Magento/Downloadable/Helper/File.php +++ b/app/code/Magento/Downloadable/Helper/File.php @@ -43,16 +43,35 @@ class File extends \Magento\App\Helper\AbstractHelper protected $_coreFileStorageDatabase = null; /** + * Filesystem object. + * + * @var \Magento\Filesystem + */ + protected $_filesystem; + + /** + * Media Directory object (writable). + * + * @var \Magento\Filesystem\Directory\WriteInterface + */ + protected $_mediaDirectory; + + /** + * @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 array $mimeTypes */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, + \Magento\Filesystem $filesystem, array $mimeTypes = array() ) { $this->_coreFileStorageDatabase = $coreFileStorageDatabase; + $this->_filesystem = $filesystem; + $this->_mediaDirectory = $filesystem->getDirectoryWrite($filesystem::MEDIA); parent::__construct($context); if (!empty($mimeTypes)) { foreach ($mimeTypes as $key => $value) { @@ -61,6 +80,22 @@ class File extends \Magento\App\Helper\AbstractHelper } } + /** + * Upload file from temporary folder. + * @param $tmpPath + * @param \Magento\Core\Model\File\Uploader $uploader + * @return array | bool + */ + public function uploadFromTmp($tmpPath, \Magento\Core\Model\File\Uploader $uploader) + { + $uploader->setAllowRenameFiles(true); + $uploader->setFilesDispersion(true); + $absoluteTmpPath = $this->_mediaDirectory->getAbsolutePath($tmpPath); + $result = $uploader->save($absoluteTmpPath); + + return $result; + } + /** * Checking file for moving and move it * @param string $baseTmpPath @@ -73,7 +108,7 @@ class File extends \Magento\App\Helper\AbstractHelper { if (isset($file[0])) { $fileName = $file[0]['file']; - if ($file[0]['status'] == 'new') { + if ($file[0]['status'] === 'new') { try { $fileName = $this->_moveFileFromTmp( $baseTmpPath, $basePath, $file[0]['file'] @@ -87,6 +122,21 @@ class File extends \Magento\App\Helper\AbstractHelper return ''; } + /** + * Check if file exist in filesystem and try to re-create it from database record if negative. + * @param $file + * @return bool|int + */ + public function ensureFileInFilesystem($file) + { + $result = true; + if (!$this->_mediaDirectory->isFile($file)) { + $result = $this->_coreFileStorageDatabase->saveFileToFilesystem($file); + } + + return $result; + } + /** * Move file from tmp path to base path * @@ -97,20 +147,11 @@ class File extends \Magento\App\Helper\AbstractHelper */ protected function _moveFileFromTmp($baseTmpPath, $basePath, $file) { - $ioObject = new \Magento\Io\File(); - $destDirectory = dirname($this->getFilePath($basePath, $file)); - try { - $ioObject->open(array('path'=>$destDirectory)); - } catch (\Exception $e) { - $ioObject->mkdir($destDirectory, 0777, true); - $ioObject->open(array('path'=>$destDirectory)); - } - if (strrpos($file, '.tmp') == strlen($file)-4) { $file = substr($file, 0, strlen($file)-4); } - $destFile = dirname($file) . $ioObject->dirsep() + $destFile = dirname($file) . '/' . \Magento\Core\Model\File\Uploader::getNewFileName($this->getFilePath($basePath, $file)); $this->_coreFileStorageDatabase->copyFile( @@ -118,11 +159,12 @@ class File extends \Magento\App\Helper\AbstractHelper $this->getFilePath($basePath, $destFile) ); - $result = $ioObject->mv( + $this->_mediaDirectory->renameFile( $this->getFilePath($baseTmpPath, $file), $this->getFilePath($basePath, $destFile) ); - return str_replace($ioObject->dirsep(), '/', $destFile); + + return str_replace('\\', '/', $destFile); } /** @@ -134,24 +176,10 @@ class File extends \Magento\App\Helper\AbstractHelper */ public function getFilePath($path, $file) { - $file = $this->_prepareFileForPath($file); - - if(substr($file, 0, 1) == DS) { - return $path . DS . substr($file, 1); - } - - return $path . DS . $file; - } + $path = rtrim($path, '/'); + $file = ltrim($file, '/'); - /** - * Replace slashes with directory separator - * - * @param string $file - * @return string - */ - protected function _prepareFileForPath($file) - { - return str_replace('/', DS, $file); + return $path . '/' . $file; } /** @@ -162,13 +190,21 @@ class File extends \Magento\App\Helper\AbstractHelper */ public function getFileFromPathFile($pathFile) { - $file = ''; - - $file = substr($pathFile, strrpos($this->_prepareFileForPath($pathFile), DS)+1); + $file = substr($pathFile, strrpos($pathFile, '/')+1); return $file; } + /** + * Get filesize in bytes. + * @param $file + * @return int + */ + public function getFileSize($file) + { + return $this->_mediaDirectory->stat($file)['size']; + } + public function getFileType($filePath) { $ext = substr($filePath, strrpos($filePath, '.')+1); diff --git a/app/code/Magento/Downloadable/Model/Link.php b/app/code/Magento/Downloadable/Model/Link.php index b7096373192..1cd4337aa1f 100644 --- a/app/code/Magento/Downloadable/Model/Link.php +++ b/app/code/Magento/Downloadable/Model/Link.php @@ -67,15 +67,9 @@ class Link extends \Magento\Core\Model\AbstractModel const LINK_SHAREABLE_NO = 0; const LINK_SHAREABLE_CONFIG = 2; - /** - * @var \Magento\App\Dir - */ - protected $_dirModel; - /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry - * @param \Magento\App\Dir $dirModel * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -83,12 +77,10 @@ class Link extends \Magento\Core\Model\AbstractModel public function __construct( \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\App\Dir $dirModel, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_dirModel = $dirModel; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -102,16 +94,6 @@ class Link extends \Magento\Core\Model\AbstractModel parent::_construct(); } - /** - * Return link files path - * - * @return string - */ - public function getLinkDir() - { - return $this->_dirModel->getDir(); - } - /** * Enter description here... * @@ -130,8 +112,7 @@ class Link extends \Magento\Core\Model\AbstractModel */ public function getBaseTmpPath() { - return $this->_dirModel->getDir(\Magento\App\Dir::MEDIA) - . DS . 'downloadable' . DS . 'tmp' . DS . 'links'; + return 'downloadable/tmp/links'; } /** @@ -141,7 +122,7 @@ class Link extends \Magento\Core\Model\AbstractModel */ public function getBasePath() { - return $this->_dirModel->getDir(\Magento\App\Dir::MEDIA) . DS . 'downloadable' . DS . 'files' . DS . 'links'; + return 'downloadable/files/links'; } /** @@ -151,7 +132,7 @@ class Link extends \Magento\Core\Model\AbstractModel */ public function getBaseSampleTmpPath() { - return $this->_dirModel->getDir(\Magento\App\Dir::MEDIA) . DS . 'downloadable' . DS . 'tmp' . DS . 'link_samples'; + return 'downloadable/tmp/link_samples'; } /** @@ -161,7 +142,7 @@ class Link extends \Magento\Core\Model\AbstractModel */ public function getBaseSamplePath() { - return $this->_dirModel->getDir(\Magento\App\Dir::MEDIA) . DS . 'downloadable' . DS . 'files' . DS . 'link_samples'; + return 'downloadable/files/link_samples'; } /** diff --git a/app/code/Magento/Downloadable/Model/Product/Type.php b/app/code/Magento/Downloadable/Model/Product/Type.php index 149fa860773..32f68026abc 100644 --- a/app/code/Magento/Downloadable/Model/Product/Type.php +++ b/app/code/Magento/Downloadable/Model/Product/Type.php @@ -102,12 +102,12 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual \Magento\Eav\Model\Config $eavConfig, \Magento\Catalog\Model\Product\Type $catalogProductType, \Magento\Event\ManagerInterface $eventManager, - \Magento\Downloadable\Helper\File $downloadableFile, \Magento\Core\Helper\Data $coreData, \Magento\Core\Helper\File\Storage\Database $fileStorageDb, \Magento\Filesystem $filesystem, \Magento\Core\Model\Registry $coreRegistry, \Magento\Logger $logger, + \Magento\Downloadable\Helper\File $downloadableFile, \Magento\Downloadable\Model\Resource\SampleFactory $sampleResFactory, \Magento\Downloadable\Model\Resource\Link $linkResource, \Magento\Downloadable\Model\Resource\Link\CollectionFactory $linksFactory, 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 901600565f9..ec5c19fc89b 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\App\Dir $coreDir + * @param \Magento\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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, @@ -82,7 +82,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra $this->_coreStoreConfig = $coreStoreConfig; $this->_purchasedFactory = $purchasedFactory; $this->_itemsFactory = $itemsFactory; - parent::__construct($context, $registry, $taxData, $coreDir, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $taxData, $filesystem, $resource, $resourceCollection, $data); } /** 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 08fe08ccda7..1ba8847664b 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\App\Dir $coreDir + * @param \Magento\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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, @@ -68,7 +68,7 @@ class Creditmemo $context, $registry, $taxData, - $coreDir, + $filesystem, $coreStoreConfig, $purchasedFactory, $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 e960c53fc84..7b3d5161fb6 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\App\Dir $coreDir + * @param \Magento\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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, @@ -73,7 +73,7 @@ class Invoice $context, $registry, $taxData, - $coreDir, + $filesystem, $coreStoreConfig, $purchasedFactory, $itemsFactory, diff --git a/app/code/Magento/Downloadable/Model/Sample.php b/app/code/Magento/Downloadable/Model/Sample.php index df718f6ad27..eb2db532e4c 100644 --- a/app/code/Magento/Downloadable/Model/Sample.php +++ b/app/code/Magento/Downloadable/Model/Sample.php @@ -50,15 +50,9 @@ class Sample extends \Magento\Core\Model\AbstractModel { const XML_PATH_SAMPLES_TITLE = 'catalog/downloadable/samples_title'; - /** - * @var \Magento\App\Dir - */ - protected $_dirModel; - /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry - * @param \Magento\App\Dir $dirModel * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -66,12 +60,10 @@ class Sample extends \Magento\Core\Model\AbstractModel public function __construct( \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\App\Dir $dirModel, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_dirModel = $dirModel; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -85,16 +77,6 @@ class Sample extends \Magento\Core\Model\AbstractModel parent::_construct(); } - /** - * Return sample files path - * - * @return string - */ - public function getSampleDir() - { - return $this->_dirModel->getDir(); - } - /** * After save process * @@ -128,8 +110,7 @@ class Sample extends \Magento\Core\Model\AbstractModel */ public function getBaseTmpPath() { - return $this->_dirModel->getDir(\Magento\App\Dir::MEDIA) - . DS . 'downloadable' . DS . 'tmp' . DS . 'samples'; + return 'downloadable/tmp/samples'; } /** @@ -139,8 +120,7 @@ class Sample extends \Magento\Core\Model\AbstractModel */ public function getBasePath() { - return $this->_dirModel->getDir(\Magento\App\Dir::MEDIA) - . DS . 'downloadable' . DS . 'files' . DS . 'samples'; + return 'downloadable/files/samples'; } /** diff --git a/app/code/Magento/Downloadable/etc/adminhtml/routes.xml b/app/code/Magento/Downloadable/etc/adminhtml/routes.xml index 1fa519db9c0..cdea51819a7 100644 --- a/app/code/Magento/Downloadable/etc/adminhtml/routes.xml +++ b/app/code/Magento/Downloadable/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Downloadable_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Downloadable" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Downloadable/etc/module.xml b/app/code/Magento/Downloadable/etc/module.xml index 061d0ee728c..1992bce18c8 100755 --- a/app/code/Magento/Downloadable/etc/module.xml +++ b/app/code/Magento/Downloadable/etc/module.xml @@ -32,7 +32,6 @@ <module name="Magento_Catalog"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Tax"/> <module name="Magento_Theme"/> <module name="Magento_Eav"/> 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 8908a7ffed9..0bca924cf83 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 @@ -23,16 +23,20 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -$installFile = __DIR__ . DS . 'upgrade-1.6.0.0.1-1.6.0.0.2.php'; -if (file_exists($installFile)) { + + +/** @var $this \Magento\Catalog\Model\Resource\Setup */ +$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); +if ($moduleDirectory->isExist($moduleDirectory->getRelativePath($installFile))) { include $installFile; } -/** @var $installer \Magento\Catalog\Model\Resource\Setup */ -$installer = $this; /** @var $connection \Magento\DB\Adapter\Pdo\Mysql */ -$connection = $installer->getConnection(); +$connection = $this->getConnection(); $connection->changeTableEngine( - $installer->getTable('catalog_product_index_price_downlod_tmp'), + $this->getTable('catalog_product_index_price_downlod_tmp'), \Magento\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY ); diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Grid/AbstractGrid.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Grid/AbstractGrid.php index 98d9c8719bd..04d6059fde2 100644 --- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Grid/AbstractGrid.php +++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Grid/AbstractGrid.php @@ -33,7 +33,7 @@ */ namespace Magento\Eav\Block\Adminhtml\Attribute\Grid; -abstract class AbstractGrid extends \Magento\Adminhtml\Block\Widget\Grid +abstract class AbstractGrid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Block Module diff --git a/app/code/Magento/Eav/Model/Attribute/Data/File.php b/app/code/Magento/Eav/Model/Attribute/Data/File.php index 297c13b2692..7d797b76a43 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/File.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/File.php @@ -55,28 +55,28 @@ class File extends \Magento\Eav\Model\Attribute\Data\AbstractData protected $_fileValidator; /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem\Directory\Write */ - protected $_coreDir; + protected $_directory; /** * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Logger $logger * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\File\Validator\NotProtectedExtension $fileValidator - * @param \Magento\App\Dir $coreDir + * @param \Magento\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\App\Dir $coreDir + \Magento\Filesystem $filesystem ) { parent::__construct($locale, $logger); $this->_coreData = $coreData; $this->_fileValidator = $fileValidator; - $this->_coreDir = $coreDir; + $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); } /** @@ -252,15 +252,14 @@ class File extends \Magento\Eav\Model\Attribute\Data\AbstractData } } - $path = $this->_coreDir->getDir('media') . DS . $attribute->getEntity()->getEntityTypeCode(); + $destinationFolder = $attribute->getEntity()->getEntityTypeCode(); // unlink entity file if ($toDelete) { $this->getEntity()->setData($attribute->getAttributeCode(), ''); - $file = $path . $original; - $ioFile = new \Magento\Io\File(); - if ($ioFile->fileExists($file)) { - $ioFile->rm($file); + $file = $destinationFolder . $original; + if ($this->_directory->isExist($file)) { + $this->_directory->delete($file); } } @@ -270,7 +269,7 @@ class File extends \Magento\Eav\Model\Attribute\Data\AbstractData $uploader->setFilesDispersion(true); $uploader->setFilenamesCaseSensitivity(false); $uploader->setAllowRenameFiles(true); - $uploader->save($path, $value['name']); + $uploader->save($this->_directory->getAbsolutePath($destinationFolder), $value['name']); $fileName = $uploader->getUploadedFileName(); $this->getEntity()->setData($attribute->getAttributeCode(), $fileName); } catch (\Exception $e) { diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Config/SchemaLocator.php b/app/code/Magento/Eav/Model/Entity/Attribute/Config/SchemaLocator.php index c5d9d94caa1..8b046c4e092 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Config/SchemaLocator.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Config/SchemaLocator.php @@ -39,7 +39,7 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface */ public function __construct(\Magento\Module\Dir\Reader $moduleReader) { - $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Eav') . DIRECTORY_SEPARATOR . 'eav_attributes.xsd'; + $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Eav') . '/eav_attributes.xsd'; } /** diff --git a/app/code/Magento/Eav/etc/module.xml b/app/code/Magento/Eav/etc/module.xml index 48bd425218c..26ee456e53b 100755 --- a/app/code/Magento/Eav/etc/module.xml +++ b/app/code/Magento/Eav/etc/module.xml @@ -30,7 +30,6 @@ </sequence> <depends> <module name="Magento_Core"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Backend"/> <module name="Magento_Catalog"/> </depends> diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php b/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php index 806a121e9dc..4452d8b1e32 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php @@ -34,7 +34,7 @@ */ namespace Magento\Email\Block\Adminhtml\Template; -class Edit extends \Magento\Adminhtml\Block\Widget +class Edit extends \Magento\Backend\Block\Widget { /** * @var \Magento\Core\Model\Registry @@ -68,6 +68,11 @@ class Edit extends \Magento\Adminhtml\Block\Widget */ protected $_jsonEncoder; + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Json\EncoderInterface $jsonEncoder @@ -75,6 +80,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget * @param \Magento\Backend\Model\Menu\Config $menuConfig * @param \Magento\Backend\Model\Config\Structure $configStructure * @param \Magento\Email\Model\Template\Config $emailConfig + * @param \Magento\Core\Helper\Data $coreHelper * @param array $data */ public function __construct( @@ -84,8 +90,10 @@ class Edit extends \Magento\Adminhtml\Block\Widget \Magento\Backend\Model\Menu\Config $menuConfig, \Magento\Backend\Model\Config\Structure $configStructure, \Magento\Email\Model\Template\Config $emailConfig, + \Magento\Core\Helper\Data $coreHelper, array $data = array() ) { + $this->_coreHelper = $coreHelper; $this->_jsonEncoder = $jsonEncoder; $this->_registryManager = $registry; $this->_menuConfig = $menuConfig; @@ -97,7 +105,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget protected function _prepareLayout() { $this->setChild('back_button', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData( array( 'label' => __('Back'), @@ -107,7 +115,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget ) ); $this->setChild('reset_button', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData( array( 'label' => __('Reset'), @@ -116,7 +124,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget ) ); $this->setChild('delete_button', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData( array( 'label' => __('Delete Template'), @@ -126,7 +134,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget ) ); $this->setChild('to_plain_button', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData( array( 'label' => __('Convert to Plain Text'), @@ -136,7 +144,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget ) ); $this->setChild('to_html_button', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData( array( 'label' => __('Return Html Version'), @@ -147,7 +155,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget ) ); $this->setChild('toggle_button', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData( array( 'label' => __('Toggle Editor'), @@ -157,7 +165,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget ) ); $this->setChild('preview_button', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData( array( 'label' => __('Preview Template'), @@ -166,7 +174,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget ) ); $this->setChild('save_button', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData( array( 'label' => __('Save Template'), @@ -176,7 +184,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget ) ); $this->setChild('load_button', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData( array( 'label' => __('Load Template'), @@ -374,7 +382,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget $paths = $template->getSystemConfigPathsWhereUsedAsDefault(); $pathsParts = $this->_getSystemConfigPathsParts($paths); if ($asJSON) { - return $this->helper('Magento\Core\Helper\Data')->jsonEncode($pathsParts); + return $this->_coreHelper->jsonEncode($pathsParts); } return $pathsParts; } diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php b/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php index 7fabdb53af0..0e38163d9ec 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php @@ -108,7 +108,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * Add fields to form and create template info form * * @SuppressWarnings(PHPMD.NPathComplexity) - * @return \Magento\Adminhtml\Block\Widget\Form + * @return \Magento\Backend\Block\Widget\Form */ protected function _prepareForm() { @@ -168,7 +168,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic )); $insertVariableButton = $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Widget\Button', '', array('data' => array( + ->createBlock('Magento\Backend\Block\Widget\Button', '', array('data' => array( 'type' => 'button', 'label' => __('Insert Variable...'), 'onclick' => 'templateControl.openVariableChooser();return false;' diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Filter/Type.php b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Filter/Type.php index eb1b72f4320..a73d25efc31 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Filter/Type.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Filter/Type.php @@ -34,7 +34,7 @@ namespace Magento\Email\Block\Adminhtml\Template\Grid\Filter; -class Type extends \Magento\Adminhtml\Block\Widget\Grid\Column\Filter\Select +class Type extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select { protected static $_types = array( null => null, diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Action.php b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Action.php index 6230cab8c58..96f46f99ba3 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Action.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Action.php @@ -34,7 +34,7 @@ namespace Magento\Email\Block\Adminhtml\Template\Grid\Renderer; -class Action extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Action +class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action { public function render(\Magento\Object $row) { diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Sender.php b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Sender.php index 0cc15b409bc..a222b4710b8 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Sender.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Sender.php @@ -34,7 +34,7 @@ namespace Magento\Email\Block\Adminhtml\Template\Grid\Renderer; -class Sender extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Sender extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { public function render(\Magento\Object $row) { diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Type.php b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Type.php index 84fea4a5b76..7af7bed2924 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Type.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Type.php @@ -34,7 +34,7 @@ namespace Magento\Email\Block\Adminhtml\Template\Grid\Renderer; -class Type extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Type extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { protected static $_types = array( \Magento\Email\Model\Template::TYPE_HTML => 'HTML', diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php b/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php index 234101fed8b..cf8d32cd9c4 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php @@ -33,7 +33,7 @@ */ namespace Magento\Email\Block\Adminhtml\Template; -class Preview extends \Magento\Adminhtml\Block\Widget +class Preview extends \Magento\Backend\Block\Widget { /** * @var \Magento\Core\Model\Input\Filter\MaliciousCode diff --git a/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php b/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php index dccfe91d94d..641f45ca33f 100644 --- a/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php +++ b/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php @@ -117,8 +117,7 @@ class Template extends \Magento\Backend\App\Action $template = $this->_initTemplate('id'); if (!$template->getId() && $id) { - $this->_objectManager->get('Magento\Backend\Model\Session') - ->addError(__('This email template no longer exists.')); + $this->messageManager->addError(__('This email template no longer exists.')); $this->_redirect('adminhtml/*/'); return; } @@ -143,13 +142,12 @@ class Template extends \Magento\Backend\App\Action $template->save(); $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData(false); - $this->_objectManager->get('Magento\Backend\Model\Session') - ->addSuccess(__('The email template has been saved.')); + $this->messageManager->addSuccess(__('The email template has been saved.')); $this->_redirect('adminhtml/*'); } catch (\Exception $e) { $this->_objectManager->get('Magento\Backend\Model\Session') ->setData('email_template_form_data', $request->getParams()); - $this->_objectManager->get('Magento\Backend\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_forward('new'); } @@ -162,15 +160,14 @@ class Template extends \Magento\Backend\App\Action try { $template->delete(); // display success message - $this->_objectManager->get('Magento\Backend\Model\Session') - ->addSuccess(__('The email template has been deleted.')); + $this->messageManager->addSuccess(__('The email template has been deleted.')); // go to grid $this->_redirect('adminhtml/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError( + $this->messageManager->addError( __('An error occurred while deleting email template data. Please review log and try again.') ); $this->_objectManager->get('Magento\Logger')->logException($e); @@ -183,8 +180,7 @@ class Template extends \Magento\Backend\App\Action } } // display error message - $this->_objectManager->get('Magento\Backend\Model\Session') - ->addError(__('We can\'t find an email template to delete.')); + $this->messageManager->addError(__('We can\'t find an email template to delete.')); // go to grid $this->_redirect('adminhtml/*/'); } diff --git a/app/code/Magento/Email/Model/BackendTemplate.php b/app/code/Magento/Email/Model/BackendTemplate.php index 7513f96c98c..c2c291fc43b 100644 --- a/app/code/Magento/Email/Model/BackendTemplate.php +++ b/app/code/Magento/Email/Model/BackendTemplate.php @@ -29,7 +29,7 @@ namespace Magento\Email\Model; * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class BackendTemplate extends \Magento\Email\Model\Template +class BackendTemplate extends Template { /** * @var \Magento\Core\Model\Config @@ -53,7 +53,6 @@ class BackendTemplate extends \Magento\Email\Model\Template * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\Email\Model\Template\FilterFactory $emailFilterFactory - * @param \Magento\App\Dir $dir * @param \Magento\Email\Model\Template\Config $emailConfig * @param \Magento\Backend\Model\Config\Structure $structure * @param array $data @@ -72,7 +71,6 @@ class BackendTemplate extends \Magento\Email\Model\Template \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Config $coreConfig, \Magento\Email\Model\Template\FilterFactory $emailFilterFactory, - \Magento\App\Dir $dir, \Magento\Email\Model\Template\Config $emailConfig, \Magento\Backend\Model\Config\Structure $structure, array $data = array() @@ -89,7 +87,6 @@ class BackendTemplate extends \Magento\Email\Model\Template $coreStoreConfig, $coreConfig, $emailFilterFactory, - $dir, $emailConfig, $data ); diff --git a/app/code/Magento/Email/Model/Template.php b/app/code/Magento/Email/Model/Template.php index af06fcb2b17..c9c734e1470 100644 --- a/app/code/Magento/Email/Model/Template.php +++ b/app/code/Magento/Email/Model/Template.php @@ -129,11 +129,6 @@ class Template extends \Magento\Core\Model\Template */ protected $_emailFilterFactory; - /** - * @var \Magento\App\Dir - */ - protected $_dir; - /** * Types of template */ @@ -152,7 +147,6 @@ class Template extends \Magento\Core\Model\Template * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\ConfigInterface $coreConfig * @param \Magento\Email\Model\Template\FilterFactory $emailFilterFactory - * @param \Magento\App\Dir $dir * @param \Magento\Email\Model\Template\Config $emailConfig * @param array $data * @@ -170,7 +164,6 @@ class Template extends \Magento\Core\Model\Template \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\ConfigInterface $coreConfig, \Magento\Email\Model\Template\FilterFactory $emailFilterFactory, - \Magento\App\Dir $dir, \Magento\Email\Model\Template\Config $emailConfig, array $data = array() ) { @@ -180,7 +173,6 @@ class Template extends \Magento\Core\Model\Template $this->_viewFileSystem = $viewFileSystem; $this->_coreConfig = $coreConfig; $this->_emailFilterFactory = $emailFilterFactory; - $this->_dir = $dir; $this->_emailConfig = $emailConfig; parent::__construct($context, $design, $registry, $appEmulation, $storeManager, $data); } @@ -206,8 +198,8 @@ 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; - $fullFileName = $this->_dir->getDir('media') . DS . $uploadDir . DS . $fileName; - if ($this->_filesystem->isFile($fullFileName)) { + $mediaDirectory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); + if ($mediaDirectory->isFile($uploadDir . '/' . $fileName)) { return $this->_storeManager->getStore()->getBaseUrl('media') . $uploadDir . '/' . $fileName; } } @@ -292,7 +284,8 @@ class Template extends \Magento\Core\Model\Template $templateTypeCode = $templateType == 'html' ? self::TYPE_HTML : self::TYPE_TEXT; $this->setTemplateType($templateTypeCode); - $templateText = $this->_filesystem->read($templateFile); + $modulesDirectory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + $templateText = $modulesDirectory->readFile($modulesDirectory->getRelativePath($templateFile)); if (preg_match('/<!--@subject\s*(.*?)\s*@-->/u', $templateText, $matches)) { $this->setTemplateSubject($matches[1]); diff --git a/app/code/Magento/Email/Model/Template/Config/FileIterator.php b/app/code/Magento/Email/Model/Template/Config/FileIterator.php new file mode 100644 index 00000000000..f0ec586d0f6 --- /dev/null +++ b/app/code/Magento/Email/Model/Template/Config/FileIterator.php @@ -0,0 +1,72 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Email\Model\Template\Config; + +/** + * Class FileIterator + */ +class FileIterator extends \Magento\Config\FileIterator +{ + /** + * @var \Magento\Module\Dir\ReverseResolver + */ + protected $_moduleDirResolver; + + /** + * @param \Magento\Filesystem\Directory\ReadInterface $directory + * @param array $paths + * @param \Magento\Module\Dir\ReverseResolver $dirResolver + */ + public function __construct( + \Magento\Filesystem\Directory\ReadInterface $directory, + array $paths, + \Magento\Module\Dir\ReverseResolver $dirResolver + ) { + parent::__construct($directory, $paths); + $this->_moduleDirResolver = $dirResolver; + } + + /** + * @return string + * @throws \UnexpectedValueException + */ + public function current() + { + if (!isset($this->cached[$this->key()])) { + $contents = $this->directoryRead->readFile($this->key()); + $path = $this->directoryRead->getAbsolutePath($this->key()); + $moduleName = $this->_moduleDirResolver->getModuleName($path); + if (!$moduleName) { + throw new \UnexpectedValueException( + sprintf("Unable to determine a module, file '%s' belongs to.", $this->key()) + ); + } + $contents = str_replace('<template ', '<template module="' . $moduleName . '" ', $contents); + $this->cached[$this->key()] = $contents; + } + return $this->cached[$this->key()]; + + } +} diff --git a/app/code/Magento/Email/Model/Template/Config/FileResolver.php b/app/code/Magento/Email/Model/Template/Config/FileResolver.php new file mode 100644 index 00000000000..3c1d4b72145 --- /dev/null +++ b/app/code/Magento/Email/Model/Template/Config/FileResolver.php @@ -0,0 +1,65 @@ +<?php +/** + * Hierarchy config file resolver + * + * 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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Email\Model\Template\Config; + +class FileResolver implements \Magento\Config\FileResolverInterface +{ + /** + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $directoryRead; + + /** + * @var \Magento\Config\FileIteratorFactory + */ + protected $iteratorFactory; + + /** + * @param \Magento\Filesystem $filesystem + * @param \Magento\Email\Model\Template\Config\FileIteratorFactory $iteratorFactory + */ + public function __construct( + \Magento\Filesystem $filesystem, + \Magento\Email\Model\Template\Config\FileIteratorFactory $iteratorFactory + ) { + $this->directoryRead = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $this->iteratorFactory = $iteratorFactory; + } + + /** + * @inheritdoc + */ + public function get($filename, $scope) + { + $iterator = $this->iteratorFactory->create( + array( + 'directory' => $this->directoryRead, + 'paths' => $this->directoryRead->search('#' . preg_quote($filename) . '$#') + ) + ); + return $iterator; + } +} diff --git a/app/code/Magento/Email/Model/Template/Config/Reader.php b/app/code/Magento/Email/Model/Template/Config/Reader.php index 3c52bbf0b59..5ceb1ea6f86 100644 --- a/app/code/Magento/Email/Model/Template/Config/Reader.php +++ b/app/code/Magento/Email/Model/Template/Config/Reader.php @@ -27,11 +27,6 @@ namespace Magento\Email\Model\Template\Config; class Reader extends \Magento\Config\Reader\Filesystem { - /** - * @var \Magento\Module\Dir\ReverseResolver - */ - private $_moduleDirResolver; - /** * List of id attributes for merge * @@ -46,13 +41,11 @@ class Reader extends \Magento\Config\Reader\Filesystem \Magento\Email\Model\Template\Config\Converter $converter, \Magento\Email\Model\Template\Config\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, - \Magento\Module\Dir\ReverseResolver $moduleDirResolver, $fileName = 'email_templates.xml', $idAttributes = array(), $domDocumentClass = 'Magento\Config\Dom', $defaultScope = 'global' ) { - $this->_moduleDirResolver = $moduleDirResolver; parent::__construct( $fileResolver, $converter, @@ -64,21 +57,4 @@ class Reader extends \Magento\Config\Reader\Filesystem $defaultScope ); } - - /** - * Add information on context of a module, config file belongs to - * - * {@inheritdoc} - * @throws \UnexpectedValueException - */ - protected function _readFileContents($filename) - { - $result = parent::_readFileContents($filename); - $moduleName = $this->_moduleDirResolver->getModuleName($filename); - if (!$moduleName) { - throw new \UnexpectedValueException("Unable to determine a module, file '$filename' belongs to."); - } - $result = str_replace('<template ', '<template module="' . $moduleName . '" ', $result); - return $result; - } } diff --git a/app/code/Magento/Email/etc/adminhtml/menu.xml b/app/code/Magento/Email/etc/adminhtml/menu.xml index 96a08efa939..6f74d91a960 100644 --- a/app/code/Magento/Email/etc/adminhtml/menu.xml +++ b/app/code/Magento/Email/etc/adminhtml/menu.xml @@ -27,6 +27,6 @@ --> <config> <menu> - <add id="Magento_Email::template" title="Email Templates" module="Magento_Email" sortOrder="10" parent="Magento_Adminhtml::marketing_communications" action="adminhtml/email_template" resource="Magento_Email::template"/> + <add id="Magento_Email::template" title="Email Templates" module="Magento_Email" sortOrder="10" parent="Magento_Backend::marketing_communications" action="adminhtml/email_template" resource="Magento_Email::template"/> </menu> </config> diff --git a/app/code/Magento/Email/etc/adminhtml/routes.xml b/app/code/Magento/Email/etc/adminhtml/routes.xml index f708fad875c..9b2253d1a6e 100644 --- a/app/code/Magento/Email/etc/adminhtml/routes.xml +++ b/app/code/Magento/Email/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Email_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Email" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Email/etc/di.xml b/app/code/Magento/Email/etc/di.xml index 083a2003fb6..72f3a16dd08 100644 --- a/app/code/Magento/Email/etc/di.xml +++ b/app/code/Magento/Email/etc/di.xml @@ -25,3 +25,6 @@ --> <config> </config> + +<!--/var/www/magetwo-firedrakes.localhost/app/code/Magento/Email/etc/di.xml--> +<!--/var/www/magetwo-firedrakes.localhost/app/etc/code/Magento/Email/etc/di.xml--> \ No newline at end of file diff --git a/app/code/Magento/Email/etc/email_templates.xsd b/app/code/Magento/Email/etc/email_templates.xsd index 7d96d27a2c0..16eef905ccf 100644 --- a/app/code/Magento/Email/etc/email_templates.xsd +++ b/app/code/Magento/Email/etc/email_templates.xsd @@ -26,22 +26,26 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:include schemaLocation="email_templates_types.xsd"/> + <xs:complexType name="emailTemplateType"> + <xs:attribute name="id" type="xs:string" use="required"/> + <xs:attribute name="label" type="xs:string" use="required"/> + <xs:attribute name="file" type="xs:string" use="required"/> + <xs:attribute name="type" type="emailTemplateFormatType" use="required"/> + <xs:attribute name="module" type="xs:string" use="required"/> + </xs:complexType> + + <xs:simpleType name="emailTemplateFormatType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="html"/> + <xs:enumeration value="text"/> + </xs:restriction> + </xs:simpleType> <xs:element name="config"> <xs:complexType> <xs:sequence> - <xs:element name="template" type="emailTemplateModularType" minOccurs="1" maxOccurs="unbounded"/> + <xs:element name="template" type="emailTemplateType" minOccurs="1" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> - - <!-- Module context is determined automatically during merger, it is not stored in individual config files --> - <xs:complexType name="emailTemplateModularType"> - <xs:complexContent> - <xs:extension base="emailTemplateType"> - <xs:attribute name="module" type="xs:string" use="required"/> - </xs:extension> - </xs:complexContent> - </xs:complexType> </xs:schema> diff --git a/app/code/Magento/Email/etc/module.xml b/app/code/Magento/Email/etc/module.xml index c8e5e52a1ba..729145861b9 100644 --- a/app/code/Magento/Email/etc/module.xml +++ b/app/code/Magento/Email/etc/module.xml @@ -25,6 +25,10 @@ --> <config> <module name="Magento_Email" version="1.0.0.0" active="true"> + <sequence> + <module name="Magento_Core"/> + <module name="Magento_Cms"/> + </sequence> <depends> <module name="Magento_Core"/> <module name="Magento_Cms" /> diff --git a/app/code/Magento/Email/sql/email_setup/install-1.0.0.0.php b/app/code/Magento/Email/sql/email_setup/install-1.0.0.0.php index 870f7c65d26..ec04b6ea6ba 100644 --- a/app/code/Magento/Email/sql/email_setup/install-1.0.0.0.php +++ b/app/code/Magento/Email/sql/email_setup/install-1.0.0.0.php @@ -129,7 +129,7 @@ $table = $installer->getConnection() ) ->addIndex( $installer->getIdxName( - 'core_email_template', + 'email_template', array('template_code'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), @@ -137,11 +137,11 @@ $table = $installer->getConnection() array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) ) ->addIndex( - $installer->getIdxName('core_email_template', array('added_at')), + $installer->getIdxName('email_template', array('added_at')), array('added_at') ) ->addIndex( - $installer->getIdxName('core_email_template', array('modified_at')), + $installer->getIdxName('email_template', array('modified_at')), array('modified_at') ) ->setComment('Email Templates'); diff --git a/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/Create/Form.php b/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/Create/Form.php index 534aafd1013..0e3d2aed00e 100644 --- a/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/Create/Form.php +++ b/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/Create/Form.php @@ -36,20 +36,28 @@ namespace Magento\GiftMessage\Block\Adminhtml\Sales\Order\Create; class Form extends \Magento\Backend\Block\Template { /** - * @var \Magento\Adminhtml\Model\Session\Quote + * @var \Magento\Backend\Model\Session\Quote */ protected $_sessionQuote; + /** + * @var \Magento\GiftMessage\Helper\Message + */ + protected $_messageHelper; + /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote + * @param \Magento\GiftMessage\Helper\Message $messageHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, + \Magento\GiftMessage\Helper\Message $messageHelper, array $data = array() ) { + $this->_messageHelper = $messageHelper; $this->_sessionQuote = $sessionQuote; parent::__construct($context, $data); } @@ -62,6 +70,6 @@ class Form extends \Magento\Backend\Block\Template public function canDisplayGiftmessageForm() { $quote = $this->_sessionQuote->getQuote(); - return $this->helper('Magento\GiftMessage\Helper\Message')->getIsMessagesAvailable('items', $quote, $quote->getStore()); + return $this->_messageHelper->getIsMessagesAvailable('items', $quote, $quote->getStore()); } } diff --git a/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/Create/Items.php b/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/Create/Items.php index 798d57319e6..a5dd2a1f9c6 100644 --- a/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/Create/Items.php +++ b/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/Create/Items.php @@ -35,6 +35,25 @@ namespace Magento\GiftMessage\Block\Adminhtml\Sales\Order\Create; class Items extends \Magento\Backend\Block\Template { + /** + * @var \Magento\GiftMessage\Helper\Message + */ + protected $_messageHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\GiftMessage\Helper\Message $messageHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\GiftMessage\Helper\Message $messageHelper, + array $data = array() + ) { + $this->_messageHelper = $messageHelper; + parent::__construct($context, $data); + } + /** * Get order item * @@ -56,7 +75,7 @@ class Items extends \Magento\Backend\Block\Template if (!$item) { return false; } - return $this->helper('Magento\GiftMessage\Helper\Message')->getIsMessagesAvailable( + return $this->_messageHelper->getIsMessagesAvailable( 'item', $item, $item->getStoreId() ); } @@ -82,7 +101,7 @@ class Items extends \Magento\Backend\Block\Template public function getMessageText() { if ($this->getItem()->getGiftMessageId()) { - $model = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($this->getItem()->getGiftMessageId()); + $model = $this->_messageHelper->getGiftMessage($this->getItem()->getGiftMessageId()); return $this->escapeHtml($model->getMessage()); } return ''; diff --git a/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Items.php b/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Items.php index 8a521ce46f1..8b6eadc73e0 100644 --- a/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Items.php +++ b/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Items.php @@ -42,6 +42,25 @@ class Items extends \Magento\Backend\Block\Template */ protected $_giftMessage = array(); + /** + * @var \Magento\GiftMessage\Helper\Message + */ + protected $_messageHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\GiftMessage\Helper\Message $messageHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\GiftMessage\Helper\Message $messageHelper, + array $data = array() + ) { + $this->_messageHelper = $messageHelper; + parent::__construct($context, $data); + } + /** * Get Order Item * @@ -138,7 +157,7 @@ class Items extends \Magento\Backend\Block\Template protected function _initMessage() { $this->_giftMessage[$this->getItem()->getGiftMessageId()] = - $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($this->getItem()->getGiftMessageId()); + $this->_messageHelper->getGiftMessage($this->getItem()->getGiftMessageId()); // init default values for giftmessage form if(!$this->getMessage()->getSender()) { diff --git a/app/code/Magento/GiftMessage/Block/Message/Inline.php b/app/code/Magento/GiftMessage/Block/Message/Inline.php index ae5fd09b8ef..ac838744377 100644 --- a/app/code/Magento/GiftMessage/Block/Message/Inline.php +++ b/app/code/Magento/GiftMessage/Block/Message/Inline.php @@ -54,18 +54,26 @@ class Inline extends \Magento\View\Element\Template */ protected $_customerSession; + /** + * @var \Magento\Catalog\Helper\Image + */ + protected $_imageHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\GiftMessage\Helper\Message $giftMessageMessage + * @param \Magento\Catalog\Helper\Image $imageHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\GiftMessage\Helper\Message $giftMessageMessage, + \Magento\Catalog\Helper\Image $imageHelper, array $data = array() ) { + $this->_imageHelper = $imageHelper; $this->_giftMessageMessage = $giftMessageMessage; $this->_customerSession = $customerSession; parent::__construct($context, $data); @@ -132,7 +140,7 @@ class Inline extends \Magento\View\Element\Template */ protected function _initMessage() { - $this->_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage( + $this->_giftMessage = $this->_giftMessageMessage->getGiftMessage( $this->getEntity()->getGiftMessageId() ); return $this; @@ -181,7 +189,7 @@ class Inline extends \Magento\View\Element\Template if ($entity) { if (!$entity->getGiftMessage()) { $entity->setGiftMessage( - $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($entity->getGiftMessageId()) + $this->_giftMessageMessage->getGiftMessage($entity->getGiftMessageId()) ); } return $entity->getGiftMessage(); @@ -313,7 +321,7 @@ class Inline extends \Magento\View\Element\Template */ public function getThumbnailUrl($product) { - return (string)$this->helper('Magento\Catalog\Helper\Image')->init($product, 'thumbnail') + return (string)$this->_imageHelper->init($product, 'thumbnail') ->resize($this->getThumbnailSize()); } diff --git a/app/code/Magento/GiftMessage/Model/Save.php b/app/code/Magento/GiftMessage/Model/Save.php index 099d7bb01cd..67a2157c753 100644 --- a/app/code/Magento/GiftMessage/Model/Save.php +++ b/app/code/Magento/GiftMessage/Model/Save.php @@ -46,7 +46,7 @@ class Save extends \Magento\Object protected $_giftMessageMessage = null; /** - * @var \Magento\Adminhtml\Model\Session\Quote + * @var \Magento\Backend\Model\Session\Quote */ protected $_session; @@ -63,13 +63,13 @@ class Save extends \Magento\Object /** * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\GiftMessage\Model\MessageFactory $messageFactory - * @param \Magento\Adminhtml\Model\Session\Quote $session + * @param \Magento\Backend\Model\Session\Quote $session * @param \Magento\GiftMessage\Helper\Message $giftMessageMessage */ public function __construct( \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\GiftMessage\Model\MessageFactory $messageFactory, - \Magento\Adminhtml\Model\Session\Quote $session, + \Magento\Backend\Model\Session\Quote $session, \Magento\GiftMessage\Helper\Message $giftMessageMessage ) { $this->_productFactory = $productFactory; diff --git a/app/code/Magento/GiftMessage/etc/module.xml b/app/code/Magento/GiftMessage/etc/module.xml index e2453e8b042..a49abedaa89 100644 --- a/app/code/Magento/GiftMessage/etc/module.xml +++ b/app/code/Magento/GiftMessage/etc/module.xml @@ -32,7 +32,6 @@ <depends> <module name="Magento_Catalog"/> <module name="Magento_Sales"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Backend"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> diff --git a/app/code/Magento/GoogleCheckout/Block/Adminhtml/Shipping/Merchant.php b/app/code/Magento/GoogleCheckout/Block/Adminhtml/Shipping/Merchant.php index bb89ac76593..87a7bb3479f 100644 --- a/app/code/Magento/GoogleCheckout/Block/Adminhtml/Shipping/Merchant.php +++ b/app/code/Magento/GoogleCheckout/Block/Adminhtml/Shipping/Merchant.php @@ -204,7 +204,7 @@ class Merchant protected function _getAddRowButtonHtml($container, $template, $title='Add') { if (!isset($this->_addRowButtonHtml[$container])) { - $this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setType('button') ->setClass('add ' . $this->_getDisabled()) ->setLabel(__($title)) @@ -218,7 +218,7 @@ class Merchant protected function _getRemoveRowButtonHtml($selector = 'tr', $title = 'Remove') { if (!$this->_removeRowButtonHtml) { - $this->_removeRowButtonHtml = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $this->_removeRowButtonHtml = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setType('button') ->setClass('delete ' . $this->_getDisabled()) ->setLabel(__($title)) diff --git a/app/code/Magento/GoogleCheckout/Controller/Redirect.php b/app/code/Magento/GoogleCheckout/Controller/Redirect.php index 89a54b6f32a..3b0cb39d2f8 100644 --- a/app/code/Magento/GoogleCheckout/Controller/Redirect.php +++ b/app/code/Magento/GoogleCheckout/Controller/Redirect.php @@ -80,7 +80,7 @@ class Redirect extends \Magento\App\Action\Action $api->getResponse(); if ($api->getError()) { - $session->addError($api->getError()); + $this->messageManager->addError($api->getError()); } else { $quote->setIsActive(false)->save(); $session->replaceQuote($storeQuote); diff --git a/app/code/Magento/GoogleCheckout/Model/Api/Xml/AbstractXml.php b/app/code/Magento/GoogleCheckout/Model/Api/Xml/AbstractXml.php index d3e874d55c3..ce20122182f 100644 --- a/app/code/Magento/GoogleCheckout/Model/Api/Xml/AbstractXml.php +++ b/app/code/Magento/GoogleCheckout/Model/Api/Xml/AbstractXml.php @@ -72,7 +72,7 @@ abstract class AbstractXml extends \Magento\Object public function log($text, $nl=true) { - error_log(print_r($text, 1) . ($nl ? "\n" : ''), 3, $this->objectManager->get('Magento\Core\Mode\Dir')->getBaseDir('log') . DS . 'callback.log'); + error_log(print_r($text, 1) . ($nl ? "\n" : ''), 3, $this->objectManager->get('Magento\Core\Mode\Dir')->getBaseDir('log') . '/callback.log'); return $this; } @@ -138,8 +138,8 @@ abstract class AbstractXml extends \Magento\Object //Setup the log file $logDir = $this->objectManager->get('Magento\Core\Mode\Dir')->getBaseDir('log'); $this->getData('g_request')->SetLogFiles( - $logDir . DS . 'googleerror.log', - $logDir . DS . 'googlemessage.log', + $logDir . '/googleerror.log', + $logDir . '/googlemessage.log', L_ALL ); } @@ -168,8 +168,8 @@ abstract class AbstractXml extends \Magento\Object //Setup the log file $logDir = $this->objectManager->get('Magento\Core\Mode\Dir')->getBaseDir('log'); $this->getData('g_response')->SetLogFiles( - $logDir . DS . 'googleerror.log', - $logDir . DS . 'googlemessage.log', + $logDir . '/googleerror.log', + $logDir . '/googlemessage.log', L_ALL ); } diff --git a/app/code/Magento/GoogleCheckout/etc/module.xml b/app/code/Magento/GoogleCheckout/etc/module.xml index 67fa41e43b2..95ced2ddac3 100755 --- a/app/code/Magento/GoogleCheckout/etc/module.xml +++ b/app/code/Magento/GoogleCheckout/etc/module.xml @@ -39,7 +39,6 @@ <module name="Magento_Customer"/> <module name="Magento_Backend"/> <module name="Magento_Shipping"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Weee"/> <module name="Magento_Tax"/> <module name="Magento_Directory"/> diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Captcha.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Captcha.php index feb6bdeef69..2f287e0fdf9 100644 --- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Captcha.php +++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Captcha.php @@ -46,7 +46,7 @@ class Captcha extends \Magento\Backend\Block\Template */ public function getConfirmButtonHtml() { - $confirmButton = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $confirmButton = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => __('Confirm'), 'onclick' => "if($('user_confirm').value != '') diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Items.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Items.php index 899cb38cbb7..e321d7a67d1 100644 --- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Items.php +++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Items.php @@ -33,7 +33,7 @@ */ namespace Magento\GoogleShopping\Block\Adminhtml; -class Items extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Items extends \Magento\Backend\Block\Widget\Grid\Container { protected $_template = 'items.phtml'; diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Items/Item.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Items/Item.php index 697d63b622e..f16cadb0c81 100644 --- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Items/Item.php +++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Items/Item.php @@ -45,17 +45,19 @@ class Item extends \Magento\Backend\Block\Widget\Grid\Extended /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\GoogleShopping\Model\Resource\Item\CollectionFactory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\GoogleShopping\Model\Resource\Item\CollectionFactory $collectionFactory, array $data = array() ) { $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Items/Product.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Items/Product.php index 16da65cafc3..5852f9b4cb3 100644 --- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Items/Product.php +++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Items/Product.php @@ -66,6 +66,7 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Extended /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\GoogleShopping\Model\Resource\Item\CollectionFactory $itemCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $eavCollectionFactory * @param \Magento\Catalog\Model\Product\Type $productType @@ -75,6 +76,7 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Extended public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\GoogleShopping\Model\Resource\Item\CollectionFactory $itemCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $eavCollectionFactory, \Magento\Catalog\Model\Product\Type $productType, @@ -85,7 +87,7 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Extended $this->_eavCollectionFactory = $eavCollectionFactory; $this->_productType = $productType; $this->_productFactory = $productFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit.php index 40a55f0bd98..d078fbbfb1a 100644 --- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit.php +++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit.php @@ -30,7 +30,7 @@ namespace Magento\GoogleShopping\Block\Adminhtml\Types; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Attributes.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Attributes.php index 5b4f748039f..3759e316108 100644 --- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Attributes.php +++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Attributes.php @@ -34,7 +34,7 @@ namespace Magento\GoogleShopping\Block\Adminhtml\Types\Edit; class Attributes - extends \Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset\Element + extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element { protected $_template = 'types/edit/attributes.phtml'; @@ -86,13 +86,13 @@ class Attributes */ protected function _prepareLayout() { - $this->addChild('add_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('add_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add New Attribute'), 'class' => 'add', 'id' => 'add_new_attribute', 'on_click' => 'gContentAttribute.add()' )); - $this->addChild('delete_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('delete_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Remove'), 'class' => 'delete delete-product-option', 'on_click' => 'gContentAttribute.remove(event)' diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php index 377d6ddfaa8..76781008cfc 100644 --- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php +++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php @@ -87,7 +87,7 @@ class Items extends \Magento\Backend\App\Action ) { $_countryInfo = $this->_objectManager->get('Magento\GoogleShopping\Model\Config') ->getTargetCountryInfo($this->_getStore()->getId()); - $this->_getSession()->addNotice( + $this->messageManager->addNotice( __("The store's currency should be set to %1 for %2 in system configuration. Otherwise item prices won't be correct in Google Content.", $_countryInfo['currency_name'], $_countryInfo['name']) ); } @@ -146,7 +146,7 @@ class Items extends \Magento\Backend\App\Action ->addProducts($productIds, $storeId); } catch (\Zend_Gdata_App_CaptchaRequiredException $e) { // Google requires CAPTCHA for login - $this->_getSession()->addError(__($e->getMessage())); + $this->messageManager->addError(__($e->getMessage())); $flag->unlock(); $this->_redirectToCaptcha($e); return; @@ -186,7 +186,7 @@ class Items extends \Magento\Backend\App\Action ->deleteItems($itemIds); } catch (\Zend_Gdata_App_CaptchaRequiredException $e) { // Google requires CAPTCHA for login - $this->_getSession()->addError(__($e->getMessage())); + $this->messageManager->addError(__($e->getMessage())); $flag->unlock(); $this->_redirectToCaptcha($e); return; @@ -226,7 +226,7 @@ class Items extends \Magento\Backend\App\Action ->synchronizeItems($itemIds); } catch (\Zend_Gdata_App_CaptchaRequiredException $e) { // Google requires CAPTCHA for login - $this->_getSession()->addError(__($e->getMessage())); + $this->messageManager->addError(__($e->getMessage())); $flag->unlock(); $this->_redirectToCaptcha($e); return; @@ -257,20 +257,20 @@ class Items extends \Magento\Backend\App\Action ->urlDecode($this->getRequest()->getParam('captcha_token')), $this->getRequest()->getParam('user_confirm') ); - $this->_getSession()->addSuccess(__('Captcha has been confirmed.')); + $this->messageManager->addSuccess(__('Captcha has been confirmed.')); } catch (\Zend_Gdata_App_CaptchaRequiredException $e) { - $this->_getSession()->addError(__('There was a Captcha confirmation error: %1', $e->getMessage())); + $this->messageManager->addError(__('There was a Captcha confirmation error: %1', $e->getMessage())); $this->_redirectToCaptcha($e); return; } catch (\Zend_Gdata_App_Exception $e) { - $this->_getSession()->addError( + $this->messageManager->addError( $this->_objectManager->get('Magento\GoogleShopping\Helper\Data') ->parseGdataExceptionMessage($e->getMessage()) ); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError(__('Something went wrong during Captcha confirmation.')); + $this->messageManager->addError(__('Something went wrong during Captcha confirmation.')); } $this->_redirect('adminhtml/*/index', array('store'=>$storeId)); diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php index 1988ef4076d..1721d4eee82 100644 --- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php +++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php @@ -39,6 +39,7 @@ class Types extends \Magento\Backend\App\Action * @var \Magento\Core\Model\Registry */ protected $_coreRegistry = null; + /** * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Core\Model\Registry $coreRegistry @@ -55,13 +56,13 @@ class Types extends \Magento\Backend\App\Action * Dispatches controller_action_postdispatch_adminhtml Event * * @param RequestInterface $request - * @return $this|mixed|void + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { parent::dispatch($request); if ($this->_actionFlag->get('', self::FLAG_NO_POST_DISPATCH)) { - return; + return $this->_response; } $this->_eventManager->dispatch('controller_action_postdispatch_adminhtml', array('controller_action' => $this)); } @@ -137,7 +138,7 @@ class Types extends \Magento\Backend\App\Action $this->_view->renderLayout(); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError(__("We can't create Attribute Set Mapping.")); + $this->messageManager->addError(__("We can't create Attribute Set Mapping.")); $this->_redirect('adminhtml/*/index', array('store' => $this->_getStore()->getId())); } } @@ -175,7 +176,7 @@ class Types extends \Magento\Backend\App\Action $this->_view->renderLayout(); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError(__("We can't edit Attribute Set Mapping.")); + $this->messageManager->addError(__("We can't edit Attribute Set Mapping.")); $this->_redirect('adminhtml/*/index'); } } @@ -226,16 +227,14 @@ class Types extends \Magento\Backend\App\Action } } - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addSuccess(__('The attribute mapping has been saved.')); + $this->messageManager->addSuccess(__('The attribute mapping has been saved.')); if (!empty($requiredAttributes)) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') + $this->messageManager ->addSuccess($this->_objectManager->get('Magento\GoogleShopping\Helper\Category')->getMessage()); } } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError(__("We can't save Attribute Set Mapping.")); + $this->messageManager->addError(__("We can't save Attribute Set Mapping.")); } $this->_redirect('adminhtml/*/index', array('store' => $this->_getStore()->getId())); } @@ -252,10 +251,10 @@ class Types extends \Magento\Backend\App\Action if ($model->getTypeId()) { $model->delete(); } - $this->_getSession()->addSuccess(__('Attribute set mapping was deleted')); + $this->messageManager->addSuccess(__('Attribute set mapping was deleted')); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError(__("We can't delete Attribute Set Mapping.")); + $this->messageManager->addError(__("We can't delete Attribute Set Mapping.")); } $this->_redirect('adminhtml/*/index', array('store' => $this->_getStore()->getId())); } @@ -276,7 +275,7 @@ class Types extends \Magento\Backend\App\Action } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); // just need to output text with error - $this->_getSession()->addError(__("We can't load attributes.")); + $this->messageManager->addError(__("We can't load attributes.")); } } @@ -294,7 +293,7 @@ class Types extends \Magento\Backend\App\Action } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); // just need to output text with error - $this->_getSession()->addError(__("We can't load attribute sets.")); + $this->messageManager->addError(__("We can't load attribute sets.")); } } diff --git a/app/code/Magento/GoogleShopping/Model/Observer.php b/app/code/Magento/GoogleShopping/Model/Observer.php index 54e08c01f29..495b2dad54e 100644 --- a/app/code/Magento/GoogleShopping/Model/Observer.php +++ b/app/code/Magento/GoogleShopping/Model/Observer.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\GoogleShopping\Model; + /** * Google Shopping Observer - * - * @category Magento - * @package Magento_GoogleShopping - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\GoogleShopping\Model; - class Observer { /** @@ -43,11 +39,9 @@ class Observer protected $_coreStoreConfig; /** - * Admin session - * - * @var \Magento\Core\Model\Session\AbstractSession + * @var \Magento\Message\ManagerInterface */ - protected $_session; + protected $messageManager; /** * Admin session @@ -82,7 +76,7 @@ class Observer * @param \Magento\GoogleShopping\Model\MassOperationsFactory $operationsFactory * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Message\ManagerInterface $messageManager * @param \Magento\GoogleShopping\Model\Flag $flag */ public function __construct( @@ -90,14 +84,14 @@ class Observer \Magento\GoogleShopping\Model\MassOperationsFactory $operationsFactory, \Magento\AdminNotification\Model\InboxFactory $inboxFactory, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Session\AbstractSession $session, + \Magento\Message\ManagerInterface $messageManager, \Magento\GoogleShopping\Model\Flag $flag ) { $this->_collectionFactory = $collectionFactory; $this->_operationsFactory = $operationsFactory; $this->_inboxFactory = $inboxFactory; $this->_coreStoreConfig = $coreStoreConfig; - $this->_session = $session; + $this->messageManager = $messageManager; $this->_flag = $flag; } @@ -115,7 +109,7 @@ class Observer try { $this->_operationsFactory->create()->synchronizeItems($items); } catch (\Zend_Gdata_App_CaptchaRequiredException $e) { - $this->_session->addError('Cannot update Google Content Item. Google requires CAPTCHA.'); + $this->messageManager->addError('Cannot update Google Content Item. Google requires CAPTCHA.'); } return $this; @@ -135,7 +129,7 @@ class Observer try { $this->_operationsFactory->create()->deleteItems($items); } catch (\Zend_Gdata_App_CaptchaRequiredException $e) { - $this->_session->addError('Cannot delete Google Content Item. Google requires CAPTCHA.'); + $this->messageManager->addError('Cannot delete Google Content Item. Google requires CAPTCHA.'); } return $this; diff --git a/app/code/Magento/GoogleShopping/etc/adminhtml/di.xml b/app/code/Magento/GoogleShopping/etc/adminhtml/di.xml index 0297ce65dcb..3648bd7e917 100644 --- a/app/code/Magento/GoogleShopping/etc/adminhtml/di.xml +++ b/app/code/Magento/GoogleShopping/etc/adminhtml/di.xml @@ -26,5 +26,5 @@ */ --> <config> - <preference for="Magento\Core\Model\Session\AbstractSession" type="Magento\Backend\Model\Session" /> + <preference for="Magento\Session\SessionManagerInterface" type="Magento\Backend\Model\Session" /> </config> diff --git a/app/code/Magento/GoogleShopping/etc/adminhtml/routes.xml b/app/code/Magento/GoogleShopping/etc/adminhtml/routes.xml index bee1cd9fd91..2d20a545632 100644 --- a/app/code/Magento/GoogleShopping/etc/adminhtml/routes.xml +++ b/app/code/Magento/GoogleShopping/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_GoogleShopping_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_GoogleShopping" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/GoogleShopping/etc/module.xml b/app/code/Magento/GoogleShopping/etc/module.xml index 4de7eba2176..e6f9b22fbcc 100755 --- a/app/code/Magento/GoogleShopping/etc/module.xml +++ b/app/code/Magento/GoogleShopping/etc/module.xml @@ -29,7 +29,6 @@ <module name="Magento_Catalog"/> </sequence> <depends> - <module name="Magento_Adminhtml"/> <module name="Magento_AdminNotification"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php index b301aa9fba8..75984fa2d04 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php @@ -33,7 +33,7 @@ */ namespace Magento\ImportExport\Block\Adminhtml\Export; -class Filter extends \Magento\Adminhtml\Block\Widget\Grid +class Filter extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Helper object. @@ -52,17 +52,19 @@ class Filter extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\ImportExport\Helper\Data $importExportData * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\ImportExport\Helper\Data $importExportData, array $data = array() ) { $this->_importExportData = $importExportData; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit.php b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit.php index 71f104094f7..d8323350aac 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit.php @@ -33,7 +33,7 @@ */ namespace Magento\ImportExport\Block\Adminhtml\Import; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Internal constructor diff --git a/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php b/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php index 70420f30d4c..ced8632a85c 100644 --- a/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php +++ b/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php @@ -95,13 +95,13 @@ class Export extends \Magento\Backend\App\Action $model->getContentType() ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError(__('Please correct the data sent.')); + $this->messageManager->addError(__('Please correct the data sent.')); } } else { - $this->_getSession()->addError(__('Please correct the data sent.')); + $this->messageManager->addError(__('Please correct the data sent.')); } return $this->_redirect('adminhtml/*/index'); } @@ -146,10 +146,10 @@ class Export extends \Magento\Backend\App\Action $this->_view->renderLayout(); return; } catch (\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } } else { - $this->_getSession()->addError(__('Please correct the data sent.')); + $this->messageManager->addError(__('Please correct the data sent.')); } $this->_redirect('adminhtml/*/index'); } diff --git a/app/code/Magento/ImportExport/Controller/Adminhtml/Import.php b/app/code/Magento/ImportExport/Controller/Adminhtml/Import.php index cb6fa4abe66..c4181c5155f 100644 --- a/app/code/Magento/ImportExport/Controller/Adminhtml/Import.php +++ b/app/code/Magento/ImportExport/Controller/Adminhtml/Import.php @@ -72,7 +72,7 @@ class Import extends \Magento\Backend\App\Action */ public function indexAction() { - $this->_getSession()->addNotice($this->_objectManager->get('Magento\ImportExport\Helper\Data') + $this->messageManager->addNotice($this->_objectManager->get('Magento\ImportExport\Helper\Data') ->getMaxUploadSizeMessage()); $this->_initAction(); $this->_title->add(__('Import')); @@ -132,7 +132,10 @@ class Import extends \Magento\Backend\App\Action try { /** @var $import \Magento\ImportExport\Model\Import */ $import = $this->_objectManager->create('Magento\ImportExport\Model\Import')->setData($data); - $source = \Magento\ImportExport\Model\Import\Adapter::findAdapterFor($import->uploadSource()); + $source = \Magento\ImportExport\Model\Import\Adapter::findAdapterFor( + $import->uploadSource(), + $this->_objectManager->create('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::ROOT) + ); $validationResult = $import->validateSource($source); if (!$import->getProcessedRowsCount()) { @@ -170,7 +173,7 @@ class Import extends \Magento\Backend\App\Action $resultBlock->addError(__('File was not uploaded')); $this->_view->renderLayout(); } else { - $this->_getSession()->addError(__('Data is invalid or file is not uploaded')); + $this->messageManager->addError(__('Data is invalid or file is not uploaded')); $this->_redirect('adminhtml/*/index'); } } diff --git a/app/code/Magento/ImportExport/Model/AbstractModel.php b/app/code/Magento/ImportExport/Model/AbstractModel.php index babc37bf781..b30dcbc14ce 100644 --- a/app/code/Magento/ImportExport/Model/AbstractModel.php +++ b/app/code/Magento/ImportExport/Model/AbstractModel.php @@ -68,9 +68,9 @@ abstract class AbstractModel extends \Magento\Object protected $_logger; /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem\Directory\WriteInterface */ - protected $_dir; + protected $_varDirectory; /** * @var \Magento\Core\Model\Log\AdapterFactory @@ -79,18 +79,18 @@ abstract class AbstractModel extends \Magento\Object /** * @param \Magento\Logger $logger - * @param \Magento\App\Dir $dir + * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\Log\AdapterFactory $adapterFactory * @param array $data */ public function __construct( \Magento\Logger $logger, - \Magento\App\Dir $dir, + \Magento\Filesystem $filesystem, \Magento\Core\Model\Log\AdapterFactory $adapterFactory, array $data = array() ) { $this->_logger = $logger; - $this->_dir = $dir; + $this->_varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); $this->_adapterFactory = $adapterFactory; parent::__construct($data); } @@ -114,21 +114,19 @@ abstract class AbstractModel extends \Magento\Object } if (!$this->_logInstance) { - $dirName = date('Y' . DS .'m' . DS .'d' . DS); + $dirName = date('Y/m/d/'); $fileName = join('_', array( str_replace(':', '-', $this->getRunAt()), $this->getScheduledOperationId(), $this->getOperationType(), $this->getEntity() )); - $dirPath = $this->_dir->getDir('var') . DS . \Magento\ImportExport\Model\Scheduled\Operation::LOG_DIRECTORY - . $dirName; - if (!is_dir($dirPath)) { - mkdir($dirPath, 0777, true); - } - $fileName = substr(strstr(\Magento\ImportExport\Model\Scheduled\Operation::LOG_DIRECTORY, DS), 1) - . $dirName . $fileName . '.log'; - $this->_logInstance = $this->_adapterFactory->create(array('fileName' => $fileName)) + $path = 'import_export/'. $dirName; + $this->_varDirectory->create($path); + + $fileName = $path . $fileName . '.log'; + $this->_logInstance = $this->_adapterFactory + ->create(array('fileName' => $this->_varDirectory->getAbsolutePath($fileName))) ->setFilterDataKeys($this->_debugReplacePrivateDataKeys); } $this->_logInstance->log($debugData); diff --git a/app/code/Magento/ImportExport/Model/Export.php b/app/code/Magento/ImportExport/Model/Export.php index b73c96a8bf9..1105c07dff3 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\App\Dir $dir + * @param \Magento\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\App\Dir $dir, + \Magento\Filesystem $filesystem, \Magento\Core\Model\Log\AdapterFactory $adapterFactory, \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig, \Magento\ImportExport\Model\Export\Entity\Factory $entityFactory, @@ -96,7 +96,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel $this->_exportConfig = $exportConfig; $this->_entityFactory = $entityFactory; $this->_exportAdapterFac = $exportAdapterFac; - parent::__construct($logger, $dir, $adapterFactory, $data); + parent::__construct($logger, $filesystem, $adapterFactory, $data); } /** diff --git a/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php b/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php index c8275dc00d1..a3da9377c05 100644 --- a/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php +++ b/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php @@ -50,22 +50,32 @@ abstract class AbstractAdapter protected $_headerCols = null; /** - * @param null $destination + * @var \Magento\Filesystem\Directory\Write */ - public function __construct($destination = null) + protected $_directoryHandle; + + /** + * Constructor + * + * @param \Magento\Filesystem $filesystem + * @param null $destination + * @throws \Magento\Core\Exception + */ + public function __construct(\Magento\Filesystem $filesystem, $destination = null) { + $this->_directoryHandle = $filesystem->getDirectoryWrite(\Magento\Filesystem::SYS_TMP); if (!$destination) { - $destination = tempnam(sys_get_temp_dir(), 'importexport_'); + $destination = uniqid('importexport_'); + $this->_directoryHandle->touch($destination); } if (!is_string($destination)) { throw new \Magento\Core\Exception(__('Destination file path must be a string')); } - $pathinfo = pathinfo($destination); - if (empty($pathinfo['dirname']) || !is_writable($pathinfo['dirname'])) { + if (!$this->_directoryHandle->isWritable()) { throw new \Magento\Core\Exception(__('Destination directory is not writable')); } - if (is_file($destination) && !is_writable($destination)) { + if ($this->_directoryHandle->isFile($destination) && !$this->_directoryHandle->isWritable($destination)) { throw new \Magento\Core\Exception(__('Destination file is not writable')); } @@ -91,7 +101,7 @@ abstract class AbstractAdapter */ public function getContents() { - return file_get_contents($this->_destination); + return $this->_directoryHandle->readFile($this->_destination); } /** diff --git a/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php b/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php index 37f44eeba40..6d6b52a8b7b 100644 --- a/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php +++ b/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php @@ -52,7 +52,7 @@ class Csv extends \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter /** * Source file handler. * - * @var resource + * @var \Magento\Filesystem\File\Write */ protected $_fileHandler; @@ -63,8 +63,8 @@ class Csv extends \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter */ public function __destruct() { - if (is_resource($this->_fileHandler)) { - fclose($this->_fileHandler); + if (is_object($this->_fileHandler)) { + $this->_fileHandler->close(); } } @@ -75,7 +75,7 @@ class Csv extends \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter */ protected function _init() { - $this->_fileHandler = fopen($this->_destination, 'w'); + $this->_fileHandler = $this->_directoryHandle->openFile($this->_destination, 'w'); return $this; } @@ -115,7 +115,7 @@ class Csv extends \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter foreach ($headerColumns as $columnName) { $this->_headerCols[$columnName] = false; } - fputcsv($this->_fileHandler, array_keys($this->_headerCols), $this->_delimiter, $this->_enclosure); + $this->_fileHandler->writeCsv(array_keys($this->_headerCols), $this->_delimiter, $this->_enclosure); } return $this; } @@ -132,13 +132,11 @@ class Csv extends \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter if (null === $this->_headerCols) { $this->setHeaderCols(array_keys($rowData)); } - fputcsv( - $this->_fileHandler, + $this->_fileHandler->writeCsv( array_merge($this->_headerCols, array_intersect_key($rowData, $this->_headerCols)), $this->_delimiter, $this->_enclosure ); - return $this; } } diff --git a/app/code/Magento/ImportExport/Model/Export/Config/SchemaLocator.php b/app/code/Magento/ImportExport/Model/Export/Config/SchemaLocator.php index de38998f8b9..258e95ece56 100644 --- a/app/code/Magento/ImportExport/Model/Export/Config/SchemaLocator.php +++ b/app/code/Magento/ImportExport/Model/Export/Config/SchemaLocator.php @@ -45,8 +45,8 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $etcDir = $moduleReader->getModuleDir('etc', 'Magento_ImportExport'); - $this->_schema = $etcDir . DIRECTORY_SEPARATOR . 'export_merged.xsd'; - $this->_perFileSchema = $etcDir . DIRECTORY_SEPARATOR . 'export.xsd'; + $this->_schema = $etcDir . '/export_merged.xsd'; + $this->_perFileSchema = $etcDir . '/export.xsd'; } /** diff --git a/app/code/Magento/ImportExport/Model/Import.php b/app/code/Magento/ImportExport/Model/Import.php index 5464fe6ec42..505368b7214 100644 --- a/app/code/Magento/ImportExport/Model/Import.php +++ b/app/code/Magento/ImportExport/Model/Import.php @@ -132,9 +132,14 @@ class Import extends \Magento\ImportExport\Model\AbstractModel */ protected $_behaviorFactory; + /** + * @var \Magento\Filesystem + */ + protected $_filesystem; + /** * @param \Magento\Logger $logger - * @param \Magento\App\Dir $dir + * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\Log\AdapterFactory $adapterFactory * @param \Magento\ImportExport\Helper\Data $importExportData * @param \Magento\Core\Model\Config $coreConfig @@ -150,7 +155,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel */ public function __construct( \Magento\Logger $logger, - \Magento\App\Dir $dir, + \Magento\Filesystem $filesystem, \Magento\Core\Model\Log\AdapterFactory $adapterFactory, \Magento\ImportExport\Helper\Data $importExportData, \Magento\Core\Model\Config $coreConfig, @@ -174,7 +179,8 @@ class Import extends \Magento\ImportExport\Model\AbstractModel $this->_uploaderFactory = $uploaderFactory; $this->_indexer = $indexer; $this->_behaviorFactory = $behaviorFactory; - parent::__construct($logger, $dir, $adapterFactory, $data); + $this->_filesystem = $filesystem; + parent::__construct($logger, $filesystem, $adapterFactory, $data); } /** @@ -228,7 +234,10 @@ class Import extends \Magento\ImportExport\Model\AbstractModel */ protected function _getSourceAdapter($sourceFile) { - return \Magento\ImportExport\Model\Import\Adapter::findAdapterFor($sourceFile); + return \Magento\ImportExport\Model\Import\Adapter::findAdapterFor( + $sourceFile, + $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT) + ); } /** @@ -410,7 +419,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel */ public function getWorkingDir() { - return $this->_dir->getDir('var') . DS . 'importexport' . DS; + return $this->_varDirectory->getAbsolutePath('importexport/'); } /** @@ -536,19 +545,25 @@ class Import extends \Magento\ImportExport\Model\AbstractModel $uploadedFile = $result['path'] . $result['file']; if (!$extension) { - unlink($uploadedFile); + $this->_varDirectory->delete($uploadedFile); throw new \Magento\Core\Exception(__('Uploaded file has no extension')); } $sourceFile = $this->getWorkingDir() . $entity; $sourceFile .= '.' . $extension; + $sourceFileRelative = $this->_varDirectory->getRelativePath($sourceFile); if (strtolower($uploadedFile) != strtolower($sourceFile)) { - if (file_exists($sourceFile)) { - unlink($sourceFile); + if ($this->_varDirectory->isExist($sourceFileRelative)) { + $this->_varDirectory->delete($sourceFileRelative); } - if (!@rename($uploadedFile, $sourceFile)) { + try { + $this->_varDirectory->renameFile( + $this->_varDirectory->getRelativePath($uploadedFile), + $sourceFileRelative + ); + } catch (\Magento\Filesystem\FilesystemException $e) { throw new \Magento\Core\Exception(__('Source file moving failed')); } } @@ -557,7 +572,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel try { $this->_getSourceAdapter($sourceFile); } catch (\Exception $e) { - unlink($sourceFile); + $this->_varDirectory->delete($sourceFileRelative); throw new \Magento\Core\Exception($e->getMessage()); } return $sourceFile; @@ -571,10 +586,10 @@ class Import extends \Magento\ImportExport\Model\AbstractModel */ protected function _removeBom($sourceFile) { - $string = file_get_contents($sourceFile); + $string = $this->_varDirectory->readFile($this->_varDirectory->getRelativePath($sourceFile)); if ($string !== false && substr($string, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) { $string = substr($string, 3); - file_put_contents($sourceFile, $string); + $this->_varDirectory->writeFile($this->_varDirectory->getRelativePath($sourceFile), $string); } return $this; } diff --git a/app/code/Magento/ImportExport/Model/Import/Adapter.php b/app/code/Magento/ImportExport/Model/Import/Adapter.php index 5a9c4985609..1a80c4a60bb 100644 --- a/app/code/Magento/ImportExport/Model/Import/Adapter.php +++ b/app/code/Magento/ImportExport/Model/Import/Adapter.php @@ -39,11 +39,12 @@ class Adapter * Adapter factory. Checks for availability, loads and create instance of import adapter object. * * @param string $type Adapter type ('csv', 'xml' etc.) + * @param \Magento\Filesystem\Directory\Write $directory * @param mixed $options OPTIONAL Adapter constructor options * @throws \Exception * @return \Magento\ImportExport\Model\Import\AbstractSource */ - public static function factory($type, $options = null) + public static function factory($type, $directory, $options = null) { if (!is_string($type) || !$type) { throw new \Magento\Core\Exception(__('The adapter type must be a non empty string.')); @@ -53,7 +54,7 @@ class Adapter if (!class_exists($adapterClass)) { throw new \Magento\Core\Exception("'{$type}' file extension is not supported"); } - $adapter = new $adapterClass($options); + $adapter = new $adapterClass($options, $directory); if (! $adapter instanceof \Magento\ImportExport\Model\Import\AbstractSource) { throw new \Magento\Core\Exception( @@ -67,10 +68,11 @@ class Adapter * Create adapter instance for specified source file. * * @param string $source Source file path. + * @param \Magento\Filesystem\Directory\Write $directory * @return \Magento\ImportExport\Model\Import\AbstractSource */ - public static function findAdapterFor($source) + public static function findAdapterFor($source, $directory) { - return self::factory(pathinfo($source, PATHINFO_EXTENSION), $source); + return self::factory(pathinfo($source, PATHINFO_EXTENSION), $directory, $source); } } diff --git a/app/code/Magento/ImportExport/Model/Import/Config/SchemaLocator.php b/app/code/Magento/ImportExport/Model/Import/Config/SchemaLocator.php index d7eb2c0e892..50ad8025b22 100644 --- a/app/code/Magento/ImportExport/Model/Import/Config/SchemaLocator.php +++ b/app/code/Magento/ImportExport/Model/Import/Config/SchemaLocator.php @@ -45,8 +45,8 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $etcDir = $moduleReader->getModuleDir('etc', 'Magento_ImportExport'); - $this->_schema = $etcDir . DIRECTORY_SEPARATOR . 'import_merged.xsd'; - $this->_perFileSchema = $etcDir . DIRECTORY_SEPARATOR . 'import.xsd'; + $this->_schema = $etcDir . '/import_merged.xsd'; + $this->_perFileSchema = $etcDir . '/import.xsd'; } /** diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php index bbd505dcc83..e94052612a5 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php @@ -373,9 +373,9 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity protected $_uploaderFactory; /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem\Directory\WriteInterface */ - protected $_dir; + protected $_mediaDirectory; /** * @var \Magento\CatalogInventory\Model\Resource\Stock\ItemFactory @@ -397,6 +397,11 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity */ protected $dateTime; + /** + * @var \Magento\Logger + */ + private $_logger; + /** * @param \Magento\Core\Helper\Data $coreData * @param \Magento\ImportExport\Helper\Data $importExportData @@ -420,11 +425,12 @@ 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\App\Dir $dir + * @param \Magento\Filesystem $filesystem * @param \Magento\CatalogInventory\Model\Resource\Stock\ItemFactory $stockResItemFac * @param \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Logger $logger * @param array $data */ public function __construct( @@ -450,11 +456,12 @@ 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\App\Dir $dir, + \Magento\Filesystem $filesystem, \Magento\CatalogInventory\Model\Resource\Stock\ItemFactory $stockResItemFac, \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory, \Magento\Core\Model\LocaleInterface $locale, \Magento\Stdlib\DateTime $dateTime, + \Magento\Logger $logger, array $data = array() ) { $this->_eventManager = $eventManager; @@ -471,11 +478,12 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $this->_linkFactory = $linkFactory; $this->_proxyProdFactory = $proxyProdFactory; $this->_uploaderFactory = $uploaderFactory; - $this->_dir = $dir; + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); $this->_stockResItemFac = $stockResItemFac; $this->_stockItemFactory = $stockItemFactory; $this->_locale = $locale; $this->dateTime = $dateTime; + $this->_logger = $logger; parent::__construct( $coreData, $importExportData, @@ -679,7 +687,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity foreach ($productTypes as $productTypeName => $productTypeConfig) { $params = array($this, $productTypeName); if (!($model = $this->_productTypeFactory->create($productTypeConfig['model'], array('params' => $params)))) { - throw new \Magento\Core\Exception("Entity type model '{$productTypeConfig['model']}' is not found"); + throw new \Magento\Core\Exception(sprintf("Entity type model '%s' is not found", $productTypeConfig['model'])); } if (! $model instanceof \Magento\ImportExport\Model\Import\Entity\Product\Type\AbstractType) { throw new \Magento\Core\Exception(__('Entity type model must be an instance of ' @@ -942,6 +950,19 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity } else { $linkedId = $this->_oldSku[$linkedSku]['entity_id']; } + + if ($linkedId == null) { + // Import file links to a SKU which is skipped for some reason, which leads to a "NULL" + // link causing fatal errors. + $this->_logger->logException( + new \Exception( + sprintf('WARNING: Orphaned link skipped: From SKU %s (ID %d) to SKU %s, ' . + 'Link type id: %d', $sku, $productId, $linkedSku, $linkId) + ) + ); + continue; + } + $linkKey = "{$productId}-{$linkedId}-{$linkId}"; if (!isset($linkRows[$linkKey])) { @@ -1389,20 +1410,16 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $this->_fileUploader->init(); - $mediaDir = $this->_dir->getDir(\Magento\App\Dir::MEDIA); - if (!$mediaDir) { - throw new \Magento\Exception('Media directory is unavailable.'); - } - $tmpDir = "{$mediaDir}/import"; - if (!$this->_fileUploader->setTmpDir($tmpDir)) { - throw new \Magento\Core\Exception("File directory '{$tmpDir}' is not readable."); + $tmpPath = $this->_mediaDirectory->getAbsolutePath('import'); + if (!$this->_fileUploader->setTmpDir($tmpPath)) { + throw new \Magento\Core\Exception(sprintf("File directory '%s' is not readable.", $tmpPath)); } - $destDir = "{$mediaDir}/catalog/product"; - if (!is_dir($destDir)) { - mkdir($destDir, 0777, true); - } - if (!$this->_fileUploader->setDestDir($destDir)) { - throw new \Magento\Core\Exception("File directory '{$destDir}' is not writable."); + $destinationDir = "catalog/product"; + $destinationPath = $this->_mediaDirectory->getAbsolutePath($destinationDir); + + $this->_mediaDirectory->create($destinationDir); + if (!$this->_fileUploader->setDestDir($destinationPath)) { + throw new \Magento\Core\Exception(sprintf("File directory '%s' is not writable.", $destinationPath)); } } return $this->_fileUploader; diff --git a/app/code/Magento/ImportExport/Model/Import/Source/Csv.php b/app/code/Magento/ImportExport/Model/Import/Source/Csv.php index b56628d0b9d..05050bf4b92 100644 --- a/app/code/Magento/ImportExport/Model/Import/Source/Csv.php +++ b/app/code/Magento/ImportExport/Model/Import/Source/Csv.php @@ -32,7 +32,7 @@ namespace Magento\ImportExport\Model\Import\Source; class Csv extends \Magento\ImportExport\Model\Import\AbstractSource { /** - * @var resource + * @var \Magento\Filesystem\File\Write */ protected $_file; @@ -52,14 +52,20 @@ class Csv extends \Magento\ImportExport\Model\Import\AbstractSource * There must be column names in the first line * * @param string $fileOrStream + * @param \Magento\Filesystem\Directory\Write $directory * @param string $delimiter * @param string $enclosure * @throws \LogicException */ - public function __construct($fileOrStream, $delimiter = ',', $enclosure = '"') - { - $this->_file = @fopen($fileOrStream, 'r'); - if (false === $this->_file) { + public function __construct( + $fileOrStream, + \Magento\Filesystem\Directory\Write $directory, + $delimiter = ',', + $enclosure = '"' + ) { + try { + $this->_file = $directory->openFile($directory->getRelativePath($fileOrStream), 'r'); + } catch(\Magento\Filesystem\FilesystemException $e) { throw new \LogicException("Unable to open file or stream: '{$fileOrStream}'"); } $this->_delimiter = $delimiter; @@ -72,8 +78,8 @@ class Csv extends \Magento\ImportExport\Model\Import\AbstractSource */ public function __destruct() { - if (is_resource($this->_file)) { - fclose($this->_file); + if (is_object($this->_file)) { + $this->_file->close(); } } @@ -84,7 +90,7 @@ class Csv extends \Magento\ImportExport\Model\Import\AbstractSource */ protected function _getNextRow() { - return fgetcsv($this->_file, null, $this->_delimiter, $this->_enclosure); + return $this->_file->readCsv(0, $this->_delimiter, $this->_enclosure); } /** @@ -92,7 +98,7 @@ class Csv extends \Magento\ImportExport\Model\Import\AbstractSource */ public function rewind() { - rewind($this->_file); + $this->_file->seek(0); $this->_getNextRow(); // skip first line with the header parent::rewind(); } diff --git a/app/code/Magento/ImportExport/Model/Import/Uploader.php b/app/code/Magento/ImportExport/Model/Import/Uploader.php index f8eb4a9e97d..8303d699124 100644 --- a/app/code/Magento/ImportExport/Model/Import/Uploader.php +++ b/app/code/Magento/ImportExport/Model/Import/Uploader.php @@ -67,6 +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, $filePath = null ) { if (!is_null($filePath)) { @@ -76,6 +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); } /** @@ -100,7 +102,7 @@ class Uploader extends \Magento\Core\Model\File\Uploader */ public function move($fileName) { - $filePath = realpath($this->getTmpDir() . DS . $fileName); + $filePath = $this->_directory->getRelativePath($this->getTmpDir() . '/' . $fileName); $this->_setUploadFile($filePath); $result = $this->save($this->getDestDir()); $result['name'] = self::getCorrectFileName($result['name']); @@ -111,10 +113,11 @@ class Uploader extends \Magento\Core\Model\File\Uploader * Prepare information about the file for moving * * @param string $filePath + * @throws \Magento\Core\Exception */ protected function _setUploadFile($filePath) { - if (!is_readable($filePath)) { + if (!$this->_directory->isReadable($filePath)) { throw new \Magento\Core\Exception("File '{$filePath}' was not found or has read restriction."); } $this->_file = $this->_readFileInfo($filePath); @@ -131,13 +134,12 @@ class Uploader extends \Magento\Core\Model\File\Uploader protected function _readFileInfo($filePath) { $fileInfo = pathinfo($filePath); - return array( 'name' => $fileInfo['basename'], 'type' => $this->_getMimeTypeByExt($fileInfo['extension']), 'tmp_name' => $filePath, 'error' => 0, - 'size' => filesize($filePath) + 'size' => $this->_directory->stat($filePath)['size'] ); } @@ -147,7 +149,7 @@ class Uploader extends \Magento\Core\Model\File\Uploader protected function _validateFile() { $filePath = $this->_file['tmp_name']; - if (is_readable($filePath)) { + if ($this->_directory->isReadable($filePath)) { $this->_fileExists = true; } else { $this->_fileExists = false; @@ -197,7 +199,7 @@ class Uploader extends \Magento\Core\Model\File\Uploader */ public function setTmpDir($path) { - if (is_string($path) && is_readable($path)) { + if (is_string($path) && $this->_directory->isReadable($path)) { $this->_tmpDir = $path; return true; } @@ -222,7 +224,7 @@ class Uploader extends \Magento\Core\Model\File\Uploader */ public function setDestDir($path) { - if (is_string($path) && is_writable($path)) { + if (is_string($path) && $this->_directory->isWritable($path)) { $this->_destDir = $path; return true; } @@ -238,9 +240,8 @@ class Uploader extends \Magento\Core\Model\File\Uploader */ protected function _moveFile($tmpPath, $destPath) { - $sourceFile = realpath($tmpPath); - if ($sourceFile !== false) { - return copy($sourceFile, $destPath); + if ($this->_directory->isFile($tmpPath)) { + return $this->_directory->copyFile($tmpPath, $destPath); } else { return false; } diff --git a/app/code/Magento/ImportExport/etc/adminhtml/menu.xml b/app/code/Magento/ImportExport/etc/adminhtml/menu.xml index 55731334be9..c60bc710ae8 100644 --- a/app/code/Magento/ImportExport/etc/adminhtml/menu.xml +++ b/app/code/Magento/ImportExport/etc/adminhtml/menu.xml @@ -27,7 +27,7 @@ --> <config> <menu> - <add id="Magento_ImportExport::system_convert_import" title="Import" module="Magento_ImportExport" sortOrder="10" parent="Magento_Adminhtml::system_convert" action="adminhtml/import" resource="Magento_ImportExport::import"/> - <add id="Magento_ImportExport::system_convert_export" title="Export" module="Magento_ImportExport" sortOrder="20" parent="Magento_Adminhtml::system_convert" action="adminhtml/export" resource="Magento_ImportExport::export"/> + <add id="Magento_ImportExport::system_convert_import" title="Import" module="Magento_ImportExport" sortOrder="10" parent="Magento_Backend::system_convert" action="adminhtml/import" resource="Magento_ImportExport::import"/> + <add id="Magento_ImportExport::system_convert_export" title="Export" module="Magento_ImportExport" sortOrder="20" parent="Magento_Backend::system_convert" action="adminhtml/export" resource="Magento_ImportExport::export"/> </menu> </config> diff --git a/app/code/Magento/ImportExport/etc/adminhtml/routes.xml b/app/code/Magento/ImportExport/etc/adminhtml/routes.xml index 44fe1d587fe..4d2afd2324a 100644 --- a/app/code/Magento/ImportExport/etc/adminhtml/routes.xml +++ b/app/code/Magento/ImportExport/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_ImportExport_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_ImportExport" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/ImportExport/etc/module.xml b/app/code/Magento/ImportExport/etc/module.xml index c8efbd41ed0..cfe80541cf7 100755 --- a/app/code/Magento/ImportExport/etc/module.xml +++ b/app/code/Magento/ImportExport/etc/module.xml @@ -30,7 +30,6 @@ </sequence> <depends> <module name="Magento_Catalog"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> <module name="Magento_Eav"/> diff --git a/app/code/Magento/Index/App/Indexer.php b/app/code/Magento/Index/App/Indexer.php index 6278facb48f..da88be113fb 100644 --- a/app/code/Magento/Index/App/Indexer.php +++ b/app/code/Magento/Index/App/Indexer.php @@ -25,8 +25,7 @@ */ namespace Magento\Index\App; -use Magento\AppInterface, - Magento\Filesystem; +use Magento\AppInterface; class Indexer implements AppInterface { @@ -43,18 +42,18 @@ class Indexer implements AppInterface protected $_filesystem; /** - * @var Magento\Index\Model\IndexerFactory + * @var \Magento\Index\Model\IndexerFactory */ protected $_indexerFactory; /** * @param string $reportDir - * @param Filesystem $filesystem + * @param \Magento\Filesystem $filesystem * @param \Magento\Index\Model\IndexerFactory $indexerFactory */ public function __construct( $reportDir, - Filesystem $filesystem, + \Magento\Filesystem $filesystem, \Magento\Index\Model\IndexerFactory $indexerFactory ) { $this->_reportDir = $reportDir; @@ -70,7 +69,11 @@ class Indexer implements AppInterface public function execute() { /* Clean reports */ - $this->_filesystem->delete($this->_reportDir, dirname($this->_reportDir)); + $directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $path = $directory->getRelativePath($this->_reportDir); + if ($directory->isExist($path)) { + $directory->delete($path); + } /* Run all indexer processes */ /** @var $indexer \Magento\Index\Model\Indexer */ diff --git a/app/code/Magento/Index/Block/Adminhtml/Process.php b/app/code/Magento/Index/Block/Adminhtml/Process.php index a2db7a34dd0..28105118d51 100644 --- a/app/code/Magento/Index/Block/Adminhtml/Process.php +++ b/app/code/Magento/Index/Block/Adminhtml/Process.php @@ -26,7 +26,7 @@ namespace Magento\Index\Block\Adminhtml; -class Process extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Process extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() { diff --git a/app/code/Magento/Index/Block/Adminhtml/Process/Edit.php b/app/code/Magento/Index/Block/Adminhtml/Process/Edit.php index d6a76b0afed..db7f5627110 100644 --- a/app/code/Magento/Index/Block/Adminhtml/Process/Edit.php +++ b/app/code/Magento/Index/Block/Adminhtml/Process/Edit.php @@ -26,7 +26,7 @@ namespace Magento\Index\Block\Adminhtml\Process; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Index/Block/Adminhtml/Process/Edit/Tabs.php b/app/code/Magento/Index/Block/Adminhtml/Process/Edit/Tabs.php index 48bcd8cd85e..aef9b217cd4 100644 --- a/app/code/Magento/Index/Block/Adminhtml/Process/Edit/Tabs.php +++ b/app/code/Magento/Index/Block/Adminhtml/Process/Edit/Tabs.php @@ -26,7 +26,7 @@ namespace Magento\Index\Block\Adminhtml\Process\Edit; -class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs +class Tabs extends \Magento\Backend\Block\Widget\Tabs { protected function _construct() diff --git a/app/code/Magento/Index/Block/Adminhtml/Process/Grid.php b/app/code/Magento/Index/Block/Adminhtml/Process/Grid.php index 093f93ea5fa..c2f5f32d66a 100644 --- a/app/code/Magento/Index/Block/Adminhtml/Process/Grid.php +++ b/app/code/Magento/Index/Block/Adminhtml/Process/Grid.php @@ -26,7 +26,7 @@ namespace Magento\Index\Block\Adminhtml\Process; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Process model @@ -57,6 +57,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Index\Model\Resource\Process\CollectionFactory $factory * @param \Magento\Index\Model\Process $indexProcess * @param \Magento\Index\Model\EventRepository $eventRepository @@ -65,12 +66,13 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Index\Model\Resource\Process\CollectionFactory $factory, \Magento\Index\Model\Process $indexProcess, \Magento\Index\Model\EventRepository $eventRepository, array $data = array() ) { - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); $this->_eventRepository = $eventRepository; $this->_indexProcess = $indexProcess; $this->_collectionFactory = $factory; @@ -212,7 +214,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid * * @param string $value * @param \Magento\Index\Model\Process $row - * @param \Magento\Adminhtml\Block\Widget\Grid\Column $column + * @param \Magento\Backend\Block\Widget\Grid\Column $column * @param bool $isExport * * @return string @@ -239,7 +241,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid * * @param string $value * @param \Magento\Index\Model\Process $row - * @param \Magento\Adminhtml\Block\Widget\Grid\Column $column + * @param \Magento\Backend\Block\Widget\Grid\Column $column * @param bool $isExport * * @return string @@ -263,7 +265,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid * * @param string $value * @param \Magento\Index\Model\Process $row - * @param \Magento\Adminhtml\Block\Widget\Grid\Column $column + * @param \Magento\Backend\Block\Widget\Grid\Column $column * @param bool $isExport * * @return string diff --git a/app/code/Magento/Index/Block/Adminhtml/Process/Grid/Massaction.php b/app/code/Magento/Index/Block/Adminhtml/Process/Grid/Massaction.php index 1d4477498ae..a2b610b5723 100644 --- a/app/code/Magento/Index/Block/Adminhtml/Process/Grid/Massaction.php +++ b/app/code/Magento/Index/Block/Adminhtml/Process/Grid/Massaction.php @@ -33,7 +33,7 @@ */ namespace Magento\Index\Block\Adminhtml\Process\Grid; -class Massaction extends \Magento\Adminhtml\Block\Widget\Grid\Massaction\AbstractMassaction +class Massaction extends \Magento\Backend\Block\Widget\Grid\Massaction\Extended { /** * Get ids for only visible indexers diff --git a/app/code/Magento/Index/Controller/Adminhtml/Process.php b/app/code/Magento/Index/Controller/Adminhtml/Process.php index a93292cff0c..9d7f88a6ddb 100644 --- a/app/code/Magento/Index/Controller/Adminhtml/Process.php +++ b/app/code/Magento/Index/Controller/Adminhtml/Process.php @@ -112,7 +112,7 @@ class Process extends \Magento\Backend\App\Action $this->_view->loadLayout(); $this->_view->renderLayout(); } else { - $this->_getSession()->addError( + $this->messageManager->addError( __('Cannot initialize the indexer process.') ); $this->_redirect('adminhtml/*/list'); @@ -133,19 +133,19 @@ class Process extends \Magento\Backend\App\Action } try { $process->save(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('The index has been saved.') ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException($e, + $this->messageManager->addException($e, __('There was a problem with saving process.') ); } $this->_redirect('adminhtml/*/list'); } else { - $this->_getSession()->addError( + $this->messageManager->addError( __('Cannot initialize the indexer process.') ); $this->_redirect('adminhtml/*/list'); @@ -165,18 +165,18 @@ class Process extends \Magento\Backend\App\Action $process->reindexEverything(); \Magento\Profiler::stop('__INDEX_PROCESS_REINDEX_ALL__'); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('%1 index was rebuilt.', $process->getIndexer()->getName()) ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException($e, + $this->messageManager->addException($e, __('There was a problem with reindexing process.') ); } } else { - $this->_getSession()->addError( + $this->messageManager->addError( __('Cannot initialize the indexer process.') ); } @@ -208,7 +208,7 @@ class Process extends \Magento\Backend\App\Action { $processIds = $this->getRequest()->getParam('process'); if (empty($processIds) || !is_array($processIds)) { - $this->_getSession()->addError(__('Please select Indexes')); + $this->messageManager->addError(__('Please select Indexes')); } else { try { $counter = 0; @@ -220,13 +220,13 @@ class Process extends \Magento\Backend\App\Action $counter++; } } - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('Total of %1 index(es) have reindexed data.', $counter) ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException($e, __('Cannot initialize the indexer process.')); + $this->messageManager->addException($e, __('Cannot initialize the indexer process.')); } } @@ -241,7 +241,7 @@ class Process extends \Magento\Backend\App\Action { $processIds = $this->getRequest()->getParam('process'); if (empty($processIds) || !is_array($processIds)) { - $this->_getSession()->addError(__('Please select Index(es)')); + $this->messageManager->addError(__('Please select Index(es)')); } else { try { $counter = 0; @@ -254,13 +254,13 @@ class Process extends \Magento\Backend\App\Action $counter++; } } - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('Total of %1 index(es) have changed index mode.', $counter) ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException($e, __('Cannot initialize the indexer process.')); + $this->messageManager->addException($e, __('Cannot initialize the indexer process.')); } } diff --git a/app/code/Magento/Index/Model/Indexer/Config/SchemaLocator.php b/app/code/Magento/Index/Model/Indexer/Config/SchemaLocator.php index 56f3ec2357f..99df945856e 100644 --- a/app/code/Magento/Index/Model/Indexer/Config/SchemaLocator.php +++ b/app/code/Magento/Index/Model/Indexer/Config/SchemaLocator.php @@ -46,10 +46,8 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface */ public function __construct(\Magento\Module\Dir\Reader $moduleReader) { - $this->_schema - = $moduleReader->getModuleDir('etc', 'Magento_Index') . DIRECTORY_SEPARATOR . 'indexers_merged.xsd'; - $this->_perFileSchema - = $moduleReader->getModuleDir('etc', 'Magento_Index') . DIRECTORY_SEPARATOR . 'indexers.xsd'; + $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Index') . '/indexers_merged.xsd'; + $this->_perFileSchema = $moduleReader->getModuleDir('etc', 'Magento_Index') . '/indexers.xsd'; } /** diff --git a/app/code/Magento/Index/Model/Lock/Storage.php b/app/code/Magento/Index/Model/Lock/Storage.php index cb5d9cfd46a..29d1e4a713e 100644 --- a/app/code/Magento/Index/Model/Lock/Storage.php +++ b/app/code/Magento/Index/Model/Lock/Storage.php @@ -31,11 +31,6 @@ namespace Magento\Index\Model\Lock; class Storage { - /** - * @var \Magento\App\Dir - */ - protected $_dirs; - /** * @var \Magento\Index\Model\Process\FileFactory */ @@ -49,15 +44,22 @@ class Storage protected $_fileHandlers = array(); /** - * @param \Magento\App\Dir $dirs + * Directory instance + * + * @var \Magento\Filesystem\Directory\WriteInterface + */ + protected $_varDirectory; + + /** * @param \Magento\Index\Model\Process\FileFactory $fileFactory + * @param \Magento\Filesystem $filesystem */ public function __construct( - \Magento\App\Dir $dirs, - \Magento\Index\Model\Process\FileFactory $fileFactory + \Magento\Index\Model\Process\FileFactory $fileFactory, + \Magento\Filesystem $filesystem ) { - $this->_dirs = $dirs; $this->_fileFactory = $fileFactory; + $this->_varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); } /** @@ -69,15 +71,11 @@ class Storage public function getFile($processId) { if (!isset($this->_fileHandlers[$processId])) { - $file = $this->_fileFactory->create(); - $varDirectory = $this->_dirs->getDir(\Magento\App\Dir::VAR_DIR) . DIRECTORY_SEPARATOR . 'locks'; - $file->setAllowCreateFolders(true); - - $file->open(array('path' => $varDirectory)); - $fileName = 'index_process_' . $processId . '.lock'; - $file->streamOpen($fileName); - $file->streamWrite(date('r')); - $this->_fileHandlers[$processId] = $file; + $this->_varDirectory->create('locks'); + $fileName = 'locks/index_process_' . $processId . '.lock'; + $stream = $this->_varDirectory->openFile($fileName, 'w+'); + $stream->write(date('r')); + $this->_fileHandlers[$processId] = $this->_fileFactory->create(array('streamHandler' => $stream)); } return $this->_fileHandlers[$processId]; } diff --git a/app/code/Magento/Index/Model/Process/File.php b/app/code/Magento/Index/Model/Process/File.php index 51f12644f9c..8028df8d174 100644 --- a/app/code/Magento/Index/Model/Process/File.php +++ b/app/code/Magento/Index/Model/Process/File.php @@ -24,13 +24,30 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Index\Model\Process; + +use Magento\Filesystem\FilesystemException; +use Magento\Filesystem\File\WriteInterface; + /** * Process file entity */ -namespace Magento\Index\Model\Process; - -class File extends \Magento\Io\File +class File { + /** + * Stream handle instance + * + * @var WriteInterface + */ + protected $_streamHandler; + + /** + * Is stream locked + * + * @var bool + */ + protected $_streamLocked; + /** * Process lock flag: * - true - if process is already locked by another user @@ -41,6 +58,14 @@ class File extends \Magento\Io\File */ protected $_processLocked = null; + /** + * @param WriteInterface $streamHandler + */ + public function __construct(WriteInterface $streamHandler) + { + $this->_streamHandler = $streamHandler; + } + /** * Lock process file * @@ -49,18 +74,18 @@ class File extends \Magento\Io\File */ public function processLock($nonBlocking = true) { - if (!$this->_streamHandler) { - return false; - } - $this->_streamLocked = true; - $lock = LOCK_EX; + $lockMode = LOCK_EX; if ($nonBlocking) { - $lock = $lock | LOCK_NB; + $lockMode = $lockMode | LOCK_NB; + } + try { + $this->_streamHandler->lock($lockMode); + $this->_streamLocked = true; + } catch (FilesystemException $e) { + $this->_streamLocked = false; } - $result = flock($this->_streamHandler, $lock); // true if process is locked by other user - $this->_processLocked = !$result; - return $result; + $this->_processLocked = !$this->_streamLocked; } /** @@ -71,7 +96,13 @@ class File extends \Magento\Io\File public function processUnlock() { $this->_processLocked = null; - return parent::streamUnlock(); + try { + $this->_streamHandler->unlock(); + $this->_streamLocked = false; + } catch (FilesystemException $e) { + $this->_streamLocked = true; + } + return !$this->_streamLocked; } /** @@ -89,16 +120,18 @@ class File extends \Magento\Io\File if ($this->_processLocked !== null) { return $this->_processLocked; } else { - if (flock($this->_streamHandler, LOCK_EX | LOCK_NB)) { + try { + $this->_streamHandler->lock(LOCK_EX | LOCK_NB); if ($needUnlock) { - flock($this->_streamHandler, LOCK_UN); - $this->_processLocked = false; + $this->_streamHandler->unlock(); + $this->_streamLocked = false; } else { $this->_streamLocked = true; } return false; + } catch (FilesystemException $e) { + return true; } - return true; } } } diff --git a/app/code/Magento/Index/Model/Shell.php b/app/code/Magento/Index/Model/Shell.php index 3ddf6efef97..ac2e0d72b8d 100644 --- a/app/code/Magento/Index/Model/Shell.php +++ b/app/code/Magento/Index/Model/Shell.php @@ -50,17 +50,15 @@ class Shell extends \Magento\Core\Model\AbstractShell /** * @param \Magento\Filesystem $filesystem * @param string $entryPoint - * @param \Magento\App\Dir $dir - * @param \Magento\Index\Model\Indexer $indexer + * @param Indexer $indexer */ public function __construct( \Magento\Filesystem $filesystem, $entryPoint, - \Magento\App\Dir $dir, \Magento\Index\Model\Indexer $indexer ) { $this->_indexer = $indexer; - parent::__construct($filesystem, $entryPoint, $dir); + parent::__construct($filesystem, $entryPoint); } /** diff --git a/app/code/Magento/Index/etc/adminhtml/menu.xml b/app/code/Magento/Index/etc/adminhtml/menu.xml index 620ee8c28a8..52ce7badf45 100644 --- a/app/code/Magento/Index/etc/adminhtml/menu.xml +++ b/app/code/Magento/Index/etc/adminhtml/menu.xml @@ -27,6 +27,6 @@ --> <config> <menu> - <add id="Magento_Index::system_index" title="Index Management" module="Magento_Index" sortOrder="20" parent="Magento_Adminhtml::system_tools" action="adminhtml/process/list" resource="Magento_Index::index"/> + <add id="Magento_Index::system_index" title="Index Management" module="Magento_Index" sortOrder="20" parent="Magento_Backend::system_tools" action="adminhtml/process/list" resource="Magento_Index::index"/> </menu> </config> diff --git a/app/code/Magento/Index/etc/adminhtml/routes.xml b/app/code/Magento/Index/etc/adminhtml/routes.xml index fa6658ab218..351bbbde9a9 100644 --- a/app/code/Magento/Index/etc/adminhtml/routes.xml +++ b/app/code/Magento/Index/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Index_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Index" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Index/etc/module.xml b/app/code/Magento/Index/etc/module.xml index 278e4b8dbf8..4f20a6666f4 100755 --- a/app/code/Magento/Index/etc/module.xml +++ b/app/code/Magento/Index/etc/module.xml @@ -30,7 +30,6 @@ </sequence> <depends> <module name="Magento_Core"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Backend"/> <module name="Magento_AdminNotification"/> </depends> diff --git a/app/code/Magento/Install/App/Action/Plugin/Dir.php b/app/code/Magento/Install/App/Action/Plugin/Dir.php index ef69bf6fdc8..f43abf2c0d9 100644 --- a/app/code/Magento/Install/App/Action/Plugin/Dir.php +++ b/app/code/Magento/Install/App/Action/Plugin/Dir.php @@ -25,30 +25,45 @@ namespace Magento\Install\App\Action\Plugin; +use Magento\Filesystem, + Magento\Filesystem\FilesystemException, + Magento\Filesystem\Directory\Write, + Magento\App\State, + Magento\Logger; + class Dir { /** * Application state * - * @var \Magento\App\State + * @var State */ - protected $_appState; + protected $appState; /** * Directory list * - * @var \Magento\App\Dir + * @var Write + */ + protected $varDirectory; + + /** + * Logger + * + * @var Logger */ - protected $_dir; + protected $logger; /** - * @param \Magento\App\State $state - * @param \Magento\App\Dir $dir + * @param State $state + * @param Filesystem $filesystem + * @param Logger $logger */ - public function __construct(\Magento\App\State $state, \Magento\App\Dir $dir) + public function __construct(State $state, Filesystem $filesystem, Logger $logger) { - $this->_appState = $state; - $this->_dir = $dir; + $this->appState = $state; + $this->varDirectory = $filesystem->getDirectoryWrite(Filesystem::VAR_DIR); + $this->logger = $logger; } /** @@ -59,9 +74,15 @@ class Dir */ public function beforeDispatch($arguments) { - if (!$this->_appState->isInstalled()) { - foreach (glob($this->_dir->getDir(\Magento\App\Dir::VAR_DIR) . '/*', GLOB_ONLYDIR) as $dir) { - \Magento\Io\File::rmdirRecursive($dir); + if (!$this->appState->isInstalled()) { + foreach ($this->varDirectory->read() as $dir) { + if ($this->varDirectory->isDirectory($dir)) { + try { + $this->varDirectory->delete($dir); + } catch (FilesystemException $exception) { + $this->logger->log($exception->getMessage()); + } + } } } return $arguments; diff --git a/app/code/Magento/Install/App/Console.php b/app/code/Magento/Install/App/Console.php index 2a838aec034..18104dea57b 100644 --- a/app/code/Magento/Install/App/Console.php +++ b/app/code/Magento/Install/App/Console.php @@ -53,12 +53,18 @@ class Console implements \Magento\AppInterface */ protected $_objectManager; + /** + * @var \Magento\Filesystem\Directory\Read + */ + protected $rootDirectory; + /** * @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 array $arguments */ public function __construct( @@ -67,8 +73,10 @@ class Console implements \Magento\AppInterface \Magento\App\State $state, \Magento\App\ObjectManager\ConfigLoader $loader, \Magento\ObjectManager $objectManager, + \Magento\Filesystem $filesystem, array $arguments = array() ) { + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); $this->_loader = $loader; $this->_state = $state; $this->_installerFactory = $installerFactory; @@ -85,13 +93,18 @@ class Console implements \Magento\AppInterface */ protected function _buildInitArguments(array $args) { + $directories = array(); if (!empty($args[\Magento\Install\Model\Installer\Console::OPTION_URIS])) { - $args[\Magento\App\Dir::PARAM_APP_URIS] = - unserialize(base64_decode($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; + } } if (!empty($args[\Magento\Install\Model\Installer\Console::OPTION_DIRS])) { - $args[\Magento\App\Dir::PARAM_APP_DIRS] = - unserialize(base64_decode($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; + } } return $args; } @@ -103,7 +116,9 @@ class Console implements \Magento\AppInterface */ protected function _handleInstall(\Magento\Install\Model\Installer\Console $installer) { - if (isset($this->_arguments['config']) && file_exists($this->_arguments['config'])) { + if (isset($this->_arguments['config']) + && $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($this->_arguments['config'])) + ) { $config = (array) include($this->_arguments['config']); $this->_arguments = array_merge((array)$config, $this->_arguments); } @@ -115,8 +130,7 @@ class Console implements \Magento\AppInterface } if (!$installer->hasErrors()) { if ($isUninstallMode) { - $msg = $result ? 'Uninstalled successfully' - : 'Ignoring attempt to uninstall non-installed application'; + $msg = $result ? 'Uninstalled successfully' : 'Ignoring attempt to uninstall non-installed application'; } else { $msg = 'Installed successfully' . ($result ? ' (encryption key "' . $result . '")' : ''); } @@ -139,11 +153,11 @@ class Console implements \Magento\AppInterface $installer = $this->_installerFactory->create(array('installArgs' => $this->_arguments)); if (isset($this->_arguments['show_locales'])) { $this->_output->export($installer->getAvailableLocales()); - } else if (isset($this->_arguments['show_currencies'])) { + } elseif (isset($this->_arguments['show_currencies'])) { $this->_output->export($installer->getAvailableCurrencies()); - } else if (isset($this->_arguments['show_timezones'])) { + } elseif (isset($this->_arguments['show_timezones'])) { $this->_output->export($installer->getAvailableTimezones()); - } else if (isset($this->_arguments['show_install_options'])) { + } elseif (isset($this->_arguments['show_install_options'])) { $this->_output->export($installer->getAvailableInstallOptions()); } else { $this->_handleInstall($installer); diff --git a/app/code/Magento/Install/Block/AbstractBlock.php b/app/code/Magento/Install/Block/AbstractBlock.php index 90b5e3912c4..71e52b76bff 100644 --- a/app/code/Magento/Install/Block/AbstractBlock.php +++ b/app/code/Magento/Install/Block/AbstractBlock.php @@ -50,7 +50,7 @@ abstract class AbstractBlock extends \Magento\View\Element\Template /** * Install session * - * @var \Magento\Core\Model\Session\Generic + * @var \Magento\Session\Generic */ protected $_session; @@ -58,14 +58,14 @@ abstract class AbstractBlock extends \Magento\View\Element\Template * @param \Magento\View\Element\Template\Context $context * @param \Magento\Install\Model\Installer $installer * @param \Magento\Install\Model\Wizard $installWizard - * @param \Magento\Core\Model\Session\Generic $session + * @param \Magento\Session\Generic $session * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Install\Model\Installer $installer, \Magento\Install\Model\Wizard $installWizard, - \Magento\Core\Model\Session\Generic $session, + \Magento\Session\Generic $session, array $data = array() ) { parent::__construct($context, $data); diff --git a/app/code/Magento/Install/Block/Begin.php b/app/code/Magento/Install/Block/Begin.php index c39c0e7b5c2..5c432f7f024 100644 --- a/app/code/Magento/Install/Block/Begin.php +++ b/app/code/Magento/Install/Block/Begin.php @@ -44,7 +44,7 @@ class Begin extends \Magento\Install\Block\AbstractBlock * @param \Magento\View\Element\Template\Context $context * @param \Magento\Install\Model\Installer $installer * @param \Magento\Install\Model\Wizard $installWizard - * @param \Magento\Core\Model\Session\Generic $session + * @param \Magento\Session\Generic $session * @param null $eulaFile * @param array $data */ @@ -52,7 +52,7 @@ class Begin extends \Magento\Install\Block\AbstractBlock \Magento\View\Element\Template\Context $context, \Magento\Install\Model\Installer $installer, \Magento\Install\Model\Wizard $installWizard, - \Magento\Core\Model\Session\Generic $session, + \Magento\Session\Generic $session, $eulaFile = null, array $data = array() ) { @@ -78,6 +78,8 @@ class Begin extends \Magento\Install\Block\AbstractBlock */ public function getLicenseHtml() { - return ($this->_eulaFile) ? $this->_filesystem->read(BP . DS . $this->_eulaFile) : ''; + return ($this->_eulaFile) + ? $this->_filesystem->getDirectoryRead(\Magento\Filesystem::ROOT)->readFile($this->_eulaFile) + : ''; } } diff --git a/app/code/Magento/Install/Block/Config.php b/app/code/Magento/Install/Block/Config.php index 91ed1a0b522..9e68b7dd76a 100644 --- a/app/code/Magento/Install/Block/Config.php +++ b/app/code/Magento/Install/Block/Config.php @@ -49,7 +49,7 @@ class Config extends \Magento\Install\Block\AbstractBlock * @param \Magento\View\Element\Template\Context $context * @param \Magento\Install\Model\Installer $installer * @param \Magento\Install\Model\Wizard $installWizard - * @param \Magento\Core\Model\Session\Generic $session + * @param \Magento\Session\Generic $session * @param \Magento\Install\Model\Installer\Config $installerConfig * @param array $data */ @@ -57,7 +57,7 @@ class Config extends \Magento\Install\Block\AbstractBlock \Magento\View\Element\Template\Context $context, \Magento\Install\Model\Installer $installer, \Magento\Install\Model\Wizard $installWizard, - \Magento\Core\Model\Session\Generic $session, + \Magento\Session\Generic $session, \Magento\Install\Model\Installer\Config $installerConfig, array $data = array() ) { diff --git a/app/code/Magento/Install/Block/Db/Main.php b/app/code/Magento/Install/Block/Db/Main.php index 2c968e68dc0..8cd60e41a51 100644 --- a/app/code/Magento/Install/Block/Db/Main.php +++ b/app/code/Magento/Install/Block/Db/Main.php @@ -48,20 +48,20 @@ class Main extends \Magento\View\Element\Template /** * Install installer config * - * @var \Magento\Core\Model\Session\Generic + * @var \Magento\Session\Generic */ protected $_session; /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Install\Model\Installer\Config $installerConfig - * @param \Magento\Core\Model\Session\Generic $session + * @param \Magento\Session\Generic $session * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Install\Model\Installer\Config $installerConfig, - \Magento\Core\Model\Session\Generic $session, + \Magento\Session\Generic $session, array $data = array() ) { parent::__construct($context, $data); diff --git a/app/code/Magento/Install/Block/Db/Type.php b/app/code/Magento/Install/Block/Db/Type.php index 87f308d762a..cf53f032a35 100644 --- a/app/code/Magento/Install/Block/Db/Type.php +++ b/app/code/Magento/Install/Block/Db/Type.php @@ -50,20 +50,20 @@ class Type extends \Magento\View\Element\Template /** * Install installer config * - * @var \Magento\Core\Model\Session\Generic + * @var \Magento\Session\Generic */ protected $_session; /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Install\Model\Installer\Config $installerConfig - * @param \Magento\Core\Model\Session\Generic $session + * @param \Magento\Session\Generic $session * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Install\Model\Installer\Config $installerConfig, - \Magento\Core\Model\Session\Generic $session, + \Magento\Session\Generic $session, array $data = array() ) { parent::__construct($context, $data); diff --git a/app/code/Magento/Install/Block/Download.php b/app/code/Magento/Install/Block/Download.php index 1f7f2d43bb4..21ba4fad0fc 100644 --- a/app/code/Magento/Install/Block/Download.php +++ b/app/code/Magento/Install/Block/Download.php @@ -47,7 +47,7 @@ class Download extends \Magento\Install\Block\AbstractBlock * @param \Magento\View\Element\Template\Context $context * @param \Magento\Install\Model\Installer $installer * @param \Magento\Install\Model\Wizard $installWizard - * @param \Magento\Core\Model\Session\Generic $session + * @param \Magento\Session\Generic $session * @param \Magento\Module\Dir\Reader $moduleReader * @param array $data */ @@ -55,7 +55,7 @@ class Download extends \Magento\Install\Block\AbstractBlock \Magento\View\Element\Template\Context $context, \Magento\Install\Model\Installer $installer, \Magento\Install\Model\Wizard $installWizard, - \Magento\Core\Model\Session\Generic $session, + \Magento\Session\Generic $session, \Magento\Module\Dir\Reader $moduleReader, array $data = array() ) { @@ -88,8 +88,10 @@ class Download extends \Magento\Install\Block\AbstractBlock */ public function hasLocalCopy() { - $dir = $this->_moduleReader->getModuleDir('etc', 'Magento_Adminhtml'); - if ($dir && $this->_filesystem->isDirectory($dir)) { + $path = $this->_moduleReader->getModuleDir('etc', 'Magento_Adminhtml'); + $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + + if ($path && $directory->isDirectory($directory->getRelativePath($path))) { return true; } return false; diff --git a/app/code/Magento/Install/Block/End.php b/app/code/Magento/Install/Block/End.php index 47ad1c45f4f..4cc59658ad3 100644 --- a/app/code/Magento/Install/Block/End.php +++ b/app/code/Magento/Install/Block/End.php @@ -59,7 +59,7 @@ class End extends \Magento\Install\Block\AbstractBlock * @param \Magento\View\Element\Template\Context $context * @param \Magento\Install\Model\Installer $installer * @param \Magento\Install\Model\Wizard $installWizard - * @param \Magento\Core\Model\Session\Generic $session + * @param \Magento\Session\Generic $session * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\AdminNotification\Model\Survey $survey * @param $cryptKey @@ -69,7 +69,7 @@ class End extends \Magento\Install\Block\AbstractBlock \Magento\View\Element\Template\Context $context, \Magento\Install\Model\Installer $installer, \Magento\Install\Model\Wizard $installWizard, - \Magento\Core\Model\Session\Generic $session, + \Magento\Session\Generic $session, \Magento\Core\Model\Config $coreConfig, \Magento\AdminNotification\Model\Survey $survey, $cryptKey, diff --git a/app/code/Magento/Install/Block/Locale.php b/app/code/Magento/Install/Block/Locale.php index 1d2d5c08f9b..95aeff9bcce 100644 --- a/app/code/Magento/Install/Block/Locale.php +++ b/app/code/Magento/Install/Block/Locale.php @@ -29,15 +29,48 @@ * * @category Magento * @package Magento_Install - * @author Magento Core Team <core@magentocommerce.com> + * @author Magento Core Team <core@magentocommerce.com> */ namespace Magento\Install\Block; class Locale extends \Magento\Install\Block\AbstractBlock { - + /** + * Template file + * + * @var string + */ protected $_template = 'locale.phtml'; + /** + * Locale code + * + * @var string + */ + protected $_localeCode; + + /** + * Set locale code + * + * @param $localeCode + * @return \Magento\Install\Block\Locale + */ + public function setLocaleCode($localeCode) + { + $this->_localeCode = $localeCode; + return $this; + } + + /** + * Retrieve locale code + * + * @return string + */ + public function getLocaleCode() + { + return $this->_localeCode; + } + /** * Retrieve locale object * @@ -47,7 +80,9 @@ class Locale extends \Magento\Install\Block\AbstractBlock { $locale = $this->getData('locale'); if (null === $locale) { - $locale = $this->_locale->getLocale(); + $locale = $this->_locale->setLocaleCode( + $this->getLocaleCode() + )->getLocale(); $this->setData('locale', $locale); } return $locale; diff --git a/app/code/Magento/Install/Block/State.php b/app/code/Magento/Install/Block/State.php index ac12aa72ea6..47c3977452a 100644 --- a/app/code/Magento/Install/Block/State.php +++ b/app/code/Magento/Install/Block/State.php @@ -36,6 +36,13 @@ class State extends \Magento\View\Element\Template */ protected $_template = 'state.phtml'; + /** + * Install Wizard + * + * @var \Magento\Install\Model\Wizard + */ + protected $_wizard; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Install\Model\Wizard $wizard diff --git a/app/code/Magento/Install/Controller/Wizard.php b/app/code/Magento/Install/Controller/Wizard.php index f89be92cd83..f45730220bd 100644 --- a/app/code/Magento/Install/Controller/Wizard.php +++ b/app/code/Magento/Install/Controller/Wizard.php @@ -58,7 +58,7 @@ class Wizard extends \Magento\Install\Controller\Action /** * Install Session * - * @var \Magento\Core\Model\Session\Generic + * @var \Magento\Session\Generic */ protected $_session; @@ -74,7 +74,7 @@ class Wizard extends \Magento\Install\Controller\Action * @param \Magento\Config\Scope $configScope * @param \Magento\Install\Model\Installer $installer * @param \Magento\Install\Model\Wizard $wizard - * @param \Magento\Core\Model\Session\Generic $session + * @param \Magento\Session\Generic $session * @param \Magento\Module\UpdaterInterface $dbUpdater * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState @@ -84,7 +84,7 @@ class Wizard extends \Magento\Install\Controller\Action \Magento\Config\Scope $configScope, \Magento\Install\Model\Installer $installer, \Magento\Install\Model\Wizard $wizard, - \Magento\Core\Model\Session\Generic $session, + \Magento\Session\Generic $session, \Magento\Module\UpdaterInterface $dbUpdater, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState @@ -105,7 +105,7 @@ class Wizard extends \Magento\Install\Controller\Action * Throw a bootstrap exception if page cannot be displayed due to mis-configured base directories * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { @@ -189,7 +189,7 @@ class Wizard extends \Magento\Install\Controller\Action $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); $this->_prepareLayout(); - $this->_view->getLayout()->initMessages('Magento\Install\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->getLayout()->addBlock('Magento\Install\Block\Begin', 'install.begin', 'content'); @@ -221,9 +221,13 @@ class Wizard extends \Magento\Install\Controller\Action $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); $this->_prepareLayout(); - $this->_view->getLayout()->initMessages('Magento\Install\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->getLayout()->addBlock('Magento\Install\Block\Locale', 'install.locale', 'content'); - + $this->_view->getLayout() + ->getBlock('install.locale') + ->setLocaleCode( + $this->_session->getLocale() + ); $this->_view->renderLayout(); } @@ -272,7 +276,7 @@ class Wizard extends \Magento\Install\Controller\Action $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); $this->_prepareLayout(); - $this->_view->getLayout()->initMessages('Magento\Install\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->getLayout()->addBlock('Magento\Install\Block\Download', 'install.download', 'content'); $this->_view->renderLayout(); @@ -319,7 +323,7 @@ class Wizard extends \Magento\Install\Controller\Action */ public function installAction() { - $pear = \Magento\Pear::getInstance(); + $pear = \Magento\Pear::getInstance(); $params = array( 'comment' => __("Downloading and installing Magento, please wait...") . "\r\n\r\n" ); @@ -388,7 +392,7 @@ class Wizard extends \Magento\Install\Controller\Action } $this->_prepareLayout(); - $this->_view->getLayout()->initMessages('Magento\Install\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->getLayout()->addBlock('Magento\Install\Block\Config', 'install.config', 'content'); $this->_view->renderLayout(); @@ -415,10 +419,9 @@ class Wizard extends \Magento\Install\Controller\Action ->setSkipBaseUrlValidation($this->getRequest()->getPost('skip_base_url_validation')); try { $this->_getInstaller()->installConfig($data); - $this->_redirect('*/*/installDb'); - return $this; + return $this->_redirect('*/*/installDb'); } catch (\Exception $e) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->getResponse()->setRedirect($step->getUrl()); } } @@ -444,7 +447,7 @@ class Wizard extends \Magento\Install\Controller\Action $this->getResponse()->setRedirect($step->getNextUrl()); } catch (\Exception $e) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->getResponse()->setRedirect($step->getUrl()); } } @@ -457,7 +460,7 @@ class Wizard extends \Magento\Install\Controller\Action $this->_checkIfInstalled(); $this->_prepareLayout(); - $this->_view->getLayout()->initMessages('Magento\Install\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->getLayout()->addBlock('Magento\Install\Block\Admin', 'install.administrator', 'content'); $this->_view->renderLayout(); @@ -482,9 +485,9 @@ class Wizard extends \Magento\Install\Controller\Action } catch (\Exception $e) { $this->_session->setAdminData($adminData); if ($e instanceof \Magento\Core\Exception) { - $this->_session->addMessages($e->getMessages()); + $this->messageManager->addMessages($e->getMessages()); } else { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } $this->getResponse()->setRedirect($step->getUrl()); } @@ -507,7 +510,7 @@ class Wizard extends \Magento\Install\Controller\Action $this->_objectManager->get('Magento\AdminNotification\Model\Survey')->saveSurveyViewed(true); $this->_prepareLayout(); - $this->_view->getLayout()->initMessages('Magento\Install\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->getLayout()->addBlock('Magento\Install\Block\End', 'install.end', 'content'); $this->_view->renderLayout(); diff --git a/app/code/Magento/Install/Model/Config.php b/app/code/Magento/Install/Model/Config.php index 16aeea67b0e..475a9f89fdc 100644 --- a/app/code/Magento/Install/Model/Config.php +++ b/app/code/Magento/Install/Model/Config.php @@ -44,22 +44,24 @@ class Config protected $_dataStorage; /** - * Directory model + * Filesystem * - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_coreDir; - - + protected $filesystem; /** - * @param \Magento\Install\Model\Config\Data $dataStorage - * @param \Magento\App\Dir $coreDir + * Constructor + * + * @param Config\Data $dataStorage + * @param \Magento\Filesystem $filesystem */ - public function __construct(\Magento\Install\Model\Config\Data $dataStorage, \Magento\App\Dir $coreDir) - { + public function __construct( + \Magento\Install\Model\Config\Data $dataStorage, + \Magento\Filesystem $filesystem + ) { $this->_dataStorage = $dataStorage; - $this->_coreDir = $coreDir; + $this->filesystem = $filesystem; } /** @@ -126,7 +128,7 @@ class Config $data['filesystem_prerequisites']['writables'] : array(); foreach ($items as $nodeKey => $item) { $value = $item; - $value['path'] = $this->_coreDir->getDir($nodeKey); + $value['path'] = $this->filesystem->getPath($nodeKey); $paths[$nodeKey] = $value; } diff --git a/app/code/Magento/Install/Model/Installer.php b/app/code/Magento/Install/Model/Installer.php index 38db0f5153b..36ac343c952 100644 --- a/app/code/Magento/Install/Model/Installer.php +++ b/app/code/Magento/Install/Model/Installer.php @@ -141,7 +141,7 @@ class Installer extends \Magento\Object /** * Install session * - * @var \Magento\Core\Model\Session\Generic + * @var \Magento\Session\Generic */ protected $_session; @@ -174,7 +174,7 @@ class Installer extends \Magento\Object * @param Installer\Pear $installerPear * @param Installer\Db $installerDb * @param Installer\Config $installerConfig - * @param \Magento\Core\Model\Session\Generic $session + * @param \Magento\Session\Generic $session * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Math\Random $mathRandom * @param \Magento\App\Resource $resource @@ -196,7 +196,7 @@ class Installer extends \Magento\Object \Magento\Install\Model\Installer\Pear $installerPear, \Magento\Install\Model\Installer\Db $installerDb, \Magento\Install\Model\Installer\Config $installerConfig, - \Magento\Core\Model\Session\Generic $session, + \Magento\Session\Generic $session, \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Math\Random $mathRandom, \Magento\App\Resource $resource, @@ -237,7 +237,7 @@ class Installer extends \Magento\Object /** * Get data model * - * @return \Magento\Core\Model\Session\Generic + * @return \Magento\Object */ public function getDataModel() { @@ -253,7 +253,7 @@ class Installer extends \Magento\Object * @param \Magento\Object $model * @return \Magento\Install\Model\Installer */ - public function setDataModel(\Magento\Object $model) + public function setDataModel($model) { $this->_dataModel = $model; return $this; diff --git a/app/code/Magento/Install/Model/Installer/Config.php b/app/code/Magento/Install/Model/Installer/Config.php index 15e3c728588..0486ecc040e 100644 --- a/app/code/Magento/Install/Model/Installer/Config.php +++ b/app/code/Magento/Install/Model/Installer/Config.php @@ -24,14 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Install\Model\Installer; /** * Config installer - * @category Magento - * @package Magento_Install */ -namespace Magento\Install\Model\Installer; - class Config extends \Magento\Install\Model\Installer\AbstractInstaller { const TMP_INSTALL_DATE_VALUE= 'd-d-d-d-d'; @@ -42,18 +39,13 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller * * @var string */ - protected $_localConfigFile; + protected $_localConfigFile = 'local.xml'; /** * @var \Magento\App\RequestInterface */ protected $_request; - /** - * @var \Magento\App\Dir - */ - protected $_dirs; - protected $_configData = array(); /** @@ -61,6 +53,11 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller */ protected $_filesystem; + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected $_configDirectory; + /** * Store Manager * @@ -68,26 +65,31 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller */ protected $_storeManager; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\Install\Model\Installer $installer * @param \Magento\App\RequestInterface $request - * @param \Magento\App\Dir $dirs * @param \Magento\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\App\Dir $dirs, \Magento\Filesystem $filesystem, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Message\ManagerInterface $messageManager ) { parent::__construct($installer); - $this->_localConfigFile = $dirs->getDir(\Magento\App\Dir::CONFIG) . DIRECTORY_SEPARATOR . 'local.xml'; - $this->_dirs = $dirs; $this->_request = $request; - $this->_filesystem = $filesystem; $this->_storeManager = $storeManager; + $this->_filesystem = $filesystem; + $this->_configDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::CONFIG); + $this->messageManager = $messageManager; } public function setConfigData($data) @@ -111,9 +113,9 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller $data = $this->getConfigData(); $defaults = array( - 'root_dir' => $this->_dirs->getDir(\Magento\App\Dir::ROOT), - 'app_dir' => $this->_dirs->getDir(\Magento\App\Dir::APP), - 'var_dir' => $this->_dirs->getDir(\Magento\App\Dir::VAR_DIR), + '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), 'base_url' => $this->_request->getDistroBaseUrl(), ); foreach ($defaults as $index => $value) { @@ -151,14 +153,13 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller $this->_getInstaller()->getDataModel()->setConfigData($data); - $path = $this->_dirs->getDir(\Magento\App\Dir::CONFIG) . DIRECTORY_SEPARATOR . 'local.xml.template'; - $contents = $this->_filesystem->read($path); + $contents = $this->_configDirectory->readFile('local.xml.template'); foreach ($data as $index => $value) { $contents = str_replace('{{' . $index . '}}', '<![CDATA[' . $value . ']]>', $contents); } - $this->_filesystem->write($this->_localConfigFile, $contents); - $this->_filesystem->changePermissions($this->_localConfigFile, 0777); + $this->_configDirectory->writeFile($this->_localConfigFile, $contents); + $this->_configDirectory->changePermissions($this->_localConfigFile, 0777); } public function getFormData() @@ -197,72 +198,42 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller protected function _checkUrl($baseUrl) { try { - $pubLibDir = $this->_dirs->getDir(\Magento\App\Dir::PUB_LIB); - $staticFile = $this->_findFirstFileRelativePath($pubLibDir, '/.+\.(html?|js|css|gif|jpe?g|png)$/'); - $staticUrl = $baseUrl . $this->_dirs->getUri(\Magento\App\Dir::PUB_LIB) . '/' . $staticFile; + $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::PUB_LIB); + $files = $directory->search('/.+\.(html?|js|css|gif|jpe?g|png)$/'); + + $staticFile = isset($files[0]) ? $files[0] : null; + $staticUrl = $baseUrl . $this->_filesystem->getUri(\Magento\Filesystem::PUB_LIB) . '/' . $staticFile; $client = new \Magento\HTTP\ZendClient($staticUrl); $response = $client->request('GET'); } catch (\Exception $e){ - $this->_getInstaller()->getDataModel()->addError( + $this->messageManager->addError( __('The URL "%1" is not accessible.', $baseUrl) ); throw $e; } if ($response->getStatus() != 200) { - $this->_getInstaller()->getDataModel()->addError( + $this->messageManager->addError( __('The URL "%1" is invalid.', $baseUrl) ); throw new \Magento\Core\Exception(__('Response from the server is invalid.')); } } - /** - * Find a relative path to a first file located in a directory or its descendants - * - * @param string $dir Directory to search for a file within - * @param string $pattern PCRE pattern a file name has to match - * @return string|null - */ - protected function _findFirstFileRelativePath($dir, $pattern = '/.*/') - { - $childDirs = array(); - foreach (scandir($dir) as $itemName) { - if ($itemName == '.' || $itemName == '..') { - continue; - } - $itemPath = $dir . DIRECTORY_SEPARATOR . $itemName; - if (is_file($itemPath)) { - if (preg_match($pattern, $itemName)) { - return $itemName; - } - } else { - $childDirs[$itemName] = $itemPath; - } - } - foreach ($childDirs as $dirName => $dirPath) { - $filePath = $this->_findFirstFileRelativePath($dirPath, $pattern); - if ($filePath) { - return $dirName . '/' . $filePath; - } - } - return null; - } - public function replaceTmpInstallDate($date = 'now') { $stamp = strtotime((string) $date); - $localXml = $this->_filesystem->read($this->_localConfigFile); + $localXml = $this->_configDirectory->readFile($this->_localConfigFile); $localXml = str_replace(self::TMP_INSTALL_DATE_VALUE, date('r', $stamp), $localXml); - $this->_filesystem->write($this->_localConfigFile, $localXml); + $this->_configDirectory->writeFile($this->_localConfigFile, $localXml); return $this; } public function replaceTmpEncryptKey($key) { - $localXml = $this->_filesystem->read($this->_localConfigFile); + $localXml = $this->_configDirectory->readFile($this->_localConfigFile); $localXml = str_replace(self::TMP_ENCRYPT_KEY_VALUE, $key, $localXml); - $this->_filesystem->write($this->_localConfigFile, $localXml); + $this->_configDirectory->writeFile($this->_localConfigFile, $localXml); return $this; } diff --git a/app/code/Magento/Install/Model/Installer/Console.php b/app/code/Magento/Install/Model/Installer/Console.php index 8eebe52e3f3..c32b54766ac 100644 --- a/app/code/Magento/Install/Model/Installer/Console.php +++ b/app/code/Magento/Install/Model/Installer/Console.php @@ -82,7 +82,7 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller /** * Installer data model to store data between installations steps * - * @var \Magento\Install\Model\Installer\Data|\Magento\Core\Model\Session\Generic + * @var \Magento\Install\Model\Installer\Data|\Magento\Session\Generic */ protected $_dataModel; @@ -114,13 +114,6 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller */ protected $_appState; - /** - * Core Dir model - * - * @var \Magento\App\Dir - */ - protected $_coreDir; - /** * Locale model * @@ -142,7 +135,6 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller * @param \Magento\Filesystem $filesystem * @param \Magento\Install\Model\Installer\Data $installerData * @param \Magento\App\State $appState - * @param \Magento\App\Dir $coreDir * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\ObjectManager $objectManager */ @@ -153,7 +145,6 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller \Magento\Filesystem $filesystem, \Magento\Install\Model\Installer\Data $installerData, \Magento\App\State $appState, - \Magento\App\Dir $coreDir, \Magento\Core\Model\LocaleInterface $locale, \Magento\ObjectManager $objectManager ) { @@ -164,7 +155,6 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller $this->_installerData = $installerData; $this->_installer->setDataModel($this->_installerData); $this->_appState = $appState; - $this->_coreDir = $coreDir; $this->_locale = $locale; $this->_objectManager = $objectManager; } @@ -370,11 +360,14 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller /** * Change directories mode to be writable by apache user */ - $this->_filesystem->changePermissions($this->_coreDir->getDir('var'), 0777, true); + $this->_filesystem + ->getDirectoryWrite(\Magento\Filesystem::VAR_DIR) + ->changePermissions('', 0777); + return $encryptionKey; } catch (\Exception $e) { if ($e instanceof \Magento\Core\Exception) { - foreach ($e->getMessages(\Magento\Message\Factory::ERROR) as $errorMessage) { + foreach ($e->getMessages(\Magento\Message\MessageInterface::TYPE_ERROR) as $errorMessage) { $this->addError($errorMessage); } } else { @@ -409,11 +402,13 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller $this->_cleanUpDatabase(); /* Remove temporary directories and local.xml */ - foreach (glob($this->_coreDir->getDir(\Magento\App\Dir::VAR_DIR) . '/*', GLOB_ONLYDIR) as $dir) { - $this->_filesystem->delete($dir); + $varDirectory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + foreach ($varDirectory->read() as $path) { + if ($varDirectory->isDirectory($path)) { + $varDirectory->delete($path); + } } - $this->_filesystem->delete($this->_coreDir->getDir(\Magento\App\Dir::CONFIG) - . DIRECTORY_SEPARATOR . '/local.xml'); + $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::CONFIG)->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 687d2275147..1761c820c65 100644 --- a/app/code/Magento/Install/Model/Installer/Filesystem.php +++ b/app/code/Magento/Install/Model/Installer/Filesystem.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Fylesystem installer - * - * @category Magento - * @package Magento_Install - * @author Magento Core Team <core@magentocommerce.com> - */ namespace Magento\Install\Model\Installer; +/** + * Filesystem installer + */ class Filesystem extends \Magento\Install\Model\Installer\AbstractInstaller { /**#@+ @@ -54,11 +50,6 @@ class Filesystem extends \Magento\Install\Model\Installer\AbstractInstaller */ protected $_installConfig; - /** - * @var \Magento\App\Dir - */ - protected $_dir; - /** * Application Root Directory * @@ -66,21 +57,27 @@ class Filesystem extends \Magento\Install\Model\Installer\AbstractInstaller */ protected $_appRootDir; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\Install\Model\Installer $installer * @param \Magento\Filesystem $filesystem * @param \Magento\Install\Model\Config $installConfig - * @param \Magento\App\Dir $dir + * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( \Magento\Install\Model\Installer $installer, \Magento\Filesystem $filesystem, \Magento\Install\Model\Config $installConfig, - \Magento\App\Dir $dir + \Magento\Message\ManagerInterface $messageManager ) { parent::__construct($installer); $this->_filesystem = $filesystem; $this->_installConfig = $installConfig; + $this->messageManager = $messageManager; } /** @@ -116,26 +113,6 @@ class Filesystem extends \Magento\Install\Model\Installer\AbstractInstaller return $res; } - /** - * Check file system path - * - * @deprecated since 1.7.1.0 - * @param string $path - * @param bool $recursive - * @param bool $existence - * @param string $mode - * @return bool - * @throws \Magento\Exception - */ - protected function _checkPath($path, $recursive, $existence, $mode) - { - $appRootDir = $this->_dir->getDir('app'); - if (!is_readable($appRootDir)) { - throw new \Magento\Exception("Application root directory '$appRootDir' is not readable."); - } - return $this->_checkFullPath(dirname($appRootDir) . $path, $recursive, $existence); - } - /** * Check file system full path * @@ -147,12 +124,13 @@ class Filesystem extends \Magento\Install\Model\Installer\AbstractInstaller protected function _checkFullPath($fullPath, $recursive, $existence) { $result = true; - - if ($recursive && $this->_filesystem->isDirectory($fullPath)) { - $pathsToCheck = $this->_filesystem->getNestedKeys($fullPath); - array_unshift($pathsToCheck, $fullPath); + $directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $path = $directory->getRelativePath($fullPath); + if ($recursive && $directory->isDirectory($path)) { + $pathsToCheck = $directory->read($path); + array_unshift($pathsToCheck, $path); } else { - $pathsToCheck = array($fullPath); + $pathsToCheck = array($path); } $skipFileNames = array('.svn', '.htaccess'); @@ -162,15 +140,13 @@ class Filesystem extends \Magento\Install\Model\Installer\AbstractInstaller } if ($existence) { - $setError = !$this->_filesystem->isWritable($fullPath); + $setError = !$directory->isWritable($path); } else { - $setError = $this->_filesystem->has($fullPath) && !$this->_filesystem->isWritable($fullPath); + $setError = $directory->isExist($path) && !$directory->isWritable($path); } if ($setError) { - $this->_getInstaller()->getDataModel()->addError( - __('Path "%1" must be writable.', $pathToCheck) - ); + $this->messageManager->addError(__('Path "%1" must be writable.', $pathToCheck)); $result = false; } } diff --git a/app/code/Magento/Install/Model/Installer/Pear.php b/app/code/Magento/Install/Model/Installer/Pear.php index d57b3672da0..cc49bb03e87 100644 --- a/app/code/Magento/Install/Model/Installer/Pear.php +++ b/app/code/Magento/Install/Model/Installer/Pear.php @@ -24,30 +24,28 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Install\Model\Installer; + /** * PEAR Packages Download Manager */ -namespace Magento\Install\Model\Installer; - class Pear extends \Magento\Install\Model\Installer\AbstractInstaller { /** - * Installer Session - * - * @var \Magento\Core\Model\Session\Generic + * @var \Magento\Message\ManagerInterface */ - protected $_session; + protected $messageManager; /** * @param \Magento\Install\Model\Installer $installer - * @param \Magento\Core\Model\Session\Generic $session + * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( \Magento\Install\Model\Installer $installer, - \Magento\Core\Model\Session\Generic $session + \Magento\Message\ManagerInterface $messageManager ) { parent::__construct($installer); - $this->_session = $session; + $this->messageManager = $messageManager; } @@ -86,7 +84,7 @@ class Pear extends \Magento\Install\Model\Installer\AbstractInstaller if (is_array($message)) { $message = $message['message']; } - $this->_session->addError($message); + $this->messageManager->addError($message); } } else { print_r($obj->getUserInfo()); diff --git a/app/code/Magento/Install/Model/Observer.php b/app/code/Magento/Install/Model/Observer.php index f1df1316686..1ce11bd379b 100644 --- a/app/code/Magento/Install/Model/Observer.php +++ b/app/code/Magento/Install/Model/Observer.php @@ -34,14 +34,14 @@ class Observer /** * Install Session * - * @var \Magento\Core\Model\Session\Generic + * @var \Magento\Session\Generic */ protected $_session; /** - * @param \Magento\Core\Model\Session\Generic $session + * @param \Magento\Session\Generic $session */ - public function __construct(\Magento\Core\Model\Session\Generic $session) + public function __construct(\Magento\Session\Generic $session) { $this->_session = $session; } diff --git a/app/code/Magento/Install/Model/Wizard.php b/app/code/Magento/Install/Model/Wizard.php index 7efa2688855..7dae36876f1 100644 --- a/app/code/Magento/Install/Model/Wizard.php +++ b/app/code/Magento/Install/Model/Wizard.php @@ -90,10 +90,10 @@ class Wizard /** * Get wizard step by request * - * @param \Zend_Controller_Request_Abstract $request + * @param \Magento\App\RequestInterface $request * @return \Magento\Object|bool */ - public function getStepByRequest(\Zend_Controller_Request_Abstract $request) + public function getStepByRequest(\Magento\App\RequestInterface $request) { foreach ($this->_steps as $step) { if ($step->getController() == $request->getControllerName() diff --git a/app/code/Magento/Install/etc/di.xml b/app/code/Magento/Install/etc/di.xml index 551fc38f61b..9e6010fc24b 100644 --- a/app/code/Magento/Install/etc/di.xml +++ b/app/code/Magento/Install/etc/di.xml @@ -25,11 +25,16 @@ --> <config> <preference for="Magento\View\Design\Theme\ListInterface" type="Magento\Core\Model\Theme\Collection" /> - <virtualType name="Magento\Install\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\Install\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>install</value> </param> </virtualType> + <virtualType name="Magento\Install\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\Install\Model\Session\Storage" /> + </param> + </virtualType> <type name="Magento\Install\Block\Begin"> <param name="eulaFile"> <value>LICENSE.html</value> @@ -125,11 +130,6 @@ <instance type="Magento\Install\Model\Session" /> </param> </type> - <type name="Magento\Install\Model\Installer\Pear"> - <param name='session'> - <instance type="Magento\Install\Model\Session" /> - </param> - </type> <type name="Magento\Install\Model\Installer\AbstractInstaller"> <param name="installer"> <instance type="Magento\Install\Model\Installer\Proxy" /> diff --git a/app/code/Magento/Install/etc/frontend/di.xml b/app/code/Magento/Install/etc/frontend/di.xml index 858d3a8bbfb..6599f16c1c8 100644 --- a/app/code/Magento/Install/etc/frontend/di.xml +++ b/app/code/Magento/Install/etc/frontend/di.xml @@ -31,9 +31,14 @@ </value> </param> </type> - <type name="Magento\Install\Model\Session"> - <param name="sessionNamespace"> + <virtualType name="Magento\Install\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>install</value> </param> + </virtualType> + <type name="Magento\Install\Model\Session"> + <param name="storage"> + <instance type="Magento\Install\Model\Session\Storage" /> + </param> </type> </config> diff --git a/app/code/Magento/Install/etc/module.xml b/app/code/Magento/Install/etc/module.xml index 103276bde5e..c8b923e08a9 100755 --- a/app/code/Magento/Install/etc/module.xml +++ b/app/code/Magento/Install/etc/module.xml @@ -31,7 +31,6 @@ <depends> <module name="Magento_Core"/> <module name="Magento_AdminNotification"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Directory"/> <module name="Magento_User"/> <module name="Magento_Backend"/> diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tabs.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tabs.php index 1bfaaefb923..39a3ffe2a02 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tabs.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tabs.php @@ -29,7 +29,7 @@ use Magento\Backend\Block\Widget\Tabs as TabsWidget; class Tabs extends TabsWidget { - protected $_template = 'Magento_Adminhtml::widget/tabshoriz.phtml'; + protected $_template = 'Magento_Backend::widget/tabshoriz.phtml'; protected function _construct() { diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php index 8f32e05d58b..8154d320acf 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php @@ -29,7 +29,7 @@ namespace Magento\Integration\Block\Adminhtml\Integration; use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info; use Magento\Integration\Controller\Adminhtml\Integration; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry @@ -38,17 +38,25 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container */ protected $_registry = null; + /** @var \Magento\Integration\Helper\Data */ + protected $_integrationHelper; + /** + * Initialize dependencies. + * * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Integration\Helper\Data $integrationHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Integration\Helper\Data $integrationHelper, array $data = array() ) { $this->_registry = $registry; + $this->_integrationHelper = $integrationHelper; parent::__construct($context, $data); } @@ -64,6 +72,12 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container $this->_removeButton('reset'); $this->_removeButton('delete'); + if ($this->_integrationHelper->isConfigType( + $this->_registry->registry(Integration::REGISTRY_KEY_CURRENT_INTEGRATION)) + ) { + $this->_removeButton('save'); + } + if ($this->_isNewIntegration()) { $this->removeButton('save')->addButton( 'save', diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Form.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Form.php index 2d38b893f23..da06b9cd6b8 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Form.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Form.php @@ -37,7 +37,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Prepare form before rendering HTML * - * @return \Magento\Adminhtml\Block\Widget\Form + * @return \Magento\Backend\Block\Widget\Form */ protected function _prepareForm() { diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php index 9755e8ffe58..c4b95ff7d9a 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php @@ -46,6 +46,7 @@ class Info extends \Magento\Backend\Block\Widget\Form\Generic const DATA_NAME = 'name'; const DATA_EMAIL = 'email'; const DATA_ENDPOINT = 'endpoint'; + const DATA_IDENTITY_LINK_URL = 'identity_link_url'; const DATA_SETUP_TYPE = 'setup_type'; const DATA_CONSUMER_ID = 'consumer_id'; /**#@-*/ @@ -163,6 +164,18 @@ class Info extends \Magento\Backend\Block\Widget\Form\Generic // @codingStandardsIgnoreEnd ) ); + $fieldset->addField( + self::DATA_IDENTITY_LINK_URL, + 'text', + array( + 'label' => __('Identity link URL'), + 'name' => self::DATA_IDENTITY_LINK_URL, + 'disabled' => $disabled, + 'note' => __( + 'URL to redirect user to link their 3rd party account with this Magento integration credentials.' + ) + ) + ); } /** diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tabs.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tabs.php index 4baf8ae6b08..07773f3864d 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tabs.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tabs.php @@ -26,7 +26,7 @@ namespace Magento\Integration\Block\Adminhtml\Integration\Edit; -class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs +class Tabs extends \Magento\Backend\Block\Widget\Tabs { /** * Initialize integration edit page tabs diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link.php index d675789d15c..57949fe0fca 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link.php @@ -35,6 +35,25 @@ class Link extends AbstractRenderer /** @var \Magento\Object */ protected $_row; + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + + /** + * @param \Magento\Backend\Block\Context $context + * @param \Magento\Core\Helper\Data $coreHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Context $context, + \Magento\Core\Helper\Data $coreHelper, + array $data = array() + ) { + $this->_coreHelper = $coreHelper; + parent::__construct($context, $data); + } + /** * Render grid row * @@ -129,7 +148,7 @@ class Link extends AbstractRenderer protected function _getAttributes() { /** @var \Magento\Core\Helper\Data $helper */ - $helper = $this->helper('Magento\Core\Helper\Data'); + $helper = $this->_coreHelper; $attributes = ['title' => $this->getCaption()]; foreach ($this->_getDataAttributes() as $key => $attr) { diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/Activate.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/Activate.php index c96b7e74f4b..dad74144795 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/Activate.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/Activate.php @@ -32,20 +32,12 @@ use Magento\Object; class Activate extends Link { - /** - * {@inheritDoc} - */ - public function getUrlPattern() - { - return ($this->_row->getStatus() == Integration::STATUS_INACTIVE) ? '*/*/activate' : '*/*/deactivate'; - } - /** * {@inheritDoc} */ public function getCaption() { - return ($this->_row->getStatus() == Integration::STATUS_INACTIVE) ? __('Activate') : __('Deactivate'); + return ($this->_row->getStatus() == Integration::STATUS_INACTIVE) ? __('Activate') : __('Reauthorize'); } /** @@ -72,7 +64,9 @@ class Activate extends Link { return [ 'row-id' => $this->_row->getId(), - 'row-dialog' => $this->_row->getStatus() === Integration::STATUS_ACTIVE ? 'deactivate' : 'permissions' + 'row-dialog' => 'permissions', + 'row-is-reauthorize' => ($this->_row->getStatus() == Integration::STATUS_INACTIVE) ? '0' : '1', + 'row-is-token-exchange' => ($this->_row->getEndpoint() && $this->_row->getIdentityLinkUrl()) ? '1' : '0' ]; } } diff --git a/app/code/Magento/Integration/Controller/Adminhtml/Integration.php b/app/code/Magento/Integration/Controller/Adminhtml/Integration.php index 63c56ae663b..3c30498bc61 100644 --- a/app/code/Magento/Integration/Controller/Adminhtml/Integration.php +++ b/app/code/Magento/Integration/Controller/Adminhtml/Integration.php @@ -38,15 +38,15 @@ class Integration extends Action /** Param Key for extracting integration id from Request */ const PARAM_INTEGRATION_ID = 'id'; - /** Keys used for registering data into the registry */ + /** Reauthorize flag is used to distinguish activation from reauthorization */ + const PARAM_REAUTHORIZE = 'reauthorize'; + const REGISTRY_KEY_CURRENT_INTEGRATION = 'current_integration'; /** - * Core registry - * * @var \Magento\Core\Model\Registry */ - protected $_registry = null; + protected $_registry; /** @var \Magento\Logger */ protected $_logger; @@ -57,7 +57,7 @@ class Integration extends Action /** @var IntegrationOauthService */ protected $_oauthService; - /** @var \Magento\Core\Helper\Data */ + /** @var \Magento\Core\Helper\Data */ protected $_coreHelper; /** @var \Magento\Integration\Helper\Data */ @@ -152,12 +152,12 @@ class Integration extends Action $integrationData = $this->_integrationService->get($integrationId)->getData(); $originalName = $integrationData[Info::DATA_NAME]; } catch (IntegrationException $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/'); return; } catch (\Exception $e) { $this->_logger->logException($e); - $this->_getSession()->addError(__('Internal error. Check exception log for details.')); + $this->messageManager->addError(__('Internal error. Check exception log for details.')); $this->_redirect('*/*'); return; } @@ -166,7 +166,7 @@ class Integration extends Action $integrationData = array_merge($integrationData, $restoredIntegration); } } else { - $this->_getSession()->addError(__('Integration ID is not specified or is invalid.')); + $this->messageManager->addError(__('Integration ID is not specified or is invalid.')); $this->_redirect('*/*/'); return; } @@ -174,11 +174,15 @@ class Integration extends Action $this->_view->loadLayout(); $this->_getSession()->setIntegrationData(array()); $this->_setActiveMenu('Magento_Integration::system_integrations'); - $this->_addBreadcrumb( - __('Edit "%1" Integration', $integrationData[Info::DATA_NAME]), - __('Edit "%1" Integration', $integrationData[Info::DATA_NAME]) - ); - $this->_title->add(__('Edit "%1" Integration', $originalName)); + + if ($this->_integrationData->isConfigType($integrationData)) { + $title = __('View "%1" Integration', $originalName); + } else { + $title = __('Edit "%1" Integration', $originalName); + } + + $this->_addBreadcrumb($title, $title); + $this->_title->add($title); $this->_view->renderLayout(); } @@ -198,12 +202,12 @@ class Integration extends Action try { $integrationData = $this->_integrationService->get($integrationId)->getData(); } catch (IntegrationException $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/'); return; } catch (\Exception $e) { $this->_logger->logException($e); - $this->_getSession()->addError(__('Internal error. Check exception log for details.')); + $this->messageManager->addError(__('Internal error. Check exception log for details.')); $this->_redirect('*/*'); return; } @@ -217,33 +221,36 @@ class Integration extends Action } $integrationData = array_merge($integrationData, $data); if (!isset($integrationData[Info::DATA_ID])) { - $integrationData = $this->_integrationService->create($integrationData); + $integration = $this->_integrationService->create($integrationData); } else { - $integrationData = $this->_integrationService->update($integrationData); + $integration = $this->_integrationService->update($integrationData); } if (!$this->getRequest()->isXmlHttpRequest()) { - $this->_getSession() - ->addSuccess(__('The integration \'%1\' has been saved.', $integrationData[Info::DATA_NAME])); + $this->messageManager + ->addSuccess(__('The integration \'%1\' has been saved.', $integration->getName())); + } + if ($this->getRequest()->isXmlHttpRequest()) { + $isTokenExchange = ($integration->getEndpoint() && $integration->getIdentityLinkUrl()) ? '1' : '0'; + $this->getResponse()->setBody( + $this->_coreHelper->jsonEncode( + ['integrationId' => $integration->getId(), 'isTokenExchange' => $isTokenExchange] + ) + ); + } else { + $this->_redirect('*/*/'); } } else { - $this->_getSession()->addError(__('The integration was not saved.')); - } - if ($this->getRequest()->isXmlHttpRequest()) { - $this->getResponse()->setBody( - $this->_coreHelper->jsonEncode(['integrationId' => $integrationData[Info::DATA_ID]]) - ); - } else { - $this->_redirect('*/*/'); + $this->messageManager->addError(__('The integration was not saved.')); } } catch (IntegrationException $e) { - $this->_getSession()->addError($e->getMessage())->setIntegrationData($integrationData); + $this->messageManager->addError($e->getMessage())->setIntegrationData($integrationData); $this->_redirectOnSaveError(); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirectOnSaveError(); } catch (\Exception $e) { $this->_logger->logException($e); - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirectOnSaveError(); } } @@ -254,23 +261,22 @@ class Integration extends Action public function permissionsDialogAction() { $integrationId = (int)$this->getRequest()->getParam(self::PARAM_INTEGRATION_ID); - if ($integrationId) { try { $integrationData = $this->_integrationService->get($integrationId)->getData(); $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $integrationData); } catch (IntegrationException $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/'); return; } catch (\Exception $e) { $this->_logger->logException($e); - $this->_getSession()->addError(__('Internal error. Check exception log for details.')); + $this->messageManager->addError(__('Internal error. Check exception log for details.')); $this->_redirect('*/*'); return; } } else { - $this->_getSession()->addError(__('Integration ID is not specified or is invalid.')); + $this->messageManager->addError(__('Integration ID is not specified or is invalid.')); $this->_redirect('*/*/'); return; } @@ -298,7 +304,7 @@ class Integration extends Action if ($integrationId) { $integrationData = $this->_integrationService->get($integrationId); if ($this->_integrationData->isConfigType($integrationData)) { - $this->_getSession()->addError( + $this->messageManager->addError( __("Uninstall the extension to remove integration '%1'.", $integrationData[Info::DATA_NAME]) ); $this->_redirect('*/*/'); @@ -306,21 +312,21 @@ class Integration extends Action } $integrationData = $this->_integrationService->delete($integrationId); if (!$integrationData[Info::DATA_ID]) { - $this->_getSession()->addError(__('This integration no longer exists.')); + $this->messageManager->addError(__('This integration no longer exists.')); } else { //Integration deleted successfully, now safe to delete the associated consumer data if (isset($integrationData[Info::DATA_CONSUMER_ID])) { $this->_oauthService->deleteConsumer($integrationData[Info::DATA_CONSUMER_ID]); } $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $integrationData); - $this->_getSession() + $this->messageManager ->addSuccess(__("The integration '%1' has been deleted.", $integrationData[Info::DATA_NAME])); } } else { - $this->_getSession()->addError(__('Integration ID is not specified or is invalid.')); + $this->messageManager->addError(__('Integration ID is not specified or is invalid.')); } } catch (\Magento\Integration\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_logger->logException($e); } @@ -328,32 +334,87 @@ class Integration extends Action } /** - * Show tokens popup. + * Show tokens popup for simple tokens */ public function tokensDialogAction() { try { - $integrationId = $this->getRequest()->getParam('id'); + $integrationId = $this->getRequest()->getParam(self::PARAM_INTEGRATION_ID); $integration = $this->_integrationService->get($integrationId); - $this->_oauthService->createAccessToken($integration->getConsumerId()); + $clearExistingToken = (int)$this->getRequest()->getParam(self::PARAM_REAUTHORIZE, 0); + if ($this->_oauthService->createAccessToken($integration->getConsumerId(), $clearExistingToken)) { + $integration->setStatus(IntegrationModel::STATUS_ACTIVE)->save(); + } $this->_registry->register( self::REGISTRY_KEY_CURRENT_INTEGRATION, + // Important to call get() once again - that will pull newly generated token $this->_integrationService->get($integrationId)->getData() ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*'); return; } catch (\Exception $e) { $this->_logger->logException($e); - $this->_getSession()->addError(__('Internal error. Check exception log for details.')); + $this->messageManager->addError(__('Internal error. Check exception log for details.')); $this->_redirect('*/*'); return; } $this->_view->loadLayout(false); + //This cannot precede loadlayout(false) else the messages will be removed + $this->_setActivationSuccessMsg($clearExistingToken, $integration->getName()); $this->_view->renderLayout(); } + /** + * Post consumer credentials for Oauth integration. + */ + public function tokensExchangeAction() + { + try { + $integrationId = $this->getRequest()->getParam(self::PARAM_INTEGRATION_ID); + $isReauthorize = (bool)$this->getRequest()->getParam(self::PARAM_REAUTHORIZE, 0); + $integration = $this->_integrationService->get($integrationId); + if ($isReauthorize) { + /** Remove existing token associated with consumer before issuing a new one. */ + $this->_oauthService->deleteToken($integration->getConsumerId()); + $integration->setStatus(IntegrationModel::STATUS_INACTIVE)->save(); + } + //Integration chooses to use Oauth for token exchange + $this->_oauthService->postToConsumer($integration->getConsumerId(), $integration->getEndpoint()); + /** Generate JS popup content */ + $this->_view->loadLayout(false); + // Activation or authorization is done only when the Oauth token exchange completes + $this->_setActivationInProcessMsg($isReauthorize, $integration->getName()); + $this->_view->renderLayout(); + $popupContent = $this->_response->getBody(); + /** Initialize response body */ + $result = [ + IntegrationModel::IDENTITY_LINK_URL => $integration->getIdentityLinkUrl(), + IntegrationModel::CONSUMER_ID => $integration->getConsumerId(), + 'popup_content' => $popupContent + ]; + $this->getResponse()->setBody($this->_coreHelper->jsonEncode($result)); + } catch (\Magento\Core\Exception $e) { + $this->messageManager->addError($e->getMessage()); + $this->_redirect('*/*'); + return; + } catch (\Exception $e) { + $this->_logger->logException($e); + $this->messageManager->addError(__('Internal error. Check exception log for details.')); + $this->_redirect('*/*'); + return; + } + } + + /** + * Close window after callback has succeeded + */ + public function loginSuccessCallbackAction() + { + $this->getResponse()->setBody('<script type="text/javascript">setTimeout("self.close()",1000);</script>'); + } + /** * Redirect merchant to 'Edit integration' or 'New integration' if error happened during integration save. */ @@ -385,4 +446,43 @@ class Integration extends Action return parent::_redirect($path, $arguments); } } + + /** + * Set success message based on Integration activation or re-authorization. + * + * @param boolean $isReauthorize Is a re-authorization flow + * @param string $integrationName Integration name + */ + protected function _setActivationSuccessMsg($isReauthorize, $integrationName) + { + $successMsg = $isReauthorize ? __("The integration '%1' has been re-authorized.", $integrationName) + : __("The integration '%1' has been activated.", $integrationName); + $this->messageManager->addSuccess($successMsg); + } + + /** + * Let the admin know that activation was failed. + * + * @param bool $isReauthorize + * @param string $integrationName + */ + protected function _setActivationFailedMsg($isReauthorize, $integrationName) + { + $msg = $isReauthorize ? __("Integration '%1' re-authorization has been failed.", $integrationName) + : __("Integration '%1' activation has been failed.", $integrationName); + $this->messageManager->addError($msg); + } + + /** + * Let the admin know that integration has been sent for activation and token exchange is in process. + * + * @param bool $isReauthorize + * @param string $integrationName + */ + protected function _setActivationInProcessMsg($isReauthorize, $integrationName) + { + $msg = $isReauthorize ? __("Integration '%1' has been sent for re-authorization.", $integrationName) + : __("Integration '%1' has been sent for activation.", $integrationName); + $this->messageManager->addNotice($msg); + } } diff --git a/app/code/Magento/Integration/Controller/Token.php b/app/code/Magento/Integration/Controller/Token.php index 1a8c6185628..0900f256a20 100644 --- a/app/code/Magento/Integration/Controller/Token.php +++ b/app/code/Magento/Integration/Controller/Token.php @@ -22,31 +22,47 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Integration\Controller; + +use Magento\Integration\Service\OauthV1Interface as IntegrationOauthService; +use Magento\Integration\Service\IntegrationV1Interface as IntegrationService; +use Magento\Integration\Model\Integration as IntegrationModel; + /** * oAuth token controller */ -namespace Magento\Integration\Controller; - class Token extends \Magento\App\Action\Action { /** @var \Magento\Oauth\OauthInterface */ protected $_oauthService; + /** @var IntegrationOauthService */ + protected $_intOauthService; + + /** @var IntegrationService */ + protected $_integrationService; + /** @var \Magento\Oauth\Helper\Request */ protected $_helper; - /*** + /** * @param \Magento\App\Action\Context $context * @param \Magento\Oauth\OauthInterface $oauthService + * @param IntegrationOauthService $intOauthService + * @param IntegrationService $integrationService * @param \Magento\Oauth\Helper\Request $helper */ public function __construct( \Magento\App\Action\Context $context, \Magento\Oauth\OauthInterface $oauthService, + IntegrationOauthService $intOauthService, + IntegrationService $integrationService, \Magento\Oauth\Helper\Request $helper ) { parent::__construct($context); $this->_oauthService = $oauthService; + $this->_intOauthService = $intOauthService; + $this->_integrationService = $integrationService; $this->_helper = $helper; } @@ -82,7 +98,15 @@ class Token extends \Magento\App\Action\Action // Request access token in exchange of a pre-authorized token $response = $this->_oauthService->getAccessToken( - $request, $requestUrl, $this->getRequest()->getMethod()); + $request, + $requestUrl, + $this->getRequest()->getMethod() + ); + //After sending the access token, update the integration status to active; + $consumer = $this->_intOauthService->loadConsumerByKey($request['oauth_consumer_key']); + $this->_integrationService->findByConsumerId($consumer->getId()) + ->setStatus(IntegrationModel::STATUS_ACTIVE) + ->save(); } catch (\Exception $exception) { $response = $this->_helper->prepareErrorResponse( $exception, diff --git a/app/code/Magento/Integration/Model/Config/Converter.php b/app/code/Magento/Integration/Model/Config/Converter.php index df21a836308..72fdee04992 100644 --- a/app/code/Magento/Integration/Model/Config/Converter.php +++ b/app/code/Magento/Integration/Model/Config/Converter.php @@ -33,6 +33,7 @@ class Converter implements \Magento\Config\ConverterInterface */ const KEY_EMAIL = 'email'; const KEY_AUTHENTICATION_ENDPOINT_URL = 'endpoint_url'; + const KEY_IDENTITY_LINKING_URL = 'identity_link_url'; /**#@-*/ /** @@ -54,12 +55,16 @@ class Converter implements \Magento\Config\ConverterInterface /** @var \DOMElement $email */ $email = $integration->getElementsByTagName('email')->item(0)->nodeValue; $result[$integrationName][self::KEY_EMAIL] = $email; - if ($integration->getElementsByTagName('endpoint_url')->length) { /** @var \DOMElement $endpointUrl */ $endpointUrl = $integration->getElementsByTagName('endpoint_url')->item(0)->nodeValue; $result[$integrationName][self::KEY_AUTHENTICATION_ENDPOINT_URL] = $endpointUrl; } + if ($integration->getElementsByTagName('identity_link_url')->length) { + /** @var \DOMElement $identityLinkUrl */ + $identityLinkUrl = $integration->getElementsByTagName('identity_link_url')->item(0)->nodeValue; + $result[$integrationName][self::KEY_IDENTITY_LINKING_URL] = $identityLinkUrl; + } } return $result; } diff --git a/app/code/Magento/Integration/Model/Config/SchemaLocator.php b/app/code/Magento/Integration/Model/Config/SchemaLocator.php index 1d64acb9b78..154a231b8ac 100644 --- a/app/code/Magento/Integration/Model/Config/SchemaLocator.php +++ b/app/code/Magento/Integration/Model/Config/SchemaLocator.php @@ -47,8 +47,7 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface */ public function __construct(\Magento\Module\Dir\Reader $moduleReader) { - $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Integration') . DIRECTORY_SEPARATOR . - DIRECTORY_SEPARATOR . 'integration' . DIRECTORY_SEPARATOR . 'config.xsd'; + $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Integration') . '/integration/config.xsd'; } /** diff --git a/app/code/Magento/Integration/Model/Integration.php b/app/code/Magento/Integration/Model/Integration.php index 0659bb46795..3e8e6247684 100644 --- a/app/code/Magento/Integration/Model/Integration.php +++ b/app/code/Magento/Integration/Model/Integration.php @@ -31,14 +31,15 @@ namespace Magento\Integration\Model; * @method Integration setName(\string $name) * @method \string getEmail() * @method Integration setEmail(\string $email) - * @method \int getStatus() * @method Integration setStatus(\int $value) * @method \int getType() * @method Integration setType(\int $value) - * @method \string getEndpoint() * @method Integration setConsumerId(\string $consumerId) * @method \string getConsumerId() + * @method \string getEndpoint() * @method Integration setEndpoint(\string $endpoint) + * @method \string getIdentityLinkUrl() + * @method Integration setIdentityLinkUrl(\string $identityLinkUrl) * @method \string getCreatedAt() * @method Integration setCreatedAt(\string $createdAt) * @method \string getUpdatedAt() @@ -67,8 +68,10 @@ class Integration extends \Magento\Core\Model\AbstractModel const NAME = 'name'; const EMAIL = 'email'; const ENDPOINT = 'endpoint'; + const IDENTITY_LINK_URL = 'identity_link_url'; const SETUP_TYPE = 'setup_type'; const CONSUMER_ID = 'consumer_id'; + const STATUS = 'status'; /**#@-*/ /** @@ -132,4 +135,14 @@ class Integration extends \Magento\Core\Model\AbstractModel { return $this->load($consumerId, self::CONSUMER_ID); } + + /** + * Get integration status. Cast to the type of STATUS_* constants in order to make strict comparison valid. + * + * @return int + */ + public function getStatus() + { + return (int)$this->getData(self::STATUS); + } } diff --git a/app/code/Magento/Integration/Model/Manager.php b/app/code/Magento/Integration/Model/Manager.php index 50f3e915252..4e63ebacb0e 100644 --- a/app/code/Magento/Integration/Model/Manager.php +++ b/app/code/Magento/Integration/Model/Manager.php @@ -82,6 +82,10 @@ class Manager $integrationData[Integration::ENDPOINT] = $integrationDetails[Converter::KEY_AUTHENTICATION_ENDPOINT_URL]; } + if (isset($integrationDetails[Converter::KEY_IDENTITY_LINKING_URL])) { + $integrationData[Integration::IDENTITY_LINK_URL] = + $integrationDetails[Converter::KEY_IDENTITY_LINKING_URL]; + } $integrationData[Integration::SETUP_TYPE] = Integration::TYPE_CONFIG; // If it already exists, update it $integration = $this->_integrationService->findByName($name); diff --git a/app/code/Magento/Integration/Model/Oauth/Token.php b/app/code/Magento/Integration/Model/Oauth/Token.php index 22117849efb..83d34df2b53 100644 --- a/app/code/Magento/Integration/Model/Oauth/Token.php +++ b/app/code/Magento/Integration/Model/Oauth/Token.php @@ -94,6 +94,8 @@ class Token extends \Magento\Core\Model\AbstractModel protected $_dateTime; /** + * Initialize dependencies. + * * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Integration\Model\Oauth\Consumer\Validator\KeyLengthFactory $keyLengthFactory @@ -105,7 +107,6 @@ class Token extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data - * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( diff --git a/app/code/Magento/Integration/Service/IntegrationV1.php b/app/code/Magento/Integration/Service/IntegrationV1.php index 91a8b838b8e..d6125905499 100644 --- a/app/code/Magento/Integration/Service/IntegrationV1.php +++ b/app/code/Magento/Integration/Service/IntegrationV1.php @@ -117,6 +117,15 @@ class IntegrationV1 implements \Magento\Integration\Service\IntegrationV1Interfa return $integration; } + /** + * {@inheritdoc} + */ + public function findByConsumerId($consumerId) + { + $integration = $this->_integrationFactory->create()->load($consumerId, 'consumer_id'); + return $integration; + } + /** * Check if an integration exists by the name * diff --git a/app/code/Magento/Integration/Service/IntegrationV1Interface.php b/app/code/Magento/Integration/Service/IntegrationV1Interface.php index d5c47a0d47a..0a25e04faff 100644 --- a/app/code/Magento/Integration/Service/IntegrationV1Interface.php +++ b/app/code/Magento/Integration/Service/IntegrationV1Interface.php @@ -53,10 +53,18 @@ interface IntegrationV1Interface * Find Integration by name. * * @param string $integrationName - * @return array|null Integration data or null if not found + * @return IntegrationModel */ public function findByName($integrationName); + /** + * Get the details of an Integration by consumer_id. + * + * @param int $consumerId + * @return IntegrationModel + */ + public function findByConsumerId($consumerId); + /** * Update an Integration. * diff --git a/app/code/Magento/Integration/Service/OauthV1.php b/app/code/Magento/Integration/Service/OauthV1.php index a4e8d7ec2db..c73c8e0bd39 100644 --- a/app/code/Magento/Integration/Service/OauthV1.php +++ b/app/code/Magento/Integration/Service/OauthV1.php @@ -118,12 +118,15 @@ class OauthV1 implements OauthV1Interface /** * {@inheritdoc} */ - public function createAccessToken($consumerId) + public function createAccessToken($consumerId, $clearExistingToken = false) { - // TODO: This implementation is temporary and should be changed after requirements clarification try { $consumer = $this->_consumerFactory->create()->load($consumerId); $existingToken = $this->_tokenProvider->getTokenByConsumerId($consumer->getId()); + if ($existingToken && $clearExistingToken) { + $existingToken->delete(); + unset($existingToken); + } } catch (\Exception $e) { } if (!isset($existingToken)) { @@ -167,6 +170,20 @@ class OauthV1 implements OauthV1Interface } } + /** + * {@inheritdoc} + */ + public function loadConsumerByKey($key) + { + try { + return $this->_consumerFactory->create()->load($key, 'key'); + } catch (\Magento\Core\Exception $exception) { + throw $exception; + } catch (\Exception $exception) { + throw new \Magento\Oauth\Exception(__('Unexpected error. Unable to load oAuth consumer account.')); + } + } + /** * {@inheritdoc} */ @@ -216,6 +233,21 @@ class OauthV1 implements OauthV1Interface return $data; } + /** + * {@inheritdoc} + */ + public function deleteToken($consumerId) + { + try { + $consumer = $this->_consumerFactory->create()->load($consumerId); + $existingToken = $this->_tokenProvider->getTokenByConsumerId($consumer->getId()); + $existingToken->delete(); + return true; + } catch (\Exception $e) { + return false; + } + } + /** * Load consumer by id. * diff --git a/app/code/Magento/Integration/Service/OauthV1Interface.php b/app/code/Magento/Integration/Service/OauthV1Interface.php index 4f1593d2d1d..60936b63657 100644 --- a/app/code/Magento/Integration/Service/OauthV1Interface.php +++ b/app/code/Magento/Integration/Service/OauthV1Interface.php @@ -51,9 +51,10 @@ interface OauthV1Interface * Create access token for provided consumer. * * @param int $consumerId + * @param bool $clearExistingToken * @return bool If token was created */ - public function createAccessToken($consumerId); + public function createAccessToken($consumerId, $clearExistingToken = false); /** * Retrieve access token assigned to the consumer. @@ -73,6 +74,16 @@ interface OauthV1Interface */ public function loadConsumer($consumerId); + /** + * Load consumer by its key. + * + * @param string $key + * @return \Magento\Integration\Model\Oauth\Consumer + * @throws \Magento\Oauth\Exception + * @throws \Magento\Core\Exception + */ + public function loadConsumerByKey($key); + /** * Execute post to integration (consumer) HTTP Post URL. Generate and return oauth_verifier. * @@ -91,4 +102,12 @@ interface OauthV1Interface * @return array Consumer data array */ public function deleteConsumer($consumerId); + + /** + * Remove token associated with provided consumer. + * + * @param int $consumerId + * @return bool If token was deleted + */ + public function deleteToken($consumerId); } diff --git a/app/code/Magento/Integration/etc/adminhtml/menu.xml b/app/code/Magento/Integration/etc/adminhtml/menu.xml index d3f9e327259..7fc37ee5c36 100644 --- a/app/code/Magento/Integration/etc/adminhtml/menu.xml +++ b/app/code/Magento/Integration/etc/adminhtml/menu.xml @@ -27,7 +27,7 @@ --> <config> <menu> - <add id="Magento_Integration::system_extensions" title="Extensions" module="Magento_Integration" sortOrder="45" parent="Magento_Adminhtml::system" resource="Magento_Integration::extensions"/> + <add id="Magento_Integration::system_extensions" title="Extensions" module="Magento_Integration" sortOrder="45" parent="Magento_Backend::system" resource="Magento_Integration::extensions"/> <add id="Magento_Integration::system_integrations" title="Integrations" module="Magento_Integration" sortOrder="10" parent="Magento_Integration::system_extensions" action="adminhtml/integration" resource="Magento_Integration::integrations"/> </menu> </config> diff --git a/app/code/Magento/Integration/etc/adminhtml/routes.xml b/app/code/Magento/Integration/etc/adminhtml/routes.xml index 53fcd309330..3dbb25dadc9 100644 --- a/app/code/Magento/Integration/etc/adminhtml/routes.xml +++ b/app/code/Magento/Integration/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Integration_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Integration" before="Magento_Adminhtml" /> </route> </router> </config> diff --git a/app/code/Magento/Integration/etc/integration/config.xsd b/app/code/Magento/Integration/etc/integration/config.xsd index 1381c44c4af..4b13011ba9a 100644 --- a/app/code/Magento/Integration/etc/integration/config.xsd +++ b/app/code/Magento/Integration/etc/integration/config.xsd @@ -36,6 +36,7 @@ <xs:sequence> <xs:element name="email" type="emailType"/> <xs:element name="endpoint_url" type="urlType" minOccurs="0"/> + <xs:element name="identity_link_url" type="urlType" minOccurs="0"/> </xs:sequence> <xs:attribute name="name" type="integrationNameType" use="required"/> </xs:complexType> diff --git a/app/code/Magento/Integration/etc/module.xml b/app/code/Magento/Integration/etc/module.xml index f4b9ad3d881..12cbb6476e6 100755 --- a/app/code/Magento/Integration/etc/module.xml +++ b/app/code/Magento/Integration/etc/module.xml @@ -24,13 +24,11 @@ */ --> <config> - <module name="Magento_Integration" version="1.0.0.1" active="true"> + <module name="Magento_Integration" version="1.0.0.2" active="true"> <sequence> <module name="Magento_Core"/> - <module name="Magento_Adminhtml"/> </sequence> <depends> - <module name="Magento_Adminhtml"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> </depends> diff --git a/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php b/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php index ddada3104db..d32e4c67d53 100644 --- a/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php +++ b/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php @@ -242,7 +242,7 @@ $table = $installer->getConnection() \Magento\DB\Ddl\Table::TYPE_TEXT, 255, array(), - 'Endpoint for Oauth handshake' + 'Endpoint for posting consumer credentials' ) ->addColumn( 'status', diff --git a/app/code/Magento/Core/Model/Session/Exception.php b/app/code/Magento/Integration/sql/integration_setup/upgrade-1.0.0.1-1.0.0.2.php similarity index 71% rename from app/code/Magento/Core/Model/Session/Exception.php rename to app/code/Magento/Integration/sql/integration_setup/upgrade-1.0.0.1-1.0.0.2.php index 16b1d452875..1d237f2f624 100644 --- a/app/code/Magento/Core/Model/Session/Exception.php +++ b/app/code/Magento/Integration/sql/integration_setup/upgrade-1.0.0.1-1.0.0.2.php @@ -1,5 +1,7 @@ <?php /** + * Upgrade script for integration table. + * * Magento * * NOTICE OF LICENSE @@ -18,23 +20,18 @@ * 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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -/** - * Core Session \Exception - * - * Allows dispatching before and after events for each controller action - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Core\Model\Session; - -class Exception extends \Magento\Core\Exception -{} +/* @var \Magento\Integration\Model\Resource\Setup $installer */ +$installer = $this; +$installer->getConnection()->addColumn( + $installer->getTable('integration'), + 'identity_link_url', + array( + 'type' => \Magento\DB\Ddl\Table::TYPE_TEXT, + 'length' => 255, + 'comment' => 'Identity linking Url' + ) +); \ No newline at end of file diff --git a/app/code/Magento/Integration/view/adminhtml/integration.css b/app/code/Magento/Integration/view/adminhtml/integration.css index bd8e90ef861..f848409ec29 100644 --- a/app/code/Magento/Integration/view/adminhtml/integration.css +++ b/app/code/Magento/Integration/view/adminhtml/integration.css @@ -22,13 +22,13 @@ */ #integrationGrid_table .col-name { - width: 60%; + width: 75%; } #integrationGrid_table .col-status, #integrationGrid_table .col-reauthorize, #integrationGrid_table .col-authorize { - width: 12%; + width: 10%; } #integrationGrid_table .col-delete, diff --git a/app/code/Magento/Integration/view/adminhtml/integration/activate/permissions.phtml b/app/code/Magento/Integration/view/adminhtml/integration/activate/permissions.phtml index d99d82572ed..28f57093ef2 100644 --- a/app/code/Magento/Integration/view/adminhtml/integration/activate/permissions.phtml +++ b/app/code/Magento/Integration/view/adminhtml/integration/activate/permissions.phtml @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * - * @var \Magento\Adminhtml\Block\Widget\Form\Container $this + * @var \Magento\Backend\Block\Widget\Form\Container $this */ ?> <div><p><?php echo __('The integration you selected asks you to approve access to the following:'); ?></p></div> diff --git a/app/code/Magento/Integration/view/adminhtml/integration/popup_container.phtml b/app/code/Magento/Integration/view/adminhtml/integration/popup_container.phtml index d4696852e62..dae439c1eea 100644 --- a/app/code/Magento/Integration/view/adminhtml/integration/popup_container.phtml +++ b/app/code/Magento/Integration/view/adminhtml/integration/popup_container.phtml @@ -28,10 +28,11 @@ ?> <script type="text/javascript"> window.integration = new Integration( - '<?php echo $this->getUrl('*/*/permissionsDialog', ['id' => ':id']); ?>', - '<?php echo $this->getUrl('*/*/tokensDialog', ['id' => ':id']); ?>', - '', // Not implemented - '' // Not implemented + '<?php echo $this->getUrl('*/*/permissionsDialog', ['id' => ':id', 'reauthorize' => ':isReauthorize']); ?>', + '<?php echo $this->getUrl('*/*/tokensDialog', ['id' => ':id', 'reauthorize' => ':isReauthorize']); ?>', + '<?php echo $this->getUrl('*/*/tokensExchange', ['id' => ':id', 'reauthorize' => ':isReauthorize']); ?>', + '<?php echo $this->getUrl('*/*'); ?>', + '<?php echo $this->getUrl('*/*/loginSuccessCallback'); ?>' ); </script> <div id="integration-popup-container" style="display:none;"></div> diff --git a/app/code/Magento/Integration/view/adminhtml/integration/tokens_exchange.phtml b/app/code/Magento/Integration/view/adminhtml/integration/tokens_exchange.phtml new file mode 100644 index 00000000000..f16dab7f6e4 --- /dev/null +++ b/app/code/Magento/Integration/view/adminhtml/integration/tokens_exchange.phtml @@ -0,0 +1,29 @@ +<?php +/** + * Content of popup for tokens exchange action. + * + * 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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + * + * @var \Magento\Backend\Block\Template $this + */ +?> +<div><p><?php echo __("Please setup or sign in into your 3rd party account to complete setup of this integration."); ?></p></div> diff --git a/app/code/Magento/Integration/view/adminhtml/js/integration.js b/app/code/Magento/Integration/view/adminhtml/js/integration.js index e67ff6f9db4..5b4b93471c8 100644 --- a/app/code/Magento/Integration/view/adminhtml/js/integration.js +++ b/app/code/Magento/Integration/view/adminhtml/js/integration.js @@ -23,7 +23,7 @@ /*jshint jquery:true*/ /*global FORM_KEY*/ /*global integration*/ -(function($, window) { +(function ($, window) { "use strict"; $.widget('mage.integration', { /** @@ -75,7 +75,9 @@ window.integration.popup.show($('<span>').attr({ 'data-row-dialog': 'permissions', 'data-row-id': data['integrationId'], - 'data-row-name': $('#integration_properties_name').val() + 'data-row-name': $('#integration_properties_name').val(), + 'data-row-is-reauthorize': '0', + 'data-row-is-token-exchange': data['isTokenExchange'] })); var that = this; $('#integration-popup-container').on('dialogclose', function () { @@ -98,50 +100,171 @@ } }); - window.Integration = function (permissionsDialogUrl, tokensDialogUrl, deactivateDialogUrl, reauthorizeDialogUrl) { + window.Integration = function ( + permissionsDialogUrl, + tokensDialogUrl, + tokensExchangeUrl, + gridUrl, + successCallbackUrl + ) { var url = { permissions: permissionsDialogUrl, tokens: tokensDialogUrl, - deactivate: deactivateDialogUrl, - reauthorize: reauthorizeDialogUrl + tokensExchange: tokensExchangeUrl, + grid: gridUrl + }; + + var IdentityLogin = { + win: null, + strLocation: null, + checker: null, + isCalledBack: false, + //Info popup dialog. Should be hidden when login window is closed + jqInfoDialog: $('#integration-popup-container'), + successCallbackUrl: successCallbackUrl, + Constants: { + /* + This interval is set such that it adjusts to the child window closing timeout of 1000 ms. This will + give the checker function enough time to detect if the successCallback has been invoked + */ + CHECKER_INTERVAL: 500, + //Login screen size plus some buffer + WIDTH: 680, + HEIGHT: 510, + // subtract pixels(30) and width(680) from screen width to move popup from extreme left + LEFT: screen.width - 680 - 30, + // subtract pixels(300) and height(300) from screen height to move from top + TOP: screen.height - 510 - 300 + }, + + invokePopup: function (identityCallbackUrl, consumerId, jqInfoDialog) { + // Callback should be invoked only once. Reset callback flag on subsequent invocations. + IdentityLogin.isCalledBack = false; + IdentityLogin.jqInfoDialog = jqInfoDialog; + var param = $.param({"consumer_id": consumerId, "success_call_back": IdentityLogin.successCallbackUrl}); + IdentityLogin.win = window.open(identityCallbackUrl + '?' + param, '', + 'top=' + IdentityLogin.Constants.TOP + + ', left=' + IdentityLogin.Constants.LEFT + + ', width=' + IdentityLogin.Constants.WIDTH + + ', height=' + IdentityLogin.Constants.HEIGHT + ',scrollbars=no'); + + if (IdentityLogin.checker != null) { + //Clear any previous check + clearInterval(IdentityLogin.checker); + } + //Polling to detect url of the child window. + IdentityLogin.checker = setInterval( + IdentityLogin.fnCheckLocation, IdentityLogin.Constants.CHECKER_INTERVAL + ); + }, + + /** + * Function to check the location of the child popoup window. + * Once detected if the callback is successful, parent window will be reloaded + */ + fnCheckLocation: function () { + if (IdentityLogin.win == null) { + return; + } + // Check to see if the location has changed. + try { + //Is the success callback invoked + IdentityLogin.isCalledBack = IdentityLogin.win.location.href == IdentityLogin.successCallbackUrl; + if (IdentityLogin.win.closed || IdentityLogin.isCalledBack) { + //Stop the the polling + clearInterval(IdentityLogin.checker); + if (IdentityLogin.isCalledBack) { + $('body').trigger('processStart'); + //Check for window closed + window.location.reload(); + IdentityLogin.jqInfoDialog.dialog('close'); + } + } + } catch (e) { + //squash. In case Window closed without success callback, clear polling + if (IdentityLogin.win.closed) { + IdentityLogin.jqInfoDialog.dialog('close'); + clearInterval(IdentityLogin.checker); + } + return; + } + } }; var _showPopup = function (dialog, title, okButton, url) { $.ajax({ url: url, cache: false, - dataType: 'html', data: {form_key: window.FORM_KEY}, method: 'GET', beforeSend: function () { // Show the spinner $('body').trigger('processStart'); }, - success: function (html) { - var popup = $('#integration-popup-container'); - popup.html(html); + success: function (result) { + if (result.indexOf('_redirect') !== -1) { + window.location.href = JSON.parse(result)['_redirect']; + return; + } + var identityLinkUrl = null, + consumerId = null, + popupHtml = null, + popup = $('#integration-popup-container'); + try { + var resultObj = $.parseJSON(result); + identityLinkUrl = resultObj['identity_link_url']; + consumerId = resultObj['consumer_id']; + popupHtml = resultObj['popup_content']; + } catch (e) { + //This is expected if result is not json. Do nothing. + } + if (identityLinkUrl && consumerId && popupHtml) { + IdentityLogin.invokePopup(identityLinkUrl, consumerId, popup); + } else { + popupHtml = result; + } - var buttons = [{ - text: $.mage.__('Cancel'), - click: function() { - $(this).dialog('close'); - } - }]; - - // Add confirmation button to the list of dialog buttons - buttons.push(okButton); - - popup.dialog({ - title: title, - modal: true, - autoOpen: true, - minHeight: 450, - minWidth: 600, - dialogClass: 'integration-dialog', - position: {at: 'center'}, - buttons: buttons - }); + popup.html(popupHtml); + + var buttons = [], + dialogProperties = { + title: title, + modal: true, + autoOpen: true, + minHeight: 450, + minWidth: 600, + dialogClass: dialog == 'permissions' ? 'integration-dialog' : 'integration-dialog no-close', + position: {at: 'center'}, + closeOnEscape: false + }; + if (dialog == 'permissions') { + // We don't need this button in 'tokens' dialog, since if you got there - integration is + // already activated and have necessary tokens + buttons.push({ + text: $.mage.__('Cancel'), + click: function () { + $(this).dialog('close'); + } + }); + } else if (dialog == 'tokensExchange') { + dialogProperties['minHeight'] = 150; + dialogProperties['minWidth'] = 500; + } + + // Add confirmation button to the list of dialog buttons. okButton not set for tokenExchange dialog + if (okButton) { + buttons.push(okButton); + } + // Add button only if its not empty + if (buttons.length > 0) { + dialogProperties['buttons'] = buttons + } + popup.dialog(dialogProperties); + }, + error: function (jqXHR, status, error) { + alert($.mage.__('Sorry, something went wrong. Please try again later.')); + console && console.log(status + ': ' + error + "\nResponse text:\n" + jqXHR.responseText); }, complete: function () { // Hide the spinner @@ -154,8 +277,10 @@ popup: { show: function (ctx) { var dialog = $(ctx).attr('data-row-dialog'); + var isReauthorize = $(ctx).attr('data-row-is-reauthorize'); + var isTokenExchange = $(ctx).attr('data-row-is-token-exchange'); - if (['permissions', 'deactivate', 'reauthorize', 'tokens'].indexOf(dialog) === -1) { + if (!url.hasOwnProperty(dialog)) { throw 'Invalid dialog type'; } @@ -165,8 +290,8 @@ throw 'Unable to find integration ID'; } - // Replace placeholder in URL with actual ID - var ajaxUrl = url[dialog].replace(':id', integrationId); + // Replace placeholders in URL + var ajaxUrl = url[dialog].replace(':id', integrationId).replace(':isReauthorize', isReauthorize); try { // Get integration name either from current element or from neighbor column @@ -178,12 +303,14 @@ var okButton = { permissions: { - text: $.mage.__('Allow'), + text: (isReauthorize == '1') ? $.mage.__('Reauthorize') : $.mage.__('Allow'), 'class': 'primary', // This data is going to be used in the next dialog 'data-row-id': integrationId, 'data-row-name': integrationName, - 'data-row-dialog': 'tokens', + 'data-row-dialog': (isTokenExchange == '1') ? 'tokensExchange' : 'tokens', + 'data-row-is-reauthorize': isReauthorize, + 'data-row-is-token-exchange': isTokenExchange, click: function () { // Find the 'Allow' button and clone - it has all necessary data, but is going to be // destroyed along with the current dialog @@ -194,10 +321,11 @@ } }, tokens: { - text: $.mage.__('Activate'), + text: $.mage.__('Done'), 'class': 'primary', click: function () { - alert('Not implemented'); + // Integration has been activated at the point of generating tokens + window.location.href = url.grid; } } }; @@ -211,8 +339,8 @@ /** * Confirm dialog for delete integration action */ - $(function() { - $('#integrationGrid_table').on('click', 'button#delete', function(e){ + $(function () { + $('#integrationGrid_table').on('click', 'button#delete', function (e) { $('#integration-delete-container').dialog({ modal: true, autoOpen: true, @@ -222,11 +350,11 @@ dialogClass: "no-close", position: {at: 'top'}, buttons: { - Cancel: function() { - $(this).dialog( "close" ); + Cancel: function () { + $(this).dialog("close"); }, - Delete: function() { - $(this).dialog( "close" ); + Delete: function () { + $(this).dialog("close"); window.location.href = $(e.target).data('url'); } } diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml index eb8d6917d6b..e29f0820034 100644 --- a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml @@ -62,15 +62,6 @@ <argument name="id" xsi:type="string">status</argument> </arguments> </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="reauthorize"> - <arguments> - <argument name="renderer" xsi:type="string">Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Link\Reauthorize</argument> - <argument name="index" xsi:type="string">reauthorize</argument> - <argument name="id" xsi:type="string">reauthorize</argument> - <argument name="sortable" xsi:type="string">0</argument> - <argument name="filter" xsi:type="string">0</argument> - </arguments> - </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="activate"> <arguments> <argument name="renderer" xsi:type="string">Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Link\Activate</argument> diff --git a/app/code/Magento/Adminhtml/etc/module.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_tokensexchange.xml old mode 100755 new mode 100644 similarity index 77% rename from app/code/Magento/Adminhtml/etc/module.xml rename to app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_tokensexchange.xml index d6a5997479c..1c4872e5524 --- a/app/code/Magento/Adminhtml/etc/module.xml +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_tokensexchange.xml @@ -23,12 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<config> - <module name="Magento_Adminhtml" version="0.7.1" active="true"> - <depends> - <module name="Magento_Core"/> - <module name="Magento_Backend"/> - <module name="Magento_Weee"/> - </depends> - </module> -</config> + +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <block class="Magento\Backend\Block\Template" name="integration_tokenexchange_popup" template="Magento_Integration::integration/tokens_exchange.phtml" output="1" /> +</layout> diff --git a/app/code/Magento/Log/Model/Shell.php b/app/code/Magento/Log/Model/Shell.php index c3e4b8c75e9..568851c01a4 100644 --- a/app/code/Magento/Log/Model/Shell.php +++ b/app/code/Magento/Log/Model/Shell.php @@ -43,16 +43,14 @@ class Shell extends \Magento\Core\Model\AbstractShell /** * @param \Magento\Filesystem $filesystem * @param string $entryPoint - * @param \Magento\App\Dir $dir - * @param \Magento\Log\Model\Shell\Command\Factory $commandFactory + * @param Shell\Command\Factory $commandFactory */ public function __construct( \Magento\Filesystem $filesystem, $entryPoint, - \Magento\App\Dir $dir, \Magento\Log\Model\Shell\Command\Factory $commandFactory ) { - parent::__construct($filesystem, $entryPoint, $dir); + parent::__construct($filesystem, $entryPoint); $this->_commandFactory = $commandFactory; } diff --git a/app/code/Magento/Log/Model/Visitor.php b/app/code/Magento/Log/Model/Visitor.php index 701c8a91542..7dbdec20076 100644 --- a/app/code/Magento/Log/Model/Visitor.php +++ b/app/code/Magento/Log/Model/Visitor.php @@ -79,7 +79,7 @@ class Visitor extends \Magento\Core\Model\AbstractModel protected $_storeManager; /** - * @var \Magento\Core\Model\Session + * @var \Magento\Session\SessionManagerInterface */ protected $_session; @@ -119,7 +119,7 @@ class Visitor extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Sales\Model\QuoteFactory $quoteFactory - * @param \Magento\Core\Model\Session $session + * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\HTTP\Header $httpHeader @@ -138,7 +138,7 @@ class Visitor extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Sales\Model\QuoteFactory $quoteFactory, - \Magento\Core\Model\Session $session, + \Magento\Session\SessionManagerInterface $session, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Config $coreConfig, \Magento\HTTP\Header $httpHeader, @@ -184,7 +184,7 @@ class Visitor extends \Magento\Core\Model\AbstractModel /** * Retrieve session object * - * @return \Magento\Core\Model\Session\AbstractSession + * @return \Magento\Session\SessionManagerInterface */ protected function _getSession() { diff --git a/app/code/Magento/Log/etc/email_templates.xml b/app/code/Magento/Log/etc/email_templates.xml index 167e3eb0b44..9f03abd8c4c 100644 --- a/app/code/Magento/Log/etc/email_templates.xml +++ b/app/code/Magento/Log/etc/email_templates.xml @@ -24,5 +24,5 @@ */ --> <config> - <template id="system_log_error_email_template" label="Log Cleanup Warnings" file="cleanup_warning.html" type="text"/> + <template id="system_log_error_email_template" label="Log Cleanup Warnings" file="cleanup_warning.html" type="text" module="Magento_Log"/> </config> diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Problem.php b/app/code/Magento/Newsletter/Block/Adminhtml/Problem.php index cba4e53d636..3eebd6bc6e9 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Problem.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Problem.php @@ -68,7 +68,7 @@ class Problem extends \Magento\Backend\Block\Template protected function _prepareLayout() { $this->setChild('deleteButton', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button', 'del.button') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button', 'del.button') ->setData( array( 'label' => __('Delete Selected Problems'), @@ -78,7 +78,7 @@ class Problem extends \Magento\Backend\Block\Template ); $this->setChild('unsubscribeButton', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button', 'unsubscribe.button') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button', 'unsubscribe.button') ->setData( array( 'label' => __('Unsubscribe Selected'), diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Filter/Checkbox.php b/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Filter/Checkbox.php index b4e108e8386..ade99b2f935 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Filter/Checkbox.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Filter/Checkbox.php @@ -34,7 +34,7 @@ namespace Magento\Newsletter\Block\Adminhtml\Problem\Grid\Filter; -class Checkbox extends \Magento\Adminhtml\Block\Widget\Grid\Column\Filter\AbstractFilter +class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilter { public function getCondition() { diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Renderer/Checkbox.php b/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Renderer/Checkbox.php index 258a0fb9391..718f9c57c48 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Renderer/Checkbox.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Problem/Grid/Renderer/Checkbox.php @@ -34,7 +34,7 @@ namespace Magento\Newsletter\Block\Adminhtml\Problem\Grid\Renderer; -class Checkbox extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * Renders grid column diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php index 0f85f9b8944..83a494baf1c 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php @@ -106,13 +106,13 @@ class Edit extends \Magento\Backend\Block\Template $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true); } - $this->addChild('preview_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('preview_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Preview Template'), 'onclick' => 'queueControl.preview();', 'class' => 'preview' )); - $this->addChild('save_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save Newsletter'), 'class' => 'save primary', 'data_attribute' => array( @@ -122,7 +122,7 @@ class Edit extends \Magento\Backend\Block\Template ), )); - $this->addChild('save_and_resume', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_and_resume', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save and Resume'), 'class' => 'save', 'data_attribute' => array( @@ -140,12 +140,12 @@ class Edit extends \Magento\Backend\Block\Template ), )); - $this->addChild('reset_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('reset_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Reset'), 'onclick' => 'window.location = window.location' )); - $this->addChild('back_button','Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('back_button','Magento\Backend\Block\Widget\Button', array( 'label' => __('Back'), 'onclick' => "window.location.href = '" . $this->getUrl(( $this->getTemplateId() ? '*/template' : '*/*')) . "'", diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Grid/Renderer/Action.php b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Grid/Renderer/Action.php index 7a9f46b2b8b..6f2b379ed87 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Grid/Renderer/Action.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Grid/Renderer/Action.php @@ -34,7 +34,7 @@ namespace Magento\Newsletter\Block\Adminhtml\Queue\Grid\Renderer; -class Action extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Action +class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action { public function render(\Magento\Object $row) { diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview.php b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview.php index ecc6068997b..8e822c2d063 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview.php @@ -33,7 +33,7 @@ */ namespace Magento\Newsletter\Block\Adminhtml\Queue; -class Preview extends \Magento\Adminhtml\Block\Widget +class Preview extends \Magento\Backend\Block\Widget { /** * @var \Magento\Newsletter\Model\TemplateFactory @@ -97,7 +97,11 @@ class Preview extends \Magento\Adminhtml\Block\Widget $vars['subscriber'] = $this->_subscriberFactory->create(); $template->emulateDesign($storeId); - $templateProcessed = $template->getProcessedTemplate($vars, true); + $templateProcessed = $this->_appState->emulateAreaCode( + \Magento\Newsletter\Model\Template::DEFAULT_DESIGN_AREA, + array($template, 'getProcessedTemplate'), + array($vars, true) + ); $template->revertDesign(); if ($template->isPlain()) { diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview/Form.php b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview/Form.php index 13b54900a8c..b38d4537e2b 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview/Form.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview/Form.php @@ -38,7 +38,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Preparing from for revision page * - * @return \Magento\Adminhtml\Block\Widget\Form + * @return \Magento\Backend\Block\Widget\Form */ protected function _prepareForm() { diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid.php b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid.php index f6f9f93c971..73aafce7e3f 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid.php @@ -43,17 +43,19 @@ class Grid extends \Magento\Backend\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Newsletter\Model\QueueFactory $queueFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Newsletter\Model\QueueFactory $queueFactory, array $data = array() ) { $this->_queueFactory = $queueFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Checkbox.php b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Checkbox.php index a2f94fa1850..bbe55641a71 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Checkbox.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Checkbox.php @@ -34,7 +34,7 @@ namespace Magento\Newsletter\Block\Adminhtml\Subscriber\Grid\Filter; -class Checkbox extends \Magento\Adminhtml\Block\Widget\Grid\Column\Filter\AbstractFilter +class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilter { public function getCondition() { diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Renderer/Checkbox.php b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Renderer/Checkbox.php index bbdfa60cf8c..492240c7378 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Renderer/Checkbox.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Renderer/Checkbox.php @@ -34,7 +34,7 @@ namespace Magento\Newsletter\Block\Adminhtml\Subscriber\Grid\Renderer; -class Checkbox extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * Renders grid column diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php index ee4a5631bb1..f2adfcb6f2e 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php @@ -33,7 +33,7 @@ */ namespace Magento\Newsletter\Block\Adminhtml\Template; -class Edit extends \Magento\Adminhtml\Block\Widget +class Edit extends \Magento\Backend\Block\Widget { /** * Edit Block model @@ -94,26 +94,26 @@ class Edit extends \Magento\Adminhtml\Block\Widget $block->setCanLoadTinyMce(true); } - $this->addChild('back_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('back_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Back'), 'onclick' => "window.location.href = '" . $this->getUrl('*/*') . "'", 'class' => 'action-back' )); - $this->addChild('reset_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('reset_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Reset'), 'onclick' => 'window.location.href = window.location.href', 'class' => 'reset' )); - $this->addChild('to_plain_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('to_plain_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Convert to Plain Text'), 'onclick' => 'templateControl.stripTags();', 'id' => 'convert_button', 'class' => 'convert' )); - $this->addChild('to_html_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('to_html_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Return HTML Version'), 'onclick' => 'templateControl.unStripTags();', 'id' => 'convert_button_back', @@ -121,25 +121,25 @@ class Edit extends \Magento\Adminhtml\Block\Widget 'class' => 'return' )); - $this->addChild('save_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save Template'), 'onclick' => 'templateControl.save();', 'class' => 'save primary' )); - $this->addChild('save_as_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_as_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save As'), 'onclick' => 'templateControl.saveAs();', 'class' => 'save-as' )); - $this->addChild('preview_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('preview_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Preview Template'), 'onclick' => 'templateControl.preview();', 'class' => 'preview' )); - $this->addChild('delete_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('delete_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete Template'), 'onclick' => 'templateControl.deleteTemplate();', 'class' => 'delete' diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid.php index f2ddc03b6ee..c6a4193d028 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid.php @@ -43,17 +43,19 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Newsletter\Model\Resource\Template\Collection $templateCollection * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Newsletter\Model\Resource\Template\Collection $templateCollection, array $data = array() ) { $this->_templateCollection = $templateCollection; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); $this->setEmptyText(__('No Templates Found')); } diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Action.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Action.php index 90d062c18e7..19bd6823461 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Action.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Action.php @@ -34,7 +34,7 @@ namespace Magento\Newsletter\Block\Adminhtml\Template\Grid\Renderer; -class Action extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Action +class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action { /** * Renderer for "Action" column in Newsletter templates grid diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Sender.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Sender.php index 3c9adbac05f..7f1ed2cf5cd 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Sender.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Sender.php @@ -34,7 +34,7 @@ namespace Magento\Newsletter\Block\Adminhtml\Template\Grid\Renderer; -class Sender extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Sender extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { public function render(\Magento\Object $row) { diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php index 90b906a6621..67cf74862af 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php @@ -33,7 +33,7 @@ */ namespace Magento\Newsletter\Block\Adminhtml\Template; -class Preview extends \Magento\Adminhtml\Block\Widget +class Preview extends \Magento\Backend\Block\Widget { /** * @var \Magento\Newsletter\Model\TemplateFactory @@ -89,7 +89,11 @@ class Preview extends \Magento\Adminhtml\Block\Widget } $template->emulateDesign($storeId); - $templateProcessed = $template->getProcessedTemplate($vars, true); + $templateProcessed = $this->_appState->emulateAreaCode( + \Magento\Newsletter\Model\Template::DEFAULT_DESIGN_AREA, + array($template, 'getProcessedTemplate'), + array($vars, true) + ); $template->revertDesign(); if ($template->isPlain()) { diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview/Form.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview/Form.php index 2b6963970d7..7ea22683618 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview/Form.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview/Form.php @@ -38,7 +38,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Preparing from for revision page * - * @return \Magento\Adminhtml\Block\Widget\Form + * @return \Magento\Backend\Block\Widget\Form */ protected function _prepareForm() { diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Problem.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Problem.php index 389881968ba..cc8c7539818 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Problem.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Problem.php @@ -40,13 +40,10 @@ class Problem extends \Magento\Backend\App\Action return; } - $this->_view->getLayout()->getMessagesBlock()->setMessages( - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getMessages(true) - ); + $this->_view->getLayout()->getMessagesBlock()->setMessages($this->messageManager->getMessages(true)); $this->_view->loadLayout(); $this->_setActiveMenu('Magento_Newsletter::newsletter_problem'); - $this->_addBreadcrumb(__('Newsletter Problem Reports'), __('Newsletter Problem Reports')); $this->_view->renderLayout(); @@ -61,14 +58,13 @@ class Problem extends \Magento\Backend\App\Action $collection ->addSubscriberInfo() ->addFieldToFilter($collection->getResource()->getIdFieldName(), - array('in'=>$problems)) + array('in' => $problems)) ->load(); $collection->walk('unsubscribe'); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addSuccess(__('We unsubscribed the people you identified.')); + $this->messageManager->addSuccess(__('We unsubscribed the people you identified.')); } if ($this->getRequest()->getParam('_delete')) { @@ -78,18 +74,13 @@ class Problem extends \Magento\Backend\App\Action $collection->addFieldToFilter( $collection->getResource()->getIdFieldName(), array('in' => $problems) - ) - ->load(); + )->load(); $collection->walk('delete'); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addSuccess(__('The problems you identified have been deleted.')); + $this->messageManager->addSuccess(__('The problems you identified have been deleted.')); } - $this->_view->getLayout()->getMessagesBlock()->setMessages( - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getMessages(true) - ); - + $this->_view->getLayout()->getMessagesBlock()->setMessages($this->messageManager->getMessages(true)); $this->_view->loadLayout(false); $this->_view->renderLayout(); } diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php index c4071fb7fc9..8abd1b4582e 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php @@ -94,7 +94,7 @@ class Queue extends \Magento\Backend\App\Action $data = $this->getRequest()->getParams(); if (empty($data) || !isset($data['id'])) { $this->_forward('noroute'); - return $this; + return; } // set default value for selected store @@ -279,12 +279,12 @@ class Queue extends \Magento\Backend\App\Action $queue->save(); - $this->_getSession()->addSuccess(__('The newsletter queue has been saved.')); + $this->messageManager->addSuccess(__('The newsletter queue has been saved.')); $this->_getSession()->setFormData(false); $this->_redirect('*/*'); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $id = $this->getRequest()->getParam('id'); if ($id) { $this->_redirect('*/*/edit', array('id' => $id)); diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber.php index 3e834133b71..3117e513f6a 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Newsletter\Controller\Adminhtml; + /** * Newsletter subscribers controller - * - * @category Magento - * @package Magento_Newsletter - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Newsletter\Controller\Adminhtml; - class Subscriber extends \Magento\Backend\App\Action { /** @@ -75,7 +71,7 @@ class Subscriber extends \Magento\Backend\App\Action { $this->_view->loadLayout(false); $this->_view->renderLayout(); - } + } /** * Export subscribers grid to CSV format @@ -104,19 +100,19 @@ class Subscriber extends \Magento\Backend\App\Action { $subscribersIds = $this->getRequest()->getParam('subscriber'); if (!is_array($subscribersIds)) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('Please select one or more subscribers.')); - } - else { + $this->messageManager->addError(__('Please select one or more subscribers.')); + } else { try { foreach ($subscribersIds as $subscriberId) { - $subscriber = $this->_objectManager->create('Magento\Newsletter\Model\Subscriber')->load($subscriberId); + $subscriber = $this->_objectManager->create('Magento\Newsletter\Model\Subscriber') + ->load($subscriberId); $subscriber->unsubscribe(); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( + $this->messageManager->addSuccess( __('A total of %1 record(s) were updated.', count($subscribersIds)) ); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } } @@ -127,19 +123,17 @@ class Subscriber extends \Magento\Backend\App\Action { $subscribersIds = $this->getRequest()->getParam('subscriber'); if (!is_array($subscribersIds)) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('Please select one or more subscribers.')); - } - else { + $this->messageManager->addError(__('Please select one or more subscribers.')); + } else { try { foreach ($subscribersIds as $subscriberId) { - $subscriber = $this->_objectManager->create('Magento\Newsletter\Model\Subscriber')->load($subscriberId); + $subscriber = $this->_objectManager->create('Magento\Newsletter\Model\Subscriber') + ->load($subscriberId); $subscriber->delete(); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('Total of %1 record(s) were deleted', count($subscribersIds)) - ); + $this->messageManager->addSuccess(__('Total of %1 record(s) were deleted', count($subscribersIds))); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } } diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php index 1b73f0767d3..399cc0a6382 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php @@ -208,17 +208,17 @@ class Template extends \Magento\Backend\App\Action $template->save(); - $this->_getSession()->addSuccess(__('The newsletter template has been saved.')); + $this->messageManager->addSuccess(__('The newsletter template has been saved.')); $this->_getSession()->setFormData(false); $this->_redirect('*/template'); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError(nl2br($e->getMessage())); + $this->messageManager->addError(nl2br($e->getMessage())); $this->_getSession()->setData('newsletter_template_form_data', $this->getRequest()->getParams()); } catch (\Exception $e) { - $this->_getSession()->addException($e, + $this->messageManager->addException($e, __('An error occurred while saving this template.') ); $this->_getSession()->setData('newsletter_template_form_data', $this->getRequest()->getParams()); @@ -238,12 +238,12 @@ class Template extends \Magento\Backend\App\Action if ($template->getId()) { try { $template->delete(); - $this->_getSession()->addSuccess(__('The newsletter template has been deleted.')); + $this->messageManager->addSuccess(__('The newsletter template has been deleted.')); $this->_getSession()->setFormData(false); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException($e, + $this->messageManager->addException($e, __('An error occurred while deleting this template.') ); } diff --git a/app/code/Magento/Newsletter/Controller/Manage.php b/app/code/Magento/Newsletter/Controller/Manage.php index 90a8f9f0882..9f6870a2722 100644 --- a/app/code/Magento/Newsletter/Controller/Manage.php +++ b/app/code/Magento/Newsletter/Controller/Manage.php @@ -24,19 +24,14 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -/** - * Customers newsletter subscription controller - * - * @category Magento - * @package Magento_Newsletter - * @author Magento Core Team <core@magentocommerce.com> - */ namespace Magento\Newsletter\Controller; use Magento\App\Action\NotFoundException; use Magento\App\RequestInterface; +/** + * Customers newsletter subscription controller + */ class Manage extends \Magento\App\Action\Action { /** @@ -78,7 +73,7 @@ class Manage extends \Magento\App\Action\Action * Check customer authentication for some actions * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { @@ -91,8 +86,7 @@ class Manage extends \Magento\App\Action\Action public function indexAction() { $this->_view->loadLayout(); - $this->_view->getLayout() - ->initMessages(array('Magento\Customer\Model\Session', 'Magento\Catalog\Model\Session')); + $this->_view->getLayout()->initMessages(); if ($block = $this->_view->getLayout()->getBlock('customer_newsletter')) { $block->setRefererUrl($this->_redirect->getRefererUrl()); @@ -112,13 +106,12 @@ class Manage extends \Magento\App\Action\Action ->setIsSubscribed((boolean)$this->getRequest()->getParam('is_subscribed', false)) ->save(); if ((boolean)$this->getRequest()->getParam('is_subscribed', false)) { - $this->_customerSession->addSuccess(__('We saved the subscription.')); + $this->messageManager->addSuccess(__('We saved the subscription.')); } else { - $this->_customerSession->addSuccess(__('We removed the subscription.')); + $this->messageManager->addSuccess(__('We removed the subscription.')); } - } - catch (\Exception $e) { - $this->_customerSession->addError(__('Something went wrong while saving your subscription.')); + } catch (\Exception $e) { + $this->messageManager->addError(__('Something went wrong while saving your subscription.')); } $this->_redirect('customer/account/'); } diff --git a/app/code/Magento/Newsletter/Controller/Subscriber.php b/app/code/Magento/Newsletter/Controller/Subscriber.php index 4dae263feaa..95d72ccc1b8 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber.php @@ -125,17 +125,15 @@ class Subscriber extends \Magento\App\Action\Action $status = $this->_subscriberFactory->create()->subscribe($email); if ($status == \Magento\Newsletter\Model\Subscriber::STATUS_NOT_ACTIVE) { - $this->_session->addSuccess(__('The confirmation request has been sent.')); + $this->messageManager->addSuccess(__('The confirmation request has been sent.')); } else { - $this->_session->addSuccess(__('Thank you for your subscription.')); + $this->messageManager->addSuccess(__('Thank you for your subscription.')); } - } - catch (\Magento\Core\Exception $e) { - $this->_session->addException($e, __('There was a problem with the subscription: %1', + } catch (\Magento\Core\Exception $e) { + $this->messageManager->addException($e, __('There was a problem with the subscription: %1', $e->getMessage())); - } - catch (\Exception $e) { - $this->_session->addException($e, __('Something went wrong with the subscription.')); + } catch (\Exception $e) { + $this->messageManager->addException($e, __('Something went wrong with the subscription.')); } } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); @@ -155,12 +153,12 @@ class Subscriber extends \Magento\App\Action\Action if ($subscriber->getId() && $subscriber->getCode()) { if ($subscriber->confirm($code)) { - $this->_session->addSuccess(__('Your subscription has been confirmed.')); + $this->messageManager->addSuccess(__('Your subscription has been confirmed.')); } else { - $this->_session->addError(__('This is an invalid subscription confirmation code.')); + $this->messageManager->addError(__('This is an invalid subscription confirmation code.')); } } else { - $this->_session->addError(__('This is an invalid subscription ID.')); + $this->messageManager->addError(__('This is an invalid subscription ID.')); } } @@ -180,13 +178,11 @@ class Subscriber extends \Magento\App\Action\Action $this->_subscriberFactory->create()->load($id) ->setCheckCode($code) ->unsubscribe(); - $this->_session->addSuccess(__('You have been unsubscribed.')); - } - catch (\Magento\Core\Exception $e) { - $this->_session->addException($e, $e->getMessage()); - } - catch (\Exception $e) { - $this->_session->addException($e, __('Something went wrong with the un-subscription.')); + $this->messageManager->addSuccess(__('You have been unsubscribed.')); + } catch (\Magento\Core\Exception $e) { + $this->messageManager->addException($e, $e->getMessage()); + } catch (\Exception $e) { + $this->messageManager->addException($e, __('Something went wrong with the un-subscription.')); } } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); diff --git a/app/code/Magento/Newsletter/Model/Queue.php b/app/code/Magento/Newsletter/Model/Queue.php index 35a9ca2a0c7..c728c402fb5 100644 --- a/app/code/Magento/Newsletter/Model/Queue.php +++ b/app/code/Magento/Newsletter/Model/Queue.php @@ -268,7 +268,11 @@ class Queue extends \Magento\Core\Model\Template $name = $item->getSubscriberFullName(); $sender->emulateDesign($item->getStoreId()); - $successSend = $sender->send($email, $name, array('subscriber' => $item)); + $successSend = $this->_appState->emulateAreaCode( + self::DEFAULT_DESIGN_AREA, + array($sender, 'send'), + array($email, $name, array('subscriber' => $item)) + ); $sender->revertDesign(); if ($successSend) { diff --git a/app/code/Magento/Newsletter/Model/Session.php b/app/code/Magento/Newsletter/Model/Session.php index a8f1eff9951..46c93259d9d 100644 --- a/app/code/Magento/Newsletter/Model/Session.php +++ b/app/code/Magento/Newsletter/Model/Session.php @@ -24,36 +24,13 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Newsletter\Model; + /** * Newsletter session model - * - * @category Magento - * @package Magento_Newsletter - * @author Magento Core Team <core@magentocommerce.com> */ - -namespace Magento\Newsletter\Model; - -class Session extends \Magento\Core\Model\Session\AbstractSession +class Session extends \Magento\Session\Generic { - /** - * @param \Magento\Core\Model\Session\Context $context - * @param \Magento\Session\SidResolverInterface $sidResolver - * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param null $sessionName - * @param array $data - */ - public function __construct( - \Magento\Core\Model\Session\Context $context, - \Magento\Session\SidResolverInterface $sidResolver, - \Magento\Session\Config\ConfigInterface $sessionConfig, - $sessionName = null, - array $data = array() - ) { - parent::__construct($context, $sidResolver, $sessionConfig, $data); - $this->start('newsletter', $sessionName); - } - public function addError($message) { $this->setErrorMessage($message); diff --git a/app/code/Magento/Newsletter/etc/adminhtml/menu.xml b/app/code/Magento/Newsletter/etc/adminhtml/menu.xml index 81dead1b53a..f6818e558f2 100644 --- a/app/code/Magento/Newsletter/etc/adminhtml/menu.xml +++ b/app/code/Magento/Newsletter/etc/adminhtml/menu.xml @@ -27,9 +27,9 @@ --> <config> <menu> - <add id="Magento_Newsletter::newsletter_template" title="Newsletter Template" module="Magento_Newsletter" parent="Magento_Adminhtml::marketing_communications" sortOrder="30" action="newsletter/template/" resource="Magento_Newsletter::template"/> - <add id="Magento_Newsletter::newsletter_queue" title="Newsletter Queue" module="Magento_Newsletter" sortOrder="40" parent="Magento_Adminhtml::marketing_communications" action="newsletter/queue/" resource="Magento_Newsletter::queue"/> - <add id="Magento_Newsletter::newsletter_subscriber" title="Newsletter Subscribers" module="Magento_Newsletter" sortOrder="50" parent="Magento_Adminhtml::marketing_communications" action="newsletter/subscriber/" resource="Magento_Newsletter::subscriber"/> + <add id="Magento_Newsletter::newsletter_template" title="Newsletter Template" module="Magento_Newsletter" parent="Magento_Backend::marketing_communications" sortOrder="30" action="newsletter/template/" resource="Magento_Newsletter::template"/> + <add id="Magento_Newsletter::newsletter_queue" title="Newsletter Queue" module="Magento_Newsletter" sortOrder="40" parent="Magento_Backend::marketing_communications" action="newsletter/queue/" resource="Magento_Newsletter::queue"/> + <add id="Magento_Newsletter::newsletter_subscriber" title="Newsletter Subscribers" module="Magento_Newsletter" sortOrder="50" parent="Magento_Backend::marketing_communications" action="newsletter/subscriber/" resource="Magento_Newsletter::subscriber"/> <add id="Magento_Newsletter::newsletter_problem" title="Newsletter Problem Reports" module="Magento_Newsletter" sortOrder="50" parent="Magento_Reports::report_marketing" action="newsletter/problem/" resource="Magento_Newsletter::problem"/> </menu> </config> diff --git a/app/code/Magento/Newsletter/etc/di.xml b/app/code/Magento/Newsletter/etc/di.xml index 8e9456d5cf7..1be5e38ad5b 100644 --- a/app/code/Magento/Newsletter/etc/di.xml +++ b/app/code/Magento/Newsletter/etc/di.xml @@ -31,4 +31,14 @@ </value> </param> </type> + <virtualType name="Magento\Newsletter\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> + <value>newsletter</value> + </param> + </virtualType> + <type name="Magento\Newsletter\Model\Session"> + <param name="storage"> + <instance type="Magento\Newsletter\Model\Session\Storage" /> + </param> + </type> </config> diff --git a/app/code/Magento/Newsletter/etc/email_templates.xml b/app/code/Magento/Newsletter/etc/email_templates.xml index d7e26ae9d7e..7233f32052c 100644 --- a/app/code/Magento/Newsletter/etc/email_templates.xml +++ b/app/code/Magento/Newsletter/etc/email_templates.xml @@ -24,7 +24,7 @@ */ --> <config> - <template id="newsletter_subscription_confirm_email_template" label="Subscription Confirmation" file="subscr_confirm.html" type="html"/> - <template id="newsletter_subscription_success_email_template" label="Subscription Success" file="subscr_success.html" type="html"/> - <template id="newsletter_subscription_un_email_template" label="Unsubscription Success" file="unsub_success.html" type="html"/> + <template id="newsletter_subscription_confirm_email_template" label="Subscription Confirmation" file="subscr_confirm.html" type="html" module="Magento_Newsletter"/> + <template id="newsletter_subscription_success_email_template" label="Subscription Success" file="subscr_success.html" type="html" module="Magento_Newsletter"/> + <template id="newsletter_subscription_un_email_template" label="Unsubscription Success" file="unsub_success.html" type="html" module="Magento_Newsletter"/> </config> diff --git a/app/code/Magento/Newsletter/etc/module.xml b/app/code/Magento/Newsletter/etc/module.xml index e32e58a1ec0..5594a813b71 100755 --- a/app/code/Magento/Newsletter/etc/module.xml +++ b/app/code/Magento/Newsletter/etc/module.xml @@ -35,7 +35,6 @@ <module name="Magento_Core"/> <module name="Magento_Customer"/> <module name="Magento_Widget"/> - <module name="Magento_Catalog"/> <module name="Magento_Backend"/> </depends> </module> diff --git a/app/code/Magento/Ogone/Controller/Api.php b/app/code/Magento/Ogone/Controller/Api.php index 54bd77aa35f..ced149ad210 100644 --- a/app/code/Magento/Ogone/Controller/Api.php +++ b/app/code/Magento/Ogone/Controller/Api.php @@ -122,13 +122,13 @@ class Api extends \Magento\App\Action\Action } if (!$hashValidationResult) { - $this->_getCheckout()->addError(__('The hash is not valid.')); + $this->messageManager->addError(__('The hash is not valid.')); return false; } $order = $this->_getOrder(); if (!$order->getId()) { - $this->_getCheckout()->addError(__('The order is not valid.')); + $this->messageManager->addError(__('The order is not valid.')); return false; } @@ -225,6 +225,7 @@ class Api extends \Magento\App\Action\Action default: //all unknown transaction will accept as exceptional $this->_exceptionProcess(); + break; } } @@ -274,7 +275,7 @@ class Api extends \Magento\App\Action\Action throw new \Exception (__('Can\'t detect Ogone payment action')); } } catch(\Exception $e) { - $this->_getCheckout()->addError(__('The order cannot be saved.')); + $this->messageManager->addError(__('The order cannot be saved.')); $this->_redirect('checkout/cart'); return; } @@ -287,8 +288,8 @@ class Api extends \Magento\App\Action\Action { $order = $this->_getOrder(); $status = $this->getRequest()->getParam('STATUS'); - try{ - if ($status == \Magento\Ogone\Model\Api::OGONE_AUTH_PROCESSING) { + try { + if ($status == \Magento\Ogone\Model\Api::OGONE_AUTH_PROCESSING) { $order->setState( \Magento\Sales\Model\Order::STATE_PROCESSING, \Magento\Ogone\Model\Api::WAITING_AUTHORIZATION, @@ -330,7 +331,7 @@ class Api extends \Magento\App\Action\Action $this->_redirect('checkout/onepage/success'); return; } catch (\Exception $e) { - $this->_getCheckout()->addError(__('Order can\'t save')); + $this->messageManager->addError(__('Order can\'t save')); $this->_redirect('checkout/cart'); return; } @@ -365,8 +366,8 @@ class Api extends \Magento\App\Action\Action $order->save(); $this->_redirect('checkout/onepage/success'); return; - } catch(\Exception $e) { - $this->_getCheckout()->addError(__('Order can\'t save')); + } catch (\Exception $e) { + $this->messageManager->addError(__('Order can\'t save')); $this->_redirect('checkout/cart'); return; } @@ -418,7 +419,7 @@ class Api extends \Magento\App\Action\Action return; } - switch($params['STATUS']) { + switch ($params['STATUS']) { case \Magento\Ogone\Model\Api::OGONE_PAYMENT_UNCERTAIN_STATUS : $exception = __('Something went wrong during the payment process, and so the result is unpredictable.'); break; @@ -427,10 +428,11 @@ class Api extends \Magento\App\Action\Action break; default: $exception = __('Unknown exception'); + break; } if (!empty($exception)) { - try{ + try { $this->_getCheckout()->setLastSuccessQuoteId($order->getQuoteId()); $this->_prepareCCInfo($order, $params); $order->getPayment()->setLastTransId($params['PAYID']); @@ -445,11 +447,11 @@ class Api extends \Magento\App\Action\Action $order->addStatusToHistory(\Magento\Ogone\Model\Api::PROCESSING_OGONE_STATUS, $exception); } $order->save(); - }catch(\Exception $e) { - $this->_getCheckout()->addError(__('Something went wrong while saving this order.')); + } catch (\Exception $e) { + $this->messageManager->addError(__('Something went wrong while saving this order.')); } } else { - $this->_getCheckout()->addError(__('Exception not defined')); + $this->messageManager->addError(__('Exception not defined')); } $this->_redirect('checkout/onepage/success'); @@ -469,7 +471,6 @@ class Api extends \Magento\App\Action\Action } $this->_getCheckout()->setQuoteId($this->_getCheckout()->getOgoneQuoteId()); $this->_declineProcess(); - return $this; } /** @@ -479,7 +480,7 @@ class Api extends \Magento\App\Action\Action { $status = \Magento\Ogone\Model\Api::DECLINE_OGONE_STATUS; $comment = __('Declined Order on Ogone side'); - $this->_getCheckout()->addError(__('The payment transaction has been declined.')); + $this->messageManager->addError(__('The payment transaction has been declined.')); $this->_cancelOrder($status, $comment); } @@ -498,7 +499,6 @@ class Api extends \Magento\App\Action\Action } $this->_getCheckout()->setQuoteId($this->_getCheckout()->getOgoneQuoteId()); $this->_cancelProcess(); - return $this; } /** @@ -528,12 +528,12 @@ class Api extends \Magento\App\Action\Action return; } - try{ + try { $order->cancel(); $order->setState(\Magento\Sales\Model\Order::STATE_CANCELED, $status, $comment); $order->save(); - }catch(\Exception $e) { - $this->_getCheckout()->addError(__('Something went wrong while canceling this order.')); + } catch (\Exception $e) { + $this->messageManager->addError(__('Something went wrong while canceling this order.')); } $this->_redirect('checkout/cart'); diff --git a/app/code/Magento/PageCache/Controller/Adminhtml/PageCache.php b/app/code/Magento/PageCache/Controller/Adminhtml/PageCache.php index c4f88d18c8d..c896d7d9718 100644 --- a/app/code/Magento/PageCache/Controller/Adminhtml/PageCache.php +++ b/app/code/Magento/PageCache/Controller/Adminhtml/PageCache.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\PageCache\Controller\Adminhtml; + /** * Page cache admin controller - * - * @category Magento - * @package Magento_PageCache - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\PageCache\Controller\Adminhtml; - class PageCache extends \Magento\Backend\App\Action { /** @@ -46,16 +42,14 @@ class PageCache extends \Magento\Backend\App\Action $pageCacheData = $this->_objectManager->get('Magento\PageCache\Helper\Data'); if ($pageCacheData->isEnabled()) { $pageCacheData->getCacheControlInstance()->clean(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('The external full page cache has been cleaned.') ); } - } - catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); - } - catch (\Exception $e) { - $this->_getSession()->addException( + } 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.') ); diff --git a/app/code/Magento/PageCache/etc/adminhtml/routes.xml b/app/code/Magento/PageCache/etc/adminhtml/routes.xml index 34ed3e2d15f..d0711af71dd 100644 --- a/app/code/Magento/PageCache/etc/adminhtml/routes.xml +++ b/app/code/Magento/PageCache/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_PageCache_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_PageCache" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Paygate/Block/Authorizenet/Form/Cc.php b/app/code/Magento/Paygate/Block/Authorizenet/Form/Cc.php index 4af8a927688..105ed89d5e9 100644 --- a/app/code/Magento/Paygate/Block/Authorizenet/Form/Cc.php +++ b/app/code/Magento/Paygate/Block/Authorizenet/Form/Cc.php @@ -170,7 +170,7 @@ class Cc extends \Magento\Payment\Block\Form */ public function getCancelButtonHtml() { - $cancelButton = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $cancelButton = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'id' => 'payment_cancel', 'label' => __('Cancel'), diff --git a/app/code/Magento/Paygate/Block/Authorizenet/Info/Cc.php b/app/code/Magento/Paygate/Block/Authorizenet/Info/Cc.php index b8796c1f1db..ce288a763f0 100644 --- a/app/code/Magento/Paygate/Block/Authorizenet/Info/Cc.php +++ b/app/code/Magento/Paygate/Block/Authorizenet/Info/Cc.php @@ -119,6 +119,7 @@ class Cc extends \Magento\Payment\Block\Info\Cc $balance = $this->_coreData->currency($cardInfo->getBalanceOnCard(), true, false); $data[__('Remaining Balance')] = $balance; } + $cardInfo->setMethodInstance($this->getInfo()->getMethodInstance()); $this->setCardInfoObject($cardInfo); $cards[] = array_merge($this->getSpecificInformation(), $data); $this->unsCardInfoObject(); diff --git a/app/code/Magento/Paygate/Controller/Adminhtml/Paygate/Authorizenet/Payment.php b/app/code/Magento/Paygate/Controller/Adminhtml/Paygate/Authorizenet/Payment.php index 80a4b863802..ea8e382c45e 100644 --- a/app/code/Magento/Paygate/Controller/Adminhtml/Paygate/Authorizenet/Payment.php +++ b/app/code/Magento/Paygate/Controller/Adminhtml/Paygate/Authorizenet/Payment.php @@ -38,17 +38,17 @@ class Payment extends \Magento\Backend\App\Action /** * Session quote * - * @var \Magento\Adminhtml\Model\Session\Quote + * @var \Magento\Backend\Model\Session\Quote */ protected $_sessionQuote; /** * @param \Magento\Backend\App\Action\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote */ public function __construct( \Magento\Backend\App\Action\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote + \Magento\Backend\Model\Session\Quote $sessionQuote ) { $this->_sessionQuote = $sessionQuote; parent::__construct($context); diff --git a/app/code/Magento/Paygate/Model/Authorizenet.php b/app/code/Magento/Paygate/Model/Authorizenet.php index 222411806c7..cecf65a9c43 100644 --- a/app/code/Magento/Paygate/Model/Authorizenet.php +++ b/app/code/Magento/Paygate/Model/Authorizenet.php @@ -198,7 +198,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc /** * Session * - * @var \Magento\Core\Model\Session\AbstractSession + * @var \Magento\Session\SessionManagerInterface */ protected $_session; @@ -243,7 +243,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Paygate\Model\Authorizenet\RequestFactory $requestFactory * @param \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Paygate\Helper\Data $paygateData * @param array $data * @@ -262,7 +262,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc \Magento\Paygate\Model\Authorizenet\RequestFactory $requestFactory, \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory, \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Core\Model\Session\AbstractSession $session, + \Magento\Session\SessionManagerInterface $session, \Magento\Paygate\Helper\Data $paygateData, array $data = array() ) { diff --git a/app/code/Magento/Paygate/Model/Authorizenet/Cards.php b/app/code/Magento/Paygate/Model/Authorizenet/Cards.php index ecfefbea1fe..9fde6a510a8 100644 --- a/app/code/Magento/Paygate/Model/Authorizenet/Cards.php +++ b/app/code/Magento/Paygate/Model/Authorizenet/Cards.php @@ -57,12 +57,26 @@ class Cards public function setPayment(\Magento\Payment\Model\Info $payment) { $this->_payment = $payment; + $this->_initCards(); + return $this; + } + + /** + * Init cards data + */ + protected function _initCards() + { $paymentCardsInformation = $this->_payment->getAdditionalInformation(self::CARDS_NAMESPACE); if ($paymentCardsInformation) { + $additionalInfo = $this->_payment->getAdditionalInformation(); + unset($additionalInfo[self::CARDS_NAMESPACE]); + + foreach ($paymentCardsInformation as $cardId => $data) { + $paymentCardsInformation[$cardId]['additional_information'] = $additionalInfo; + } + $this->_cards = $paymentCardsInformation; } - - return $this; } /** diff --git a/app/code/Magento/Paygate/etc/adminhtml/di.xml b/app/code/Magento/Paygate/etc/adminhtml/di.xml index 2fc21e6bd12..5355f9d9a1e 100644 --- a/app/code/Magento/Paygate/etc/adminhtml/di.xml +++ b/app/code/Magento/Paygate/etc/adminhtml/di.xml @@ -26,7 +26,7 @@ <config> <type name="Magento\Paygate\Model\Authorizenet"> <param name="session"> - <instance type="Magento\Adminhtml\Model\Session\Quote" /> + <instance type="Magento\Backend\Model\Session\Quote" /> </param> </type> </config> diff --git a/app/code/Magento/Paygate/etc/adminhtml/routes.xml b/app/code/Magento/Paygate/etc/adminhtml/routes.xml index cb3029eef0c..467b5ec8be0 100644 --- a/app/code/Magento/Paygate/etc/adminhtml/routes.xml +++ b/app/code/Magento/Paygate/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Paygate_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Paygate" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Paygate/etc/module.xml b/app/code/Magento/Paygate/etc/module.xml index ddbc419fbb3..0f16642b2f5 100755 --- a/app/code/Magento/Paygate/etc/module.xml +++ b/app/code/Magento/Paygate/etc/module.xml @@ -30,7 +30,6 @@ </sequence> <depends> <module name="Magento_Payment"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Core"/> <module name="Magento_Checkout"/> <module name="Magento_Backend"/> diff --git a/app/code/Magento/Paygate/view/adminhtml/info/cc.phtml b/app/code/Magento/Paygate/view/adminhtml/info/cc.phtml index 3fcbdd2c8df..9e90f67f67f 100644 --- a/app/code/Magento/Paygate/view/adminhtml/info/cc.phtml +++ b/app/code/Magento/Paygate/view/adminhtml/info/cc.phtml @@ -41,11 +41,11 @@ <span><?php echo sprintf(__('Credit Card %s'), $key + 1); ?></span> <?php endif;?> - <table class="info-table<?php if ($showCount):?> offset<?php endif;?>"> + <table class="data-table<?php if ($showCount):?> offset<?php endif;?>"> <tbody> <?php foreach ($card as $_label => $_value):?> <tr> - <td><?php echo $this->escapeHtml($_label)?>:</td> + <th><?php echo $this->escapeHtml($_label)?>:</th> <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td> </tr> <?php endforeach; ?> diff --git a/app/code/Magento/Payment/Block/Form/Container.php b/app/code/Magento/Payment/Block/Form/Container.php index f20abbce92e..fbc5b3c4a35 100644 --- a/app/code/Magento/Payment/Block/Form/Container.php +++ b/app/code/Magento/Payment/Block/Form/Container.php @@ -37,6 +37,25 @@ namespace Magento\Payment\Block\Form; class Container extends \Magento\View\Element\Template { + /** + * @var \Magento\Payment\Helper\Data + */ + protected $_paymentHelper; + + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Payment\Helper\Data $paymentHelper + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Payment\Helper\Data $paymentHelper, + array $data = array() + ) { + $this->_paymentHelper = $paymentHelper; + parent::__construct($context, $data); + } + /** * Prepare children blocks */ @@ -48,7 +67,7 @@ class Container extends \Magento\View\Element\Template foreach ($this->getMethods() as $method) { $this->setChild( 'payment.method.'.$method->getCode(), - $this->helper('Magento\Payment\Helper\Data')->getMethodFormBlock($method) + $this->_paymentHelper->getMethodFormBlock($method) ); } @@ -112,7 +131,7 @@ class Container extends \Magento\View\Element\Template $quote = $this->getQuote(); $store = $quote ? $quote->getStoreId() : null; $methods = array(); - foreach ($this->helper('Magento\Payment\Helper\Data')->getStoreMethods($store, $quote) as $method) { + foreach ($this->_paymentHelper->getStoreMethods($store, $quote) as $method) { if ($this->_canUseMethod($method) && $method->isApplicableToQuote( $quote, \Magento\Payment\Model\Method\AbstractMethod::CHECK_ZERO_TOTAL diff --git a/app/code/Magento/Payment/Block/Info.php b/app/code/Magento/Payment/Block/Info.php index 4ccd4762583..53689d3f0ba 100644 --- a/app/code/Magento/Payment/Block/Info.php +++ b/app/code/Magento/Payment/Block/Info.php @@ -138,15 +138,19 @@ class Info extends \Magento\View\Element\Template if ($this->hasIsSecureMode()) { return (bool)(int)$this->_getData('is_secure_mode'); } - if (!$payment = $this->getInfo()) { + + $method = $this->getMethod(); + if (!$method) { return true; } - if (!$method = $payment->getMethodInstance()) { - return true; + + $store = $method->getStore(); + if (!$store) { + return false; } - $methodStore = $this->_storeManager->getStore($method->getStore()); - return $methodStore->getId() != \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $methodStore = $this->_storeManager->getStore($store); + return $methodStore->getCode() != \Magento\Core\Model\Store::ADMIN_CODE; } /** diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details.php b/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details.php index 4b234ee04ae..dace44bee6d 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details.php @@ -33,7 +33,7 @@ */ namespace Magento\Paypal\Block\Adminhtml\Settlement; -class Details extends \Magento\Adminhtml\Block\Widget\Form\Container +class Details extends \Magento\Backend\Block\Widget\Form\Container { /** * Block construction diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php index e450af8d913..f6a8ab3b7ab 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php @@ -35,14 +35,16 @@ class Expanded /** * @param \Magento\Backend\Block\Context $context * @param \Magento\Backend\Model\Auth\Session $authSession + * @param \Magento\Core\Helper\Js $jsHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, \Magento\Backend\Model\Auth\Session $authSession, + \Magento\Core\Helper\Js $jsHelper, array $data = array() ) { - parent::__construct($context, $authSession, $data); + parent::__construct($context, $authSession, $jsHelper, $data); } /** diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php index d9b276efc11..c6797c16b10 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php @@ -35,14 +35,16 @@ class Group /** * @param \Magento\Backend\Block\Context $context * @param \Magento\Backend\Model\Auth\Session $authSession + * @param \Magento\Core\Helper\Js $jsHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, \Magento\Backend\Model\Auth\Session $authSession, + \Magento\Core\Helper\Js $jsHelper, array $data = array() ) { - parent::__construct($context, $authSession, $data); + parent::__construct($context, $authSession, $jsHelper, $data); } /** diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php index 8c0f4cb5444..c52b0f558d1 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php @@ -37,6 +37,25 @@ class Hint { protected $_template = 'Magento_Paypal::system/config/fieldset/hint.phtml'; + /** + * @var \Magento\Backend\Helper\Js + */ + protected $_jsHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Backend\Helper\Js $jsHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Backend\Helper\Js $jsHelper, + array $data = array() + ) { + $this->_jsHelper = $jsHelper; + parent::__construct($context, $data); + } + /** * Render fieldset html * @@ -95,6 +114,6 @@ class Hint }); }); '; - return $this->toHtml() . $this->helper('Magento\Adminhtml\Helper\Js')->getScript($js); + return $this->toHtml() . $this->_jsHelper->getScript($js); } } diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php index 810742ccde5..ea92c2f5c6e 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php @@ -357,6 +357,6 @@ class Location }); }); '; - return $this->toHtml() . $this->helper('Magento\Adminhtml\Helper\Js')->getScript($js); + return $this->toHtml() . $this->_jsHelper->getScript($js); } } diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php index bdbdd660353..8fc43ed6280 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php @@ -40,17 +40,19 @@ class Payment /** * @param \Magento\Backend\Block\Context $context * @param \Magento\Backend\Model\Auth\Session $authSession + * @param \Magento\Core\Helper\Js $jsHelper * @param \Magento\Backend\Model\Config $backendConfig * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, \Magento\Backend\Model\Auth\Session $authSession, + \Magento\Core\Helper\Js $jsHelper, \Magento\Backend\Model\Config $backendConfig, array $data = array() ) { $this->_backendConfig = $backendConfig; - parent::__construct($context, $authSession, $data); + parent::__construct($context, $authSession, $jsHelper, $data); } /** diff --git a/app/code/Magento/Paypal/Block/Express/Review.php b/app/code/Magento/Paypal/Block/Express/Review.php index 6d2cf3c07bf..62092ea3b60 100644 --- a/app/code/Magento/Paypal/Block/Express/Review.php +++ b/app/code/Magento/Paypal/Block/Express/Review.php @@ -54,6 +54,25 @@ class Review extends \Magento\View\Element\Template */ protected $_paypalActionPrefix = 'paypal'; + /** + * @var \Magento\Tax\Helper\Data + */ + protected $_taxHelper; + + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Tax\Helper\Data $taxHelper + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Tax\Helper\Data $taxHelper, + array $data = array() + ) { + $this->_taxHelper = $taxHelper; + parent::__construct($context, $data); + } + /** * Quote object setter * @@ -143,10 +162,10 @@ class Review extends \Magento\View\Element\Template $price = $rate->getErrorMessage(); } else { $price = $this->_getShippingPrice($rate->getPrice(), - $this->helper('Magento\Tax\Helper\Data')->displayShippingPriceIncludingTax()); + $this->_taxHelper->displayShippingPriceIncludingTax()); $incl = $this->_getShippingPrice($rate->getPrice(), true); - if (($incl != $price) && $this->helper('Magento\Tax\Helper\Data')->displayShippingBothPrices()) { + if (($incl != $price) && $this->_taxHelper->displayShippingBothPrices()) { $renderedInclTax = sprintf( $inclTaxFormat, __('Incl. Tax'), @@ -186,7 +205,7 @@ class Review extends \Magento\View\Element\Template protected function _getShippingPrice($price, $isInclTax) { return $this->_formatPrice( - $this->helper('Magento\Tax\Helper\Data')->getShippingPrice( + $this->_taxHelper->getShippingPrice( $price, $isInclTax, $this->_address diff --git a/app/code/Magento/Paypal/Block/Iframe.php b/app/code/Magento/Paypal/Block/Iframe.php index 99d2ca240f3..6b89856b133 100644 --- a/app/code/Magento/Paypal/Block/Iframe.php +++ b/app/code/Magento/Paypal/Block/Iframe.php @@ -74,18 +74,26 @@ class Iframe extends \Magento\Payment\Block\Form */ protected $_checkoutSession; + /** + * @var \Magento\Paypal\Helper\Hss + */ + protected $_hssHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Paypal\Helper\Hss $hssHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Paypal\Helper\Hss $hssHelper, array $data = array() ) { + $this->_hssHelper = $hssHelper; $this->_orderFactory = $orderFactory; $this->_checkoutSession = $checkoutSession; parent::__construct($context, $data); @@ -101,11 +109,14 @@ class Iframe extends \Magento\Payment\Block\Form ->getQuote() ->getPayment() ->getMethod(); - if (in_array($paymentCode, $this->helper('Magento\Paypal\Helper\Hss')->getHssMethods())) { + if (in_array($paymentCode, $this->_hssHelper->getHssMethods())) { $this->_paymentMethodCode = $paymentCode; $templatePath = str_replace('_', '', $paymentCode); $templateFile = "{$templatePath}/iframe.phtml"; - if (file_exists($this->_viewFileSystem->getFilename($templateFile, array('module' => 'Magento_Paypal')))) { + + $directory = $this->getDirectory(); + $file = $this->_viewFileSystem->getFilename($templateFile, array('module' => 'Magento_Paypal')); + if ($directory->isExist($directory->getRelativePath($file))) { $this->setTemplate($templateFile); } else { $this->setTemplate('hss/iframe.phtml'); diff --git a/app/code/Magento/Paypal/Block/Payflow/Link/Iframe.php b/app/code/Magento/Paypal/Block/Payflow/Link/Iframe.php index c2f1780a0f9..7eb691fd618 100644 --- a/app/code/Magento/Paypal/Block/Payflow/Link/Iframe.php +++ b/app/code/Magento/Paypal/Block/Payflow/Link/Iframe.php @@ -42,6 +42,7 @@ class Iframe extends \Magento\Paypal\Block\Iframe * @param \Magento\View\Element\Template\Context $context * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Paypal\Helper\Hss $hssHelper * @param \Magento\Payment\Helper\Data $paymentData * @param array $data */ @@ -49,11 +50,12 @@ class Iframe extends \Magento\Paypal\Block\Iframe \Magento\View\Element\Template\Context $context, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Paypal\Helper\Hss $hssHelper, \Magento\Payment\Helper\Data $paymentData, array $data = array() ) { $this->_paymentData = $paymentData; - parent::__construct($context, $orderFactory, $checkoutSession, $data); + parent::__construct($context, $orderFactory, $checkoutSession, $hssHelper, $data); } /** diff --git a/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php b/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php index a1150de185d..1bec219ffe5 100644 --- a/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php +++ b/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php @@ -132,19 +132,19 @@ class Reports extends \Magento\Backend\App\Action $fetched = $reports->fetchAndSave( \Magento\Paypal\Model\Report\Settlement::createConnection($config) ); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __("We fetched %1 report rows from '%2@%3'.", $fetched, $config['username'], $config['hostname']) ); } catch (\Exception $e) { - $this->_getSession()->addError( + $this->messageManager->addError( __("We couldn't fetch reports from '%1@%2'.", $config['username'], $config['hostname']) ); $this->_logger->logException($e); } } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_logger->logException($e); } diff --git a/app/code/Magento/Paypal/Controller/Express.php b/app/code/Magento/Paypal/Controller/Express.php index d6fd4b8697b..93141d87018 100644 --- a/app/code/Magento/Paypal/Controller/Express.php +++ b/app/code/Magento/Paypal/Controller/Express.php @@ -67,7 +67,7 @@ class Express extends \Magento\Paypal\Controller\Express\AbstractExpress * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Paypal\Model\Express\Checkout\Factory $checkoutFactory - * @param \Magento\Core\Model\Session\Generic $paypalSession + * @param \Magento\Session\Generic $paypalSession * @param \Magento\Core\Helper\Url $urlHelper * @param \Magento\Customer\Helper\Data $customerHelper * @@ -80,7 +80,7 @@ class Express extends \Magento\Paypal\Controller\Express\AbstractExpress \Magento\Checkout\Model\Session $checkoutSession, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Paypal\Model\Express\Checkout\Factory $checkoutFactory, - \Magento\Core\Model\Session\Generic $paypalSession, + \Magento\Session\Generic $paypalSession, \Magento\Core\Helper\Url $urlHelper, \Magento\Customer\Helper\Data $customerHelper ) { diff --git a/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php b/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php index c1ad618cc43..90a3a87d4ff 100644 --- a/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php +++ b/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php @@ -24,11 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Paypal\Controller\Express; + /** * Abstract Express Checkout Controller */ -namespace Magento\Paypal\Controller\Express; - abstract class AbstractExpress extends \Magento\App\Action\Action { /** @@ -100,7 +100,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action protected $_checkoutFactory; /** - * @var \Magento\Core\Model\Session\Generic + * @var \Magento\Session\Generic */ protected $_paypalSession; @@ -111,7 +111,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Paypal\Model\Express\Checkout\Factory $checkoutFactory - * @param \Magento\Core\Model\Session\Generic $paypalSession + * @param \Magento\Session\Generic $paypalSession */ public function __construct( \Magento\App\Action\Context $context, @@ -120,7 +120,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action \Magento\Checkout\Model\Session $checkoutSession, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Paypal\Model\Express\Checkout\Factory $checkoutFactory, - \Magento\Core\Model\Session\Generic $paypalSession + \Magento\Session\Generic $paypalSession ) { $this->_customerSession = $customerSession; $this->_quoteFactory = $quoteFactory; @@ -177,9 +177,9 @@ abstract class AbstractExpress extends \Magento\App\Action\Action return; } } catch (\Magento\Core\Exception $e) { - $this->_getCheckoutSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getCheckoutSession()->addError(__('We can\'t start Express Checkout.')); + $this->messageManager->addError(__('We can\'t start Express Checkout.')); $this->_objectManager->get('Magento\Logger')->logException($e); } @@ -219,16 +219,15 @@ abstract class AbstractExpress extends \Magento\App\Action\Action ->unsLastQuoteId() ->unsLastSuccessQuoteId() ->unsLastOrderId() - ->unsLastRealOrderId() - ->addSuccess(__('Express Checkout and Order have been canceled.')) - ; + ->unsLastRealOrderId(); + $this->messageManager->addSuccess(__('Express Checkout and Order have been canceled.')); } else { - $this->_getCheckoutSession()->addSuccess(__('Express Checkout has been canceled.')); + $this->messageManager->addSuccess(__('Express Checkout has been canceled.')); } } catch (\Magento\Core\Exception $e) { - $this->_getCheckoutSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getCheckoutSession()->addError(__('Unable to cancel Express Checkout')); + $this->messageManager->addError(__('Unable to cancel Express Checkout')); $this->_objectManager->get('Magento\Logger')->logException($e); } @@ -246,9 +245,9 @@ abstract class AbstractExpress extends \Magento\App\Action\Action $this->_redirect('*/*/review'); return; } catch (\Magento\Core\Exception $e) { - $this->_checkoutSession->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_checkoutSession->addError(__('We can\'t process Express Checkout approval.')); + $this->messageManager->addError(__('We can\'t process Express Checkout approval.')); $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('checkout/cart'); @@ -263,7 +262,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action $this->_initCheckout(); $this->_checkout->prepareOrderReview($this->_initToken()); $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Paypal\Model\Session'); + $this->_view->getLayout()->initMessages(); $reviewBlock = $this->_view->getLayout()->getBlock('paypal.express.review'); $reviewBlock->setQuote($this->_getQuote()); $reviewBlock->getChildBlock('details')->setQuote($this->_getQuote()); @@ -273,9 +272,9 @@ abstract class AbstractExpress extends \Magento\App\Action\Action $this->_view->renderLayout(); return; } catch (\Magento\Core\Exception $e) { - $this->_checkoutSession->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_checkoutSession->addError( + $this->messageManager->addError( __('We can\'t initialize Express Checkout review.') ); $this->_objectManager->get('Magento\Logger')->logException($e); @@ -291,7 +290,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action try { $this->getResponse()->setRedirect($this->_config->getExpressCheckoutEditUrl($this->_initToken())); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/review'); } } @@ -313,9 +312,9 @@ abstract class AbstractExpress extends \Magento\App\Action\Action return; } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We can\'t update shipping method.')); + $this->messageManager->addError(__('We can\'t update shipping method.')); $this->_objectManager->get('Magento\Logger')->logException($e); } if ($isAjax) { @@ -341,9 +340,9 @@ abstract class AbstractExpress extends \Magento\App\Action\Action ->toHtml()); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We can\'t update Order data.')); + $this->messageManager->addError(__('We can\'t update Order data.')); $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody('<script type="text/javascript">window.location.href = ' @@ -367,9 +366,9 @@ abstract class AbstractExpress extends \Magento\App\Action\Action return; } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We can\'t update Order data.')); + $this->messageManager->addError(__('We can\'t update Order data.')); $this->_objectManager->get('Magento\Logger')->logException($e); } if ($isAjax) { @@ -402,22 +401,21 @@ abstract class AbstractExpress extends \Magento\App\Action\Action $this->_checkout->place($this->_initToken()); // prepare session to success or cancellation page - $session = $this->_getCheckoutSession(); - $session->clearHelperData(); + $this->_getCheckoutSession()->clearHelperData(); // "last successful quote" $quoteId = $this->_getQuote()->getId(); - $session->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId); + $this->_getCheckoutSession()->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId); // an order may be created $order = $this->_checkout->getOrder(); if ($order) { - $session->setLastOrderId($order->getId()) + $this->_getCheckoutSession()->setLastOrderId($order->getId()) ->setLastRealOrderId($order->getIncrementId()); // as well a billing agreement can be created $agreement = $this->_checkout->getBillingAgreement(); if ($agreement) { - $session->setLastBillingAgreementId($agreement->getId()); + $this->_getCheckoutSession()->setLastBillingAgreementId($agreement->getId()); } } @@ -428,7 +426,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action foreach ($profiles as $profile) { $ids[] = $profile->getId(); } - $session->setLastRecurringProfileIds($ids); + $this->_getCheckoutSession()->setLastRecurringProfileIds($ids); } // redirect if PayPal specified some URL (for example, to Giropay bank) @@ -441,9 +439,9 @@ abstract class AbstractExpress extends \Magento\App\Action\Action $this->_redirect('checkout/onepage/success'); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We can\'t place the order.')); + $this->messageManager->addError(__('We can\'t place the order.')); $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('*/*/review'); @@ -510,7 +508,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action /** * PayPal session instance getter * - * @return \Magento\Core\Model\Session\Generic + * @return \Magento\Session\Generic */ private function _getSession() { diff --git a/app/code/Magento/Paypal/Controller/Payflowadvanced.php b/app/code/Magento/Paypal/Controller/Payflowadvanced.php index 482a20bf9e8..d65be4f6a8c 100644 --- a/app/code/Magento/Paypal/Controller/Payflowadvanced.php +++ b/app/code/Magento/Paypal/Controller/Payflowadvanced.php @@ -67,7 +67,7 @@ class Payflowadvanced extends \Magento\Paypal\Controller\Express\AbstractExpress * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Paypal\Model\Express\Checkout\Factory $checkoutFactory - * @param \Magento\Core\Model\Session\Generic $paypalSession + * @param \Magento\Session\Generic $paypalSession * @param \Magento\Paypal\Helper\Checkout $checkoutHelper * @param \Magento\Logger $logger */ @@ -78,7 +78,7 @@ class Payflowadvanced extends \Magento\Paypal\Controller\Express\AbstractExpress \Magento\Checkout\Model\Session $checkoutSession, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Paypal\Model\Express\Checkout\Factory $checkoutFactory, - \Magento\Core\Model\Session\Generic $paypalSession, + \Magento\Session\Generic $paypalSession, \Magento\Paypal\Helper\Checkout $checkoutHelper, \Magento\Logger $logger ) { diff --git a/app/code/Magento/Paypal/Model/Cert.php b/app/code/Magento/Paypal/Model/Cert.php index 3130e8070f5..fd4fa12c8ed 100644 --- a/app/code/Magento/Paypal/Model/Cert.php +++ b/app/code/Magento/Paypal/Model/Cert.php @@ -29,27 +29,29 @@ */ namespace Magento\Paypal\Model; +use Magento\Filesystem\Directory\WriteInterface; + class Cert extends \Magento\Core\Model\AbstractModel { /** * Certificate base path */ - const BASEPATH_PAYPAL_CERT = 'cert/paypal'; + const BASEPATH_PAYPAL_CERT = 'cert/paypal/'; /** - * @var \Magento\App\Dir + * @var WriteInterface */ - protected $_coreDir; + protected $varDirectory; /** * @var \Magento\Encryption\EncryptorInterface */ - protected $_encryptor; + protected $encryptor; /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry - * @param \Magento\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -58,14 +60,14 @@ class Cert extends \Magento\Core\Model\AbstractModel public function __construct( \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreDir = $coreDir; - $this->_encryptor = $encryptor; + $this->varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->encryptor = $encryptor; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -104,12 +106,12 @@ class Cert extends \Magento\Core\Model\AbstractModel } $certFileName = sprintf('cert_%s_%s.pem', $this->getWebsiteId(), strtotime($this->getUpdatedAt())); - $certFile = $this->_getBaseDir() . DS . $certFileName; + $certFile = self::BASEPATH_PAYPAL_CERT . $certFileName; - if (!file_exists($certFile)) { + if (!$this->varDirectory->isExist($certFile)) { $this->_createCertFile($certFile); } - return $certFile; + return $this->varDirectory->getAbsolutePath($certFile); } /** @@ -119,15 +121,10 @@ class Cert extends \Magento\Core\Model\AbstractModel */ protected function _createCertFile($file) { - $certDir = $this->_getBaseDir(); - if (!is_dir($certDir)) { - $ioAdapter = new \Magento\Io\File(); - $ioAdapter->checkAndCreateFolder($certDir); - } else { + if ($this->varDirectory->isDirectory(self::BASEPATH_PAYPAL_CERT)) { $this->_removeOutdatedCertFile(); } - - file_put_contents($file, $this->_encryptor->decrypt($this->getContent())); + $this->varDirectory->writeFile($file, $this->encryptor->decrypt($this->getContent())); } /** @@ -137,25 +134,12 @@ class Cert extends \Magento\Core\Model\AbstractModel */ protected function _removeOutdatedCertFile() { - $certDir = $this->_getBaseDir(); - if (is_dir($certDir)) { - $entries = scandir($certDir); - foreach ($entries as $entry) { - if ($entry != '.' && $entry != '..' && strpos($entry, 'cert_' . $this->getWebsiteId()) !== false) { - unlink($certDir . DS . $entry); - } - } - } - } + $pattern = sprintf('#cert_%s#' . $this->getWebsiteId()); - /** - * Retrieve base directory for certificate - * - * @return string - */ - protected function _getBaseDir() - { - return $this->_coreDir->getDir(\Magento\App\Dir::VAR_DIR) . DS . self::BASEPATH_PAYPAL_CERT; + $entries = $this->varDirectory->search($pattern, self::BASEPATH_PAYPAL_CERT); + foreach ($entries as $entry) { + $this->varDirectory->delete($entry); + } } /** diff --git a/app/code/Magento/Paypal/Model/Payflowpro.php b/app/code/Magento/Paypal/Model/Payflowpro.php index 7515da6b351..e6e413dc2df 100644 --- a/app/code/Magento/Paypal/Model/Payflowpro.php +++ b/app/code/Magento/Paypal/Model/Payflowpro.php @@ -77,8 +77,9 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc protected $_isGateway = true; protected $_canAuthorize = true; protected $_canCapture = true; - protected $_canCapturePartial = false; + protected $_canCapturePartial = true; protected $_canRefund = true; + protected $_canRefundInvoicePartial = true; protected $_canVoid = true; protected $_canUseInternal = true; protected $_canUseCheckout = true; @@ -238,6 +239,20 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc return $this; } + /** + * Get capture amount + * + * @param float $amount + * @return float + */ + protected function _getCaptureAmount($amount) + { + $infoInstance = $this->getInfoInstance(); + $amountToPay = round($amount, 2); + $authorizedAmount = round($infoInstance->getAmountAuthorized(), 2); + return $amountToPay != $authorizedAmount ? $amountToPay : 0; + } + /** * Capture payment * @@ -253,8 +268,13 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc $request->setOrigid($payment->getReferenceTransactionId()); } elseif ($payment->getParentTransactionId()) { $request = $this->_buildBasicRequest($payment); - $request->setTrxtype(self::TRXTYPE_DELAYED_CAPTURE); $request->setOrigid($payment->getParentTransactionId()); + $captureAmount = $this->_getCaptureAmount($amount); + if ($captureAmount) { + $request->setAmt($captureAmount); + } + $trxType = $this->getInfoInstance()->hasAmountPaid() ? self::TRXTYPE_SALE : self::TRXTYPE_DELAYED_CAPTURE; + $request->setTrxtype($trxType); } else { $request = $this->_buildPlaceRequest($payment, $amount); $request->setTrxtype(self::TRXTYPE_SALE); @@ -301,6 +321,26 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc return $this; } + /** + * Check void availability + * + * @param \Magento\Object $payment + * @return bool + */ + public function canVoid(\Magento\Object $payment) + { + if ($payment instanceof \Magento\Sales\Model\Order\Invoice + || $payment instanceof \Magento\Sales\Model\Order\Creditmemo + ) { + return false; + } + if ($payment->getAmountPaid()) { + $this->_canVoid = false; + } + + return $this->_canVoid; + } + /** * Attempt to void the authorization on cancelling * @@ -309,7 +349,11 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc */ public function cancel(\Magento\Object $payment) { - return $this->void($payment); + if (!$payment->getOrder()->getInvoiceCollection()->count()) { + return $this->void($payment); + } + + return false; } /** @@ -331,6 +375,7 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc if ($response->getResultCode() == self::RESPONSE_CODE_APPROVED){ $payment->setTransactionId($response->getPnref()) ->setIsTransactionClosed(1); + $payment->setShouldCloseParentTransaction(!$payment->getCreditmemo()->getInvoice()->canRefund()); } return $this; } diff --git a/app/code/Magento/Paypal/Model/Report/Settlement.php b/app/code/Magento/Paypal/Model/Report/Settlement.php index ad4da16cec4..e9f315716ba 100644 --- a/app/code/Magento/Paypal/Model/Report/Settlement.php +++ b/app/code/Magento/Paypal/Model/Report/Settlement.php @@ -159,9 +159,9 @@ class Settlement extends \Magento\Core\Model\AbstractModel ); /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem\Directory\WriteInterface */ - protected $_coreDir; + protected $_tmpDirectory; /** * @var \Magento\Core\Model\StoreManagerInterface @@ -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\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -180,17 +180,15 @@ class Settlement extends \Magento\Core\Model\AbstractModel public function __construct( \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreDir = $coreDir; + $this->_tmpDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::SYS_TMP); $this->_storeManager = $storeManager; - parent::__construct( - $context, $registry, $resource, $resourceCollection, $data - ); + parent::__construct($context, $registry, $resource, $resourceCollection, $data); } /** @@ -231,24 +229,27 @@ class Settlement extends \Magento\Core\Model\AbstractModel $fetched = 0; $listing = $this->_filterReportsList($connection->rawls()); foreach ($listing as $filename => $attributes) { - $localCsv = tempnam($this->_coreDir->getDir(\Magento\App\Dir::TMP), 'PayPal_STL'); - if ($connection->read($filename, $localCsv)) { - if (!is_writable($localCsv)) { + + $localCsv = 'PayPal_STL_' . uniqid(mt_rand()) . time() . '.csv'; + if ($connection->read($filename, $this->_tmpDirectory->getAbsolutePath($localCsv))) { + if (!$this->_tmpDirectory->isWritable($localCsv)) { throw new \Magento\Core\Exception(__('We cannot create a target file for reading reports.')); } - $encoded = file_get_contents($localCsv); + $encoded = $this->_tmpDirectory->readFile($localCsv); $csvFormat = 'new'; if (self::FILES_OUT_CHARSET != mb_detect_encoding(($encoded))) { $decoded = @iconv(self::FILES_IN_CHARSET, self::FILES_OUT_CHARSET . '//IGNORE', $encoded); - file_put_contents($localCsv, $decoded); + $this->_tmpDirectory->writeFile($localCsv, $decoded); $csvFormat = 'old'; } // Set last modified date, this value will be overwritten during parsing if (isset($attributes['mtime'])) { $lastModified = new \Zend_Date($attributes['mtime']); - $this->setReportLastModified($lastModified->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)); + $this->setReportLastModified( + $lastModified->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT) + ); } $this->setReportDate($this->_fileNameToDate($filename)) @@ -264,7 +265,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel } // clean object and remove parsed file $this->unsetData(); - unlink($localCsv); + $this->_tmpDirectory->delete($localCsv); } } return $fetched; @@ -309,8 +310,8 @@ class Settlement extends \Magento\Core\Model\AbstractModel $rowMap = $this->_csvColumns[$format]['rowmap']; $flippedSectionColumns = array_flip($sectionColumns); - $fp = fopen($localCsv, 'r'); - while ($line = fgetcsv($fp)) { + $stream = $this->_tmpDirectory->openFile($localCsv); + while ($line = $stream->readCsv()) { if (empty($line)) { // The line was empty, so skip it. continue; } diff --git a/app/code/Magento/Paypal/Model/Standard.php b/app/code/Magento/Paypal/Model/Standard.php index 1b25bc6b720..0dec2633aaf 100644 --- a/app/code/Magento/Paypal/Model/Standard.php +++ b/app/code/Magento/Paypal/Model/Standard.php @@ -102,7 +102,7 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory - * @param \Magento\Core\Model\Session\Generic $paypalSession + * @param \Magento\Session\Generic $paypalSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\UrlInterface $urlBuilder * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -119,7 +119,7 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, - \Magento\Core\Model\Session\Generic $paypalSession, + \Magento\Session\Generic $paypalSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\UrlInterface $urlBuilder, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -154,7 +154,7 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod /** * Get paypal session namespace * - * @return \Magento\Core\Model\Session\Generic + * @return \Magento\Session\Generic */ public function getSession() { 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 4ce45df4c52..64313bf74eb 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php +++ b/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php @@ -41,6 +41,11 @@ class Cert extends \Magento\Core\Model\Config\Value */ protected $_encryptor; + /** + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $_tmpDirectory; + /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -48,6 +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\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -59,12 +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\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); parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); } @@ -85,13 +93,15 @@ class Cert extends \Magento\Core\Model\Config\Value if (!isset($_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value'])) { return $this; } - $tmpPath = $_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value']; - if ($tmpPath && file_exists($tmpPath)) { - if (!filesize($tmpPath)) { + $tmpPath = $this->_tmpDirectory->getRelativePath( + $_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value'] + ); + if ($tmpPath && $this->_tmpDirectory->isExist($tmpPath)) { + if (!$this->_tmpDirectory->stat($tmpPath)['size']) { throw new \Magento\Core\Exception(__('The PayPal certificate file is empty.')); } $this->setValue($_FILES['groups']['name'][$this->getGroupId()]['fields'][$this->getField()]['value']); - $content = $this->_encryptor->encrypt(file_get_contents($tmpPath)); + $content = $this->_encryptor->encrypt($this->_tmpDirectory->readFile($tmpPath)); $this->_certFactory->create()->loadByWebsite($this->getScopeId()) ->setContent($content) ->save(); diff --git a/app/code/Magento/Paypal/etc/adminhtml/di.xml b/app/code/Magento/Paypal/etc/adminhtml/di.xml index ec645990a71..d1d98e56d0a 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/di.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/di.xml @@ -24,18 +24,20 @@ */ --> <config> - <virtualType name="Magento\Paypal\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\Paypal\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>paypal</value> </param> + </virtualType> + <virtualType name="Magento\Paypal\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\Paypal\Model\Session\Storage" /> + </param> <param name="sessionName"> <value>adminhtml</value> </param> </virtualType> - <type name="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> - <value>paypal</value> - </param> + <type name="Magento\Session\Generic"> <param name="sessionName"> <value>adminhtml</value> </param> diff --git a/app/code/Magento/Paypal/etc/adminhtml/routes.xml b/app/code/Magento/Paypal/etc/adminhtml/routes.xml index 49bc9d55b72..0393f172c47 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/routes.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Paypal_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Paypal" before="Magento_Adminhtml" /> </route> </router> </config> diff --git a/app/code/Magento/Paypal/etc/frontend/di.xml b/app/code/Magento/Paypal/etc/frontend/di.xml index b63c9e2e8dd..5bbffb332d0 100644 --- a/app/code/Magento/Paypal/etc/frontend/di.xml +++ b/app/code/Magento/Paypal/etc/frontend/di.xml @@ -24,18 +24,20 @@ */ --> <config> - <virtualType name="Magento\Paypal\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\Paypal\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>paypal</value> </param> + </virtualType> + <virtualType name="Magento\Paypal\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\Paypal\Model\Session\Storage" /> + </param> <param name="sessionName"> <value>frontend</value> </param> </virtualType> - <type name="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> - <value>paypal</value> - </param> + <type name="Magento\Session\Generic"> <param name="sessionName"> <value>frontend</value> </param> diff --git a/app/code/Magento/Paypal/etc/module.xml b/app/code/Magento/Paypal/etc/module.xml index dcb5fbc9763..dcb2688f179 100755 --- a/app/code/Magento/Paypal/etc/module.xml +++ b/app/code/Magento/Paypal/etc/module.xml @@ -35,7 +35,6 @@ <module name="Magento_Sales"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Payment"/> <module name="Magento_Backend"/> <module name="Magento_Tax"/> diff --git a/app/code/Magento/Paypal/view/frontend/order-review.js b/app/code/Magento/Paypal/view/frontend/order-review.js index d66aeb9519e..f77f28f8754 100644 --- a/app/code/Magento/Paypal/view/frontend/order-review.js +++ b/app/code/Magento/Paypal/view/frontend/order-review.js @@ -69,9 +69,10 @@ this.options.shippingSelector, $.proxy(this._submitUpdateOrder, this, $(this.options.shippingSubmitFormSelector).prop('action'), this.options.updateContainerSelector)); this._updateOrderSubmit(!$(this.options.shippingSubmitFormSelector).find(this.options.shippingSelector).val()); } else { - this.element.on('input propertychange', ":input[name]", $.proxy(this._updateOrderSubmit, this, true, this._onShippingChange)) + var isDisable = (this.isShippingSubmitForm && this.element.find(this.options.shippingSelector).val()); + this.element.on('input propertychange', ":input[name]", $.proxy(this._updateOrderSubmit, this, isDisable, this._onShippingChange)) .find('select').not(this.options.shippingSelector).on('change', this._propertyChange); - this._updateOrderSubmit(!this.element.find(this.options.shippingSelector).val()); + this._updateOrderSubmit(isDisable); } }, diff --git a/app/code/Magento/PaypalUk/etc/adminhtml/di.xml b/app/code/Magento/PaypalUk/etc/adminhtml/di.xml index d0afaf9f50a..bf130c1d743 100644 --- a/app/code/Magento/PaypalUk/etc/adminhtml/di.xml +++ b/app/code/Magento/PaypalUk/etc/adminhtml/di.xml @@ -24,10 +24,15 @@ */ --> <config> - <virtualType name="Magento\PaypalUk\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\PaypalUk\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>paypaluk</value> </param> + </virtualType> + <virtualType name="Magento\PaypalUk\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\PaypalUk\Model\Session\Storage" /> + </param> <param name="sessionName"> <value>adminhtml</value> </param> diff --git a/app/code/Magento/PaypalUk/etc/frontend/di.xml b/app/code/Magento/PaypalUk/etc/frontend/di.xml index 4241f02afe7..497ac56b6d2 100644 --- a/app/code/Magento/PaypalUk/etc/frontend/di.xml +++ b/app/code/Magento/PaypalUk/etc/frontend/di.xml @@ -24,10 +24,15 @@ */ --> <config> - <virtualType name="Magento\PaypalUk\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\PaypalUk\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>paypaluk</value> </param> + </virtualType> + <virtualType name="Magento\PaypalUk\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\PaypalUk\Model\Session\Storage" /> + </param> <param name="sessionName"> <value>frontend</value> </param> diff --git a/app/code/Magento/Persistent/Controller/Index.php b/app/code/Magento/Persistent/Controller/Index.php index 29c57019dd0..3e3f8d68832 100644 --- a/app/code/Magento/Persistent/Controller/Index.php +++ b/app/code/Magento/Persistent/Controller/Index.php @@ -59,30 +59,20 @@ class Index extends \Magento\App\Action\Action */ protected $_persistentObserver; - /** - * Core session model - * - * @var \Magento\Core\Model\Session - */ - protected $_session; - /** * Construct * * @param \Magento\App\Action\Context $context - * @param \Magento\Core\Model\Session $session * @param \Magento\Persistent\Model\Observer $persistentObserver * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Customer\Model\Session $customerSession */ public function __construct( \Magento\App\Action\Context $context, - \Magento\Core\Model\Session $session, \Magento\Persistent\Model\Observer $persistentObserver, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Customer\Model\Session $customerSession ) { - $this->_session = $session; $this->_persistentObserver = $persistentObserver; $this->_checkoutSession = $checkoutSession; $this->_customerSession = $customerSession; @@ -166,7 +156,7 @@ class Index extends \Magento\App\Action\Action */ public function expressCheckoutAction() { - $this->_session->addNotice(__('Your shopping cart has been updated with new prices.')); + $this->messageManager->addNotice(__('Your shopping cart has been updated with new prices.')); $this->_redirect('checkout/cart'); } } diff --git a/app/code/Magento/Persistent/Helper/Data.php b/app/code/Magento/Persistent/Helper/Data.php index f3638e0ac0b..3503faf5647 100644 --- a/app/code/Magento/Persistent/Helper/Data.php +++ b/app/code/Magento/Persistent/Helper/Data.php @@ -211,7 +211,7 @@ class Data extends \Magento\Core\Helper\Data */ public function getPersistentConfigFilePath() { - return $this->_modulesReader->getModuleDir('etc', $this->_getModuleName()) . DS . $this->_configFileName; + return $this->_modulesReader->getModuleDir('etc', $this->_getModuleName()) . '/' . $this->_configFileName; } /** diff --git a/app/code/Magento/Persistent/Model/Observer.php b/app/code/Magento/Persistent/Model/Observer.php index 8abbc6edf14..109e4cbde5c 100644 --- a/app/code/Magento/Persistent/Model/Observer.php +++ b/app/code/Magento/Persistent/Model/Observer.php @@ -124,13 +124,6 @@ class Observer */ protected $_checkoutSession; - /** - * Session - * - * @var \Magento\Core\Model\Session - */ - protected $_session; - /** * Website collection factory * @@ -143,6 +136,11 @@ class Observer */ protected $_escaper; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * Construct * @@ -150,7 +148,6 @@ class Observer * @param \Magento\Persistent\Helper\Session $persistentSession * @param \Magento\Persistent\Helper\Data $persistentData * @param \Magento\Core\Model\Resource\Website\CollectionFactory $websiteCollectionFactory - * @param \Magento\Core\Model\Session $session * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\UrlInterface $url @@ -161,6 +158,7 @@ class Observer * @param \Magento\App\RequestInterface $requestHttp * @param \Magento\View\LayoutInterface $layout * @param \Magento\Escaper $escaper + * @param \Magento\Message\ManagerInterface $messageManager * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -169,7 +167,6 @@ class Observer \Magento\Persistent\Helper\Session $persistentSession, \Magento\Persistent\Helper\Data $persistentData, \Magento\Core\Model\Resource\Website\CollectionFactory $websiteCollectionFactory, - \Magento\Core\Model\Session $session, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Customer\Model\Session $customerSession, \Magento\UrlInterface $url, @@ -179,13 +176,13 @@ class Observer \Magento\Persistent\Model\Persistent\ConfigFactory $persistentConfigFactory, \Magento\App\RequestInterface $requestHttp, \Magento\View\LayoutInterface $layout, - \Magento\Escaper $escaper + \Magento\Escaper $escaper, + \Magento\Message\ManagerInterface $messageManager ) { $this->_eventManager = $eventManager; $this->_persistentSession = $persistentSession; $this->_persistentData = $persistentData; $this->_websiteCollectionFactory = $websiteCollectionFactory; - $this->_session = $session; $this->_checkoutSession = $checkoutSession; $this->_customerSession = $customerSession; $this->_url = $url; @@ -196,6 +193,7 @@ class Observer $this->_requestHttp = $requestHttp; $this->_layout = $layout; $this->_escaper = $escaper; + $this->messageManager = $messageManager; } /** @@ -476,7 +474,7 @@ class Observer /** @var $controllerAction \Magento\App\Action\Action */ $controllerAction = $observer->getEvent()->getControllerAction(); if (method_exists($controllerAction, 'redirectLogin')) { - $this->_session->addNotice(__('To check out, please log in using your email address.')); + $this->messageManager->addNotice(__('To check out, please log in using your email address.')); $controllerAction->redirectLogin(); if ($controllerAction instanceof \Magento\GoogleCheckout\Controller\Redirect || $controllerAction instanceof \Magento\Paypal\Controller\Express\AbstractExpress diff --git a/app/code/Magento/Persistent/Model/Persistent/Config.php b/app/code/Magento/Persistent/Model/Persistent/Config.php index 7744d099f1d..8f5c450ecf5 100644 --- a/app/code/Magento/Persistent/Model/Persistent/Config.php +++ b/app/code/Magento/Persistent/Model/Persistent/Config.php @@ -69,25 +69,35 @@ class Config */ protected $_persistentFactory; + /** + * Filesystem + * + * @var \Magento\Filesystem\Directory\Read; + */ + protected $_modulesDirectory; + /** * @param \Magento\Config\DomFactory $domFactory * @param \Magento\Module\Dir\Reader $moduleReader * @param \Magento\View\LayoutInterface $layout * @param \Magento\App\State $appState * @param \Magento\Persistent\Model\Factory $persistentFactory + * @param \Magento\Filesystem $filesystem */ public function __construct( \Magento\Config\DomFactory $domFactory, \Magento\Module\Dir\Reader $moduleReader, \Magento\View\LayoutInterface $layout, \Magento\App\State $appState, - \Magento\Persistent\Model\Factory $persistentFactory + \Magento\Persistent\Model\Factory $persistentFactory, + \Magento\Filesystem $filesystem ) { $this->_domFactory = $domFactory; $this->_moduleReader = $moduleReader; $this->_layout = $layout; $this->_appState = $appState; $this->_persistentFactory = $persistentFactory; + $this->_modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); } /** @@ -111,11 +121,15 @@ class Config protected function _getConfigDomXPath() { if (is_null($this->_configDomXPath)) { - $filePath = $this->_configFilePath; - if (!is_file($filePath) || !is_readable($filePath)) { - throw new \Magento\Core\Exception(__('We cannot load the configuration from file %1.', $filePath)); + $filePath = $this->_modulesDirectory->getRelativePath($this->_configFilePath); + $isFile = $this->_modulesDirectory->isFile($filePath); + $isReadable = $this->_modulesDirectory->isReadable($filePath); + if (!$isFile || !$isReadable) { + throw new \Magento\Core\Exception( + __('We cannot load the configuration from file %1.', $this->_configFilePath) + ); } - $xml = file_get_contents($filePath); + $xml = $this->_modulesDirectory->readFile($filePath); /** @var \Magento\Config\Dom $configDom */ $configDom = $this->_domFactory->createDom( array( diff --git a/app/code/Magento/Persistent/etc/module.xml b/app/code/Magento/Persistent/etc/module.xml index 447255c73b5..fac374ea1da 100755 --- a/app/code/Magento/Persistent/etc/module.xml +++ b/app/code/Magento/Persistent/etc/module.xml @@ -26,7 +26,6 @@ <config> <module name="Magento_Persistent" version="1.0.0.0" active="true"> <sequence> - <module name="Magento_Adminhtml"/> <module name="Magento_Checkout"/> </sequence> <depends> diff --git a/app/code/Magento/ProductAlert/Block/Email/Stock.php b/app/code/Magento/ProductAlert/Block/Email/Stock.php index 4661f346bcf..75525102504 100644 --- a/app/code/Magento/ProductAlert/Block/Email/Stock.php +++ b/app/code/Magento/ProductAlert/Block/Email/Stock.php @@ -39,6 +39,25 @@ class Stock extends \Magento\ProductAlert\Block\Email\AbstractEmail protected $_template = 'email/stock.phtml'; + /** + * @var \Magento\Catalog\Helper\Image + */ + protected $_imageHelper; + + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Catalog\Helper\Image $imageHelper + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Catalog\Helper\Image $imageHelper, + array $data = array() + ) { + $this->_imageHelper = $imageHelper; + parent::__construct($context, $data); + } + /** * Product thumbnail image url getter * @@ -47,7 +66,7 @@ class Stock extends \Magento\ProductAlert\Block\Email\AbstractEmail */ public function getThumbnailUrl($product) { - return (string)$this->helper('Magento\Catalog\Helper\Image')->init($product, 'thumbnail') + return (string)$this->_imageHelper->init($product, 'thumbnail') ->resize($this->getThumbnailSize()); } diff --git a/app/code/Magento/ProductAlert/Controller/Add.php b/app/code/Magento/ProductAlert/Controller/Add.php index 74aaa8d6ad2..94893b2eae4 100644 --- a/app/code/Magento/ProductAlert/Controller/Add.php +++ b/app/code/Magento/ProductAlert/Controller/Add.php @@ -55,6 +55,12 @@ class Add extends \Magento\App\Action\Action parent::__construct($context); } + /** + * Check customer authentication for some actions + * + * @param RequestInterface $request + * @return \Magento\App\ResponseInterface + */ public function dispatch(RequestInterface $request) { if (!$this->_objectManager->get('Magento\Customer\Model\Session')->authenticate($this)) { @@ -76,7 +82,6 @@ class Add extends \Magento\App\Action\Action public function priceAction() { - $session = $this->_objectManager->get('Magento\Catalog\Model\Session'); $backUrl = $this->getRequest()->getParam(\Magento\App\Action\Action::PARAM_NAME_URL_ENCODED); $productId = (int) $this->getRequest()->getParam('product_id'); if (!$backUrl || !$productId) { @@ -87,7 +92,7 @@ class Add extends \Magento\App\Action\Action $product = $this->_objectManager->create('Magento\Catalog\Model\Product')->load($productId); if (!$product->getId()) { /* @var $product \Magento\Catalog\Model\Product */ - $session->addError(__('There are not enough parameters.')); + $this->messageManager->addError(__('There are not enough parameters.')); if ($this->_isInternal($backUrl)) { $this->getResponse()->setRedirect($backUrl); } else { @@ -105,18 +110,16 @@ class Add extends \Magento\App\Action\Action $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId() ); $model->save(); - $session->addSuccess(__('You saved the alert subscription.')); + $this->messageManager->addSuccess(__('You saved the alert subscription.')); } catch (\Exception $e) { - $session->addException($e, __('Unable to update the alert subscription.')); + $this->messageManager->addException($e, __('Unable to update the alert subscription.')); } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); } public function stockAction() { - $session = $this->_objectManager->get('Magento\Catalog\Model\Session'); - /* @var $session \Magento\Catalog\Model\Session */ $backUrl = $this->getRequest()->getParam(\Magento\App\Action\Action::PARAM_NAME_URL_ENCODED); $productId = (int) $this->getRequest()->getParam('product_id'); if (!$backUrl || !$productId) { @@ -126,7 +129,7 @@ class Add extends \Magento\App\Action\Action if (!$product = $this->_objectManager->create('Magento\Catalog\Model\Product')->load($productId)) { /* @var $product \Magento\Catalog\Model\Product */ - $session->addError(__('There are not enough parameters.')); + $this->messageManager->addError(__('There are not enough parameters.')); $this->getResponse()->setRedirect($backUrl); return ; } @@ -139,10 +142,10 @@ class Add extends \Magento\App\Action\Action $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId() ); $model->save(); - $session->addSuccess(__('Alert subscription has been saved.')); + $this->messageManager->addSuccess(__('Alert subscription has been saved.')); } catch (\Exception $e) { - $session->addException($e, __('Unable to update the alert subscription.')); + $this->messageManager->addException($e, __('Unable to update the alert subscription.')); } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); } diff --git a/app/code/Magento/ProductAlert/Controller/Unsubscribe.php b/app/code/Magento/ProductAlert/Controller/Unsubscribe.php index 406218de078..904c3aa0bb0 100644 --- a/app/code/Magento/ProductAlert/Controller/Unsubscribe.php +++ b/app/code/Magento/ProductAlert/Controller/Unsubscribe.php @@ -40,8 +40,10 @@ use Magento\App\RequestInterface; class Unsubscribe extends \Magento\App\Action\Action { /** + * Check customer authentication for some actions + * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { @@ -63,13 +65,10 @@ class Unsubscribe extends \Magento\App\Action\Action $this->_redirect(''); return; } - $session = $this->_objectManager->get('Magento\Catalog\Model\Session'); - - /* @var $session \Magento\Catalog\Model\Session */ $product = $this->_objectManager->create('Magento\Catalog\Model\Product')->load($productId); if (!$product->getId() || !$product->isVisibleInCatalog()) { /* @var $product \Magento\Catalog\Model\Product */ - $this->_objectManager->get('Magento\Customer\Model\Session')->addError(__('We can\'t find the product.')); + $this->messageManager->addError(__('We can\'t find the product.')); $this->_redirect('customer/account/'); return ; } @@ -86,10 +85,10 @@ class Unsubscribe extends \Magento\App\Action\Action $model->delete(); } - $session->addSuccess(__('You deleted the alert subscription.')); + $this->messageManager->addSuccess(__('You deleted the alert subscription.')); } catch (\Exception $e) { - $session->addException($e, __('Unable to update the alert subscription.')); + $this->messageManager->addException($e, __('Unable to update the alert subscription.')); } $this->getResponse()->setRedirect($product->getProductUrl()); } @@ -104,10 +103,10 @@ class Unsubscribe extends \Magento\App\Action\Action $session->getCustomerId(), $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId() ); - $session->addSuccess(__('You will no longer receive price alerts for this product.')); + $this->messageManager->addSuccess(__('You will no longer receive price alerts for this product.')); } catch (\Exception $e) { - $session->addException($e, __('Unable to update the alert subscription.')); + $this->messageManager->addException($e, __('Unable to update the alert subscription.')); } $this->_redirect('customer/account/'); } @@ -121,12 +120,10 @@ class Unsubscribe extends \Magento\App\Action\Action return; } - $session = $this->_objectManager->get('Magento\Catalog\Model\Session'); - /* @var $session \Magento\Catalog\Model\Session */ $product = $this->_objectManager->create('Magento\Catalog\Model\Product')->load($productId); /* @var $product \Magento\Catalog\Model\Product */ if (!$product->getId() || !$product->isVisibleInCatalog()) { - $this->_objectManager->get('Magento\Customer\Model\Session')->addError(__('The product was not found.')); + $this->messageManager->addError(__('The product was not found.')); $this->_redirect('customer/account/'); return ; } @@ -142,10 +139,10 @@ class Unsubscribe extends \Magento\App\Action\Action if ($model->getId()) { $model->delete(); } - $session->addSuccess(__('You will no longer receive stock alerts for this product.')); + $this->messageManager->addSuccess(__('You will no longer receive stock alerts for this product.')); } catch (\Exception $e) { - $session->addException($e, __('Unable to update the alert subscription.')); + $this->messageManager->addException($e, __('Unable to update the alert subscription.')); } $this->getResponse()->setRedirect($product->getProductUrl()); } @@ -160,10 +157,10 @@ class Unsubscribe extends \Magento\App\Action\Action $session->getCustomerId(), $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId() ); - $session->addSuccess(__('You will no longer receive stock alerts.')); + $this->messageManager->addSuccess(__('You will no longer receive stock alerts.')); } catch (\Exception $e) { - $session->addException($e, __('Unable to update the alert subscription.')); + $this->messageManager->addException($e, __('Unable to update the alert subscription.')); } $this->_redirect('customer/account/'); } diff --git a/app/code/Magento/ProductAlert/etc/email_templates.xml b/app/code/Magento/ProductAlert/etc/email_templates.xml index e3c0623a667..6332fd5291d 100644 --- a/app/code/Magento/ProductAlert/etc/email_templates.xml +++ b/app/code/Magento/ProductAlert/etc/email_templates.xml @@ -24,7 +24,7 @@ */ --> <config> - <template id="catalog_productalert_email_stock_template" label="Stock Alert" file="stock_alert.html" type="html"/> - <template id="catalog_productalert_email_price_template" label="Price Alert" file="price_alert.html" type="html"/> - <template id="catalog_productalert_cron_error_email_template" label="Cron Error Warning" file="cron_error.html" type="html"/> + <template id="catalog_productalert_email_stock_template" label="Stock Alert" file="stock_alert.html" type="html" module="Magento_ProductAlert"/> + <template id="catalog_productalert_email_price_template" label="Price Alert" file="price_alert.html" type="html" module="Magento_ProductAlert"/> + <template id="catalog_productalert_cron_error_email_template" label="Cron Error Warning" file="cron_error.html" type="html" module="Magento_ProductAlert"/> </config> diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit.php b/app/code/Magento/Rating/Block/Adminhtml/Edit.php index 4c1233b3c78..ce192fa73e2 100644 --- a/app/code/Magento/Rating/Block/Adminhtml/Edit.php +++ b/app/code/Magento/Rating/Block/Adminhtml/Edit.php @@ -29,7 +29,7 @@ */ namespace Magento\Rating\Block\Adminhtml; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php index cff671b8eb7..87359091f19 100644 --- a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php +++ b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Rating\Block\Adminhtml\Edit\Tab; class Form extends \Magento\Backend\Block\Widget\Form\Generic @@ -39,7 +38,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Session * - * @var \Magento\Core\Model\Session\AbstractSession + * @var \Magento\Session\SessionManagerInterface */ protected $_session; @@ -55,7 +54,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Rating\Model\Rating\OptionFactory $optionFactory - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Core\Model\System\Store $systemStore * @param array $data */ @@ -64,7 +63,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Core\Model\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Rating\Model\Rating\OptionFactory $optionFactory, - \Magento\Core\Model\Session\AbstractSession $session, + \Magento\Session\SessionManagerInterface $session, \Magento\Core\Model\System\Store $systemStore, array $data = array() ) { diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tabs.php b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tabs.php index dc05869d08b..156568833a4 100644 --- a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tabs.php +++ b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tabs.php @@ -33,7 +33,7 @@ */ namespace Magento\Rating\Block\Adminhtml\Edit; -class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs +class Tabs extends \Magento\Backend\Block\Widget\Tabs { protected function _construct() diff --git a/app/code/Magento/Rating/Controller/Adminhtml/Index.php b/app/code/Magento/Rating/Controller/Adminhtml/Index.php index 9b15b7dfeb0..d035d511754 100644 --- a/app/code/Magento/Rating/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Rating/Controller/Adminhtml/Index.php @@ -131,14 +131,14 @@ class Index extends \Magento\Backend\App\Action } } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('You saved the rating.')); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setRatingData(false); + $this->messageManager->addSuccess(__('You saved the rating.')); + $this->_objectManager->get('Magento\Backend\Model\Session')->setRatingData(false); $this->_redirect('rating/*/'); return; } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setRatingData($this->getRequest()->getPost()); + $this->messageManager->addError($e->getMessage()); + $this->_objectManager->get('Magento\Backend\Model\Session')->setRatingData($this->getRequest()->getPost()); $this->_redirect('rating/*/edit', array('id' => $this->getRequest()->getParam('id'))); return; } @@ -154,10 +154,10 @@ class Index extends \Magento\Backend\App\Action /* @var $model \Magento\Rating\Model\Rating */ $model->load($this->getRequest()->getParam('id')) ->delete(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('You deleted the rating.')); + $this->messageManager->addSuccess(__('You deleted the rating.')); $this->_redirect('rating/*/'); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('rating/*/edit', array('id' => $this->getRequest()->getParam('id'))); } } diff --git a/app/code/Magento/Rating/etc/adminhtml/di.xml b/app/code/Magento/Rating/etc/adminhtml/di.xml index f9988e03e27..fb620a8aa2f 100644 --- a/app/code/Magento/Rating/etc/adminhtml/di.xml +++ b/app/code/Magento/Rating/etc/adminhtml/di.xml @@ -26,7 +26,7 @@ <config> <type name="Magento\Rating\Block\Adminhtml\Edit\Tab\Form"> <param name="session"> - <instance type="Magento\Adminhtml\Model\Session" /> + <instance type="Magento\Backend\Model\Session" /> </param> </type> </config> diff --git a/app/code/Magento/Reports/Block/Adminhtml/Filter/Form.php b/app/code/Magento/Reports/Block/Adminhtml/Filter/Form.php index 892763652bf..e3436a4feaa 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Filter/Form.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Filter/Form.php @@ -194,7 +194,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * Initialize form fileds values * Method will be called after prepareForm and can be used for field values initialization * - * @return \Magento\Adminhtml\Block\Widget\Form + * @return \Magento\Backend\Block\Widget\Form */ protected function _initFormValues() { @@ -211,7 +211,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * This method is called before rendering HTML * - * @return \Magento\Adminhtml\Block\Widget\Form + * @return \Magento\Backend\Block\Widget\Form */ protected function _beforeToHtml() { diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php index 7756fa9b371..5105c220d4a 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php @@ -58,6 +58,7 @@ class AbstractGrid extends \Magento\Backend\Block\Widget\Grid\Extended /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Report\Collection\Factory $resourceFactory * @param \Magento\Reports\Model\Grouped\CollectionFactory $collectionFactory * @param \Magento\Reports\Helper\Data $reportsData @@ -66,6 +67,7 @@ class AbstractGrid extends \Magento\Backend\Block\Widget\Grid\Extended public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Report\Collection\Factory $resourceFactory, \Magento\Reports\Model\Grouped\CollectionFactory $collectionFactory, \Magento\Reports\Helper\Data $reportsData, @@ -74,7 +76,7 @@ class AbstractGrid extends \Magento\Backend\Block\Widget\Grid\Extended $this->_resourceFactory = $resourceFactory; $this->_collectionFactory = $collectionFactory; $this->_reportsData = $reportsData; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Blanknumber.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Blanknumber.php index 57130d86ab6..861dfd84637 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Blanknumber.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Blanknumber.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Grid\Column\Renderer; -class Blanknumber extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Number +class Blanknumber extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Number { protected function _getValue(\Magento\Object $row) { diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php index 48a589bc47b..6c9243ffc13 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php @@ -35,7 +35,7 @@ namespace Magento\Reports\Block\Adminhtml\Grid\Column\Renderer; class Customer - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer + extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * Renders grid column diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Product.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Product.php index b598d5e3453..a52d98f702a 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Product.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Product.php @@ -35,7 +35,7 @@ namespace Magento\Reports\Block\Adminhtml\Grid\Column\Renderer; class Product - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer + extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * Renders grid column diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product.php b/app/code/Magento/Reports/Block/Adminhtml/Product.php index 35355169e3e..04d15c0e133 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product.php @@ -33,7 +33,7 @@ */ namespace Magento\Reports\Block\Adminhtml; -class Product extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Product extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads.php index 86695e021cf..e3734cc8c1b 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Product; -class Downloads extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Downloads extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() { diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads/Grid.php index 3d954099402..43967925787 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads/Grid.php @@ -33,7 +33,7 @@ */ namespace Magento\Reports\Block\Adminhtml\Product\Downloads; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * @var \Magento\Reports\Model\Resource\Product\Downloads\CollectionFactory @@ -43,17 +43,19 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Product\Downloads\CollectionFactory $downloadsFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Product\Downloads\CollectionFactory $downloadsFactory, array $data = array() ) { $this->_downloadsFactory = $downloadsFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads/Renderer/Purchases.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads/Renderer/Purchases.php index 7fd67755895..e516c012cc7 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads/Renderer/Purchases.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads/Renderer/Purchases.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Product\Downloads\Renderer; class Purchases - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer + extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * Renders Purchases value diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Grid.php index 85a1c2a5a54..3deb40d9da0 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Grid.php @@ -43,17 +43,19 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Product\CollectionFactory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Product\CollectionFactory $collectionFactory, array $data = array() ) { $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock.php index 3492e84a222..0d45a8ce4a3 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Product; -class Lowstock extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Lowstock extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() { diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock/Grid.php index 1c2cb24199a..96dc6da8707 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock/Grid.php @@ -43,17 +43,19 @@ class Grid extends \Magento\Backend\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Product\Lowstock\CollectionFactory $lowstocksFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Product\Lowstock\CollectionFactory $lowstocksFactory, array $data = array() ) { $this->_lowstocksFactory = $lowstocksFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Viewed.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Viewed.php index 2d8fc1e213e..3873c722a94 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Viewed.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Viewed.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Product; -class Viewed extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Viewed extends \Magento\Backend\Block\Widget\Grid\Container { protected $_template = 'report/grid/container.phtml'; diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Viewed/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Viewed/Grid.php index 6c2b19145c0..3d190d2f467 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Viewed/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Viewed/Grid.php @@ -61,7 +61,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\AbstractGrid /** * Custom columns preparation * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/Reports/Block/Adminhtml/Review/Customer.php b/app/code/Magento/Reports/Block/Adminhtml/Review/Customer.php index f6c8043617d..b16dfd4f90d 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Review/Customer.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Review/Customer.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Review; -class Customer extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Customer extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Review/Detail.php b/app/code/Magento/Reports/Block/Adminhtml/Review/Detail.php index a8ef09d4678..3c2eb2593cc 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Review/Detail.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Review/Detail.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Review; -class Detail extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Detail extends \Magento\Backend\Block\Widget\Grid\Container { /** * @var \Magento\Catalog\Model\ProductFactory diff --git a/app/code/Magento/Reports/Block/Adminhtml/Review/Detail/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Review/Detail/Grid.php index ac81efa1550..5624c98cd39 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Review/Detail/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Review/Detail/Grid.php @@ -33,7 +33,7 @@ */ namespace Magento\Reports\Block\Adminhtml\Review\Detail; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * @var \Magento\Reports\Model\Resource\Review\CollectionFactory @@ -43,17 +43,19 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Review\CollectionFactory $reviewsFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Review\CollectionFactory $reviewsFactory, array $data = array() ) { $this->_reviewsFactory = $reviewsFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Review/Product.php b/app/code/Magento/Reports/Block/Adminhtml/Review/Product.php index ec4befe0c00..528ade2f202 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Review/Product.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Review/Product.php @@ -33,7 +33,7 @@ */ namespace Magento\Reports\Block\Adminhtml\Review; -class Product extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Product extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Bestsellers.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Bestsellers.php index 7228b5e0c11..06da2e9fc5c 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Bestsellers.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Bestsellers.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Sales; -class Bestsellers extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Bestsellers extends \Magento\Backend\Block\Widget\Grid\Container { protected $_template = 'report/grid/container.phtml'; diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Coupons.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Coupons.php index 622b77b1d5a..c8aaf4e4ae4 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Coupons.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Coupons.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Sales; -class Coupons extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Coupons extends \Magento\Backend\Block\Widget\Grid\Container { protected $_template = 'report/grid/container.phtml'; diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php index d58f5112545..6d6a43c0385 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php @@ -30,7 +30,7 @@ namespace Magento\Reports\Block\Adminhtml\Sales\Grid\Column\Renderer; class Date - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Date + extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Date { /** * Retrieve date format diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Invoiced.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Invoiced.php index 6b19c1592d0..9bae8fceee8 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Invoiced.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Invoiced.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Sales; -class Invoiced extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Invoiced extends \Magento\Backend\Block\Widget\Grid\Container { protected $_template = 'report/grid/container.phtml'; diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Refunded.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Refunded.php index 1216cd954a5..264d4de8e71 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Refunded.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Refunded.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Sales; -class Refunded extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Refunded extends \Magento\Backend\Block\Widget\Grid\Container { protected $_template = 'report/grid/container.phtml'; diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Sales.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Sales.php index bf5360ca8c4..c2a17525858 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Sales.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Sales.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Sales; -class Sales extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Sales extends \Magento\Backend\Block\Widget\Grid\Container { protected $_template = 'report/grid/container.phtml'; diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Shipping.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Shipping.php index 1d382b0d0fa..14c4dfdd1db 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Shipping.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Shipping.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Sales; -class Shipping extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Shipping extends \Magento\Backend\Block\Widget\Grid\Container { protected $_template = 'report/grid/container.phtml'; diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax.php index 358d4ab48f0..0d9a518a067 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Sales; -class Tax extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Tax extends \Magento\Backend\Block\Widget\Grid\Container { protected $_template = 'report/grid/container.phtml'; diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php index 5bb9a34d558..ceee0ceaadd 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php @@ -45,6 +45,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\AbstractGrid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Report\Collection\Factory $resourceFactory * @param \Magento\Reports\Model\Grouped\CollectionFactory $collectionFactory * @param \Magento\Reports\Helper\Data $reportsData @@ -54,6 +55,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\AbstractGrid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Report\Collection\Factory $resourceFactory, \Magento\Reports\Model\Grouped\CollectionFactory $collectionFactory, \Magento\Reports\Helper\Data $reportsData, @@ -61,7 +63,15 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\AbstractGrid array $data = array() ) { $this->_configFactory = $configFactory; - parent::__construct($context, $urlModel, $resourceFactory, $collectionFactory, $reportsData, $data); + parent::__construct( + $context, + $urlModel, + $backendHelper, + $resourceFactory, + $collectionFactory, + $reportsData, + $data + ); } protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned.php b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned.php index a4bd90b7b92..8a0ef435ecb 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned.php @@ -33,7 +33,7 @@ */ namespace Magento\Reports\Block\Adminhtml\Shopcart; -class Abandoned extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Abandoned extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned/Grid.php index a85b83d5153..63798fa9001 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned/Grid.php @@ -43,17 +43,19 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Quote\CollectionFactory $quotesFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Quote\CollectionFactory $quotesFactory, array $data = array() ) { $this->_quotesFactory = $quotesFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Customer.php b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Customer.php index 69fa0e4f01c..0eec97468b8 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Customer.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Customer.php @@ -34,7 +34,7 @@ namespace Magento\Reports\Block\Adminhtml\Shopcart; -class Customer extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Customer extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() { diff --git a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Customer/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Customer/Grid.php index 33eefd1309d..0aa127b2a7d 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Customer/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Customer/Grid.php @@ -43,17 +43,19 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Customer\CollectionFactory $customersFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Customer\CollectionFactory $customersFactory, array $data = array() ) { $this->_customersFactory = $customersFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product.php b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product.php index 3b60e367aba..064b1c3a1a6 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product.php @@ -33,7 +33,7 @@ */ namespace Magento\Reports\Block\Adminhtml\Shopcart; -class Product extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Product extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php index 12e1db3778b..ad220020510 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php @@ -43,17 +43,19 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Quote\CollectionFactory $quotesFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Quote\CollectionFactory $quotesFactory, array $data = array() ) { $this->_quotesFactory = $quotesFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Reports/Block/Adminhtml/Wishlist/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Wishlist/Grid.php index b785995c13d..a2d9eab9c35 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Wishlist/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Wishlist/Grid.php @@ -33,7 +33,7 @@ */ namespace Magento\Reports\Block\Adminhtml\Wishlist; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * @var \Magento\Reports\Model\Resource\Wishlist\Product\CollectionFactory @@ -43,17 +43,19 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Reports\Model\Resource\Wishlist\Product\CollectionFactory $productsFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Reports\Model\Resource\Wishlist\Product\CollectionFactory $productsFactory, array $data = array() ) { $this->_productsFactory = $productsFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Reports/Block/Product/AbstractProduct.php b/app/code/Magento/Reports/Block/Product/AbstractProduct.php index ce2908b0e5b..c0fd2a62369 100644 --- a/app/code/Magento/Reports/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Reports/Block/Product/AbstractProduct.php @@ -67,9 +67,16 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Reports\Model\Product\Index\Factory $indexFactory * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -78,11 +85,29 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Reports\Model\Product\Index\Factory $indexFactory, array $data = array() ) { - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); $this->_productVisibility = $productVisibility; $this->_indexFactory = $indexFactory; } diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Report/AbstractReport.php b/app/code/Magento/Reports/Controller/Adminhtml/Report/AbstractReport.php index 54f5276bb45..3450a8e74c6 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Report/AbstractReport.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Report/AbstractReport.php @@ -148,7 +148,7 @@ abstract class AbstractReport extends \Magento\Backend\App\Action $refreshStatsLink = $this->getUrl('reports/report_statistics'); $directRefreshLink = $this->getUrl('reports/report_statistics/refreshRecent', array('code' => $refreshCode)); - $this->_objectManager->get('Magento\Adminhtml\Model\Session') + $this->messageManager ->addNotice(__('Last updated: %1. To refresh last day\'s <a href="%2">statistics</a>, ' . 'click <a href="%3">here</a>.', $updatedAt, $refreshStatsLink, $directRefreshLink)); return $this; diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Report/Sales.php b/app/code/Magento/Reports/Controller/Adminhtml/Report/Sales.php index ae4f1338e75..0fe935b2192 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Report/Sales.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Report/Sales.php @@ -118,7 +118,7 @@ class Sales extends \Magento\Reports\Controller\Adminhtml\Report\AbstractReport */ public function refreshRecentAction() { - return $this->_forward('refreshRecent', 'report_statistics'); + $this->_forward('refreshRecent', 'report_statistics'); } /** @@ -128,7 +128,7 @@ class Sales extends \Magento\Reports\Controller\Adminhtml\Report\AbstractReport */ public function refreshLifetimeAction() { - return $this->_forward('refreshLifetime', 'report_statistics'); + $this->_forward('refreshLifetime', 'report_statistics'); } /** @@ -370,7 +370,7 @@ class Sales extends \Magento\Reports\Controller\Adminhtml\Report\AbstractReport public function refreshStatisticsAction() { - return $this->_forward('index', 'report_statistics'); + $this->_forward('index', 'report_statistics'); } protected function _isAllowed() diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Report/Statistics.php b/app/code/Magento/Reports/Controller/Adminhtml/Report/Statistics.php index ec274160123..0cde6ce2ba4 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Report/Statistics.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Report/Statistics.php @@ -144,23 +144,19 @@ class Statistics extends \Magento\Backend\App\Action foreach ($collectionsNames as $collectionName) { $this->_objectManager->create($collectionName)->aggregate($date); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addSuccess(__('Recent statistics have been updated.')); + $this->messageManager->addSuccess(__('Recent statistics have been updated.')); } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError(__('We can\'t refresh recent statistics.')); + $this->messageManager->addError(__('We can\'t refresh recent statistics.')); $this->_objectManager->get('Magento\Logger')->logException($e); } - if($this->_getSession()->isFirstPageAfterLogin()) { + if ($this->_getSession()->isFirstPageAfterLogin()) { $this->_redirect('adminhtml/*'); } else { $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl('*/*')); } - return $this; } /** @@ -175,14 +171,11 @@ class Statistics extends \Magento\Backend\App\Action foreach ($collectionsNames as $collectionName) { $this->_objectManager->create($collectionName)->aggregate(); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addSuccess(__('We updated lifetime statistics.')); + $this->messageManager->addSuccess(__('We updated lifetime statistics.')); } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError(__('We can\'t refresh lifetime statistics.')); + $this->messageManager->addError(__('We can\'t refresh lifetime statistics.')); $this->_objectManager->get('Magento\Logger')->logException($e); } @@ -191,8 +184,6 @@ class Statistics extends \Magento\Backend\App\Action } else { $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl('*/*')); } - - return $this; } public function indexAction() diff --git a/app/code/Magento/Reports/Model/Config.php b/app/code/Magento/Reports/Model/Config.php index 0b1147bf0c9..bb7167a6967 100644 --- a/app/code/Magento/Reports/Model/Config.php +++ b/app/code/Magento/Reports/Model/Config.php @@ -59,7 +59,7 @@ class Config extends \Magento\Object public function getGlobalConfig() { $dom = new \DOMDocument(); - $dom->load($this->_moduleReader->getModuleDir('etc', 'Magento_Reports') . DS . 'flexConfig.xml'); + $dom->load($this->_moduleReader->getModuleDir('etc', 'Magento_Reports') . '/flexConfig.xml'); $baseUrl = $dom->createElement('baseUrl'); $baseUrl->nodeValue = $this->_storeManager->getBaseUrl(); @@ -72,14 +72,14 @@ class Config extends \Magento\Object public function getLanguage() { return file_get_contents( - $this->_moduleReader->getModuleDir('etc', 'Magento_Reports') . DS . 'flexLanguage.xml' + $this->_moduleReader->getModuleDir('etc', 'Magento_Reports') . '/flexLanguage.xml' ); } public function getDashboard() { return file_get_contents( - $this->_moduleReader->getModuleDir('etc', 'Magento_Reports') . DS . 'flexDashboard.xml' + $this->_moduleReader->getModuleDir('etc', 'Magento_Reports') . '/flexDashboard.xml' ); } } diff --git a/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php b/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php index b9812bf7203..e0d2df36ff1 100644 --- a/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php +++ b/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php @@ -54,7 +54,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel protected $_customerSession; /** - * @var \Magento\Core\Model\Session\Generic + * @var \Magento\Session\Generic */ protected $_reportSession; @@ -74,7 +74,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Core\Model\Session\Generic $reportSession + * @param \Magento\Session\Generic $reportSession * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Resource\AbstractResource $resource @@ -87,7 +87,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Log\Model\Visitor $logVisitor, \Magento\Customer\Model\Session $customerSession, - \Magento\Core\Model\Session\Generic $reportSession, + \Magento\Session\Generic $reportSession, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\AbstractResource $resource = null, @@ -208,7 +208,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel /** * Retrieve Reports Session instance * - * @return \Magento\Core\Model\Session\Generic + * @return \Magento\Session\Generic */ protected function _getSession() { diff --git a/app/code/Magento/Reports/Model/Product/Index/Compared.php b/app/code/Magento/Reports/Model/Product/Index/Compared.php index 48aa58fe091..76899525369 100644 --- a/app/code/Magento/Reports/Model/Product/Index/Compared.php +++ b/app/code/Magento/Reports/Model/Product/Index/Compared.php @@ -66,7 +66,7 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Core\Model\Session\Generic $reportSession + * @param \Magento\Session\Generic $reportSession * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Catalog\Helper\Product\Compare $productCompare @@ -80,7 +80,7 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Log\Model\Visitor $logVisitor, \Magento\Customer\Model\Session $customerSession, - \Magento\Core\Model\Session\Generic $reportSession, + \Magento\Session\Generic $reportSession, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Stdlib\DateTime $dateTime, \Magento\Catalog\Helper\Product\Compare $productCompare, diff --git a/app/code/Magento/Reports/Model/Totals.php b/app/code/Magento/Reports/Model/Totals.php index 695676d3c65..a695ff0dab4 100644 --- a/app/code/Magento/Reports/Model/Totals.php +++ b/app/code/Magento/Reports/Model/Totals.php @@ -38,7 +38,7 @@ class Totals /** * Retrieve count totals * - * @param \Magento\Adminhtml\Block\Widget\Grid $grid + * @param \Magento\Backend\Block\Widget\Grid $grid * @param string $from * @param string $to * @return \Magento\Object diff --git a/app/code/Magento/Reports/etc/adminhtml/menu.xml b/app/code/Magento/Reports/etc/adminhtml/menu.xml index 5a4a7ec25e3..21cfe30c1df 100644 --- a/app/code/Magento/Reports/etc/adminhtml/menu.xml +++ b/app/code/Magento/Reports/etc/adminhtml/menu.xml @@ -28,7 +28,7 @@ <config> <menu> <add id="Magento_Reports::report" title="Reports" module="Magento_Reports" sortOrder="60" resource="Magento_Reports::report"/> - <add id="Magento_Reports::report_marketing" title="Marketing" module="Magento_Adminhtml" sortOrder="10" parent="Magento_Reports::report" resource="Magento_Reports::report_marketing"/> + <add id="Magento_Reports::report_marketing" title="Marketing" module="Magento_Backend" sortOrder="10" parent="Magento_Reports::report" resource="Magento_Reports::report_marketing"/> <add id="Magento_Reports::report_salesroot" title="Sales" module="Magento_Reports" sortOrder="40" parent="Magento_Reports::report" resource="Magento_Reports::salesroot"/> <add id="Magento_Reports::report_salesroot_sales" title="Orders" module="Magento_Reports" sortOrder="10" parent="Magento_Reports::report_salesroot" action="reports/report_sales/sales" resource="Magento_Reports::salesroot_sales"/> <add id="Magento_Reports::report_salesroot_tax" title="Tax" module="Magento_Reports" sortOrder="20" parent="Magento_Reports::report_salesroot" action="reports/report_sales/tax" resource="Magento_Reports::tax"/> diff --git a/app/code/Magento/Reports/etc/di.xml b/app/code/Magento/Reports/etc/di.xml index e94a86e861a..f04965b8421 100644 --- a/app/code/Magento/Reports/etc/di.xml +++ b/app/code/Magento/Reports/etc/di.xml @@ -34,11 +34,16 @@ </value> </param> </type> - <virtualType name="Magento\Reports\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\Reports\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>reports</value> </param> </virtualType> + <virtualType name="Magento\Reports\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\Reports\Model\Session\Storage" /> + </param> + </virtualType> <type name="Magento\Reports\Model\Product\Index\AbstractIndex"> <param name="reportSession"> <instance type="Magento\Reports\Model\Session" /> diff --git a/app/code/Magento/Reports/etc/module.xml b/app/code/Magento/Reports/etc/module.xml index 22077d21838..8b2792c478b 100755 --- a/app/code/Magento/Reports/etc/module.xml +++ b/app/code/Magento/Reports/etc/module.xml @@ -44,7 +44,6 @@ <module name="Magento_Log"/> <module name="Magento_Wishlist"/> <module name="Magento_Review"/> - <module name="Magento_Adminhtml"/> <module name="Magento_CatalogInventory"/> <module name="Magento_Tax"/> <module name="Magento_Rating"/> 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 f3b7496bfd4..95edeae6adb 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 @@ -24,16 +24,15 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ -$installer = $this; +/** @var $this \Magento\Core\Model\Resource\Setup */ /** * Create table 'report_compared_product_index'. * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that * only one record is added when customer/visitor compares same product again. */ -$table = $installer->getConnection() - ->newTable($installer->getTable('report_compared_product_index')) +$table = $this->getConnection() + ->newTable($this->getTable('report_compared_product_index')) ->addColumn('index_id', \Magento\DB\Ddl\Table::TYPE_BIGINT, null, array( 'identity' => true, 'unsigned' => true, @@ -56,35 +55,35 @@ $table = $installer->getConnection() ->addColumn('added_at', \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, null, array( 'nullable' => false, ), 'Added At') - ->addIndex($installer->getIdxName('report_compared_product_index', array('visitor_id', 'product_id'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), + ->addIndex($this->getIdxName('report_compared_product_index', array('visitor_id', 'product_id'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), array('visitor_id', 'product_id'), array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)) - ->addIndex($installer->getIdxName('report_compared_product_index', array('customer_id', 'product_id'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), + ->addIndex($this->getIdxName('report_compared_product_index', array('customer_id', 'product_id'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), array('customer_id', 'product_id'), array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)) - ->addIndex($installer->getIdxName('report_compared_product_index', array('store_id')), + ->addIndex($this->getIdxName('report_compared_product_index', array('store_id')), array('store_id')) - ->addIndex($installer->getIdxName('report_compared_product_index', array('added_at')), + ->addIndex($this->getIdxName('report_compared_product_index', array('added_at')), array('added_at')) - ->addIndex($installer->getIdxName('report_compared_product_index', array('product_id')), + ->addIndex($this->getIdxName('report_compared_product_index', array('product_id')), array('product_id')) - ->addForeignKey($installer->getFkName('report_compared_product_index', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', $installer->getTable('customer_entity'), 'entity_id', + ->addForeignKey($this->getFkName('report_compared_product_index', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', $this->getTable('customer_entity'), 'entity_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE) - ->addForeignKey($installer->getFkName('report_compared_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', + ->addForeignKey($this->getFkName('report_compared_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', $this->getTable('catalog_product_entity'), 'entity_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE) - ->addForeignKey($installer->getFkName('report_compared_product_index', 'store_id', 'core_store', 'store_id'), - 'store_id', $installer->getTable('core_store'), 'store_id', + ->addForeignKey($this->getFkName('report_compared_product_index', 'store_id', 'core_store', 'store_id'), + 'store_id', $this->getTable('core_store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE) ->setComment('Reports Compared Product Index Table'); -$installer->getConnection()->createTable($table); +$this->getConnection()->createTable($table); /** * Create table 'report_viewed_product_index' * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that * only one record is added when customer/visitor views same product again. */ -$table = $installer->getConnection() - ->newTable($installer->getTable('report_viewed_product_index')) +$table = $this->getConnection() + ->newTable($this->getTable('report_viewed_product_index')) ->addColumn('index_id', \Magento\DB\Ddl\Table::TYPE_BIGINT, null, array( 'identity' => true, 'unsigned' => true, @@ -107,29 +106,32 @@ $table = $installer->getConnection() ->addColumn('added_at', \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, null, array( 'nullable' => false, ), 'Added At') - ->addIndex($installer->getIdxName('report_viewed_product_index', array('visitor_id', 'product_id'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), + ->addIndex($this->getIdxName('report_viewed_product_index', array('visitor_id', 'product_id'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), array('visitor_id', 'product_id'), array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)) - ->addIndex($installer->getIdxName('report_viewed_product_index', array('customer_id', 'product_id'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), + ->addIndex($this->getIdxName('report_viewed_product_index', array('customer_id', 'product_id'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), array('customer_id', 'product_id'), array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)) - ->addIndex($installer->getIdxName('report_viewed_product_index', array('store_id')), + ->addIndex($this->getIdxName('report_viewed_product_index', array('store_id')), array('store_id')) - ->addIndex($installer->getIdxName('report_viewed_product_index', array('added_at')), + ->addIndex($this->getIdxName('report_viewed_product_index', array('added_at')), array('added_at')) - ->addIndex($installer->getIdxName('report_viewed_product_index', array('product_id')), + ->addIndex($this->getIdxName('report_viewed_product_index', array('product_id')), array('product_id')) - ->addForeignKey($installer->getFkName('report_viewed_product_index', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', $installer->getTable('customer_entity'), 'entity_id', + ->addForeignKey($this->getFkName('report_viewed_product_index', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', $this->getTable('customer_entity'), 'entity_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE) - ->addForeignKey($installer->getFkName('report_viewed_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', + ->addForeignKey($this->getFkName('report_viewed_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', $this->getTable('catalog_product_entity'), 'entity_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE) - ->addForeignKey($installer->getFkName('report_viewed_product_index', 'store_id', 'core_store', 'store_id'), - 'store_id', $installer->getTable('core_store'), 'store_id', + ->addForeignKey($this->getFkName('report_viewed_product_index', 'store_id', 'core_store', 'store_id'), + 'store_id', $this->getTable('core_store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE) ->setComment('Reports Viewed Product Index Table'); -$installer->getConnection()->createTable($table); +$this->getConnection()->createTable($table); -$installFile = __DIR__ . DS . 'install-1.6.0.0.php'; -if (file_exists($installFile)) { +$installFile = __DIR__ . '/install-1.6.0.0.php'; + +/** @var \Magento\Filesystem\Directory\Read $modulesDirectory */ +$modulesDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\Filesystem::MODULES); +if ($modulesDirectory->isExist($modulesDirectory->getRelativePath($installFile))) { include $installFile; } diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_lowstock_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_lowstock_grid.xml index 3a359a75fd0..8e3191c5e64 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_lowstock_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_lowstock_grid.xml @@ -67,7 +67,7 @@ <block class="Magento\Backend\Block\Widget\Grid\Column" as="qty"> <arguments> <argument name="header" xsi:type="string" translate="true">Stock Quantity</argument> - <argument name="filter" xsi:type="string">Magento\Adminhtml\Block\Widget\Grid\Column\Filter\Range</argument> + <argument name="filter" xsi:type="string">Magento\Backend\Block\Widget\Grid\Column\Filter\Range</argument> <argument name="sortable" xsi:type="string">0</argument> <argument name="index" xsi:type="string">qty</argument> <argument name="type" xsi:type="string">number</argument> diff --git a/app/code/Magento/Review/Block/Adminhtml/Add.php b/app/code/Magento/Review/Block/Adminhtml/Add.php index a91ba8ea69d..db039068073 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Add.php +++ b/app/code/Magento/Review/Block/Adminhtml/Add.php @@ -34,7 +34,7 @@ namespace Magento\Review\Block\Adminhtml; -class Add extends \Magento\Adminhtml\Block\Widget\Form\Container +class Add extends \Magento\Backend\Block\Widget\Form\Container { protected function _construct() { diff --git a/app/code/Magento/Review/Block/Adminhtml/Edit.php b/app/code/Magento/Review/Block/Adminhtml/Edit.php index f269dc72a41..b2e76e37a57 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Edit.php +++ b/app/code/Magento/Review/Block/Adminhtml/Edit.php @@ -29,7 +29,7 @@ */ namespace Magento\Review\Block\Adminhtml; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Review action pager diff --git a/app/code/Magento/Review/Block/Adminhtml/Grid.php b/app/code/Magento/Review/Block/Adminhtml/Grid.php index f8b0433e306..3d2b7710be5 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Review/Block/Adminhtml/Grid.php @@ -75,6 +75,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param \Magento\Review\Model\Resource\Review\Product\CollectionFactory $productsFactory * @param \Magento\Review\Helper\Data $reviewData @@ -85,6 +86,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Review\Model\Resource\Review\Product\CollectionFactory $productsFactory, \Magento\Review\Helper\Data $reviewData, @@ -97,7 +99,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended $this->_reviewData = $reviewData; $this->_reviewActionPager = $reviewActionPager; $this->_reviewFactory = $reviewFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** diff --git a/app/code/Magento/Review/Block/Adminhtml/Grid/Filter/Type.php b/app/code/Magento/Review/Block/Adminhtml/Grid/Filter/Type.php index 8e9c57cf686..23309d8c66a 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Grid/Filter/Type.php +++ b/app/code/Magento/Review/Block/Adminhtml/Grid/Filter/Type.php @@ -34,7 +34,7 @@ namespace Magento\Review\Block\Adminhtml\Grid\Filter; -class Type extends \Magento\Adminhtml\Block\Widget\Grid\Column\Filter\Select +class Type extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select { protected function _getOptions() { diff --git a/app/code/Magento/Review/Block/Adminhtml/Grid/Renderer/Type.php b/app/code/Magento/Review/Block/Adminhtml/Grid/Renderer/Type.php index fb7da5ee709..2ab4aac03ea 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Grid/Renderer/Type.php +++ b/app/code/Magento/Review/Block/Adminhtml/Grid/Renderer/Type.php @@ -34,7 +34,7 @@ namespace Magento\Review\Block\Adminhtml\Grid\Renderer; -class Type extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Type extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { public function render(\Magento\Object $row) { diff --git a/app/code/Magento/Review/Block/Adminhtml/Main.php b/app/code/Magento/Review/Block/Adminhtml/Main.php index 25db0febac1..a603a515659 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Main.php +++ b/app/code/Magento/Review/Block/Adminhtml/Main.php @@ -29,7 +29,7 @@ */ namespace Magento\Review\Block\Adminhtml; -class Main extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Main extends \Magento\Backend\Block\Widget\Grid\Container { /** * Core registry diff --git a/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php index 03f19458251..ec872109553 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php @@ -43,6 +43,7 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Core\Model\WebsiteFactory $websiteFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory @@ -52,10 +53,13 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Core\Model\Resource\Website\CollectionFactory $websitesFactory * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Core\Model\WebsiteFactory $websiteFactory, \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory, \Magento\Catalog\Model\ProductFactory $productFactory, @@ -70,6 +74,7 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid parent::__construct( $context, $urlModel, + $backendHelper, $websiteFactory, $setsFactory, $productFactory, diff --git a/app/code/Magento/Review/Block/Customer/View.php b/app/code/Magento/Review/Block/Customer/View.php index 99ec5202c27..7b1f124a773 100644 --- a/app/code/Magento/Review/Block/Customer/View.php +++ b/app/code/Magento/Review/Block/Customer/View.php @@ -70,12 +70,19 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory * @param \Magento\Rating\Model\RatingFactory $ratingFactory * @param \Magento\Customer\Model\Session $customerSession * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -84,6 +91,11 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, @@ -97,7 +109,20 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct $this->_ratingFactory = $ratingFactory; $this->_customerSession = $customerSession; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); } diff --git a/app/code/Magento/Review/Block/Form.php b/app/code/Magento/Review/Block/Form.php index 1c7deb78c3d..315355ec93b 100644 --- a/app/code/Magento/Review/Block/Form.php +++ b/app/code/Magento/Review/Block/Form.php @@ -67,24 +67,31 @@ class Form extends \Magento\View\Element\Template */ protected $_coreData; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Model\Session\Generic $reviewSession + * @param \Magento\Session\Generic $reviewSession * @param \Magento\Review\Helper\Data $reviewData * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Rating\Model\RatingFactory $ratingFactory + * @param \Magento\Message\ManagerInterface $messageManager * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\Session\Generic $reviewSession, + \Magento\Session\Generic $reviewSession, \Magento\Review\Helper\Data $reviewData, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Rating\Model\RatingFactory $ratingFactory, + \Magento\Message\ManagerInterface $messageManager, array $data = array() ) { $this->_coreData = $coreData; @@ -93,6 +100,7 @@ class Form extends \Magento\View\Element\Template $this->_customerSession = $customerSession; $this->_productFactory = $productFactory; $this->_ratingFactory = $ratingFactory; + $this->messageManager = $messageManager; parent::__construct($context, $data); } @@ -127,7 +135,7 @@ class Form extends \Magento\View\Element\Template $this->setTemplate('form.phtml') ->assign('data', $data) - ->assign('messages', $this->_reviewSession->getMessages(true)); + ->assign('messages', $this->messageManager->getMessages(true)); } public function getProductInfo() diff --git a/app/code/Magento/Review/Block/Product/View.php b/app/code/Magento/Review/Block/Product/View.php index 36843b4bd10..634c10bf228 100644 --- a/app/code/Magento/Review/Block/Product/View.php +++ b/app/code/Magento/Review/Block/Product/View.php @@ -47,18 +47,26 @@ class View extends \Magento\Catalog\Block\Product\View /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\Config $catalogConfig * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Tax\Model\Calculation $taxCalculation * @param \Magento\Stdlib\String $string + * @param \Magento\Catalog\Helper\Product $productHelper * @param \Magento\Review\Model\Resource\Review\CollectionFactory $collectionFactory * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -67,11 +75,17 @@ class View extends \Magento\Catalog\Block\Product\View \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Tax\Model\Calculation $taxCalculation, \Magento\Stdlib\String $string, + \Magento\Catalog\Helper\Product $productHelper, \Magento\Review\Model\Resource\Review\CollectionFactory $collectionFactory, array $data = array() ) { @@ -83,11 +97,17 @@ class View extends \Magento\Catalog\Block\Product\View $taxData, $catalogData, $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, $coreData, $jsonEncoder, $productFactory, $taxCalculation, $string, + $productHelper, $data ); } diff --git a/app/code/Magento/Review/Block/View.php b/app/code/Magento/Review/Block/View.php index 900f0e1b2ae..5b8d2e56e9a 100644 --- a/app/code/Magento/Review/Block/View.php +++ b/app/code/Magento/Review/Block/View.php @@ -60,10 +60,17 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory * @param \Magento\Rating\Model\RatingFactory $ratingFactory * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -72,6 +79,11 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, \Magento\Rating\Model\RatingFactory $ratingFactory, \Magento\Review\Model\ReviewFactory $reviewFactory, @@ -80,7 +92,20 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct $this->_voteFactory = $voteFactory; $this->_reviewFactory = $reviewFactory; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); } /** diff --git a/app/code/Magento/Review/Controller/Customer.php b/app/code/Magento/Review/Controller/Customer.php index f08728c7fc2..8fd98cb4f53 100644 --- a/app/code/Magento/Review/Controller/Customer.php +++ b/app/code/Magento/Review/Controller/Customer.php @@ -60,7 +60,7 @@ class Customer extends \Magento\App\Action\Action * Check customer authentication for some actions * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { @@ -73,7 +73,7 @@ class Customer extends \Magento\App\Action\Action public function indexAction() { $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Catalog\Model\Session'); + $this->_view->getLayout()->initMessages(); if ($navigationBlock = $this->_view->getLayout()->getBlock('customer_account_navigation')) { $navigationBlock->setActive('review/customer'); diff --git a/app/code/Magento/Review/Controller/Product.php b/app/code/Magento/Review/Controller/Product.php index a5063d50ff3..2b58a90907c 100644 --- a/app/code/Magento/Review/Controller/Product.php +++ b/app/code/Magento/Review/Controller/Product.php @@ -106,7 +106,7 @@ class Product extends \Magento\App\Action\Action * @param \Magento\Rating\Model\RatingFactory $ratingFactory * @param \Magento\Core\Model\Session $session * @param \Magento\Catalog\Model\Design $catalogDesign - * @param \Magento\Core\Model\Session\Generic $reviewSession + * @param \Magento\Session\Generic $reviewSession * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( @@ -120,7 +120,7 @@ class Product extends \Magento\App\Action\Action \Magento\Rating\Model\RatingFactory $ratingFactory, \Magento\Core\Model\Session $session, \Magento\Catalog\Model\Design $catalogDesign, - \Magento\Core\Model\Session\Generic $reviewSession, + \Magento\Session\Generic $reviewSession, \Magento\Core\Model\StoreManagerInterface $storeManager ) { $this->_storeManager = $storeManager; @@ -142,7 +142,7 @@ class Product extends \Magento\App\Action\Action * Dispatch request * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { @@ -295,19 +295,19 @@ class Product extends \Magento\App\Action\Action } $review->aggregate(); - $session->addSuccess(__('Your review has been accepted for moderation.')); + $this->messageManager->addSuccess(__('Your review has been accepted for moderation.')); } catch (\Exception $e) { $session->setFormData($data); - $session->addError(__('We cannot post the review.')); + $this->messageManager->addError(__('We cannot post the review.')); } } else { $session->setFormData($data); if (is_array($validate)) { foreach ($validate as $errorMessage) { - $session->addError($errorMessage); + $this->messageManager->addError($errorMessage); } } else { - $session->addError(__('We cannot post the review.')); + $this->messageManager->addError(__('We cannot post the review.')); } } } @@ -373,7 +373,7 @@ class Product extends \Magento\App\Action\Action } $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages(array('Magento\Review\Model\Session', 'Magento\Catalog\Model\Session')); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } diff --git a/app/code/Magento/Review/etc/adminhtml/di.xml b/app/code/Magento/Review/etc/adminhtml/di.xml index 73ff81b6889..e3e250fc10c 100644 --- a/app/code/Magento/Review/etc/adminhtml/di.xml +++ b/app/code/Magento/Review/etc/adminhtml/di.xml @@ -24,10 +24,15 @@ */ --> <config> - <virtualType name="Magento\Review\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\Review\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>review</value> </param> + </virtualType> + <virtualType name="Magento\Review\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\Review\Model\Session\Storage" /> + </param> <param name="sessionName"> <value>adminhtml</value> </param> diff --git a/app/code/Magento/Review/etc/adminhtml/menu.xml b/app/code/Magento/Review/etc/adminhtml/menu.xml index 4349ca5f651..c109c8ad623 100644 --- a/app/code/Magento/Review/etc/adminhtml/menu.xml +++ b/app/code/Magento/Review/etc/adminhtml/menu.xml @@ -27,8 +27,8 @@ --> <config> <menu> - <add id="Magento_Review::catalog_reviews_ratings_ratings" title="Rating" module="Magento_Review" sortOrder="60" parent="Magento_Adminhtml::stores_attributes" action="rating/index/" resource="Magento_Rating::ratings"/> - <add id="Magento_Review::catalog_reviews_ratings_reviews_all" title="Reviews" module="Magento_Review" parent="Magento_Adminhtml::marketing_user_content" sortOrder="10" action="catalog/product_review/" resource="Magento_Review::reviews_all"/> + <add id="Magento_Review::catalog_reviews_ratings_ratings" title="Rating" module="Magento_Review" sortOrder="60" parent="Magento_Backend::stores_attributes" action="rating/index/" resource="Magento_Rating::ratings"/> + <add id="Magento_Review::catalog_reviews_ratings_reviews_all" title="Reviews" module="Magento_Review" parent="Magento_Backend::marketing_user_content" sortOrder="10" action="catalog/product_review/" resource="Magento_Review::reviews_all"/> <add id="Magento_Review::report_review" title="Reviews" module="Magento_Reports" sortOrder="20" parent="Magento_Reports::report" resource="Magento_Reports::review"/> <add id="Magento_Review::report_review_customer" title="By Customers" sortOrder="10" module="Magento_Review" parent="Magento_Review::report_review" action="reports/report_review/customer" resource="Magento_Reports::review_customer"/> <add id="Magento_Review::report_review_product" title="By Products" sortOrder="20" module="Magento_Review" parent="Magento_Review::report_review" action="reports/report_review/product" resource="Magento_Reports::review_product"/> diff --git a/app/code/Magento/Review/etc/frontend/di.xml b/app/code/Magento/Review/etc/frontend/di.xml index 0ce38e26e0a..4414ca1c253 100644 --- a/app/code/Magento/Review/etc/frontend/di.xml +++ b/app/code/Magento/Review/etc/frontend/di.xml @@ -24,10 +24,15 @@ */ --> <config> - <virtualType name="Magento\Review\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\Review\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>review</value> </param> + </virtualType> + <virtualType name="Magento\Review\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\Review\Model\Session\Storage" /> + </param> <param name="sessionName"> <value>frontend</value> </param> diff --git a/app/code/Magento/Rss/App/Action/Plugin/Authentication.php b/app/code/Magento/Rss/App/Action/Plugin/Authentication.php index 9453c666631..c3a48b4d914 100644 --- a/app/code/Magento/Rss/App/Action/Plugin/Authentication.php +++ b/app/code/Magento/Rss/App/Action/Plugin/Authentication.php @@ -56,20 +56,20 @@ class Authentication extends \Magento\Backend\App\Action\Plugin\Authentication /** * @param \Magento\Backend\Model\Auth $auth - * @param \Magento\Backend\Model\Session $session * @param \Magento\Backend\Model\Url $url * @param \Magento\App\ResponseInterface $response * @param \Magento\App\ActionFlag $actionFlag + * @param \Magento\Message\ManagerInterface $messageManager * @param \Magento\HTTP\Authentication $httpAuthentication * @param \Magento\Logger $logger * @param \Magento\AuthorizationInterface $authorization */ public function __construct( \Magento\Backend\Model\Auth $auth, - \Magento\Backend\Model\Session $session, \Magento\Backend\Model\Url $url, \Magento\App\ResponseInterface $response, \Magento\App\ActionFlag $actionFlag, + \Magento\Message\ManagerInterface $messageManager, \Magento\HTTP\Authentication $httpAuthentication, \Magento\Logger $logger, \Magento\AuthorizationInterface $authorization @@ -77,7 +77,7 @@ class Authentication extends \Magento\Backend\App\Action\Plugin\Authentication $this->_httpAuthentication = $httpAuthentication; $this->_logger = $logger; $this->_authorization = $authorization; - parent::__construct($auth, $session, $url, $response, $actionFlag); + parent::__construct($auth, $url, $response, $actionFlag, $messageManager); } /** @@ -115,7 +115,7 @@ class Authentication extends \Magento\Backend\App\Action\Plugin\Authentication // Verify if logged in and authorized if (!$session->isLoggedIn() || !$this->_authorization->isAllowed($resource)) { $this->_httpAuthentication->setAuthenticationFailed('RSS Feeds'); - return null; + return $this->_response; } return parent::aroundDispatch($arguments, $invocationChain); diff --git a/app/code/Magento/Rss/Block/Catalog/Category.php b/app/code/Magento/Rss/Block/Catalog/Category.php index d57324b2843..364944966b0 100644 --- a/app/code/Magento/Rss/Block/Catalog/Category.php +++ b/app/code/Magento/Rss/Block/Catalog/Category.php @@ -56,6 +56,11 @@ class Category extends \Magento\Rss\Block\Catalog\AbstractCatalog */ protected $_collectionFactory; + /** + * @var \Magento\Catalog\Helper\Image + */ + protected $_imageHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession @@ -65,6 +70,7 @@ class Category extends \Magento\Rss\Block\Catalog\AbstractCatalog * @param \Magento\Rss\Model\RssFactory $rssFactory * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $collectionFactory + * @param \Magento\Catalog\Helper\Image $imageHelper * @param array $data */ public function __construct( @@ -76,8 +82,10 @@ class Category extends \Magento\Rss\Block\Catalog\AbstractCatalog \Magento\Rss\Model\RssFactory $rssFactory, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Resource\Product\CollectionFactory $collectionFactory, + \Magento\Catalog\Helper\Image $imageHelper, array $data = array() ) { + $this->_imageHelper = $imageHelper; $this->_catalogLayer = $catalogLayer; $this->_visibility = $visibility; $this->_rssFactory = $rssFactory; @@ -181,7 +189,7 @@ class Category extends \Magento\Rss\Block\Catalog\AbstractCatalog $description = '<table><tr>' . '<td><a href="'.$product->getProductUrl().'"><img src="' - . $this->helper('Magento\Catalog\Helper\Image')->init($product, 'thumbnail')->resize(75, 75) + . $this->_imageHelper->init($product, 'thumbnail')->resize(75, 75) . '" border="0" align="left" height="75" width="75"></a></td>' . '<td style="text-decoration:none;">' . $product->getDescription(); diff --git a/app/code/Magento/Rss/Block/Catalog/NewCatalog.php b/app/code/Magento/Rss/Block/Catalog/NewCatalog.php index 3b5fd823bc9..cc91d76dc58 100644 --- a/app/code/Magento/Rss/Block/Catalog/NewCatalog.php +++ b/app/code/Magento/Rss/Block/Catalog/NewCatalog.php @@ -51,6 +51,11 @@ class NewCatalog extends \Magento\Rss\Block\Catalog\AbstractCatalog */ protected $_resourceIterator; + /** + * @var \Magento\Catalog\Helper\Image + */ + protected $_imageHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession @@ -59,6 +64,7 @@ class NewCatalog extends \Magento\Rss\Block\Catalog\AbstractCatalog * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Product\Visibility $visibility * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Catalog\Helper\Image $imageHelper * @param array $data */ public function __construct( @@ -69,8 +75,10 @@ class NewCatalog extends \Magento\Rss\Block\Catalog\AbstractCatalog \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Product\Visibility $visibility, \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Catalog\Helper\Image $imageHelper, array $data = array() ) { + $this->_imageHelper = $imageHelper; $this->_rssFactory = $rssFactory; $this->_productFactory = $productFactory; $this->_visibility = $visibility; @@ -172,7 +180,7 @@ class NewCatalog extends \Magento\Rss\Block\Catalog\AbstractCatalog $product->setData($args['row']); $description = '<table><tr>' . '<td><a href="'.$product->getProductUrl().'"><img src="' - . $this->helper('Magento\Catalog\Helper\Image')->init($product, 'thumbnail')->resize(75, 75) + . $this->_imageHelper->init($product, 'thumbnail')->resize(75, 75) .'" border="0" align="left" height="75" width="75"></a></td>'. '<td style="text-decoration:none;">'.$product->getDescription(); diff --git a/app/code/Magento/Rss/Block/Catalog/Special.php b/app/code/Magento/Rss/Block/Catalog/Special.php index cf9c370a691..e48b2c3d9e1 100644 --- a/app/code/Magento/Rss/Block/Catalog/Special.php +++ b/app/code/Magento/Rss/Block/Catalog/Special.php @@ -58,14 +58,26 @@ class Special extends \Magento\Rss\Block\Catalog\AbstractCatalog */ protected $_coreData; + /** + * @var \Magento\Catalog\Helper\Image + */ + protected $_imageHelper; + + /** + * @var \Magento\Catalog\Helper\Output + */ + protected $_outputHelper; + /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Helper\Data $catalogData + * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Rss\Model\RssFactory $rssFactory * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Helper\Output $outputHelper * @param array $data */ public function __construct( @@ -76,8 +88,12 @@ class Special extends \Magento\Rss\Block\Catalog\AbstractCatalog \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Rss\Model\RssFactory $rssFactory, \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Helper\Output $outputHelper, array $data = array() ) { + $this->_outputHelper = $outputHelper; + $this->_imageHelper = $imageHelper; $this->_coreData = $coreData; $this->_productFactory = $productFactory; $this->_rssFactory = $rssFactory; @@ -149,8 +165,8 @@ class Special extends \Magento\Rss\Block\Catalog\AbstractCatalog <td><a href="%s"><img src="%s" alt="" border="0" align="left" height="75" width="75" /></a></td> <td style="text-decoration:none;">%s', $product->getProductUrl(), - $this->helper('Magento\Catalog\Helper\Image')->init($product, 'thumbnail')->resize(75, 75), - $this->helper('Magento\Catalog\Helper\Output')->productAttribute( + $this->_imageHelper->init($product, 'thumbnail')->resize(75, 75), + $this->_outputHelper->productAttribute( $product, $product->getDescription(), 'description' diff --git a/app/code/Magento/Rss/Block/Wishlist.php b/app/code/Magento/Rss/Block/Wishlist.php index 887a8144013..8aecc9f7373 100644 --- a/app/code/Magento/Rss/Block/Wishlist.php +++ b/app/code/Magento/Rss/Block/Wishlist.php @@ -69,21 +69,33 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock */ protected $_coreData; + /** + * @var \Magento\Catalog\Helper\Output + */ + protected $_outputHelper; + /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Catalog\Model\Config $catalogConfig * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom - * @param \Magento\Wishlist\Helper\Data $wishlistData + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\ProductFactory $productFactory + * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Wishlist\Model\WishlistFactory $wishlistFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Rss\Model\RssFactory $rssFactory + * @param \Magento\Catalog\Helper\Output $outputHelper * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -92,15 +104,21 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, - \Magento\Wishlist\Helper\Data $wishlistData, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Core\Helper\Data $coreData, \Magento\Wishlist\Model\WishlistFactory $wishlistFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Rss\Model\RssFactory $rssFactory, + \Magento\Catalog\Helper\Output $outputHelper, array $data = array() ) { + $this->_outputHelper = $outputHelper; $this->_coreData = $coreData; $this->_wishlistFactory = $wishlistFactory; $this->_customerFactory = $customerFactory; @@ -112,7 +130,11 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $taxData, $catalogData, $mathRandom, - $wishlistData, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, $customerSession, $productFactory, $data @@ -214,9 +236,9 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock } /** @var $outputHelper \Magento\Catalog\Helper\Output */ - $outputHelper = $this->helper('Magento\Catalog\Helper\Output'); + $outputHelper = $this->_outputHelper; $description = '<table><tr><td><a href="' . $productUrl . '"><img src="' - . $this->helper('Magento\Catalog\Helper\Image')->init($product, 'thumbnail')->resize(75, 75) + . $this->_imageHelper->init($product, 'thumbnail')->resize(75, 75) . '" border="0" align="left" height="75" width="75"></a></td>' . '<td style="text-decoration:none;">' . $outputHelper->productAttribute($product, $product->getShortDescription(), 'short_description') diff --git a/app/code/Magento/Sales/Block/Adminhtml/Billing/Agreement.php b/app/code/Magento/Sales/Block/Adminhtml/Billing/Agreement.php index 30caeee7a2c..ed0addc35d8 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Billing/Agreement.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Billing/Agreement.php @@ -31,7 +31,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Billing; -class Agreement extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Agreement extends \Magento\Backend\Block\Widget\Grid\Container { /** * Initialize billing agreements grid container diff --git a/app/code/Magento/Sales/Block/Adminhtml/Billing/Agreement/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Billing/Agreement/Grid.php index 40ec49d3627..f1a6e3af25b 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Billing/Agreement/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Billing/Agreement/Grid.php @@ -31,7 +31,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Billing\Agreement; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Payment data @@ -53,6 +53,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Sales\Model\Resource\Billing\Agreement\CollectionFactory $agreementFactory * @param \Magento\Sales\Model\Billing\Agreement $agreementModel @@ -61,6 +62,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Payment\Helper\Data $paymentData, \Magento\Sales\Model\Resource\Billing\Agreement\CollectionFactory $agreementFactory, \Magento\Sales\Model\Billing\Agreement $agreementModel, @@ -69,7 +71,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid $this->_paymentData = $paymentData; $this->_agreementFactory = $agreementFactory; $this->_agreementModel = $agreementModel; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** @@ -109,7 +111,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare collection for grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { @@ -123,7 +125,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * Add columns to grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Creditmemo.php b/app/code/Magento/Sales/Block/Adminhtml/Creditmemo.php index 46f75c7d50c..7b835e60112 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Creditmemo.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Creditmemo.php @@ -34,7 +34,7 @@ namespace Magento\Sales\Block\Adminhtml; -class Creditmemo extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Creditmemo extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Creditmemo/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Creditmemo/Grid.php index 03af0cb5de5..1b8368cf844 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Creditmemo/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Creditmemo/Grid.php @@ -31,7 +31,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Creditmemo; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * @var \Magento\Sales\Model\Resource\Order\Creditmemo\Grid\CollectionFactory @@ -46,6 +46,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Sales\Model\Order\CreditmemoFactory $creditmemoFactory * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Grid\CollectionFactory $collectionFactory * @param array $data @@ -53,13 +54,14 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Sales\Model\Order\CreditmemoFactory $creditmemoFactory, \Magento\Sales\Model\Resource\Order\Creditmemo\Grid\CollectionFactory $collectionFactory, array $data = array() ) { $this->_creditmemoFactory = $creditmemoFactory; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php b/app/code/Magento/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php index 0f350b4f5b0..0d7984e9f47 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php @@ -52,6 +52,7 @@ class Agreement /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Sales\Model\Resource\Billing\Agreement\CollectionFactory $agreementFactory * @param \Magento\Sales\Model\Billing\Agreement $agreementModel @@ -61,6 +62,7 @@ class Agreement public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Payment\Helper\Data $paymentData, \Magento\Sales\Model\Resource\Billing\Agreement\CollectionFactory $agreementFactory, \Magento\Sales\Model\Billing\Agreement $agreementModel, @@ -68,7 +70,15 @@ class Agreement array $data = array() ) { $this->_coreRegistry = $coreRegistry; - parent::__construct($context, $urlModel, $paymentData, $agreementFactory, $agreementModel, $data); + parent::__construct( + $context, + $urlModel, + $backendHelper, + $paymentData, + $agreementFactory, + $agreementModel, + $data + ); } /** @@ -148,13 +158,13 @@ class Agreement ->addFieldToFilter('customer_id', $this->_coreRegistry->registry('current_customer')->getId()) ->setOrder('created_at'); $this->setCollection($collection); - return \Magento\Adminhtml\Block\Widget\Grid::_prepareCollection(); + return \Magento\Backend\Block\Widget\Grid::_prepareCollection(); } /** * Remove some columns and make other not sortable * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Customer/Edit/Tab/Recurring/Profile.php b/app/code/Magento/Sales/Block/Adminhtml/Customer/Edit/Tab/Recurring/Profile.php index 8164162624f..d33260eb925 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Customer/Edit/Tab/Recurring/Profile.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Customer/Edit/Tab/Recurring/Profile.php @@ -45,6 +45,7 @@ class Profile /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Sales\Model\Resource\Recurring\Profile\CollectionFactory $profileCollection * @param \Magento\Sales\Model\Recurring\ProfileFactory $recurringProfile @@ -54,6 +55,7 @@ class Profile public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Payment\Helper\Data $paymentData, \Magento\Sales\Model\Resource\Recurring\Profile\CollectionFactory $profileCollection, \Magento\Sales\Model\Recurring\ProfileFactory $recurringProfile, @@ -61,7 +63,15 @@ class Profile array $data = array() ) { $this->_coreRegistry = $coreRegistry; - parent::__construct($context, $urlModel, $paymentData, $profileCollection, $recurringProfile, $data); + parent::__construct( + $context, + $urlModel, + $backendHelper, + $paymentData, + $profileCollection, + $recurringProfile, + $data + ); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Invoice.php b/app/code/Magento/Sales/Block/Adminhtml/Invoice.php index f62526dedeb..c8c19071662 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Invoice.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Invoice.php @@ -34,7 +34,7 @@ namespace Magento\Sales\Block\Adminhtml; -class Invoice extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Invoice extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Invoice/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Invoice/Grid.php index fbe748f877c..89fa8f38331 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Invoice/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Invoice/Grid.php @@ -31,7 +31,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Invoice; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * @var \Magento\Sales\Model\Resource\Order\Invoice\Grid\CollectionFactory @@ -46,6 +46,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Sales\Model\Order\InvoiceFactory $invoiceFactory * @param \Magento\Sales\Model\Resource\Order\Invoice\Grid\CollectionFactory $collectionFactory * @param array $data @@ -53,13 +54,14 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Sales\Model\Order\InvoiceFactory $invoiceFactory, \Magento\Sales\Model\Resource\Order\Invoice\Grid\CollectionFactory $collectionFactory, array $data = array() ) { $this->_invoiceFactory = $invoiceFactory; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order.php b/app/code/Magento/Sales/Block/Adminhtml/Order.php index a74a449f049..5c43df885e5 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml; -class Order extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Order extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php b/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php index d6b4aec3989..3ce7e23be12 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Order; -class AbstractOrder extends \Magento\Adminhtml\Block\Widget +class AbstractOrder extends \Magento\Backend\Block\Widget { /** * Core registry @@ -42,16 +42,24 @@ class AbstractOrder extends \Magento\Adminhtml\Block\Widget */ protected $_coreRegistry = null; + /** + * @var \Magento\Sales\Helper\Admin + */ + protected $_adminHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Sales\Helper\Admin $adminHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Sales\Helper\Admin $adminHelper, array $data = array() ) { + $this->_adminHelper = $adminHelper; $this->_coreRegistry = $registry; parent::__construct($context, $data); } @@ -86,12 +94,12 @@ class AbstractOrder extends \Magento\Adminhtml\Block\Widget public function displayPriceAttribute($code, $strong = false, $separator = '<br/>') { - return $this->helper('Magento\Sales\Helper\Admin')->displayPriceAttribute($this->getPriceDataObject(), $code, $strong, $separator); + return $this->_adminHelper->displayPriceAttribute($this->getPriceDataObject(), $code, $strong, $separator); } public function displayPrices($basePrice, $price, $strong = false, $separator = '<br/>') { - return $this->helper('Magento\Sales\Helper\Admin')->displayPrices($this->getPriceDataObject(), $basePrice, $price, $strong, $separator); + return $this->_adminHelper->displayPrices($this->getPriceDataObject(), $basePrice, $price, $strong, $separator); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Address.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Address.php index 706adfc282c..a4ce0194fe6 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Address.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Address.php @@ -29,7 +29,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Order; -class Address extends \Magento\Adminhtml\Block\Widget\Form\Container +class Address extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php index aaebd85de95..206274c2c4c 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php @@ -47,27 +47,31 @@ class Form /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Json\EncoderInterface $jsonEncoder - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Data\FormFactory $formFactory + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Customer\Model\AddressFactory $addressFactory * @param \Magento\Customer\Model\FormFactory $customerFormFactory - * @param \Magento\Adminhtml\Helper\Addresses $adminhtmlAddresses + * @param \Magento\Backend\Helper\Addresses $adminhtmlAddresses + * @param \Magento\Customer\Helper\Data $customerHelper * @param \Magento\Core\Model\Registry $registry * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Customer\Model\AddressFactory $addressFactory, \Magento\Customer\Model\FormFactory $customerFormFactory, - \Magento\Adminhtml\Helper\Addresses $adminhtmlAddresses, + \Magento\Backend\Helper\Addresses $adminhtmlAddresses, + \Magento\Customer\Helper\Data $customerHelper, \Magento\Core\Model\Registry $registry, array $data = array() ) { @@ -82,6 +86,7 @@ class Form $addressFactory, $customerFormFactory, $adminhtmlAddresses, + $customerHelper, $data ); } 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 ae17815db74..63908aa06c0 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php @@ -75,7 +75,7 @@ class View extends \Magento\Backend\Block\Template */ protected function _prepareLayout() { - $this->addChild('submit_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('submit_button', 'Magento\Backend\Block\Widget\Button', array( 'id' => 'submit_comment_button', 'label' => __('Submit Comment'), 'class' => 'save' diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create.php index 52d5e3ec879..9be874784a2 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create.php @@ -34,21 +34,21 @@ namespace Magento\Sales\Block\Adminhtml\Order; -class Create extends \Magento\Adminhtml\Block\Widget\Form\Container +class Create extends \Magento\Backend\Block\Widget\Form\Container { /** - * @var \Magento\Adminhtml\Model\Session\Quote + * @var \Magento\Backend\Model\Session\Quote */ protected $_sessionQuote; /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, array $data = array() ) { $this->_sessionQuote = $sessionQuote; @@ -134,7 +134,7 @@ class Create extends \Magento\Adminhtml\Block\Widget\Form\Container /** * Retrieve quote session object * - * @return \Magento\Adminhtml\Model\Session\Quote + * @return \Magento\Backend\Model\Session\Quote */ protected function _getSession() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/AbstractCreate.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/AbstractCreate.php index f48991437a4..3fad0aa6b35 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/AbstractCreate.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/AbstractCreate.php @@ -36,7 +36,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\Create; abstract class AbstractCreate extends \Magento\Backend\Block\Widget { /** - * @var \Magento\Adminhtml\Model\Session\Quote + * @var \Magento\Backend\Model\Session\Quote */ protected $_sessionQuote; @@ -47,7 +47,7 @@ abstract class AbstractCreate extends \Magento\Backend\Block\Widget public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, array $data = array() ) { @@ -69,7 +69,7 @@ abstract class AbstractCreate extends \Magento\Backend\Block\Widget /** * Retrieve quote session object * - * @return \Magento\Adminhtml\Model\Session\Quote + * @return \Magento\Backend\Model\Session\Quote */ protected function _getSession() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Billing/Method/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Billing/Method/Form.php index 80ad6bc6864..314346666f2 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Billing/Method/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Billing/Method/Form.php @@ -36,22 +36,24 @@ namespace Magento\Sales\Block\Adminhtml\Order\Create\Billing\Method; class Form extends \Magento\Payment\Block\Form\Container { /** - * @var \Magento\Adminhtml\Model\Session\Quote + * @var \Magento\Backend\Model\Session\Quote */ protected $_sessionQuote; /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Payment\Helper\Data $paymentHelper + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Payment\Helper\Data $paymentHelper, + \Magento\Backend\Model\Session\Quote $sessionQuote, array $data = array() ) { $this->_sessionQuote = $sessionQuote; - parent::__construct($context, $data); + parent::__construct($context, $paymentHelper, $data); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Customer.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Customer.php index bc9a4dfbb3e..20bab033c78 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Customer.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Customer.php @@ -55,7 +55,7 @@ class Customer extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreat 'onclick' => 'order.setCustomerId(false)', 'class' => 'primary', ); - return $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button')->setData($addButtonData)->toHtml(); + return $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button')->setData($addButtonData)->toHtml(); } } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Data.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Data.php index 78ed7447d76..2921f362525 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Data.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Data.php @@ -42,14 +42,14 @@ class Data extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Directory\Model\CurrencyFactory $currencyFactory, array $data = array() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form.php index 57792332ea2..c91cee01e86 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form.php @@ -49,14 +49,14 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Json\EncoderInterface $jsonEncoder - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Customer\Model\FormFactory $customerFormFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Customer\Model\FormFactory $customerFormFactory, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php index da0559ae19e..cdf72261808 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php @@ -51,14 +51,14 @@ abstract class AbstractForm /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Data\FormFactory $formFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Data\FormFactory $formFactory, array $data = array() @@ -79,19 +79,19 @@ abstract class AbstractForm \Magento\Data\Form::setElementRenderer( $this->getLayout()->createBlock( - 'Magento\Adminhtml\Block\Widget\Form\Renderer\Element', + 'Magento\Backend\Block\Widget\Form\Renderer\Element', $this->getNameInLayout() . '_element' ) ); \Magento\Data\Form::setFieldsetRenderer( $this->getLayout()->createBlock( - 'Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset', + 'Magento\Backend\Block\Widget\Form\Renderer\Fieldset', $this->getNameInLayout() . '_fieldset' ) ); \Magento\Data\Form::setFieldsetElementRenderer( $this->getLayout()->createBlock( - 'Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset\Element', + 'Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element', $this->getNameInLayout() . '_fieldset_element' ) ); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php index 297bd0b41c8..947fdaae503 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php @@ -45,7 +45,7 @@ class Account extends \Magento\Sales\Block\Adminhtml\Order\Create\Form\AbstractF /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory @@ -54,7 +54,7 @@ class Account extends \Magento\Sales\Block\Adminhtml\Order\Create\Form\AbstractF */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Data\FormFactory $formFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php index c3424d9777b..86daa04a2cb 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php @@ -46,7 +46,7 @@ class Address /** * Adminhtml addresses * - * @var \Magento\Adminhtml\Helper\Addresses + * @var \Magento\Backend\Helper\Addresses */ protected $_adminhtmlAddresses = null; @@ -70,30 +70,40 @@ class Address */ protected $_coreData; + /** + * @var \Magento\Customer\Helper\Data + */ + protected $_customerHelper; + /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Json\EncoderInterface $jsonEncoder - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Data\FormFactory $formFactory + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Customer\Model\AddressFactory $addressFactory * @param \Magento\Customer\Model\FormFactory $customerFormFactory - * @param \Magento\Adminhtml\Helper\Addresses $adminhtmlAddresses + * @param \Magento\Backend\Helper\Addresses $adminhtmlAddresses + * @param \Magento\Customer\Helper\Data $customerHelper * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Customer\Model\AddressFactory $addressFactory, \Magento\Customer\Model\FormFactory $customerFormFactory, - \Magento\Adminhtml\Helper\Addresses $adminhtmlAddresses, + \Magento\Backend\Helper\Addresses $adminhtmlAddresses, + \Magento\Customer\Helper\Data $customerHelper, array $data = array() ) { + $this->_customerHelper = $customerHelper; $this->_coreData = $coreData; $this->_jsonEncoder = $jsonEncoder; $this->_addressFactory = $addressFactory; @@ -188,7 +198,7 @@ class Address $prefixElement = $this->_form->getElement('prefix'); if ($prefixElement) { - $prefixOptions = $this->helper('Magento\Customer\Helper\Data')->getNamePrefixOptions($this->getStore()); + $prefixOptions = $this->_customerHelper->getNamePrefixOptions($this->getStore()); if (!empty($prefixOptions)) { $fieldset->removeField($prefixElement->getId()); $prefixField = $fieldset->addField($prefixElement->getId(), @@ -205,7 +215,7 @@ class Address $suffixElement = $this->_form->getElement('suffix'); if ($suffixElement) { - $suffixOptions = $this->helper('Magento\Customer\Helper\Data')->getNameSuffixOptions($this->getStore()); + $suffixOptions = $this->_customerHelper->getNameSuffixOptions($this->getStore()); if (!empty($suffixOptions)) { $fieldset->removeField($suffixElement->getId()); $suffixField = $fieldset->addField($suffixElement->getId(), diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage.php index da36b489464..82513be2628 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage.php @@ -41,20 +41,28 @@ class Giftmessage extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCr */ protected $_giftMessageSave; + /** + * @var \Magento\GiftMessage\Helper\Message + */ + protected $_messageHelper; + /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\GiftMessage\Model\Save $giftMessageSave + * @param \Magento\GiftMessage\Helper\Message $messageHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\GiftMessage\Model\Save $giftMessageSave, + \Magento\GiftMessage\Helper\Message $messageHelper, array $data = array() ) { + $this->_messageHelper = $messageHelper; $this->_giftMessageSave = $giftMessageSave; parent::__construct($context, $sessionQuote, $orderCreate, $data); } @@ -88,7 +96,7 @@ class Giftmessage extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCr foreach ($allItems as $item) { if($this->_getGiftmessageSaveModel()->getIsAllowedQuoteItem($item) - && $this->helper('Magento\GiftMessage\Helper\Message')->getIsMessagesAvailable('item', + && $this->_messageHelper->getIsMessagesAvailable('item', $item, $this->getStore())) { // if item allowed $items[] = $item; diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php index b5f56553bcf..b9abd394fd8 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php @@ -54,24 +54,32 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic protected $_giftMessage; /** - * @var \Magento\Adminhtml\Model\Session\Quote + * @var \Magento\Backend\Model\Session\Quote */ protected $_sessionQuote; + /** + * @var \Magento\GiftMessage\Helper\Message + */ + protected $_messageHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote + * @param \Magento\GiftMessage\Helper\Message $messageHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, + \Magento\GiftMessage\Helper\Message $messageHelper, array $data = array() ) { + $this->_messageHelper = $messageHelper; $this->_sessionQuote = $sessionQuote; parent::__construct($context, $registry, $formFactory, $data); } @@ -273,7 +281,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic */ protected function _initMessage() { - $this->_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage( + $this->_giftMessage = $this->_messageHelper->getGiftMessage( $this->getEntity()->getGiftMessageId() ); return $this; diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items.php index 82ccf3b85b1..c1c053b5d1f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items.php @@ -92,7 +92,7 @@ class Items extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate // Make buttons to be rendered in opposite order of addition. This makes "Add products" the last one. $this->_buttons = array_reverse($this->_buttons); foreach ($this->_buttons as $buttonData) { - $html .= $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button')->setData($buttonData)->toHtml(); + $html .= $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button')->setData($buttonData)->toHtml(); } return $html; diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items/Grid.php index b5617feb083..798695cbbe6 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items/Grid.php @@ -64,26 +64,34 @@ class Grid extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate */ protected $_taxConfig; + /** + * @var \Magento\GiftMessage\Helper\Message + */ + protected $_messageHelper; + /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Wishlist\Model\WishlistFactory $wishlistFactory * @param \Magento\GiftMessage\Model\Save $giftMessageSave * @param \Magento\Tax\Model\Config $taxConfig * @param \Magento\Tax\Helper\Data $taxData + * @param \Magento\GiftMessage\Helper\Message $messageHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Wishlist\Model\WishlistFactory $wishlistFactory, \Magento\GiftMessage\Model\Save $giftMessageSave, \Magento\Tax\Model\Config $taxConfig, \Magento\Tax\Helper\Data $taxData, + \Magento\GiftMessage\Helper\Message $messageHelper, array $data = array() ) { + $this->_messageHelper = $messageHelper; $this->_wishlistFactory = $wishlistFactory; $this->_giftMessageSave = $giftMessageSave; $this->_taxConfig = $taxConfig; @@ -158,12 +166,12 @@ class Grid extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate public function isGiftMessagesAvailable($item=null) { if(is_null($item)) { - return $this->helper('Magento\GiftMessage\Helper\Message')->getIsMessagesAvailable( + return $this->_messageHelper->getIsMessagesAvailable( 'items', $this->getQuote(), $this->getStore() ); } - return $this->helper('Magento\GiftMessage\Helper\Message')->getIsMessagesAvailable( + return $this->_messageHelper->getIsMessagesAvailable( 'item', $item, $this->getStore() ); } @@ -416,7 +424,7 @@ class Grid extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate $options['title'] = __('This product does not have any configurable options'); } - return $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + return $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData($options) ->toHtml(); } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Load.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Load.php index 821415d5d1d..5660d6a119a 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Load.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Load.php @@ -39,7 +39,7 @@ class Load extends \Magento\View\Element\Template /** * Adminhtml js * - * @var \Magento\Adminhtml\Helper\Js + * @var \Magento\Backend\Helper\Js */ protected $_adminhtmlJs = null; @@ -51,13 +51,13 @@ class Load extends \Magento\View\Element\Template /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Json\EncoderInterface $jsonEncoder - * @param \Magento\Adminhtml\Helper\Js $adminhtmlJs + * @param \Magento\Backend\Helper\Js $adminhtmlJs * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Json\EncoderInterface $jsonEncoder, - \Magento\Adminhtml\Helper\Js $adminhtmlJs, + \Magento\Backend\Helper\Js $adminhtmlJs, array $data = array() ) { $this->_jsonEncoder = $jsonEncoder; diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Messages.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Messages.php index bdc1b6e2ab4..be51d23ac59 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Messages.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Messages.php @@ -35,35 +35,12 @@ namespace Magento\Sales\Block\Adminhtml\Order\Create; class Messages extends \Magento\View\Element\Messages { - /** - * @var \Magento\Adminhtml\Model\Session\Quote - */ - protected $sessionQuote; - - /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Message\Factory $messageFactory - * @param \Magento\Message\CollectionFactory $collectionFactory - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote - * @param array $data - */ - public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Message\Factory $messageFactory, - \Magento\Message\CollectionFactory $collectionFactory, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, - array $data = array() - ) { - $this->sessionQuote = $sessionQuote; - parent::__construct($context, $messageFactory, $collectionFactory, $data); - } - /** * @return \Magento\View\Element\Messages */ protected function _prepareLayout() { - $this->addMessages($this->sessionQuote->getMessages(true)); + $this->addMessages($this->messageManager->getMessages(true)); parent::_prepareLayout(); } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Newsletter/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Newsletter/Form.php index 2ad7d58ebc8..3f3fe81b851 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Newsletter/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Newsletter/Form.php @@ -34,7 +34,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\Create\Newsletter; -class Form extends \Magento\Adminhtml\Block\Widget +class Form extends \Magento\Backend\Block\Widget { protected function _construct() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search.php index 9d97f76fee7..cea27199e15 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search.php @@ -55,7 +55,7 @@ class Search extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate 'onclick' => 'order.productGridAddSelected()', 'class' => 'action-add', ); - return $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button')->setData($addButtonData)->toHtml(); + return $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button')->setData($addButtonData)->toHtml(); } public function getHeaderCssClass() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php index fb5b4a81a89..e2841d32d2f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Order\Create\Search; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * @var \Magento\Sales\Model\Config @@ -41,7 +41,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid protected $_salesConfig; /** - * @var \Magento\Adminhtml\Model\Session\Quote + * @var \Magento\Backend\Model\Session\Quote */ protected $_sessionQuote; @@ -58,18 +58,20 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\Config $salesConfig * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\Config $salesConfig, array $data = array() ) { @@ -77,7 +79,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid $this->_catalogConfig = $catalogConfig; $this->_sessionQuote = $sessionQuote; $this->_salesConfig = $salesConfig; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() @@ -232,7 +234,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /* * Add custom options to product collection * - * return \Magento\Adminhtml\Block\Widget\Grid + * return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _afterLoadCollection() { $this->getCollection()->addOptionsToResult(); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Price.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Price.php index f90613e52c2..abf055a8db3 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Price.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Price.php @@ -34,7 +34,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid\Renderer; class Price extends - \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Price + \Magento\Backend\Block\Widget\Grid\Column\Renderer\Price { /** * Render minimal price for downloadable products diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Product.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Product.php index 862299255b2..4756323bbb3 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Product.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Product.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid\Renderer; -class Product extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Text +class Product extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text { /** * Render product name to add Configure link 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 4338c1fc568..2e72cdc0af7 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 @@ -34,7 +34,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid\Renderer; class Qty - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Input + extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Input { /** * Returns whether this qty field must be inactive diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Method/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Method/Form.php index 57b3c88c0fb..3c22b215fe9 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Method/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Method/Form.php @@ -47,14 +47,14 @@ class Form /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Tax\Helper\Data $taxData * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Tax\Helper\Data $taxData, array $data = array() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php index f8f69f60a0f..e000c08466f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php @@ -39,7 +39,7 @@ class Sidebar extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate protected function _prepareLayout() { if ($this->getCustomerId()) { - $button = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button')->setData(array( + $button = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button')->setData(array( 'label' => __('Update Changes'), 'onclick' => 'order.sidebarApplyChanges()', 'before_html' => '<div class="actions">', diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php index a7ccb1db8a5..e6a7a180468 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php @@ -49,14 +49,14 @@ class AbstractSidebar extends \Magento\Sales\Block\Adminhtml\Order\Create\Abstra /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Sales\Model\Config $salesConfig * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Sales\Model\Config $salesConfig, array $data = array() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Cart.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Cart.php index dbadf6ac65b..975709fa320 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Cart.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Cart.php @@ -107,7 +107,7 @@ class Cart protected function _prepareLayout() { $deleteAllConfirmString = __('Are you sure you want to delete all items from shopping cart?'); - $this->addChild('empty_customer_cart_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('empty_customer_cart_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Clear Shopping Cart'), 'onclick' => 'order.clearShoppingCart(\'' . $deleteAllConfirmString . '\')' )); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pcompared.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pcompared.php index 02f8fa6d81e..2198ec1fb09 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pcompared.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pcompared.php @@ -48,7 +48,7 @@ class Pcompared extends \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Abst /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Sales\Model\Config $salesConfig * @param \Magento\Reports\Model\Resource\Event $event @@ -57,7 +57,7 @@ class Pcompared extends \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Abst */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Sales\Model\Config $salesConfig, \Magento\Reports\Model\Resource\Event $event, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pviewed.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pviewed.php index 2e9c799a887..0d3d44b2681 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pviewed.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pviewed.php @@ -48,7 +48,7 @@ class Pviewed extends \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Abstra /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Sales\Model\Config $salesConfig * @param \Magento\Reports\Model\EventFactory $eventFactory @@ -57,7 +57,7 @@ class Pviewed extends \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Abstra */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Sales\Model\Config $salesConfig, \Magento\Reports\Model\EventFactory $eventFactory, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Reorder.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Reorder.php index 0a5ad6b5fbb..671a0496472 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Reorder.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Reorder.php @@ -49,7 +49,7 @@ class Reorder extends \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Abstra /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Sales\Model\Config $salesConfig * @param \Magento\Sales\Model\Resource\Order\CollectionFactory $ordersFactory @@ -57,7 +57,7 @@ class Reorder extends \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Abstra */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Sales\Model\Config $salesConfig, \Magento\Sales\Model\Resource\Order\CollectionFactory $ordersFactory, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php index 6df8ba4adde..8724b82110b 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php @@ -53,7 +53,7 @@ class Totals extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Sales\Helper\Data $salesData * @param \Magento\Sales\Model\Config $salesConfig @@ -61,7 +61,7 @@ class Totals extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Sales\Helper\Data $salesData, \Magento\Sales\Model\Config $salesConfig, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/DefaultTotals.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/DefaultTotals.php index dad7ff60978..86ca12d3a37 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/DefaultTotals.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/DefaultTotals.php @@ -39,7 +39,7 @@ class DefaultTotals extends \Magento\Sales\Block\Adminhtml\Order\Create\Totals /** * Retrieve quote session object * - * @return \Magento\Adminhtml\Model\Session\Quote + * @return \Magento\Backend\Model\Session\Quote */ protected function _getSession() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Discount.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Discount.php index 32ae4837088..3212c5cf2b2 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Discount.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Discount.php @@ -43,7 +43,7 @@ class Discount extends \Magento\Sales\Block\Adminhtml\Order\Create\Totals\Defaul /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Sales\Helper\Data $salesData * @param \Magento\Sales\Model\Config $salesConfig @@ -52,7 +52,7 @@ class Discount extends \Magento\Sales\Block\Adminhtml\Order\Create\Totals\Defaul */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Sales\Helper\Data $salesData, \Magento\Sales\Model\Config $salesConfig, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Grandtotal.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Grandtotal.php index 1bafa6eb255..43f0baf62b7 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Grandtotal.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Grandtotal.php @@ -43,7 +43,7 @@ class Grandtotal extends \Magento\Sales\Block\Adminhtml\Order\Create\Totals\Defa /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Sales\Helper\Data $salesData * @param \Magento\Sales\Model\Config $salesConfig @@ -52,7 +52,7 @@ class Grandtotal extends \Magento\Sales\Block\Adminhtml\Order\Create\Totals\Defa */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Sales\Helper\Data $salesData, \Magento\Sales\Model\Config $salesConfig, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Shipping.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Shipping.php index 7fdc7fe6499..123b4e33bde 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Shipping.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Shipping.php @@ -44,7 +44,7 @@ class Shipping /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Sales\Helper\Data $salesData * @param \Magento\Sales\Model\Config $salesConfig @@ -53,7 +53,7 @@ class Shipping */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Sales\Helper\Data $salesData, \Magento\Sales\Model\Config $salesConfig, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Subtotal.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Subtotal.php index 49f5d41ea81..3cc6b7fe340 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Subtotal.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Subtotal.php @@ -43,7 +43,7 @@ class Subtotal extends \Magento\Sales\Block\Adminhtml\Order\Create\Totals\Defaul /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Sales\Helper\Data $salesData * @param \Magento\Sales\Model\Config $salesConfig @@ -52,7 +52,7 @@ class Subtotal extends \Magento\Sales\Block\Adminhtml\Order\Create\Totals\Defaul */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Sales\Helper\Data $salesData, \Magento\Sales\Model\Config $salesConfig, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create.php index 4851388c9c4..10911e494ed 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create.php @@ -30,7 +30,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\Creditmemo; -class Create extends \Magento\Adminhtml\Block\Widget\Form\Container +class Create extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Items.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Items.php index afe51a21f55..52a3ba026f5 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Items.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Items.php @@ -66,7 +66,7 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems protected function _prepareLayout() { $onclick = "submitAndReloadArea($('creditmemo_item_container'),'".$this->getUpdateUrl()."')"; - $this->addChild('update_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('update_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Update Qty\'s'), 'class' => 'update-button', 'onclick' => $onclick, @@ -74,20 +74,20 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems if ($this->getCreditmemo()->canRefund()) { if ($this->getCreditmemo()->getInvoice() && $this->getCreditmemo()->getInvoice()->getTransactionId()) { - $this->addChild('submit_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('submit_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Refund'), 'class' => 'save submit-button refund', 'onclick' => 'disableElements(\'submit-button\');submitCreditMemo()', )); } - $this->addChild('submit_offline', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('submit_offline', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Refund Offline'), 'class' => 'save submit-button', 'onclick' => 'disableElements(\'submit-button\');submitCreditMemoOffline()', )); } else { - $this->addChild('submit_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('submit_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Refund Offline'), 'class' => 'save submit-button', 'onclick' => 'disableElements(\'submit-button\');submitCreditMemoOffline()', diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php index ddd8f385f0a..b15203860fd 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Order\Creditmemo; -class View extends \Magento\Adminhtml\Block\Widget\Form\Container +class View extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry @@ -218,7 +218,7 @@ class View extends \Magento\Adminhtml\Block\Widget\Form\Container /** * Update 'back' button url * - * @return \Magento\Adminhtml\Block\Widget\Container | \Magento\Sales\Block\Adminhtml\Order\Creditmemo\View + * @return \Magento\Backend\Block\Widget\Container | \Magento\Sales\Block\Adminhtml\Order\Creditmemo\View */ public function updateBackButtonUrl($flag) { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create.php index 2de1206afbe..6934339167f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create.php @@ -30,7 +30,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\Invoice; -class Create extends \Magento\Adminhtml\Block\Widget\Form\Container +class Create extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Items.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Items.php index f8cfd8708a9..a1de047a7bf 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Items.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Items.php @@ -66,7 +66,7 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems protected function _beforeToHtml() { $onclick = "submitAndReloadArea($('invoice_item_container'),'".$this->getUpdateUrl()."')"; - $this->addChild('update_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('update_button', 'Magento\Backend\Block\Widget\Button', array( 'class' => 'update-button', 'label' => __('Update Qty\'s'), 'onclick' => $onclick, @@ -88,7 +88,7 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems } else { $_submitLabel = __('Submit Invoice'); } - $this->addChild('submit_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('submit_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => $_submitLabel, 'class' => 'save submit-button' . $_submitButtonClass, 'onclick' => 'disableElements(\'submit-button\');$(\'edit_form\').submit()', 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 index 73cabe06b8f..aa30e1157a9 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Tracking.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Tracking.php @@ -76,7 +76,7 @@ class Tracking extends \Magento\Backend\Block\Template */ protected function _prepareLayout() { - $this->addChild('add_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('add_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add Tracking Number'), 'class' => '', 'onclick' => 'trackingControl.add()' diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php index ab240c338f1..ce12853d84c 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Order\Invoice; -class View extends \Magento\Adminhtml\Block\Widget\Form\Container +class View extends \Magento\Backend\Block\Widget\Form\Container { /** * Admin session diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create.php index 7b13d540eb1..6af2502640a 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create.php @@ -30,7 +30,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\Shipment; -class Create extends \Magento\Adminhtml\Block\Widget\Form\Container +class Create extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Items.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Items.php index a0ef8beecc6..7dda7b3abcc 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Items.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Items.php @@ -91,7 +91,7 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems */ protected function _beforeToHtml() { - $this->addChild('submit_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('submit_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Submit Shipment'), 'class' => 'save submit-button', 'onclick' => 'submitShipment(this);', diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Tracking.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Tracking.php index d1ec8fc1fc6..656f1df610c 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Tracking.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Tracking.php @@ -71,7 +71,7 @@ class Tracking extends \Magento\Backend\Block\Template */ protected function _prepareLayout() { - $this->addChild('add_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('add_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add Tracking Number'), 'class' => '', 'onclick' => 'trackingControl.add()' diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Packaging.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Packaging.php index b48e3ff021c..00028ca4848 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Packaging.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Packaging.php @@ -310,7 +310,7 @@ class Packaging extends \Magento\Backend\Block\Template $data['shipment_id'] = $this->getShipment()->getId(); $url = $this->getUrl('sales/order_shipment/printPackage', $data); return $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Widget\Button') + ->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => __('Print'), 'onclick' => 'setLocation(\'' . $url . '\')' diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View.php index 07e95dbfe1b..cc31e5555f3 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Order\Shipment; -class View extends \Magento\Adminhtml\Block\Widget\Form\Container +class View extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Form.php index 0d78d792a06..f0d552bfee8 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Form.php @@ -75,7 +75,7 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder $data['shipment_id'] = $this->getShipment()->getId(); $url = $this->getUrl('sales/order_shipment/createLabel', $data); return $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Widget\Button') + ->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => __('Create Shipping Label...'), 'onclick' => 'packaging.showWindow();', @@ -93,7 +93,7 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder $data['shipment_id'] = $this->getShipment()->getId(); $url = $this->getUrl('sales/order_shipment/printLabel', $data); return $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Widget\Button') + ->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => __('Print Shipping Label'), 'onclick' => 'setLocation(\'' . $url . '\')' @@ -109,7 +109,7 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder public function getShowPackagesButton() { return $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Widget\Button') + ->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => __('Show Packages'), 'onclick' => 'showPackedWindow();' diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Tracking.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Tracking.php index fd691ec74e0..4dcc8d2dd54 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Tracking.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Tracking.php @@ -72,7 +72,7 @@ class Tracking extends \Magento\Backend\Block\Template protected function _prepareLayout() { $onclick = "submitAndReloadArea($('shipment_tracking_info').parentNode, '".$this->getSubmitUrl()."')"; - $this->addChild('save_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add'), 'class' => 'save', 'onclick' => $onclick diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign.php index 7a9d1770ffd..7ac0bd969e0 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign.php @@ -26,7 +26,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\Status; -class Assign extends \Magento\Adminhtml\Block\Widget\Form\Container +class Assign extends \Magento\Backend\Block\Widget\Form\Container { protected function _construct() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php index 24b78e5bd74..8226ba4aad9 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php @@ -71,7 +71,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Prepare form fields * - * @return \Magento\Adminhtml\Block\Widget\Form + * @return \Magento\Backend\Block\Widget\Form */ protected function _prepareForm() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Edit/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Edit/Form.php index f2a18669192..babb03542fa 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Edit/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Edit/Form.php @@ -40,7 +40,7 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\Status\NewStatus\Form /** * Modify structure of new status form * - * @return \Magento\Adminhtml\Block\Widget\Form + * @return \Magento\Backend\Block\Widget\Form */ protected function _prepareForm() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus.php index 68c2545f524..8d011a64868 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus.php @@ -26,7 +26,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\Status; -class NewStatus extends \Magento\Adminhtml\Block\Widget\Form\Container +class NewStatus extends \Magento\Backend\Block\Widget\Form\Container { protected function _construct() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus/Form.php index c6b71e5ac12..f8fda6e9b3c 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus/Form.php @@ -40,7 +40,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Prepare form fields and structure * - * @return \Magento\Adminhtml\Block\Widget\Form + * @return \Magento\Backend\Block\Widget\Form */ protected function _prepareForm() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Item.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Item.php index 891888757cf..0ca368d451d 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Item.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Item.php @@ -77,7 +77,7 @@ class Item extends \Magento\Sales\Block\Adminhtml\Order\Totals */ public function displayPrices($baseAmount, $amount) { - return $this->helper('Magento\Sales\Helper\Admin')->displayPrices($this->getOrder(), $baseAmount, $amount); + return $this->_adminHelper->displayPrices($this->getOrder(), $baseAmount, $amount); } /** @@ -90,7 +90,7 @@ class Item extends \Magento\Sales\Block\Adminhtml\Order\Totals */ public function displayPriceAttribute($code, $strong = false, $separator = '<br/>') { - return $this->helper('Magento\Sales\Helper\Admin')->displayPriceAttribute($this->getSource(), $code, $strong, $separator); + return $this->_adminHelper->displayPriceAttribute($this->getSource(), $code, $strong, $separator); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php index ad6128801ff..9eba8b1dd86 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php @@ -50,12 +50,18 @@ class Tax extends \Magento\Tax\Block\Sales\Order\Tax */ protected $_taxOrderFactory; + /** + * @var \Magento\Sales\Helper\Admin + */ + protected $_salesAdminHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Tax\Model\Config $taxConfig * @param \Magento\Tax\Helper\Data $taxHelper * @param \Magento\Tax\Model\Calculation $taxCalculation * @param \Magento\Tax\Model\Sales\Order\TaxFactory $taxOrderFactory + * @param \Magento\Sales\Helper\Admin $salesAdminHelper * @param array $data */ public function __construct( @@ -64,11 +70,13 @@ class Tax extends \Magento\Tax\Block\Sales\Order\Tax \Magento\Tax\Helper\Data $taxHelper, \Magento\Tax\Model\Calculation $taxCalculation, \Magento\Tax\Model\Sales\Order\TaxFactory $taxOrderFactory, + \Magento\Sales\Helper\Admin $salesAdminHelper, array $data = array() ) { $this->_taxHelper = $taxHelper; $this->_taxCalculation = $taxCalculation; $this->_taxOrderFactory = $taxOrderFactory; + $this->_salesAdminHelper = $salesAdminHelper; parent::__construct($context, $taxConfig, $data); } @@ -103,7 +111,7 @@ class Tax extends \Magento\Tax\Block\Sales\Order\Tax */ public function displayAmount($amount, $baseAmount) { - return $this->_helperFactory->get('Magento\Sales\Helper\Admin')->displayPrices( + return $this->_salesAdminHelper->displayPrices( $this->getSource(), $baseAmount, $amount, false, '<br />' ); } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php index ffaa79576fd..f3cfabcd449 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php @@ -52,18 +52,26 @@ class View extends \Magento\Backend\Block\Widget\Form\Container */ protected $_salesConfig; + /** + * @var \Magento\Sales\Helper\Reorder + */ + protected $_reorderHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Sales\Model\Config $salesConfig + * @param \Magento\Sales\Helper\Reorder $reorderHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Sales\Model\Config $salesConfig, + \Magento\Sales\Helper\Reorder $reorderHelper, array $data = array() ) { + $this->_reorderHelper = $reorderHelper; $this->_coreRegistry = $registry; $this->_salesConfig = $salesConfig; parent::__construct($context, $data); @@ -203,7 +211,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container } if ($this->_isAllowedAction('Magento_Sales::reorder') - && $this->helper('Magento\Sales\Helper\Reorder')->isAllowed($order->getStore()) + && $this->_reorderHelper->isAllowed($order->getStore()) && $order->canReorderIgnoreSalable() ) { $this->_addButton('order_reorder', array( diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Giftmessage.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Giftmessage.php index 1581fe3a9b8..4476d6cd561 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Giftmessage.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Giftmessage.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Order\View; -class Giftmessage extends \Magento\Adminhtml\Block\Widget +class Giftmessage extends \Magento\Backend\Block\Widget { /** * Entity for editing of gift message @@ -54,18 +54,26 @@ class Giftmessage extends \Magento\Adminhtml\Block\Widget */ protected $_messageFactory; + /** + * @var \Magento\GiftMessage\Helper\Message + */ + protected $_messageHelper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\GiftMessage\Model\MessageFactory $messageFactory * @param \Magento\Core\Model\Registry $registry + * @param \Magento\GiftMessage\Helper\Message $messageHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\GiftMessage\Model\MessageFactory $messageFactory, \Magento\Core\Model\Registry $registry, + \Magento\GiftMessage\Helper\Message $messageHelper, array $data = array() ) { + $this->_messageHelper = $messageHelper; $this->_coreRegistry = $registry; $this->_messageFactory = $messageFactory; parent::__construct($context, $data); @@ -103,7 +111,7 @@ class Giftmessage extends \Magento\Adminhtml\Block\Widget */ protected function _prepareLayout() { - $this->addChild('save_button', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save Gift Message'), 'class' => 'save' )); @@ -236,7 +244,7 @@ class Giftmessage extends \Magento\Adminhtml\Block\Widget */ protected function _initMessage() { - $this->_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage( + $this->_giftMessage = $this->_messageHelper->getGiftMessage( $this->getEntity()->getGiftMessageId() ); @@ -293,7 +301,7 @@ class Giftmessage extends \Magento\Adminhtml\Block\Widget */ public function canDisplayGiftmessage() { - return $this->helper('Magento\GiftMessage\Helper\Message')->getIsMessagesAvailable( + return $this->_messageHelper->getIsMessagesAvailable( 'order', $this->getEntity(), $this->getEntity()->getStoreId() ); } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php index c004bd4914b..423f120f75d 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php @@ -69,7 +69,7 @@ class History extends \Magento\Backend\Block\Template protected function _prepareLayout() { $onclick = "submitAndReloadArea($('order_history_block').parentNode, '".$this->getSubmitUrl()."')"; - $button = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $button = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => __('Submit Comment'), 'class' => 'save', diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php index c33c7583e3e..316d2b85248 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php @@ -58,6 +58,7 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Sales\Helper\Admin $adminHelper * @param \Magento\Customer\Model\GroupFactory $groupFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Eav\Model\Config $eavConfig @@ -67,6 +68,7 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Sales\Helper\Admin $adminHelper, \Magento\Customer\Model\GroupFactory $groupFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Eav\Model\Config $eavConfig, @@ -77,7 +79,7 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder $this->_groupFactory = $groupFactory; $this->_eavConfig = $eavConfig; $this->_attrDataFactory = $attrDataFactory; - parent::__construct($context, $registry, $data); + parent::__construct($context, $registry, $adminHelper, $data); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php index 4dc20ededf3..35f4c6fe73e 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items/Renderer/DefaultRenderer.php @@ -35,6 +35,37 @@ namespace Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer; class DefaultRenderer extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems { + /** + * @var \Magento\GiftMessage\Helper\Message + */ + protected $_messageHelper; + + /** + * @var \Magento\Checkout\Helper\Data + */ + protected $_checkoutHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Catalog\Model\ProductFactory $productFactory + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\GiftMessage\Helper\Message $messageHelper + * @param \Magento\Checkout\Helper\Data $checkoutHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Catalog\Model\ProductFactory $productFactory, + \Magento\Core\Model\Registry $registry, + \Magento\GiftMessage\Helper\Message $messageHelper, + \Magento\Checkout\Helper\Data $checkoutHelper, + array $data = array() + ) { + $this->_checkoutHelper = $checkoutHelper; + $this->_messageHelper = $messageHelper; + parent::__construct($context, $productFactory, $registry, $data); + } + public function getItem() { return $this->_getData('item'); @@ -143,7 +174,7 @@ class DefaultRenderer extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems protected function _initMessage() { $this->_giftMessage[$this->getItem()->getGiftMessageId()] = - $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($this->getItem()->getGiftMessageId()); + $this->_messageHelper->getGiftMessage($this->getItem()->getGiftMessageId()); // init default values for giftmessage form if(!$this->getMessage()->getSender()) { @@ -201,7 +232,7 @@ class DefaultRenderer extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems */ public function canDisplayGiftmessage() { - return $this->helper('Magento\GiftMessage\Helper\Message')->getIsMessagesAvailable( + return $this->_messageHelper->getIsMessagesAvailable( 'order_item', $this->getItem(), $this->getItem()->getOrder()->getStoreId() ); } @@ -215,8 +246,8 @@ class DefaultRenderer extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems public function displaySubtotalInclTax($item) { return $this->displayPrices( - $this->helper('Magento\Checkout\Helper\Data')->getBaseSubtotalInclTax($item), - $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($item) + $this->_checkoutHelper->getBaseSubtotalInclTax($item), + $this->_checkoutHelper->getSubtotalInclTax($item) ); } @@ -229,8 +260,8 @@ class DefaultRenderer extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems public function displayPriceInclTax(\Magento\Object $item) { return $this->displayPrices( - $this->helper('Magento\Checkout\Helper\Data')->getBasePriceInclTax($item), - $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($item) + $this->_checkoutHelper->getBasePriceInclTax($item), + $this->_checkoutHelper->getPriceInclTax($item) ); } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Messages.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Messages.php index d3bd3078a7e..9fd1e5aead5 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Messages.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Messages.php @@ -46,6 +46,7 @@ class Messages extends \Magento\View\Element\Messages * @param \Magento\View\Element\Template\Context $context * @param \Magento\Message\Factory $messageFactory * @param \Magento\Message\CollectionFactory $collectionFactory + * @param \Magento\Message\ManagerInterface $messageManager * @param \Magento\Core\Model\Registry $registry * @param array $data */ @@ -53,11 +54,12 @@ class Messages extends \Magento\View\Element\Messages \Magento\View\Element\Template\Context $context, \Magento\Message\Factory $messageFactory, \Magento\Message\CollectionFactory $collectionFactory, + \Magento\Message\ManagerInterface $messageManager, \Magento\Core\Model\Registry $registry, array $data = array() ) { $this->coreRegistry = $registry; - parent::__construct($context, $messageFactory, $collectionFactory, $data); + parent::__construct($context, $messageFactory, $collectionFactory, $messageManager, $data); } protected function _getOrder() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Creditmemos.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Creditmemos.php index f4fc1cb4fc6..f6070a0dff8 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Creditmemos.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Creditmemos.php @@ -34,8 +34,8 @@ namespace Magento\Sales\Block\Adminhtml\Order\View\Tab; class Creditmemos - extends \Magento\Adminhtml\Block\Widget\Grid - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + extends \Magento\Backend\Block\Widget\Grid\Extended + implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** * Core registry @@ -57,6 +57,7 @@ class Creditmemos /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory * @param \Magento\Sales\Model\Order\Creditmemo $orderCreditmemo * @param \Magento\Core\Model\Registry $coreRegistry @@ -65,6 +66,7 @@ class Creditmemos public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory, \Magento\Sales\Model\Order\Creditmemo $orderCreditmemo, \Magento\Core\Model\Registry $coreRegistry, @@ -73,7 +75,7 @@ class Creditmemos $this->_coreRegistry = $coreRegistry; $this->_orderCreditmemo = $orderCreditmemo; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php index 00456af4385..3e61eac589c 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php @@ -35,7 +35,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\View\Tab; class History extends \Magento\Backend\Block\Template - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + implements \Magento\Backend\Block\Widget\Tab\TabInterface { protected $_template = 'order/view/tab/history.phtml'; diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Info.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Info.php index cc5b656cd6c..6a7e1d8cdd7 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Info.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Info.php @@ -35,7 +35,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\View\Tab; class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** * Retrieve order model instance diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Invoices.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Invoices.php index f63d7ccda8f..0fa74be09c6 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Invoices.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Invoices.php @@ -34,8 +34,8 @@ namespace Magento\Sales\Block\Adminhtml\Order\View\Tab; class Invoices - extends \Magento\Adminhtml\Block\Widget\Grid - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + extends \Magento\Backend\Block\Widget\Grid\Extended + implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** * Core registry @@ -57,6 +57,7 @@ class Invoices /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory * @param \Magento\Sales\Model\Order\Invoice $orderInvoice * @param \Magento\Core\Model\Registry $coreRegistry @@ -65,6 +66,7 @@ class Invoices public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory, \Magento\Sales\Model\Order\Invoice $orderInvoice, \Magento\Core\Model\Registry $coreRegistry, @@ -73,7 +75,7 @@ class Invoices $this->_coreRegistry = $coreRegistry; $this->_orderInvoice = $orderInvoice; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() 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 9f92736c5b6..85ac68353b6 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 @@ -30,8 +30,8 @@ namespace Magento\Sales\Block\Adminhtml\Order\View\Tab; class Shipments - extends \Magento\Adminhtml\Block\Widget\Grid - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + extends \Magento\Backend\Block\Widget\Grid\Extended + implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** * Core registry @@ -48,6 +48,7 @@ class Shipments /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data @@ -55,13 +56,14 @@ class Shipments public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory, \Magento\Core\Model\Registry $coreRegistry, array $data = array() ) { $this->_coreRegistry = $coreRegistry; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Transactions.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Transactions.php index 85a6c3aebdb..757b861924a 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Transactions.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Transactions.php @@ -35,7 +35,7 @@ namespace Magento\Sales\Block\Adminhtml\Order\View\Tab; class Transactions extends \Magento\Sales\Block\Adminhtml\Transactions\Grid - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile.php b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile.php index afdaf137af1..9f6bac8b6bd 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile.php @@ -29,7 +29,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Recurring; -class Profile extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Profile extends \Magento\Backend\Block\Widget\Grid\Container { /** * Instructions to create child grid diff --git a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Edit/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Edit/Form.php index a26592467b2..71a4edee4de 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Edit/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Edit/Form.php @@ -134,7 +134,7 @@ class Form extends \Magento\Backend\Block\AbstractBlock $form = $this->_formFactory->create(); $form->setFieldsetRenderer( - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Form\Renderer\Fieldset') ); $form->setFieldsetElementRenderer( $this->getLayout()->createBlock('Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset\Element') diff --git a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Grid.php index 2b13b96b8c0..04f3c69b899 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Grid.php @@ -29,7 +29,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Recurring\Profile; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Set ajax/session parameters @@ -54,6 +54,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Sales\Model\Resource\Recurring\Profile\CollectionFactory $profileCollection * @param \Magento\Sales\Model\Recurring\ProfileFactory $recurringProfile @@ -62,6 +63,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Payment\Helper\Data $paymentData, \Magento\Sales\Model\Resource\Recurring\Profile\CollectionFactory $profileCollection, \Magento\Sales\Model\Recurring\ProfileFactory $recurringProfile, @@ -70,7 +72,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid $this->_paymentData = $paymentData; $this->_profileCollection = $profileCollection; $this->_recurringProfile = $recurringProfile; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() @@ -184,6 +186,6 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid */ public function getGridUrl() { - return $this->getUrl('adminhtml/*/grid', array('_current'=>true)); + return $this->getUrl('sales/*/grid', array('_current'=>true)); } } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Getawayinfo.php b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Getawayinfo.php index 943b27b41c2..ffc136f185a 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Getawayinfo.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Getawayinfo.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Recurring\Profile\View; -class Getawayinfo extends \Magento\Adminhtml\Block\Widget +class Getawayinfo extends \Magento\Backend\Block\Widget { /** * Core registry diff --git a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Info.php b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Info.php index f8d6f57547f..2745a0670af 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Info.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Info.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Recurring\Profile\View; -class Info extends \Magento\Adminhtml\Block\Widget +class Info extends \Magento\Backend\Block\Widget { /** * Core registry diff --git a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Info.php b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Info.php index 6b2ac2ce0f6..97f51dcae41 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Info.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Info.php @@ -30,8 +30,8 @@ namespace Magento\Sales\Block\Adminhtml\Recurring\Profile\View\Tab; class Info - extends \Magento\Adminhtml\Block\Widget - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + extends \Magento\Backend\Block\Widget + implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** * Label getter 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 f5a1e885b59..1c6908d5954 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 @@ -30,8 +30,8 @@ namespace Magento\Sales\Block\Adminhtml\Recurring\Profile\View\Tab; class Orders - extends \Magento\Adminhtml\Block\Widget\Grid - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + extends \Magento\Backend\Block\Widget\Grid\Extended + implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** * Core registry @@ -53,6 +53,7 @@ class Orders /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory $orderCollection * @param \Magento\Sales\Model\Order\ConfigFactory $orderConfig @@ -61,6 +62,7 @@ class Orders public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Core\Model\Registry $coreRegistry, \Magento\Sales\Model\Resource\Order\Grid\CollectionFactory $orderCollection, \Magento\Sales\Model\Order\ConfigFactory $orderConfig, @@ -69,7 +71,7 @@ class Orders $this->_coreRegistry = $coreRegistry; $this->_orderCollection = $orderCollection; $this->_orderConfig = $orderConfig; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form.php index 25566efa7b1..02ae2e36927 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form.php @@ -104,7 +104,7 @@ class Form extends \Magento\Reports\Block\Adminhtml\Filter\Form if ($this->getFieldVisibility('show_order_statuses') && $this->getFieldVisibility('order_statuses')) { $this->setChild( 'form_after', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Form\Element\Dependence') + $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Form\Element\Dependence') ->addFieldMap("{$htmlIdPrefix}show_order_statuses", 'show_order_statuses') ->addFieldMap("{$htmlIdPrefix}order_statuses", 'order_statuses') ->addFieldDependence('order_statuses', 'show_order_statuses', '1') diff --git a/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php b/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php index 904bb13c41c..a6c5363fa59 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php @@ -131,8 +131,8 @@ class Coupon extends \Magento\Sales\Block\Adminhtml\Report\Filter\Form * form creates appropriate child block and uses this alias. In this case we can't use the same alias * without core logic changes, that's why the code below was moved inside method '_afterToHtml'. */ - /** @var $formAfterBlock \Magento\Adminhtml\Block\Widget\Form\Element\Dependence */ - $formAfterBlock = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Form\Element\Dependence', + /** @var $formAfterBlock \Magento\Backend\Block\Widget\Form\Element\Dependence */ + $formAfterBlock = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Form\Element\Dependence', 'adminhtml.block.widget.form.element.dependence' ); $formAfterBlock->addFieldMap($htmlIdPrefix . 'price_rule_type', 'price_rule_type') diff --git a/app/code/Magento/Sales/Block/Adminhtml/Shipment.php b/app/code/Magento/Sales/Block/Adminhtml/Shipment.php index 28c1071b41f..8e8f4b01dc9 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Shipment.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Shipment.php @@ -34,7 +34,7 @@ namespace Magento\Sales\Block\Adminhtml; -class Shipment extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Shipment extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Shipment/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Shipment/Grid.php index ed0ff1d8235..aff0a6d855b 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Shipment/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Shipment/Grid.php @@ -31,7 +31,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Shipment; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * @var \Magento\Sales\Model\Resource\Order\Collection\Factory @@ -41,17 +41,19 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Sales\Model\Resource\Order\Collection\Factory $collectionFactory, array $data = array() ) { $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } @@ -79,7 +81,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare and set collection of grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { @@ -91,7 +93,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare and add columns to grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { @@ -217,7 +219,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid */ public function getGridUrl() { - return $this->getUrl('adminhtml/*/*', array('_current' => true)); + return $this->getUrl('sales/*/*', array('_current' => true)); } } diff --git a/app/code/Magento/Sales/Block/Adminhtml/System/Config/Form/Fieldset/Order/Statuses.php b/app/code/Magento/Sales/Block/Adminhtml/System/Config/Form/Fieldset/Order/Statuses.php index e777967f854..44116f2a543 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/System/Config/Form/Fieldset/Order/Statuses.php +++ b/app/code/Magento/Sales/Block/Adminhtml/System/Config/Form/Fieldset/Order/Statuses.php @@ -52,17 +52,19 @@ class Statuses /** * @param \Magento\Backend\Block\Context $context * @param \Magento\Backend\Model\Auth\Session $authSession + * @param \Magento\Core\Helper\Js $jsHelper * @param \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $orderStatusCollection * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, \Magento\Backend\Model\Auth\Session $authSession, + \Magento\Core\Helper\Js $jsHelper, \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $orderStatusCollection, array $data = array() ) { $this->_orderStatusCollection = $orderStatusCollection; - parent::__construct($context, $authSession, $data); + parent::__construct($context, $authSession, $jsHelper, $data); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Totals.php b/app/code/Magento/Sales/Block/Adminhtml/Totals.php index 243843b899b..70043b3c960 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Totals.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Totals.php @@ -28,6 +28,27 @@ namespace Magento\Sales\Block\Adminhtml; class Totals extends \Magento\Sales\Block\Order\Totals { + /** + * @var \Magento\Sales\Helper\Admin + */ + protected $_adminHelper; + + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Sales\Helper\Admin $adminHelper + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Sales\Helper\Admin $adminHelper, + array $data = array() + ) { + $this->_adminHelper = $adminHelper; + parent::__construct($context, $registry, $data); + } + /** * Format total value based on order currency * @@ -37,7 +58,7 @@ class Totals extends \Magento\Sales\Block\Order\Totals public function formatValue($total) { if (!$total->getIsFormated()) { - return $this->helper('Magento\Sales\Helper\Admin')->displayPrices( + return $this->_adminHelper->displayPrices( $this->getOrder(), $total->getBaseValue(), $total->getValue() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Transactions.php b/app/code/Magento/Sales/Block/Adminhtml/Transactions.php index a5c92e49b09..881140b3af8 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Transactions.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Transactions.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml; -class Transactions extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Transactions extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Child/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Child/Grid.php index 9b08ac239c8..3013d06c75d 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Child/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Child/Grid.php @@ -58,7 +58,7 @@ class Grid extends \Magento\Sales\Block\Adminhtml\Transactions\Grid /** * Add filter by parent transaction ID * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php index 1948bef9a68..d98f46ae22f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Transactions; -class Detail extends \Magento\Adminhtml\Block\Widget\Container +class Detail extends \Magento\Backend\Block\Widget\Container { /** * Transaction model diff --git a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail/Grid.php index 2f8f3a62c48..95aac024078 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail/Grid.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Transactions\Detail; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Core registry @@ -50,6 +50,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Data\CollectionFactory $collectionFactory * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data @@ -57,13 +58,14 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Data\CollectionFactory $collectionFactory, \Magento\Core\Model\Registry $coreRegistry, array $data = array() ) { $this->_collectionFactory = $collectionFactory; $this->_coreRegistry = $coreRegistry; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** @@ -79,7 +81,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare collection for grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { @@ -96,7 +98,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * Add columns to grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Grid.php index bb3fd2b16fe..d27a993d159 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Grid.php @@ -33,7 +33,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Transactions; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Core registry @@ -62,6 +62,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Sales\Model\Order\Payment\Transaction $transaction * @param \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $collectionFactory * @param \Magento\Payment\Helper\Data $paymentData @@ -71,6 +72,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Sales\Model\Order\Payment\Transaction $transaction, \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $collectionFactory, \Magento\Payment\Helper\Data $paymentData, @@ -81,7 +83,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid $this->_paymentData = $paymentData; $this->_transaction = $transaction; $this->_collectionFactory = $collectionFactory; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** @@ -101,7 +103,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare collection for grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { @@ -122,7 +124,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * Add columns to grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/Sales/Block/Billing/Agreement/View.php b/app/code/Magento/Sales/Block/Billing/Agreement/View.php index ec41ea64a89..01a20ead1b0 100644 --- a/app/code/Magento/Sales/Block/Billing/Agreement/View.php +++ b/app/code/Magento/Sales/Block/Billing/Agreement/View.php @@ -76,12 +76,18 @@ class View extends \Magento\View\Element\Template */ protected $_orderConfig; + /** + * @var \Magento\Payment\Helper\Data + */ + protected $_paymentHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Sales\Model\Resource\Order\CollectionFactory $orderCollectionFactory * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Sales\Model\Order\Config $orderConfig + * @param \Magento\Payment\Helper\Data $paymentHelper * @param array $data */ public function __construct( @@ -90,8 +96,10 @@ class View extends \Magento\View\Element\Template \Magento\Sales\Model\Resource\Order\CollectionFactory $orderCollectionFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Sales\Model\Order\Config $orderConfig, + \Magento\Payment\Helper\Data $paymentHelper, array $data = array() ) { + $this->_paymentHelper = $paymentHelper; $this->_orderCollectionFactory = $orderCollectionFactory; $this->_customerSession = $customerSession; $this->_orderConfig = $orderConfig; @@ -186,7 +194,7 @@ class View extends \Magento\View\Element\Template protected function _loadPaymentMethods() { if (!$this->_paymentMethods) { - foreach ($this->helper('Magento\Payment\Helper\Data')->getBillingAgreementMethods() as $paymentMethod) { + foreach ($this->_paymentHelper->getBillingAgreementMethods() as $paymentMethod) { $this->_paymentMethods[$paymentMethod->getCode()] = $paymentMethod->getTitle(); } } diff --git a/app/code/Magento/Sales/Block/Billing/Agreements.php b/app/code/Magento/Sales/Block/Billing/Agreements.php index 532070565c7..09ed7366585 100644 --- a/app/code/Magento/Sales/Block/Billing/Agreements.php +++ b/app/code/Magento/Sales/Block/Billing/Agreements.php @@ -57,18 +57,26 @@ class Agreements extends \Magento\View\Element\Template */ protected $_agreementCollection; + /** + * @var \Magento\Payment\Helper\Data + */ + protected $_paymentHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Sales\Model\Resource\Billing\Agreement\CollectionFactory $agreementCollection + * @param \Magento\Payment\Helper\Data $paymentHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Sales\Model\Resource\Billing\Agreement\CollectionFactory $agreementCollection, + \Magento\Payment\Helper\Data $paymentHelper, array $data = array() ) { + $this->_paymentHelper = $paymentHelper; $this->_customerSession = $customerSession; $this->_agreementCollection = $agreementCollection; parent::__construct($context, $data); @@ -146,7 +154,7 @@ class Agreements extends \Magento\View\Element\Template protected function _loadPaymentMethods() { if (!$this->_paymentMethods) { - foreach ($this->helper('Magento\Payment\Helper\Data')->getBillingAgreementMethods() as $paymentMethod) { + foreach ($this->_paymentHelper->getBillingAgreementMethods() as $paymentMethod) { $this->_paymentMethods[$paymentMethod->getCode()] = $paymentMethod->getTitle(); } } @@ -161,7 +169,7 @@ class Agreements extends \Magento\View\Element\Template public function getWizardPaymentMethodOptions() { $paymentMethodOptions = array(); - foreach ($this->helper('Magento\Payment\Helper\Data')->getBillingAgreementMethods() as $paymentMethod) { + foreach ($this->_paymentHelper->getBillingAgreementMethods() as $paymentMethod) { if ($paymentMethod->getConfigData('allow_billing_agreement_wizard') == 1) { $paymentMethodOptions[$paymentMethod->getCode()] = $paymentMethod->getTitle(); } diff --git a/app/code/Magento/Sales/Block/Order/Creditmemo.php b/app/code/Magento/Sales/Block/Order/Creditmemo.php index 2d845a588d1..5a3bfa8a297 100644 --- a/app/code/Magento/Sales/Block/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Block/Order/Creditmemo.php @@ -45,18 +45,26 @@ class Creditmemo extends \Magento\Sales\Block\Order\Creditmemo\Items */ protected $_customerSession; + /** + * @var \Magento\Payment\Helper\Data + */ + protected $_paymentHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Payment\Helper\Data $paymentHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Customer\Model\Session $customerSession, + \Magento\Payment\Helper\Data $paymentHelper, array $data = array() ) { + $this->_paymentHelper = $paymentHelper; $this->_customerSession = $customerSession; parent::__construct($context, $registry, $data); } @@ -69,7 +77,7 @@ class Creditmemo extends \Magento\Sales\Block\Order\Creditmemo\Items } $this->setChild( 'payment_info', - $this->helper('Magento\Payment\Helper\Data')->getInfoBlock($this->getOrder()->getPayment()) + $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment()) ); } diff --git a/app/code/Magento/Sales/Block/Order/Info.php b/app/code/Magento/Sales/Block/Order/Info.php index d8c4f81d718..75560578e13 100644 --- a/app/code/Magento/Sales/Block/Order/Info.php +++ b/app/code/Magento/Sales/Block/Order/Info.php @@ -45,16 +45,24 @@ class Info extends \Magento\View\Element\Template */ protected $_coreRegistry = null; + /** + * @var \Magento\Payment\Helper\Data + */ + protected $_paymentHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Payment\Helper\Data $paymentHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Payment\Helper\Data $paymentHelper, array $data = array() ) { + $this->_paymentHelper = $paymentHelper; $this->_coreRegistry = $registry; parent::__construct($context, $data); } @@ -66,7 +74,7 @@ class Info extends \Magento\View\Element\Template } $this->setChild( 'payment_info', - $this->helper('Magento\Payment\Helper\Data')->getInfoBlock($this->getOrder()->getPayment()) + $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment()) ); } diff --git a/app/code/Magento/Sales/Block/Order/Invoice.php b/app/code/Magento/Sales/Block/Order/Invoice.php index 882d5bc9ab1..7252d4b59ef 100644 --- a/app/code/Magento/Sales/Block/Order/Invoice.php +++ b/app/code/Magento/Sales/Block/Order/Invoice.php @@ -41,18 +41,26 @@ class Invoice extends \Magento\Sales\Block\Order\Invoice\Items */ protected $_customerSession; + /** + * @var \Magento\Payment\Helper\Data + */ + protected $_paymentHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Payment\Helper\Data $paymentHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Customer\Model\Session $customerSession, + \Magento\Payment\Helper\Data $paymentHelper, array $data = array() ) { + $this->_paymentHelper = $paymentHelper; $this->_customerSession = $customerSession; parent::__construct($context, $registry, $data); } @@ -65,7 +73,7 @@ class Invoice extends \Magento\Sales\Block\Order\Invoice\Items } $this->setChild( 'payment_info', - $this->helper('Magento\Payment\Helper\Data')->getInfoBlock($this->getOrder()->getPayment()) + $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment()) ); } diff --git a/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php b/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php index c089df81227..35d53d042fd 100644 --- a/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php +++ b/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php @@ -38,16 +38,24 @@ class Creditmemo extends \Magento\Sales\Block\Items\AbstractItems */ protected $_coreRegistry = null; + /** + * @var \Magento\Payment\Helper\Data + */ + protected $_paymentHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Payment\Helper\Data $paymentHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Payment\Helper\Data $paymentHelper, array $data = array() ) { + $this->_paymentHelper = $paymentHelper; $this->_coreRegistry = $registry; parent::__construct($context, $data); } @@ -59,7 +67,7 @@ class Creditmemo extends \Magento\Sales\Block\Items\AbstractItems } $this->setChild( 'payment_info', - $this->helper('Magento\Payment\Helper\Data')->getInfoBlock($this->getOrder()->getPayment()) + $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment()) ); } diff --git a/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php b/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php index 4acaa71941b..195a59bb87f 100644 --- a/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php +++ b/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php @@ -38,16 +38,24 @@ class Invoice extends \Magento\Sales\Block\Items\AbstractItems */ protected $_coreRegistry = null; + /** + * @var \Magento\Payment\Helper\Data + */ + protected $_paymentHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Payment\Helper\Data $paymentHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Payment\Helper\Data $paymentHelper, array $data = array() ) { + $this->_paymentHelper = $paymentHelper; $this->_coreRegistry = $registry; parent::__construct($context, $data); } @@ -60,7 +68,7 @@ class Invoice extends \Magento\Sales\Block\Items\AbstractItems } $this->setChild( 'payment_info', - $this->helper('Magento\Payment\Helper\Data')->getInfoBlock($this->getOrder()->getPayment()) + $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment()) ); } diff --git a/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php b/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php index e6dcf8935b1..84a3df97d2c 100644 --- a/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php +++ b/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php @@ -52,16 +52,24 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems */ protected $_coreRegistry = null; + /** + * @var \Magento\Payment\Helper\Data + */ + protected $_paymentHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Payment\Helper\Data $paymentHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Payment\Helper\Data $paymentHelper, array $data = array() ) { + $this->_paymentHelper = $paymentHelper; $this->_coreRegistry = $registry; parent::__construct($context, $data); } @@ -98,7 +106,7 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems } $this->setChild( 'payment_info', - $this->helper('Magento\Payment\Helper\Data')->getInfoBlock($this->getOrder()->getPayment()) + $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment()) ); } diff --git a/app/code/Magento/Sales/Block/Order/PrintShipment.php b/app/code/Magento/Sales/Block/Order/PrintShipment.php index 6427c52a36a..33619b28516 100644 --- a/app/code/Magento/Sales/Block/Order/PrintShipment.php +++ b/app/code/Magento/Sales/Block/Order/PrintShipment.php @@ -42,16 +42,24 @@ class PrintShipment extends \Magento\Sales\Block\Items\AbstractItems */ protected $_coreRegistry = null; + /** + * @var \Magento\Payment\Helper\Data + */ + protected $_paymentHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Payment\Helper\Data $paymentHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Payment\Helper\Data $paymentHelper, array $data = array() ) { + $this->_paymentHelper = $paymentHelper; $this->_coreRegistry = $registry; parent::__construct($context, $data); } @@ -63,7 +71,7 @@ class PrintShipment extends \Magento\Sales\Block\Items\AbstractItems } $this->setChild( 'payment_info', - $this->helper('Magento\Payment\Helper\Data')->getInfoBlock($this->getOrder()->getPayment()) + $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment()) ); } diff --git a/app/code/Magento/Sales/Block/Order/Shipment.php b/app/code/Magento/Sales/Block/Order/Shipment.php index 38a4abfcc84..6d63f4245c0 100644 --- a/app/code/Magento/Sales/Block/Order/Shipment.php +++ b/app/code/Magento/Sales/Block/Order/Shipment.php @@ -48,18 +48,26 @@ class Shipment extends \Magento\View\Element\Template */ protected $_customerSession; + /** + * @var \Magento\Payment\Helper\Data + */ + protected $_paymentHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Payment\Helper\Data $paymentHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Customer\Model\Session $customerSession, + \Magento\Payment\Helper\Data $paymentHelper, array $data = array() ) { + $this->_paymentHelper = $paymentHelper; $this->_coreRegistry = $registry; $this->_customerSession = $customerSession; parent::__construct($context, $data); @@ -73,7 +81,7 @@ class Shipment extends \Magento\View\Element\Template } $this->setChild( 'payment_info', - $this->helper('Magento\Payment\Helper\Data')->getInfoBlock($this->getOrder()->getPayment()) + $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment()) ); } diff --git a/app/code/Magento/Sales/Block/Order/View.php b/app/code/Magento/Sales/Block/Order/View.php index fae90cb3304..33cc0faa926 100644 --- a/app/code/Magento/Sales/Block/Order/View.php +++ b/app/code/Magento/Sales/Block/Order/View.php @@ -48,18 +48,26 @@ class View extends \Magento\View\Element\Template */ protected $_customerSession; + /** + * @var \Magento\Payment\Helper\Data + */ + protected $_paymentHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Payment\Helper\Data $paymentHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Customer\Model\Session $customerSession, + \Magento\Payment\Helper\Data $paymentHelper, array $data = array() ) { + $this->_paymentHelper = $paymentHelper; $this->_coreRegistry = $registry; $this->_customerSession = $customerSession; parent::__construct($context, $data); @@ -73,7 +81,7 @@ class View extends \Magento\View\Element\Template } $this->setChild( 'payment_info', - $this->helper('Magento\Payment\Helper\Data')->getInfoBlock($this->getOrder()->getPayment()) + $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment()) ); } 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 d73454dff02..c7e5ff1d054 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 @@ -40,11 +40,17 @@ class Grid extends \Magento\Sales\Block\Recurring\Profile\View */ protected $_config; + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Sales\Model\Resource\Order\Collection $collection * @param \Magento\Sales\Model\Order\Config $config + * @param \Magento\Core\Helper\Data $coreHelper * @param array $data */ public function __construct( @@ -52,8 +58,10 @@ class Grid extends \Magento\Sales\Block\Recurring\Profile\View \Magento\Core\Model\Registry $registry, \Magento\Sales\Model\Resource\Order\Collection $collection, \Magento\Sales\Model\Order\Config $config, + \Magento\Core\Helper\Data $coreHelper, array $data = array() ) { + $this->_coreHelper = $coreHelper; parent::__construct($context, $registry, $data); $this->_orderCollection = $collection; $this->_config = $config; @@ -132,7 +140,7 @@ class Grid extends \Magento\Sales\Block\Recurring\Profile\View 'increment_id' => $order->getIncrementId(), 'created_at' => $this->formatDate($order->getCreatedAt()), 'customer_name' => $order->getCustomerName(), - 'base_grand_total' => $this->helper('Magento\Core\Helper\Data')->formatCurrency( + 'base_grand_total' => $this->_coreHelper->formatCurrency( $order->getBaseGrandTotal(), false ), 'status' => $order->getStatusLabel(), diff --git a/app/code/Magento/Sales/Block/Recurring/Profile/View/Fees.php b/app/code/Magento/Sales/Block/Recurring/Profile/View/Fees.php index 7a909f43f7a..2d81ed1eae4 100644 --- a/app/code/Magento/Sales/Block/Recurring/Profile/View/Fees.php +++ b/app/code/Magento/Sales/Block/Recurring/Profile/View/Fees.php @@ -31,6 +31,27 @@ namespace Magento\Sales\Block\Recurring\Profile\View; */ class Fees extends \Magento\Sales\Block\Recurring\Profile\View { + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Core\Helper\Data $coreHelper + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Core\Helper\Data $coreHelper, + array $data = array() + ) { + $this->_coreHelper = $coreHelper; + parent::__construct($context, $registry, $data); + } + /** * Prepare fees info * @@ -51,7 +72,7 @@ class Fees extends \Magento\Sales\Block\Recurring\Profile\View if ($value) { $this->_addInfo(array( 'label' => $this->_profile->getFieldLabel($key), - 'value' => $this->helper('Magento\Core\Helper\Data')->formatCurrency($value, false), + 'value' => $this->_coreHelper->formatCurrency($value, false), 'is_amount' => true, )); } diff --git a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php index 4303fb167b2..28ebbaab2c8 100644 --- a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php +++ b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php @@ -63,7 +63,7 @@ class State extends \Magento\Backend\Block\Widget\Grid\Column * * @param string $value * @param \Magento\Sales\Model\Order\Status $row - * @param \Magento\Adminhtml\Block\Widget\Grid\Column $column + * @param \Magento\Backend\Block\Widget\Grid\Column $column * @param bool $isExport * @return string */ diff --git a/app/code/Magento/Sales/Block/Status/Grid/Column/Unassign.php b/app/code/Magento/Sales/Block/Status/Grid/Column/Unassign.php index 72fd1c15f10..52566af457b 100644 --- a/app/code/Magento/Sales/Block/Status/Grid/Column/Unassign.php +++ b/app/code/Magento/Sales/Block/Status/Grid/Column/Unassign.php @@ -43,7 +43,7 @@ class Unassign extends \Magento\Backend\Block\Widget\Grid\Column * * @param string $value * @param \Magento\Sales\Model\Order\Status $row - * @param \Magento\Adminhtml\Block\Widget\Grid\Column $column + * @param \Magento\Backend\Block\Widget\Grid\Column $column * @param bool $isExport * @return string */ diff --git a/app/code/Magento/Sales/Controller/AbstractController.php b/app/code/Magento/Sales/Controller/AbstractController.php index 7dcfd917fa9..6b718ad3dfd 100644 --- a/app/code/Magento/Sales/Controller/AbstractController.php +++ b/app/code/Magento/Sales/Controller/AbstractController.php @@ -78,7 +78,7 @@ abstract class AbstractController extends \Magento\App\Action\Action } $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Catalog\Model\Session'); + $this->_view->getLayout()->initMessages(); $navigationBlock = $this->_view->getLayout()->getBlock('customer_account_navigation'); if ($navigationBlock) { @@ -162,17 +162,15 @@ abstract class AbstractController extends \Magento\App\Action\Action foreach ($items as $item) { try { $cart->addOrderItem($item); - } catch (\Magento\Core\Exception $e){ + } catch (\Magento\Core\Exception $e) { if ($this->_objectManager->get('Magento\Checkout\Model\Session')->getUseNotice(true)) { - $this->_objectManager->get('Magento\Checkout\Model\Session')->addNotice($e->getMessage()); + $this->messageManager->addNotice($e->getMessage()); } else { - $this->_objectManager->get('Magento\Checkout\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } $this->_redirect('*/*/history'); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Checkout\Model\Session')->addException($e, - __('We cannot add this item to your shopping cart.') - ); + $this->messageManager->addException($e, __('We cannot add this item to your shopping cart.')); $this->_redirect('checkout/cart'); } } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Billing/Agreement.php b/app/code/Magento/Sales/Controller/Adminhtml/Billing/Agreement.php index 2d59a3cc159..d36b16bd4dd 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Billing/Agreement.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Billing/Agreement.php @@ -128,13 +128,13 @@ class Agreement extends \Magento\Backend\App\Action if ($agreementModel && $agreementModel->canCancel()) { try { $agreementModel->cancel(); - $this->_getSession()->addSuccess(__('You canceled the billing agreement.')); + $this->messageManager->addSuccess(__('You canceled the billing agreement.')); $this->_redirect('sales/*/view', array('_current' => true)); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We could not cancel the billing agreement.')); + $this->messageManager->addError(__('We could not cancel the billing agreement.')); $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/*/view', array('_current' => true)); @@ -152,13 +152,13 @@ class Agreement extends \Magento\Backend\App\Action if ($agreementModel) { try { $agreementModel->delete(); - $this->_getSession()->addSuccess(__('You deleted the billing agreement.')); + $this->messageManager->addSuccess(__('You deleted the billing agreement.')); $this->_redirect('sales/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We could not delete the billing agreement.')); + $this->messageManager->addError(__('We could not delete the billing agreement.')); $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/*/view', array('_current' => true)); @@ -177,7 +177,7 @@ class Agreement extends \Magento\Backend\App\Action $agreementModel = $this->_objectManager->create('Magento\Sales\Model\Billing\Agreement')->load($agreementId); if (!$agreementModel->getId()) { - $this->_getSession()->addError(__('Please specify the correct billing agreement ID and try again.')); + $this->messageManager->addError(__('Please specify the correct billing agreement ID and try again.')); return false; } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo.php b/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo.php index f8d5310a097..e3ae86c9ec2 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo.php @@ -104,7 +104,7 @@ class AbstractCreditmemo extends \Magento\Backend\App\Action $historyItem->save(); } - $this->_getSession()->addSuccess(__('We sent the message.')); + $this->messageManager->addSuccess(__('We sent the message.')); $this->_redirect('sales/order_creditmemo/view', array( 'creditmemo_id' => $creditmemoId )); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice.php b/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice.php index 65ddd74d129..064599404b7 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice.php @@ -113,7 +113,7 @@ class AbstractInvoice $historyItem->setIsCustomerNotified(1); $historyItem->save(); } - $this->_getSession()->addSuccess(__('We sent the message.')); + $this->messageManager->addSuccess(__('We sent the message.')); $this->_redirect('sales/invoice/view', array( 'order_id' => $invoice->getOrder()->getId(), 'invoice_id'=> $invoiceId, diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order.php b/app/code/Magento/Sales/Controller/Adminhtml/Order.php index 185ee1ac0d1..b85cbd7a113 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order.php @@ -103,7 +103,7 @@ class Order extends \Magento\Backend\App\Action $order = $this->_objectManager->create('Magento\Sales\Model\Order')->load($id); if (!$order->getId()) { - $this->_getSession()->addError(__('This order no longer exists.')); + $this->messageManager->addError(__('This order no longer exists.')); $this->_redirect('sales/*/'); $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); return false; @@ -162,11 +162,11 @@ class Order extends \Magento\Backend\App\Action $historyItem->setIsCustomerNotified(1); $historyItem->save(); } - $this->_getSession()->addSuccess(__('You sent the order email.')); + $this->messageManager->addSuccess(__('You sent the order email.')); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We couldn\'t send the email order.')); + $this->messageManager->addError(__('We couldn\'t send the email order.')); $this->_objectManager->get('Magento\Logger')->logException($e); } } @@ -183,13 +183,13 @@ class Order extends \Magento\Backend\App\Action try { $order->cancel() ->save(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('You canceled the order.') ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('You have not canceled the item.')); + $this->messageManager->addError(__('You have not canceled the item.')); $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/order/view', array('order_id' => $order->getId())); @@ -206,13 +206,13 @@ class Order extends \Magento\Backend\App\Action try { $order->hold() ->save(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('You put the order on hold.') ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('You have not put the order on hold.')); + $this->messageManager->addError(__('You have not put the order on hold.')); } $this->_redirect('sales/order/view', array('order_id' => $order->getId())); } @@ -228,13 +228,13 @@ class Order extends \Magento\Backend\App\Action try { $order->unhold() ->save(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('You released the order from holding status.') ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('The order was not on hold.')); + $this->messageManager->addError(__('The order was not on hold.')); } $this->_redirect('sales/order/view', array('order_id' => $order->getId())); } @@ -271,11 +271,11 @@ class Order extends \Magento\Backend\App\Action throw new \Exception(sprintf('Action "%s" is not supported.', $action)); } $order->save(); - $this->_getSession()->addSuccess($message); + $this->messageManager->addSuccess($message); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We couldn\'t update the payment.')); + $this->messageManager->addError(__('We couldn\'t update the payment.')); $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/order/view', array('order_id' => $order->getId())); @@ -395,13 +395,13 @@ class Order extends \Magento\Backend\App\Action } if ($countNonCancelOrder) { if ($countCancelOrder) { - $this->_getSession()->addError(__('%1 order(s) cannot be canceled.', $countNonCancelOrder)); + $this->messageManager->addError(__('%1 order(s) cannot be canceled.', $countNonCancelOrder)); } else { - $this->_getSession()->addError(__('You cannot cancel the order(s).')); + $this->messageManager->addError(__('You cannot cancel the order(s).')); } } if ($countCancelOrder) { - $this->_getSession()->addSuccess(__('We canceled %1 order(s).', $countCancelOrder)); + $this->messageManager->addSuccess(__('We canceled %1 order(s).', $countCancelOrder)); } $this->_redirect('sales/*/'); } @@ -427,13 +427,13 @@ class Order extends \Magento\Backend\App\Action if ($countNonHoldOrder) { if ($countHoldOrder) { - $this->_getSession()->addError(__('%1 order(s) were not put on hold.', $countNonHoldOrder)); + $this->messageManager->addError(__('%1 order(s) were not put on hold.', $countNonHoldOrder)); } else { - $this->_getSession()->addError(__('No order(s) were put on hold.')); + $this->messageManager->addError(__('No order(s) were put on hold.')); } } if ($countHoldOrder) { - $this->_getSession()->addSuccess(__('You have put %1 order(s) on hold.', $countHoldOrder)); + $this->messageManager->addSuccess(__('You have put %1 order(s) on hold.', $countHoldOrder)); } $this->_redirect('sales/*/'); @@ -460,15 +460,15 @@ class Order extends \Magento\Backend\App\Action } if ($countNonUnHoldOrder) { if ($countUnHoldOrder) { - $this->_getSession()->addError( + $this->messageManager->addError( __('%1 order(s) were not released from on hold status.', $countNonUnHoldOrder) ); } else { - $this->_getSession()->addError(__('No order(s) were released from on hold status.')); + $this->messageManager->addError(__('No order(s) were released from on hold status.')); } } if ($countUnHoldOrder) { - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('%1 order(s) have been released from on hold status.', $countUnHoldOrder) ); } @@ -488,8 +488,7 @@ class Order extends \Magento\Backend\App\Action */ public function massPrintAction() { - $orderIds = $this->getRequest()->getPost('order_ids'); - $document = $this->getRequest()->getPost('document'); + } /** @@ -521,7 +520,7 @@ class Order extends \Magento\Backend\App\Action 'application/pdf' ); } else { - $this->_getSession()->addError( + $this->messageManager->addError( __('There are no printable documents related to selected orders.') ); $this->_redirect('sales/*/'); @@ -559,7 +558,7 @@ class Order extends \Magento\Backend\App\Action 'application/pdf' ); } else { - $this->_getSession()->addError( + $this->messageManager->addError( __('There are no printable documents related to selected orders.') ); $this->_redirect('sales/*/'); @@ -597,7 +596,7 @@ class Order extends \Magento\Backend\App\Action 'application/pdf' ); } else { - $this->_getSession()->addError( + $this->messageManager->addError( __('There are no printable documents related to selected orders.') ); $this->_redirect('sales/*/'); @@ -661,7 +660,7 @@ class Order extends \Magento\Backend\App\Action 'application/pdf' ); } else { - $this->_getSession()->addError( + $this->messageManager->addError( __('There are no printable documents related to selected orders.') ); $this->_redirect('sales/*/'); @@ -683,11 +682,11 @@ class Order extends \Magento\Backend\App\Action new \Magento\Object() // workaround for backwards compatibility ); $order->save(); - $this->_getSession()->addSuccess(__('The payment has been voided.')); + $this->messageManager->addSuccess(__('The payment has been voided.')); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We couldn\'t void the payment.')); + $this->messageManager->addError(__('We couldn\'t void the payment.')); $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/*/view', array('order_id' => $order->getId())); @@ -806,13 +805,13 @@ class Order extends \Magento\Backend\App\Action $address->addData($data); try { $address->save(); - $this->_getSession()->addSuccess(__('You updated the order address.')); + $this->messageManager->addSuccess(__('You updated the order address.')); $this->_redirect('sales/*/view', array('order_id' => $address->getParentId())); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException( + $this->messageManager->addException( $e, __('Something went wrong updating the order address.') ); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php index aa858f81a04..68ac12edb61 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php @@ -54,11 +54,11 @@ class Create extends \Magento\Backend\App\Action /** * Retrieve session object * - * @return \Magento\Adminhtml\Model\Session\Quote + * @return \Magento\Backend\Model\Session\Quote */ protected function _getSession() { - return $this->_objectManager->get('Magento\Adminhtml\Model\Session\Quote'); + return $this->_objectManager->get('Magento\Backend\Model\Session\Quote'); } /** @@ -303,11 +303,11 @@ class Create extends \Magento\Backend\App\Action } if (!empty($couponCode)) { if ($this->_getQuote()->getCouponCode() !== $couponCode) { - $this->_getSession()->addError( + $this->messageManager->addError( __('"%1" coupon code is not valid.', $this->_objectManager->get('Magento\Escaper') ->escapeHtml($couponCode))); } else { - $this->_getSession()->addSuccess(__('The coupon code has been accepted.')); + $this->messageManager->addSuccess(__('The coupon code has been accepted.')); } } @@ -356,7 +356,8 @@ class Create extends \Magento\Backend\App\Action $orderId = $this->getRequest()->getParam('order_id'); $order = $this->_objectManager->create('Magento\Sales\Model\Order')->load($orderId); if (!$this->_objectManager->get('Magento\Sales\Helper\Reorder')->canReorder($order)) { - return $this->_forward('noroute'); + $this->_forward('noroute'); + return; } if ($order->getId()) { @@ -390,11 +391,11 @@ class Create extends \Magento\Backend\App\Action } catch (\Magento\Core\Exception $e){ $this->_reloadQuote(); - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e){ $this->_reloadQuote(); - $this->_getSession()->addException($e, $e->getMessage()); + $this->messageManager->addException($e, $e->getMessage()); } @@ -423,7 +424,7 @@ class Create extends \Magento\Backend\App\Action $this->_view->generateLayoutBlocks(); $result = $this->_view->getLayout()->renderElement('content'); if ($request->getParam('as_js_varname')) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setUpdateResult($result); + $this->_objectManager->get('Magento\Backend\Model\Session')->setUpdateResult($result); $this->_redirect('sales/*/showUpdateResult'); } else { $this->getResponse()->setBody($result); @@ -455,7 +456,7 @@ class Create extends \Magento\Backend\App\Action } $updateResult->setJsVarName($this->getRequest()->getParam('as_js_varname')); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setCompositeProductResult($updateResult); + $this->_objectManager->get('Magento\Backend\Model\Session')->setCompositeProductResult($updateResult); $this->_redirect('catalog/product/showUpdateResult'); } @@ -509,7 +510,7 @@ class Create extends \Magento\Backend\App\Action ->createOrder(); $this->_getSession()->clearStorage(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('You created the order.')); + $this->messageManager->addSuccess(__('You created the order.')); if ($this->_authorization->isAllowed('Magento_Sales::actions_view')) { $this->_redirect('sales/order/view', array('order_id' => $order->getId())); } else { @@ -519,18 +520,18 @@ class Create extends \Magento\Backend\App\Action $this->_getOrderCreateModel()->saveQuote(); $message = $e->getMessage(); if( !empty($message) ) { - $this->_getSession()->addError($message); + $this->messageManager->addError($message); } $this->_redirect('sales/*/'); } catch (\Magento\Core\Exception $e){ $message = $e->getMessage(); if( !empty($message) ) { - $this->_getSession()->addError($message); + $this->messageManager->addError($message); } $this->_redirect('sales/*/'); } catch (\Exception $e){ - $this->_getSession()->addException($e, __('Order saving error: %1', $e->getMessage())); + $this->messageManager->addException($e, __('Order saving error: %1', $e->getMessage())); $this->_redirect('sales/*/'); } } @@ -574,15 +575,13 @@ class Create extends \Magento\Backend\App\Action $configureResult = new \Magento\Object(); $configureResult->setOk(true); $configureResult->setProductId($productId); - $sessionQuote = $this->_objectManager->get('Magento\Adminhtml\Model\Session\Quote'); + $sessionQuote = $this->_objectManager->get('Magento\Backend\Model\Session\Quote'); $configureResult->setCurrentStoreId($sessionQuote->getStore()->getId()); $configureResult->setCurrentCustomerId($sessionQuote->getCustomerId()); // Render page $this->_objectManager->get('Magento\Catalog\Helper\Product\Composite') ->renderConfigureResult($configureResult); - - return $this; } /* @@ -613,7 +612,7 @@ class Create extends \Magento\Backend\App\Action $configureResult->setBuyRequest($quoteItem->getBuyRequest()); $configureResult->setCurrentStoreId($quoteItem->getStoreId()); $configureResult->setProductId($quoteItem->getProductId()); - $sessionQuote = $this->_objectManager->get('Magento\Adminhtml\Model\Session\Quote'); + $sessionQuote = $this->_objectManager->get('Magento\Backend\Model\Session\Quote'); $configureResult->setCurrentCustomerId($sessionQuote->getCustomerId()); } catch (\Exception $e) { @@ -624,8 +623,6 @@ class Create extends \Magento\Backend\App\Action // Render page $this->_objectManager->get('Magento\Catalog\Helper\Product\Composite') ->renderConfigureResult($configureResult); - - return $this; } @@ -636,7 +633,7 @@ class Create extends \Magento\Backend\App\Action */ public function showUpdateResultAction() { - $session = $this->_objectManager->get('Magento\Adminhtml\Model\Session'); + $session = $this->_objectManager->get('Magento\Backend\Model\Session'); if ($session->hasUpdateResult() && is_scalar($session->getUpdateResult())) { $this->getResponse()->setBody($session->getUpdateResult()); $session->unsUpdateResult(); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php index 5039f25a65f..7109c66b550 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php @@ -43,7 +43,7 @@ class Creditmemo { $data = $this->getRequest()->getParam('creditmemo'); if (!$data) { - $data = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getFormData(true); + $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getFormData(true); } if (isset($data['items'])) { @@ -65,7 +65,7 @@ class Creditmemo * Check order existing */ if (!$order->getId()) { - $this->_getSession()->addError(__('The order no longer exists.')); + $this->messageManager->addError(__('The order no longer exists.')); return false; } @@ -73,7 +73,7 @@ class Creditmemo * Check creditmemo create availability */ if (!$order->canCreditmemo()) { - $this->_getSession()->addError(__('Cannot create credit memo for the order.')); + $this->messageManager->addError(__('Cannot create credit memo for the order.')); return false; } return true; @@ -239,7 +239,7 @@ class Creditmemo $this->_title->add(__("New Memo")); } - if ($comment = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getCommentText(true)) { + if ($comment = $this->_objectManager->get('Magento\Backend\Model\Session')->getCommentText(true)) { $creditmemo->setCommentText($comment); } @@ -328,7 +328,7 @@ class Creditmemo $creditmemo->getOrder()->setCustomerNoteNotify(!empty($data['send_email'])); $this->_saveCreditmemo($creditmemo); $creditmemo->sendEmail(!empty($data['send_email']), $comment); - $this->_getSession()->addSuccess(__('You created the credit memo.')); + $this->messageManager->addSuccess(__('You created the credit memo.')); $this->_getSession()->getCommentText(true); $this->_redirect('sales/order/view', array('order_id' => $creditmemo->getOrderId())); return; @@ -337,11 +337,11 @@ class Creditmemo return; } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_getSession()->setFormData($data); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError(__('Cannot save the credit memo.')); + $this->messageManager->addError(__('Cannot save the credit memo.')); } $this->_redirect('sales/*/new', array('_current' => true)); } @@ -356,11 +356,11 @@ class Creditmemo try { $creditmemo->cancel(); $this->_saveCreditmemo($creditmemo); - $this->_getSession()->addSuccess(__('The credit memo has been canceled.')); + $this->messageManager->addSuccess(__('The credit memo has been canceled.')); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('You canceled the credit memo.')); + $this->messageManager->addError(__('You canceled the credit memo.')); } $this->_redirect('sales/*/view', array('creditmemo_id'=>$creditmemo->getId())); } else { @@ -378,11 +378,11 @@ class Creditmemo try { $creditmemo->void(); $this->_saveCreditmemo($creditmemo); - $this->_getSession()->addSuccess(__('You voided the credit memo.')); + $this->messageManager->addSuccess(__('You voided the credit memo.')); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We can\'t void the credit memo.')); + $this->messageManager->addError(__('We can\'t void the credit memo.')); } $this->_redirect('sales/*/view', array('creditmemo_id'=>$creditmemo->getId())); } else { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Edit.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Edit.php index 4963e9a0575..61ffb622b50 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Edit.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Edit.php @@ -53,10 +53,10 @@ class Edit extends \Magento\Sales\Controller\Adminhtml\Order\Create $this->_redirect('sales/order/'); } } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('sales/order/view', array('order_id' => $orderId)); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addException($e, $e->getMessage()); + $this->messageManager->addException($e, $e->getMessage()); $this->_redirect('sales/order/view', array('order_id' => $orderId)); } } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php index 0a90b039382..6768187e36a 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php @@ -91,7 +91,7 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic if ($invoiceId) { $invoice = $this->_objectManager->create('Magento\Sales\Model\Order\Invoice')->load($invoiceId); if (!$invoice->getId()) { - $this->_getSession()->addError(__('The invoice no longer exists.')); + $this->messageManager->addError(__('The invoice no longer exists.')); return false; } } elseif ($orderId) { @@ -100,14 +100,14 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic * Check order existing */ if (!$order->getId()) { - $this->_getSession()->addError(__('The order no longer exists.')); + $this->messageManager->addError(__('The order no longer exists.')); return false; } /** * Check invoice create availability */ if (!$order->canInvoice()) { - $this->_getSession()->addError(__('The order does not allow an invoice to be created.')); + $this->messageManager->addError(__('The order does not allow an invoice to be created.')); return false; } $savedQtys = $this->_getItemQtys(); @@ -207,7 +207,7 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic if ($invoice) { $this->_title->add(__('New Invoice')); - $comment = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getCommentText(true); + $comment = $this->_objectManager->get('Magento\Backend\Model\Session')->getCommentText(true); if ($comment) { $invoice->setCommentText($comment); } @@ -260,7 +260,7 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic $orderId = $this->getRequest()->getParam('order_id'); if (!empty($data['comment_text'])) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setCommentText($data['comment_text']); + $this->_objectManager->get('Magento\Backend\Model\Session')->setCommentText($data['comment_text']); } try { @@ -302,12 +302,12 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic $transactionSave->save(); if (isset($shippingResponse) && $shippingResponse->hasErrors()) { - $this->_getSession()->addError(__('The invoice and the shipment have been created. ' + $this->messageManager->addError(__('The invoice and the shipment have been created. ' . 'The shipping label cannot be created now.')); } elseif (!empty($data['do_shipment'])) { - $this->_getSession()->addSuccess(__('You created the invoice and shipment.')); + $this->messageManager->addSuccess(__('You created the invoice and shipment.')); } else { - $this->_getSession()->addSuccess(__('The invoice has been created.')); + $this->messageManager->addSuccess(__('The invoice has been created.')); } // send invoice/shipment emails @@ -319,26 +319,26 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic $invoice->sendEmail(!empty($data['send_email']), $comment); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError(__('We can\'t send the invoice email.')); + $this->messageManager->addError(__('We can\'t send the invoice email.')); } if ($shipment) { try { $shipment->sendEmail(!empty($data['send_email'])); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError(__('We can\'t send the shipment.')); + $this->messageManager->addError(__('We can\'t send the shipment.')); } } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getCommentText(true); + $this->_objectManager->get('Magento\Backend\Model\Session')->getCommentText(true); $this->_redirect('sales/order/view', array('order_id' => $orderId)); } else { $this->_redirect('sales/*/new', array('order_id' => $orderId)); } return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We can\'t save the invoice.')); + $this->messageManager->addError(__('We can\'t save the invoice.')); $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/*/new', array('order_id' => $orderId)); @@ -355,11 +355,11 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic try { $invoice->capture(); $this->_saveInvoice($invoice); - $this->_getSession()->addSuccess(__('The invoice has been captured.')); + $this->messageManager->addSuccess(__('The invoice has been captured.')); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('Invoice capturing error')); + $this->messageManager->addError(__('Invoice capturing error')); } $this->_redirect('sales/*/view', array('invoice_id'=>$invoice->getId())); } else { @@ -377,11 +377,11 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic try { $invoice->cancel(); $this->_saveInvoice($invoice); - $this->_getSession()->addSuccess(__('You canceled the invoice.')); + $this->messageManager->addSuccess(__('You canceled the invoice.')); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('Invoice canceling error')); + $this->messageManager->addError(__('Invoice canceling error')); } $this->_redirect('sales/*/view', array('invoice_id' => $invoice->getId())); } else { @@ -399,11 +399,11 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic try { $invoice->void(); $this->_saveInvoice($invoice); - $this->_getSession()->addSuccess(__('The invoice has been voided.')); + $this->messageManager->addSuccess(__('The invoice has been voided.')); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('Invoice voiding error')); + $this->messageManager->addError(__('Invoice voiding error')); } $this->_redirect('sales/*/view', array('invoice_id' => $invoice->getId())); } else { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Shipment.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Shipment.php index 0682ce675c2..ebd82d3f3ec 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Shipment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Shipment.php @@ -97,21 +97,21 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip * Check order existing */ if (!$order->getId()) { - $this->_getSession()->addError(__('The order no longer exists.')); + $this->messageManager->addError(__('The order no longer exists.')); return false; } /** * Check shipment is available to create separate from invoice */ if ($order->getForcedShipmentWithInvoice()) { - $this->_getSession()->addError(__('Cannot do shipment for the order separately from invoice.')); + $this->messageManager->addError(__('Cannot do shipment for the order separately from invoice.')); return false; } /** * Check shipment create availability */ if (!$order->canShip()) { - $this->_getSession()->addError(__('Cannot do shipment for the order.')); + $this->messageManager->addError(__('Cannot do shipment for the order.')); return false; } $savedQtys = $this->_getItemQtys(); @@ -190,7 +190,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip if ($shipment) { $this->_title->add(__('New Shipment')); - $comment = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getCommentText(true); + $comment = $this->_objectManager->get('Magento\Backend\Model\Session')->getCommentText(true); if ($comment) { $shipment->setCommentText($comment); } @@ -213,7 +213,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip { $data = $this->getRequest()->getPost('shipment'); if (!empty($data['comment_text'])) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setCommentText($data['comment_text']); + $this->_objectManager->get('Magento\Backend\Model\Session')->setCommentText($data['comment_text']); } try { @@ -255,15 +255,15 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $shipmentCreatedMessage = __('The shipment has been created.'); $labelCreatedMessage = __('You created the shipping label.'); - $this->_getSession()->addSuccess($isNeedCreateLabel ? $shipmentCreatedMessage . ' ' . $labelCreatedMessage + $this->messageManager->addSuccess($isNeedCreateLabel ? $shipmentCreatedMessage . ' ' . $labelCreatedMessage : $shipmentCreatedMessage); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getCommentText(true); + $this->_objectManager->get('Magento\Backend\Model\Session')->getCommentText(true); } catch (\Magento\Core\Exception $e) { if ($isNeedCreateLabel) { $responseAjax->setError(true); $responseAjax->setMessage($e->getMessage()); } else { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('sales/*/new', array('order_id' => $this->getRequest()->getParam('order_id'))); } } catch (\Exception $e) { @@ -273,7 +273,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $responseAjax->setMessage( __('An error occurred while creating shipping label.')); } else { - $this->_getSession()->addError(__('Cannot save shipment.')); + $this->messageManager->addError(__('Cannot save shipment.')); $this->_redirect('sales/*/new', array('order_id' => $this->getRequest()->getParam('order_id'))); } @@ -302,12 +302,12 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $historyItem->setIsCustomerNotified(1); $historyItem->save(); } - $this->_getSession()->addSuccess(__('You sent the shipment.')); + $this->messageManager->addSuccess(__('You sent the shipment.')); } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('Cannot send shipment information.')); + $this->messageManager->addError(__('Cannot send shipment information.')); } $this->_redirect('sales/*/view', array( 'shipment_id' => $this->getRequest()->getParam('shipment_id') @@ -496,7 +496,8 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip return false; } $shipment->setPackages($this->getRequest()->getParam('packages')); - $response = $this->_objectManager->create('Magento\Shipping\Model\Shipping')->requestToShipment($shipment); + $response = $this->_objectManager->create('Magento\Shipping\Model\Shipping\Labels') + ->requestToShipment($shipment); if ($response->hasErrors()) { throw new \Magento\Core\Exception($response->getErrors()); } @@ -540,7 +541,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $shipment = $this->_initShipment(); if ($this->_createShippingLabel($shipment)) { $shipment->save(); - $this->_getSession()->addSuccess(__('You created the shipping label.')); + $this->messageManager->addSuccess(__('You created the shipping label.')); $response->setOk(true); } } catch (\Magento\Core\Exception $e) { @@ -572,9 +573,9 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $pdf = new \Zend_Pdf(); $page = $this->_createPdfPageFromImageString($labelContent); if (!$page) { - $this->_getSession() - ->addError(__('We don\'t recognize or support the file extension in this shipment: %1.', - $shipment->getIncrementId())); + $this->messageManager->addError( + __('We don\'t recognize or support the file extension in this shipment: %1.', $shipment->getIncrementId()) + ); } $pdf->pages[] = $page; $pdfContent = $pdf->render(); @@ -587,11 +588,10 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip ); } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession() - ->addError(__('An error occurred while creating shipping label.')); + $this->messageManager->addError(__('An error occurred while creating shipping label.')); } $this->_redirect('sales/order_shipment/view', array( 'shipment_id' => $this->getRequest()->getParam('shipment_id') @@ -662,17 +662,14 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip if (!empty($labelsContent)) { $outputPdf = $this->_combineLabelsPdf($labelsContent); - $this->_fileFactory->create('ShippingLabels.pdf', $outputPdf->render(), 'application/pdf'); - return; + return $this->_fileFactory->create('ShippingLabels.pdf', $outputPdf->render(), 'application/pdf'); } if ($createdFromOrders) { - $this->_getSession() - ->addError(__('There are no shipping labels related to selected orders.')); + $this->messageManager->addError(__('There are no shipping labels related to selected orders.')); $this->_redirect('sales/order/index'); } else { - $this->_getSession() - ->addError(__('There are no shipping labels related to selected shipments.')); + $this->messageManager->addError(__('There are no shipping labels related to selected shipments.')); $this->_redirect('sales/order_shipment/index'); } } @@ -710,10 +707,9 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip */ protected function _createPdfPageFromImageString($imageString) { - /** @var \Magento\Filesystem $filesystem */ - $filesystem = $this->_objectManager->get('Magento\Filesystem'); - /** @var $tmpDir \Magento\App\Dir */ - $tmpDir = $this->_objectManager->get('Magento\App\Dir', $filesystem->getWorkingDirectory()); + /** @var \Magento\Filesystem\Directory\Write $directory */ + $directory = $this->_objectManager->get('Magento\Filesystem') + ->getDirectoryWrite(\Magento\Filesystem::TMP); $image = imagecreatefromstring($imageString); if (!$image) { return false; @@ -724,12 +720,11 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $page = new \Zend_Pdf_Page($xSize, $ySize); imageinterlace($image, 0); - $tmpFileName = $tmpDir->getDir(\Magento\App\Dir::TMP) . 'shipping_labels_' - . uniqid(mt_rand()) . time() . '.png'; + $tmpFileName = $directory->getAbsolutePath('shipping_labels_' . uniqid(mt_rand()) . time() . '.png'); imagepng($image, $tmpFileName); $pdfImage = \Zend_Pdf_Image::imageWithPath($tmpFileName); $page->drawImage($pdfImage, 0, 0, $xSize, $ySize); - $filesystem->delete($tmpFileName); + $directory->delete($directory->getRelativePath($tmpFileName)); return $page; } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php index d943c7d9e4e..3f5c55a5d11 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php @@ -113,7 +113,7 @@ class Status extends \Magento\Backend\App\Action $this->_setActiveMenu('Magento_Sales::system_order_statuses'); $this->_view->renderLayout(); } else { - $this->_getSession()->addError( + $this->messageManager->addError( __('We can\'t find this order status.') ); $this->_redirect('sales/'); @@ -146,7 +146,7 @@ class Status extends \Magento\Backend\App\Action ->load($statusCode); // check if status exist if ($isNew && $status->getStatus()) { - $this->_getSession()->addError( + $this->messageManager->addError( __('We found another order status with the same order status code.') ); $this->_getSession()->setFormData($data); @@ -158,13 +158,13 @@ class Status extends \Magento\Backend\App\Action try { $status->save(); - $this->_getSession()->addSuccess(__('You have saved the order status.')); + $this->messageManager->addSuccess(__('You have saved the order status.')); $this->_redirect('sales/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException( + $this->messageManager->addException( $e, __('We couldn\'t add your order status because something went wrong saving.') ); @@ -205,19 +205,19 @@ class Status extends \Magento\Backend\App\Action if ($status && $status->getStatus()) { try { $status->assignState($state, $isDefault); - $this->_getSession()->addSuccess(__('You have assigned the order status.')); + $this->messageManager->addSuccess(__('You have assigned the order status.')); $this->_redirect('sales/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException( + $this->messageManager->addException( $e, __('An error occurred while assigning order status. Status has not been assigned.') ); } } else { - $this->_getSession()->addError(__('We can\'t find this order status.')); + $this->messageManager->addError(__('We can\'t find this order status.')); } $this->_redirect('sales/*/assign'); return; @@ -232,17 +232,17 @@ class Status extends \Magento\Backend\App\Action if ($status) { try { $status->unassignState($state); - $this->_getSession()->addSuccess(__('You have unassigned the order status.')); + $this->messageManager->addSuccess(__('You have unassigned the order status.')); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException( + $this->messageManager->addException( $e, __('Something went wrong while we were unassigning the order.') ); } } else { - $this->_getSession()->addError(__('We can\'t find this order status.')); + $this->messageManager->addError(__('We can\'t find this order status.')); } $this->_redirect('sales/*/'); } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/View/Giftmessage.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/View/Giftmessage.php index 6a61a0a6570..39902155068 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/View/Giftmessage.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/View/Giftmessage.php @@ -43,9 +43,9 @@ class Giftmessage extends \Magento\Backend\App\Action ->setGiftmessages($this->getRequest()->getParam('giftmessage')) ->saveAllInOrder(); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('Something went wrong while saving the gift message.')); + $this->messageManager->addError(__('Something went wrong while saving the gift message.')); } if($this->getRequest()->getParam('type')=='order_item') { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Recurring/Profile.php b/app/code/Magento/Sales/Controller/Adminhtml/Recurring/Profile.php index 0e6f98c7436..fb6109b659d 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Recurring/Profile.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Recurring/Profile.php @@ -63,7 +63,6 @@ class Profile extends \Magento\Backend\App\Action $this->_view->loadLayout(); $this->_setActiveMenu('Magento_Sales::sales_recurring_profile'); $this->_view->renderLayout(); - return $this; } /** @@ -80,7 +79,7 @@ class Profile extends \Magento\Backend\App\Action $this->_view->renderLayout(); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); } @@ -96,7 +95,7 @@ class Profile extends \Magento\Backend\App\Action $this->_view->loadLayout()->renderLayout(); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); } @@ -139,11 +138,11 @@ class Profile extends \Magento\Backend\App\Action $profile->activate(); break; } - $this->_getSession()->addSuccess(__('The profile state has been updated.')); + $this->messageManager->addSuccess(__('The profile state has been updated.')); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We could not update the profile.')); + $this->messageManager->addError(__('We could not update the profile.')); $this->_objectManager->get('Magento\Logger')->logException($e); } if ($profile) { @@ -164,14 +163,14 @@ class Profile extends \Magento\Backend\App\Action $profile->fetchUpdate(); if ($profile->hasDataChanges()) { $profile->save(); - $this->_getSession()->addSuccess(__('You updated the profile.')); + $this->messageManager->addSuccess(__('You updated the profile.')); } else { - $this->_getSession()->addNotice(__('The profile has no changes.')); + $this->messageManager->addNotice(__('The profile has no changes.')); } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError(__('We could not update the profile.')); + $this->messageManager->addError(__('We could not update the profile.')); $this->_objectManager->get('Magento\Logger')->logException($e); } if ($profile) { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Shipment/AbstractShipment.php b/app/code/Magento/Sales/Controller/Adminhtml/Shipment/AbstractShipment.php index 0ed1470ba8d..9831025165a 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Shipment/AbstractShipment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Shipment/AbstractShipment.php @@ -117,7 +117,9 @@ class AbstractShipment extends \Magento\Backend\App\Action $pdf = $this->_objectManager->create('Magento\Sales\Model\Order\Pdf\Shipment') ->getPdf(array($shipment)); $date = $this->_objectManager->get('Magento\Core\Model\Date')->date('Y-m-d_H-i-s'); - $this->_fileFactory->create('packingslip' . $date . '.pdf', $pdf->render(), 'application/pdf'); + return $this->_fileFactory->create( + 'packingslip' . $date . '.pdf', $pdf->render(), 'application/pdf' + ); } } else { $this->_forward('noroute'); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php b/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php index 3e5a3bdeb0e..3d43dbcc0ad 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php @@ -66,7 +66,7 @@ class Transactions extends \Magento\Backend\App\Action ); if (!$txn->getId()) { - $this->_getSession()->addError(__('Please correct the transaction ID and try again.')); + $this->messageManager->addError(__('Please correct the transaction ID and try again.')); $this->_redirect('sales/*/'); $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); return false; @@ -131,15 +131,11 @@ class Transactions extends \Magento\Backend\App\Action ->setOrder($txn->getOrder()) ->importTransactionInfo($txn); $txn->save(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('The transaction details have been updated.') - ); + $this->messageManager->addSuccess(__('The transaction details have been updated.')); } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('We can\'t update the transaction details.') - ); + $this->messageManager->addError(__('We can\'t update the transaction details.')); $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/transactions/view', array('_current' => true)); diff --git a/app/code/Magento/Sales/Controller/Billing/Agreement.php b/app/code/Magento/Sales/Controller/Billing/Agreement.php index 53b92572e27..aa7b044629e 100644 --- a/app/code/Magento/Sales/Controller/Billing/Agreement.php +++ b/app/code/Magento/Sales/Controller/Billing/Agreement.php @@ -69,16 +69,15 @@ class Agreement extends \Magento\App\Action\Action { $this->_title->add(__('Billing Agreements')); $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } - /** * Check customer authentication * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { @@ -103,7 +102,7 @@ class Agreement extends \Magento\App\Action\Action $this->_title->add(__('Billing Agreements')); $this->_title->add(__('Billing Agreement # %1', $agreement->getReferenceId())); $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); $navigationBlock = $this->_view->getLayout()->getBlock('customer_account_navigation'); if ($navigationBlock) { $navigationBlock->setActive('sales/billing_agreement/'); @@ -129,13 +128,12 @@ class Agreement extends \Magento\App\Action\Action ->setCancelUrl($this->_objectManager->create('Magento\Core\Model\Url') ->getUrl('*/*/cancelWizard', array('payment_method' => $paymentCode))); - $this->getResponse()->setRedirect($agreement->initToken()); - return $this; + return $this->getResponse()->setRedirect($agreement->initToken()); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError(__('We couldn\'t start the billing agreement wizard.')); + $this->messageManager->addError(__('We couldn\'t start the billing agreement wizard.')); } } $this->_redirect('*/*/'); @@ -158,16 +156,16 @@ class Agreement extends \Magento\App\Action\Action ->setMethodCode($paymentCode) ->setCustomer($this->_objectManager->get('Magento\Customer\Model\Session')->getCustomer()) ->place(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('The billing agreement "%1" has been created.', $agreement->getReferenceId()) ); $this->_redirect('*/*/view', array('agreement' => $agreement->getId())); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError(__('We couldn\'t finish the billing agreement wizard.')); + $this->messageManager->addError(__('We couldn\'t finish the billing agreement wizard.')); } $this->_redirect('*/*/index'); } @@ -193,14 +191,14 @@ class Agreement extends \Magento\App\Action\Action if ($agreement && $agreement->canCancel()) { try { $agreement->cancel(); - $this->_getSession()->addNotice( + $this->messageManager->addNotice( __('The billing agreement "%1" has been canceled.', $agreement->getReferenceId()) ); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession()->addError(__('We couldn\'t cancel the billing agreement.')); + $this->messageManager->addError(__('We couldn\'t cancel the billing agreement.')); } } $this->_redirect('*/*/view', array('_current' => true)); @@ -218,7 +216,7 @@ class Agreement extends \Magento\App\Action\Action $billingAgreement = $this->_objectManager->create('Magento\Sales\Model\Billing\Agreement') ->load($agreementId); if (!$billingAgreement->getAgreementId()) { - $this->_getSession()->addError(__('Please specify the correct billing agreement ID and try again.')); + $this->messageManager->addError(__('Please specify the correct billing agreement ID and try again.')); $this->_redirect('*/*/'); return false; } diff --git a/app/code/Magento/Sales/Controller/Download.php b/app/code/Magento/Sales/Controller/Download.php index dad4241ca3b..c30623e1316 100644 --- a/app/code/Magento/Sales/Controller/Download.php +++ b/app/code/Magento/Sales/Controller/Download.php @@ -40,15 +40,25 @@ class Download extends \Magento\App\Action\Action */ protected $_fileResponseFactory; + /** + * Filesystem instance + * + * @var \Magento\Filesystem + */ + protected $_filesystem; + /** * @param \Magento\App\Action\Context $context * @param \Magento\App\Response\Http\FileFactory $fileResponseFactory + * @param \Magento\Filesystem $filesystem */ public function __construct( \Magento\App\Action\Context $context, - \Magento\App\Response\Http\FileFactory $fileResponseFactory + \Magento\App\Response\Http\FileFactory $fileResponseFactory, + \Magento\Filesystem $filesystem ) { $this->_fileResponseFactory = $fileResponseFactory; + $this->_filesystem = $filesystem; parent::__construct($context); } @@ -65,13 +75,21 @@ class Download extends \Magento\App\Action\Action throw new \Exception(); } - $filePath = $this->_objectManager->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::ROOT) . $info['order_path']; - if ((!is_file($filePath) || !is_readable($filePath)) && !$this->_processDatabaseFile($filePath)) { + /** @var \Magento\Filesystem\Directory\Read $directory */ + $directory = $this->_objectManager->get('Magento\Filesystem') + ->getDirectoryWrite(\Magento\Filesystem::ROOT); + + $relativePath = $info['order_path']; + $filePath = $directory->getAbsolutePath($relativePath); + if ((!$directory->isFile($relativePath) || !$directory->isReadable($relativePath)) + && !$this->_processDatabaseFile($filePath) + ) { //try get file from quote - $filePath = $this->_objectManager->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::ROOT) . $info['quote_path']; - if ((!is_file($filePath) || !is_readable($filePath)) && !$this->_processDatabaseFile($filePath)) { + $relativePath = $info['quote_path']; + $filePath = $directory->getAbsolutePath($relativePath); + if ((!$directory->isFile($relativePath) || !$directory->isReadable($relativePath)) + && !$this->_processDatabaseFile($filePath) + ) { throw new \Exception(); } } @@ -105,17 +123,14 @@ class Download extends \Magento\App\Action\Action return false; } - $directory = dirname($filePath); - @mkdir($directory, 0777, true); - - $io = new \Magento\Io\File(); - $io->cd($directory); - - $io->streamOpen($filePath); - $io->streamLock(true); - $io->streamWrite($file->getContent()); - $io->streamUnlock(); - $io->streamClose(); + /** @var \Magento\Filesystem\Directory\WriteInterface $directory */ + $directory = $this->_objectManager->get('Magento\Filesystem') + ->getDirectoryWrite(\Magento\Filesystem::ROOT); + $stream = $directory->openFile($filePath, 'w+'); + $stream->lock(); + $stream->write($filePath, $file->getContent()); + $stream->unlock(); + $stream->close(); return true; } diff --git a/app/code/Magento/Sales/Controller/Order.php b/app/code/Magento/Sales/Controller/Order.php index 6ead3cd7485..7d0e50a92d4 100644 --- a/app/code/Magento/Sales/Controller/Order.php +++ b/app/code/Magento/Sales/Controller/Order.php @@ -38,7 +38,7 @@ class Order extends \Magento\Sales\Controller\AbstractController * Check customer authentication for some actions * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { @@ -56,7 +56,7 @@ class Order extends \Magento\Sales\Controller\AbstractController public function historyAction() { $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Catalog\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->getLayout()->getBlock('head')->setTitle(__('My Orders')); diff --git a/app/code/Magento/Sales/Controller/Recurring/Profile.php b/app/code/Magento/Sales/Controller/Recurring/Profile.php index 596cec0f59d..e23b85a3980 100644 --- a/app/code/Magento/Sales/Controller/Recurring/Profile.php +++ b/app/code/Magento/Sales/Controller/Recurring/Profile.php @@ -71,7 +71,7 @@ class Profile extends \Magento\App\Action\Action * Make sure customer is logged in and put it into registry * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface */ public function dispatch(RequestInterface $request) { @@ -93,7 +93,7 @@ class Profile extends \Magento\App\Action\Action { $this->_title->add(__('Recurring Billing Profiles')); $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -127,11 +127,11 @@ class Profile extends \Magento\App\Action\Action default: break; } - $this->_session->addSuccess(__('The profile state has been updated.')); + $this->messageManager->addSuccess(__('The profile state has been updated.')); } catch (\Magento\Core\Exception $e) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_session->addError(__('We couldn\'t update the profile.')); + $this->messageManager->addError(__('We couldn\'t update the profile.')); $this->_objectManager->get('Magento\Logger')->logException($e); } if ($profile) { @@ -152,14 +152,14 @@ class Profile extends \Magento\App\Action\Action $profile->fetchUpdate(); if ($profile->hasDataChanges()) { $profile->save(); - $this->_session->addSuccess(__('The profile has been updated.')); + $this->messageManager->addSuccess(__('The profile has been updated.')); } else { - $this->_session->addNotice(__('The profile has no changes.')); + $this->messageManager->addNotice(__('The profile has no changes.')); } } catch (\Magento\Core\Exception $e) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_session->addError(__('We couldn\'t update the profile.')); + $this->messageManager->addError(__('We couldn\'t update the profile.')); $this->_objectManager->get('Magento\Logger')->logException($e); } if ($profile) { @@ -179,7 +179,7 @@ class Profile extends \Magento\App\Action\Action $this->_title->add(__('Recurring Billing Profiles')); $this->_title->add(__('Profile #%1', $profile->getReferenceId())); $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Customer\Model\Session'); + $this->_view->getLayout()->initMessages(); $navigationBlock = $this->_view->getLayout()->getBlock('customer_account_navigation'); if ($navigationBlock) { $navigationBlock->setActive('sales/recurring_profile/'); @@ -187,7 +187,7 @@ class Profile extends \Magento\App\Action\Action $this->_view->renderLayout(); return; } catch (\Magento\Core\Exception $e) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); } diff --git a/app/code/Magento/Sales/Helper/Guest.php b/app/code/Magento/Sales/Helper/Guest.php index 750b6e34e42..d3eecd6c55a 100644 --- a/app/code/Magento/Sales/Helper/Guest.php +++ b/app/code/Magento/Sales/Helper/Guest.php @@ -58,9 +58,9 @@ class Guest extends \Magento\Core\Helper\Data protected $_coreCookie; /** - * @var \Magento\Core\Model\Session + * @var \Magento\Message\ManagerInterface */ - protected $_session; + protected $messageManager; /** * @var \Magento\Sales\Model\OrderFactory @@ -76,7 +76,7 @@ class Guest extends \Magento\Core\Helper\Data * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Stdlib\Cookie $coreCookie - * @param \Magento\Core\Model\Session $coreSession + * @param \Magento\Message\ManagerInterface $messageManager * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\App\ViewInterface $view * @param bool $dbCompatibleMode @@ -90,7 +90,7 @@ class Guest extends \Magento\Core\Helper\Data \Magento\Core\Model\Registry $coreRegistry, \Magento\Customer\Model\Session $customerSession, \Magento\Stdlib\Cookie $coreCookie, - \Magento\Core\Model\Session $coreSession, + \Magento\Message\ManagerInterface $messageManager, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\App\ViewInterface $view, $dbCompatibleMode = true @@ -98,7 +98,7 @@ class Guest extends \Magento\Core\Helper\Data $this->_coreRegistry = $coreRegistry; $this->_customerSession = $customerSession; $this->_coreCookie = $coreCookie; - $this->_session = $coreSession; + $this->messageManager = $messageManager; $this->_orderFactory = $orderFactory; $this->_view = $view; parent::__construct( @@ -184,9 +184,7 @@ class Guest extends \Magento\Core\Helper\Data return true; } - $this->_session->addError( - __('You entered incorrect data. Please try again.') - ); + $this->messageManager->addError(__('You entered incorrect data. Please try again.')); $this->_app->getResponse()->setRedirect($this->_urlBuilder->getUrl('sales/guest/form')); return false; } diff --git a/app/code/Magento/Sales/Model/AdminOrder.php b/app/code/Magento/Sales/Model/AdminOrder.php index bec56ca9812..ae034a8d531 100644 --- a/app/code/Magento/Sales/Model/AdminOrder.php +++ b/app/code/Magento/Sales/Model/AdminOrder.php @@ -36,9 +36,9 @@ namespace Magento\Sales\Model; class AdminOrder { /** - * @var \Magento\Backend\Model\Session + * @var \Magento\Message\ManagerInterface */ - protected $_session; + protected $messageManager; /** * @var \Magento\Customer\Model\CustomerFactory] @@ -53,16 +53,16 @@ class AdminOrder /** * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory - * @param \Magento\Backend\Model\Session $session + * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, - \Magento\Backend\Model\Session $session + \Magento\Message\ManagerInterface $messageManager ) { $this->_productFactory = $productFactory; $this->_customerFactory = $customerFactory; - $this->_session = $session; + $this->messageManager = $messageManager; } public function checkRelation(\Magento\Sales\Model\Order $order) @@ -72,9 +72,7 @@ class AdminOrder */ $customer = $this->_customerFactory->create()->load($order->getCustomerId()); if (!$customer->getId()) { - $this->_session->addNotice( - __(' The customer does not exist in the system anymore.') - ); + $this->messageManager->addNotice(__(' The customer does not exist in the system anymore.')); } /** @@ -92,14 +90,14 @@ class AdminOrder $hasBadItems = false; foreach ($order->getAllItems() as $item) { if (!$productCollection->getItemById($item->getProductId())) { - $this->_session->addError( + $this->messageManager->addError( __('The item %1 (SKU %2) does not exist in the catalog anymore.', $item->getName(), $item->getSku() )); $hasBadItems = true; } } if ($hasBadItems) { - $this->_session->addError( + $this->messageManager->addError( __('Some items in this order are no longer in our catalog.') ); } diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 2fc9c35e224..df1cae69c76 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -39,7 +39,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car /** * Quote session object * - * @var \Magento\Adminhtml\Model\Session\Quote + * @var \Magento\Backend\Model\Session\Quote */ protected $_session; @@ -154,14 +154,20 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car */ protected $_objectCopyService; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\ObjectManager $objectManager * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Sales\Model\Config $salesConfig - * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote + * @param \Magento\Backend\Model\Session\Quote $sessionQuote * @param \Magento\Logger $logger * @param \Magento\Object\Copy $objectCopyService + * @param \Magento\Message\ManagerInterface $messageManager * @param array $data */ public function __construct( @@ -169,9 +175,10 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\Registry $coreRegistry, \Magento\Sales\Model\Config $salesConfig, - \Magento\Adminhtml\Model\Session\Quote $sessionQuote, + \Magento\Backend\Model\Session\Quote $sessionQuote, \Magento\Logger $logger, \Magento\Object\Copy $objectCopyService, + \Magento\Message\ManagerInterface $messageManager, array $data = array() ) { $this->_objectManager = $objectManager; @@ -182,6 +189,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $this->_objectCopyService = $objectCopyService; parent::__construct($data); $this->_session = $sessionQuote; + $this->messageManager = $messageManager; } /** @@ -288,7 +296,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car /** * Retrieve session model object of quote * - * @return \Magento\Adminhtml\Model\Session\Quote + * @return \Magento\Backend\Model\Session\Quote */ public function getSession() { @@ -853,7 +861,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car try { $this->addProduct($productId, $config); } catch (\Magento\Core\Exception $e){ - $this->getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e){ return $e; } @@ -1665,7 +1673,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car if (!empty($this->_errors)) { foreach ($this->_errors as $error) { - $this->getSession()->addError($error); + $this->messageManager->addError($error); } throw new \Magento\Core\Exception(''); } diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index e7d574bdcc9..c6a86dc9c47 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -690,7 +690,10 @@ class Order extends \Magento\Sales\Model\AbstractModel */ public function canCancel() { - if ($this->canUnhold()) { // $this->isPaymentReview() + if (!$this->_canVoidOrder()) { + return false; + } + if ($this->canUnhold()) { return false; } @@ -718,15 +721,6 @@ class Order extends \Magento\Sales\Model\AbstractModel return false; } - /** - * Use only state for availability detect - */ - /*foreach ($this->getAllItems() as $item) { - if ($item->getQtyToCancel()>0) { - return true; - } - } - return false;*/ return true; } @@ -735,15 +729,21 @@ class Order extends \Magento\Sales\Model\AbstractModel * @return bool */ public function canVoidPayment() + { + return $this->_canVoidOrder() ? $this->getPayment()->canVoid($this->getPayment()) : false; + } + + /** + * Check whether order could be canceled by states and flags + * + * @return bool + */ + protected function _canVoidOrder() { if ($this->canUnhold() || $this->isPaymentReview()) { return false; } - $state = $this->getState(); - if ($this->isCanceled() || $state === self::STATE_COMPLETE || $state === self::STATE_CLOSED) { - return false; - } - return $this->getPayment()->canVoid(new \Magento\Object); + return true; } /** diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php index f99901c5fad..e8bb06ff0e2 100644 --- a/app/code/Magento/Sales/Model/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Order/Payment.php @@ -863,7 +863,7 @@ class Payment extends \Magento\Payment\Model\Info public function cancel() { $isOnline = true; - if (!$this->canVoid(new \Magento\Object())) { + if (!$this->canVoid($this)) { $isOnline = false; } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php index d2a2f60c3e0..c34b302dca6 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php @@ -99,9 +99,14 @@ abstract class AbstractPdf extends \Magento\Object protected $_translate; /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem\Directory\WriteInterface */ - protected $_coreDir; + protected $_mediaDirectory; + + /** + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $_rootDirectory; /** * @var \Magento\Shipping\Model\Config @@ -128,7 +133,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\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem * @param \Magento\Shipping\Model\Config $shippingConfig * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory @@ -143,7 +148,7 @@ abstract class AbstractPdf extends \Magento\Object \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\Translate $translate, - \Magento\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Shipping\Model\Config $shippingConfig, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, @@ -156,7 +161,8 @@ abstract class AbstractPdf extends \Magento\Object $this->string = $string; $this->_coreStoreConfig = $coreStoreConfig; $this->_translate = $translate; - $this->_coreDir = $coreDir; + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); $this->_shippingConfig = $shippingConfig; $this->_pdfConfig = $pdfConfig; $this->_pdfTotalFactory = $pdfTotalFactory; @@ -239,9 +245,9 @@ abstract class AbstractPdf extends \Magento\Object $this->y = $this->y ? $this->y : 815; $image = $this->_coreStoreConfig->getConfig('sales/identity/logo', $store); if ($image) { - $image = $this->_coreDir->getDir(\Magento\App\Dir::MEDIA) . '/sales/store/logo/' . $image; - if (is_file($image)) { - $image = \Zend_Pdf_Image::imageWithPath($image); + $imagePath = '/sales/store/logo/' . $image; + if ($this->_mediaDirectory->isFile($imagePath)) { + $image = \Zend_Pdf_Image::imageWithPath($this->_mediaDirectory->getAbsolutePath($imagePath)); $top = 830; //top border of the page $widthLimit = 270; //half of the page width $heightLimit = 270; //assuming the image is not a "skyscraper" @@ -834,7 +840,7 @@ abstract class AbstractPdf extends \Magento\Object protected function _setFontRegular($object, $size = 7) { $font = \Zend_Pdf_Font::fontWithPath( - $this->_coreDir->getDir() . '/lib/LinLibertineFont/LinLibertine_Re-4.4.1.ttf' + $this->_rootDirectory->getAbsolutePath('lib/LinLibertineFont/LinLibertine_Re-4.4.1.ttf') ); $object->setFont($font, $size); return $font; @@ -850,7 +856,7 @@ abstract class AbstractPdf extends \Magento\Object protected function _setFontBold($object, $size = 7) { $font = \Zend_Pdf_Font::fontWithPath( - $this->_coreDir->getDir() . '/lib/LinLibertineFont/LinLibertine_Bd-2.8.1.ttf' + $this->_rootDirectory->getAbsolutePath('lib/LinLibertineFont/LinLibertine_Bd-2.8.1.ttf') ); $object->setFont($font, $size); return $font; @@ -866,7 +872,7 @@ abstract class AbstractPdf extends \Magento\Object protected function _setFontItalic($object, $size = 7) { $font = \Zend_Pdf_Font::fontWithPath( - $this->_coreDir->getDir() . '/lib/LinLibertineFont/LinLibertine_It-2.8.2.ttf' + $this->_rootDirectory->getAbsolutePath('lib/LinLibertineFont/LinLibertine_It-2.8.2.ttf') ); $object->setFont($font, $size); return $font; diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php index e1c4359dbf6..fcedd9ec613 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php @@ -41,7 +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\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem * @param \Magento\Shipping\Model\Config $shippingConfig * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory @@ -57,7 +57,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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Shipping\Model\Config $shippingConfig, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, @@ -72,7 +72,7 @@ class Creditmemo extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $string, $coreStoreConfig, $translate, - $coreDir, + $filesystem, $shippingConfig, $pdfConfig, $pdfTotalFactory, diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php index 66d5cbffd2b..28ed5b0d6db 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php @@ -41,7 +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\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem, * @param \Magento\Shipping\Model\Config $shippingConfig * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory @@ -57,7 +57,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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Shipping\Model\Config $shippingConfig, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, @@ -72,7 +72,7 @@ class Invoice extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $string, $coreStoreConfig, $translate, - $coreDir, + $filesystem, $shippingConfig, $pdfConfig, $pdfTotalFactory, 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 fd7ddf30dcc..b3e62439096 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php @@ -74,15 +74,15 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel protected $_taxData = null; /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem\Directory\ReadInterface */ - protected $_coreDir; + protected $_rootDirectory; /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\App\Dir $coreDir + * @param \Magento\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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_taxData = $taxData; - $this->_coreDir = $coreDir; + $this->_rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -339,7 +339,7 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel protected function _setFontRegular($size = 7) { $font = \Zend_Pdf_Font::fontWithPath( - $this->_coreDir->getDir(\Magento\App\Dir::ROOT) . '/lib/LinLibertineFont/LinLibertine_Re-4.4.1.ttf' + $this->_rootDirectory->getAbsolutePath('lib/LinLibertineFont/LinLibertine_Re-4.4.1.ttf') ); $this->getPage()->setFont($font, $size); return $font; @@ -354,7 +354,7 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel protected function _setFontBold($size = 7) { $font = \Zend_Pdf_Font::fontWithPath( - $this->_coreDir->getDir(\Magento\App\Dir::ROOT) . '/lib/LinLibertineFont/LinLibertine_Bd-2.8.1.ttf' + $this->_rootDirectory->getAbsolutePath('lib/LinLibertineFont/LinLibertine_Bd-2.8.1.ttf') ); $this->getPage()->setFont($font, $size); return $font; @@ -369,7 +369,7 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel protected function _setFontItalic($size = 7) { $font = \Zend_Pdf_Font::fontWithPath( - $this->_coreDir->getDir(\Magento\App\Dir::ROOT) . '/lib/LinLibertineFont/LinLibertine_It-2.8.2.ttf' + $this->_rootDirectory->getAbsolutePath('lib/LinLibertineFont/LinLibertine_It-2.8.2.ttf') ); $this->getPage()->setFont($font, $size); return $font; 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 e3151ecd8da..17062d58036 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\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -56,14 +56,14 @@ 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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->string = $string; - parent::__construct($context, $registry, $taxData, $coreDir, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $taxData, $filesystem, $resource, $resourceCollection, $data); } /** 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 c889863e2ff..3766f9b7aab 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\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -52,14 +52,14 @@ 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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->string = $string; - parent::__construct($context, $registry, $taxData, $coreDir, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $taxData, $filesystem, $resource, $resourceCollection, $data); } /** 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 209dbb3e153..78f3c612736 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\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -52,14 +52,14 @@ 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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->string = $string; - parent::__construct($context, $registry, $taxData, $coreDir, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $taxData, $filesystem, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php index d3dfe268480..3931271c5f0 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php @@ -41,7 +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\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem * @param \Magento\Shipping\Model\Config $shippingConfig * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory @@ -57,7 +57,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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Shipping\Model\Config $shippingConfig, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, @@ -72,7 +72,7 @@ class Shipment extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $string, $coreStoreConfig, $translate, - $coreDir, + $filesystem, $shippingConfig, $pdfConfig, $pdfTotalFactory, diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Shipment/Packaging.php b/app/code/Magento/Sales/Model/Order/Pdf/Shipment/Packaging.php index 697c4ce8801..ee7e820ae32 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Shipment/Packaging.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Shipment/Packaging.php @@ -53,7 +53,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\App\Dir $coreDir + * @param \Magento\Filesystem $filesystem * @param \Magento\Shipping\Model\Config $shippingConfig * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory @@ -71,7 +71,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\App\Dir $coreDir, + \Magento\Filesystem $filesystem, \Magento\Shipping\Model\Config $shippingConfig, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, @@ -91,7 +91,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $string, $coreStoreConfig, $translate, - $coreDir, + $filesystem, $shippingConfig, $pdfConfig, $pdfTotalFactory, diff --git a/app/code/Magento/Sales/Model/Quote.php b/app/code/Magento/Sales/Model/Quote.php index 89090bea6bd..94237560c1d 100644 --- a/app/code/Magento/Sales/Model/Quote.php +++ b/app/code/Magento/Sales/Model/Quote.php @@ -1649,7 +1649,7 @@ class Quote extends \Magento\Core\Model\AbstractModel } if (is_string($message)) { - $message = $this->messageFactory->error($message); + $message = $this->messageFactory->create(\Magento\Message\MessageInterface::TYPE_ERROR, $message); } $messages[$index] = $message; @@ -1682,7 +1682,7 @@ class Quote extends \Magento\Core\Model\AbstractModel $errors = array(); foreach ($this->getMessages() as $message) { /* @var $error \Magento\Message\AbstractMessage */ - if ($message->getType() == \Magento\Message\Factory::ERROR) { + if ($message->getType() == \Magento\Message\MessageInterface::TYPE_ERROR) { array_push($errors, $message); } } diff --git a/app/code/Magento/Sales/Model/Resource/Quote.php b/app/code/Magento/Sales/Model/Resource/Quote.php index 22f95944d03..d4ce4619310 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote.php +++ b/app/code/Magento/Sales/Model/Resource/Quote.php @@ -177,7 +177,7 @@ class Quote extends \Magento\Sales\Model\Resource\AbstractResource public function isOrderIncrementIdUsed($orderIncrementId) { $adapter = $this->_getReadAdapter(); - $bind = array(':increment_id' => (int)$orderIncrementId); + $bind = array(':increment_id' => $orderIncrementId); $select = $adapter->select(); $select->from($this->getTable('sales_flat_order'), 'entity_id') ->where('increment_id = :increment_id'); diff --git a/app/code/Magento/Sales/etc/adminhtml/menu.xml b/app/code/Magento/Sales/etc/adminhtml/menu.xml index 0777158997b..8e2ae9baa04 100644 --- a/app/code/Magento/Sales/etc/adminhtml/menu.xml +++ b/app/code/Magento/Sales/etc/adminhtml/menu.xml @@ -36,6 +36,6 @@ <add id="Magento_Sales::sales_transactions" title="Transactions" module="Magento_Sales" sortOrder="70" parent="Magento_Sales::sales_operation" action="sales/transactions" resource="Magento_Sales::transactions"/> <add id="Magento_Sales::sales_recurring_profile" title="Recurring Billing" module="Magento_Sales" sortOrder="80" parent="Magento_Sales::sales_operation" action="sales/recurring_profile" resource="Magento_Sales::recurring_profile"/> <add id="Magento_Sales::sales_billing_agreement" title="Billing Agreements" module="Magento_Sales" sortOrder="60" parent="Magento_Sales::sales_operation" action="sales/billing_agreement" resource="Magento_Sales::billing_agreement"/> - <add id="Magento_Sales::system_order_statuses" title="Order Status" module="Magento_Sales" sortOrder="40" parent="Magento_Adminhtml::stores_settings" action="sales/order_status" resource="Magento_Sales::order_statuses"/> + <add id="Magento_Sales::system_order_statuses" title="Order Status" module="Magento_Sales" sortOrder="40" parent="Magento_Backend::stores_settings" action="sales/order_status" resource="Magento_Sales::order_statuses"/> </menu> </config> diff --git a/app/code/Magento/Sales/etc/adminhtml/routes.xml b/app/code/Magento/Sales/etc/adminhtml/routes.xml index a5055bf8c1c..538b3f91297 100644 --- a/app/code/Magento/Sales/etc/adminhtml/routes.xml +++ b/app/code/Magento/Sales/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="sales" frontName="sales"> - <module name="Magento_Sales_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Sales" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Sales/etc/email_templates.xml b/app/code/Magento/Sales/etc/email_templates.xml index 7fb505d4d48..182c105c36f 100644 --- a/app/code/Magento/Sales/etc/email_templates.xml +++ b/app/code/Magento/Sales/etc/email_templates.xml @@ -24,20 +24,20 @@ */ --> <config> - <template id="sales_email_order_template" label="New Order" file="order_new.html" type="html"/> - <template id="sales_email_order_guest_template" label="New Order for Guest" file="order_new_guest.html" type="html"/> - <template id="sales_email_order_comment_template" label="Order Update" file="order_update.html" type="html"/> - <template id="sales_email_order_comment_guest_template" label="Order Update for Guest" file="order_update_guest.html" type="html"/> - <template id="sales_email_invoice_template" label="New Invoice" file="invoice_new.html" type="html"/> - <template id="sales_email_invoice_guest_template" label="New Invoice for Guest" file="invoice_new_guest.html" type="html"/> - <template id="sales_email_invoice_comment_template" label="Invoice Update" file="invoice_update.html" type="html"/> - <template id="sales_email_invoice_comment_guest_template" label="Invoice Update for Guest" file="invoice_update_guest.html" type="html"/> - <template id="sales_email_creditmemo_template" label="New Credit Memo" file="creditmemo_new.html" type="html"/> - <template id="sales_email_creditmemo_guest_template" label="New Credit Memo for Guest" file="creditmemo_new_guest.html" type="html"/> - <template id="sales_email_creditmemo_comment_template" label="Credit Memo Update" file="creditmemo_update.html" type="html"/> - <template id="sales_email_creditmemo_comment_guest_template" label="Credit Memo Update for Guest" file="creditmemo_update_guest.html" type="html"/> - <template id="sales_email_shipment_template" label="New Shipment" file="shipment_new.html" type="html"/> - <template id="sales_email_shipment_guest_template" label="New Shipment for Guest" file="shipment_new_guest.html" type="html"/> - <template id="sales_email_shipment_comment_template" label="Shipment Update" file="shipment_update.html" type="html"/> - <template id="sales_email_shipment_comment_guest_template" label="Shipment Update for Guest" file="shipment_update_guest.html" type="html"/> + <template id="sales_email_order_template" label="New Order" file="order_new.html" type="html" module="Magento_Sales"/> + <template id="sales_email_order_guest_template" label="New Order for Guest" file="order_new_guest.html" type="html" module="Magento_Sales"/> + <template id="sales_email_order_comment_template" label="Order Update" file="order_update.html" type="html" module="Magento_Sales"/> + <template id="sales_email_order_comment_guest_template" label="Order Update for Guest" file="order_update_guest.html" type="html" module="Magento_Sales"/> + <template id="sales_email_invoice_template" label="New Invoice" file="invoice_new.html" type="html" module="Magento_Sales"/> + <template id="sales_email_invoice_guest_template" label="New Invoice for Guest" file="invoice_new_guest.html" type="html" module="Magento_Sales"/> + <template id="sales_email_invoice_comment_template" label="Invoice Update" file="invoice_update.html" type="html" module="Magento_Sales"/> + <template id="sales_email_invoice_comment_guest_template" label="Invoice Update for Guest" file="invoice_update_guest.html" type="html" module="Magento_Sales"/> + <template id="sales_email_creditmemo_template" label="New Credit Memo" file="creditmemo_new.html" type="html" module="Magento_Sales"/> + <template id="sales_email_creditmemo_guest_template" label="New Credit Memo for Guest" file="creditmemo_new_guest.html" type="html" module="Magento_Sales"/> + <template id="sales_email_creditmemo_comment_template" label="Credit Memo Update" file="creditmemo_update.html" type="html" module="Magento_Sales"/> + <template id="sales_email_creditmemo_comment_guest_template" label="Credit Memo Update for Guest" file="creditmemo_update_guest.html" type="html" module="Magento_Sales"/> + <template id="sales_email_shipment_template" label="New Shipment" file="shipment_new.html" type="html" module="Magento_Sales"/> + <template id="sales_email_shipment_guest_template" label="New Shipment for Guest" file="shipment_new_guest.html" type="html" module="Magento_Sales"/> + <template id="sales_email_shipment_comment_template" label="Shipment Update" file="shipment_update.html" type="html" module="Magento_Sales"/> + <template id="sales_email_shipment_comment_guest_template" label="Shipment Update for Guest" file="shipment_update_guest.html" type="html" module="Magento_Sales"/> </config> diff --git a/app/code/Magento/Sales/etc/module.xml b/app/code/Magento/Sales/etc/module.xml index bc071ade3f9..f2f316ec276 100755 --- a/app/code/Magento/Sales/etc/module.xml +++ b/app/code/Magento/Sales/etc/module.xml @@ -38,7 +38,6 @@ <module name="Magento_Core"/> <module name="Magento_Checkout"/> <module name="Magento_Theme"/> - <module name="Magento_Adminhtml"/> <module name="Magento_SalesRule"/> <module name="Magento_Backend"/> <module name="Magento_Widget"/> 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 37a2af6e41c..b6cfd2699fe 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 @@ -52,35 +52,35 @@ <updater>Magento\Sales\Model\Order\Grid\Massaction\ItemsUpdater</updater> <item name="cancel_order" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Cancel</item> - <item name="url" xsi:type="string">adminhtml/sales_order/massCancel</item> + <item name="url" xsi:type="string">sales/order/massCancel</item> </item> <item name="hold_order" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Hold</item> - <item name="url" xsi:type="string">adminhtml/sales_order/massHold</item> + <item name="url" xsi:type="string">sales/order/massHold</item> </item> <item name="unhold_order" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Unhold</item> - <item name="url" xsi:type="string">adminhtml/sales_order/massUnhold</item> + <item name="url" xsi:type="string">sales/order/massUnhold</item> </item> <item name="pdfinvoices_order" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Print Invoices</item> - <item name="url" xsi:type="string">adminhtml/sales_order/pdfinvoices</item> + <item name="url" xsi:type="string">sales/order/pdfinvoices</item> </item> <item name="pdfshipments_order" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Print Packing Slips</item> - <item name="url" xsi:type="string">adminhtml/sales_order/pdfshipments</item> + <item name="url" xsi:type="string">sales/order/pdfshipments</item> </item> <item name="pdfcreditmemos_order" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Print Credit Memos</item> - <item name="url" xsi:type="string">adminhtml/sales_order/pdfcreditmemos</item> + <item name="url" xsi:type="string">sales/order/pdfcreditmemos</item> </item> <item name="pdfdocs_order" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Print All</item> - <item name="url" xsi:type="string">adminhtml/sales_order/pdfdocs</item> + <item name="url" xsi:type="string">sales/order/pdfdocs</item> </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">adminhtml/sales_order_shipment/massPrintShippingLabel</item> + <item name="url" xsi:type="string">sales/order_shipment/massPrintShippingLabel</item> </item> </argument> </arguments> @@ -89,11 +89,11 @@ <arguments> <argument name="exportTypes" xsi:type="array"> <item name="csv" xsi:type="array"> - <item name="urlPath" xsi:type="string">adminhtml/*/exportCsv</item> + <item name="urlPath" xsi:type="string">sales/*/exportCsv</item> <item name="label" xsi:type="string" translate="true">CSV</item> </item> <item name="excel" xsi:type="array"> - <item name="urlPath" xsi:type="string">adminhtml/*/exportExcel</item> + <item name="urlPath" xsi:type="string">sales/*/exportExcel</item> <item name="label" xsi:type="string" translate="true">Excel XML</item> </item> </argument> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_recurring_profile_view.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_recurring_profile_view.xml index ca3b850eaab..75b3d904f33 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_recurring_profile_view.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_recurring_profile_view.xml @@ -32,7 +32,7 @@ </block> </referenceContainer> <referenceContainer name="left"> - <block class="Magento\Adminhtml\Block\Widget\Tabs" name="sales.recurring.profile.view.tabs"> + <block class="Magento\Backend\Block\Widget\Tabs" name="sales.recurring.profile.view.tabs"> <action method="setDestElementId"> <argument name="value" xsi:type="string">sales_recurring_profile_view</argument> </action> diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging.js b/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging.js index 9c499151444..93a447ee8b5 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging.js +++ b/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging.js @@ -36,7 +36,6 @@ Packaging.prototype = { this.errorQtyOverLimit = params.errorQtyOverLimit; this.titleDisabledSaveBtn = params.titleDisabledSaveBtn; this.window = $('packaging_window'); - this.windowMask = $('popup-window-mask'); this.messages = this.window.select('.messages')[0]; this.packagesContent = $('packages_content'); this.template = $('package_template'); @@ -92,14 +91,10 @@ Packaging.prototype = { this.window.show().setStyle({ 'marginLeft': -this.window.getDimensions().width/2 + 'px' }); - this.windowMask.setStyle({ - height: $('html-body').getHeight() + 'px' - }).show(); }, cancelPackaging: function() { packaging.window.hide(); - packaging.windowMask.hide(); if (Object.isFunction(this.cancelCallback)) { this.cancelCallback(); } diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote.php index e4466f646f4..5527b651c82 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote.php @@ -35,7 +35,7 @@ namespace Magento\SalesRule\Block\Adminhtml\Promo; -class Quote extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Quote extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() { diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit.php index aa98feffc2b..997d2fca006 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit.php @@ -30,7 +30,7 @@ namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons.php index fa494fe850c..9a58e6ef156 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons.php @@ -35,7 +35,7 @@ namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab; class Coupons extends \Magento\Backend\Block\Text\ListText - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** * Core registry diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Form.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Form.php index 1cb87a9ccbd..b8a78e66e1f 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Form.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Form.php @@ -65,7 +65,7 @@ class Form /** * Prepare coupon codes generation parameters form * - * @return \Magento\Adminhtml\Block\Widget\Form + * @return \Magento\Backend\Block\Widget\Form */ protected function _prepareForm() { diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid.php index 41f63e6d800..aa53653b5bf 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid.php @@ -34,7 +34,7 @@ */ namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Core registry @@ -51,6 +51,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\SalesRule\Model\Resource\Coupon\CollectionFactory $salesRuleCoupon * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data @@ -58,13 +59,14 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\SalesRule\Model\Resource\Coupon\CollectionFactory $salesRuleCoupon, \Magento\Core\Model\Registry $coreRegistry, array $data = array() ) { $this->_coreRegistry = $coreRegistry; $this->_salesRuleCoupon = $salesRuleCoupon; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** @@ -80,7 +82,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare collection for grid * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareCollection() { @@ -101,7 +103,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * Define grid columns * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php index e4e60d31ae6..a8411dcb594 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php @@ -34,7 +34,7 @@ namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid\Column\Renderer; class Used - extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Text + extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text { public function render(\Magento\Object $row) { diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php index ccf44447722..a3d9b0eee43 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php @@ -298,7 +298,7 @@ class Main // field dependencies $this->setChild('form_after', $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Widget\Form\Element\Dependence') + ->createBlock('Magento\Backend\Block\Widget\Form\Element\Dependence') ->addFieldMap($couponTypeFiled->getHtmlId(), $couponTypeFiled->getName()) ->addFieldMap($couponCodeFiled->getHtmlId(), $couponCodeFiled->getName()) ->addFieldMap($autoGenerationCheckbox->getHtmlId(), $autoGenerationCheckbox->getName()) diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tabs.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tabs.php index 3edb6cb149e..3f4acf11134 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tabs.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tabs.php @@ -34,7 +34,7 @@ */ namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit; -class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs +class Tabs extends \Magento\Backend\Block\Widget\Tabs { protected function _construct() diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php index 0a3d7b0305f..15f454ab208 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php @@ -110,8 +110,7 @@ class Quote extends \Magento\Backend\App\Action if ($id) { $model->load($id); if (! $model->getRuleId()) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('This rule no longer exists.')); + $this->messageManager->addError(__('This rule no longer exists.')); $this->_redirect('sales_rule/*'); return; } @@ -120,7 +119,7 @@ class Quote extends \Magento\Backend\App\Action $this->_title->add($model->getRuleId() ? $model->getName() : __('New Cart Price Rule')); // set entered data if was error when we do save - $data = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getPageData(true); + $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getPageData(true); if (!empty($data)) { $model->addData($data); } @@ -168,12 +167,12 @@ class Quote extends \Magento\Backend\App\Action } } - $session = $this->_objectManager->get('Magento\Adminhtml\Model\Session'); + $session = $this->_objectManager->get('Magento\Backend\Model\Session'); $validateResult = $model->validateData(new \Magento\Object($data)); if ($validateResult !== true) { foreach ($validateResult as $errorMessage) { - $session->addError($errorMessage); + $this->messageManager->addError($errorMessage); } $session->setPageData($data); $this->_redirect('sales_rule/*/edit', array('id'=>$model->getId())); @@ -200,7 +199,7 @@ class Quote extends \Magento\Backend\App\Action $session->setPageData($model->getData()); $model->save(); - $session->addSuccess(__('The rule has been saved.')); + $this->messageManager->addSuccess(__('The rule has been saved.')); $session->setPageData(false); if ($this->getRequest()->getParam('back')) { $this->_redirect('sales_rule/*/edit', array('id' => $model->getId())); @@ -209,7 +208,7 @@ class Quote extends \Magento\Backend\App\Action $this->_redirect('sales_rule/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $id = (int)$this->getRequest()->getParam('rule_id'); if (!empty($id)) { $this->_redirect('sales_rule/*/edit', array('id' => $id)); @@ -219,10 +218,11 @@ class Quote extends \Magento\Backend\App\Action return; } catch (\Exception $e) { - $this->_getSession()->addError( - __('An error occurred while saving the rule data. Please review the log and try again.')); + $this->messageManager->addError( + __('An error occurred while saving the rule data. Please review the log and try again.') + ); $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setPageData($data); + $this->_objectManager->get('Magento\Backend\Model\Session')->setPageData($data); $this->_redirect('sales_rule/*/edit', array('id' => $this->getRequest()->getParam('rule_id'))); return; } @@ -238,22 +238,20 @@ class Quote extends \Magento\Backend\App\Action $model = $this->_objectManager->create('Magento\SalesRule\Model\Rule'); $model->load($id); $model->delete(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('The rule has been deleted.')); + $this->messageManager->addSuccess(__('The rule has been deleted.')); $this->_redirect('sales_rule/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addError( + $this->messageManager->addError( __('An error occurred while deleting the rule. Please review the log and try again.')); $this->_objectManager->get('Magento\Logger')->logException($e); $this->_redirect('sales_rule/*/edit', array('id' => $this->getRequest()->getParam('id'))); return; } } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('We can\'t find a rule to delete.')); + $this->messageManager->addError(__('We can\'t find a rule to delete.')); $this->_redirect('sales_rule/*/'); } @@ -420,8 +418,8 @@ class Quote extends \Magento\Backend\App\Action $generator->setData($data); $generator->generatePool(); $generated = $generator->getGeneratedCount(); - $this->_getSession()->addSuccess(__('%1 coupon(s) have been generated.', $generated)); - $this->_view->getLayout()->initMessages('Magento\Adminhtml\Model\Session'); + $this->messageManager->addSuccess(__('%1 coupon(s) have been generated.', $generated)); + $this->_view->getLayout()->initMessages(); $result['messages'] = $this->_view->getLayout()->getMessagesBlock()->getGroupedHtml(); } } catch (\Magento\Core\Exception $e) { diff --git a/app/code/Magento/SalesRule/Model/Observer.php b/app/code/Magento/SalesRule/Model/Observer.php index 7d48f180c36..919f2e5e534 100644 --- a/app/code/Magento/SalesRule/Model/Observer.php +++ b/app/code/Magento/SalesRule/Model/Observer.php @@ -64,9 +64,9 @@ class Observer protected $_collectionFactory; /** - * @var \Magento\Backend\Model\Session + * @var \Magento\Message\ManagerInterface */ - protected $_backendSession; + protected $messageManager; /** * @param \Magento\SalesRule\Model\RuleFactory $ruleFactory @@ -76,7 +76,7 @@ class Observer * @param \Magento\SalesRule\Model\Resource\Report\Rule $reportRule * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\SalesRule\Model\Resource\Rule\CollectionFactory $collectionFactory - * @param \Magento\Backend\Model\Session $backendSession + * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( \Magento\SalesRule\Model\RuleFactory $ruleFactory, @@ -86,7 +86,7 @@ class Observer \Magento\SalesRule\Model\Resource\Report\Rule $reportRule, \Magento\Core\Model\LocaleInterface $locale, \Magento\SalesRule\Model\Resource\Rule\CollectionFactory $collectionFactory, - \Magento\Backend\Model\Session $backendSession + \Magento\Message\ManagerInterface $messageManager ) { $this->_ruleFactory = $ruleFactory; $this->_ruleCustomerFactory = $ruleCustomerFactory; @@ -95,7 +95,7 @@ class Observer $this->_reportRule = $reportRule; $this->_locale = $locale; $this->_collectionFactory = $collectionFactory; - $this->_backendSession = $backendSession; + $this->messageManager = $messageManager; } /** @@ -198,7 +198,7 @@ class Observer } if ($disabledRulesCount) { - $this->_backendSession->addWarning(__( + $this->messageManager->addWarning(__( '%1 Shopping Cart Price Rules based on "%2" attribute have been disabled.', $disabledRulesCount, $attributeCode diff --git a/app/code/Magento/SalesRule/Model/Resource/Coupon/Collection.php b/app/code/Magento/SalesRule/Model/Resource/Coupon/Collection.php index 0ba6cc53456..936a022d11c 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Coupon/Collection.php +++ b/app/code/Magento/SalesRule/Model/Resource/Coupon/Collection.php @@ -94,7 +94,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * Callback function that filters collection by field "Used" from grid * * @param \Magento\Core\Model\Resource\Db\Collection\AbstractCollection $collection - * @param \Magento\Adminhtml\Block\Widget\Grid\Column $column + * @param \Magento\Backend\Block\Widget\Grid\Column $column */ public function addIsUsedFilterCallback($collection, $column) { diff --git a/app/code/Magento/SalesRule/etc/adminhtml/routes.xml b/app/code/Magento/SalesRule/etc/adminhtml/routes.xml index 3c89225e3cc..61f5f446892 100644 --- a/app/code/Magento/SalesRule/etc/adminhtml/routes.xml +++ b/app/code/Magento/SalesRule/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="sales_rule" frontName="sales_rule"> - <module name="Magento_SalesRule_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_SalesRule" before="Magento_Adminhtml" /> </route> </router> </config> diff --git a/app/code/Magento/SalesRule/etc/di.xml b/app/code/Magento/SalesRule/etc/di.xml index 5faa35ed43a..1d7bc5ca025 100644 --- a/app/code/Magento/SalesRule/etc/di.xml +++ b/app/code/Magento/SalesRule/etc/di.xml @@ -28,11 +28,6 @@ <type name="Magento\Sales\Model\Quote\Config"> <plugin name="append_sales_rule_keys_to_quote" type="Magento\SalesRule\Model\Plugin\QuoteConfigProductAttributes"/> </type> - <type name="Magento\SalesRule\Model\Observer"> - <param name="backendSession"> - <instance type="Magento\Backend\Model\Session\Proxy" /> - </param> - </type> <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> diff --git a/app/code/Magento/Sendfriend/Controller/Product.php b/app/code/Magento/Sendfriend/Controller/Product.php index e3686855ab2..c611abf1682 100644 --- a/app/code/Magento/Sendfriend/Controller/Product.php +++ b/app/code/Magento/Sendfriend/Controller/Product.php @@ -70,7 +70,7 @@ class Product extends \Magento\App\Action\Action * If allow only for customer - redirect to login page * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface * @throws \Magento\App\Action\NotFoundException */ public function dispatch(RequestInterface $request) @@ -164,13 +164,13 @@ class Product extends \Magento\App\Action\Action $catalogSession = $this->_objectManager->get('Magento\Catalog\Model\Session'); if ($model->getMaxSendsToFriend() && $model->isExceedLimit()) { - $catalogSession->addNotice( + $this->messageManager->addNotice( __('You can\'t send messages more than %1 times an hour.', $model->getMaxSendsToFriend()) ); } $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages('Magento\Catalog\Model\Session'); + $this->_view->getLayout()->initMessages(); $this->_eventManager->dispatch('sendfriend_product', array('product' => $product)); $data = $catalogSession->getSendfriendFormData(); @@ -222,7 +222,7 @@ class Product extends \Magento\App\Action\Action $validate = $model->validate(); if ($validate === true) { $model->send(); - $catalogSession->addSuccess(__('The link to a friend was sent.')); + $this->messageManager->addSuccess(__('The link to a friend was sent.')); $url = $product->getProductUrl(); $this->getResponse()->setRedirect($this->_redirect->success($url)); return; @@ -230,16 +230,16 @@ class Product extends \Magento\App\Action\Action else { if (is_array($validate)) { foreach ($validate as $errorMessage) { - $catalogSession->addError($errorMessage); + $this->messageManager->addError($errorMessage); } } else { - $catalogSession->addError(__('We found some problems with the data.')); + $this->messageManager->addError(__('We found some problems with the data.')); } } } catch (\Magento\Core\Exception $e) { - $catalogSession->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $catalogSession->addException($e, __('Some emails were not sent.')); + $this->messageManager->addException($e, __('Some emails were not sent.')); } // save form data diff --git a/app/code/Magento/Sendfriend/etc/email_templates.xml b/app/code/Magento/Sendfriend/etc/email_templates.xml index c223e2d02c1..619a8313a2f 100644 --- a/app/code/Magento/Sendfriend/etc/email_templates.xml +++ b/app/code/Magento/Sendfriend/etc/email_templates.xml @@ -24,5 +24,5 @@ */ --> <config> - <template id="sendfriend_email_template" label="Send Product Link to Friend" file="product_share.html" type="html"/> + <template id="sendfriend_email_template" label="Send Product Link to Friend" file="product_share.html" type="html" module="Magento_Sendfriend"/> </config> diff --git a/app/code/Magento/Shipping/Block/Adminhtml/Carrier/Tablerate/Grid.php b/app/code/Magento/Shipping/Block/Adminhtml/Carrier/Tablerate/Grid.php index eb157f296f0..722a3b0650c 100644 --- a/app/code/Magento/Shipping/Block/Adminhtml/Carrier/Tablerate/Grid.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/Carrier/Tablerate/Grid.php @@ -34,7 +34,7 @@ */ namespace Magento\Shipping\Block\Adminhtml\Carrier\Tablerate; -class Grid extends \Magento\Adminhtml\Block\Widget\Grid +class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** * Website filter @@ -63,6 +63,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Shipping\Model\Resource\Carrier\Tablerate\CollectionFactory $collectionFactory * @param \Magento\Shipping\Model\Carrier\Tablerate $tablerate * @param array $data @@ -70,13 +71,14 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Shipping\Model\Resource\Carrier\Tablerate\CollectionFactory $collectionFactory, \Magento\Shipping\Model\Carrier\Tablerate $tablerate, array $data = array() ) { $this->_collectionFactory = $collectionFactory; $this->_tablerate = $tablerate; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } /** @@ -158,7 +160,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare table columns * - * @return \Magento\Adminhtml\Block\Widget\Grid + * @return \Magento\Backend\Block\Widget\Grid\Extended */ protected function _prepareColumns() { diff --git a/app/code/Magento/Shipping/Model/Resource/Carrier/Tablerate.php b/app/code/Magento/Shipping/Model/Resource/Carrier/Tablerate.php index b0cb9f2bfaa..f74ee0180c7 100644 --- a/app/code/Magento/Shipping/Model/Resource/Carrier/Tablerate.php +++ b/app/code/Magento/Shipping/Model/Resource/Carrier/Tablerate.php @@ -129,6 +129,12 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected $_regionCollFactory; + /** + * Filesystem instance + * + * @var \Magento\Filesystem + */ + protected $_filesystem; /** * @param \Magento\App\Resource $resource @@ -138,6 +144,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb * @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 */ public function __construct( \Magento\App\Resource $resource, @@ -146,7 +153,8 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb \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\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, + \Magento\Filesystem $filesystem ) { parent::__construct($resource); $this->_coreConfig = $coreConfig; @@ -155,6 +163,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb $this->_carrierTablerate = $carrierTablerate; $this->_countryCollFactory = $countryCollFactory; $this->_regionCollFactory = $regionCollFactory; + $this->_filesystem = $filesystem; } /** @@ -190,19 +199,19 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb // Render destination condition $orWhere = '(' . implode(') OR (', array( - "dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = :postcode", - "dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = ''", - - // Handle asterix in dest_zip field - "dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = '*'", - "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = '*'", - "dest_country_id = '0' AND dest_region_id = :region_id AND dest_zip = '*'", - "dest_country_id = '0' AND dest_region_id = 0 AND dest_zip = '*'", - - "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = ''", - "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = :postcode", - "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = '*'", - )) . ')'; + "dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = :postcode", + "dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = ''", + + // Handle asterix in dest_zip field + "dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = '*'", + "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = '*'", + "dest_country_id = '0' AND dest_region_id = :region_id AND dest_zip = '*'", + "dest_country_id = '0' AND dest_region_id = 0 AND dest_zip = '*'", + + "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = ''", + "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = :postcode", + "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = '*'", + )) . ')'; $select->where($orWhere); // Render condition by condition name @@ -243,6 +252,8 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb * @param \Magento\Object $object * @throws \Magento\Core\Exception * @return \Magento\Shipping\Model\Resource\Carrier\Tablerate + * @todo: this method should be refactored as soon as updated design will be provided + * @see https://wiki.corp.x.com/display/MCOMS/Magento+Filesystem+Decisions */ public function uploadAndImport(\Magento\Object $object) { @@ -258,15 +269,14 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb $this->_importErrors = array(); $this->_importedRows = 0; - $io = new \Magento\Io\File(); - $info = pathinfo($csvFile); - $io->open(array('path' => $info['dirname'])); - $io->streamOpen($info['basename'], 'r'); + $tmpDirectory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::SYS_TMP); + $path = $tmpDirectory->getRelativePath($csvFile); + $stream = $tmpDirectory->openFile($path); // check and skip headers - $headers = $io->streamReadCsv(); + $headers = $stream->readCsv(); if ($headers === false || count($headers) < 5) { - $io->streamClose(); + $stream->close(); throw new \Magento\Core\Exception(__('Please correct Table Rates File Format.')); } @@ -294,7 +304,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb ); $adapter->delete($this->getMainTable(), $condition); - while (false !== ($csvLine = $io->streamReadCsv())) { + while (false !== ($csvLine = $stream->readCsv())) { $rowNumber ++; if (empty($csvLine)) { @@ -312,14 +322,14 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb } } $this->_saveImportData($importData); - $io->streamClose(); + $stream->close(); } catch (\Magento\Core\Exception $e) { $adapter->rollback(); - $io->streamClose(); + $stream->close(); throw new \Magento\Core\Exception($e->getMessage()); } catch (\Exception $e) { $adapter->rollback(); - $io->streamClose(); + $stream->close(); $this->_logger->logException($e); throw new \Magento\Core\Exception(__('Something went wrong while importing table rates.')); } diff --git a/app/code/Magento/Shipping/Model/Shipping/Labels.php b/app/code/Magento/Shipping/Model/Shipping/Labels.php index dbfdb0d62c7..83da0814851 100644 --- a/app/code/Magento/Shipping/Model/Shipping/Labels.php +++ b/app/code/Magento/Shipping/Model/Shipping/Labels.php @@ -37,6 +37,11 @@ class Labels extends \Magento\Shipping\Model\Shipping */ protected $_authSession; + /** + * @var \Magento\Shipping\Model\Shipment\Request + */ + protected $_request; + /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Shipping\Model\Config $shippingConfig @@ -57,9 +62,11 @@ class Labels extends \Magento\Shipping\Model\Shipping \Magento\Shipping\Model\Rate\RequestFactory $rateRequestFactory, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Math\Division $mathDivision, - \Magento\Backend\Model\Auth\Session $authSession + \Magento\Backend\Model\Auth\Session $authSession, + \Magento\Shipping\Model\Shipment\Request $request ) { $this->_authSession = $authSession; + $this->_request = $request; parent::__construct( $coreStoreConfig, $shippingConfig, @@ -113,7 +120,7 @@ class Labels extends \Magento\Shipping\Model\Shipping } /** @var $request \Magento\Shipping\Model\Shipment\Request */ - $request = $this->_rateRequestFactory->create(); + $request = $this->_request; $request->setOrderShipment($orderShipment); $request->setShipperContactPersonName($admin->getName()); $request->setShipperContactPersonFirstName($admin->getFirstname()); diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Edit.php b/app/code/Magento/Sitemap/Block/Adminhtml/Edit.php index 2284967977c..3c4f963b263 100644 --- a/app/code/Magento/Sitemap/Block/Adminhtml/Edit.php +++ b/app/code/Magento/Sitemap/Block/Adminhtml/Edit.php @@ -33,7 +33,7 @@ */ namespace Magento\Sitemap\Block\Adminhtml; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Action.php b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Action.php index a1e4ad55a8b..3de8735da07 100644 --- a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Action.php +++ b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Action.php @@ -32,7 +32,7 @@ */ namespace Magento\Sitemap\Block\Adminhtml\Grid\Renderer; -class Action extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Action +class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action { public function render(\Magento\Object $row) { 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 5f4a69c698a..a59619be861 100644 --- a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Link.php +++ b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Link.php @@ -32,7 +32,7 @@ */ namespace Magento\Sitemap\Block\Adminhtml\Grid\Renderer; -class Link extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Link extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * @var \Magento\Filesystem $filesystem @@ -74,7 +74,8 @@ class Link extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Abstract $url = $this->escapeHtml($sitemap->getSitemapUrl($row->getSitemapPath(), $row->getSitemapFilename())); $fileName = preg_replace('/^\//', '', $row->getSitemapPath() . $row->getSitemapFilename()); - if ($this->_filesystem->isFile(BP . DS . $fileName)) { + $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + if ($directory->isFile($fileName)) { return sprintf('<a href="%1$s">%1$s</a>', $url); } diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Time.php b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Time.php index c92d0bd57f2..f8e4f699f3f 100644 --- a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Time.php +++ b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Time.php @@ -32,7 +32,7 @@ */ namespace Magento\Sitemap\Block\Adminhtml\Grid\Renderer; -class Time extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Time extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * @var \Magento\Core\Model\Date diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Sitemap.php b/app/code/Magento/Sitemap/Block/Adminhtml/Sitemap.php index 4343064b579..b90949cc565 100644 --- a/app/code/Magento/Sitemap/Block/Adminhtml/Sitemap.php +++ b/app/code/Magento/Sitemap/Block/Adminhtml/Sitemap.php @@ -32,7 +32,7 @@ */ namespace Magento\Sitemap\Block\Adminhtml; -class Sitemap extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Sitemap extends \Magento\Backend\Block\Widget\Grid\Container { /** diff --git a/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php b/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php index e3e67a4baf5..6dfb749ce49 100644 --- a/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php +++ b/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php @@ -107,8 +107,7 @@ class Sitemap extends \Magento\Backend\App\Action if ($id) { $model->load($id); if (! $model->getId()) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('This sitemap no longer exists.')); + $this->messageManager->addError(__('This sitemap no longer exists.')); $this->_redirect('adminhtml/*/'); return; } @@ -117,7 +116,7 @@ class Sitemap extends \Magento\Backend\App\Action $this->_title->add($model->getId() ? $model->getSitemapFilename() : __('New Site Map')); // 3. Set entered data if was error when we do save - $data = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getFormData(true); + $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getFormData(true); if (!empty($data)) { $model->setData($data); } @@ -150,7 +149,7 @@ class Sitemap extends \Magento\Backend\App\Action //validate path to generate if (!empty($data['sitemap_filename']) && !empty($data['sitemap_path'])) { $path = rtrim($data['sitemap_path'], '\\/') - . DS . $data['sitemap_filename']; + . '/' . $data['sitemap_filename']; /** @var $validator \Magento\Core\Model\File\Validator\AvailablePath */ $validator = $this->_objectManager->create('Magento\Core\Model\File\Validator\AvailablePath'); /** @var $helper \Magento\Catalog\Helper\Catalog */ @@ -158,10 +157,10 @@ class Sitemap extends \Magento\Backend\App\Action $validator->setPaths($helper->getSitemapValidPaths()); if (!$validator->isValid($path)) { foreach ($validator->getMessages() as $message) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($message); + $this->messageManager->addError($message); } // save data in session - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setFormData($data); + $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData($data); // redirect to edit form $this->_redirect('adminhtml/*/edit', array( 'sitemap_id' => $this->getRequest()->getParam('sitemap_id'))); @@ -169,21 +168,17 @@ class Sitemap extends \Magento\Backend\App\Action } } - /** @var \Magento\Filesystem $filesystem */ - $filesystem = $this->_objectManager->get('Magento\Filesystem'); + /** @var \Magento\Filesystem\Directory\Write $directory */ + $directory = $this->_objectManager->get('Magento\Filesystem') + ->getDirectoryWrite(\Magento\Filesystem::ROOT); if ($this->getRequest()->getParam('sitemap_id')) { $model->load($this->getRequest()->getParam('sitemap_id')); $fileName = $model->getSitemapFilename(); - $filesystem->setWorkingDirectory( - $this->_objectManager->get('Magento\App\Dir')->getDir() . $model->getSitemapPath() - ); - $filePath = $this->_objectManager->get('Magento\App\Dir')->getDir() - . $model->getSitemapPath() . DS . $fileName; - - if ($fileName && $filesystem->isFile($filePath)) { - $filesystem->delete($filePath); + $path = $model->getSitemapPath() . '/' . $fileName; + if ($fileName && $directory->isFile($path)) { + $directory->delete($path); } } @@ -194,10 +189,9 @@ class Sitemap extends \Magento\Backend\App\Action // save the data $model->save(); // display success message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('The sitemap has been saved.')); + $this->messageManager->addSuccess(__('The sitemap has been saved.')); // clear previously saved data from session - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setFormData(false); + $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData(false); // check if 'Save and Continue' if ($this->getRequest()->getParam('back')) { @@ -215,9 +209,9 @@ class Sitemap extends \Magento\Backend\App\Action } catch (\Exception $e) { // display error message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); // save data in session - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setFormData($data); + $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData($data); // redirect to edit form $this->_redirect('adminhtml/*/edit', array( 'sitemap_id' => $this->getRequest()->getParam('sitemap_id'))); @@ -233,8 +227,10 @@ class Sitemap extends \Magento\Backend\App\Action */ public function deleteAction() { - /** @var \Magento\Filesystem $filesystem */ - $filesystem = $this->_objectManager->get('Magento\Filesystem'); + /** @var \Magento\Filesystem\Directory\Write $directory */ + $directory = $this->_objectManager->get('Magento\Filesystem') + ->getDirectoryWrite(\Magento\Filesystem::ROOT); + // check if we know what should be deleted $id = $this->getRequest()->getParam('sitemap_id'); if ($id) { @@ -247,28 +243,27 @@ class Sitemap extends \Magento\Backend\App\Action /* @var $sitemap \Magento\Sitemap\Model\Sitemap */ $model->load($id); // delete file - if ($model->getSitemapFilename() && $filesystem->isFile($model->getPreparedFilename())) { - $filesystem->delete($model->getPreparedFilename()); + $path = $directory->getRelativePath($model->getPreparedFilename()); + if ($model->getSitemapFilename() && $directory->isFile($path)) { + $directory->delete($path); } $model->delete(); // display success message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( - __('The sitemap has been deleted.')); + $this->messageManager->addSuccess(__('The sitemap has been deleted.')); // go to grid $this->_redirect('adminhtml/*/'); return; } catch (\Exception $e) { // display error message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); // go back to edit form $this->_redirect('adminhtml/*/edit', array('sitemap_id' => $id)); return; } } // display error message - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( - __('We can\'t find a sitemap to delete.')); + $this->messageManager->addError(__('We can\'t find a sitemap to delete.')); // go to grid $this->_redirect('adminhtml/*/'); } @@ -288,16 +283,16 @@ class Sitemap extends \Magento\Backend\App\Action try { $sitemap->generateXml(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('The sitemap "%1" has been generated.', $sitemap->getSitemapFilename())); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException($e, + $this->messageManager->addException($e, __('Something went wrong generating the sitemap.')); } } else { - $this->_getSession()->addError( + $this->messageManager->addError( __('We can\'t find a sitemap to generate.')); } diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index 2fef4b339d7..876144157de 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -57,13 +57,6 @@ class Sitemap extends \Magento\Core\Model\AbstractModel */ protected $_filePath; - /** - * File handler - * - * @var \Magento\Io\File - */ - protected $_fileHandler; - /** * Sitemap items * @@ -107,9 +100,14 @@ class Sitemap extends \Magento\Core\Model\AbstractModel private $_crlf = array("win" => "\r\n", "unix" => "\n", "mac" => "\r"); /** - * @var \Magento\Filesystem $filesystem + * @var \Magento\Filesystem\Directory\Write */ - protected $_filesystem; + protected $_directory; + + /** + * @var \Magento\Filesystem\File\Write + */ + protected $_stream; /** * Sitemap data @@ -143,11 +141,6 @@ class Sitemap extends \Magento\Core\Model\AbstractModel */ protected $_dateModel; - /** - * @var \Magento\App\Dir - */ - protected $_dirModel; - /** * @var \Magento\Core\Model\StoreManagerInterface */ @@ -173,7 +166,6 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * @param \Magento\Sitemap\Model\Resource\Catalog\ProductFactory $productFactory * @param \Magento\Sitemap\Model\Resource\Cms\PageFactory $cmsFactory * @param \Magento\Core\Model\Date $modelDate - * @param \Magento\App\Dir $dirModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\RequestInterface $request * @param \Magento\Stdlib\DateTime $dateTime @@ -191,7 +183,6 @@ class Sitemap extends \Magento\Core\Model\AbstractModel \Magento\Sitemap\Model\Resource\Catalog\ProductFactory $productFactory, \Magento\Sitemap\Model\Resource\Cms\PageFactory $cmsFactory, \Magento\Core\Model\Date $modelDate, - \Magento\App\Dir $dirModel, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\RequestInterface $request, \Magento\Stdlib\DateTime $dateTime, @@ -201,12 +192,11 @@ class Sitemap extends \Magento\Core\Model\AbstractModel ) { $this->_escaper = $escaper; $this->_sitemapData = $sitemapData; - $this->_filesystem = $filesystem; + $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); $this->_categoryFactory = $categoryFactory; $this->_productFactory = $productFactory; $this->_cmsFactory = $cmsFactory; $this->_dateModel = $modelDate; - $this->_dirModel = $dirModel; $this->_storeManager = $storeManager; $this->_request = $request; $this->dateTime = $dateTime; @@ -224,13 +214,13 @@ class Sitemap extends \Magento\Core\Model\AbstractModel /** * Get file handler * + * @return \Magento\Filesystem\File\WriteInterface * @throws \Magento\Core\Exception - * @return \Magento\Io\File */ - protected function _getFileHandler() + protected function _getStream() { - if ($this->_fileHandler) { - return $this->_fileHandler; + if ($this->_stream) { + return $this->_stream; } else { throw new \Magento\Core\Exception(__('File handler unreachable')); } @@ -282,31 +272,28 @@ class Sitemap extends \Magento\Core\Model\AbstractModel /** * Check sitemap file location and permissions * - * @throws \Magento\Core\Exception * @return \Magento\Core\Model\AbstractModel + * @throws \Magento\Core\Exception */ protected function _beforeSave() { - $file = $this->_getFileObject(); - $realPath = $file->getCleanPath($this->_getBaseDir() . '/' . $this->getSitemapPath()); + $path = $this->getSitemapPath(); /** * Check path is allow */ - /** @var $helper \Magento\Sitemap\Helper\Data */ - $helper = $this->_sitemapData; - if (!$file->allowedPath($realPath, $this->_getBaseDir())) { + if ($path && preg_match('#\.\.[\\\/]#', $path)) { throw new \Magento\Core\Exception(__('Please define a correct path.')); } /** - * Check exists and writeable path + * Check exists and writable path */ - if (!$file->fileExists($realPath, false)) { + if (!$this->_directory->isExist($path)) { throw new \Magento\Core\Exception(__('Please create the specified folder "%1" before saving the sitemap.', $this->_escaper->escapeHtml($this->getSitemapPath()))); } - if (!$file->isWriteable($realPath)) { + if (!$this->_directory->isWritable($path)) { throw new \Magento\Core\Exception(__('Please make sure that "%1" is writable by the web-server.', $this->getSitemapPath())); } @@ -320,8 +307,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel $this->setSitemapFilename($this->getSitemapFilename() . '.xml'); } - $this->setSitemapPath( - rtrim(str_replace(str_replace('\\', '/', $this->_getBaseDir()), '', $realPath), '/') . '/'); + $this->setSitemapPath(rtrim(str_replace(str_replace('\\', '/', $this->_getBaseDir()), '', $path), '/') . '/'); return parent::_beforeSave(); } @@ -364,8 +350,11 @@ class Sitemap extends \Magento\Core\Model\AbstractModel if ($this->_sitemapIncrement == 1) { // In case when only one increment file was created use it as default sitemap - $this->_getFileHandler() - ->mv($this->_getCurrentSitemapFilename($this->_sitemapIncrement), $this->getSitemapFilename()); + $path = rtrim($this->getSitemapPath(), '/') . '/' . + $this->_getCurrentSitemapFilename($this->_sitemapIncrement); + $destination = rtrim($this->getSitemapPath(), '/') . '/' . $this->getSitemapFilename(); + + $this->_directory->renameFile($path, $destination); } else { // Otherwise create index file with list of generated sitemaps $this->_createSitemapIndex(); @@ -509,24 +498,12 @@ class Sitemap extends \Magento\Core\Model\AbstractModel $this->_sitemapIncrement++; $fileName = $this->_getCurrentSitemapFilename($this->_sitemapIncrement); } - $this->_fileHandler = $this->_getFileObject(); - $this->_fileHandler->setAllowCreateFolders(true); - - $path = $this->_fileHandler->getCleanPath($this->_getBaseDir() . $this->getSitemapPath()); - $this->_fileHandler->open(array('path' => $path)); - - if ($this->_fileHandler->fileExists($fileName) && !$this->_fileHandler->isWriteable($fileName)) { - throw new \Magento\Core\Exception( - __('File "%1" cannot be saved. Please, make sure the directory "%2" is writable by web server.', - $fileName, $path - ) - ); - } - $fileHeader = sprintf($this->_tags[$type][self::OPEN_TAG_KEY], $type); - $this->_fileHandler->streamOpen($fileName); - $this->_fileHandler->streamWrite($fileHeader); + $path = rtrim($this->getSitemapPath(), '/') . '/' . $fileName; + $this->_stream = $this->_directory->openFile($path); + $fileHeader = sprintf($this->_tags[$type][self::OPEN_TAG_KEY], $type); + $this->_stream->write($fileHeader); $this->_fileSize = strlen($fileHeader . sprintf($this->_tags[$type][self::CLOSE_TAG_KEY], $type)); } @@ -537,7 +514,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel */ protected function _writeSitemapRow($row) { - $this->_getFileHandler()->streamWrite($row . PHP_EOL); + $this->_getStream()->write($row . PHP_EOL); } /** @@ -547,9 +524,9 @@ class Sitemap extends \Magento\Core\Model\AbstractModel */ protected function _finalizeSitemap($type = self::TYPE_URL) { - if ($this->_fileHandler) { - $this->_fileHandler->streamWrite(sprintf($this->_tags[$type][self::CLOSE_TAG_KEY], $type)); - $this->_fileHandler->streamClose(); + if ($this->_stream) { + $this->_stream->write(sprintf($this->_tags[$type][self::CLOSE_TAG_KEY], $type)); + $this->_stream->close(); } // Reset all counters @@ -575,17 +552,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel */ protected function _getBaseDir() { - return $this->_dirModel->getDir(\Magento\App\Dir::ROOT); - } - - /** - * Get file object - * - * @return \Magento\Io\File - */ - protected function _getFileObject() - { - return new \Magento\Io\File(); + return $this->_directory->getAbsolutePath(); } /** @@ -656,7 +623,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel $documentRoot = trim(str_replace('\\', '/', $this->_getDocumentRoot()), '/'); $baseDir = trim(str_replace('\\', '/', $this->_getBaseDir()), '/'); - if ($this->_getFilesystem()->isPathInDirectory($baseDir, $documentRoot)) { + if ((strpos($baseDir, $documentRoot) === 0)) { //case when basedir is in document root $installationFolder = trim(str_replace($documentRoot, '', $baseDir), '/'); $storeDomain = rtrim($url . '/' . $installationFolder, '/'); @@ -703,32 +670,20 @@ class Sitemap extends \Magento\Core\Model\AbstractModel { $robotsSitemapLine = 'Sitemap: ' . $this->getSitemapUrl($this->getSitemapPath(), $sitemapFileName); - $robotsFileHandler = $this->_getFileObject(); - $robotsFileName = $robotsFileHandler->getCleanPath($this->_getBaseDir() . '/robots.txt'); - $robotsFullText = ''; - if ($robotsFileHandler->fileExists($robotsFileName)) { - $robotsFileHandler->open(array('path' => $robotsFileHandler->getDestinationFolder($robotsFileName))); - $robotsFullText = $robotsFileHandler->read($robotsFileName); + $filename = 'robots.txt'; + $content = ''; + if ($this->_directory->isExist($filename)) { + $content = $this->_directory->readFile($filename); } - if (strpos($robotsFullText, $robotsSitemapLine) === false) { - if (!empty($robotsFullText)) { - $robotsFullText .= $this->_findNewLinesDelimiter($robotsFullText); + if (strpos($content, $robotsSitemapLine) === false) { + if (!empty($content)) { + $content .= $this->_findNewLinesDelimiter($content); } - $robotsFullText .= $robotsSitemapLine; + $content .= $robotsSitemapLine; } - $robotsFileHandler->write($robotsFileName, $robotsFullText); - } - - /** - * Get \Magento\Filesystem object - * - * @return \Magento\Filesystem - */ - protected function _getFilesystem() - { - return $this->_filesystem; + $this->_directory->writeFile($filename, $content); } /** diff --git a/app/code/Magento/Sitemap/etc/adminhtml/menu.xml b/app/code/Magento/Sitemap/etc/adminhtml/menu.xml index 96b5b68ae2e..ee179e36282 100644 --- a/app/code/Magento/Sitemap/etc/adminhtml/menu.xml +++ b/app/code/Magento/Sitemap/etc/adminhtml/menu.xml @@ -27,6 +27,6 @@ --> <config> <menu> - <add id="Magento_Sitemap::catalog_sitemap" title="Site Map" module="Magento_Sitemap" sortOrder="40" parent="Magento_Adminhtml::marketing_seo" action="adminhtml/sitemap/" resource="Magento_Sitemap::sitemap"/> + <add id="Magento_Sitemap::catalog_sitemap" title="Site Map" module="Magento_Sitemap" sortOrder="40" parent="Magento_Backend::marketing_seo" action="adminhtml/sitemap/" resource="Magento_Sitemap::sitemap"/> </menu> </config> diff --git a/app/code/Magento/Sitemap/etc/adminhtml/routes.xml b/app/code/Magento/Sitemap/etc/adminhtml/routes.xml index 1eb890617b2..8506d18c31d 100644 --- a/app/code/Magento/Sitemap/etc/adminhtml/routes.xml +++ b/app/code/Magento/Sitemap/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Sitemap_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Sitemap" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Sitemap/etc/email_templates.xml b/app/code/Magento/Sitemap/etc/email_templates.xml index 2e131dadfbf..24d26fe18a3 100644 --- a/app/code/Magento/Sitemap/etc/email_templates.xml +++ b/app/code/Magento/Sitemap/etc/email_templates.xml @@ -24,5 +24,5 @@ */ --> <config> - <template id="sitemap_generate_error_email_template" label="Sitemap Generation Warnings" file="generate_warnings.html" type="text"/> + <template id="sitemap_generate_error_email_template" label="Sitemap Generation Warnings" file="generate_warnings.html" type="text" module="Magento_Sitemap"/> </config> diff --git a/app/code/Magento/Sitemap/etc/module.xml b/app/code/Magento/Sitemap/etc/module.xml index 82b24e7ad4e..5d6acb5c400 100755 --- a/app/code/Magento/Sitemap/etc/module.xml +++ b/app/code/Magento/Sitemap/etc/module.xml @@ -33,7 +33,6 @@ <module name="Magento_Core"/> <module name="Magento_Eav"/> <module name="Magento_Cms"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Backend"/> </depends> </module> diff --git a/app/code/Magento/Tax/Block/Adminhtml/Frontend/Region/Updater.php b/app/code/Magento/Tax/Block/Adminhtml/Frontend/Region/Updater.php index 08bf5e783e3..768c12f1a65 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Frontend/Region/Updater.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Frontend/Region/Updater.php @@ -29,6 +29,25 @@ namespace Magento\Tax\Block\Adminhtml\Frontend\Region; class Updater extends \Magento\Backend\Block\System\Config\Form\Field { + /** + * @var \Magento\Directory\Helper\Data + */ + protected $_directoryHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Directory\Helper\Data $directoryHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Directory\Helper\Data $directoryHelper, + array $data = array() + ) { + $this->_directoryHelper = $directoryHelper; + parent::__construct($context, $data); + } + protected function _getElementHtml(\Magento\Data\Form\Element\AbstractElement $element) { $html = parent::_getElementHtml($element); @@ -47,7 +66,7 @@ class Updater } </script>'; - $html .= sprintf($js, $this->helper('Magento\Directory\Helper\Data')->getRegionJson()); + $html .= sprintf($js, $this->_directoryHelper->getRegionJson()); return $html; } } diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Grid/Renderer/Country.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Grid/Renderer/Country.php index 78682b4e865..779e7c15d29 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Grid/Renderer/Country.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Grid/Renderer/Country.php @@ -33,7 +33,7 @@ */ namespace Magento\Tax\Block\Adminhtml\Rate\Grid\Renderer; -class Country extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Country +class Country extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Country { /** * Render column for export diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Grid/Renderer/Data.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Grid/Renderer/Data.php index a0e4284311d..31eca20b016 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Grid/Renderer/Data.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Grid/Renderer/Data.php @@ -34,7 +34,7 @@ namespace Magento\Tax\Block\Adminhtml\Rate\Grid\Renderer; -class Data extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Data extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { protected function _getValue (\Magento\Object $row) { diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/ImportExport.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/ImportExport.php index 49684dfc545..4c492241cf6 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/ImportExport.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/ImportExport.php @@ -27,7 +27,7 @@ namespace Magento\Tax\Block\Adminhtml\Rate; -class ImportExport extends \Magento\Adminhtml\Block\Widget +class ImportExport extends \Magento\Backend\Block\Widget { protected $_template = 'importExport.phtml'; diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/ImportExportHeader.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/ImportExportHeader.php index e854b7b5ade..4f654943dae 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/ImportExportHeader.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/ImportExportHeader.php @@ -33,7 +33,7 @@ */ namespace Magento\Tax\Block\Adminhtml\Rate; -class ImportExportHeader extends \Magento\Adminhtml\Block\Widget +class ImportExportHeader extends \Magento\Backend\Block\Widget { /** * Block's template diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Add.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Add.php index 18e8d64a529..d37d39ff8fe 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Add.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Add.php @@ -41,7 +41,7 @@ class Add extends \Magento\Backend\Block\Template protected function _prepareLayout() { - $this->addChild('addButton', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('addButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add New Tax Rate'), 'onclick' => 'window.location.href=\''.$this->getUrl('tax/rate/add').'\'', 'class' => 'add' diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Save.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Save.php index 84c6b308e49..4d66985c023 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Save.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Save.php @@ -48,23 +48,23 @@ class Save extends \Magento\Backend\Block\Template protected function _prepareLayout() { - $this->addChild('backButton', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('backButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Back'), 'onclick' => 'window.location.href=\''.$this->getUrl('tax/*/').'\'', 'class' => 'back' )); - $this->addChild('resetButton', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('resetButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Reset'), 'onclick' => 'window.location.reload()' )); - $this->addChild('saveButton', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('saveButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save Rate'), 'class' => 'save' )); - $this->addChild('deleteButton', 'Magento\Adminhtml\Block\Widget\Button', array( + $this->addChild('deleteButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete Rate'), 'onclick' => 'deleteConfirm(\'' . __('Are you sure you want to do this?') . '\', \'' . $this->getUrl('tax/*/delete', array('rate' => $this->getRequest()->getParam('rate'))) . '\')', 'class' => 'delete' diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rule.php b/app/code/Magento/Tax/Block/Adminhtml/Rule.php index 9a671ae6e53..4c1a5a09636 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rule.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rule.php @@ -34,7 +34,7 @@ namespace Magento\Tax\Block\Adminhtml; -class Rule extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Rule extends \Magento\Backend\Block\Widget\Grid\Container { protected function _construct() { diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit.php b/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit.php index 687bc09bc49..987789f5a4d 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit.php @@ -30,7 +30,7 @@ namespace Magento\Tax\Block\Adminhtml\Rule; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php b/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php index 4b12e0d03d5..c65a1d121d5 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php @@ -73,7 +73,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic } /** - * return \Magento\Adminhtml\Block\Widget\Form + * return \Magento\Backend\Block\Widget\Form */ protected function _prepareForm() { diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate.php index a75cf47a8a2..fb67efcbee2 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate.php @@ -79,7 +79,7 @@ class Rate extends \Magento\Backend\App\Action $this->_title->add(__('New Tax Rate')); - $rateModel->setData($this->_objectManager->get('Magento\Adminhtml\Model\Session')->getFormData(true)); + $rateModel->setData($this->_objectManager->get('Magento\Backend\Model\Session')->getFormData(true)); if ($rateModel->getZipIsRange() && !$rateModel->hasTaxPostcode()) { $rateModel->setTaxPostcode($rateModel->getZipFrom() . '-' . $rateModel->getZipTo()); @@ -120,14 +120,14 @@ class Rate extends \Magento\Backend\App\Action try { $rateModel->save(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('The tax rate has been saved.')); + $this->messageManager->addSuccess(__('The tax rate has been saved.')); $this->getResponse()->setRedirect($this->getUrl("*/*/")); return true; } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setFormData($ratePost); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData($ratePost); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); @@ -238,18 +238,15 @@ class Rate extends \Magento\Backend\App\Action try { $rateModel->delete(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addSuccess(__('The tax rate has been deleted.')); + $this->messageManager->addSuccess(__('The tax rate has been deleted.')); $this->getResponse()->setRedirect($this->getUrl("*/*/")); return true; } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError(__('Something went wrong deleting this rate.')); + $this->messageManager->addError(__('Something went wrong deleting this rate.')); } if ($referer = $this->getRequest()->getServer('HTTP_REFERER')) { $this->getResponse()->setRedirect($referer); @@ -258,8 +255,9 @@ class Rate extends \Magento\Backend\App\Action $this->getResponse()->setRedirect($this->getUrl("*/*/")); } } else { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError(__('Something went wrong deleting this rate because of an incorrect rate ID.')); + $this->messageManager->addError( + __('Something went wrong deleting this rate because of an incorrect rate ID.') + ); $this->getResponse()->setRedirect($this->getUrl('tax/*/')); } } @@ -358,18 +356,14 @@ class Rate extends \Magento\Backend\App\Action $importHandler = $this->_objectManager->create('Magento\Tax\Model\Rate\CsvImportHandler'); $importHandler->importFromCsvFile($this->getRequest()->getFiles('import_rates_file')); - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addSuccess(__('The tax rate has been imported.')); + $this->messageManager->addSuccess(__('The tax rate has been imported.')); } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError(__('Invalid file upload attempt')); + $this->messageManager->addError(__('Invalid file upload attempt')); } } else { - $this->_objectManager->get('Magento\Adminhtml\Model\Session') - ->addError(__('Invalid file upload attempt')); + $this->messageManager->addError(__('Invalid file upload attempt')); } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); } diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rule.php b/app/code/Magento/Tax/Controller/Adminhtml/Rule.php index f9c8805e677..50702f10884 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rule.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rule.php @@ -79,14 +79,14 @@ class Rule extends \Magento\Backend\App\Action if ($taxRuleId) { $ruleModel->load($taxRuleId); if (!$ruleModel->getId()) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->unsRuleData(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('This rule no longer exists.')); + $this->_objectManager->get('Magento\Backend\Model\Session')->unsRuleData(); + $this->messageManager->addError(__('This rule no longer exists.')); $this->_redirect('tax/*/'); return; } } - $data = $this->_objectManager->get('Magento\Adminhtml\Model\Session')->getRuleData(true); + $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getRuleData(true); if (!empty($data)) { $ruleModel->setData($data); } @@ -111,7 +111,7 @@ class Rule extends \Magento\Backend\App\Action try { $ruleModel->save(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('The tax rule has been saved.')); + $this->messageManager->addSuccess(__('The tax rule has been saved.')); if ($this->getRequest()->getParam('back')) { $this->_redirect('tax/*/edit', array('rule' => $ruleModel->getId())); @@ -121,12 +121,12 @@ class Rule extends \Magento\Backend\App\Action $this->_redirect('tax/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('Something went wrong saving this tax rule.')); + $this->messageManager->addError(__('Something went wrong saving this tax rule.')); } - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setRuleData($postData); + $this->_objectManager->get('Magento\Backend\Model\Session')->setRuleData($postData); $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); return; } @@ -139,7 +139,7 @@ class Rule extends \Magento\Backend\App\Action $ruleModel = $this->_objectManager->get('Magento\Tax\Model\Calculation\Rule') ->load($ruleId); if (!$ruleModel->getId()) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('This rule no longer exists')); + $this->messageManager->addError(__('This rule no longer exists')); $this->_redirect('tax/*/'); return; } @@ -147,14 +147,14 @@ class Rule extends \Magento\Backend\App\Action try { $ruleModel->delete(); - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('The tax rule has been deleted.')); + $this->messageManager->addSuccess(__('The tax rule has been deleted.')); $this->_redirect('tax/*/'); return; } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('Something went wrong deleting this tax rule.')); + $this->messageManager->addError(__('Something went wrong deleting this tax rule.')); } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); diff --git a/app/code/Magento/Tax/Model/Resource/Rule/Grid/Collection.php b/app/code/Magento/Tax/Model/Resource/Rule/Grid/Collection.php index 03250fd46c8..fca105dc4fa 100644 --- a/app/code/Magento/Tax/Model/Resource/Rule/Grid/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Rule/Grid/Collection.php @@ -28,11 +28,13 @@ namespace Magento\Tax\Model\Resource\Rule\Grid; class Collection extends \Magento\Tax\Model\Resource\Calculation\Rule\Collection { /** + * Process loaded collection data + * * @return \Magento\Tax\Model\Resource\Rule\Grid\Collection */ - protected function _initSelect() + protected function _afterLoadData() { - parent::_initSelect(); + parent::_afterLoadData(); $this->addCustomerTaxClassesToResult(); $this->addProductTaxClassesToResult(); $this->addRatesToResult(); diff --git a/app/code/Magento/Tax/etc/adminhtml/menu.xml b/app/code/Magento/Tax/etc/adminhtml/menu.xml index 75eb983de20..e9aabfa571b 100644 --- a/app/code/Magento/Tax/etc/adminhtml/menu.xml +++ b/app/code/Magento/Tax/etc/adminhtml/menu.xml @@ -27,9 +27,9 @@ --> <config> <menu> - <add id="Magento_Tax::sales_tax" title="Taxes" module="Magento_Tax" sortOrder="20" parent="Magento_Adminhtml::stores" resource="Magento_Tax::manage_tax"/> + <add id="Magento_Tax::sales_tax" title="Taxes" module="Magento_Tax" sortOrder="20" parent="Magento_Backend::stores" resource="Magento_Tax::manage_tax"/> <add id="Magento_Tax::sales_tax_rules" title="Tax Rules" module="Magento_Tax" sortOrder="10" parent="Magento_Tax::sales_tax" action="tax/rule" resource="Magento_Tax::manage_tax"/> <add id="Magento_Tax::sales_tax_rates" title="Tax Zones and Rates" module="Magento_Tax" sortOrder="20" parent="Magento_Tax::sales_tax" action="tax/rate" resource="Magento_Tax::manage_tax"/> - <add id="Magento_Tax::system_convert_tax" title="Import/Export Tax Rates" sortOrder="30" module="Magento_Tax" parent="Magento_Adminhtml::system_convert" action="tax/rate/importExport" resource="Magento_Tax::import_export"/> + <add id="Magento_Tax::system_convert_tax" title="Import/Export Tax Rates" sortOrder="30" module="Magento_Tax" parent="Magento_Backend::system_convert" action="tax/rate/importExport" resource="Magento_Tax::import_export"/> </menu> </config> diff --git a/app/code/Magento/Tax/etc/module.xml b/app/code/Magento/Tax/etc/module.xml index 3b33766a62b..e8ceb848dfb 100755 --- a/app/code/Magento/Tax/etc/module.xml +++ b/app/code/Magento/Tax/etc/module.xml @@ -31,7 +31,6 @@ <module name="Magento_User"/> </sequence> <depends> - <module name="Magento_Adminhtml"/> <module name="Magento_Catalog"/> <module name="Magento_Customer"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/Css.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/Css.php index 3153b3a3f8d..df2c795d401 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/Css.php +++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/Css.php @@ -188,7 +188,7 @@ class Css $themeFieldset->addField('css_download_button', 'button', $downloadButtonConfig); /** @var $imageButton \Magento\Backend\Block\Widget\Button */ - $imageButton = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $imageButton = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'id' => 'css_images_manager', 'label' => __('Manage'), @@ -214,7 +214,7 @@ class Css )); /** @var $fontButton \Magento\Backend\Block\Widget\Button */ - $fontButton = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $fontButton = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'id' => 'css_fonts_manager', 'label' => __('Manage'), @@ -300,7 +300,7 @@ class Css { return $this->getUrl('adminhtml/*/downloadCss', array( 'theme_id' => $themeId, - 'file' => $this->_helperFactory->get('Magento\Core\Helper\Data')->urlEncode($fileId) + 'file' => $this->_coreData->urlEncode($fileId) )); } } diff --git a/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Content.php b/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Content.php index e34accd130b..18d0f7a714e 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Content.php +++ b/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Content.php @@ -33,6 +33,33 @@ namespace Magento\Theme\Block\Adminhtml\Wysiwyg\Files; */ class Content extends \Magento\Backend\Block\Widget\Container { + /** + * @var \Magento\Theme\Helper\Storage + */ + protected $_storageHelper; + + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Theme\Helper\Storage $storageHelper + * @param \Magento\Core\Helper\Data $coreHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Theme\Helper\Storage $storageHelper, + \Magento\Core\Helper\Data $coreHelper, + array $data = array() + ) { + $this->_coreHelper = $coreHelper; + $this->_storageHelper = $storageHelper; + parent::__construct($context, $data); + } + /** * Block construction */ @@ -81,7 +108,7 @@ class Content extends \Magento\Backend\Block\Widget\Container public function getContentsUrl() { return $this->getUrl('adminhtml/*/contents', array('type' => $this->getRequest()->getParam('type')) - + $this->helper('Magento\Theme\Helper\Storage')->getRequestParams()); + + $this->_storageHelper->getRequestParams()); } /** @@ -107,7 +134,7 @@ class Content extends \Magento\Backend\Block\Widget\Container 'showBreadcrumbs' => true )); - return $this->helper('Magento\Core\Helper\Data')->jsonEncode($setupObject); + return $this->_coreHelper->jsonEncode($setupObject); } /** @@ -118,7 +145,7 @@ class Content extends \Magento\Backend\Block\Widget\Container public function getNewfolderUrl() { return $this->getUrl( - 'adminhtml/*/newFolder', $this->helper('Magento\Theme\Helper\Storage')->getRequestParams() + 'adminhtml/*/newFolder', $this->_storageHelper->getRequestParams() ); } @@ -130,7 +157,7 @@ class Content extends \Magento\Backend\Block\Widget\Container protected function getDeletefolderUrl() { return $this->getUrl( - 'adminhtml/*/deleteFolder', $this->helper('Magento\Theme\Helper\Storage')->getRequestParams() + 'adminhtml/*/deleteFolder', $this->_storageHelper->getRequestParams() ); } @@ -142,7 +169,7 @@ class Content extends \Magento\Backend\Block\Widget\Container public function getDeleteFilesUrl() { return $this->getUrl( - 'adminhtml/*/deleteFiles', $this->helper('Magento\Theme\Helper\Storage')->getRequestParams() + 'adminhtml/*/deleteFiles', $this->_storageHelper->getRequestParams() ); } @@ -153,7 +180,7 @@ class Content extends \Magento\Backend\Block\Widget\Container */ public function getOnInsertUrl() { - return $this->getUrl('adminhtml/*/onInsert', $this->helper('Magento\Theme\Helper\Storage')->getRequestParams()); + return $this->getUrl('adminhtml/*/onInsert', $this->_storageHelper->getRequestParams()); } /** diff --git a/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Content/Uploader.php b/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Content/Uploader.php index 5ca7025b884..27a2342a41b 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Content/Uploader.php +++ b/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Content/Uploader.php @@ -40,6 +40,27 @@ class Uploader extends \Magento\Backend\Block\Media\Uploader */ protected $_template = 'browser/content/uploader.phtml'; + /** + * @var \Magento\Theme\Helper\Storage + */ + protected $_storageHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\File\Size $fileSize + * @param \Magento\Theme\Helper\Storage $storageHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\File\Size $fileSize, + \Magento\Theme\Helper\Storage $storageHelper, + array $data = array() + ) { + $this->_storageHelper = $storageHelper; + parent::__construct($context, $fileSize, $data); + } + /** * Prepare layout * @@ -48,7 +69,7 @@ class Uploader extends \Magento\Backend\Block\Media\Uploader protected function _prepareLayout() { $this->getConfig()->setUrl( - $this->getUrl('adminhtml/*/upload', $this->helper('Magento\Theme\Helper\Storage')->getRequestParams()) + $this->getUrl('adminhtml/*/upload', $this->_storageHelper->getRequestParams()) ); return parent::_prepareLayout(); } @@ -60,6 +81,6 @@ class Uploader extends \Magento\Backend\Block\Media\Uploader */ public function getHelperStorage() { - return $this->helper('Magento\Theme\Helper\Storage'); + return $this->_storageHelper; } } diff --git a/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Tree.php b/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Tree.php index 2b56eda8dfa..ac3c249ec5a 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Tree.php +++ b/app/code/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/Tree.php @@ -33,6 +33,25 @@ namespace Magento\Theme\Block\Adminhtml\Wysiwyg\Files; */ class Tree extends \Magento\Backend\Block\Template { + /** + * @var \Magento\Theme\Helper\Storage + */ + protected $_storageHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Theme\Helper\Storage $storageHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Theme\Helper\Storage $storageHelper, + array $data = array() + ) { + $this->_storageHelper = $storageHelper; + parent::__construct($context, $data); + } + /** * Json source URL * @@ -40,7 +59,7 @@ class Tree extends \Magento\Backend\Block\Template */ public function getTreeLoaderUrl() { - return $this->getUrl('adminhtml/*/treeJson', $this->helper('Magento\Theme\Helper\Storage')->getRequestParams()); + return $this->getUrl('adminhtml/*/treeJson', $this->_storageHelper->getRequestParams()); } /** @@ -72,14 +91,14 @@ class Tree extends \Magento\Backend\Block\Template public function getTreeCurrentPath() { $treePath = '/root'; - $path = $this->helper('Magento\Theme\Helper\Storage')->getSession()->getCurrentPath(); + $path = $this->_storageHelper->getSession()->getCurrentPath(); if ($path) { - $path = str_replace($this->helper('Magento\Theme\Helper\Storage')->getStorageRoot(), '', $path); + $path = str_replace($this->_storageHelper->getStorageRoot(), '', $path); $relative = ''; - foreach (explode(DIRECTORY_SEPARATOR, $path) as $dirName) { + foreach (explode('/', $path) as $dirName) { if ($dirName) { - $relative .= DIRECTORY_SEPARATOR . $dirName; - $treePath .= '/' . $this->helper('Magento\Theme\Helper\Storage')->urlEncode($relative); + $relative .= '/' . $dirName; + $treePath .= '/' . $this->_storageHelper->urlEncode($relative); } } } diff --git a/app/code/Magento/Theme/Block/Html/Head.php b/app/code/Magento/Theme/Block/Html/Head.php index 8fd9b508f3f..c1ce99fa102 100644 --- a/app/code/Magento/Theme/Block/Html/Head.php +++ b/app/code/Magento/Theme/Block/Html/Head.php @@ -102,7 +102,6 @@ class Head extends \Magento\View\Element\Template $this->_assetMinifyService = $assetMinifyService; $this->_pageAssets = $assets; } - /** * Add RSS element to HEAD entity * @@ -386,10 +385,10 @@ class Head extends \Magento\View\Element\Template { $folderName = \Magento\Backend\Model\Config\Backend\Image\Favicon::UPLOAD_DIR; $storeConfig = $this->_storeConfig->getConfig('design/head/shortcut_icon'); - $faviconFile = $this->_storeManager->getStore()->getBaseUrl('media') . $folderName . '/' . $storeConfig; - $absolutePath = $this->_dirs->getDir('media') . '/' . $folderName . '/' . $storeConfig; + $path = $folderName . '/' . $storeConfig; + $faviconFile = $this->_storeManager->getStore()->getBaseUrl('media') . $path; - if (!is_null($storeConfig) && $this->_isFile($absolutePath)) { + if (!is_null($storeConfig) && $this->_isFile($path)) { $url = $faviconFile; } else { $url = $this->getViewFileUrl('Magento_Theme::favicon.ico'); @@ -400,15 +399,15 @@ class Head extends \Magento\View\Element\Template /** * If DB file storage is on - find there, otherwise - just file_exists * - * @param string $filename + * @param string $filename relative file path * @return bool */ protected function _isFile($filename) { - if ($this->_fileStorageDatabase->checkDbUsage() && !is_file($filename)) { + if ($this->_fileStorageDatabase->checkDbUsage() && !$this->mediaDirectory->isFile($filename)) { $this->_fileStorageDatabase->saveFileToFilesystem($filename); } - return is_file($filename); + return $this->mediaDirectory->isFile($filename); } /** diff --git a/app/code/Magento/Theme/Block/Html/Header.php b/app/code/Magento/Theme/Block/Html/Header.php index ba263345778..c0bd24aa248 100644 --- a/app/code/Magento/Theme/Block/Html/Header.php +++ b/app/code/Magento/Theme/Block/Html/Header.php @@ -41,16 +41,24 @@ class Header extends \Magento\View\Element\Template */ protected $_customerSession; + /** + * @var \Magento\Core\Helper\File\Storage\Database + */ + protected $_fileStorageHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Core\Helper\File\Storage\Database $fileStorageHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, + \Magento\Core\Helper\File\Storage\Database $fileStorageHelper, array $data = array() ) { + $this->_fileStorageHelper = $fileStorageHelper; $this->_customerSession = $customerSession; parent::__construct($context, $data); } @@ -121,12 +129,10 @@ class Header extends \Magento\View\Element\Template { $folderName = \Magento\Backend\Model\Config\Backend\Image\Logo::UPLOAD_DIR; $storeLogoPath = $this->_storeConfig->getConfig('design/header/logo_src'); - $logoUrl = $this->_urlBuilder->getBaseUrl(array('_type' => \Magento\Core\Model\Store::URL_TYPE_MEDIA)) - . $folderName . '/' . $storeLogoPath; - $absolutePath = $this->_dirs->getDir(\Magento\App\Dir::MEDIA) . DIRECTORY_SEPARATOR - . $folderName . DIRECTORY_SEPARATOR . $storeLogoPath; + $path = $folderName . '/' . $storeLogoPath; + $logoUrl = $this->_urlBuilder->getBaseUrl(array('_type' => \Magento\Core\Model\Store::URL_TYPE_MEDIA)) . $path; - if (!is_null($storeLogoPath) && $this->_isFile($absolutePath)) { + if (!is_null($storeLogoPath) && $this->_isFile($path)) { $url = $logoUrl; } else { $url = $this->getViewFileUrl('images/logo.gif'); @@ -137,17 +143,15 @@ class Header extends \Magento\View\Element\Template /** * If DB file storage is on - find there, otherwise - just file_exists * - * @param string $filename + * @param string $filename relative path * @return bool */ protected function _isFile($filename) { - $helper = $this->_helperFactory->get('Magento\Core\Helper\File\Storage\Database'); - - if ($helper->checkDbUsage() && !is_file($filename)) { - $helper->saveFileToFilesystem($filename); + if ($this->_fileStorageHelper->checkDbUsage() && !$this->getMediaDirectory()->isFile($filename)) { + $this->_fileStorageHelper->saveFileToFilesystem($filename); } - return is_file($filename); + return $this->getMediaDirectory()->isFile($filename); } } 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 6fba27a5ab0..32823fa4ff1 100644 --- a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php +++ b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php @@ -112,10 +112,10 @@ class Theme extends \Magento\Backend\App\Action $this->_setActiveMenu('Magento_Theme::system_design_theme'); $this->_view->renderLayout(); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('adminhtml/*/'); } catch (\Exception $e) { - $this->_getSession()->addError(__('We cannot find the theme.')); + $this->messageManager->addError(__('We cannot find the theme.')); $this->_objectManager->get('Magento\Logger')->logException($e); $this->_redirect('adminhtml/*/'); } @@ -162,15 +162,15 @@ class Theme extends \Magento\Backend\App\Action $customization->reorder(\Magento\View\Design\Theme\Customization\File\Js::TYPE, $reorderJsFiles); $customization->delete($removeJsFiles); $singleFile->update($theme, $customCssData); - $this->_getSession()->addSuccess(__('You saved the theme.')); + $this->messageManager->addSuccess(__('You saved the theme.')); } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_getSession()->setThemeData($themeData); $this->_getSession()->setThemeCustomCssData($customCssData); $redirectBack = true; } catch (\Exception $e) { - $this->_getSession()->addError('The theme was not saved'); + $this->messageManager->addError('The theme was not saved'); $this->_objectManager->get('Magento\Logger')->logException($e); } $redirectBack @@ -198,12 +198,12 @@ class Theme extends \Magento\Backend\App\Action ); } $theme->delete(); - $this->_getSession()->addSuccess(__('You deleted the theme.')); + $this->messageManager->addSuccess(__('You deleted the theme.')); } } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_getSession()->addException($e, __('We cannot delete the theme.')); + $this->messageManager->addException($e, __('We cannot delete the theme.')); $this->_objectManager->get('Magento\Logger')->logException($e); } /** @@ -291,7 +291,7 @@ class Theme extends \Magento\Backend\App\Action /** @var $customCssFile \Magento\View\Design\Theme\FileInterface */ $customCssFile = reset($customCssFiles); if ($customCssFile && $customCssFile->getContent()) { - $this->_fileFactory->create( + return $this->_fileFactory->create( $customCssFile->getFileName(), array( 'type' => 'filename', @@ -300,7 +300,7 @@ class Theme extends \Magento\Backend\App\Action ); } } catch (\Exception $e) { - $this->_getSession()->addException($e, __('We cannot find file')); + $this->messageManager->addException($e, __('We cannot find file')); $this->getResponse()->setRedirect($this->_redirect->getRefererUrl()); $this->_objectManager->get('Magento\Logger')->logException($e); } @@ -331,12 +331,12 @@ class Theme extends \Magento\Backend\App\Action ); } - $this->_fileFactory->create($fileName, array( + return $this->_fileFactory->create($fileName, array( 'type' => 'filename', 'value' => $themeCss[$fileName]['path'] )); } catch (\Exception $e) { - $this->_getSession()->addException($e, __('We cannot find file "%1".', $fileName)); + $this->messageManager->addException($e, __('We cannot find file "%1".', $fileName)); $this->getResponse()->setRedirect($this->_redirect->getRefererUrl()); $this->_objectManager->get('Magento\Logger')->logException($e); } 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 9437b247556..8eeade6d5a8 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 @@ -147,7 +147,7 @@ class Files extends \Magento\Backend\App\Action /** @var $helper \Magento\Theme\Helper\Storage */ $helper = $this->_objectManager->get('Magento\Theme\Helper\Storage'); try { - $this->_fileFactory->create($file, array( + return $this->_fileFactory->create($file, array( 'type' => 'filename', 'value' => $helper->getThumbnailPath($file) )); diff --git a/app/code/Magento/Theme/Helper/Storage.php b/app/code/Magento/Theme/Helper/Storage.php index aaf39aba2d8..fde8e659225 100644 --- a/app/code/Magento/Theme/Helper/Storage.php +++ b/app/code/Magento/Theme/Helper/Storage.php @@ -85,7 +85,7 @@ class Storage extends \Magento\App\Helper\AbstractHelper * * @var \Magento\Filesystem */ - protected $_filesystem; + protected $filesystem; /** * @var \Magento\Backend\Model\Session @@ -97,6 +97,11 @@ class Storage extends \Magento\App\Helper\AbstractHelper */ protected $_themeFactory; + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected $mediaDirectoryWrite; + /** * @param \Magento\App\Helper\Context $context * @param \Magento\Filesystem $filesystem @@ -110,12 +115,11 @@ class Storage extends \Magento\App\Helper\AbstractHelper \Magento\View\Design\Theme\FlyweightFactory $themeFactory ) { parent::__construct($context); - $this->_filesystem = $filesystem; + $this->filesystem = $filesystem; $this->_session = $session; $this->_themeFactory = $themeFactory; - - $this->_filesystem->setIsAllowCreateDirectories(true); - $this->_filesystem->ensureDirectoryExists($this->getStorageRoot()); + $this->mediaDirectoryWrite = $this->filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->mediaDirectoryWrite->create($this->getStorageRoot()); } /** @@ -165,10 +169,10 @@ class Storage extends \Magento\App\Helper\AbstractHelper public function getStorageRoot() { if (null === $this->_storageRoot) { - $this->_storageRoot = implode(\Magento\Filesystem::DIRECTORY_SEPARATOR, array( - \Magento\Filesystem::fixSeparator($this->_getTheme()->getCustomization()->getCustomizationPath()), - $this->getStorageType() - )); + $this->_storageRoot = implode('/', array( + $this->_getTheme()->getCustomization()->getCustomizationPath(), + $this->getStorageType()) + ); } return $this->_storageRoot; } @@ -219,10 +223,7 @@ class Storage extends \Magento\App\Helper\AbstractHelper $node = $this->_getRequest()->getParam(self::PARAM_NODE); if ($node !== self::NODE_ROOT) { $node = $this->urlDecode($node); - $nodes = explode( - \Magento\Filesystem::DIRECTORY_SEPARATOR, - trim($node, \Magento\Filesystem::DIRECTORY_SEPARATOR) - ); + $nodes = explode('/', trim($node, '/')); $pathPieces = array_merge($pathPieces, $nodes); } $pathPieces[] = $this->urlDecode($this->_getRequest()->getParam(self::PARAM_FILENAME)); @@ -241,10 +242,11 @@ class Storage extends \Magento\App\Helper\AbstractHelper $path = $this->_getRequest()->getParam(self::PARAM_NODE); if ($path && $path !== self::NODE_ROOT) { $path = $this->convertIdToPath($path); - if ($this->_filesystem->isDirectory($path) - && $this->_filesystem->isPathInDirectory($path, $currentPath) + + if ($this->mediaDirectoryWrite->isDirectory($path) + && 0 === strpos($path, $currentPath) ) { - $currentPath = $this->_filesystem->normalizePath($path); + $currentPath = $this->mediaDirectoryWrite->getRelativePath($path); } } $this->_currentPath = $currentPath; @@ -260,7 +262,7 @@ class Storage extends \Magento\App\Helper\AbstractHelper */ public function getThumbnailDirectory($path) { - return pathinfo($path, PATHINFO_DIRNAME) . \Magento\Filesystem::DIRECTORY_SEPARATOR + return pathinfo($path, PATHINFO_DIRNAME) . '/' . \Magento\Theme\Model\Wysiwyg\Storage::THUMBNAIL_DIRECTORY; } @@ -273,13 +275,13 @@ class Storage extends \Magento\App\Helper\AbstractHelper */ public function getThumbnailPath($imageName) { - $imagePath = $this->getCurrentPath() . \Magento\Filesystem::DIRECTORY_SEPARATOR . $imageName; - if (!$this->_filesystem->has($imagePath) - || !$this->_filesystem->isPathInDirectory($imagePath, $this->getStorageRoot()) + $imagePath = $this->getCurrentPath() . '/' . $imageName; + if (!$this->mediaDirectoryWrite->isExist($imagePath) + || 0 !== strpos($imagePath, $this->getStorageRoot()) ) { throw new \InvalidArgumentException('The image not found.'); } - return $this->getThumbnailDirectory($imagePath) . \Magento\Filesystem::DIRECTORY_SEPARATOR + return $this->getThumbnailDirectory($imagePath) . '/' . pathinfo($imageName, PATHINFO_BASENAME); } @@ -318,7 +320,6 @@ class Storage extends \Magento\App\Helper\AbstractHelper default: throw new \Magento\Exception('Invalid type'); } - return $extensions; } diff --git a/app/code/Magento/Theme/Model/CopyService.php b/app/code/Magento/Theme/Model/CopyService.php index 7e02081280a..eab3bc97639 100644 --- a/app/code/Magento/Theme/Model/CopyService.php +++ b/app/code/Magento/Theme/Model/CopyService.php @@ -32,9 +32,9 @@ namespace Magento\Theme\Model; class CopyService { /** - * @var \Magento\Filesystem + * @var \Magento\Filesystem\Directory\Write */ - protected $_filesystem; + protected $_directory; /** * @var \Magento\View\Design\Theme\FileFactory @@ -77,7 +77,7 @@ class CopyService \Magento\Event\ManagerInterface $eventManager, \Magento\View\Design\Theme\Customization\Path $customization ) { - $this->_filesystem = $filesystem; + $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); $this->_fileFactory = $fileFactory; $this->_link = $link; $this->_updateFactory = $updateFactory; @@ -183,7 +183,7 @@ class CopyService $this->_deleteFilesRecursively($targetPath); - if ($this->_filesystem->isDirectory($sourcePath)) { + if ($this->_directory->isDirectory($sourcePath)) { $this->_copyFilesRecursively($sourcePath, $sourcePath, $targetPath); } } @@ -197,13 +197,12 @@ class CopyService */ protected function _copyFilesRecursively($baseDir, $sourceDir, $targetDir) { - $this->_filesystem->setIsAllowCreateDirectories(true); - foreach ($this->_filesystem->searchKeys($sourceDir, '*') as $path) { - if ($this->_filesystem->isDirectory($path)) { + foreach ($this->_directory->read($sourceDir) as $path) { + if ($this->_directory->isDirectory($path)) { $this->_copyFilesRecursively($baseDir, $path, $targetDir); } else { $filePath = substr($path, strlen($baseDir) + 1); - $this->_filesystem->copy($path, $targetDir . '/' . $filePath, $baseDir, $targetDir); + $this->_directory->copyFile($path, $targetDir . '/' . $filePath); } } } @@ -215,8 +214,11 @@ class CopyService */ protected function _deleteFilesRecursively($targetDir) { - foreach ($this->_filesystem->searchKeys($targetDir, '*') as $path) { - $this->_filesystem->delete($path); + if (!$this->_directory->isExist($targetDir)) { + return; + } + foreach ($this->_directory->read($targetDir) as $path) { + $this->_directory->delete($path); } } } diff --git a/app/code/Magento/Theme/Model/Uploader/Service.php b/app/code/Magento/Theme/Model/Uploader/Service.php index 01239d57ddf..64bb3ba4c4c 100644 --- a/app/code/Magento/Theme/Model/Uploader/Service.php +++ b/app/code/Magento/Theme/Model/Uploader/Service.php @@ -38,11 +38,9 @@ class Service protected $_filePath; /** - * File system helper - * - * @var \Magento\Io\File + * @var \Magento\Filesystem\Directory\ReadInterface */ - protected $_fileIo; + protected $_tmpDirectory; /** * File size @@ -76,18 +74,18 @@ class Service /** * Constructor * - * @param \Magento\Io\File $fileIo + * @param \Magento\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\Io\File $fileIo, + \Magento\Filesystem $filesystem, \Magento\File\Size $fileSize, \Magento\Core\Model\File\UploaderFactory $uploaderFactory, array $uploadLimits = array() ) { - $this->_fileIo = $fileIo; + $this->_tmpDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::SYS_TMP); $this->_fileSize = $fileSize; $this->_uploaderFactory = $uploaderFactory; if (isset($uploadLimits['css'])) { @@ -158,7 +156,7 @@ class Service */ public function getFileContent($filePath) { - return $this->_fileIo->read($filePath); + return $this->_tmpDirectory->readFile($this->_tmpDirectory->getRelativePath($filePath)); } /** diff --git a/app/code/Magento/Theme/Model/Wysiwyg/Storage.php b/app/code/Magento/Theme/Model/Wysiwyg/Storage.php index 3003b9c164d..93cae322266 100644 --- a/app/code/Magento/Theme/Model/Wysiwyg/Storage.php +++ b/app/code/Magento/Theme/Model/Wysiwyg/Storage.php @@ -61,11 +61,6 @@ class Storage */ const DIRECTORY_NAME_REGEXP = '/^[a-z0-9\-\_]+$/si'; - /** - * @var \Magento\Filesystem - */ - protected $_filesystem; - /** * Storage helper * @@ -83,6 +78,11 @@ class Storage */ protected $_imageFactory; + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected $mediaWriteDirectory; + /** * Initialize dependencies * @@ -97,8 +97,7 @@ class Storage \Magento\ObjectManager $objectManager, \Magento\Image\AdapterFactory $imageFactory ) { - $this->_filesystem = $filesystem; - $this->_filesystem->setIsAllowCreateDirectories(true); + $this->mediaWriteDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); $this->_helper = $helper; $this->_objectManager = $objectManager; $this->_imageFactory = $imageFactory; @@ -125,7 +124,7 @@ class Storage } $this->_createThumbnail( - $targetPath . \Magento\Filesystem::DIRECTORY_SEPARATOR . $uploader->getUploadedFileName() + $targetPath . '/' . $uploader->getUploadedFileName() ); $result['cookie'] = array( @@ -147,27 +146,27 @@ class Storage */ public function _createThumbnail($source) { - if (self::TYPE_IMAGE != $this->_helper->getStorageType() || !$this->_filesystem->isFile($source) - || !$this->_filesystem->isReadable($source) + if (self::TYPE_IMAGE != $this->_helper->getStorageType() || !$this->mediaWriteDirectory->isFile($source) + || !$this->mediaWriteDirectory->isReadable($source) ) { return false; } $thumbnailDir = $this->_helper->getThumbnailDirectory($source); $thumbnailPath = - $thumbnailDir . \Magento\Filesystem::DIRECTORY_SEPARATOR . pathinfo($source, PATHINFO_BASENAME); + $thumbnailDir . '/' . pathinfo($source, PATHINFO_BASENAME); try { - $this->_filesystem->ensureDirectoryExists($thumbnailDir); + $this->mediaWriteDirectory->isExist($thumbnailDir); $image = $this->_imageFactory->create(); - $image->open($source); + $image->open($this->mediaWriteDirectory->getAbsolutePath($source)); $image->keepAspectRatio(true); $image->resize(self::THUMBNAIL_WIDTH, self::THUMBNAIL_HEIGHT); - $image->save($thumbnailPath); + $image->save($this->mediaWriteDirectory->getAbsolutePath($thumbnailPath)); } catch (\Magento\Filesystem\FilesystemException $e) { $this->_objectManager->get('Magento\Logger')->logException($e); return false; } - if ($this->_filesystem->isFile($thumbnailPath)) { + if ($this->mediaWriteDirectory->isFile($thumbnailPath)) { return $thumbnailPath; } return false; @@ -188,17 +187,17 @@ class Storage __('Use only standard alphanumeric, dashes and underscores.') ); } - if (!$this->_filesystem->isWritable($path)) { + if (!$this->mediaWriteDirectory->isWritable($path)) { $path = $this->_helper->getStorageRoot(); } - $newPath = $path . \Magento\Filesystem::DIRECTORY_SEPARATOR . $name; + $newPath = $path . '/' . $name; - if ($this->_filesystem->has($newPath)) { + if ($this->mediaWriteDirectory->isExist($newPath)) { throw new \Magento\Core\Exception(__('We found a directory with the same name.')); } - $this->_filesystem->ensureDirectoryExists($newPath); + $this->mediaWriteDirectory->create($newPath); $result = array( 'name' => $name, @@ -219,18 +218,16 @@ class Storage public function deleteFile($file) { $file = $this->_helper->urlDecode($file); - $path = $this->_helper->getSession()->getStoragePath(); + $path = $this->mediaWriteDirectory->getRelativePath($this->_helper->getSession()->getStoragePath()); - $filePath = $this->_filesystem->normalizePath($path . '/' . $file); - $thumbnailPath = $this->_helper->getThumbnailDirectory($filePath) - . \Magento\Filesystem::DIRECTORY_SEPARATOR - . $file; + $filePath = $this->mediaWriteDirectory->getRelativePath($path . '/' . $file); + $thumbnailPath = $this->_helper->getThumbnailDirectory($filePath) . '/' . $file; - if ($this->_filesystem->isPathInDirectory($filePath, $path) - && $this->_filesystem->isPathInDirectory($filePath, $this->_helper->getStorageRoot()) + if (0 === strpos($filePath, $path) + && 0 === strpos($filePath, $this->_helper->getStorageRoot()) ) { - $this->_filesystem->delete($filePath); - $this->_filesystem->delete($thumbnailPath); + $this->mediaWriteDirectory->delete($filePath); + $this->mediaWriteDirectory->delete($thumbnailPath); } return $this; } @@ -244,14 +241,13 @@ class Storage */ public function getDirsCollection($currentPath) { - if (!$this->_filesystem->has($currentPath)) { + if (!$this->mediaWriteDirectory->isExist($currentPath)) { throw new \Magento\Core\Exception(__('We cannot find a directory with this name.')); } - - $paths = $this->_filesystem->searchKeys($currentPath, '*'); + $paths = $this->mediaWriteDirectory->search('#.*#', $currentPath); $directories = array(); foreach ($paths as $path) { - if ($this->_filesystem->isDirectory($path)) { + if ($this->mediaWriteDirectory->isDirectory($path)) { $directories[] = $path; } } @@ -265,12 +261,12 @@ class Storage */ public function getFilesCollection() { - $paths = $this->_filesystem->searchKeys($this->_helper->getCurrentPath(), '*'); + $paths = $this->mediaWriteDirectory->search('#.*#', $this->_helper->getCurrentPath()); $files = array(); $requestParams = $this->_helper->getRequestParams(); $storageType = $this->_helper->getStorageType(); foreach ($paths as $path) { - if (!$this->_filesystem->isFile($path)) { + if (!$this->mediaWriteDirectory->isFile($path)) { continue; } $fileName = pathinfo($path, PATHINFO_BASENAME); @@ -321,13 +317,13 @@ class Storage */ public function deleteDirectory($path) { - $rootCmp = rtrim($this->_helper->getStorageRoot(), \Magento\Filesystem::DIRECTORY_SEPARATOR); - $pathCmp = rtrim($path, \Magento\Filesystem::DIRECTORY_SEPARATOR); + $rootCmp = rtrim($this->_helper->getStorageRoot(), '/'); + $pathCmp = rtrim($path, '/'); if ($rootCmp == $pathCmp) { throw new \Magento\Core\Exception(__('We cannot delete root directory %1.', $path)); } - return $this->_filesystem->delete($path); + return $this->mediaWriteDirectory->delete($path); } } diff --git a/app/code/Magento/Email/etc/email_templates_types.xsd b/app/code/Magento/Theme/etc/adminhtml/di.xml similarity index 54% rename from app/code/Magento/Email/etc/email_templates_types.xsd rename to app/code/Magento/Theme/etc/adminhtml/di.xml index fda8b6f487f..81e71e9b49b 100644 --- a/app/code/Magento/Email/etc/email_templates_types.xsd +++ b/app/code/Magento/Theme/etc/adminhtml/di.xml @@ -1,8 +1,6 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0"?> <!-- /** - * Types to be reused between XSD files for individual config files and merged config - * * Magento * * NOTICE OF LICENSE @@ -25,18 +23,20 @@ * @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:complexType name="emailTemplateType"> - <xs:attribute name="id" type="xs:string" use="required"/> - <xs:attribute name="label" type="xs:string" use="required"/> - <xs:attribute name="file" type="xs:string" use="required"/> - <xs:attribute name="type" type="emailTemplateFormatType" use="required"/> - </xs:complexType> - - <xs:simpleType name="emailTemplateFormatType"> - <xs:restriction base="xs:string"> - <xs:enumeration value="html"/> - <xs:enumeration value="text"/> - </xs:restriction> - </xs:simpleType> -</xs:schema> +<config> + <type name="Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content"> + <param name="storageHelper"> + <instance type="Magento\Theme\Helper\Storage\Proxy" /> + </param> + </type> + <type name="Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Tree"> + <param name="storageHelper"> + <instance type="Magento\Theme\Helper\Storage\Proxy" /> + </param> + </type> + <type name="Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content\Uploader"> + <param name="storageHelper"> + <instance type="Magento\Theme\Helper\Storage\Proxy" /> + </param> + </type> +</config> diff --git a/app/code/Magento/Theme/etc/adminhtml/menu.xml b/app/code/Magento/Theme/etc/adminhtml/menu.xml index a42e54a76c4..8d5f452788c 100644 --- a/app/code/Magento/Theme/etc/adminhtml/menu.xml +++ b/app/code/Magento/Theme/etc/adminhtml/menu.xml @@ -27,6 +27,6 @@ --> <config> <menu> - <add id="Magento_Theme::system_design_theme" title="Themes" module="Magento_Theme" sortOrder="20" parent="Magento_Adminhtml::system_design" action="adminhtml/system_design_theme" resource="Magento_Theme::theme"/> + <add id="Magento_Theme::system_design_theme" title="Themes" module="Magento_Theme" sortOrder="20" parent="Magento_Backend::system_design" action="adminhtml/system_design_theme" resource="Magento_Theme::theme"/> </menu> </config> diff --git a/app/code/Magento/Theme/etc/adminhtml/routes.xml b/app/code/Magento/Theme/etc/adminhtml/routes.xml index 80cccba2fc9..f7ce7dcf11d 100644 --- a/app/code/Magento/Theme/etc/adminhtml/routes.xml +++ b/app/code/Magento/Theme/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Theme_Adminhtml" /> + <module name="Magento_Theme" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Theme/etc/di.xml b/app/code/Magento/Theme/etc/di.xml index 133b456dedc..1cc525cc39b 100644 --- a/app/code/Magento/Theme/etc/di.xml +++ b/app/code/Magento/Theme/etc/di.xml @@ -64,4 +64,9 @@ <instance type="Magento\Theme\Model\Layout\Config\Data" /> </param> </type> + <type name="Magento\Theme\Model\Wysiwyg\Storage"> + <param name="helper"> + <instance type="Magento\Theme\Helper\Storage\Proxy" /> + </param> + </type> </config> diff --git a/app/code/Magento/Theme/etc/module.xml b/app/code/Magento/Theme/etc/module.xml index dda559740ee..662c1328bb9 100755 --- a/app/code/Magento/Theme/etc/module.xml +++ b/app/code/Magento/Theme/etc/module.xml @@ -29,7 +29,6 @@ <module name="Magento_Core"/> </sequence> <depends> - <module name="Magento_Adminhtml"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> <module name="Magento_Backend"/> 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 6cab061aa38..b621578c4b2 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php @@ -195,6 +195,13 @@ class International */ protected $dateTime; + /** + * Modules directory with read permissions + * + * @var \Magento\Filesystem\Directory\Read + */ + protected $modulesDirectory; + /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory @@ -211,15 +218,14 @@ class International * @param \Magento\Directory\Helper\Data $directoryData * @param \Magento\Usa\Helper\Data $usaData * @param \Magento\Core\Model\Date $coreDate - * @param \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\PdfFactory $pdfFactory + * @param Label\PdfFactory $pdfFactory * @param \Magento\Module\Dir\Reader $configReader * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\String $string * @param \Magento\Math\Division $mathDivision * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Filesystem $filesystem * @param array $data - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, @@ -243,8 +249,10 @@ class International \Magento\Stdlib\String $string, \Magento\Math\Division $mathDivision, \Magento\Stdlib\DateTime $dateTime, + \Magento\Filesystem $filesystem, array $data = array() ) { + $this->modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $this->_usaData = $usaData; $this->_coreDate = $coreDate; $this->_pdfFactory = $pdfFactory; @@ -484,6 +492,7 @@ class International * Get allowed shipping methods * * @return array + * @throws \Magento\Core\Exception */ public function getAllowedMethods() { @@ -515,7 +524,7 @@ class International /** * Get configuration data of carrier * - * @param strin $type + * @param string $type * @param string $code * @return array|bool */ @@ -1149,6 +1158,7 @@ class International * Returns weight unit (kg or pound) * * @return string + * @throws \Magento\Core\Exception */ protected function _getWeightUnit() { @@ -1171,8 +1181,12 @@ class International protected function getCountryParams($countryCode) { if (empty($this->_countryParams)) { - $dhlConfigPath = $this->_configReader->getModuleDir('etc', 'Magento_Usa') . DS . 'dhl' . DS; - $countriesXml = file_get_contents($dhlConfigPath . 'international' . DS . 'countries.xml'); + + $usaEtcPath = $this->_configReader->getModuleDir('etc', 'Magento_Usa'); + $countriesXmlPath = $this->modulesDirectory->getRelativePath( + $usaEtcPath . '/dhl/international/countries.xml' + ); + $countriesXml = $this->modulesDirectory->readFile($countriesXmlPath); $this->_countryParams = new \Magento\Simplexml\Element($countriesXml); } if (isset($this->_countryParams->$countryCode)) { diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php index 40288288bd6..81d2a3ba959 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php @@ -190,7 +190,7 @@ class Fedex $directoryData, $data ); - $wsdlBasePath = $configReader->getModuleDir('etc', 'Magento_Usa') . DS . 'wsdl' . DS . 'FedEx' . DS; + $wsdlBasePath = $configReader->getModuleDir('etc', 'Magento_Usa') . '/wsdl/FedEx/'; $this->_shipServiceWsdl = $wsdlBasePath . 'ShipService_v10.wsdl'; $this->_rateServiceWsdl = $wsdlBasePath . 'RateService_v10.wsdl'; $this->_trackServiceWsdl = $wsdlBasePath . 'TrackService_v5.wsdl'; diff --git a/app/code/Magento/User/Block/Role/Grid/User.php b/app/code/Magento/User/Block/Role/Grid/User.php index 7977db72380..e845f68b833 100644 --- a/app/code/Magento/User/Block/Role/Grid/User.php +++ b/app/code/Magento/User/Block/Role/Grid/User.php @@ -50,8 +50,9 @@ class User extends \Magento\Backend\Block\Widget\Grid\Extended /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper + * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\User\Model\RoleFactory $roleFactory * @param array $data @@ -59,12 +60,13 @@ class User extends \Magento\Backend\Block\Widget\Grid\Extended public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Core\Model\Registry $coreRegistry, \Magento\User\Model\RoleFactory $roleFactory, array $data = array() ) { - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); $this->_jsonEncoder = $jsonEncoder; $this->_coreRegistry = $coreRegistry; $this->_roleFactory = $roleFactory; diff --git a/app/code/Magento/User/Block/User/Edit/Tab/Roles.php b/app/code/Magento/User/Block/User/Edit/Tab/Roles.php index 590c5a5d4c8..68b92f4dd33 100644 --- a/app/code/Magento/User/Block/User/Edit/Tab/Roles.php +++ b/app/code/Magento/User/Block/User/Edit/Tab/Roles.php @@ -48,8 +48,9 @@ class Roles extends \Magento\Backend\Block\Widget\Grid\Extended /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Core\Model\Url $urlModel + * @param \Magento\Backend\Helper\Data $backendHelper + * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\User\Model\Resource\Role\CollectionFactory $userRolesFactory * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data @@ -57,6 +58,7 @@ class Roles extends \Magento\Backend\Block\Widget\Grid\Extended public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Url $urlModel, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\User\Model\Resource\Role\CollectionFactory $userRolesFactory, \Magento\Core\Model\Registry $coreRegistry, @@ -65,7 +67,7 @@ class Roles extends \Magento\Backend\Block\Widget\Grid\Extended $this->_jsonEncoder = $jsonEncoder; $this->_userRolesFactory = $userRolesFactory; $this->_coreRegistry = $coreRegistry; - parent::__construct($context, $urlModel, $data); + parent::__construct($context, $urlModel, $backendHelper, $data); } protected function _construct() diff --git a/app/code/Magento/User/Controller/Adminhtml/Auth.php b/app/code/Magento/User/Controller/Adminhtml/Auth.php index ae09cfe0f19..55b81452a7f 100644 --- a/app/code/Magento/User/Controller/Adminhtml/Auth.php +++ b/app/code/Magento/User/Controller/Adminhtml/Auth.php @@ -81,7 +81,7 @@ class Auth extends \Magento\Backend\App\AbstractAction } } // @codingStandardsIgnoreStart - $this->_getSession() + $this->messageManager ->addSuccess(__('If there is an account associated with %1 you will receive an email with a link to reset your password.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($email))); // @codingStandardsIgnoreEnd $this->getResponse()->setRedirect( @@ -89,10 +89,10 @@ class Auth extends \Magento\Backend\App\AbstractAction ); return; } else { - $this->_getSession()->addError(__('Please correct this email address:')); + $this->messageManager->addError(__('Please correct this email address:')); } } elseif (!empty($params)) { - $this->_getSession()->addError(__('The email address is empty.')); + $this->messageManager->addError(__('The email address is empty.')); } $this->_view->loadLayout(); $this->_view->renderLayout(); @@ -120,7 +120,7 @@ class Auth extends \Magento\Backend\App\AbstractAction $this->_view->renderLayout(); } catch (\Exception $exception) { - $this->_getSession()->addError( + $this->messageManager->addError( __('Your password reset link has expired.') ); $this->_redirect('adminhtml/auth/forgotpassword', array('_nosecret' => true)); @@ -143,7 +143,7 @@ class Auth extends \Magento\Backend\App\AbstractAction try { $this->_validateResetPasswordLinkToken($userId, $passwordResetToken); } catch (\Exception $exception) { - $this->_getSession()->addError( + $this->messageManager->addError( __('Your password reset link has expired.') ); $this->getResponse()->setRedirect( @@ -165,14 +165,14 @@ class Auth extends \Magento\Backend\App\AbstractAction $user->setRpTokenCreatedAt(null); try { $user->save(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('Your password has been updated.') ); $this->getResponse()->setRedirect( $this->_objectManager->get('Magento\Backend\Helper\Data')->getHomePageUrl() ); } catch (\Magento\Core\Exception $exception) { - $this->_getSession()->addMessages($exception->getMessages()); + $this->messageManager->addMessages($exception->getMessages()); $this->_redirect('adminhtml/auth/resetpassword', array( '_nosecret' => true, '_query' => array( diff --git a/app/code/Magento/User/Controller/Adminhtml/User.php b/app/code/Magento/User/Controller/Adminhtml/User.php index fda0386ed79..c9f5ff38c6b 100644 --- a/app/code/Magento/User/Controller/Adminhtml/User.php +++ b/app/code/Magento/User/Controller/Adminhtml/User.php @@ -88,7 +88,7 @@ class User extends \Magento\Backend\App\AbstractAction if ($userId) { $model->load($userId); if (! $model->getId()) { - $this->_session->addError(__('This user no longer exists.')); + $this->messageManager->addError(__('This user no longer exists.')); $this->_redirect('adminhtml/*/'); return; } @@ -126,7 +126,7 @@ class User extends \Magento\Backend\App\AbstractAction /** @var $model \Magento\User\Model\User */ $model = $this->_objectManager->create('Magento\User\Model\User')->load($userId); if ($userId && $model->isObjectNew()) { - $this->_getSession()->addError(__('This user no longer exists.')); + $this->messageManager->addError(__('This user no longer exists.')); $this->_redirect('adminhtml/*/'); return; } @@ -146,11 +146,11 @@ class User extends \Magento\Backend\App\AbstractAction try { $model->save(); - $this->_getSession()->addSuccess(__('You saved the user.')); + $this->messageManager->addSuccess(__('You saved the user.')); $this->_getSession()->setUserData(false); $this->_redirect('adminhtml/*/'); } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addMessages($e->getMessages()); + $this->messageManager->addMessages($e->getMessages()); $this->_getSession()->setUserData($data); $this->_redirect('adminhtml/*/edit', array('_current' => true)); } @@ -179,9 +179,7 @@ class User extends \Magento\Backend\App\AbstractAction if ($userId = $this->getRequest()->getParam('user_id')) { if ( $currentUser->getId() == $userId ) { - $this->_session->addError( - __('You cannot delete your own account.') - ); + $this->messageManager->addError(__('You cannot delete your own account.')); $this->_redirect('adminhtml/*/edit', array('user_id' => $userId)); return; } @@ -190,17 +188,17 @@ class User extends \Magento\Backend\App\AbstractAction $model = $this->_userFactory->create(); $model->setId($userId); $model->delete(); - $this->_session->addSuccess(__('You deleted the user.')); + $this->messageManager->addSuccess(__('You deleted the user.')); $this->_redirect('adminhtml/*/'); return; } catch (\Exception $e) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('adminhtml/*/edit', array('user_id' => $this->getRequest()->getParam('user_id'))); return; } } - $this->_session->addError(__('We can\'t find a user to delete.')); + $this->messageManager->addError(__('We can\'t find a user to delete.')); $this->_redirect('adminhtml/*/'); } diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Role.php b/app/code/Magento/User/Controller/Adminhtml/User/Role.php index 8340c121e89..4502fff94eb 100644 --- a/app/code/Magento/User/Controller/Adminhtml/User/Role.php +++ b/app/code/Magento/User/Controller/Adminhtml/User/Role.php @@ -185,23 +185,16 @@ class Role extends \Magento\Backend\App\AbstractAction $currentUser = $this->_userFactory->create()->setId($this->_authSession->getUser()->getId()); if (in_array($rid, $currentUser->getRoles()) ) { - $this->_session->addError( - __('You cannot delete self-assigned roles.') - ); + $this->messageManager->addError(__('You cannot delete self-assigned roles.')); $this->_redirect('adminhtml/*/editrole', array('rid' => $rid)); return; } try { $this->_initRole()->delete(); - - $this->_session->addSuccess( - __('You deleted the role.') - ); + $this->messageManager->addSuccess(__('You deleted the role.')); } catch (\Exception $e) { - $this->_session->addError( - __('An error occurred while deleting this role.') - ); + $this->messageManager->addError(__('An error occurred while deleting this role.')); } $this->_redirect("*/*/"); @@ -230,7 +223,7 @@ class Role extends \Magento\Backend\App\AbstractAction $role = $this->_initRole('role_id'); if (!$role->getId() && $rid) { - $this->_session->addError(__('This role no longer exists.')); + $this->messageManager->addError(__('This role no longer exists.')); $this->_redirect('adminhtml/*/'); return; } @@ -259,16 +252,11 @@ class Role extends \Magento\Backend\App\AbstractAction foreach ($roleUsers as $nRuid) { $this->_addUserToRole($nRuid, $role->getId()); } - - $this->_session->addSuccess( - __('You saved the role.') - ); + $this->messageManager->addSuccess(__('You saved the role.')); } catch (\Magento\Core\Exception $e) { - $this->_session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->_session->addError( - __('An error occurred while saving this role.') - ); + $this->messageManager->addError(__('An error occurred while saving this role.')); } $this->_redirect('adminhtml/*/'); return; diff --git a/app/code/Magento/User/etc/adminhtml/menu.xml b/app/code/Magento/User/etc/adminhtml/menu.xml index 778d88778d8..ab2cc5c89b3 100644 --- a/app/code/Magento/User/etc/adminhtml/menu.xml +++ b/app/code/Magento/User/etc/adminhtml/menu.xml @@ -27,7 +27,7 @@ --> <config> <menu> - <add id="Magento_User::system_acl" title="Permissions" module="Magento_User" sortOrder="60" parent="Magento_Adminhtml::system" resource="Magento_User::acl"/> + <add id="Magento_User::system_acl" title="Permissions" module="Magento_User" sortOrder="60" parent="Magento_Backend::system" resource="Magento_User::acl"/> <add id="Magento_User::system_acl_users" title="All Users" module="Magento_User" sortOrder="10" parent="Magento_User::system_acl" action="adminhtml/user" resource="Magento_User::acl_users"/> <add id="Magento_User::system_acl_roles" title="User Roles" module="Magento_User" sortOrder="30" parent="Magento_User::system_acl" action="adminhtml/user_role" resource="Magento_User::acl_roles"/> </menu> diff --git a/app/code/Magento/User/etc/adminhtml/routes.xml b/app/code/Magento/User/etc/adminhtml/routes.xml index bc831f0183c..0aaf88a2eff 100644 --- a/app/code/Magento/User/etc/adminhtml/routes.xml +++ b/app/code/Magento/User/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_User_Adminhtml" before="Magento_Backend" /> + <module name="Magento_User" before="Magento_Backend" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/User/etc/email_templates.xml b/app/code/Magento/User/etc/email_templates.xml index 53c9d8ad215..feeb6f98acd 100644 --- a/app/code/Magento/User/etc/email_templates.xml +++ b/app/code/Magento/User/etc/email_templates.xml @@ -24,6 +24,6 @@ */ --> <config> - <template id="admin_emails_forgot_email_template" label="Forgot Admin Password" file="password_reset_confirmation.html" type="html"/> - <template id="admin_emails_reset_password_template" label="Reset Password" file="password_reset.html" type="html"/> + <template id="admin_emails_forgot_email_template" label="Forgot Admin Password" file="password_reset_confirmation.html" type="html" module="Magento_User"/> + <template id="admin_emails_reset_password_template" label="Reset Password" file="password_reset.html" type="html" module="Magento_User"/> </config> diff --git a/app/code/Magento/User/etc/module.xml b/app/code/Magento/User/etc/module.xml index ea7df742f66..4ce60b5013d 100755 --- a/app/code/Magento/User/etc/module.xml +++ b/app/code/Magento/User/etc/module.xml @@ -31,7 +31,6 @@ <depends> <module name="Magento_Backend"/> <module name="Magento_Core"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Catalog"/> <module name="Magento_Cms"/> <module name="Magento_Newsletter"/> diff --git a/app/code/Magento/Webapi/Controller/ErrorProcessor.php b/app/code/Magento/Webapi/Controller/ErrorProcessor.php index 5d6971b1ba4..53ada799f99 100644 --- a/app/code/Magento/Webapi/Controller/ErrorProcessor.php +++ b/app/code/Magento/Webapi/Controller/ErrorProcessor.php @@ -48,21 +48,37 @@ class ErrorProcessor /** @var \Magento\Logger */ protected $_logger; + /** + * Filesystem instance + * + * @var \Magento\Filesystem + */ + protected $_filesystem; + + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected $directoryWrite; + /** * Initialize dependencies. Register custom shutdown function. * * @param \Magento\Core\Helper\Data $helper * @param \Magento\Core\Model\App $app * @param \Magento\Logger $logger + * @param \Magento\Filesystem $filesystem */ public function __construct( \Magento\Core\Helper\Data $helper, \Magento\Core\Model\App $app, - \Magento\Logger $logger + \Magento\Logger $logger, + \Magento\Filesystem $filesystem ) { $this->_coreHelper = $helper; $this->_app = $app; $this->_logger = $logger; + $this->_filesystem = $filesystem; + $this->directoryWrite = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); $this->registerShutdownFunction(); } @@ -260,12 +276,9 @@ class ErrorProcessor */ protected function _saveFatalErrorReport($reportData) { - $file = new \Magento\Io\File(); - $reportDir = BP . '/var/report/api'; - $file->checkAndCreateFolder($reportDir, 0777); + $this->directoryWrite->create('report/api'); $reportId = abs(intval(microtime(true) * rand(100, 1000))); - $reportFile = "$reportDir/$reportId"; - $file->write($reportFile, serialize($reportData), 0777); + $this->directoryWrite->writeFile('report/api/' . $reportId, serialize($reportData)); return $reportId; } } diff --git a/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Factory.php b/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Factory.php index c082eb7a0f4..30acde46998 100644 --- a/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Factory.php +++ b/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Factory.php @@ -71,8 +71,7 @@ class Factory if (!isset($deserializerClass) || empty($deserializerClass)) { throw new \Magento\Webapi\Exception( - __('Server cannot understand Content-Type HTTP header media type %1', $contentType) - ); + 'Server cannot understand Content-Type HTTP header media type ' . $contentType); } $deserializer = $this->_objectManager->get($deserializerClass); diff --git a/app/code/Magento/Webapi/Model/Config/Integration/SchemaLocator.php b/app/code/Magento/Webapi/Model/Config/Integration/SchemaLocator.php index 18ca710d22e..3ccb6fc1e53 100644 --- a/app/code/Magento/Webapi/Model/Config/Integration/SchemaLocator.php +++ b/app/code/Magento/Webapi/Model/Config/Integration/SchemaLocator.php @@ -47,8 +47,7 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface */ public function __construct(\Magento\Module\Dir\Reader $moduleReader) { - $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Webapi') . DIRECTORY_SEPARATOR . - DIRECTORY_SEPARATOR . 'integration' . DIRECTORY_SEPARATOR . 'api.xsd'; + $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Webapi') . '/integration/api.xsd'; } /** diff --git a/app/code/Magento/Webapi/Model/Config/SchemaLocator.php b/app/code/Magento/Webapi/Model/Config/SchemaLocator.php index 7bab4e94acc..b5c3aad609f 100644 --- a/app/code/Magento/Webapi/Model/Config/SchemaLocator.php +++ b/app/code/Magento/Webapi/Model/Config/SchemaLocator.php @@ -47,7 +47,7 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface */ public function __construct(\Magento\Module\Dir\Reader $moduleReader) { - $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Webapi') . DIRECTORY_SEPARATOR . 'webapi.xsd'; + $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Webapi') . '/webapi.xsd'; } /** diff --git a/app/code/Magento/Webapi/Model/Plugin/AuthorizationServiceV1.php b/app/code/Magento/Webapi/Model/Plugin/AuthorizationServiceV1.php new file mode 100644 index 00000000000..1949322e1d2 --- /dev/null +++ b/app/code/Magento/Webapi/Model/Plugin/AuthorizationServiceV1.php @@ -0,0 +1,93 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Webapi\Model\Plugin; + +use Magento\Code\Plugin\InvocationChain; +use Magento\Authz\Model\UserIdentifier; +use Magento\Integration\Service\IntegrationV1 as IntegrationService; +use Magento\Integration\Model\Integration; +use Magento\Logger; + +/** + * Wrap isAllowed() method from AuthorizationV1 service to avoid checking roles of deactivated integration. + */ +class AuthorizationServiceV1 +{ + /** @var IntegrationService */ + protected $_integrationService; + + /** @var Logger */ + protected $_logger; + + /** @var UserIdentifier */ + protected $_userIdentifier; + + /** + * Inject dependencies. + * + * @param IntegrationService $integrationService + * @param Logger $logger + * @param UserIdentifier $userIdentifier + */ + public function __construct(IntegrationService $integrationService, Logger $logger, UserIdentifier $userIdentifier) + { + $this->_integrationService = $integrationService; + $this->_logger = $logger; + $this->_userIdentifier = $userIdentifier; + } + + /** + * Check whether integration is inactive and don't allow using this integration in this case. + * + * It's ok that we break invocation chain since we're dealing with ACL here - if something is not allowed at any + * point it couldn't be made allowed at some other point. + * + * @param array $arguments + * @param InvocationChain $invocationChain + * @return bool + */ + public function aroundIsAllowed(array $arguments, InvocationChain $invocationChain) + { + /** @var UserIdentifier $userIdentifier */ + $userIdentifier = $arguments[1] ?: $this->_userIdentifier; + + if ($userIdentifier->getUserType() !== UserIdentifier::USER_TYPE_INTEGRATION) { + return $invocationChain->proceed($arguments); + } + + try { + $integration = $this->_integrationService->get($userIdentifier->getUserId()); + } catch (\Exception $e) { + // Wrong integration ID or DB not reachable or whatever - give up and don't allow just in case + $this->_logger->logException($e); + return false; + } + + if ($integration->getStatus() !== Integration::STATUS_ACTIVE) { + return false; + } + + return $invocationChain->proceed($arguments); + } +} diff --git a/app/code/Magento/Webapi/Model/Soap/Config.php b/app/code/Magento/Webapi/Model/Soap/Config.php index 6dae7df7070..b44a46706e7 100644 --- a/app/code/Magento/Webapi/Model/Soap/Config.php +++ b/app/code/Magento/Webapi/Model/Soap/Config.php @@ -23,7 +23,8 @@ */ namespace Magento\Webapi\Model\Soap; -use \Magento\Webapi\Model\Config\Converter; +use Magento\Webapi\Model\Config\Converter, + Magento\Filesystem\Directory\ReadInterface; /** * Webapi Config Model for Soap. @@ -40,11 +41,8 @@ class Config const KEY_ACL_RESOURCES = 'resources'; /**#@-*/ - /** @var \Magento\Filesystem */ - protected $_filesystem; - - /** @var \Magento\App\Dir */ - protected $_dir; + /** @var ReadInterface */ + protected $modulesDirectory; /** @var \Magento\Webapi\Model\Config */ protected $_config; @@ -70,17 +68,15 @@ class Config /** * @param \Magento\ObjectManager $objectManager * @param \Magento\Filesystem $filesystem - * @param \Magento\App\Dir $dir * @param \Magento\Webapi\Model\Config $config */ public function __construct( \Magento\ObjectManager $objectManager, \Magento\Filesystem $filesystem, - \Magento\App\Dir $dir, \Magento\Webapi\Model\Config $config ) { - $this->_filesystem = $filesystem; - $this->_dir = $dir; + // TODO: Check if Service specific XSD is already cached + $this->modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); $this->_config = $config; $this->_objectManager = $objectManager; } @@ -204,9 +200,6 @@ class Config */ public function getServiceSchemaDOM($serviceClass) { - // TODO: Check if Service specific XSD is already cached - $modulesDir = $this->_dir->getDir(\Magento\App\Dir::MODULES); - // TODO: Change pattern to match interface instead of class. Think about sub-services. if (!preg_match(\Magento\Webapi\Model\Config::SERVICE_CLASS_PATTERN, $serviceClass, $matches)) { // TODO: Generate exception when error handling strategy is defined @@ -217,10 +210,10 @@ class Config /** Convert "_Catalog_Attribute" into "Catalog/Attribute" */ $servicePath = str_replace('_', '/', ltrim($matches[3], '_')); $version = $matches[4]; - $schemaPath = "{$modulesDir}/{$vendorName}/{$moduleName}/etc/schema/{$servicePath}{$version}.xsd"; + $schemaPath = "{$vendorName}/{$moduleName}/etc/schema/{$servicePath}{$version}.xsd"; - if ($this->_filesystem->isFile($schemaPath)) { - $schema = $this->_filesystem->read($schemaPath); + if ($this->modulesDirectory->isFile($schemaPath)) { + $schema = $this->modulesDirectory->readFile($schemaPath); } else { $schema = ''; } diff --git a/app/code/Magento/Webapi/etc/webapi_rest/di.xml b/app/code/Magento/Webapi/etc/webapi_rest/di.xml index 6e6562d31b7..43c4b897ca2 100644 --- a/app/code/Magento/Webapi/etc/webapi_rest/di.xml +++ b/app/code/Magento/Webapi/etc/webapi_rest/di.xml @@ -97,4 +97,7 @@ <instance type="Magento\Authz\Service\AuthorizationV1Interface\Proxy" /> </param> </type> + <type name="Magento\Authz\Service\AuthorizationV1"> + <plugin name="webapiRestAuthorizationV1" type="Magento\Webapi\Model\Plugin\AuthorizationServiceV1" /> + </type> </config> diff --git a/app/code/Magento/Webapi/etc/webapi_soap/di.xml b/app/code/Magento/Webapi/etc/webapi_soap/di.xml index 922a5cf8290..c4fe3842352 100644 --- a/app/code/Magento/Webapi/etc/webapi_soap/di.xml +++ b/app/code/Magento/Webapi/etc/webapi_soap/di.xml @@ -45,4 +45,7 @@ <instance type="Magento\Authz\Service\AuthorizationV1Interface\Proxy" /> </param> </type> + <type name="Magento\Authz\Service\AuthorizationV1"> + <plugin name="webapiSoapAuthorizationV1" type="Magento\Webapi\Model\Plugin\AuthorizationServiceV1" /> + </type> </config> diff --git a/app/code/Magento/Weee/Block/Renderer/Weee/Tax.php b/app/code/Magento/Weee/Block/Renderer/Weee/Tax.php index 4bb315a10bc..f851724cbec 100644 --- a/app/code/Magento/Weee/Block/Renderer/Weee/Tax.php +++ b/app/code/Magento/Weee/Block/Renderer/Weee/Tax.php @@ -97,7 +97,7 @@ class Tax { $this->addChild( 'add_button', - 'Magento\Adminhtml\Block\Widget\Button', + 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add Tax'), 'data_attribute' => array('action' => 'add-fpt-item'), @@ -106,7 +106,7 @@ class Tax ); $this->addChild( 'delete_button', - 'Magento\Adminhtml\Block\Widget\Button', + 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Delete Tax'), 'data_attribute' => array('action' => 'delete-fpt-item'), diff --git a/app/code/Magento/Weee/etc/module.xml b/app/code/Magento/Weee/etc/module.xml index 03689c4dfdf..aea7319e908 100644 --- a/app/code/Magento/Weee/etc/module.xml +++ b/app/code/Magento/Weee/etc/module.xml @@ -34,7 +34,6 @@ <module name="Magento_Catalog"/> <module name="Magento_Tax"/> <module name="Magento_Sales"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Backend"/> <module name="Magento_Directory"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget.php b/app/code/Magento/Widget/Block/Adminhtml/Widget.php index 9a5d59998fc..82b9b7efb89 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget.php @@ -33,7 +33,7 @@ */ namespace Magento\Widget\Block\Adminhtml; -class Widget extends \Magento\Adminhtml\Block\Widget\Form\Container +class Widget extends \Magento\Backend\Block\Widget\Form\Container { protected function _construct() { diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php index 82fe67a694a..069f83bcede 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php @@ -181,7 +181,7 @@ class Chooser extends \Magento\Backend\Block\Template } $buttons = $config->getButtons(); - $chooseButton = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $chooseButton = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setType('button') ->setId($chooserId . 'control') ->setClass('btn-chooser') diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance.php index c4814f54de3..045180baf8f 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance.php @@ -33,7 +33,7 @@ */ namespace Magento\Widget\Block\Adminhtml\Widget; -class Instance extends \Magento\Adminhtml\Block\Widget\Grid\Container +class Instance extends \Magento\Backend\Block\Widget\Grid\Container { /** * Block constructor diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit.php index 877923015ac..27b98e7729c 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit.php @@ -33,7 +33,7 @@ */ namespace Magento\Widget\Block\Adminhtml\Widget\Instance; -class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +class Edit extends \Magento\Backend\Block\Widget\Form\Container { /** * Core registry diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Template.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Template.php index 5f72c4dbdad..fcdf857b0ff 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Template.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Template.php @@ -34,7 +34,7 @@ namespace Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Chooser; class Template - extends \Magento\Adminhtml\Block\Widget + extends \Magento\Backend\Block\Widget { /** * Prepare html output diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php index b4e41518926..a38b7635ce7 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php @@ -304,7 +304,7 @@ class Layout */ public function getAddLayoutButtonHtml() { - $button = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $button = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => __('Add Layout Update'), 'onclick' => 'WidgetInstance.addPageGroup({})', @@ -320,7 +320,7 @@ class Layout */ public function getRemoveLayoutButtonHtml() { - $button = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') + $button = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => $this->escapeJsQuote(__('Remove Layout Update')), 'onclick' => 'WidgetInstance.removePageGroup(this)', diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Properties.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Properties.php index 1678a92e756..a9f86f0415d 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Properties.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Properties.php @@ -35,7 +35,7 @@ namespace Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Tab; class Properties extends \Magento\Widget\Block\Adminhtml\Widget\Options - implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface + implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** * Prepare label for tab diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php index f1060f72ff1..9e74cd47d09 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php @@ -164,7 +164,7 @@ class Settings 'values' => $options )); $continueButton = $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Widget\Button') + ->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( 'label' => __('Continue'), 'onclick' => "setSettings('" . $this->getContinueUrl() . "', 'code', 'theme_id')", diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tabs.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tabs.php index 0dc7b90831c..71ddf9eecf6 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tabs.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tabs.php @@ -33,7 +33,7 @@ */ namespace Magento\Widget\Block\Adminhtml\Widget\Instance\Edit; -class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs +class Tabs extends \Magento\Backend\Block\Widget\Tabs { /** * Internal constructor diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php index 06a23fef50c..bd683905d8a 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php @@ -122,7 +122,7 @@ class Options extends \Magento\Backend\Block\Widget\Form\Generic $this->setData('main_fieldset', $fieldset); // add dependence javascript block - $block = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Form\Element\Dependence'); + $block = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Form\Element\Dependence'); $this->setChild('form_after', $block); return $fieldset; @@ -132,7 +132,7 @@ class Options extends \Magento\Backend\Block\Widget\Form\Generic * Add fields to main fieldset based on specified widget type * * @throws \Magento\Core\Exception - * @return \Magento\Adminhtml\Block\Widget\Form + * @return \Magento\Backend\Block\Widget\Form */ public function addFields() { diff --git a/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance.php b/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance.php index af49a12c94a..70a8403ae37 100644 --- a/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance.php +++ b/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance.php @@ -117,7 +117,7 @@ class Instance extends \Magento\Backend\App\Action ->load($instanceId) ->setCode($code); if (!$widgetInstance->getId()) { - $this->_getSession()->addError( + $this->messageManager->addError( __('Please specify a correct widget.') ); return false; @@ -199,8 +199,8 @@ class Instance extends \Magento\Backend\App\Action $widgetInstance = $this->_initWidgetInstance(); $result = $widgetInstance->validate(); if ($result !== true && is_string($result)) { - $this->_getSession()->addError($result); - $this->_view->getLayout()->initMessages('Magento\Adminhtml\Model\Session'); + $this->messageManager->addError($result); + $this->_view->getLayout()->initMessages(); $response->setError(true); $response->setMessage($this->_view->getLayout()->getMessagesBlock()->getGroupedHtml()); } @@ -224,7 +224,7 @@ class Instance extends \Magento\Backend\App\Action ->setWidgetParameters($this->getRequest()->getPost('parameters')); try { $widgetInstance->save(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('The widget instance has been saved.') ); if ($this->getRequest()->getParam('back', false)) { @@ -237,7 +237,7 @@ class Instance extends \Magento\Backend\App\Action } return; } catch (\Exception $exception) { - $this->_getSession()->addError($exception->getMessage()); + $this->messageManager->addError($exception->getMessage()); $this->_logger->logException($exception); $this->_redirect('adminhtml/*/edit', array('_current' => true)); return; @@ -256,11 +256,11 @@ class Instance extends \Magento\Backend\App\Action if ($widgetInstance) { try { $widgetInstance->delete(); - $this->_getSession()->addSuccess( + $this->messageManager->addSuccess( __('The widget instance has been deleted.') ); } catch (\Exception $e) { - $this->_getSession()->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } } $this->_redirect('adminhtml/*/'); @@ -298,9 +298,9 @@ class Instance extends \Magento\Backend\App\Action ->setUseMassaction(true) ->setProductTypeId($productTypeId) ->setSelectedProducts(explode(',', $selected)); - /* @var $serializer \Magento\Adminhtml\Block\Widget\Grid\Serializer */ + /* @var $serializer \Magento\Backend\Block\Widget\Grid\Serializer */ $serializer = $this->_view->getLayout()->createBlock( - 'Magento\Adminhtml\Block\Widget\Grid\Serializer', + 'Magento\Backend\Block\Widget\Grid\Serializer', '', array( 'data' => array( diff --git a/app/code/Magento/Widget/Model/Config/FileResolver.php b/app/code/Magento/Widget/Model/Config/FileResolver.php index da89fcdd363..7852d8ece98 100644 --- a/app/code/Magento/Widget/Model/Config/FileResolver.php +++ b/app/code/Magento/Widget/Model/Config/FileResolver.php @@ -35,20 +35,34 @@ class FileResolver implements \Magento\Config\FileResolverInterface protected $_moduleReader; /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem\Directory\ReadInterface */ - protected $_applicationDirs; + protected $themesDirectory; /** - * @param \Magento\Module\Dir\Reader $moduleReader - * @param \Magento\App\Dir $applicationDirs + * @var \Magento\Config\FileIteratorFactory + */ + protected $iteratorFactory; + + /** + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $modulesDirectory; + + /** + * @param \Magento\Filesystem $filesystem + * @param \Magento\Module\Dir\Reader $moduleReader + * @param \Magento\Config\FileIteratorFactory $iteratorFactory */ public function __construct( - \Magento\Module\Dir\Reader $moduleReader, - \Magento\App\Dir $applicationDirs - ) { - $this->_moduleReader = $moduleReader; - $this->_applicationDirs = $applicationDirs; + \Magento\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->iteratorFactory = $iteratorFactory; + $this->_moduleReader = $moduleReader; } /** @@ -56,18 +70,18 @@ class FileResolver implements \Magento\Config\FileResolverInterface */ public function get($filename, $scope) { - $fileList = array(); switch ($scope) { case 'global': - $fileList = $this->_moduleReader->getConfigurationFiles($filename); + $iterator = $this->_moduleReader->getConfigurationFiles($filename); break; case 'design': - $fileList = glob($this->_applicationDirs->getDir(\Magento\App\Dir::THEMES) - . "/*/*/etc/$filename", GLOB_NOSORT | GLOB_BRACE); + $fileList = $this->themesDirectory->search('#/' . preg_quote($filename) . '$#'); + $iterator = $this->iteratorFactory->create($this->themesDirectory, $fileList); break; default: + $iterator = $this->iteratorFactory->create($this->themesDirectory, array());; break; } - return $fileList; + return $iterator; } } diff --git a/app/code/Magento/Widget/Model/Template/Filter.php b/app/code/Magento/Widget/Model/Template/Filter.php index ee5d453d416..aff58998660 100644 --- a/app/code/Magento/Widget/Model/Template/Filter.php +++ b/app/code/Magento/Widget/Model/Template/Filter.php @@ -65,9 +65,9 @@ class Filter extends \Magento\Cms\Model\Template\Filter \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\View\LayoutInterface $layout, \Magento\View\LayoutFactory $layoutFactory, + \Magento\App\State $appState, \Magento\Widget\Model\Resource\Widget $widgetResource, - \Magento\Widget\Model\Widget $widget, - \Magento\App\State $appState + \Magento\Widget\Model\Widget $widget ) { $this->_widgetResource = $widgetResource; $this->_widget = $widget; diff --git a/app/code/Magento/Widget/Model/Widget/Instance.php b/app/code/Magento/Widget/Model/Widget/Instance.php index b1d1f08122a..261d02ebb34 100644 --- a/app/code/Magento/Widget/Model/Widget/Instance.php +++ b/app/code/Magento/Widget/Model/Widget/Instance.php @@ -107,6 +107,11 @@ class Instance extends \Magento\Core\Model\AbstractModel */ protected $mathRandom; + /** + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $_directory; + /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -118,6 +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\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $relatedCacheTypes @@ -134,6 +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\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $relatedCacheTypes = array(), @@ -147,6 +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->_namespaceResolver = $namespaceResolver; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -360,6 +368,7 @@ class Instance extends \Magento\Core\Model\AbstractModel /** * Retrieve option array of widget types * + * @param string * @return array */ public function getWidgetsOptionArray($value = 'code') @@ -414,7 +423,8 @@ class Instance extends \Magento\Core\Model\AbstractModel ), )); - if (is_readable($configFile)) { + $isReadable = $this->_directory->isReadable($this->_directory->getRelativePath($configFile)); + if ($isReadable) { $config = $this->_reader->readFile($configFile); $widgetName = isset($this->_widgetConfigXml['name']) ? $this->_widgetConfigXml['name'] : null; $themeWidgetConfig = null; diff --git a/app/code/Magento/Widget/etc/adminhtml/menu.xml b/app/code/Magento/Widget/etc/adminhtml/menu.xml index 4ce4c9a5a38..7efb20523e8 100644 --- a/app/code/Magento/Widget/etc/adminhtml/menu.xml +++ b/app/code/Magento/Widget/etc/adminhtml/menu.xml @@ -27,6 +27,6 @@ --> <config> <menu> - <add id="Magento_Widget::cms_widget_instance" title="Frontend Apps" module="Magento_Widget" sortOrder="50" parent="Magento_Adminhtml::content_elements" action="adminhtml/widget_instance" resource="Magento_Widget::widget_instance"/> + <add id="Magento_Widget::cms_widget_instance" title="Frontend Apps" module="Magento_Widget" sortOrder="50" parent="Magento_Backend::content_elements" action="adminhtml/widget_instance" resource="Magento_Widget::widget_instance"/> </menu> </config> diff --git a/app/code/Magento/Widget/etc/adminhtml/routes.xml b/app/code/Magento/Widget/etc/adminhtml/routes.xml index cab71b2ab96..bfe04048053 100644 --- a/app/code/Magento/Widget/etc/adminhtml/routes.xml +++ b/app/code/Magento/Widget/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Widget_Adminhtml" before="Magento_Adminhtml" /> + <module name="Magento_Widget" before="Magento_Adminhtml" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Widget/etc/module.xml b/app/code/Magento/Widget/etc/module.xml index 6ff15cc90dc..21ea39200a2 100755 --- a/app/code/Magento/Widget/etc/module.xml +++ b/app/code/Magento/Widget/etc/module.xml @@ -30,7 +30,6 @@ </sequence> <depends> <module name="Magento_Cms"/> - <module name="Magento_Adminhtml"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> <module name="Magento_Catalog"/> diff --git a/app/code/Magento/Wishlist/Block/AbstractBlock.php b/app/code/Magento/Wishlist/Block/AbstractBlock.php index 8a33aa02f36..ea5b305365b 100644 --- a/app/code/Magento/Wishlist/Block/AbstractBlock.php +++ b/app/code/Magento/Wishlist/Block/AbstractBlock.php @@ -64,13 +64,6 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd */ protected $_cachedItemPriceBlocks = array(); - /** - * Wishlist data - * - * @var \Magento\Wishlist\Helper\Data - */ - protected $_wishlistData; - /** * @var \Magento\Customer\Model\Session */ @@ -88,10 +81,16 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom - * @param \Magento\Wishlist\Helper\Data $wishlistData + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -100,15 +99,31 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, - \Magento\Wishlist\Helper\Data $wishlistData, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\ProductFactory $productFactory, array $data = array() ) { - $this->_wishlistData = $wishlistData; $this->_customerSession = $customerSession; $this->_productFactory = $productFactory; - parent::__construct($context, $catalogConfig, $registry, $taxData, $catalogData, $mathRandom, $data); + parent::__construct( + $context, + $catalogConfig, + $registry, + $taxData, + $catalogData, + $mathRandom, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, + $data + ); } /** @@ -132,7 +147,7 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd */ protected function _getHelper() { - return $this->_wishlistData; + return $this->_wishlistHelper; } /** @@ -247,12 +262,12 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd } /** - * Returns item configure url in wishlist - * - * @param \Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item $product - * - * @return string - */ + * Returns item configure url in wishlist + * + * @param \Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item $product + * + * @return string + */ public function getItemConfigureUrl($product) { if ($product instanceof \Magento\Catalog\Model\Product) { @@ -459,7 +474,7 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd */ public function getImageUrl($product) { - return (string)$this->helper('Magento\Catalog\Helper\Image')->init($product, 'small_image') + return (string)$this->_imageHelper->init($product, 'small_image') ->resize($this->getImageSize()); } diff --git a/app/code/Magento/Wishlist/Block/Customer/Sharing.php b/app/code/Magento/Wishlist/Block/Customer/Sharing.php index ff3d5249cc6..b718f205476 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Sharing.php +++ b/app/code/Magento/Wishlist/Block/Customer/Sharing.php @@ -51,20 +51,20 @@ class Sharing extends \Magento\View\Element\Template protected $_wishlistConfig; /** - * @var \Magento\Core\Model\Session\Generic + * @var \Magento\Session\Generic */ protected $_wishlistSession; /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Wishlist\Model\Config $wishlistConfig - * @param \Magento\Core\Model\Session\Generic $wishlistSession + * @param \Magento\Session\Generic $wishlistSession * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Wishlist\Model\Config $wishlistConfig, - \Magento\Core\Model\Session\Generic $wishlistSession, + \Magento\Session\Generic $wishlistSession, array $data = array() ) { $this->_wishlistConfig = $wishlistConfig; diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php index 9b7d8ceb487..8d318c965be 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php @@ -48,11 +48,17 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom - * @param \Magento\Wishlist\Helper\Data $wishlistData + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -61,7 +67,11 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, - \Magento\Wishlist\Helper\Data $wishlistData, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool, @@ -75,7 +85,11 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $taxData, $catalogData, $mathRandom, - $wishlistData, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, $customerSession, $productFactory, $data 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 7fb2ba4217c..2a6c6c099a0 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php @@ -47,11 +47,17 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom - * @param \Magento\Wishlist\Helper\Data $wishlistData + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -60,7 +66,11 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, - \Magento\Wishlist\Helper\Data $wishlistData, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool, @@ -74,7 +84,11 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock $taxData, $catalogData, $mathRandom, - $wishlistData, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, $customerSession, $productFactory, $data diff --git a/app/code/Magento/Wishlist/Block/Link.php b/app/code/Magento/Wishlist/Block/Link.php index 5cfc742ca61..defd33a1ffe 100644 --- a/app/code/Magento/Wishlist/Block/Link.php +++ b/app/code/Magento/Wishlist/Block/Link.php @@ -29,12 +29,31 @@ namespace Magento\Wishlist\Block; class Link extends \Magento\View\Element\Html\Link { + /** + * @var \Magento\Wishlist\Helper\Data + */ + protected $_wishlistHelper; + + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Wishlist\Helper\Data $wishlistHelper, + array $data = array() + ) { + $this->_wishlistHelper = $wishlistHelper; + parent::__construct($context, $data); + } + /** * @return string */ protected function _toHtml() { - if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) { + if ($this->_wishlistHelper->isAllow()) { return parent::_toHtml(); } return ''; @@ -71,7 +90,7 @@ class Link extends \Magento\View\Element\Html\Link */ protected function _getItemCount() { - return $this->helper('Magento\Wishlist\Helper\Data')->getItemCount(); + return $this->_wishlistHelper->getItemCount(); } /** diff --git a/app/code/Magento/Wishlist/Block/Share/Email/Items.php b/app/code/Magento/Wishlist/Block/Share/Email/Items.php index 7356ef91991..6422adf67d6 100644 --- a/app/code/Magento/Wishlist/Block/Share/Email/Items.php +++ b/app/code/Magento/Wishlist/Block/Share/Email/Items.php @@ -75,7 +75,7 @@ class Items extends \Magento\Wishlist\Block\AbstractBlock { $hasDescription = parent::hasDescription($item); if ($hasDescription) { - return ($item->getDescription() !== $this->_wishlistData->defaultCommentString()); + return ($item->getDescription() !== $this->_wishlistHelper->defaultCommentString()); } return $hasDescription; } diff --git a/app/code/Magento/Wishlist/Block/Share/Wishlist.php b/app/code/Magento/Wishlist/Block/Share/Wishlist.php index 568496ab822..2384339f8a7 100644 --- a/app/code/Magento/Wishlist/Block/Share/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Share/Wishlist.php @@ -55,11 +55,17 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Math\Random $mathRandom - * @param \Magento\Wishlist\Helper\Data $wishlistData + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\Element\Template\Context $context, @@ -68,7 +74,11 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Math\Random $mathRandom, - \Magento\Wishlist\Helper\Data $wishlistData, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, @@ -82,7 +92,11 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $taxData, $catalogData, $mathRandom, - $wishlistData, + $cartHelper, + $wishlistHelper, + $compareProduct, + $layoutHelper, + $imageHelper, $customerSession, $productFactory, $data diff --git a/app/code/Magento/Wishlist/Controller/AbstractController.php b/app/code/Magento/Wishlist/Controller/AbstractController.php index e75b74065ca..371e4398ec7 100644 --- a/app/code/Magento/Wishlist/Controller/AbstractController.php +++ b/app/code/Magento/Wishlist/Controller/AbstractController.php @@ -164,9 +164,8 @@ abstract class AbstractController extends \Magento\App\Action\Action } $redirectUrl = $item->getProductUrl(); } else { - $wishlistSession = $this->_objectManager->get('Magento\Wishlist\Model\Session'); foreach ($messages as $message) { - $wishlistSession->addError($message); + $this->messageManager->addError($message); } $redirectUrl = $indexUrl; } @@ -178,8 +177,7 @@ abstract class AbstractController extends \Magento\App\Action\Action $wishlist->save(); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Wishlist\Model\Session') - ->addError(__('We can\'t update wish list.')); + $this->messageManager->addError(__('We can\'t update wish list.')); $redirectUrl = $indexUrl; } @@ -188,7 +186,7 @@ abstract class AbstractController extends \Magento\App\Action\Action $products[] = '"' . $product->getName() . '"'; } - $this->_objectManager->get('Magento\Checkout\Model\Session')->addSuccess( + $this->messageManager->addSuccess( __('%1 product(s) have been added to shopping cart: %2.', count($addedItems), join(', ', $products)) ); } diff --git a/app/code/Magento/Wishlist/Controller/Index.php b/app/code/Magento/Wishlist/Controller/Index.php index f8e64824922..dd3eff6aef3 100644 --- a/app/code/Magento/Wishlist/Controller/Index.php +++ b/app/code/Magento/Wishlist/Controller/Index.php @@ -92,10 +92,8 @@ class Index } /** - * Dispatch request - * * @param RequestInterface $request - * @return mixed + * @return \Magento\App\ResponseInterface * @throws \Magento\App\Action\NotFoundException */ public function dispatch(RequestInterface $request) @@ -161,12 +159,10 @@ class Index $this->_coreRegistry->register('wishlist', $wishlist); } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Wishlist\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); return false; } catch (\Exception $e) { - $this->_objectManager->get('Magento\Wishlist\Model\Session')->addException($e, - __('Wish List could not be created.') - ); + $this->messageManager->addException($e, __('Wish List could not be created.')); return false; } @@ -195,13 +191,7 @@ class Index } } - $messageStores = array( - 'Magento\Customer\Model\Session', - 'Magento\Checkout\Model\Session', - 'Magento\Catalog\Model\Session', - 'Magento\Wishlist\Model\Session' - ); - $this->_view->getLayout()->initMessages($messageStores); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -228,7 +218,7 @@ class Index $product = $this->_objectManager->create('Magento\Catalog\Model\Product')->load($productId); if (!$product->getId() || !$product->isVisibleInCatalog()) { - $session->addError(__('We can\'t specify a product.')); + $this->messageManager->addError(__('We can\'t specify a product.')); $this->_redirect('*/'); return; } @@ -271,13 +261,15 @@ class Index /** @var $helper \Magento\Wishlist\Helper\Data */ $helper = $this->_objectManager->get('Magento\Wishlist\Helper\Data')->calculate(); $message = __('%1 has been added to your wishlist. Click <a href="%2">here</a> to continue shopping.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getName()), $this->_objectManager->get('Magento\Escaper')->escapeUrl($referer)); - $session->addSuccess($message); + $this->messageManager->addSuccess($message); } catch (\Magento\Core\Exception $e) { - $session->addError(__('An error occurred while adding item to wish list: %1', $e->getMessage())); + $this->messageManager->addError( + __('An error occurred while adding item to wish list: %1', $e->getMessage()) + ); } catch (\Exception $e) { - $session->addError(__('An error occurred while adding item to wish list.')); + $this->messageManager->addError(__('An error occurred while adding item to wish list.')); $this->_objectManager->get('Magento\Logger')->logException($e); } @@ -321,12 +313,11 @@ class Index $this->_objectManager->get('Magento\Catalog\Helper\Product\View') ->prepareAndRender($item->getProductId(), $this, $params); } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Customer\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_redirect('*'); return; } catch (\Exception $e) { - $this->_objectManager->get('Magento\Customer\Model\Session') - ->addError(__('We can\'t configure the product.')); + $this->messageManager->addError(__('We can\'t configure the product.')); $this->_objectManager->get('Magento\Logger')->logException($e); $this->_redirect('*'); return; @@ -347,7 +338,7 @@ class Index $product = $this->_objectManager->create('Magento\Catalog\Model\Product')->load($productId); if (!$product->getId() || !$product->isVisibleInCatalog()) { - $session->addError(__('We can\'t specify a product.')); + $this->messageManager->addError(__('We can\'t specify a product.')); $this->_redirect('*/'); return; } @@ -376,11 +367,11 @@ class Index $this->_objectManager->get('Magento\Wishlist\Helper\Data')->calculate(); $message = __('%1 has been updated in your wish list.', $product->getName()); - $session->addSuccess($message); + $this->messageManager->addSuccess($message); } catch (\Magento\Core\Exception $e) { - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $session->addError(__('An error occurred while updating wish list.')); + $this->messageManager->addError(__('An error occurred while updating wish list.')); $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('*/*', array('wishlist_id' => $wishlist->getId())); @@ -434,7 +425,7 @@ class Index $item->delete(); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_objectManager->get('Magento\Customer\Model\Session')->addError( + $this->messageManager->addError( __('Can\'t delete item from wishlist') ); } @@ -450,7 +441,7 @@ class Index ->save(); $updatedItems++; } catch (\Exception $e) { - $this->_objectManager->get('Magento\Customer\Model\Session')->addError( + $this->messageManager->addError( __('Can\'t save description %1', $this->_objectManager->get('Magento\Escaper')->escapeHtml($description)) ); } @@ -463,7 +454,7 @@ class Index $this->_objectManager->get('Magento\Wishlist\Helper\Data')->calculate(); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Customer\Model\Session')->addError(__('Can\'t update wish list')); + $this->messageManager->addError(__('Can\'t update wish list')); } } @@ -495,11 +486,11 @@ class Index $item->delete(); $wishlist->save(); } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Customer\Model\Session')->addError( + $this->messageManager->addError( __('An error occurred while deleting the item from wish list: %1', $e->getMessage()) ); } catch(\Exception $e) { - $this->_objectManager->get('Magento\Customer\Model\Session')->addError( + $this->messageManager->addError( __('An error occurred while deleting the item from wish list.') ); } @@ -544,7 +535,7 @@ class Index $item->setQty($qty); } - /* @var $session \Magento\Core\Model\Session\Generic */ + /* @var $session \Magento\Session\Generic */ $session = $this->_objectManager->get('Magento\Wishlist\Model\Session'); $cart = $this->_objectManager->get('Magento\Checkout\Model\Cart'); @@ -575,16 +566,16 @@ class Index $this->_objectManager->get('Magento\Wishlist\Helper\Data')->calculate(); } catch (\Magento\Core\Exception $e) { if ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_NOT_SALABLE) { - $session->addError(__('This product(s) is out of stock.')); + $this->messageManager->addError(__('This product(s) is out of stock.')); } else if ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS) { - $this->_objectManager->create('Magento\Catalog\Model\Session')->addNotice($e->getMessage()); + $this->messageManager->addNotice($e->getMessage()); $redirectUrl = $this->_url->getUrl('*/*/configure/', array('id' => $item->getId())); } else { - $this->_objectManager->get('Magento\Catalog\Model\Session')->addNotice($e->getMessage()); + $this->messageManager->addNotice($e->getMessage()); $redirectUrl = $this->_url->getUrl('*/*/configure/', array('id' => $item->getId())); } } catch (\Exception $e) { - $session->addException($e, __('Cannot add item to shopping cart')); + $this->messageManager->addException($e, __('Cannot add item to shopping cart')); } $this->_objectManager->get('Magento\Wishlist\Helper\Data')->calculate(); @@ -628,14 +619,14 @@ class Index $this->_objectManager->get('Magento\Wishlist\Helper\Data')->calculate(); $productName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($item->getProduct()->getName()); $wishlistName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($wishlist->getName()); - $session->addSuccess( + $this->messageManager->addSuccess( __("%1 has been moved to wish list %2", $productName, $wishlistName) ); $wishlist->save(); } catch (\Magento\Core\Exception $e) { - $session->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $session->addException($e, __('We can\'t move the item to the wish list.')); + $this->messageManager->addException($e, __('We can\'t move the item to the wish list.')); } return $this->getResponse()->setRedirect($this->_objectManager->get('Magento\Checkout\Helper\Cart')->getCartUrl()); @@ -648,7 +639,7 @@ class Index { $this->_getWishlist(); $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages(array('Magento\Customer\Model\Session', 'Magento\Wishlist\Model\Session')); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -696,7 +687,7 @@ class Index } if ($error) { - $this->_objectManager->get('Magento\Wishlist\Model\Session')->addError($error); + $this->messageManager->addError($error); $this->_objectManager->get('Magento\Wishlist\Model\Session') ->setSharingForm($this->getRequest()->getPost()); $this->_redirect('*/*/share'); @@ -756,13 +747,11 @@ class Index $translate->setTranslateInline(true); $this->_eventManager->dispatch('wishlist_share', array('wishlist'=>$wishlist)); - $this->_objectManager->get('Magento\Customer\Model\Session')->addSuccess( - __('Your wish list has been shared.') - ); + $this->messageManager->addSuccess(__('Your wish list has been shared.')); $this->_redirect('*/*', array('wishlist_id' => $wishlist->getId())); } catch (\Exception $e) { $translate->setTranslateInline(true); - $this->_objectManager->get('Magento\Wishlist\Model\Session')->addError($e->getMessage()); + $this->messageManager->addError($e->getMessage()); $this->_objectManager->get('Magento\Wishlist\Model\Session') ->setSharingForm($this->getRequest()->getPost()); $this->_redirect('*/*/share'); @@ -801,7 +790,8 @@ class Index try { $info = unserialize($option->getValue()); - $filePath = $this->_objectManager->get('Magento\App\Dir')->getDir() . $info['quote_path']; + $filePath = $this->_objectManager->get('Magento\Filesystem')->getPath(\Magento\Filesystem::ROOT) + . $info['quote_path']; $secretKey = $this->getRequest()->getParam('key'); if ($secretKey == $info['secret_key']) { diff --git a/app/code/Magento/Wishlist/Controller/Shared.php b/app/code/Magento/Wishlist/Controller/Shared.php index 67e3775fe1e..f1827de7b0b 100644 --- a/app/code/Magento/Wishlist/Controller/Shared.php +++ b/app/code/Magento/Wishlist/Controller/Shared.php @@ -96,7 +96,7 @@ class Shared extends \Magento\Wishlist\Controller\AbstractController $this->_coreRegistry->register('shared_wishlist', $wishlist); $this->_view->loadLayout(); - $this->_view->getLayout()->initMessages(array('Magento\Checkout\Model\Session', 'Magento\Wishlist\Model\Session')); + $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); } @@ -115,7 +115,7 @@ class Shared extends \Magento\Wishlist\Controller\AbstractController $item = $this->_objectManager->create('Magento\Wishlist\Model\Item')->load($itemId); - /* @var $session \Magento\Core\Model\Session\Generic */ + /* @var $session \Magento\Session\Generic */ $session = $this->_objectManager->get('Magento\Wishlist\Model\Session'); $cart = $this->_objectManager->get('Magento\Checkout\Model\Cart'); @@ -134,13 +134,13 @@ class Shared extends \Magento\Wishlist\Controller\AbstractController } } catch (\Magento\Core\Exception $e) { if ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_NOT_SALABLE) { - $session->addError(__('This product(s) is out of stock.')); + $this->messageManager->addError(__('This product(s) is out of stock.')); } else { - $this->_objectManager->get('Magento\Catalog\Model\Session')->addNotice($e->getMessage()); + $this->messageManager->addNotice($e->getMessage()); $redirectUrl = $item->getProductUrl(); } } catch (\Exception $e) { - $session->addException($e, __('Cannot add item to shopping cart')); + $this->messageManager->addException($e, __('Cannot add item to shopping cart')); } return $this->getResponse()->setRedirect($redirectUrl); diff --git a/app/code/Magento/Wishlist/Model/Observer.php b/app/code/Magento/Wishlist/Model/Observer.php index e0cf923465e..1672c184443 100644 --- a/app/code/Magento/Wishlist/Model/Observer.php +++ b/app/code/Magento/Wishlist/Model/Observer.php @@ -55,6 +55,11 @@ class Observer extends \Magento\Core\Model\AbstractModel */ protected $_wishlistFactory; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -62,6 +67,7 @@ class Observer extends \Magento\Core\Model\AbstractModel * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Wishlist\Model\WishlistFactory $wishlistFactory + * @param \Magento\Message\ManagerInterface $messageManager * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -73,6 +79,7 @@ class Observer extends \Magento\Core\Model\AbstractModel \Magento\Checkout\Model\Session $checkoutSession, \Magento\Customer\Model\Session $customerSession, \Magento\Wishlist\Model\WishlistFactory $wishlistFactory, + \Magento\Message\ManagerInterface $messageManager, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -81,6 +88,7 @@ class Observer extends \Magento\Core\Model\AbstractModel $this->_checkoutSession = $checkoutSession; $this->_customerSession = $customerSession; $this->_wishlistFactory = $wishlistFactory; + $this->messageManager = $messageManager; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -185,7 +193,7 @@ class Observer extends \Magento\Core\Model\AbstractModel $this->_checkoutSession->setWishlistPendingUrls($urls); $this->_checkoutSession->setWishlistPendingMessages($messages); - $this->_checkoutSession->addError($message); + $this->messageManager->addError($message); $observer->getEvent()->getResponse()->setRedirect($url); $this->_checkoutSession->setNoCartRedirect(true); diff --git a/app/code/Magento/Wishlist/etc/adminhtml/di.xml b/app/code/Magento/Wishlist/etc/adminhtml/di.xml index 7d7328db7c5..adad5f7df6a 100644 --- a/app/code/Magento/Wishlist/etc/adminhtml/di.xml +++ b/app/code/Magento/Wishlist/etc/adminhtml/di.xml @@ -29,10 +29,15 @@ <value type="bool">false</value> </param> </type> - <virtualType name="Magento\Wishlist\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\Wishlist\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>wishlist</value> </param> + </virtualType> + <virtualType name="Magento\Wishlist\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\Wishlist\Model\Session\Storage" /> + </param> <param name="sessionName"> <value>adminhtml</value> </param> diff --git a/app/code/Magento/Wishlist/etc/email_templates.xml b/app/code/Magento/Wishlist/etc/email_templates.xml index 49ff8b6046f..8d0e232dd6d 100644 --- a/app/code/Magento/Wishlist/etc/email_templates.xml +++ b/app/code/Magento/Wishlist/etc/email_templates.xml @@ -24,5 +24,5 @@ */ --> <config> - <template id="wishlist_email_email_template" label="Wishlist Sharing" file="share_notification.html" type="html"/> + <template id="wishlist_email_email_template" label="Wishlist Sharing" file="share_notification.html" type="html" module="Magento_Wishlist"/> </config> diff --git a/app/code/Magento/Wishlist/etc/frontend/di.xml b/app/code/Magento/Wishlist/etc/frontend/di.xml index cbac21f627b..ed64abd78dd 100644 --- a/app/code/Magento/Wishlist/etc/frontend/di.xml +++ b/app/code/Magento/Wishlist/etc/frontend/di.xml @@ -24,18 +24,20 @@ */ --> <config> - <virtualType name="Magento\Wishlist\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> + <virtualType name="Magento\Wishlist\Model\Session\Storage" type="Magento\Session\Storage"> + <param name="namespace"> <value>wishlist</value> </param> + </virtualType> + <virtualType name="Magento\Wishlist\Model\Session" type="Magento\Session\Generic"> + <param name="storage"> + <instance type="Magento\Wishlist\Model\Session\Storage" /> + </param> <param name="sessionName"> <value>frontend</value> </param> </virtualType> - <type name="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> - <value>wishlist</value> - </param> + <type name="Magento\Session\Generic"> <param name="sessionName"> <value>frontend</value> </param> diff --git a/app/design/adminhtml/magento_backend/Magento_Adminhtml/layout/default.xml b/app/design/adminhtml/magento_backend/Magento_Backend/layout/default.xml similarity index 100% rename from app/design/adminhtml/magento_backend/Magento_Adminhtml/layout/default.xml rename to app/design/adminhtml/magento_backend/Magento_Backend/layout/default.xml diff --git a/app/design/install/magento_basic/images/i_notice.gif b/app/design/install/magento_basic/images/i_notice.gif new file mode 100644 index 0000000000000000000000000000000000000000..17733eff3fa73171ffbce8254fa0b368d940b74d GIT binary patch literal 802 zcmcJM|1Z>W9LHbp<2c`rJ9KE|IG-Fg*CdBp<VNMPaxvN}cSs^%65BPCyVFtJY2GV0 zj%dSL{6PBTSesKK>(*uKkgc;TvRP8X(&pli==sC*r|09B$1~|vB0pNp0e@Hmuv+i$ zSP=ktd(*!zqKF94>#rLOH%IkoVxpw96h52LI|HIpZRm86NPteKi9}#BNhOjfv$-lc z8AviOKOag<<0>l?x3=ovOdua0;Br|@OLBtn)D0tofL1N4tc3RVOo4zH(xIfJV38<X z-G~|+&j|!jRRxPnXnR}r(X`9D&dj2UiiF5W=<P!zBiAA${dBskn_H-_PeP@FuP?N< zBPJ7mt)t~-g~d|c+bfnz;W>%;d?+j19k_XV!q`~R#wKcMMXjwF#l`S_6-7lIsIO09 zFd!=nl(k4I70k||?(R#gtIG8BL$!5?!Eh7`L-~Av8V%k~p@oGi7RzPV%zq90kL{j) z2-~Z@Pr%+<4RS@z9XKAJ7N=}bso~^h3MF%2W3$SShp`J&)1mOjXJfHfXNSF(plKbR zG`nL4LasQdUu~zoNQTGY=#hpa*pVc;I5B;^hJ)!&Q;5&TAx61}8$N0x6WSgbML5DT z6^h-BPcdzU+^@A84<00i)E#PSAy+e)JL8h#T$r}NS&;Wp>B_F@HSshp*C{%Buq%h@ z?ArNIXfaX(U#VsW9429Ep5tSB%*zoQY<p}pJYhh9nwr3{1PF(3a8ZxcB;eVy)%ur7 zLBz2Pd%3uw`~)#qk|S<XvsNTL;Q-yjVKxM(oQ{8Q-xK)zHf2p?E0eQ5amC@g^VzAg zA#_C>!s*l}kJdfVwbYau!%(Q3^{<mxGk7R&o%vL)VM}^&5iLd*)}Qw}kSH$^p9faR z-R#f;y*O2M5Z`l~HH^IYVIJ)lHhpO6{P|@P&)daa(5-)?q&p3C<W_I2%swkHuL_hb IkO9R0132Fp3;+NC literal 0 HcmV?d00001 diff --git a/app/design/install/magento_basic/images/validation_advice_bg.gif b/app/design/install/magento_basic/images/validation_advice_bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..46b1a2267ba5ad31f59a9c6cd8eaac9ee3b0f8ce GIT binary patch literal 134 zcmZ?wbhEHb<YeGw*v!N5efR3Gi+Vq|<$PN`<DHe@&&Rhu1nT^HdiR|<-?uG`-<fiM zKd|xluWt-6p!k!8k%57SK?fuNGJ}D|c!FoxGGCR*X%n1gT@mDBG-62NIhCN$kRa2& gNv2Ie#%HfV`++0dU*7CG;(KY+91%8APZkDi0Dg`$ivR!s literal 0 HcmV?d00001 diff --git a/app/etc/di.xml b/app/etc/di.xml index 95445ba68ea..d04c140be2d 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -63,6 +63,12 @@ <preference for="Magento\View\Design\Theme\Domain\StagingInterface" type="Magento\Core\Model\Theme\Domain\Staging" /> <preference for="Magento\Json\EncoderInterface" type="Magento\Json\Encoder" /> <preference for="Magento\Json\DecoderInterface" type="Magento\Json\Decoder" /> + <preference for="Magento\Message\ManagerInterface" type="Magento\Message\Manager" /> + <type name="Magento\Message\Manager"> + <param name="session"> + <instance type="Magento\Message\Session\Proxy" /> + </param> + </type> <type name="Magento\View\BlockPool" shared="false" /> <type name="Magento\App\Request\Http"> <param name="pathInfoProcessor"> @@ -70,6 +76,19 @@ </param> </type> <preference for="Magento\Error\HandlerInterface" type="Magento\App\Error\Handler" /> + <preference for="Magento\Session\SaveHandlerInterface" type="Magento\Session\SaveHandler" /> + <type name="Magento\Session\SaveHandler"> + <param name="saveMethod"> + <value type="argument">Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD</value> + </param> + </type> + <type name="Magento\Session\SaveHandlerFactory"> + <param name="handlers"> + <value> + <db>Magento\Session\SaveHandler\DbTable</db> + </value> + </param> + </type> <preference for="Magento\Module\Output\ConfigInterface" type="Magento\Core\Model\Module\Output\Config" /> <preference for="Magento\View\Design\Theme\CustomizationInterface" type="Magento\View\Design\Theme\Customization" /> <preference for="Magento\Image\Adapter\ConfigInterface" type="Magento\Core\Model\Image\Adapter\Config" /> @@ -153,11 +172,6 @@ <instance type="Magento\Core\Model\Config\Proxy" /> </param> </type> - <type name="Magento\Filesystem" shared="false"> - <param name="adapter"> - <instance type="Magento\Filesystem\Adapter\Local" /> - </param> - </type> <type name="Magento\Data\Structure" shared="false" /> <type name="Magento\Core\Model\DataService\Path\Composite"> <param name="items"> @@ -256,19 +270,19 @@ <value> <urlLib> <key type="const">Magento\Core\Model\Store::URL_TYPE_LIB</key> - <value type="const">Magento\App\Dir::PUB_LIB</value> + <value type="const">Magento\Filesystem::PUB_LIB</value> </urlLib> <urlMedia> <key type="const">Magento\Core\Model\Store::URL_TYPE_MEDIA</key> - <value type="const">Magento\App\Dir::MEDIA</value> + <value type="const">Magento\Filesystem::MEDIA</value> </urlMedia> <urlStatic> <key type="const">Magento\Core\Model\Store::URL_TYPE_STATIC</key> - <value type="const">Magento\App\Dir::STATIC_VIEW</value> + <value type="const">Magento\Filesystem::STATIC_VIEW</value> </urlStatic> <urlCache> <key type="const">Magento\Core\Model\Store::URL_TYPE_CACHE</key> - <value type="const">Magento\App\Dir::PUB_VIEW_CACHE</value> + <value type="const">Magento\Filesystem::PUB_VIEW_CACHE</value> </urlCache> </value> </param> @@ -278,6 +292,14 @@ <value/> </param> </type> + <type name="Magento\Filesystem"> + <param name="fileReadFactory"> + <instance type="Magento\Filesystem\File\ReadFactory" /> + </param> + <param name="fileWriteFactory"> + <instance type="Magento\Filesystem\File\WriteFactory" /> + </param> + </type> <type name="Magento\App\FrontController"> <plugin name="install" type="Magento\Module\FrontController\Plugin\Install" sortOrder="40"/> </type> diff --git a/dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixture.php b/dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixture.php index e29a6ed47c6..40a7b22dcb3 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixture.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixture.php @@ -134,7 +134,7 @@ class DataFixture if (is_callable($fixtureMethod)) { $result[] = $fixtureMethod; } else { - $result[] = $this->_fixtureBaseDir . DIRECTORY_SEPARATOR . $fixture; + $result[] = $this->_fixtureBaseDir . '/' . $fixture; } } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Application.php b/dev/tests/integration/framework/Magento/TestFramework/Application.php index c39dd300e0c..de76dca22b9 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Application.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Application.php @@ -27,6 +27,8 @@ namespace Magento\TestFramework; +use Magento\Filesystem; + /** * Encapsulates application installation, initialization and uninstall * @@ -139,13 +141,13 @@ class Application $generationDir = "$installDir/generation"; $this->_initParams = array( - \Magento\App\Dir::PARAM_APP_DIRS => array( - \Magento\App\Dir::CONFIG => $this->_installEtcDir, - \Magento\App\Dir::VAR_DIR => $installDir, - \Magento\App\Dir::MEDIA => "$installDir/media", - \Magento\App\Dir::STATIC_VIEW => "$installDir/pub_static", - \Magento\App\Dir::PUB_VIEW_CACHE => "$installDir/pub_cache", - \Magento\App\Dir::GENERATION => $generationDir, + Filesystem::PARAM_APP_DIRS => array( + Filesystem::CONFIG => 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) ), \Magento\App\State::PARAM_MODE => $appMode ); @@ -235,6 +237,22 @@ 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'); + $verification->createAndVerifyDirectories(); + + $directoryList = $objectManager->get('Magento\Filesystem\DirectoryList'); + $directoryListConfig = $objectManager->get('Magento\Filesystem\DirectoryList\Configuration'); + $directoryListConfig->configure($directoryList); + + $directories = isset($overriddenParams[\Magento\Filesystem::PARAM_APP_DIRS]) + ? $overriddenParams[\Magento\Filesystem::PARAM_APP_DIRS] + : array(); + foreach ($directories as $code => $configOverrides) { + $config = array_merge($directoryList->getConfig($code), $configOverrides); + $directoryList->addDirectory($code, $config); + } } /** @@ -280,12 +298,12 @@ class Application { $this->_ensureDirExists($this->_installDir); $this->_ensureDirExists($this->_installEtcDir); - $this->_ensureDirExists($this->_installDir . DIRECTORY_SEPARATOR . 'media'); - $this->_ensureDirExists($this->_installDir . DIRECTORY_SEPARATOR . 'static'); + $this->_ensureDirExists($this->_installDir . '/media'); + $this->_ensureDirExists($this->_installDir . '/static'); // Copy configuration files $globalConfigFiles = glob( - $this->_globalConfigDir . DIRECTORY_SEPARATOR . '{*,*' . DIRECTORY_SEPARATOR . '*}.xml', GLOB_BRACE + $this->_globalConfigDir . '/{*,*/*}.xml', GLOB_BRACE ); foreach ($globalConfigFiles as $file) { $targetFile = $this->_installEtcDir . str_replace($this->_globalConfigDir, '', $file); @@ -296,10 +314,10 @@ class Application foreach ($this->_moduleEtcFiles as $file) { $targetModulesDir = $this->_installEtcDir . '/modules'; $this->_ensureDirExists($targetModulesDir); - copy($file, $targetModulesDir . DIRECTORY_SEPARATOR . basename($file)); + copy($file, $targetModulesDir . '/' . basename($file)); } - /* Make sure that local.xml contains an invalid installation date */ + /* Make sure that local.xml does not contain an invalid installation date */ $installDate = (string)$this->_localXml->install->date; if ($installDate && strtotime($installDate)) { throw new \Magento\Exception('Local configuration must contain an invalid installation date.'); @@ -398,7 +416,20 @@ class Application */ protected function _cleanupFilesystem() { - \Magento\Io\File::rmdirRecursive($this->_installDir); + if (!is_dir($this->_installDir)) { + return; + } + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator( + $this->_installDir, + \FilesystemIterator::SKIP_DOTS + ), + \RecursiveIteratorIterator::CHILD_FIRST + ); + foreach ($iterator as $path) { + $path->isFile() ? unlink($path->getPathname()) : rmdir($path->getPathname()); + } + rmdir($this->_installDir); } /** diff --git a/dev/tests/integration/framework/Magento/TestFramework/Bootstrap.php b/dev/tests/integration/framework/Magento/TestFramework/Bootstrap.php index f6960b85dd4..20638149bde 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Bootstrap.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Bootstrap.php @@ -88,9 +88,9 @@ class Bootstrap /** * Constructor * - * @param \Magento\TestFramework\Bootstrap\Settings $settings - * @param \Magento\TestFramework\Bootstrap\Environment $envBootstrap - * @param \Magento\TestFramework\Bootstrap\DocBlock $docBlockBootstrap + * @param \Magento\TestFramework\Bootstrap\Settings $settings, + * @param \Magento\TestFramework\Bootstrap\Environment $envBootstrap, + * @param \Magento\TestFramework\Bootstrap\DocBlock $docBlockBootstrap, * @param \Magento\TestFramework\Bootstrap\Profiler $profilerBootstrap * @param \Magento\Shell $shell * @param string $tmpDir @@ -219,7 +219,12 @@ class Bootstrap $this->_shell ); return new \Magento\TestFramework\Application( - $dbInstance, $installDir, $localConfigXml, $globalConfigDir, $moduleConfigFiles, $appMode + $dbInstance, + $installDir, + $localConfigXml, + $globalConfigDir, + $moduleConfigFiles, + $appMode ); } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Bootstrap/Settings.php b/dev/tests/integration/framework/Magento/TestFramework/Bootstrap/Settings.php index 9d8e23cd495..de9aa29aabb 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Bootstrap/Settings.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Bootstrap/Settings.php @@ -146,7 +146,7 @@ class Settings */ protected function _resolvePath($relativePath) { - return $this->_baseDir . DIRECTORY_SEPARATOR . $relativePath; + return $this->_baseDir . '/' . $relativePath; } /** diff --git a/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php b/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php index f0e7f413057..ef8d44dcdf5 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php @@ -37,10 +37,10 @@ class Mysql extends \Magento\TestFramework\Db\AbstractDb */ public function cleanup() { - $script = $this->_varPath . DIRECTORY_SEPARATOR . 'drop_create_database.sql'; + $script = $this->_varPath . '/drop_create_database.sql'; $this->_createScript($script, "DROP DATABASE `{$this->_schema}`; CREATE DATABASE `{$this->_schema}`"); $this->_shell->execute( - 'mysql --protocol=TCP --host=%s --user=%s --password=%s %s < %s', + 'mysql --host=%s --user=%s --password=%s %s < %s', array($this->_host, $this->_user, $this->_password, $this->_schema, $script) ); } diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php index 500805dd68b..5daa7c1dd90 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php @@ -61,6 +61,11 @@ class ObjectManager extends \Magento\App\ObjectManager if (isset($this->_sharedInstances['Magento\Config\Scope'])) { $sharedInstances['Magento\Config\Scope'] = $this->_sharedInstances['Magento\Config\Scope']; } + + if (isset($this->_sharedInstances['Magento\Core\Model\Session\Config'])) { + $sharedInstances['Magento\Core\Model\Session\Config'] = + $this->_sharedInstances['Magento\Core\Model\Session\Config']; + } $this->_sharedInstances = $sharedInstances; $this->_config->clean(); diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php index 09a58e7defb..b3691ebc960 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php @@ -24,8 +24,12 @@ namespace Magento\TestFramework; -use Magento\App\Dir; - +/** + * Class ObjectManagerFactory + * + * @package Magento\TestFramework + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class ObjectManagerFactory extends \Magento\App\ObjectManagerFactory { /** @@ -62,18 +66,17 @@ class ObjectManagerFactory extends \Magento\App\ObjectManagerFactory */ public function restore(ObjectManager $objectManager, $rootDir, array $arguments) { - $directories = new Dir( - $rootDir, - isset($arguments[Dir::PARAM_APP_URIS]) ? $arguments[Dir::PARAM_APP_URIS] : array(), - isset($arguments[Dir::PARAM_APP_DIRS]) ? $arguments[Dir::PARAM_APP_DIRS] : array() - ); + $directories = isset($arguments[\Magento\Filesystem::PARAM_APP_DIRS]) + ? $arguments[\Magento\Filesystem::PARAM_APP_DIRS] + : array(); + $directoryList = new \Magento\Filesystem\DirectoryList($rootDir, $directories); \Magento\TestFramework\ObjectManager::setInstance($objectManager); $this->_pluginList->reset(); $objectManager->configure($this->_primaryConfigData); - $objectManager->addSharedInstance($directories, 'Magento\App\Dir'); + $objectManager->addSharedInstance($directoryList, 'Magento\Filesystem\DirectoryList'); $objectManager->configure(array( 'Magento\View\Design\FileResolution\Strategy\Fallback\CachingProxy' => array( 'parameters' => array('canSaveMap' => false) @@ -90,33 +93,30 @@ class ObjectManagerFactory extends \Magento\App\ObjectManagerFactory $options = new \Magento\App\Config( $arguments, - new \Magento\App\Config\Loader($directories) + new \Magento\App\Config\Loader($directoryList) ); + $objectManager->addSharedInstance($options, 'Magento\App\Config'); $objectManager->getFactory()->setArguments($options->get()); $objectManager->configure( $objectManager->get('Magento\App\ObjectManager\ConfigLoader')->load('global') ); - /** @var \Magento\App\Dir\Verification $verification */ - $verification = $objectManager->get('Magento\App\Dir\Verification'); - $verification->createAndVerifyDirectories(); - return $objectManager; } /** * Load primary config data * - * @param Dir $directories + * @param string $configDirectoryPath * @param string $appMode * @return array * @throws \Magento\BootstrapException */ - protected function _loadPrimaryConfig(Dir $directories, $appMode) + protected function _loadPrimaryConfig($configDirectoryPath, $appMode) { if (null === $this->_primaryConfigData) { - $this->_primaryConfigData = parent::_loadPrimaryConfig($directories, $appMode); + $this->_primaryConfigData = parent::_loadPrimaryConfig($configDirectoryPath, $appMode); } return $this->_primaryConfigData; } diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php index 16e6e246669..06722a03bd1 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 ) ); - $dirs = $this->_objectManager->get('Magento\App\Dir'); - $modulesDir = $dirs->getDir(\Magento\App\Dir::MODULES); + $filesystem = $this->_objectManager->get('Magento\Filesystem'); + $modulesDir = $filesystem->getPath(\Magento\Filesystem::MODULES); $this->_schemaFile = $modulesDir . $this->_getXsdPath(); } } @@ -91,7 +91,7 @@ abstract class AbstractConfigFiles extends \PHPUnit_Framework_TestCase if ($skip) { $this->markTestSkipped('There are no xml files in the system for this test.'); } - $domConfig = new \Magento\Config\Dom(file_get_contents($file)); + $domConfig = new \Magento\Config\Dom($file); $result = $domConfig->validate($this->_schemaFile, $errors); $message = "Invalid XML-file: {$file}\n"; foreach ($errors as $error) { @@ -108,7 +108,7 @@ abstract class AbstractConfigFiles extends \PHPUnit_Framework_TestCase $this->markTestSkipped('There are no xml files in the system for this test.'); } // have the file resolver return all relevant xml files - $this->_fileResolverMock->expects($this->once())->method('get') + $this->_fileResolverMock->expects($this->any())->method('get') ->will($this->returnValue($this->getXmlConfigFiles())); try { // this will merge all xml files and validate them @@ -129,27 +129,24 @@ abstract class AbstractConfigFiles extends \PHPUnit_Framework_TestCase public function xmlConfigFileProvider() { $fileList = $this->getXmlConfigFiles(); - if (empty($fileList)) { - return array(array(false, true)); + foreach ($fileList as $fileContent) { + $result[] = array($fileContent); } - - $dataProviderResult = array(); - foreach ($fileList as $file) { - $dataProviderResult[$file] = array($file); - } - return $dataProviderResult; + return $result; } /** * Finds all config xml files based on a path glob. * - * @return array + * @return \Magento\Config\FileIterator */ public function getXmlConfigFiles() { - return glob( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir('app') - . $this->_getConfigFilePathGlob() + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $directory = $objectManager->get('Magento\Filesystem')->getDirectoryRead(\Magento\Filesystem::MODULES); + return $objectManager->get('\Magento\Config\FileIteratorFactory')->create( + $directory, + $directory->search($this->_getConfigFilePathRegex()) ); } @@ -167,7 +164,7 @@ abstract class AbstractConfigFiles extends \PHPUnit_Framework_TestCase * * @return string */ - protected abstract function _getConfigFilePathGlob(); + protected abstract function _getConfigFilePathRegex(); /** * Returns a path to the per file XSD file, relative to the modules directory. diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php index af10bb180a0..458da42d79e 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php +++ b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php @@ -97,7 +97,7 @@ abstract class AbstractController extends \PHPUnit_Framework_TestCase { if ($this->_assertSessionErrors) { // equalTo() is intentionally used instead of isEmpty() to provide the informative diff - $this->assertSessionMessages($this->equalTo(array()), \Magento\Message\Factory::ERROR); + $this->assertSessionMessages($this->equalTo(array()), \Magento\Message\MessageInterface::TYPE_ERROR); } } @@ -198,23 +198,23 @@ abstract class AbstractController extends \PHPUnit_Framework_TestCase /** * Assert that actual session messages meet expectations: * Usage examples: - * $this->assertSessionMessages($this->isEmpty(), \Magento\Message\Factory::ERROR); + * $this->assertSessionMessages($this->isEmpty(), \Magento\Message\MessageInterface::TYPE_ERROR); * $this->assertSessionMessages($this->equalTo(array('Entity has been saved.')), - * \Magento\Message\Factory::SUCCESS); + * \Magento\Message\MessageInterface::TYPE_SUCCESS); * * @param \PHPUnit_Framework_Constraint $constraint Constraint to compare actual messages against - * @param string|null $messageType Message type filter, one of the constants \Magento\Message\Factory::* - * @param string $sessionModel Class of the session model that manages messages + * @param string|null $messageType Message type filter, one of the constants \Magento\Message\MessageInterface::* + * @param string $messageManager Class of the session model that manages messages */ public function assertSessionMessages( - \PHPUnit_Framework_Constraint $constraint, $messageType = null, $sessionModel = 'Magento\Core\Model\Session' + \PHPUnit_Framework_Constraint $constraint, $messageType = null, $messageManager = 'Magento\Message\Manager' ) { $this->_assertSessionErrors = false; - /** @var $session \Magento\Core\Model\Session\AbstractSession */ - $session = $this->_objectManager->get($sessionModel); + /** @var $messages \Magento\Message\ManagerInterface */ + $messages = $this->_objectManager->get($messageManager); $actualMessages = array(); /** @var $message \Magento\Message\AbstractMessage */ - foreach ($session->getMessages()->getItems($messageType) as $message) { + foreach ($messages->getMessages()->getItemsByType($messageType) as $message) { $actualMessages[] = $message->getText(); } $this->assertThat( diff --git a/dev/tests/integration/framework/bootstrap.php b/dev/tests/integration/framework/bootstrap.php index ce013bfde74..1dbca75d7ce 100644 --- a/dev/tests/integration/framework/bootstrap.php +++ b/dev/tests/integration/framework/bootstrap.php @@ -24,7 +24,6 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - require_once __DIR__ . '/../../../../app/bootstrap.php'; require_once __DIR__ . '/../../static/framework/Magento/TestFramework/Utility/Classes.php'; require_once __DIR__ . '/../../static/framework/Magento/TestFramework/Utility/AggregateInvoker.php'; @@ -44,8 +43,8 @@ function tool_autoloader($className) return false; } - $filePath = str_replace('\\', DS, $className); - $filePath = BP . DS . 'dev' . DS . 'tools' . DS . $filePath . '.php'; + $filePath = str_replace('\\', '/', $className); + $filePath = BP . '/dev/tools/' . $filePath . '.php'; if (file_exists($filePath)) { include_once($filePath); 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 4d5e9e035cc..b9eb9853cbe 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,6 +41,18 @@ 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\Filesystem\Directory\ReadFactory(), + new \Magento\Filesystem\Directory\WriteFactory(), + new \Magento\Filesystem\File\ReadFactory( + new \Magento\Filesystem\DriverFactory($directoryList) + ), + new \Magento\Filesystem\File\WriteFactory( + new \Magento\Filesystem\DriverFactory($directoryList) + ) + ); $object = new \Magento\TestFramework\Application( $dbInstance, @@ -48,7 +60,8 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase new \Magento\Simplexml\Element('<data/>'), '', array(), - $appMode + $appMode, + $filesystem ); $this->assertSame($dbInstance, $object->getDbInstance(), 'Db instance is not set in Application'); @@ -56,7 +69,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase $initParams = $object->getInitParams(); $this->assertInternalType('array', $initParams, 'Wrong initialization parameters type'); - $this->assertArrayHasKey(\Magento\App\Dir::PARAM_APP_DIRS, $initParams, + $this->assertArrayHasKey(\Magento\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/Bootstrap/SettingsTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Bootstrap/SettingsTest.php index 558adedbef9..ae4fdd3e763 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Bootstrap/SettingsTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Bootstrap/SettingsTest.php @@ -52,7 +52,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase public function __construct($name = null, array $data = array(), $dataName = '') { parent::__construct($name, $data, $dataName); - $this->_fixtureDir = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; + $this->_fixtureDir = __DIR__ . '/_files/'; } protected function setUp() diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/BootstrapTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/BootstrapTest.php index 9a3c8f70940..ea65623d38f 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/BootstrapTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/BootstrapTest.php @@ -104,8 +104,12 @@ class BootstrapTest extends \PHPUnit_Framework_TestCase ); $this->_shell = $this->getMock('Magento\Shell', array('execute')); $this->_object = new \Magento\TestFramework\Bootstrap( - $this->_settings, $this->_envBootstrap, $this->_docBlockBootstrap, $this->_profilerBootstrap, - $this->_shell, __DIR__ + $this->_settings, + $this->_envBootstrap, + $this->_docBlockBootstrap, + $this->_profilerBootstrap, + $this->_shell, + __DIR__ ); } @@ -143,8 +147,12 @@ class BootstrapTest extends \PHPUnit_Framework_TestCase ; // invoke the constructor explicitly $this->_object->__construct( - $settings, $this->_envBootstrap, $this->_docBlockBootstrap, $this->_profilerBootstrap, - $this->_shell, __DIR__ + $settings, + $this->_envBootstrap, + $this->_docBlockBootstrap, + $this->_profilerBootstrap, + $this->_shell, + __DIR__ ); $this->_object ->expects($this->any()) @@ -197,7 +205,6 @@ class BootstrapTest extends \PHPUnit_Framework_TestCase public function testRunBootstrapProfilerEnabled() { $baseDir = $this->_integrationTestsDir; - $dirSep = DIRECTORY_SEPARATOR; $this->_injectApplicationMock(array( 'TESTS_PROFILER_FILE' => 'profiler.csv', 'TESTS_BAMBOO_PROFILER_FILE' => 'profiler_bamboo.csv', @@ -206,12 +213,12 @@ class BootstrapTest extends \PHPUnit_Framework_TestCase $this->_profilerBootstrap ->expects($this->once()) ->method('registerFileProfiler') - ->with("{$baseDir}{$dirSep}profiler.csv") + ->with("{$baseDir}/profiler.csv") ; $this->_profilerBootstrap ->expects($this->once()) ->method('registerBambooProfiler') - ->with("{$baseDir}{$dirSep}profiler_bamboo.csv", "{$baseDir}{$dirSep}profiler_metrics.php") + ->with("{$baseDir}/profiler_bamboo.csv", "{$baseDir}/profiler_metrics.php") ; $this->_object->runBootstrap(); } 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 ed9e29c8dea..80678a020de 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,10 +53,10 @@ class BootstrapTest extends \PHPUnit_Framework_TestCase * @var array */ protected $_fixtureInitParams = array( - \Magento\App\Dir::PARAM_APP_DIRS => array( - \Magento\App\Dir::CONFIG => __DIR__, - \Magento\App\Dir::VAR_DIR => __DIR__, - ), + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::CONFIG => array('path' => __DIR__), + \Magento\Filesystem::VAR_DIR => array('path' => __DIR__) + ) ); protected function setUp() 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 111b86609c1..61bd9644c0d 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,7 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase { $resource = new \stdClass; $instanceConfig = new \Magento\TestFramework\ObjectManager\Config(); - $verification = $this->getMock('Magento\App\Dir\Verification', array(), array(), '', false); + $verification = $this->getMock('Magento\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 +57,7 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase $model = new \Magento\TestFramework\ObjectManager( null, $instanceConfig, array( - 'Magento\App\Dir\Verification' => $verification, + 'Magento\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/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php index 79704a1a073..1f5869968ea 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php @@ -39,12 +39,13 @@ class ControllerAbstractTest extends \Magento\TestFramework\TestCase\AbstractCon // emulate session messages $messagesCollection = new \Magento\Message\Collection(); $messagesCollection - ->add(new \Magento\Message\Warning('some_warning')) - ->add(new \Magento\Message\Error('error_one')) - ->add(new \Magento\Message\Error('error_two')) - ->add(new \Magento\Message\Notice('some_notice')) + ->addMessage(new \Magento\Message\Warning('some_warning')) + ->addMessage(new \Magento\Message\Error('error_one')) + ->addMessage(new \Magento\Message\Error('error_two')) + ->addMessage(new \Magento\Message\Notice('some_notice')) ; - $session = new \Magento\Object(array('messages' => $messagesCollection)); + $messageManager = $this->getMock('\Magento\Message\Manager', array(), array(), '', false); + $messageManager->expects($this->any())->method('getMessages')->will($this->returnValue($messagesCollection)); $request = new \Magento\TestFramework\Request( $this->getMock('\Magento\App\Route\ConfigInterface', array(), array(), '', false), $this->getMock('Magento\App\Request\PathInfoProcessorInterface', array(), array(), '', false) @@ -59,7 +60,7 @@ class ControllerAbstractTest extends \Magento\TestFramework\TestCase\AbstractCon ->will($this->returnValueMap(array( array('Magento\App\RequestInterface', $request), array('Magento\App\ResponseInterface', $response), - array('Magento\Core\Model\Session', $session), + array('Magento\Message\Manager', $messageManager), ))); } @@ -141,6 +142,7 @@ class ControllerAbstractTest extends \Magento\TestFramework\TestCase\AbstractCon */ public function testAssertSessionMessagesSuccess(array $expectedMessages, $messageTypeFilter) { + /** @var \PHPUnit_Framework_MockObject_MockObject|\PHPUnit_Framework_Constraint $constraint */ $constraint = $this->getMock('PHPUnit_Framework_Constraint', array('toString', 'matches')); $constraint ->expects($this->once()) @@ -154,15 +156,17 @@ class ControllerAbstractTest extends \Magento\TestFramework\TestCase\AbstractCon public function assertSessionMessagesDataProvider() { return array( - 'no message type filtering' => array(array('some_warning', 'error_one', 'error_two', 'some_notice'), null), - 'message type filtering' => array(array('error_one', 'error_two'), \Magento\Message\Factory::ERROR), + 'message waning type filtering' => array( + array('some_warning'), + \Magento\Message\MessageInterface::TYPE_WARNING + ), + 'message error type filtering' => array( + array('error_one', 'error_two'), + \Magento\Message\MessageInterface::TYPE_ERROR + ) ); } - /** - * @expectedException \PHPUnit_Framework_ExpectationFailedException - * @expectedExceptionMessage Session messages do not meet expectations - */ public function testAssertSessionMessagesFailure() { $this->assertSessionMessages($this->isEmpty()); diff --git a/dev/tests/integration/phpunit.xml.dist b/dev/tests/integration/phpunit.xml.dist index 665146b3c0f..d03ed4c289c 100644 --- a/dev/tests/integration/phpunit.xml.dist +++ b/dev/tests/integration/phpunit.xml.dist @@ -57,6 +57,7 @@ <includePath>.</includePath> <ini name="date.timezone" value="America/Los_Angeles"/> <ini name="xdebug.max_nesting_level" value="200"/> + <ini name="memory_limit" value="2048M"/> <!-- Local XML configuration file ('.dist' extension will be added, if the specified file doesn't exist) --> <const name="TESTS_LOCAL_CONFIG_FILE" value="etc/local-mysql.xml"/> <!-- Semicolon-separated 'glob' patterns, that match global XML configuration files --> @@ -66,7 +67,7 @@ <!-- Whether to cleanup the application before running tests or not --> <const name="TESTS_CLEANUP" value="enabled"/> <!-- Memory usage and estimated leaks thresholds --> - <const name="TESTS_MEM_USAGE_LIMIT" value=""/> + <!--<const name="TESTS_MEM_USAGE_LIMIT" value="1024M"/>--> <const name="TESTS_MEM_LEAK_LIMIT" value=""/> <!-- CSV Profiler Output file --> <!--<const name="TESTS_PROFILER_FILE" value="profiler.csv"/>--> @@ -79,6 +80,8 @@ <!-- Connection parameters for MongoDB library tests --> <!--<const name="MONGODB_CONNECTION_STRING" value="mongodb://localhost:27017"/>--> <!--<const name="MONGODB_DATABASE_NAME" value="magento_integration_tests"/>--> + <const name="MEMCACHE_SESSION_SAVE_PATH" value=""/> + <const name="MEMCACHED_SESSION_SAVE_PATH" value="tcp://127.0.0.1:11211?persistent=1::sess_prefix=custom_prefix"/> </php> <!-- Test listeners --> <listeners> diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/ContainerTest.php b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/ContainerTest.php deleted file mode 100644 index 954f1167a26..00000000000 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/ContainerTest.php +++ /dev/null @@ -1,88 +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 - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Adminhtml\Block\Widget; - -/** - * @magentoAppArea adminhtml - */ -class ContainerTest extends \PHPUnit_Framework_TestCase -{ - public function testGetButtonsHtml() - { - $titles = array(1 => 'Title 1', 'Title 2', 'Title 3'); - $block = $this->_buildBlock($titles); - $html = $block->getButtonsHtml(); - - $this->assertContains('<button', $html); - foreach ($titles as $title) { - $this->assertContains($title, $html); - } - } - - public function testUpdateButton() - { - $originalTitles = array(1 => 'Title 1', 'Title 2', 'Title 3'); - $newTitles = array(1 => 'Button A', 'Button B', 'Button C'); - - $block = $this->_buildBlock($originalTitles); - $html = $block->getButtonsHtml(); - foreach ($newTitles as $newTitle) { - $this->assertNotContains($newTitle, $html); - } - - $block = $this->_buildBlock($originalTitles); // Layout caches html, thus recreate block for further testing - foreach ($newTitles as $id => $newTitle) { - $block->updateButton($id, 'title', $newTitle); - } - $html = $block->getButtonsHtml(); - foreach ($newTitles as $newTitle) { - $this->assertContains($newTitle, $html); - } - } - - /** - * Composes a container with several buttons in it - * - * @param array $titles - * @return \Magento\Adminhtml\Block\Widget\Container - */ - protected function _buildBlock($titles) - { - /** @var $layout \Magento\View\LayoutInterface */ - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', - array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) - ); - /** @var $block \Magento\Adminhtml\Block\Widget\Container */ - $block = $layout->createBlock('Magento\Adminhtml\Block\Widget\Container', 'block'); - foreach ($titles as $id => $title) { - $block->addButton($id, array('title' => $title)); - } - return $block; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/GraphTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/GraphTest.php index 97bbd990070..c63251a9158 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/GraphTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/GraphTest.php @@ -40,9 +40,11 @@ class GraphTest extends \PHPUnit_Framework_TestCase protected function setUp() { parent::setUp(); - $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') - ->createBlock('Magento\Backend\Block\Dashboard\Graph'); - $this->_block->setDataHelperName('Magento\Backend\Helper\Dashboard\Order'); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\View\LayoutInterface $layout */ + $layout = $objectManager->get('Magento\View\LayoutInterface'); + $this->_block = $layout->createBlock('Magento\Backend\Block\Dashboard\Graph'); + $this->_block->setDataHelper($objectManager->get('Magento\Backend\Helper\Dashboard\Order')); } public function testGetChartUrl() 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 57d1cf4f129..f7287041352 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,16 @@ 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'); + /** @var $directory \Magento\Filesystem\Directory\Read */ + $directory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $fileIteratorFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Config\FileIteratorFactory'); + $fileIterator = $fileIteratorFactory->create($directory, array( + $directory->getRelativePath(__DIR__ . '/_files/test_section_config.xml'))); $fileResolverMock->expects($this->any()) ->method('get') - ->will($this->returnValue(array(__DIR__ . '/_files/test_section_config.xml'))); + ->will($this->returnValue($fileIterator)); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( 'Magento\Backend\Model\Config\Structure\Reader' => array( diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Category/EditTest.php similarity index 87% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/EditTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Category/EditTest.php index 26b386e828e..70de68218fc 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Category/EditTest.php @@ -25,10 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Urlrewrite\Catalog\Category; +namespace Magento\Backend\Block\Urlrewrite\Catalog\Category; /** - * Test for \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Edit + * Test for \Magento\Backend\Block\Urlrewrite\Catalog\Category\Edit * @magentoAppArea adminhtml */ class EditTest extends \PHPUnit_Framework_TestCase @@ -49,9 +49,9 @@ class EditTest extends \PHPUnit_Framework_TestCase array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); - /** @var $block \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Edit */ + /** @var $block \Magento\Backend\Block\Urlrewrite\Catalog\Category\Edit */ $block = $layout->createBlock( - 'Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Edit', '', array('data' => $blockAttributes) + 'Magento\Backend\Block\Urlrewrite\Catalog\Category\Edit', '', array('data' => $blockAttributes) ); $this->_checkSelector($block, $expected); @@ -64,7 +64,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check selector * - * @param \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Catalog\Category\Edit $block * @param array $expected */ private function _checkSelector($block, $expected) @@ -72,11 +72,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $selectorBlock \Magento\Adminhtml\Block\Urlrewrite\Selector|bool */ + /** @var $selectorBlock \Magento\Backend\Block\Urlrewrite\Selector|bool */ $selectorBlock = $layout->getChildBlock($blockName, 'selector'); if ($expected['selector']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Selector', $selectorBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Selector', $selectorBlock, 'Child block with entity selector is invalid'); } else { $this->assertFalse($selectorBlock, 'Child block with entity selector should not present in block'); @@ -86,7 +86,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check links * - * @param \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Catalog\Category\Edit $block * @param array $expected */ private function _checkLinks($block, $expected) @@ -94,11 +94,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $categoryBlock \Magento\Adminhtml\Block\Urlrewrite\Link|bool */ + /** @var $categoryBlock \Magento\Backend\Block\Urlrewrite\Link|bool */ $categoryBlock = $layout->getChildBlock($blockName, 'category_link'); if ($expected['category_link']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Link', $categoryBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Link', $categoryBlock, 'Child block with category link is invalid'); $this->assertEquals('Category:', $categoryBlock->getLabel(), @@ -117,7 +117,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check buttons * - * @param \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Catalog\Category\Edit $block * @param array $expected */ private function _checkButtons($block, $expected) @@ -165,7 +165,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check form * - * @param \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Catalog\Category\Edit $block * @param array $expected */ private function _checkForm($block, $expected) @@ -173,11 +173,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $formBlock \Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form|bool */ + /** @var $formBlock \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form|bool */ $formBlock = $layout->getChildBlock($blockName, 'form'); if ($expected['form']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form', $formBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form', $formBlock, 'Child block with form is invalid'); $this->assertSame($expected['form']['category'], $formBlock->getCategory(), @@ -193,7 +193,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check categories tree * - * @param \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Catalog\Category\Edit $block * @param array $expected */ private function _checkCategoriesTree($block, $expected) @@ -201,11 +201,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $categoriesTreeBlock \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree|bool */ + /** @var $categoriesTreeBlock \Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree|bool */ $categoriesTreeBlock = $layout->getChildBlock($blockName, 'categories_tree'); if ($expected['categories_tree']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree', $categoriesTreeBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree', $categoriesTreeBlock, 'Child block with categories tree is invalid'); } else { $this->assertFalse($categoriesTreeBlock, 'Child block with category_tree should not present in block'); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/TreeTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Category/TreeTest.php similarity index 85% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/TreeTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Category/TreeTest.php index 72da1904378..eb3bedb4d38 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/TreeTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Category/TreeTest.php @@ -25,17 +25,17 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Urlrewrite\Catalog\Category; +namespace Magento\Backend\Block\Urlrewrite\Catalog\Category; /** - * Test for \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree + * Test for \Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree * * @magentoAppArea adminhtml */ class TreeTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree + * @var \Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree */ private $_treeBlock; @@ -48,11 +48,11 @@ class TreeTest extends \PHPUnit_Framework_TestCase $this->_treeBlock = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\View\LayoutInterface') - ->createBlock('Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree'); + ->createBlock('Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree'); } /** - * Test for method \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree::getTreeArray() + * Test for method \Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree::getTreeArray() */ public function testGetTreeArray() { @@ -94,7 +94,7 @@ class TreeTest extends \PHPUnit_Framework_TestCase } /** - * Test for method \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree::getCategoryCollection() + * Test for method \Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree::getCategoryCollection() */ public function testGetCategoryCollection() { diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Edit/FormTest.php similarity index 95% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Edit/FormTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Edit/FormTest.php index 40bba41da65..903bca01ec8 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Edit/FormTest.php @@ -25,10 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit; +namespace Magento\Backend\Block\Urlrewrite\Catalog\Edit; /** - * Test for \Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\FormTest + * Test for \Magento\Backend\Block\Urlrewrite\Catalog\Edit\FormTest * @magentoAppArea adminhtml */ class FormTest extends \PHPUnit_Framework_TestCase @@ -43,9 +43,9 @@ class FormTest extends \PHPUnit_Framework_TestCase { /** @var $layout \Magento\Core\Model\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); - /** @var $block \Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form */ + /** @var $block \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form */ $block = $layout->createBlock( - 'Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form', 'block', array('data' => $args) + 'Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form', 'block', array('data' => $args) ); $block->setTemplate(null); $block->toHtml(); @@ -55,7 +55,7 @@ class FormTest extends \PHPUnit_Framework_TestCase /** * Check _formPostInit set expected fields values * - * @covers \Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form::_formPostInit + * @covers \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form::_formPostInit * * @dataProvider formPostInitDataProvider * diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Product/EditTest.php similarity index 86% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/EditTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Product/EditTest.php index ffc55ce4164..d9f2c287389 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Product/EditTest.php @@ -25,10 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Urlrewrite\Catalog\Product; +namespace Magento\Backend\Block\Urlrewrite\Catalog\Product; /** - * Test for \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit + * Test for \Magento\Backend\Block\Urlrewrite\Catalog\Product\Edit * @magentoAppArea adminhtml */ class EditTest extends \PHPUnit_Framework_TestCase @@ -49,9 +49,9 @@ class EditTest extends \PHPUnit_Framework_TestCase array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); - /** @var $block \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit */ + /** @var $block \Magento\Backend\Block\Urlrewrite\Catalog\Product\Edit */ $block = $layout->createBlock( - 'Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit', '', array('data' => $blockAttributes) + 'Magento\Backend\Block\Urlrewrite\Catalog\Product\Edit', '', array('data' => $blockAttributes) ); $this->_checkSelector($block, $expected); @@ -65,7 +65,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check selector * - * @param \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Catalog\Product\Edit $block * @param array $expected */ private function _checkSelector($block, $expected) @@ -73,11 +73,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $selectorBlock \Magento\Adminhtml\Block\Urlrewrite\Selector|bool */ + /** @var $selectorBlock \Magento\Backend\Block\Urlrewrite\Selector|bool */ $selectorBlock = $layout->getChildBlock($blockName, 'selector'); if ($expected['selector']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Selector', $selectorBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Selector', $selectorBlock, 'Child block with entity selector is invalid'); } else { $this->assertFalse($selectorBlock, 'Child block with entity selector should not present in block'); @@ -87,7 +87,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check links * - * @param \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Catalog\Product\Edit $block * @param array $expected */ private function _checkLinks($block, $expected) @@ -95,11 +95,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $productLinkBlock \Magento\Adminhtml\Block\Urlrewrite\Link|bool */ + /** @var $productLinkBlock \Magento\Backend\Block\Urlrewrite\Link|bool */ $productLinkBlock = $layout->getChildBlock($blockName, 'product_link'); if ($expected['product_link']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Link', $productLinkBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Link', $productLinkBlock, 'Child block with product link is invalid'); $this->assertEquals('Product:', $productLinkBlock->getLabel(), @@ -114,11 +114,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $this->assertFalse($productLinkBlock, 'Child block with product link should not present in block'); } - /** @var $categoryLinkBlock \Magento\Adminhtml\Block\Urlrewrite\Link|bool */ + /** @var $categoryLinkBlock \Magento\Backend\Block\Urlrewrite\Link|bool */ $categoryLinkBlock = $layout->getChildBlock($blockName, 'category_link'); if ($expected['category_link']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Link', $categoryLinkBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Link', $categoryLinkBlock, 'Child block with category link is invalid'); $this->assertEquals('Category:', $categoryLinkBlock->getLabel(), @@ -137,7 +137,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check buttons * - * @param \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Catalog\Product\Edit $block * @param array $expected */ private function _checkButtons($block, $expected) @@ -185,7 +185,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check form * - * @param \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Catalog\Product\Edit $block * @param array $expected */ private function _checkForm($block, $expected) @@ -193,11 +193,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $formBlock \Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form|bool */ + /** @var $formBlock \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form|bool */ $formBlock = $layout->getChildBlock($blockName, 'form'); if ($expected['form']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Catalog\Edit\Form', $formBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form', $formBlock, 'Child block with form is invalid'); $this->assertSame($block->getProduct(), $formBlock->getProduct(), @@ -218,7 +218,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check grid * - * @param \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Catalog\Product\Edit $block * @param array $expected */ private function _checkGrid($block, $expected) @@ -226,11 +226,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $gridBlock \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Grid|bool */ + /** @var $gridBlock \Magento\Backend\Block\Urlrewrite\Catalog\Product\Grid|bool */ $gridBlock = $layout->getChildBlock($blockName, 'products_grid'); if ($expected['products_grid']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Grid', $gridBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Catalog\Product\Grid', $gridBlock, 'Child block with product grid is invalid'); } else { $this->assertFalse($gridBlock, 'Child block with product grid should not present in block'); @@ -240,7 +240,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check categories * - * @param \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Catalog\Product\Edit $block * @param array $expected */ private function _checkCategories($block, $expected) @@ -248,21 +248,21 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $categoriesTreeBlock \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree|bool */ + /** @var $categoriesTreeBlock \Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree|bool */ $categoriesTreeBlock = $layout->getChildBlock($blockName, 'categories_tree'); if ($expected['categories_tree']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Tree', $categoriesTreeBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree', $categoriesTreeBlock, 'Child block with categories tree is invalid'); } else { $this->assertFalse($categoriesTreeBlock, 'Child block with categories tree should not present in block'); } - /** @var $skipCategoriesBlock \Magento\Adminhtml\Block\Widget\Button|bool */ + /** @var $skipCategoriesBlock \Magento\Backend\Block\Widget\Button|bool */ $skipCategoriesBlock = $layout->getChildBlock($blockName, 'skip_categories'); if ($expected['skip_categories']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Widget\Button', $skipCategoriesBlock, + $this->assertInstanceOf('Magento\Backend\Block\Widget\Button', $skipCategoriesBlock, 'Child block with skip categories is invalid'); } else { $this->assertFalse($skipCategoriesBlock, 'Child block with skip categories should not present in block'); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/GridTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Product/GridTest.php similarity index 88% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/GridTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Product/GridTest.php index cc71567f730..33afd5c4918 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Product/GridTest.php @@ -25,10 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Urlrewrite\Catalog\Product; +namespace Magento\Backend\Block\Urlrewrite\Catalog\Product; /** - * Test for \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Grid + * Test for \Magento\Backend\Block\Urlrewrite\Catalog\Product\Grid * @magentoAppArea adminhtml */ class GridTest extends \PHPUnit_Framework_TestCase @@ -38,9 +38,9 @@ class GridTest extends \PHPUnit_Framework_TestCase */ public function testPrepareGrid() { - /** @var $gridBlock \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Grid */ + /** @var $gridBlock \Magento\Backend\Block\Urlrewrite\Catalog\Product\Grid */ $gridBlock = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') - ->createBlock('Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Grid'); + ->createBlock('Magento\Backend\Block\Urlrewrite\Catalog\Product\Grid'); $gridBlock->toHtml(); foreach (array('entity_id', 'name', 'sku', 'status') as $key) { diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/FormTest.php similarity index 93% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/FormTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/FormTest.php index 80862a4f2d3..4ae74e7561f 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/FormTest.php @@ -25,10 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit; +namespace Magento\Backend\Block\Urlrewrite\Cms\Page\Edit; /** - * Test for \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit\FormTest + * Test for \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\FormTest * @magentoAppArea adminhtml */ class FormTest extends \PHPUnit_Framework_TestCase @@ -43,9 +43,9 @@ class FormTest extends \PHPUnit_Framework_TestCase { /** @var $layout \Magento\Core\Model\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); - /** @var $block \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit\Form */ + /** @var $block \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form */ $block = $layout->createBlock( - 'Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit\Form', 'block', array('data' => $args) + 'Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form', 'block', array('data' => $args) ); $block->setTemplate(null); $block->toHtml(); @@ -55,7 +55,7 @@ class FormTest extends \PHPUnit_Framework_TestCase /** * Check _formPostInit set expected fields values * - * @covers \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit\Form::_formPostInit + * @covers \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form::_formPostInit * * @dataProvider formPostInitDataProvider * diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/EditTest.php similarity index 87% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/EditTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/EditTest.php index e94788bda49..e3140d0c175 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/EditTest.php @@ -25,10 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Urlrewrite\Cms\Page; +namespace Magento\Backend\Block\Urlrewrite\Cms\Page; /** - * Test for \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit + * Test for \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit * @magentoAppArea adminhtml */ class EditTest extends \PHPUnit_Framework_TestCase @@ -49,9 +49,9 @@ class EditTest extends \PHPUnit_Framework_TestCase array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); - /** @var $block \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit */ + /** @var $block \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit */ $block = $layout->createBlock( - 'Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit', '', array('data' => $blockAttributes) + 'Magento\Backend\Block\Urlrewrite\Cms\Page\Edit', '', array('data' => $blockAttributes) ); $this->_checkSelector($block, $expected); @@ -64,7 +64,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check selector * - * @param \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit $block * @param array $expected */ private function _checkSelector($block, $expected) @@ -72,11 +72,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $selectorBlock \Magento\Adminhtml\Block\Urlrewrite\Selector|bool */ + /** @var $selectorBlock \Magento\Backend\Block\Urlrewrite\Selector|bool */ $selectorBlock = $layout->getChildBlock($blockName, 'selector'); if ($expected['selector']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Selector', $selectorBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Selector', $selectorBlock, 'Child block with entity selector is invalid'); } else { $this->assertFalse($selectorBlock, 'Child block with entity selector should not present in block'); @@ -86,7 +86,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check links * - * @param \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit $block * @param array $expected */ private function _checkLinks($block, $expected) @@ -94,11 +94,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $cmsPageLinkBlock \Magento\Adminhtml\Block\Urlrewrite\Link|bool */ + /** @var $cmsPageLinkBlock \Magento\Backend\Block\Urlrewrite\Link|bool */ $cmsPageLinkBlock = $layout->getChildBlock($blockName, 'cms_page_link'); if ($expected['cms_page_link']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Link', $cmsPageLinkBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Link', $cmsPageLinkBlock, 'Child block with CMS page link is invalid'); $this->assertEquals('CMS page:', $cmsPageLinkBlock->getLabel(), @@ -117,7 +117,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check buttons * - * @param \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit $block * @param array $expected */ private function _checkButtons($block, $expected) @@ -165,7 +165,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check form * - * @param \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit $block * @param array $expected */ private function _checkForm($block, $expected) @@ -173,11 +173,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $formBlock \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit\Form|bool */ + /** @var $formBlock \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form|bool */ $formBlock = $layout->getChildBlock($blockName, 'form'); if ($expected['form']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit\Form', $formBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form', $formBlock, 'Child block with form is invalid'); $this->assertSame($expected['form']['cms_page'], $formBlock->getCmsPage(), @@ -193,7 +193,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check grid * - * @param \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit $block * @param array $expected */ private function _checkGrid($block, $expected) @@ -201,11 +201,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $gridBlock \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Grid|bool */ + /** @var $gridBlock \Magento\Backend\Block\Urlrewrite\Cms\Page\Grid|bool */ $gridBlock = $layout->getChildBlock($blockName, 'cms_pages_grid'); if ($expected['cms_pages_grid']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Grid', $gridBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Cms\Page\Grid', $gridBlock, 'Child block with CMS pages grid is invalid'); } else { $this->assertFalse($gridBlock, 'Child block with CMS pages grid should not present in block'); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/GridTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/GridTest.php similarity index 86% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/GridTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/GridTest.php index d39908ae07e..6e920eff058 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/GridTest.php @@ -25,10 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Urlrewrite\Cms\Page; +namespace Magento\Backend\Block\Urlrewrite\Cms\Page; /** - * Test for \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Grid + * Test for \Magento\Backend\Block\Urlrewrite\Cms\Page\Grid * @magentoAppArea adminhtml */ class GridTest extends \PHPUnit_Framework_TestCase @@ -38,9 +38,9 @@ class GridTest extends \PHPUnit_Framework_TestCase */ public function testPrepareGrid() { - /** @var \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Grid $gridBlock */ + /** @var \Magento\Backend\Block\Urlrewrite\Cms\Page\Grid $gridBlock */ $gridBlock = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') - ->createBlock('Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Grid'); + ->createBlock('Magento\Backend\Block\Urlrewrite\Cms\Page\Grid'); $gridBlock->toHtml(); foreach (array('title', 'identifier', 'is_active') as $key) { @@ -67,9 +67,9 @@ class GridTest extends \PHPUnit_Framework_TestCase */ public function testPrepareGridForMultipleStores() { - /** @var \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Grid $gridBlock */ + /** @var \Magento\Backend\Block\Urlrewrite\Cms\Page\Grid $gridBlock */ $gridBlock = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') - ->createBlock('Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Grid'); + ->createBlock('Magento\Backend\Block\Urlrewrite\Cms\Page\Grid'); $gridBlock->toHtml(); $this->assertInstanceOf('Magento\Backend\Block\Widget\Grid\Column', $gridBlock->getColumn('store_id'), 'When there is more than one store column with key "store_id" should be present'); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Edit/FormTest.php similarity index 94% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Edit/FormTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Edit/FormTest.php index ba2e5bd5e82..ecb9b518cf0 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Edit/FormTest.php @@ -25,10 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Urlrewrite\Edit; +namespace Magento\Backend\Block\Urlrewrite\Edit; /** - * Test for \Magento\Adminhtml\Block\Urlrewrite\Edit\FormTest + * Test for \Magento\Backend\Block\Urlrewrite\Edit\FormTest * @magentoAppArea adminhtml */ class FormTest extends \PHPUnit_Framework_TestCase @@ -43,8 +43,8 @@ class FormTest extends \PHPUnit_Framework_TestCase { /** @var $layout \Magento\Core\Model\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); - /** @var $block \Magento\Adminhtml\Block\Urlrewrite\Edit\Form */ - $block = $layout->createBlock('Magento\Adminhtml\Block\Urlrewrite\Edit\Form', 'block', array('data' => $args)); + /** @var $block \Magento\Backend\Block\Urlrewrite\Edit\Form */ + $block = $layout->createBlock('Magento\Backend\Block\Urlrewrite\Edit\Form', 'block', array('data' => $args)); $block->setTemplate(null); $block->toHtml(); return $block->getForm(); @@ -96,7 +96,7 @@ class FormTest extends \PHPUnit_Framework_TestCase 'description' => 'description' ); \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Adminhtml\Model\Session')->setUrlrewriteData($sessionValues); + ->create('Magento\Backend\Model\Session')->setUrlrewriteData($sessionValues); // Re-init form to use newly set session data $form = $this->_getFormInstance(array('url_rewrite' => new \Magento\Object())); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/EditTest.php similarity index 88% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/EditTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/EditTest.php index 824174ab13c..ecd73b851e6 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/EditTest.php @@ -25,10 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Urlrewrite; +namespace Magento\Backend\Block\Urlrewrite; /** - * Test for \Magento\Adminhtml\Block\Urlrewrite\Edit + * Test for \Magento\Backend\Block\Urlrewrite\Edit * @magentoAppArea adminhtml */ class EditTest extends \PHPUnit_Framework_TestCase @@ -50,9 +50,9 @@ class EditTest extends \PHPUnit_Framework_TestCase array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); - /** @var $block \Magento\Adminhtml\Block\Urlrewrite\Edit */ + /** @var $block \Magento\Backend\Block\Urlrewrite\Edit */ $block = $layout->createBlock( - 'Magento\Adminhtml\Block\Urlrewrite\Edit', '', array('data' => $blockAttributes) + 'Magento\Backend\Block\Urlrewrite\Edit', '', array('data' => $blockAttributes) ); $this->_checkSelector($block, $expected); @@ -63,18 +63,18 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check entity selector * - * @param \Magento\Adminhtml\Block\Urlrewrite\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Edit $block * @param array $expected */ private function _checkSelector($block, $expected) { $layout = $block->getLayout(); - /** @var $selectorBlock \Magento\Adminhtml\Block\Urlrewrite\Selector|bool */ + /** @var $selectorBlock \Magento\Backend\Block\Urlrewrite\Selector|bool */ $selectorBlock = $layout->getChildBlock($block->getNameInLayout(), 'selector'); if ($expected['selector']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Selector', $selectorBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Selector', $selectorBlock, 'Child block with entity selector is invalid'); } else { $this->assertFalse($selectorBlock, 'Child block with entity selector should not present in block'); @@ -84,7 +84,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check form * - * @param \Magento\Adminhtml\Block\Urlrewrite\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Edit $block * @param array $expected */ private function _checkForm($block, $expected) @@ -92,11 +92,11 @@ class EditTest extends \PHPUnit_Framework_TestCase $layout = $block->getLayout(); $blockName = $block->getNameInLayout(); - /** @var $formBlock \Magento\Adminhtml\Block\Urlrewrite\Edit\Form|bool */ + /** @var $formBlock \Magento\Backend\Block\Urlrewrite\Edit\Form|bool */ $formBlock = $layout->getChildBlock($blockName, 'form'); if ($expected['form']) { - $this->assertInstanceOf('Magento\Adminhtml\Block\Urlrewrite\Edit\Form', $formBlock, + $this->assertInstanceOf('Magento\Backend\Block\Urlrewrite\Edit\Form', $formBlock, 'Child block with form is invalid'); $this->assertSame($expected['form']['url_rewrite'], $formBlock->getUrlRewrite(), @@ -109,7 +109,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * Check buttons * - * @param \Magento\Adminhtml\Block\Urlrewrite\Edit $block + * @param \Magento\Backend\Block\Urlrewrite\Edit $block * @param array $expected */ private function _checkButtons($block, $expected) diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/ContainerTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/ContainerTest.php index bd8413c402c..27bdcba1f09 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/ContainerTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/ContainerTest.php @@ -42,4 +42,58 @@ class ContainerTest extends \PHPUnit_Framework_TestCase $this->assertStringEndsWith('one', $block->getHeaderCssClass()); $this->assertContains('two', $block->getHeaderText()); } + + public function testGetButtonsHtml() + { + $titles = array(1 => 'Title 1', 'Title 2', 'Title 3'); + $block = $this->_buildBlock($titles); + $html = $block->getButtonsHtml(); + + $this->assertContains('<button', $html); + foreach ($titles as $title) { + $this->assertContains($title, $html); + } + } + + public function testUpdateButton() + { + $originalTitles = array(1 => 'Title 1', 'Title 2', 'Title 3'); + $newTitles = array(1 => 'Button A', 'Button B', 'Button C'); + + $block = $this->_buildBlock($originalTitles); + $html = $block->getButtonsHtml(); + foreach ($newTitles as $newTitle) { + $this->assertNotContains($newTitle, $html); + } + + $block = $this->_buildBlock($originalTitles); // Layout caches html, thus recreate block for further testing + foreach ($newTitles as $id => $newTitle) { + $block->updateButton($id, 'title', $newTitle); + } + $html = $block->getButtonsHtml(); + foreach ($newTitles as $newTitle) { + $this->assertContains($newTitle, $html); + } + } + + /** + * Composes a container with several buttons in it + * + * @param array $titles + * @return \Magento\Backend\Block\Widget\Container + */ + protected function _buildBlock($titles) + { + /** @var $layout \Magento\View\LayoutInterface */ + $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Core\Model\Layout', + array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ); + /** @var $block \Magento\Backend\Block\Widget\Container */ + $block = $layout->createBlock('Magento\Backend\Block\Widget\Container', 'block'); + foreach ($titles as $id => $title) { + $block->addButton($id, array('title' => $title)); + } + return $block; + } } diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/Form/ContainerTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Form/ContainerTest.php similarity index 89% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/Form/ContainerTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Form/ContainerTest.php index aa93b4b504d..0bee0071c91 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/Form/ContainerTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Form/ContainerTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Widget\Form; +namespace Magento\Backend\Block\Widget\Form; /** * @magentoAppArea adminhtml @@ -38,8 +38,8 @@ class ContainerTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\Core\Model\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); // Create block with blocking _prepateLayout(), which is used by block to instantly add 'form' child - /** @var $block \Magento\Adminhtml\Block\Widget\Form\Container */ - $block = $this->getMock('Magento\Adminhtml\Block\Widget\Form\Container', array('_prepareLayout'), + /** @var $block \Magento\Backend\Block\Widget\Form\Container */ + $block = $this->getMock('Magento\Backend\Block\Widget\Form\Container', array('_prepareLayout'), array( $objectManager->create('Magento\Backend\Block\Template\Context') ) diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/Grid/Massaction/ItemTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/ItemTest.php similarity index 86% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/Grid/Massaction/ItemTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/ItemTest.php index b2f77a73509..2a7097706f7 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/Grid/Massaction/ItemTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/ItemTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Widget\Grid\Massaction; +namespace Magento\Backend\Block\Widget\Grid; /** * @magentoAppArea adminhtml @@ -36,8 +36,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase { /** @var $layout \Magento\Core\Model\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); - /** @var $block \Magento\Adminhtml\Block\Widget\Grid\Massaction\Item */ - $block = $layout->createBlock('Magento\Adminhtml\Block\Widget\Grid\Massaction\Item', 'block'); + /** @var $block \Magento\Backend\Block\Widget\Grid\Massaction\Item */ + $block = $layout->createBlock('Magento\Backend\Block\Widget\Grid\Massaction\Item', 'block'); $expected = $layout->addBlock('Magento\View\Element\Template', 'additional_action', 'block'); $this->assertSame($expected, $block->getAdditionalActionBlock()); } 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 0d2c1e42f84..a389195ee45 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\App\Dir::PARAM_APP_DIRS => array( - \Magento\App\Dir::THEMES => __DIR__ . '/../../_files/design' + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::THEMES => 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 2ec7ff59702..6c6712d5fed 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/GridTest.php @@ -86,18 +86,15 @@ class GridTest extends \PHPUnit_Framework_TestCase */ protected function _getColumnSetMock() { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $directoryList = $objectManager->create('\Magento\Filesystem\DirectoryList', array('root' => __DIR__)); return $this->getMock('Magento\Backend\Block\Widget\Grid\ColumnSet', array(), array( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\View\Element\Template\Context', array( - 'dirs' => new \Magento\App\Dir(__DIR__), - 'filesystem' => new \Magento\Filesystem(new \Magento\Filesystem\Adapter\Local), - )), - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Backend\Model\Widget\Grid\Row\UrlGeneratorFactory'), - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Backend\Model\Widget\Grid\SubTotals'), - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Backend\Model\Widget\Grid\Totals'), + $objectManager->create('\Magento\View\Element\Template\Context', array( + 'filesystem' => $objectManager->create('\Magento\Filesystem', array('directoryList' => $directoryList)) + )), + $objectManager->create('Magento\Backend\Model\Widget\Grid\Row\UrlGeneratorFactory'), + $objectManager->create('Magento\Backend\Model\Widget\Grid\SubTotals'), + $objectManager->create('Magento\Backend\Model\Widget\Grid\Totals'), )); } @@ -117,4 +114,14 @@ class GridTest extends \PHPUnit_Framework_TestCase $this->_columnSetMock->expects($this->once())->method('isFilterVisible')->will($this->returnValue(false)); $this->_block->getMainButtonsHtml(); } + + public function testGetMassactionBlock() + { + /** @var $layout \Magento\Core\Model\Layout */ + $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); + /** @var $block \Magento\Backend\Block\Widget\Grid */ + $block = $layout->createBlock('Magento\Backend\Block\Widget\Grid\Extended', 'block'); + $child = $layout->addBlock('Magento\View\Element\Template', 'massaction', 'block'); + $this->assertSame($child, $block->getMassactionBlock()); + } } diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/TabsTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/TabsTest.php similarity index 91% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/TabsTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/Widget/TabsTest.php index a5b23e43de3..b3e56d6e2b9 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/TabsTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/TabsTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Widget; +namespace Magento\Backend\Block\Widget; /** * @magentoAppArea adminhtml @@ -46,8 +46,8 @@ class TabsTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\Core\Model\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); - /** @var $block \Magento\Adminhtml\Block\Widget\Tabs */ - $block = $layout->createBlock('Magento\Adminhtml\Block\Widget\Tabs', 'block'); + /** @var $block \Magento\Backend\Block\Widget\Tabs */ + $block = $layout->createBlock('Magento\Backend\Block\Widget\Tabs', 'block'); $layout->addBlock('Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Tab\Main', 'child_tab', 'block'); $block->addTab('tab_id', 'child_tab'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php index 0094d6f7cac..d2873132a5f 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php @@ -27,6 +27,6 @@ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Registration'); $registration->register( - __DIR__ . DIRECTORY_SEPARATOR . 'design', - implode(DIRECTORY_SEPARATOR, array('*', '*', 'theme.xml')) + __DIR__ . '/design', + '*/*/theme.xml' ); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/_files/form_key_disabled.php b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/form_key_disabled.php similarity index 100% rename from dev/tests/integration/testsuite/Magento/Adminhtml/_files/form_key_disabled.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/_files/form_key_disabled.php diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/_files/form_key_disabled_rollback.php b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/form_key_disabled_rollback.php similarity index 100% rename from dev/tests/integration/testsuite/Magento/Adminhtml/_files/form_key_disabled_rollback.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/_files/form_key_disabled_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php index aed3ba0beb4..9e46f70c2f6 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php @@ -174,8 +174,7 @@ class CacheTest extends \Magento\Backend\Utility\Controller $this->dispatch('backend/admin/cache/' . $action); $this->assertSessionMessages( $this->contains("Specified cache type(s) don't exist: invalid_type_1, invalid_type_2"), - \Magento\Message\Factory::ERROR, - 'Magento\Core\Model\Session\AbstractSession' + \Magento\Message\MessageInterface::TYPE_ERROR ); } 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 a58f09ec765..d727ff79fe8 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 @@ -35,7 +35,12 @@ class RobotsTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Backend\Model\Config\Backend\Admin\Robots */ - protected $_model = null; + protected $model = null; + + /** + * @var \Magento\Filesystem\Directory\Read + */ + protected $rootDirectory; /** * Initialize model @@ -44,10 +49,11 @@ class RobotsTest extends \PHPUnit_Framework_TestCase { parent::setUp(); - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Backend\Model\Config\Backend\Admin\Robots'); - $this->_model->setPath('design/search_engine_robots/custom_instructions'); - $this->_model->afterLoad(); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $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); } /** @@ -57,7 +63,7 @@ class RobotsTest extends \PHPUnit_Framework_TestCase */ public function testAfterLoadRobotsTxtNotExists() { - $this->assertEmpty($this->_model->getValue()); + $this->assertEmpty($this->model->getValue()); } /** @@ -67,7 +73,7 @@ class RobotsTest extends \PHPUnit_Framework_TestCase */ public function testAfterLoadRobotsTxtExists() { - $this->assertEquals('Sitemap: http://store.com/sitemap.xml', $this->_model->getValue()); + $this->assertEquals('Sitemap: http://store.com/sitemap.xml', $this->model->getValue()); } /** @@ -77,9 +83,7 @@ class RobotsTest extends \PHPUnit_Framework_TestCase */ public function testAfterSaveFileNotExists() { - $robotsTxtPath = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\App\Dir')->getDir() . DS . 'robots.txt'; - $this->assertFileNotExists($robotsTxtPath, 'robots.txt exists'); + $this->assertFalse($this->rootDirectory->isExist('robots.txt'), 'robots.txt exists'); $this->_modifyConfig(); } @@ -92,9 +96,7 @@ class RobotsTest extends \PHPUnit_Framework_TestCase */ public function testAfterSaveFileExists() { - $robotsTxtPath = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir() . DS . 'robots.txt'; - $this->assertFileExists($robotsTxtPath, 'robots.txt exists'); + $this->assertTrue($this->rootDirectory->isExist('robots.txt'), 'robots.txt not exists'); $this->_modifyConfig(); } @@ -105,10 +107,9 @@ class RobotsTest extends \PHPUnit_Framework_TestCase protected function _modifyConfig() { $robotsTxt = "User-Agent: *\nDisallow: /checkout"; - $this->_model->setValue($robotsTxt)->save(); + $this->model->setValue($robotsTxt)->save(); $this->assertStringEqualsFile( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\App\Dir')->getDir() . DS . 'robots.txt', + $this->rootDirectory->getAbsolutePath('robots.txt'), $robotsTxt ); } diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/ConfigTest.php index 98eb62221c7..4d5d1cba14d 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/ConfigTest.php @@ -77,7 +77,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function saveWithSingleStoreModeEnabledDataProvider() { - return require(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'config_groups.php'); + return require(__DIR__ . '/_files/config_groups.php'); } /** @@ -114,6 +114,6 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function saveDataProvider() { - return require(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'config_section.php'); + return require(__DIR__ . '/_files/config_section.php'); } } diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/UrlTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/UrlTest.php index 02832693aff..5af519455fb 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/UrlTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/UrlTest.php @@ -108,7 +108,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase ->setRouteName('default_router'); $this->_model->setRequest($request); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Session\AbstractSession') + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Session\SessionManagerInterface') ->setData('_form_key', 'salt'); $this->assertEquals($expectedHash, $this->_model->getSecretKey($routeName, $controller, $action)); } @@ -159,7 +159,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase $request->setControllerName('controller')->setActionName('action'); $request->initForward()->setControllerName(uniqid())->setActionName(uniqid()); $this->_model->setRequest($request); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Session\AbstractSession') + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Session\SessionManagerInterface') ->setData('_form_key', 'salt'); $this->assertEquals( $encryptor->getHash('controller' . 'action' . 'salt'), 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 96046322741..8fc14502b65 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 @@ -25,8 +25,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -$robotsTxtPath = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir() - . DS . 'robots.txt'; -if (is_file($robotsTxtPath)) { - @unlink($robotsTxtPath); +/** @var \Magento\Filesystem\Directory\Write $rootDirectory */ +$rootDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::ROOT); +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 04f3cf95c55..11a9f98f7fc 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 @@ -24,9 +24,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -copy( - __DIR__ . DS . 'robots.txt', - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir() - . DS . 'robots.txt' -); +/** @var \Magento\Filesystem\Directory\Write $rootDirectory */ +$rootDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::ROOT); +$rootDirectory->copyFile($rootDirectory->getRelativePath(__DIR__ . '/robots.txt'), 'robots.txt'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Utility/Controller.php b/dev/tests/integration/testsuite/Magento/Backend/Utility/Controller.php index 0c4f9edfbf4..ff94dc0a85f 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Utility/Controller.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Utility/Controller.php @@ -60,16 +60,7 @@ class Controller extends \Magento\TestFramework\TestCase\AbstractController protected function tearDown() { - /** @var $checkoutSession \Magento\Checkout\Model\Session */ - $checkoutSession = $this->_objectManager->get('Magento\Checkout\Model\Session'); - $checkoutSession->clearStorage(); - if (session_status() === PHP_SESSION_ACTIVE) { - session_destroy(); - } - if (isset($_COOKIE[$checkoutSession->getName()])) { - unset($_COOKIE[$checkoutSession->getName()]); - } - + $this->_auth->logout(); $this->_auth = null; $this->_session = null; $this->_objectManager->get('Magento\Backend\Model\Url')->turnOnSecretKey(); @@ -81,11 +72,11 @@ class Controller extends \Magento\TestFramework\TestCase\AbstractController * * @param \PHPUnit_Framework_Constraint $constraint * @param string|null $messageType - * @param string $sessionModel + * @param string $messageManager */ public function assertSessionMessages( - \PHPUnit_Framework_Constraint $constraint, $messageType = null, $sessionModel = 'Magento\Backend\Model\Session' + \PHPUnit_Framework_Constraint $constraint, $messageType = null, $messageManager = 'Magento\Message\Manager' ) { - parent::assertSessionMessages($constraint, $messageType, $sessionModel); + parent::assertSessionMessages($constraint, $messageType, $messageManager); } } diff --git a/dev/tests/integration/testsuite/Magento/Captcha/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Captcha/Model/ObserverTest.php index 1dd26258c80..295fbdfb338 100644 --- a/dev/tests/integration/testsuite/Magento/Captcha/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Captcha/Model/ObserverTest.php @@ -119,8 +119,7 @@ class ObserverTest extends \Magento\TestFramework\TestCase\AbstractController $this->getRequest()->setPost(array('email' => 'dummy@dummy.com', 'captcha' => '1234')); $this->dispatch('backend/admin/auth/forgotpassword'); $this->assertSessionMessages( - $this->equalTo(array('Incorrect CAPTCHA')), \Magento\Message\Factory::ERROR, - 'Magento\Backend\Model\Session' + $this->equalTo(array('Incorrect CAPTCHA')), \Magento\Message\MessageInterface::TYPE_ERROR ); } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php index e1234f7e37d..a88e6f674d4 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php @@ -54,7 +54,7 @@ class CategoryTest extends \Magento\Backend\Utility\Controller $this->dispatch('backend/catalog/category/save'); $this->assertSessionMessages( - $this->equalTo(array('You saved the category.')), \Magento\Message\Factory::SUCCESS + $this->equalTo(array('You saved the category.')), \Magento\Message\MessageInterface::TYPE_SUCCESS ); /** @var $category \Magento\Catalog\Model\Category */ @@ -305,7 +305,7 @@ class CategoryTest extends \Magento\Backend\Utility\Controller )); $this->dispatch('backend/catalog/category/save'); $this->assertSessionMessages( - $this->equalTo(array('Unable to save the category')), \Magento\Message\Factory::ERROR + $this->equalTo(array('Unable to save the category')), \Magento\Message\MessageInterface::TYPE_ERROR ); } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php index 81d34678ca8..9b81085d8da 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php @@ -42,8 +42,8 @@ class AttributeTest extends \Magento\Backend\Utility\Controller { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $session \Magento\Adminhtml\Model\Session */ - $session = $objectManager->get('Magento\Adminhtml\Model\Session'); + /** @var $session \Magento\Backend\Model\Session */ + $session = $objectManager->get('Magento\Backend\Model\Session'); $session->setProductIds(array(1)); $this->dispatch('backend/catalog/product_action_attribute/save/store/0'); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php index 4d97a63d5bf..ec0fbae625c 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php @@ -80,7 +80,7 @@ class ProductTest extends \Magento\Backend\Utility\Controller )); $this->dispatch('backend/catalog/product/save'); $this->assertSessionMessages( - $this->equalTo(array('Unable to save product')), \Magento\Message\Factory::ERROR + $this->equalTo(array('Unable to save product')), \Magento\Message\MessageInterface::TYPE_ERROR ); $this->assertRedirect($this->stringContains('/backend/catalog/product/edit')); } @@ -94,7 +94,7 @@ class ProductTest extends \Magento\Backend\Utility\Controller $this->dispatch('backend/catalog/product/save/id/1'); $this->assertRedirect($this->stringStartsWith('http://localhost/index.php/backend/catalog/product/new/')); $this->assertSessionMessages( - $this->contains('You saved the product.'), \Magento\Message\Factory::SUCCESS + $this->contains('You saved the product.'), \Magento\Message\MessageInterface::TYPE_SUCCESS ); } @@ -112,10 +112,10 @@ class ProductTest extends \Magento\Backend\Utility\Controller $this->stringStartsWith('http://localhost/index.php/backend/catalog/product/edit/id/1/') )); $this->assertSessionMessages( - $this->contains('You saved the product.'), \Magento\Message\Factory::SUCCESS + $this->contains('You saved the product.'), \Magento\Message\MessageInterface::TYPE_SUCCESS ); $this->assertSessionMessages( - $this->contains('You duplicated the product.'), \Magento\Message\Factory::SUCCESS + $this->contains('You duplicated the product.'), \Magento\Message\MessageInterface::TYPE_SUCCESS ); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php index 9266e5c55ba..141461b1ac6 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php @@ -38,11 +38,11 @@ class CompareTest extends \Magento\TestFramework\TestCase\AbstractController $this->dispatch('catalog/product_compare/add/product/1?nocookie=1'); - /** @var $session \Magento\Catalog\Model\Session */ - $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Catalog\Model\Session'); - $this->assertInstanceOf('Magento\Message\Success', $session->getMessages()->getLastAddedMessage()); + /** @var $messageManager \Magento\Message\Manager */ + $messageManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Message\Manager'); + $this->assertInstanceOf('Magento\Message\Success', $messageManager->getMessages()->getLastAddedMessage()); $this->assertContains('Simple Product 1 Name', - (string)$session->getMessages()->getLastAddedMessage()->getText()); + (string)$messageManager->getMessages()->getLastAddedMessage()->getText()); $this->assertRedirect(); @@ -66,11 +66,11 @@ class CompareTest extends \Magento\TestFramework\TestCase\AbstractController $this->dispatch('catalog/product_compare/remove/product/2'); - /** @var $session \Magento\Catalog\Model\Session */ - $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Catalog\Model\Session'); - $this->assertInstanceOf('Magento\Message\Success', $session->getMessages()->getLastAddedMessage()); + /** @var $messageManager \Magento\Message\Manager */ + $messageManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Message\Manager'); + $this->assertInstanceOf('Magento\Message\Success', $messageManager->getMessages()->getLastAddedMessage()); $this->assertContains('Simple Product 2 Name', - (string)$session->getMessages()->getLastAddedMessage()->getText()); + (string)$messageManager->getMessages()->getLastAddedMessage()->getText()); $this->assertRedirect(); @@ -106,9 +106,9 @@ class CompareTest extends \Magento\TestFramework\TestCase\AbstractController $this->dispatch('catalog/product_compare/clear'); - /** @var $session \Magento\Catalog\Model\Session */ - $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Catalog\Model\Session'); - $this->assertInstanceOf('Magento\Message\Success', $session->getMessages()->getLastAddedMessage()); + /** @var $messageManager \Magento\Message\Manager */ + $messageManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Message\Manager'); + $this->assertInstanceOf('Magento\Message\Success', $messageManager->getMessages()->getLastAddedMessage()); $this->assertRedirect(); @@ -123,13 +123,13 @@ class CompareTest extends \Magento\TestFramework\TestCase\AbstractController $this->_prepareCompareListWithProductNameXss(); $this->dispatch('catalog/product_compare/remove/product/1?nocookie=1'); $messages = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Catalog\Model\Session')->getMessages()->getItems(); + ->get('Magento\Message\Manager')->getMessages()->getItems(); $isProductNamePresent = false; foreach ($messages as $message) { - if (strpos($message->getCode(), '<script>alert("xss");</script>') !== false) { + if (strpos($message->getText(), '<script>alert("xss");</script>') !== false) { $isProductNamePresent = true; } - $this->assertNotContains('<script>alert("xss");</script>', (string)$message->getCode()); + $this->assertNotContains('<script>alert("xss");</script>', (string)$message->getText()); } $this->assertTrue($isProductNamePresent, 'Product name was not found in session messages'); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/ImageTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/ImageTest.php index 174d4412eaf..7b03a24bebc 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/ImageTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/ImageTest.php @@ -34,11 +34,6 @@ class ImageTest extends \PHPUnit_Framework_TestCase */ protected $_helper; - /** - * @var string - */ - protected static $_fixtureMediaDir = ''; - /** * @var string */ @@ -51,30 +46,35 @@ class ImageTest extends \PHPUnit_Framework_TestCase public static function setUpBeforeClass() { + $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); + // image fixtures - self::$_fixtureMediaDir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Catalog\Model\Product\Media\Config')->getBaseMediaPath(); - mkdir(self::$_fixtureMediaDir . '/m/a', 0777, true); + $fixtureMediaDir = $mediaDirectory->getAbsolutePath($config->getBaseMediaPath()); + + mkdir($fixtureMediaDir . '/m/a', 0777, true); $fixtureDir = dirname(__DIR__) . '/_files'; - copy("{$fixtureDir}/magento_image.jpg", self::$_fixtureMediaDir . '/m/a/magento_image.jpg'); - copy("{$fixtureDir}/magento_small_image.jpg", self::$_fixtureMediaDir . '/m/a/magento_small_image.jpg'); - copy("{$fixtureDir}/magento_thumbnail.jpg", self::$_fixtureMediaDir . '/m/a/magento_thumbnail.jpg'); + copy("{$fixtureDir}/magento_image.jpg", $fixtureMediaDir . '/m/a/magento_image.jpg'); + copy("{$fixtureDir}/magento_small_image.jpg", $fixtureMediaDir . '/m/a/magento_small_image.jpg'); + copy("{$fixtureDir}/magento_thumbnail.jpg", $fixtureMediaDir . '/m/a/magento_thumbnail.jpg'); // watermark fixture mkdir( - self::$_fixtureMediaDir . '/watermark/stores/' . \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + $fixtureMediaDir . '/watermark/stores/' . $objectManager ->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getId(), 0777, true ); copy( "{$fixtureDir}/watermark.jpg", - self::$_fixtureMediaDir . '/watermark/stores/' . \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + $fixtureMediaDir . '/watermark/stores/' . $objectManager ->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getId() . '/watermark.jpg' ); // sample product with images - self::$_product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + self::$_product = $objectManager ->create('Magento\Catalog\Model\Product'); self::$_product ->addData(array( @@ -85,17 +85,19 @@ class ImageTest extends \PHPUnit_Framework_TestCase ; // sample image cached URL - $helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Catalog\Helper\Image'); + $helper = $objectManager->get('Magento\Catalog\Helper\Image'); self::$_sampleCachedUrl = (string)$helper->init(self::$_product, 'image'); } public static function tearDownAfterClass() { - \Magento\Io\File::rmdirRecursive(self::$_fixtureMediaDir); - \Magento\Io\File::rmdirRecursive( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Catalog\Model\Product\Media\Config')->getBaseTmpMediaPath() - ); + $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->delete($config->getBaseMediaPath()); + $mediaDirectory->delete($config->getBaseTmpMediaPath()); } /** diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php index f1580964f9f..fcb10eec360 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php @@ -26,9 +26,6 @@ */ namespace Magento\Catalog\Helper\Product; -require \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir() - . '/app/code/Magento/Catalog/Controller/Product.php'; - /** * @magentoAppArea frontend */ @@ -148,43 +145,4 @@ class ViewTest extends \PHPUnit_Framework_TestCase { $this->_helper->prepareAndRender(999, $this->_controller); } - - /** - * Test for _getSessionMessageModels - * - * @magentoDataFixture Magento/Catalog/_files/multiple_products.php - * @magentoAppIsolation enabled - * @magentoAppArea frontend - */ - public function testGetSessionMessageModels() - { - $expectedMessages = array( - 'Magento\Catalog\Model\Session' => 'catalog message', - 'Magento\Checkout\Model\Session' => 'checkout message', - ); - - // add messages - foreach ($expectedMessages as $sessionModel => $messageText) { - /** @var $session \Magento\Core\Model\Session\AbstractSession */ - $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get($sessionModel); - $session->addNotice($messageText); - } - - // _getSessionMessageModels invokes inside prepareAndRender - $this->_helper->prepareAndRender(10, $this->_controller); - - // assert messages - $actualMessages = $this->_layout->getMessagesBlock()->getMessages(); - $this->assertSameSize($expectedMessages, $actualMessages); - - sort($expectedMessages); - - /** @var $message \Magento\Message\Notice */ - foreach ($actualMessages as $key => $message) { - $actualMessages[$key] = $message->getText(); - } - sort($actualMessages); - - $this->assertEquals($expectedMessages, $actualMessages); - } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/DesignTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/DesignTest.php index f54c916a991..2ad462d7c28 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/DesignTest.php @@ -80,9 +80,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase 'parent_theme' => null, 'is_featured' => true, 'preview_image' => '', - 'theme_directory' => implode( - DIRECTORY_SEPARATOR, array(__DIR__, '_files', 'design', 'frontend', 'default', 'default') - ) + 'theme_directory' => __DIR__ . '_files/design/frontend/default/default' ); } } 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 0d4dcc2ede7..93e876159f1 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 @@ -50,19 +50,17 @@ class MediaTest extends \PHPUnit_Framework_TestCase public static function setUpBeforeClass() { - self::$_mediaTmpDir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Catalog\Model\Product\Media\Config')->getBaseTmpMediaPath(); + $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); + + self::$_mediaTmpDir = $mediaDirectory->getAbsolutePath($config->getBaseTmpMediaPath()); + self::$_mediaDir = $mediaDirectory->getAbsolutePath($config->getBaseMediaPath()); $fixtureDir = realpath(__DIR__.'/../../../../_files'); - self::$_mediaDir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Catalog\Model\Product\Media\Config')->getBaseMediaPath(); - $ioFile = new \Magento\Io\File(); - if (!is_dir(self::$_mediaTmpDir)) { - $ioFile->mkdir(self::$_mediaTmpDir, 0777, true); - } - if (!is_dir(self::$_mediaDir)) { - $ioFile->mkdir(self::$_mediaDir, 0777, true); - } + $mediaDirectory->create($config->getBaseTmpMediaPath()); + $mediaDirectory->create($config->getBaseMediaPath()); copy($fixtureDir . "/magento_image.jpg", self::$_mediaTmpDir . "/magento_image.jpg"); copy($fixtureDir . "/magento_image.jpg", self::$_mediaDir . "/magento_image.jpg"); @@ -71,8 +69,20 @@ class MediaTest extends \PHPUnit_Framework_TestCase public static function tearDownAfterClass() { - \Magento\Io\File::rmdirRecursive(self::$_mediaTmpDir); - \Magento\Io\File::rmdirRecursive(self::$_mediaDir); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\Catalog\Model\Product\Media\Config $config */ + $config = $objectManager->get('Magento\Catalog\Model\Product\Media\Config'); + + /** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ + $mediaDirectory = $objectManager->get('Magento\Filesystem') + ->getDirectoryWrite(\Magento\Filesystem::MEDIA); + + if ($mediaDirectory->isExist($config->getBaseMediaPath())) { + $mediaDirectory->delete($config->getBaseMediaPath()); + } + if ($mediaDirectory->isExist($config->getBaseTmpMediaPath())) { + $mediaDirectory->delete($config->getBaseTmpMediaPath()); + } } protected function setUp() 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 dc08de96bfd..f19c236cad5 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,9 +68,7 @@ class SkuTest extends \PHPUnit_Framework_TestCase */ public function testGenerateUniqueLongSku($product) { - $existedProduct = clone $product; - $existedProduct->setId(2); - $existedProduct->save(); + $product->duplicate(); $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/ProductGettersTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php index dc24cdc800c..325d4d1a855 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php @@ -282,8 +282,10 @@ class ProductGettersTest extends \PHPUnit_Framework_TestCase public static function tearDownAfterClass() { - $mediaDir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Catalog\Model\Product\Media\Config')->getBaseMediaPath(); - \Magento\Io\File::rmdirRecursive($mediaDir); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $mediaDirectory = $objectManager->get('Magento\Filesystem') + ->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $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 dfbe08b0d7e..daf0da4d6d6 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php @@ -50,13 +50,20 @@ class ProductTest extends \PHPUnit_Framework_TestCase public static function tearDownAfterClass() { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var \Magento\Catalog\Model\Product\Media\Config $config */ - $config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Catalog\Model\Product\Media\Config'); + $config = $objectManager->get('Magento\Catalog\Model\Product\Media\Config'); - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); - $filesystem->delete($config->getBaseMediaPath()); - $filesystem->delete($config->getBaseTmpMediaPath()); + /** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ + $mediaDirectory = $objectManager->get('Magento\Filesystem') + ->getDirectoryWrite(\Magento\Filesystem::MEDIA); + + if ($mediaDirectory->isExist($config->getBaseMediaPath())) { + $mediaDirectory->delete($config->getBaseMediaPath()); + } + if ($mediaDirectory->isExist($config->getBaseTmpMediaPath())) { + $mediaDirectory->delete($config->getBaseTmpMediaPath()); + } } public function testCanAffectOptions() @@ -118,17 +125,17 @@ class ProductTest extends \PHPUnit_Framework_TestCase */ protected function _copyFileToBaseTmpMediaPath($sourceFile) { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var \Magento\Catalog\Model\Product\Media\Config $config */ - $config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Catalog\Model\Product\Media\Config'); - $baseTmpMediaPath = $config->getBaseTmpMediaPath(); + $config = $objectManager->get('Magento\Catalog\Model\Product\Media\Config'); - $targetFile = $baseTmpMediaPath . DS . basename($sourceFile); + /** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ + $mediaDirectory = $objectManager->get('Magento\Filesystem') + ->getDirectoryWrite(\Magento\Filesystem::MEDIA); - /** @var \Magento\Filesystem $filesystem */ - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $filesystem->setIsAllowCreateDirectories(true); - $filesystem->copy($sourceFile, $targetFile); + $mediaDirectory->create($config->getBaseTmpMediaPath()); + $targetFile = $config->getTmpMediaPath(basename($sourceFile)); + copy($sourceFile, $mediaDirectory->getAbsolutePath($targetFile)); return $targetFile; } 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 d1efda38227..e70258844a9 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_image.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_image.php @@ -25,10 +25,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -$mediaDir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Catalog\Model\Product\Media\Config')->getBaseMediaPath(); -$dir = $mediaDir . '/m/a'; +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$mediaPath = $objectManager->get('Magento\Filesystem')->getPath(\Magento\Filesystem::MEDIA); +$additionalPath = $objectManager->get('Magento\Catalog\Model\Product\Media\Config')->getBaseMediaPath(); +$dir = $mediaPath . '/' . $additionalPath . '/m/a'; if (!is_dir($dir)) { mkdir($dir, 0777, true); } -copy(__DIR__ . '/magento_image.jpg', $mediaDir . '/m/a/magento_image.jpg'); +copy(__DIR__ . '/magento_image.jpg', $dir . '/magento_image.jpg'); 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 8fa2c0fb415..b1217f5b4e6 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 @@ -28,5 +28,11 @@ /** @var $config \Magento\Catalog\Model\Product\Media\Config */ $config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Catalog\Model\Product\Media\Config'); -\Magento\Io\File::rmdirRecursive($config->getBaseMediaPath()); -\Magento\Io\File::rmdirRecursive($config->getBaseTmpMediaPath()); + +/** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ +$mediaDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Filesystem') + ->getDirectoryWrite(\Magento\Filesystem::MEDIA); + +$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 d4d3db96b70..74b10505bfa 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php @@ -26,25 +26,24 @@ */ // Copy images to tmp media path + +$obectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var \Magento\Catalog\Model\Product\Media\Config $config */ -$config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Catalog\Model\Product\Media\Config'); -$baseTmpMediaPath = $config->getBaseTmpMediaPath(); +$config = $obectManager->get('Magento\Catalog\Model\Product\Media\Config'); +/** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ +$mediaDirectory = $obectManager->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::MEDIA); -/** @var \Magento\Filesystem $filesystem */ -$filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); -$filesystem->setIsAllowCreateDirectories(true); -$filesystem->copy(__DIR__ . '/product_image.png', $baseTmpMediaPath . '/product_image.png'); +$baseTmpMediaPath = $config->getBaseTmpMediaPath(); +$mediaDirectory->create($baseTmpMediaPath); +copy(__DIR__ . '/product_image.png', $mediaDirectory->getAbsolutePath($baseTmpMediaPath . '/product_image.png')); /** @var $productOne \Magento\Catalog\Model\Product */ -$productOne = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Catalog\Model\Product'); +$productOne = $obectManager->create('Magento\Catalog\Model\Product'); $productOne->setId(1) ->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) ->setAttributeSetId(4) ->setWebsiteIds(array( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface') - ->getStore()->getWebsiteId() + $obectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId() )) ->setSku('simple_product_1') ->setName('Simple Product 1 Name') @@ -71,14 +70,12 @@ $productOne->setId(1) ->save(); /** @var $productTwo \Magento\Catalog\Model\Product */ -$productTwo = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Catalog\Model\Product'); +$productTwo = $obectManager->create('Magento\Catalog\Model\Product'); $productTwo->setId(2) ->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) ->setAttributeSetId(4) ->setWebsiteIds(array( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface') - ->getStore()->getWebsiteId() + $obectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId() )) ->setSku('simple_product_2') ->setName('Simple Product 2 Name') diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php index eec7687d299..1c09a393e03 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php @@ -50,8 +50,7 @@ class CartTest extends \Magento\TestFramework\TestCase\AbstractController $this->assertSessionMessages( $this->isEmpty(), - \Magento\Message\Factory::ERROR, - 'Magento\Checkout\Model\Session' + \Magento\Message\MessageInterface::TYPE_ERROR ); $this->assertSelectCount( @@ -80,8 +79,7 @@ class CartTest extends \Magento\TestFramework\TestCase\AbstractController $this->assertSessionMessages( $this->isEmpty(), - \Magento\Message\Factory::ERROR, - 'Magento\Checkout\Model\Session' + \Magento\Message\MessageInterface::TYPE_ERROR ); $this->assertSelectCount( @@ -117,8 +115,7 @@ class CartTest extends \Magento\TestFramework\TestCase\AbstractController $this->assertSessionMessages( $this->isEmpty(), - \Magento\Message\Factory::ERROR, - 'Magento\Checkout\Model\Session' + \Magento\Message\MessageInterface::TYPE_ERROR ); $this->assertSelectCount( @@ -147,8 +144,7 @@ class CartTest extends \Magento\TestFramework\TestCase\AbstractController $this->assertSessionMessages( $this->isEmpty(), - \Magento\Message\Factory::ERROR, - 'Magento\Checkout\Model\Session' + \Magento\Message\MessageInterface::TYPE_ERROR ); $this->assertSelectCount( @@ -184,8 +180,7 @@ class CartTest extends \Magento\TestFramework\TestCase\AbstractController $this->assertSessionMessages( $this->isEmpty(), - \Magento\Message\Factory::ERROR, - 'Magento\Checkout\Model\Session' + \Magento\Message\MessageInterface::TYPE_ERROR ); $this->assertSelectCount( 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 163485cdafc..eb2bfca596a 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Helper/Wysiwyg/ImagesTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Helper/Wysiwyg/ImagesTest.php @@ -27,11 +27,13 @@ class ImagesTest extends \PHPUnit_Framework_TestCase { public function testGetStorageRoot() { - /** @var $dir \Magento\App\Dir */ - $dir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir'); + $path = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem')->getPath( + \Magento\Filesystem::MEDIA + ); $helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Cms\Helper\Wysiwyg\Images'); - $this->assertStringStartsWith($dir->getDir(\Magento\App\Dir::MEDIA), $helper->getStorageRoot()); + $realPath = str_replace('\\', '/', $path); + $this->assertStringStartsWith($realPath, $helper->getStorageRoot()); } public function testGetCurrentUrl() 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 b40cf2950b0..49246bb95ec 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 @@ -40,13 +40,16 @@ class StorageTest extends \PHPUnit_Framework_TestCase self::$_baseDir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Cms\Helper\Wysiwyg\Images') ->getCurrentPath() . 'MagentoCmsModelWysiwygImagesStorageTest'; - mkdir(self::$_baseDir, 0777); - touch(self::$_baseDir . DIRECTORY_SEPARATOR . '1.swf'); + if (!file_exists(self::$_baseDir)) { + mkdir(self::$_baseDir, 0777); + } + touch(self::$_baseDir . '/1.swf'); } public static function tearDownAfterClass() { - \Magento\Io\File::rmdirRecursive(self::$_baseDir); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Filesystem\Driver\File')->deleteDirectory(self::$_baseDir); } /** @@ -54,13 +57,13 @@ class StorageTest extends \PHPUnit_Framework_TestCase */ public function testGetFilesCollection() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get('Magento\Core\Model\App') ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') + $objectManager->get('Magento\View\DesignInterface') ->setDesignTheme('magento_backend'); /** @var $model \Magento\Cms\Model\Wysiwyg\Images\Storage */ - $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Cms\Model\Wysiwyg\Images\Storage'); + $model = $objectManager->create('Magento\Cms\Model\Wysiwyg\Images\Storage'); $collection = $model->getFilesCollection(self::$_baseDir, 'media'); $this->assertInstanceOf('Magento\Cms\Model\Wysiwyg\Images\Storage\Collection', $collection); foreach ($collection as $item) { @@ -79,15 +82,14 @@ class StorageTest extends \PHPUnit_Framework_TestCase */ public function testGetThumbsPath() { - $filesystem = new \Magento\Filesystem(new \Magento\Filesystem\Adapter\Local); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $filesystem = $objectManager->get('Magento\Filesystem'); $session = $objectManager->get('Magento\Backend\Model\Session'); $backendUrl = $objectManager->get('Magento\Backend\Model\Url'); $imageFactory = $objectManager->get('Magento\Image\AdapterFactory'); $viewUrl = $objectManager->get('Magento\View\Url'); $imageHelper = $objectManager->get('Magento\Cms\Helper\Wysiwyg\Images'); $coreFileStorageDb = $objectManager->get('Magento\Core\Helper\File\Storage\Database'); - $dir = $objectManager->get('Magento\App\Dir'); $storageCollectionFactory = $objectManager->get('Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory'); $storageFileFactory = $objectManager->get('Magento\Core\Model\File\Storage\FileFactory'); $storageDatabaseFactory = $objectManager->get('Magento\Core\Model\File\Storage\DatabaseFactory'); @@ -102,7 +104,6 @@ class StorageTest extends \PHPUnit_Framework_TestCase $filesystem, $imageFactory, $viewUrl, - $dir, $storageCollectionFactory, $storageFileFactory, $storageDatabaseFactory, @@ -110,7 +111,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase $uploaderFactory ); $this->assertStringStartsWith( - realpath(\Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir()), + str_replace('\\', '/', $filesystem->getPath(\Magento\Filesystem::MEDIA)), $model->getThumbsPath() ); } diff --git a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest.php b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest.php index 5b082726fde..4353356ff80 100644 --- a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest.php @@ -54,18 +54,23 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase */ protected $_ioObject; + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected $varDirectory; + protected function setUp() { $this->_includePath = get_include_path(); - /** @var $dirs \Magento\App\Dir */ - $dirs = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir'); - $generationDirectory = $dirs->getDir(\Magento\App\Dir::VAR_DIR) . '/generation'; + $this->varDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $generationDirectory = $this->varDirectory->getAbsolutePath('generation'); \Magento\Autoload\IncludePath::addIncludePath($generationDirectory); $this->_ioObject = new \Magento\Code\Generator\Io( - new \Magento\Io\File(), + new \Magento\Filesystem\Driver\File(), new \Magento\Autoload\IncludePath(), $generationDirectory ); @@ -77,11 +82,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase protected function tearDown() { - /** @var $dirs \Magento\App\Dir */ - $dirs = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir'); - $generationDirectory = $dirs->getDir(\Magento\App\Dir::VAR_DIR) . '/generation'; - \Magento\Io\File::rmdirRecursive($generationDirectory); - + $this->varDirectory->delete('generation'); set_include_path($this->_includePath); unset($this->_generator); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/ConfigTest.php index cd31dbc6ee6..47e1a328aa5 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/ConfigTest.php @@ -32,31 +32,57 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ protected $_config; + /** + * @var \Magento\Filesystem + */ + protected $filesystem; + + /** + * @var \Magento\ObjectManager + */ + protected $objectManager; + + /** + * Setup test + */ protected function setUp() { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\App\Dir $dirs */ - $dirs = $objectManager->create( - 'Magento\App\Dir', - array( - 'baseDir' => BP, - 'dirs' => array( - \Magento\App\Dir::MODULES => __DIR__ . '/LayoutTest', - \Magento\App\Dir::CONFIG => __DIR__ . '/LayoutTest', - ) - ) + $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 = $objectManager->create( + $moduleList = $this->objectManager->create( 'Magento\Module\ModuleList', array( - 'reader' => $objectManager->create( + 'reader' => $this->objectManager->create( 'Magento\Module\Declaration\Reader\Filesystem', array( - 'fileResolver' => $objectManager->create( + 'fileResolver' => $this->objectManager->create( 'Magento\Module\Declaration\FileResolver', array( - 'applicationDirs' => $dirs + 'filesystem' => $this->filesystem ) ) ) @@ -65,19 +91,24 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ) ); - /** @var \Magento\Module\Dir\Reader $moduleReader */ - $moduleReader = $objectManager->create( - 'Magento\Module\Dir\Reader', - array( - 'moduleList' => $moduleList - ) + $moduleReader = new \Magento\Module\Dir\Reader( + $modulesDir, + $moduleList, + $this->filesystem, + $this->objectManager->get('Magento\Config\FileIteratorFactory') ); - $moduleReader->setModuleDir('Magento_Last', 'etc', __DIR__ . '/LayoutTest/Magento/Last/etc'); /** @var \Magento\Core\Model\DataService\Config\Reader\Factory $dsCfgReaderFactory */ - $dsCfgReaderFactory = $objectManager->create('Magento\Core\Model\DataService\Config\Reader\Factory'); + $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 + ); - $this->_config = new \Magento\Core\Model\DataService\Config($dsCfgReaderFactory, $moduleReader); } public function testGetClassByAliasOverride() diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest.php index 698235d7d0a..d215ac6ac93 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest.php @@ -29,22 +29,49 @@ class LayoutTest extends \Magento\TestFramework\TestCase\AbstractController { private $_dataServiceGraph; + /** + * @var \Magento\ObjectManager + */ + protected $objectManager; + + /** + * @var \Magento\Filesystem + */ + protected $filesystem; + + /** + * Setup + */ protected function setUp() { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - // Need to call this first so we get proper config + $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__ . DS . "LayoutTest" . DS . 'Magento' . DS . 'Catalog' . DS . 'Service' - . DS . 'TestProduct.php'; + $fixtureFileName = __DIR__ . '/LayoutTest/Magento/Catalog/Service/TestProduct.php'; include $fixtureFileName; - $invoker = $objectManager->create( + $invoker = $this->objectManager->create( 'Magento\Core\Model\DataService\Invoker', array('config' => $config) ); /** @var \Magento\Core\Model\DataService\Graph $dataServiceGraph */ - $this->_dataServiceGraph = $objectManager->create( + $this->_dataServiceGraph = $this->objectManager->create( 'Magento\Core\Model\DataService\Graph', array('dataServiceInvoker' => $invoker) ); @@ -52,18 +79,29 @@ class LayoutTest extends \Magento\TestFramework\TestCase\AbstractController protected function _loadServiceCallsConfig() { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $modulesDir = new \Magento\Module\Dir( + $this->filesystem, + $this->objectManager->get('Magento\Stdlib\String') + ); /** @var \Magento\Module\Dir\Reader $moduleReader */ - $moduleReader = $objectManager->create('Magento\Module\Dir\Reader'); - $moduleReader->setModuleDir('Magento_Catalog', 'etc', __DIR__ . '/LayoutTest/Magento/Catalog/etc'); + + $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 = $objectManager->create( + $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); + $dataServiceConfig = new \Magento\Core\Model\DataService\Config( + $dsCfgReaderFactory, + $moduleReader + ); return $dataServiceConfig; } 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 1983ea3d314..4252356df95 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/File/StorageTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/File/StorageTest.php @@ -43,7 +43,8 @@ class StorageTest extends \PHPUnit_Framework_TestCase $this->assertArrayHasKey('allowed_resources', $config); $this->assertArrayHasKey('update_time', $config); $this->assertEquals( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir('media'), + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Filesystem')->getPath(\Magento\Filesystem::MEDIA), $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 32fa7edd4db..ff51c34eef5 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php @@ -56,10 +56,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ public function testThemeRegistration() { - $baseDir = 'base_dir'; $pattern = 'path_pattern'; - $this->_eventObserver->getEvent()->setBaseDir($baseDir); $this->_eventObserver->getEvent()->setPathPattern($pattern); $themeRegistration = $this->getMock( @@ -67,12 +65,13 @@ class ObserverTest extends \PHPUnit_Framework_TestCase array('register'), array( $this->_objectManager->create('Magento\Core\Model\Resource\Theme\CollectionFactory'), - $this->_objectManager->create('Magento\Core\Model\Theme\Collection') + $this->_objectManager->create('Magento\Core\Model\Theme\Collection'), + $this->_objectManager->create('Magento\Filesystem') ) ); $themeRegistration->expects($this->once()) ->method('register') - ->with($baseDir, $pattern); + ->with($this->equalTo($pattern)); $this->_objectManager->addSharedInstance($themeRegistration, 'Magento\Core\Model\Theme\Registration'); /** @var $observer \Magento\Core\Model\Observer */ diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSession/VarienTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSession/VarienTest.php index 5171812e565..efdd7d64b10 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSession/VarienTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSession/VarienTest.php @@ -27,7 +27,7 @@ namespace Magento\Core\Model\Session\AbstractSession; /** - * Test class for \Magento\Core\Model\Session\AbstractSession + * Test class for \Magento\Session\SessionManagerInterface */ class VarienTest extends \PHPUnit_Framework_TestCase { @@ -51,12 +51,12 @@ class VarienTest extends \PHPUnit_Framework_TestCase ini_set('session.save_handler', $origSessionHandler); /** @var $configModel \Magento\Core\Model\Config */ $configModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Config'); - $configModel->setNode(\Magento\Core\Model\Session\AbstractSession::PARAM_SESSION_SAVE_METHOD, $saveMethod); + $configModel->setNode(\Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD, $saveMethod); /** - * @var \Magento\Core\Model\Session\AbstractSession $model + * @var \Magento\Session\SessionManagerInterface $model */ $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Session\AbstractSession'); + ->create('Magento\Session\SessionManagerInterface'); //There is no any possibility to determine whether session already started or not in php before 5.4 $model->setSkipEmptySessionCheck(true); $model->start(); 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 304f00efaa8..1e834305106 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Session/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Session/ConfigTest.php @@ -39,22 +39,37 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ protected $_cacheLimiter = 'private_no_expire'; + /** + * @var \Magento\TestFramework\ObjectManager + */ + protected $_objectManager; + protected function setUp() { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Core\Model\Session\AbstractSession _model */ - $this->_model = $objectManager->create('\Magento\Core\Model\Session\Config', array( + $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $sessionManager \Magento\Session\SessionManager */ + $sessionManager = $this->_objectManager->get('Magento\Session\SessionManager'); + if ($sessionManager->isSessionExists()) { + $sessionManager->destroy(); + } + $this->_model = $this->_objectManager->create('Magento\Core\Model\Session\Config', array( + 'saveMethod' => 'files', 'cacheLimiter' => $this->_cacheLimiter )); } + protected function tearDown() + { + $this->_objectManager->removeSharedInstance('Magento\Core\Model\Session\Config'); + } + /** * @magentoAppIsolation enabled */ public function testDefaultConfiguration() { $this->assertEquals( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir('session'), + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem')->getPath('session'), $this->_model->getSavePath() ); $this->assertEquals( @@ -66,6 +81,14 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->assertEquals('localhost', $this->_model->getCookieDomain()); $this->assertEquals(false, $this->_model->getCookieSecure()); $this->assertEquals(true, $this->_model->getCookieHttpOnly()); + $this->assertEquals($this->_model->getOption('save_path'), ini_get('session.save_path')); } -} + /** + * @magentoAppIsolation enabled + */ + public function testGetSessionSaveMethod() + { + $this->assertEquals('files', $this->_model->getSaveHandler()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Session/SidResolverTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Session/SidResolverTest.php index 73d5ab3289b..0f34904e843 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Session/SidResolverTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Session/SidResolverTest.php @@ -71,11 +71,6 @@ class SidResolverTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Core\Model\Session _model */ $this->session = $objectManager->get('Magento\Core\Model\Session'); - $this->store = $this->getMockBuilder('Magento\Core\Model\Store') - ->setMethods(array('isAdmin')) - ->disableOriginalConstructor() - ->getMock(); - $this->coreStoreConfig = $this->getMockBuilder('Magento\Core\Model\Store\ConfigInterface') ->setMethods(array('getConfig')) ->disableOriginalConstructor() @@ -86,18 +81,9 @@ class SidResolverTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMockForAbstractClass(); - $storeManager = $this->getMockBuilder('Magento\Core\Model\StoreManagerInterface') - ->setMethods(array('getStore')) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $storeManager->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->store)); - $this->model = $objectManager->create( 'Magento\Core\Model\Session\SidResolver', array( - 'storeManager' => $storeManager, 'coreStoreConfig' => $this->coreStoreConfig, 'urlBuilder' => $this->urlBuilder, 'sidNameMap' => array($this->customSessionName => $this->customSessionQueryParam) @@ -163,11 +149,11 @@ class SidResolverTest extends \PHPUnit_Framework_TestCase public function testGetSessionIdQueryParamCustom() { $oldSessionName = $this->session->getName(); - $this->session->setSessionName($this->customSessionName); + $this->session->setName($this->customSessionName); $this->assertEquals( $this->customSessionQueryParam, $this->model->getSessionIdQueryParam($this->session) ); - $this->session->setSessionName($oldSessionName); + $this->session->setName($oldSessionName); } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php index 1917b28bc5f..a1458f9f0bf 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'), - 'dir' => $objectManager->get('Magento\App\Dir'), + 'filesystem' => $objectManager->get('Magento\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,21 +199,21 @@ class StoreTest extends \PHPUnit_Framework_TestCase public function testGetBaseUrlInPub() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\App\Dir::PARAM_APP_URIS => array(\Magento\App\Dir::PUB => '') + \Magento\Filesystem::PARAM_APP_DIRS => array(\Magento\Filesystem::PUB => array('uri' => '')) )); $this->_model = $this->_getStoreModel(); $this->_model->load('default'); $this->assertEquals( - 'http://localhost/static/', + 'http://localhost/pub/static/', $this->_model->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_STATIC) ); $this->assertEquals( - 'http://localhost/lib/', + 'http://localhost/pub/lib/', $this->_model->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_LIB) ); $this->assertEquals( - 'http://localhost/media/', + 'http://localhost/pub/media/', $this->_model->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_MEDIA) ); } 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 c279a710a23..99ae7fbfac1 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/CollectionTest.php @@ -39,9 +39,20 @@ class CollectionTest extends \PHPUnit_Framework_TestCase protected function setUp() { + $directoryList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create( + 'Magento\Filesystem\DirectoryList', + array( + 'root' => \Magento\Filesystem::ROOT, + 'directories' => array( + \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/_files/design') + ), + ) + ); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Filesystem', array('directoryList' => $directoryList)); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Theme\Collection'); - $this->_model->setBaseDir(dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files'. DIRECTORY_SEPARATOR . 'design'); + ->create('Magento\Core\Model\Theme\Collection', array('filesystem' => $filesystem)); } /** @@ -51,7 +62,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase */ public function testLoadThemesFromFileSystem() { - $pathPattern = implode(DS, array('frontend', '*', 'theme.xml')); + $pathPattern = implode('/', array('frontend', '*', 'theme.xml')); $this->_model->addTargetPattern($pathPattern); $this->assertEquals(8, count($this->_model)); } @@ -76,7 +87,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase { return array( array( - 'themePath' => implode(DIRECTORY_SEPARATOR, array('frontend', 'magento_default', 'theme.xml')), + 'themePath' => implode('/', array('frontend', 'magento_default', 'theme.xml')), 'expectedData' => array( 'area' => 'frontend', 'theme_title' => 'Default', 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 dac00ffba61..0705c24bbf2 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/RegistrationTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/RegistrationTest.php @@ -44,6 +44,11 @@ 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'), + ) + )); $this->_theme = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\View\Design\ThemeInterface'); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() @@ -58,9 +63,8 @@ class RegistrationTest extends \PHPUnit_Framework_TestCase */ protected function registerThemes() { - $basePath = realpath(__DIR__ . '/../_files/design'); - $pathPattern = implode(DIRECTORY_SEPARATOR, array('frontend', '*', 'theme.xml')); - $this->_model->register($basePath, $pathPattern); + $pathPattern = 'frontend/*/theme.xml'; + $this->_model->register($pathPattern); return $this; } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineTest.php index 0f7974451ae..efc0075d35c 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineTest.php @@ -67,6 +67,15 @@ class InlineTest extends \PHPUnit_Framework_TestCase ->get('Magento\Core\Model\StoreManagerInterface')->getStore($this->_storeId) ) ); + $this->_model->disable(); + $this->assertFalse($this->_model->isAllowed()); + $this->assertFalse($this->_model->isAllowed($this->_storeId)); + $this->assertFalse( + $this->_model->isAllowed( + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Core\Model\StoreManagerInterface')->getStore($this->_storeId) + ) + ); } /** diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/TranslateTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/TranslateTest.php index e8778a93c49..0027a48859a 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/TranslateTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/TranslateTest.php @@ -56,7 +56,7 @@ class TranslateTest extends \PHPUnit_Framework_TestCase $this->_viewFileSystem->expects($this->any()) ->method('getFilename') - ->will($this->returnValue(implode(DIRECTORY_SEPARATOR, $pathChunks))); + ->will($this->returnValue(implode('/', $pathChunks))); $theme = $this->getMock('Magento\Core\Model\Theme', array('getId', 'getCollection'), array(), '', false); $theme->expects($this->any()) 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 bbcdb2dcdc4..3a2482b1846 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php @@ -54,41 +54,33 @@ class DesignTest extends \PHPUnit_Framework_TestCase public static function setUpBeforeClass() { - $themeDir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::MEDIA) . 'theme'; - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $filesystem->delete($themeDir . '/frontend'); - $filesystem->delete($themeDir . '/_merged'); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\Filesystem $filesystem */ + $filesystem = $objectManager->get('Magento\Filesystem'); + $themeDir = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $themeDir->delete('theme/frontend'); + $themeDir->delete('theme/_merged'); - $ioAdapter = new \Magento\Io\File(); - $ioAdapter->cp( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::PUB_LIB) . '/prototype/prototype.js', - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::PUB_LIB) . '/prototype/prototype.min.js' - ); + $pubLibPath = $filesystem->getPath(\Magento\Filesystem::PUB_LIB); + copy($pubLibPath . '/prototype/prototype.js', $pubLibPath . '/prototype/prototype.min.js'); } public static function tearDownAfterClass() { - $ioAdapter = new \Magento\Io\File(); - $ioAdapter->rm( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::PUB_LIB) . '/prototype/prototype.min.js' - ); + /** @var \Magento\Filesystem $filesystem */ + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); + $pubLibPath = $filesystem->getPath(\Magento\Filesystem::PUB_LIB); + unlink($pubLibPath . '/prototype/prototype.min.js'); } protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\View\DesignInterface'); - $this->_viewFileSystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\View\FileSystem'); - $this->_viewConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\View\ConfigInterface'); - $this->_viewUrl = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\View\Url'); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_model = $objectManager->create('Magento\View\DesignInterface'); + $this->_viewFileSystem = $objectManager->create('Magento\View\FileSystem'); + $this->_viewConfig = $objectManager->create('Magento\View\ConfigInterface'); + $this->_viewUrl = $objectManager->create('Magento\View\Url'); + $objectManager->get('Magento\App\State')->setAreaCode('frontend'); } /** @@ -99,22 +91,17 @@ class DesignTest extends \PHPUnit_Framework_TestCase protected function _emulateFixtureTheme($themePath = 'test_default') { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\App\Dir::PARAM_APP_DIRS => array( - \Magento\App\Dir::THEMES => realpath(__DIR__ . '/../_files/design'), + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::THEMES => array('path' => realpath(__DIR__ . '/../_files/design')), ), )); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadArea('frontend'); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\View\DesignInterface') - ->setDesignTheme($themePath); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get('Magento\Core\Model\App')->loadArea('frontend'); + $objectManager->get('Magento\View\DesignInterface')->setDesignTheme($themePath); - $this->_viewFileSystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\View\FileSystem'); - $this->_viewConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\View\ConfigInterface'); - $this->_viewUrl = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\View\Url'); + $this->_viewFileSystem = $objectManager->create('Magento\View\FileSystem'); + $this->_viewConfig = $objectManager->create('Magento\View\ConfigInterface'); + $this->_viewUrl = $objectManager->create('Magento\View\Url'); } public function testSetGetArea() @@ -246,19 +233,20 @@ class DesignTest extends \PHPUnit_Framework_TestCase $customConfigFile = $theme->getCustomization()->getCustomViewConfigPath(); /** @var $filesystem \Magento\Filesystem */ $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $filesystem->setIsAllowCreateDirectories(true); + $directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $relativePath = $directory->getRelativePath($customConfigFile); try { - $filesystem->write($customConfigFile, '<?xml version="1.0" encoding="UTF-8"?> + $directory->writeFile($relativePath, '<?xml version="1.0" encoding="UTF-8"?> <view><vars module="Namespace_Module"><var name="customVar">custom value</var></vars></view>'); $config = $this->_viewConfig->getViewConfig(); $this->assertInstanceOf('Magento\Config\View', $config); $this->assertEquals(array('customVar' => 'custom value'), $config->getVars('Namespace_Module')); } catch (\Exception $e) { - $filesystem->delete($customConfigFile); + $directory->delete($relativePath); throw $e; } - $filesystem->delete($customConfigFile); + $directory->delete($relativePath); } /** @@ -350,8 +338,8 @@ class DesignTest extends \PHPUnit_Framework_TestCase public function testGetPublicFileUrl() { - $pubLibFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::PUB_LIB) . '/jquery/jquery.js'; + $pubLibFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem') + ->getPath(\Magento\Filesystem::PUB_LIB) . '/jquery/jquery.js'; $actualResult = $this->_viewUrl->getPublicFileUrl($pubLibFile); $this->assertStringEndsWith('/jquery/jquery.js', $actualResult); } @@ -361,8 +349,8 @@ class DesignTest extends \PHPUnit_Framework_TestCase */ public function testGetPublicFileUrlSigned() { - $pubLibFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::PUB_LIB) . '/jquery/jquery.js'; + $pubLibFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem') + ->getPath(\Magento\Filesystem::PUB_LIB) . '/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 513f228949e..06461899901 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 @@ -29,6 +29,11 @@ \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, \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\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( 'preferences' => array( 'Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data' @@ -38,6 +43,5 @@ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Registration'); $registration->register( - __DIR__, - implode(DIRECTORY_SEPARATOR, array('*', '*', 'theme.xml')) + implode('/', array('*', '*', 'theme.xml')) ); diff --git a/dev/tests/unit/testsuite/Magento/Backup/_files/code/.gitignore b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/var/log/exception.log similarity index 100% rename from dev/tests/unit/testsuite/Magento/Backup/_files/code/.gitignore rename to dev/tests/integration/testsuite/Magento/Core/Model/_files/design/var/log/exception.log diff --git a/dev/tests/unit/testsuite/Magento/Backup/_files/media/.gitignore b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/var/log/system.log similarity index 100% rename from dev/tests/unit/testsuite/Magento/Backup/_files/media/.gitignore rename to dev/tests/integration/testsuite/Magento/Core/Model/_files/design/var/log/system.log diff --git a/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php b/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php index 893f083e33c..5b56707ba2c 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php +++ b/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php @@ -98,7 +98,6 @@ class Layout 'themeFactory' => $objectManager->get('Magento\Core\Model\Resource\Theme\CollectionFactory'), 'logger' => $objectManager->get('Magento\Logger'), 'eventManager' => $objectManager->get('Magento\Event\ManagerInterface'), - 'factoryHelper' => $objectManager->get('Magento\App\Helper\HelperFactory'), 'coreData' => $objectManager->get('Magento\Core\Helper\Data'), 'design' => $objectManager->get('Magento\View\DesignInterface'), 'blockFactory' => $objectManager->create('Magento\View\Element\BlockFactory', array()), @@ -108,6 +107,7 @@ class Layout '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'), 'objectManager' => $objectManager ); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Utility/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Core/Utility/LayoutTest.php index dd3a7f1a6cf..5375fa287a4 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Utility/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Utility/LayoutTest.php @@ -33,6 +33,11 @@ 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'), + ) + )); $this->_utility = new \Magento\Core\Utility\Layout($this); } diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change.php b/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change.php index b405537b41f..a56e4255352 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change.php +++ b/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change.php @@ -30,17 +30,17 @@ \Magento\Core\Model\App\Area::PART_CONFIG ); $designDir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir() . '/media_for_change'; -$themeDir = $designDir . DIRECTORY_SEPARATOR . 'frontend/test_default'; +$themeDir = $designDir . '/frontend/test_default'; $sourcePath = dirname(__DIR__) . '/Model/_files/design/frontend/test_publication/'; -mkdir($themeDir . '/images', 0777, true); +@mkdir($themeDir . '/images', 0777, true); // Copy all files to fixture location $mTime = time() - 10; // To ensure that all files, changed later in test, will be recognized for publication $files = array('theme.xml', 'style.css', 'sub.css', 'images/square.gif', 'images/rectangle.gif'); foreach ($files as $file) { - copy($sourcePath . $file, $themeDir . DIRECTORY_SEPARATOR . $file); - touch($themeDir . DIRECTORY_SEPARATOR . $file, $mTime); + copy($sourcePath . $file, $themeDir . '/' . $file); + touch($themeDir . '/' . $file, $mTime); } /** @var $registration \Magento\Core\Model\Theme\Registration */ @@ -48,5 +48,5 @@ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Registration'); $registration->register( $designDir, - implode(DIRECTORY_SEPARATOR, array('*', '*', 'theme.xml')) + '*/*/theme.xml' ); 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 6c1ea1aae2c..4fe7cd8624c 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 @@ -25,5 +25,16 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -$designDir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir() . '/media_for_change'; -\Magento\Io\File::rmdirRecursive($designDir); + +$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), + ), +)); +/** @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->delete(); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php index 87e1edfcbe2..a481e882ec8 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php @@ -67,9 +67,8 @@ class GroupTest extends \Magento\Backend\Utility\Controller * Check that success message is set */ $this->assertSessionMessages( - $this->equalTo(array('The customer group has been deleted.')), - \Magento\Message\Factory::SUCCESS, - 'Magento\Core\Model\Session\AbstractSession' + $this->equalTo(array('The customer group has been deleted.')), + \Magento\Message\MessageInterface::TYPE_SUCCESS ); } @@ -82,7 +81,7 @@ class GroupTest extends \Magento\Backend\Utility\Controller * Check that error message is set */ $this->assertSessionMessages( - $this->equalTo(array('The customer group no longer exists.')), \Magento\Message\Factory::ERROR + $this->equalTo(array('The customer group no longer exists.')), \Magento\Message\MessageInterface::TYPE_ERROR ); } } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index 4f8cfb4707f..369d5b286a0 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -81,7 +81,10 @@ class IndexTest extends \Magento\Backend\Utility\Controller /** * Check that errors was generated and set to session */ - $this->assertSessionMessages($this->logicalNot($this->isEmpty()), \Magento\Message\Factory::ERROR); + $this->assertSessionMessages( + $this->logicalNot($this->isEmpty()), + \Magento\Message\MessageInterface::TYPE_ERROR + ); /** * Check that customer data were set to session */ @@ -111,7 +114,10 @@ class IndexTest extends \Magento\Backend\Utility\Controller /** * Check that errors was generated and set to session */ - $this->assertSessionMessages($this->logicalNot($this->isEmpty()), \Magento\Message\Factory::ERROR); + $this->assertSessionMessages( + $this->logicalNot($this->isEmpty()), + \Magento\Message\MessageInterface::TYPE_ERROR + ); /** * Check that customer data were set to session */ @@ -157,7 +163,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller /** * Check that errors was generated and set to session */ - $this->assertSessionMessages($this->isEmpty(), \Magento\Message\Factory::ERROR); + $this->assertSessionMessages($this->isEmpty(), \Magento\Message\MessageInterface::TYPE_ERROR); /** * Check that customer data were set to session */ @@ -166,7 +172,10 @@ class IndexTest extends \Magento\Backend\Utility\Controller /** * Check that success message is set */ - $this->assertSessionMessages($this->logicalNot($this->isEmpty()), \Magento\Message\Factory::SUCCESS); + $this->assertSessionMessages( + $this->logicalNot($this->isEmpty()), + \Magento\Message\MessageInterface::TYPE_SUCCESS + ); /** * Check that customer id set and addresses saved @@ -238,7 +247,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller * Check that success message is set */ $this->assertSessionMessages( - $this->equalTo(array('You saved the customer.')), \Magento\Message\Factory::SUCCESS + $this->equalTo(array('You saved the customer.')), \Magento\Message\MessageInterface::TYPE_SUCCESS ); /** @var $objectManager \Magento\TestFramework\ObjectManager */ @@ -295,7 +304,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller */ $this->assertSessionMessages( $this->equalTo(array('Customer with the same email already exists.')), - \Magento\Message\Factory::ERROR + \Magento\Message\MessageInterface::TYPE_ERROR ); $this->assertEquals($post, \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Backend\Model\Session')->getCustomerData()); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/SessionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/SessionTest.php new file mode 100644 index 00000000000..88084f2720d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/SessionTest.php @@ -0,0 +1,65 @@ +<?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_Customer + * @subpackage integration_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Customer\Model; + +/** + * @magentoDataFixture Magento/Customer/_files/customer.php + */ +class SessionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Customer\Model\Session + */ + protected $_customerSession; + + protected function setUp() + { + $this->_customerSession = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Customer\Model\Session'); + } + + public function testLogin() + { + $this->markTestSkipped('MAGETWO-18328'); + $oldSessionId = $this->_customerSession->getSessionId(); + $this->assertTrue($this->_customerSession->login('customer@example.com', 'password')); // fixture + $this->assertTrue($this->_customerSession->isLoggedIn()); + $newSessionId = $this->_customerSession->getSessionId(); + $this->assertNotEquals($oldSessionId, $newSessionId); + } + + public function testLoginById() + { + $this->markTestSkipped('MAGETWO-18328'); + $oldSessionId = $this->_customerSession->getSessionId(); + $this->assertTrue($this->_customerSession->loginById(1)); // fixture + $this->assertTrue($this->_customerSession->isLoggedIn()); + $newSessionId = $this->_customerSession->getSessionId(); + $this->assertNotEquals($oldSessionId, $newSessionId); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/session.php b/dev/tests/integration/testsuite/Magento/Customer/_files/session.php new file mode 100644 index 00000000000..1ce6d40321c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/session.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. + * + * @category Magento + * @package Magento_Customer + * @subpackage integration_tests + * @copyright Copyright (c) 2013 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\Session; + +/** + * Mock headers_sent function to prevent check whether headers have been already sent + * + * @see \Magento\Core\Model\Session\AbstractSession + */ +function headers_sent() +{ + return false; +} + +/** + * Mock session_regenerate_id function to prevent check whether headers have been already sent + * + * @see \Magento\Core\Model\Session\AbstractSession + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ +function session_regenerate_id($delete_old_session = false) +{ + $sessionId = hexdec(session_id()); + $sessionId++; //Change Session Id value + session_id(dechex($sessionId)); + return true; +} + + +/** + * Mock session_start function to prevent check whether headers have been already sent + * + * @see \Magento\Core\Model\Session\AbstractSession + */ +function session_start() +{ + return true; +} diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/Controller/Adminhtml/System/Design/EditorTest.php b/dev/tests/integration/testsuite/Magento/DesignEditor/Controller/Adminhtml/System/Design/EditorTest.php index 298f51476b1..52b67fddb40 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Controller/Adminhtml/System/Design/EditorTest.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Controller/Adminhtml/System/Design/EditorTest.php @@ -59,7 +59,7 @@ class EditorTest extends \Magento\Backend\Utility\Controller $this->dispatch('backend/admin/system_design_editor/launch'); $this->assertSessionMessages($this->equalTo( array('We can\'t find theme "' . $wrongThemeId . '".')), - \Magento\Message\Factory::ERROR + \Magento\Message\MessageInterface::TYPE_ERROR ); $expected = 'http://localhost/index.php/backend/admin/system_design_editor/index/'; $this->assertRedirect($this->stringStartsWith($expected)); 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 c573659d85e..b3110c08348 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Config/QuickStylesTest.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Config/QuickStylesTest.php @@ -50,6 +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'); + $path = str_replace($directoryList->getRoot(), '', str_replace('\\', '/', __DIR__) . '/../_files/design'); + $directoryList->addDirectory(\Magento\Filesystem::THEMES, 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'); @@ -58,7 +62,7 @@ class QuickStylesTest extends \PHPUnit_Framework_TestCase $this->assertFileExists($quickStylesPath); $this->_model = $objectManager->create( 'Magento\DesignEditor\Model\Config\Control\QuickStyles', - array('configFiles' => array($quickStylesPath)) + array('configFiles' => array(file_get_contents($quickStylesPath))) ); } 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 33addaaf0b0..ab1e17e44d8 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 @@ -44,13 +44,13 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') - ->setAreaCode(\Magento\View\DesignInterface::DEFAULT_AREA); - $this->_design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get('Magento\App\State')->setAreaCode(\Magento\View\DesignInterface::DEFAULT_AREA); + $this->_design = $objectManager->get( 'Magento\View\DesignInterface' ); $this->_design->setDesignTheme('vendor_test_child'); - $this->_configFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + $this->_configFactory = $objectManager->create( 'Magento\DesignEditor\Model\Editor\Tools\Controls\Factory' ); } @@ -64,6 +64,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) + ->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)); $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 5f3bdbf315d..d6a01900bf8 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\App\Dir::PARAM_APP_DIRS => array( - \Magento\App\Dir::THEMES => dirname(__DIR__) . '/design' + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/design') ) )); @@ -37,8 +37,5 @@ /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Registration'); -$registration->register( - __DIR__, - implode(DIRECTORY_SEPARATOR, array('*', '*', 'theme.xml')) -); +$registration->register('*/*/theme.xml'); 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 e67c73e210e..a32ce934873 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\App\Dir::PARAM_APP_DIRS => array( - \Magento\App\Dir::THEMES => dirname(__DIR__) . '/_files/design' + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::THEMES => 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 b9c55716bb5..b592b4bb64d 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php @@ -48,7 +48,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $this->_model = $this->getMockBuilder('Magento\Email\Model\Template') ->setMethods(array('_getMail')) ->setConstructorArgs(array( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Context'), + $objectManager->get('Magento\Core\Model\Context'), $objectManager->get('Magento\View\DesignInterface'), $objectManager->get('Magento\Core\Model\Registry'), $objectManager->get('Magento\Core\Model\App\Emulation'), @@ -59,11 +59,10 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $objectManager->create('Magento\Core\Model\Store\Config'), $objectManager->create('Magento\Core\Model\Config'), $objectManager->get('Magento\Email\Model\Template\FilterFactory'), - $objectManager->get('Magento\App\Dir'), $objectManager->get('Magento\Email\Model\Template\Config'), )) ->getMock(); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); + $objectManager->get('Magento\App\State')->setAreaCode('frontend'); $this->_model->expects($this->any())->method('_getMail')->will($this->returnCallback(array($this, 'getMail'))); $this->_model->setSenderName('sender')->setSenderEmail('sender@example.com')->setTemplateSubject('Subject'); } 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 2d64c840203..df70c22e2b6 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/themes.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/themes.php @@ -21,20 +21,24 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') +\Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/_files/design') + ) +)); +$objectManger = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$objectManger->get('Magento\Core\Model\App') ->loadAreaPart( \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, \Magento\Core\Model\App\Area::PART_CONFIG ); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( +$objectManger->configure(array( 'preferences' => array( 'Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data' ) )); /** @var $registration \Magento\Core\Model\Theme\Registration */ -$registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Theme\Registration'); +$registration = $objectManger->create('Magento\Core\Model\Theme\Registration'); $registration->register( - __DIR__ . DIRECTORY_SEPARATOR . 'design', - implode(DIRECTORY_SEPARATOR, array('*', '*', 'theme.xml')) + implode('/', array('*', '*', 'theme.xml')) ); diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/Adapter/LocalTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/Adapter/LocalTest.php deleted file mode 100644 index a7324cddcdb..00000000000 --- a/dev/tests/integration/testsuite/Magento/Filesystem/Adapter/LocalTest.php +++ /dev/null @@ -1,486 +0,0 @@ -<?php -/** - * Test for \Magento\Filesystem\Adapter\Local - * - * 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) 2013 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\Adapter; - -class LocalTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Filesystem\Adapter\Local - */ - protected $_adapter; - - protected function setUp() - { - $this->_adapter = new \Magento\Filesystem\Adapter\Local(); - - \Magento\Io\File::rmdirRecursive(self::_getTmpDir()); - mkdir(self::_getTmpDir(), 0777, true); - } - - protected function tearDown() - { - \Magento\Io\File::rmdirRecursive(self::_getTmpDir()); - } - - protected static function _getTmpDir() - { - return \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::VAR_DIR) . DIRECTORY_SEPARATOR . 'Magento\Filesystem\Adapter\LocalTest'; - } - - /** - * @return string - */ - protected static function _getFixturesPath() - { - return __DIR__ . '/../_files/'; - } - - /** - * @param string $key - * @param bool $expected - * @dataProvider existsDataProvider - */ - public function testExists($key, $expected) - { - $this->assertEquals($expected, $this->_adapter->exists($key)); - } - - /** - * @return array - */ - public static function existsDataProvider() - { - return array( - 'existed file' => array(self::_getFixturesPath() . 'popup.csv', true), - 'not existed file' => array(self::_getFixturesPath() . 'popup2.css', false), - ); - } - - /** - * @param string $fileName - * @param string $expectedContent - * @dataProvider readDataProvider - */ - public function testRead($fileName, $expectedContent) - { - $this->assertEquals($expectedContent, $this->_adapter->read($fileName)); - } - - /** - * @return array - */ - public static function readDataProvider() - { - return array( - 'read' => array(self::_getFixturesPath() . 'popup.csv', 'var myData = 5;'), - ); - } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage Failed to read contents of 'non-existing-file.txt' - */ - public function testReadException() - { - $this->_adapter->read('non-existing-file.txt'); - } - - /** - * @param string $fileName - * @param string $fileData - * @dataProvider writeDataProvider - */ - public function testWrite($fileName, $fileData) - { - $this->_adapter->write($fileName, $fileData); - $this->assertFileExists($fileName); - $this->assertEquals(file_get_contents($fileName), $fileData); - } - - /** - * @return array - */ - public static function writeDataProvider() - { - return array( - 'correct file' => array(self::_getTmpDir() . '/tempFile.css', 'temporary data'), - 'empty file' => array(self::_getTmpDir() . '/tempFile2.css', '') - ); - } - - public function testWriteException() - { - $filename = __DIR__; - $this->setExpectedException('Magento\Filesystem\FilesystemException', - "Failed to write contents to '{$filename}'"); - $this->_adapter->write($filename, 'any contents'); - } - - /** - * Test, that deleting non-existing file doesn't produce exceptions - */ - public function testDeleteNotExists() - { - $fileName = self::_getTmpDir() . '/tempFile3.css'; - $this->_adapter->delete($fileName); - } - - public function testDeleteDir() - { - $dirName = self::_getTmpDir() . '/new_directory'; - $fileName = $dirName . '/tempFile3.css'; - mkdir($dirName, 0755); - file_put_contents($fileName, 'test data'); - $this->_adapter->delete($dirName); - $this->assertFileNotExists($dirName); - $this->assertFileNotExists($fileName); - } - - public function testDelete() - { - $fileName = self::_getTmpDir() . '/tempFile3.css'; - file_put_contents($fileName, 'test data'); - $this->_adapter->delete($fileName); - $this->assertFileNotExists($fileName); - } - - public function testChangePermissionsFile() - { - $fileName = self::_getTmpDir() . '/tempFile3.css'; - file_put_contents($fileName, 'test data'); - $this->_adapter->changePermissions($fileName, 0666, false); - $this->assertEquals(0666, fileperms($fileName) & 0777); - } - - public function testChangePermissionsDir() - { - if (substr(PHP_OS, 0, 3) == 'WIN') { - $this->markTestSkipped("chmod may not work for Windows"); - } - $dirName = self::_getTmpDir() . '/new_directory2'; - $fileName = $dirName . '/tempFile3.css'; - mkdir($dirName, 0777); - file_put_contents($fileName, 'test data'); - $this->_adapter->changePermissions($dirName, 0755, true); - $this->assertEquals(0755, fileperms($dirName) & 0777); - $this->assertEquals(0755, fileperms($fileName) & 0777); - } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage Failed to change mode of 'non-existing-file.txt' - */ - public function testChangePermissionsException() - { - $this->_adapter->changePermissions('non-existing-file.txt', 0666, false); - } - - public function testGetFileMd5() - { - $this->assertEquals('e5f30e10b8965645d5f8ed5999d88600', - $this->_adapter->getFileMd5(self::_getFixturesPath() . 'popup.csv')); - } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage Failed to get hash of 'non-existing-file.txt' - */ - public function testGetFileMd5Exception() - { - $this->_adapter->getFileMd5('non-existing-file.txt'); - } - - public function testIsFile() - { - $this->assertTrue($this->_adapter->isFile(self::_getFixturesPath() . 'popup.csv')); - } - - public function testIsWritable() - { - $this->assertTrue($this->_adapter->isWritable(self::_getFixturesPath() . 'popup.csv')); - } - - public function testIsReadable() - { - $this->assertTrue($this->_adapter->isReadable(self::_getFixturesPath() . 'popup.csv')); - } - - public function testCreateStream() - { - $stream = $this->_adapter->createStream(self::_getFixturesPath() . 'popup.csv'); - $this->assertInstanceOf('Magento\Filesystem\Stream\Local', $stream); - } - - /** - * @param string $sourceName - * @param string $targetName - * @throws \Exception - * @dataProvider renameDataProvider - */ - public function testRename($sourceName, $targetName) - { - file_put_contents($sourceName, 'test data'); - $this->_adapter->rename($sourceName, $targetName); - $this->assertFileExists($targetName); - $this->assertFileNotExists($sourceName); - $this->assertEquals(file_get_contents($targetName), 'test data'); - } - - /** - * @return array - */ - public static function renameDataProvider() - { - return array( - 'test 1' => array(self::_getTmpDir() . '/file1.js', self::_getTmpDir() . '/file2.js'), - ); - } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage Failed to rename 'non-existing-file.txt' to 'any-new-file.txt' - */ - public function testRenameException() - { - $this->_adapter->rename('non-existing-file.txt', 'any-new-file.txt'); - } - - - public function testIsDirectory() - { - $this->assertTrue($this->_adapter->isDirectory(self::_getFixturesPath())); - $this->assertFalse($this->_adapter->isDirectory(self::_getFixturesPath() . 'popup.csv')); - } - - public function testCreateDirectory() - { - $directoryName = self::_getTmpDir() . '/new_directory'; - $this->_adapter->createDirectory($directoryName, 0755); - $this->assertFileExists($directoryName); - $this->assertTrue(is_dir($directoryName)); - } - - public function testCreateDirectoryException() - { - $filename = __FILE__; - $this->setExpectedException('Magento\Filesystem\FilesystemException', "Failed to create '{$filename}'"); - $this->_adapter->createDirectory($filename, 0755); - } - - /** - * @dataProvider touchDataProvider - * @param string $fileName - * @param bool $newFile - */ - public function testTouch($fileName, $newFile = false) - { - if ($newFile) { - $this->assertFileNotExists($fileName); - } else { - $this->assertFileExists($fileName); - } - $this->_adapter->touch($fileName); - $this->assertFileExists($fileName); - } - - /** - * @return array - */ - public static function touchDataProvider() - { - return array( - 'update file' => array(self::_getFixturesPath() . 'popup.csv', false), - 'create file' => array(self::_getTmpDir() . '/popup.css', true) - ); - } - - public function testTouchException() - { - $filename = __FILE__ . '/invalid'; - $this->setExpectedException('Magento\Filesystem\FilesystemException', "Failed to touch '{$filename}'"); - $this->_adapter->touch($filename); - } - - /** - * @param string $sourceName - * @param string $targetName - * @dataProvider renameDataProvider - */ - public function testCopy($sourceName, $targetName) - { - $testData = 'test data'; - file_put_contents($sourceName, $testData); - $this->_adapter->copy($sourceName, $targetName); - $this->assertFileExists($targetName); - $this->assertFileExists($sourceName); - $this->assertEquals($testData, file_get_contents($targetName)); - $this->assertEquals($testData, file_get_contents($targetName)); - } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage Failed to copy 'non-existing-file.txt' to 'any-new-file.txt' - */ - public function testCopyException() - { - $this->_adapter->copy('non-existing-file.txt', 'any-new-file.txt'); - } - - public function testGetMTime() - { - $filePath = self::_getTmpDir() . '/mtime.txt'; - $this->_adapter->write($filePath, 'Test'); - $this->assertFileExists($filePath); - $this->assertGreaterThan(0, $this->_adapter->getMTime($filePath)); - } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage Failed to get modification time of 'non-existing-file.txt' - */ - public function testGetMTimeException() - { - $this->_adapter->getMTime('non-existing-file.txt'); - } - - /** - * @param string $content - * @param int $expectedSize - * @dataProvider getFileSizeDataProvider - */ - public function testGetFileSize($content, $expectedSize) - { - $filePath = self::_getTmpDir() . '/filesize.txt'; - $this->_adapter->write($filePath, $content); - $this->assertFileExists($filePath); - $this->assertEquals($expectedSize, $this->_adapter->getFileSize($filePath)); - } - - /** - * @return array - */ - public static function getFileSizeDataProvider() - { - return array( - 'usual file' => array('1234', 4), - 'empty file' => array('', 0), - ); - } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage Failed to get file size of 'non-existing-file.txt' - */ - public function testGetFileSizeException() - { - $this->_adapter->getFileSize('non-existing-file.txt'); - } - - /** - * @dataProvider getNestedKeysDataProvider - * @param string $path - * @param array $expectedKeys - */ - public function testGetNestedKeys($path, $expectedKeys) - { - $actualKeys = $this->_adapter->getNestedKeys($path); - sort($actualKeys); - $this->assertEquals($expectedKeys, $actualKeys); - } - - /** - * @return array - */ - public static function getNestedKeysDataProvider() - { - return array( - array( - self::_getFixturesPath() . 'foo', - array( - self::_getFixturesPath() . 'foo/bar', - self::_getFixturesPath() . 'foo/bar/baz', - self::_getFixturesPath() . 'foo/bar/baz/file_one.txt', - self::_getFixturesPath() . 'foo/bar/file_two.txt', - self::_getFixturesPath() . 'foo/file_three.txt', - ) - ), - array( - self::_getFixturesPath() . 'foo/bar/baz', - array(self::_getFixturesPath() . 'foo/bar/baz/file_one.txt') - ) - ); - } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage The directory '/unknown_directory' does not exist. - */ - public function testGetNestedKeysInUnknownDirectory() - { - $this->_adapter->getNestedKeys('/unknown_directory'); - } - - /** - * @dataProvider getNestedFilesDataProvider - * @param string $pattern - * @param array $expectedKeys - */ - public function testSearchKeys($pattern, $expectedKeys) - { - $this->assertEquals($expectedKeys, $this->_adapter->searchKeys($pattern)); - } - - /** - * @return array - */ - public static function getNestedFilesDataProvider() - { - return array( - array( - self::_getFixturesPath() . 'foo/*', - array( - self::_getFixturesPath() . 'foo/bar', - self::_getFixturesPath() . 'foo/file_three.txt', - ) - ), - array( - self::_getFixturesPath() . 'foo/*/file_*', - array( - self::_getFixturesPath() . 'foo/bar/file_two.txt', - ) - ) - ); - } - - public function testSearchKeysException() - { - $pattern = str_repeat('1', 20000); // Overflow the glob() length limit (Win - 260b, Linux - 1k-8k) - $this->setExpectedException('Magento\Filesystem\FilesystemException', - "Failed to resolve the file pattern '{$pattern}'"); - $this->_adapter->searchKeys($pattern); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/Adapter/ZlibTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/Adapter/ZlibTest.php deleted file mode 100644 index d5ad45ed9f8..00000000000 --- a/dev/tests/integration/testsuite/Magento/Filesystem/Adapter/ZlibTest.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php -/** - * Test for \Magento\Filesystem\Adapter\Zlib - * - * 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) 2013 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\Adapter; - -class ZlibTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Filesystem\Adapter\Zlib - */ - protected $_adapter; - - /** - * @var array - */ - protected $_deleteFiles = array(); - - protected function setUp() - { - $this->_adapter = new \Magento\Filesystem\Adapter\Zlib(); - } - - protected function tearDown() - { - foreach ($this->_deleteFiles as $fileName) { - if (is_dir($fileName)) { - rmdir($fileName); - } elseif (is_file($fileName)) { - unlink($fileName); - } - } - } - - public function testCreateStream() - { - $file = $this->_getFixturesPath() . 'data.csv'; - $this->assertInstanceOf('Magento\Filesystem\Stream\Zlib', $this->_adapter->createStream($file)); - } - - public function testRW() - { - $file = $this->_getFixturesPath() . 'compressed.tgz'; - $this->_adapter->write($file, 'Test string'); - $this->assertFileExists($file); - $this->_deleteFiles[] = $file; - $this->assertEquals('Test string', $this->_adapter->read($file)); - } - - /** - * @return string - */ - protected function _getFixturesPath() - { - return __DIR__ . DS . '..' . DS . '_files' . DS; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/Directory/ReadTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/Directory/ReadTest.php index 896c03040d5..841c9c2d62e 100644 --- a/dev/tests/integration/testsuite/Magento/Filesystem/Directory/ReadTest.php +++ b/dev/tests/integration/testsuite/Magento/Filesystem/Directory/ReadTest.php @@ -1,6 +1,6 @@ <?php /** - * Test for \Magento\Filesystem\Stream\Local + * Test for \Magento\Filesystem\Directory\Read * * Magento * @@ -50,7 +50,11 @@ class ReadTest extends \PHPUnit_Framework_TestCase { $dir = $this->getDirectoryInstance('foo'); $this->assertContains( - '../_files/foo/bar', + '_files/foo', + $dir->getAbsolutePath() + ); + $this->assertContains( + '_files/foo/bar', $dir->getAbsolutePath('bar') ); } @@ -182,7 +186,7 @@ class ReadTest extends \PHPUnit_Framework_TestCase /** * Test for isReadable method * - * @dataProvider isReadbaleProvider + * @dataProvider isReadableProvider * @param string $dirPath * @param string $path * @param bool $readable @@ -193,12 +197,36 @@ class ReadTest extends \PHPUnit_Framework_TestCase $this->assertEquals($readable, $dir->isReadable($path)); } + /** + * Test for isFile method + * + * @dataProvider isFileProvider + * @param string $path + * @param bool $isFile + */ + public function testIsFile($path, $isFile) + { + $this->assertEquals($isFile, $this->getDirectoryInstance('foo')->isFile($path)); + } + + /** + * Test for isDirectory method + * + * @dataProvider isDirectoryProvider + * @param string $path + * @param bool $isDirectory + */ + public function testIsDirectory($path, $isDirectory) + { + $this->assertEquals($isDirectory, $this->getDirectoryInstance('foo')->isDirectory($path)); + } + /** * Data provider for testIsReadable * * @return array */ - public function isReadbaleProvider() + public function isReadableProvider() { return array( array('foo', 'bar', true), @@ -206,6 +234,32 @@ class ReadTest extends \PHPUnit_Framework_TestCase ); } + /** + * Data provider for testIsFile + * + * @return array + */ + public function isFileProvider() + { + return array( + array('bar', false), + array('file_three.txt', true) + ); + } + + /** + * Data provider for testIsDirectory + * + * @return array + */ + public function isDirectoryProvider() + { + return array( + array('bar', true), + array('file_three.txt', false) + ); + } + /** * Test for openFile method */ @@ -226,9 +280,12 @@ class ReadTest extends \PHPUnit_Framework_TestCase private function getDirectoryInstance($path) { $fullPath = __DIR__ . '/../_files/' . $path; - $readFactory = Bootstrap::getObjectManager()->create( - 'Magento\Filesystem\File\ReadFactory', array('path' => $fullPath) + $config = array( + 'path' => $fullPath ); - return new Read($fullPath, $readFactory); + $objectManager = Bootstrap::getObjectManager(); + $directoryFactory = $objectManager->create('Magento\Filesystem\Directory\ReadFactory'); + return $directoryFactory->create($config, + new \Magento\Filesystem\DriverFactory($objectManager->get('Magento\Filesystem\DirectoryList'))); } } diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/Directory/WriteTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/Directory/WriteTest.php index 526a9dd3fa9..66c2532347d 100644 --- a/dev/tests/integration/testsuite/Magento/Filesystem/Directory/WriteTest.php +++ b/dev/tests/integration/testsuite/Magento/Filesystem/Directory/WriteTest.php @@ -1,6 +1,6 @@ <?php /** - * Test for \Magento\Filesystem\Stream\Local + * Test for \Magento\Filesystem\Directory\Write * * Magento * @@ -76,7 +76,8 @@ class WriteTest extends \PHPUnit_Framework_TestCase return array( array('newDir1', 0777, "newDir1"), array('newDir1', 0777, "root_dir1/subdir1/subdir2"), - array('newDir2', 0777, "root_dir2/subdir") + array('newDir2', 0755, "root_dir2/subdir"), + array('newDir1', 0777, ".") ); } @@ -120,16 +121,15 @@ class WriteTest extends \PHPUnit_Framework_TestCase public function testRename($basePath, $permissions, $name, $newName) { $directory = $this->getDirectoryInstance($basePath, $permissions); - $directory->create($name); + $directory->touch($name); $created = $directory->read(); - $directory->rename($name, $newName); + $directory->renameFile($name, $newName); $renamed = $directory->read(); $this->assertTrue(in_array($name, $created)); $this->assertTrue(in_array($newName, $renamed)); $this->assertFalse(in_array($name, $renamed)); } - /** * Data provider for testRename * @@ -138,7 +138,7 @@ class WriteTest extends \PHPUnit_Framework_TestCase public function renameProvider() { return array( - array('newDir1', 0777, 'first_name', 'second_name') + array('newDir1', 0777, 'first_name.txt', 'second_name.txt') ); } @@ -157,14 +157,12 @@ class WriteTest extends \PHPUnit_Framework_TestCase $dir1 = $this->getDirectoryInstance($firstDir, $permission); $dir2 = $this->getDirectoryInstance($secondDir, $permission); - $dir1->create($name); + $dir1->touch($name); $created = $dir1->read(); - $dir1->rename($name, $newName, $dir2); + $dir1->renameFile($name, $newName, $dir2); $oldPlace = $dir1->read(); - $newPlace = $dir2->read(); $this->assertTrue(in_array($name, $created)); - $this->assertTrue(in_array($newName, $newPlace)); $this->assertFalse(in_array($name, $oldPlace)); } @@ -176,7 +174,7 @@ class WriteTest extends \PHPUnit_Framework_TestCase public function renameTargetDirProvider() { return array( - array('dir1', 'dir2', 0777, 'first_name', 'second_name') + array('dir1', 'dir2', 0777, 'first_name.txt', 'second_name.txt') ); } @@ -194,7 +192,7 @@ class WriteTest extends \PHPUnit_Framework_TestCase $directory = $this->getDirectoryInstance($basePath, $permissions); $file = $directory->openFile($name, 'w+'); $file->close(); - $directory->copy($name, $newName); + $directory->copyFile($name, $newName); $this->assertTrue($directory->isExist($name)); $this->assertTrue($directory->isExist($newName)); } @@ -229,7 +227,7 @@ class WriteTest extends \PHPUnit_Framework_TestCase $file = $dir1->openFile($name, 'w+'); $file->close(); - $dir1->copy($name, $newName, $dir2); + $dir1->copyFile($name, $newName, $dir2); $this->assertTrue($dir1->isExist($name)); $this->assertTrue($dir2->isExist($newName)); @@ -329,41 +327,12 @@ class WriteTest extends \PHPUnit_Framework_TestCase ); } - /** - * Test for writeFile method - * - * @dataProvider writeFileProvider - * @param string $basePath - * @param int $permissions - * @param string $path - * @param string $content - * @param int $mode - * @param int $bytes - */ - public function testWriteFile($basePath, $permissions, $path, $content, $mode, $bytes) - { - $directory = $this->getDirectoryInstance($basePath, $permissions); - $this->assertEquals($bytes, $directory->writeFile($path, $content, $mode)); - } - - /** - * Data provider for testWriteFile - * - * @return array - */ - public function writeFileProvider() - { - return array( - array('newDir1', 0777, 'newFile.txt', 'content', 0777, 7), - array('newDir1', 0777, 'subdirectory/newFile.txt', 'content', 0777, 7) - ); - } - /** * Tear down */ public function tearDown() { + /** @var Write $directory */ foreach ($this->testDirectories as $directory) { if ($directory->isExist()) { $directory->delete(); @@ -382,11 +351,16 @@ class WriteTest extends \PHPUnit_Framework_TestCase private function getDirectoryInstance($path, $permissions) { $fullPath = __DIR__ . '/../_files/' . $path; - $writeFactory = Bootstrap::getObjectManager()->create( - 'Magento\Filesystem\File\WriteFactory', array('path' => $fullPath) + $config = array( + 'path' => $fullPath, + 'permissions' => $permissions, + 'allow_create_dirs' => true ); - $write = new Write($fullPath, $writeFactory, $permissions); - $this->testDirectories[] = $write; - return $write; + $objectManager = Bootstrap::getObjectManager(); + $directoryFactory = $objectManager->create('Magento\Filesystem\Directory\WriteFactory'); + $directory = $directoryFactory->create($config, + new \Magento\Filesystem\DriverFactory($objectManager->get('Magento\Filesystem\DirectoryList'))); + $this->testDirectories[] = $directory; + return $directory; } } diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/File/ReadTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/File/ReadTest.php index 5417e3a4d4d..c82b1abfe34 100644 --- a/dev/tests/integration/testsuite/Magento/Filesystem/File/ReadTest.php +++ b/dev/tests/integration/testsuite/Magento/Filesystem/File/ReadTest.php @@ -1,6 +1,6 @@ <?php /** - * Test for \Magento\Filesystem\Stream\Local + * Test for \Magento\Filesystem\File\Read * * Magento * @@ -237,8 +237,14 @@ class ReadTest extends \PHPUnit_Framework_TestCase */ private function getFileInstance($path) { - $fullPath = __DIR__ . DS . '..' . DS . '_files' . DS . $path; + $fullPath = __DIR__ . '/../_files/' . $path; return Bootstrap::getObjectManager() - ->create('Magento\Filesystem\File\Read', array('path' => $fullPath)); + ->create( + 'Magento\Filesystem\File\Read', + array( + 'path' => $fullPath, + 'driver' => new \Magento\Filesystem\Driver\File() + ) + ); } } diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/File/WriteTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/File/WriteTest.php index 1172d840f5f..f0ad267b25f 100644 --- a/dev/tests/integration/testsuite/Magento/Filesystem/File/WriteTest.php +++ b/dev/tests/integration/testsuite/Magento/Filesystem/File/WriteTest.php @@ -1,6 +1,6 @@ <?php /** - * Test for \Magento\Filesystem\Stream\Local + * Test for \Magento\Filesystem\File\Write * * Magento * @@ -220,8 +220,15 @@ class WriteTest extends \PHPUnit_Framework_TestCase */ private function getFileInstance($path, $mode) { - $this->currentFilePath = __DIR__ . DS . '..' . DS . '_files' . DS . $path; + $this->currentFilePath = __DIR__ . '/../_files/' . $path; return Bootstrap::getObjectManager() - ->create('Magento\Filesystem\File\Write', array('path' => $this->currentFilePath, 'mode' => $mode)); + ->create( + 'Magento\Filesystem\File\Write', + array( + 'path' => $this->currentFilePath, + 'driver' => new \Magento\Filesystem\Driver\File(), + 'mode' => $mode + ) + ); } } diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/FilesystemTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/FilesystemTest.php new file mode 100644 index 00000000000..f0e71592c8e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Filesystem/FilesystemTest.php @@ -0,0 +1,91 @@ +<?php +/** + * Test for \Magento\Filesystem + * + * 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) 2013 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; + +use Magento\TestFramework\Helper\Bootstrap; + +/** + * Class FilesystemTest + * Test for Magento\Filesystem class + * + * @package Magento + */ +class FilesystemTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Filesystem + */ + protected $filesystem; + + protected function setUp() + { + $this->filesystem = Bootstrap::getObjectManager()->create('Magento\Filesystem'); + } + + /** + * Test getDirectoryRead method return valid instance + */ + public function testGetDirectoryReadInstance() + { + $dir = $this->filesystem->getDirectoryRead(\Magento\Filesystem::VAR_DIR); + $this->assertInstanceOf('\Magento\Filesystem\Directory\Read', $dir); + } + + /** + * Test getDirectoryWrite method return valid instance + */ + public function testGetDirectoryWriteInstance() + { + $dir = $this->filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->assertInstanceOf('\Magento\Filesystem\Directory\Write', $dir); + } + + /** + * Test getDirectoryWrite throws exception on trying to get directory with write access + * + * @expectedException \Magento\Filesystem\FilesystemException + */ + public function testGetDirectoryWriteException() + { + $this->filesystem->getDirectoryWrite(\Magento\Filesystem::THEMES); + } + + /** + * Test getPath returns right path + */ + public function testGetPath() + { + $this->assertContains('design', $this->filesystem->getPath(\Magento\Filesystem::THEMES)); + } + + /** + * Test getUri returns right uri + */ + public function testGetUri() + { + $this->assertContains('media', $this->filesystem->getPath(\Magento\Filesystem::MEDIA)); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/Stream/LocalTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/Stream/LocalTest.php deleted file mode 100644 index 2d172c96551..00000000000 --- a/dev/tests/integration/testsuite/Magento/Filesystem/Stream/LocalTest.php +++ /dev/null @@ -1,256 +0,0 @@ -<?php -/** - * Test for \Magento\Filesystem\Stream\Local - * - * 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) 2013 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\Stream; - -class LocalTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Filesystem\Stream\Local - */ - protected $_stream; - - /** - * @var string - */ - protected $_writeFileName; - - /** - * @var string - */ - protected $_openedFile; - - protected function setUp() - { - $this->_openedFile = __DIR__ . DS . '..' . DS . '_files' . DS . 'popup.csv'; - $this->_stream = new \Magento\Filesystem\Stream\Local($this->_openedFile); - $this->_writeFileName = __DIR__ . DS . '..' . DS . '_files' . DS . 'new.css'; - } - - protected function tearDown() - { - if (file_exists($this->_writeFileName)) { - unlink($this->_writeFileName); - } - } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - */ - public function testOpenException() - { - $stream = new \Magento\Filesystem\Stream\Local(__DIR__ . DS . '..' . DS . '_files' . DS . 'invalid.css'); - $stream->open(new \Magento\Filesystem\Stream\Mode('r')); - } - - public function testOpenNewFile() - { - $stream = new \Magento\Filesystem\Stream\Local($this->_writeFileName); - $stream->open(new \Magento\Filesystem\Stream\Mode('w')); - } - - public function testOpenExistingFile() - { - $this->_stream->open(new \Magento\Filesystem\Stream\Mode('r')); - } - - public function testRead() - { - $this->_stream->open(new \Magento\Filesystem\Stream\Mode('r')); - $data = $this->_stream->read(15); - $this->assertEquals('var myData = 5;', $data); - - } - - public function testReadCsv() - { - $stream = new \Magento\Filesystem\Stream\Local(__DIR__ . DS . '..' . DS . '_files' . DS . 'data.csv'); - $stream->open(new \Magento\Filesystem\Stream\Mode('r')); - $data = $stream->readCsv(0); - $this->assertEquals(array('field1', 'field2'), $data); - $data = $stream->readCsv(0); - $this->assertEquals(array('field3', 'field4'), $data); - $data = $stream->readCsv(0); - $this->assertFalse($data); - } - - public function testWrite() - { - $stream = new \Magento\Filesystem\Stream\Local($this->_writeFileName); - $stream->open(new \Magento\Filesystem\Stream\Mode('w')); - $stream->write('test data'); - $this->assertEquals('test data', file_get_contents($this->_writeFileName)); - } - - public function testWriteCsv() - { - $stream = new \Magento\Filesystem\Stream\Local($this->_writeFileName); - $stream->open(new \Magento\Filesystem\Stream\Mode('w')); - $stream->writeCsv(array('data1', 'data2')); - $stream->open(new \Magento\Filesystem\Stream\Mode('r')); - $this->assertEquals(array('data1', 'data2'), $stream->readCsv()); - } - - public function testClose() - { - $this->_stream->open(new \Magento\Filesystem\Stream\Mode('r')); - $this->_stream->lock(); - $this->assertAttributeEquals(true, '_isLocked', $this->_stream); - $this->_stream->close(); - $this->assertAttributeEquals(false, '_isLocked', $this->_stream); - $this->assertAttributeEquals(null, '_mode', $this->_stream); - $this->assertAttributeEquals(null, '_fileHandle', $this->_stream); - } - - public function testLock() - { - $this->_stream->open(new \Magento\Filesystem\Stream\Mode('r')); - $this->_stream->lock(true); - $this->assertAttributeEquals(true, '_isLocked', $this->_stream); - $this->_stream->unlock(); - $this->assertAttributeEquals(false, '_isLocked', $this->_stream); - } - - public function testFlush() - { - $stream = new \Magento\Filesystem\Stream\Local($this->_writeFileName); - $stream->open(new \Magento\Filesystem\Stream\Mode('w')); - $stream->write('test data'); - $stream->flush(); - $this->assertEquals('test data', file_get_contents($this->_writeFileName)); - } - - public function testSeek() - { - $this->_stream->open(new \Magento\Filesystem\Stream\Mode('r')); - $this->_stream->seek(14); - $this->assertEquals(';', $this->_stream->read(1)); - } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage seek operation on the stream caused an error. - */ - public function testSeekError() - { - $this->_stream->open(new \Magento\Filesystem\Stream\Mode('r')); - $this->_stream->seek(-1); - } - - public function testTell() - { - $this->_stream->open(new \Magento\Filesystem\Stream\Mode('r')); - $this->assertEquals(0, $this->_stream->tell()); - $this->_stream->seek(14); - $this->assertEquals(14, $this->_stream->tell()); - } - - public function testEof() - { - $this->_stream->open(new \Magento\Filesystem\Stream\Mode('r')); - $this->assertFalse($this->_stream->eof()); - $this->_stream->read(15); - $this->_stream->read(15); - $this->assertTrue($this->_stream->eof()); - } - - /** - * @param string $method - * @param array $arguments - * @dataProvider streamNotOpenedDataProvider - * @expectedException \Magento\Filesystem\FilesystemException - */ - public function testExceptionStreamNotOpened($method, array $arguments = array(1)) - { - call_user_func(array($this->_stream, $method), $arguments); - } - - /** - * @return array - */ - public function streamNotOpenedDataProvider() - { - return array( - array('read'), - array('readCsv'), - array('write'), - array('writeCsv', array(array(1))), - array('close'), - array('flush'), - array('seek'), - array('tell'), - array('tell'), - array('eof'), - ); - } - - /** - * @param string $method - * @dataProvider forbiddenReadDataProvider - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage The stream does not allow read. - */ - public function testForbiddenRead($method) - { - $stream = new \Magento\Filesystem\Stream\Local($this->_writeFileName); - $stream->open(new \Magento\Filesystem\Stream\Mode('w')); - $stream->$method(1); - } - - /** - * @return array - */ - public function forbiddenReadDataProvider() - { - return array( - array('read'), - array('readCsv'), - ); - } - - /** - * @param string $method - * @param array $arguments - * @dataProvider forbiddenWriteDataProvider - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage The stream does not allow write. - */ - public function testForbiddenWrite($method, array $arguments = array(1)) - { - $this->_stream->open(new \Magento\Filesystem\Stream\Mode('r')); - call_user_func(array($this->_stream, $method), $arguments); - } - - /** - * @return array - */ - public function forbiddenWriteDataProvider() - { - return array( - array('write'), - array('writeCsv', array(array(1))), - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/Stream/ZlibTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/Stream/ZlibTest.php deleted file mode 100644 index 2fc5efe19a0..00000000000 --- a/dev/tests/integration/testsuite/Magento/Filesystem/Stream/ZlibTest.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -/** - * Test for \Magento\Filesystem\Stream\Zlib - * - * 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) 2013 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\Stream; - -class ZlibTest extends \PHPUnit_Framework_TestCase -{ - public function testOpen() - { - $stream = new \Magento\Filesystem\Stream\Zlib(__DIR__ . DS . '..' . DS . '_files' . DS . 'popup.csv'); - $stream->open('rw+9f'); - $this->assertAttributeInstanceOf('Magento\Filesystem\Stream\Mode\Zlib', '_mode', $stream); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Image/Adapter/InterfaceTest.php b/dev/tests/integration/testsuite/Magento/Image/Adapter/InterfaceTest.php index db01dbf4565..feb7c1d3261 100644 --- a/dev/tests/integration/testsuite/Magento/Image/Adapter/InterfaceTest.php +++ b/dev/tests/integration/testsuite/Magento/Image/Adapter/InterfaceTest.php @@ -98,7 +98,7 @@ class InterfaceTest extends \PHPUnit_Framework_TestCase */ protected function _getFixture($pattern) { - $dir = dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; + $dir = dirname(__DIR__) . '/_files/'; $data = glob($dir . $pattern); if (!empty($data)) { @@ -244,7 +244,7 @@ class InterfaceTest extends \PHPUnit_Framework_TestCase public function saveDataProvider() { - $dir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir() . DIRECTORY_SEPARATOR; + $dir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir() . '/'; return $this->_prepareData(array( array( $this->_getFixture('image_adapters_test.png'), @@ -597,7 +597,7 @@ class InterfaceTest extends \PHPUnit_Framework_TestCase $adapter = $this->_getAdapter($adapterType); $adapter->createPngFromString( 'T', - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir() + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem')->getPath() . '/lib/LinLibertineFont/LinLibertine_Re-4.4.1.ttf' ); $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 fef2f0448b9..2aa444a87b8 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,25 +88,32 @@ class ProductTest extends \PHPUnit_Framework_TestCase */ public function testExportStockItemAttributesAreFilled() { - $writerMock = $this->getMockForAbstractClass( - 'Magento\ImportExport\Model\Export\Adapter\AbstractAdapter', - array(), - '', - true, - true, - true, - array('setHeaderCols', 'writeRow') - ); - - $writerMock->expects($this->any()) - ->method('setHeaderCols') - ->will($this->returnCallback(array($this, 'verifyHeaderColumns'))); - - $writerMock->expects($this->any()) - ->method('writeRow') - ->will($this->returnCallback(array($this, 'verifyRow'))); - - $this->_model->setWriter($writerMock) + $filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); + + $filesystemMock->expects($this->once()) + ->method('getDirectoryWrite') + ->will($this->returnValue($directoryMock)); + + $directoryMock->expects($this->any()) + ->method('getParentDirectory') + ->will($this->returnValue('some#path')); + + $directoryMock->expects($this->any()) + ->method('isWritable') + ->will($this->returnValue(true)); + + $directoryMock->expects($this->any()) + ->method('isFile') + ->will($this->returnValue(true)); + + $directoryMock->expects($this->any()) + ->method('readFile') + ->will($this->returnValue('some string read from file')); + + $exportAdapter = new \Magento\ImportExport\Model\Export\Adapter\Csv($filesystemMock); + + $this->_model->setWriter($exportAdapter) ->export(); } 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 988ad6aaf14..46954f1938d 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,10 +163,13 @@ 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); // set fixture CSV file $result = $this->_entityAdapter - ->setSource(\Magento\ImportExport\Model\Import\Adapter::findAdapterFor($sourceFile)) + ->setSource(\Magento\ImportExport\Model\Import\Adapter::findAdapterFor($sourceFile, $rootDirectory)) ->isDataValid(); if ($errors) { $this->assertFalse($result); 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 d1bd0eba036..1bf8a9472d0 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 @@ -385,8 +385,15 @@ class AddressTest extends \PHPUnit_Framework_TestCase // set fixture CSV file $sourceFile = __DIR__ . '/../_files/address_import_update.csv'; + + /** @var $objectManager \Magento\TestFramework\ObjectManager */ + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $filesystem = $objectManager->create('Magento\Filesystem'); + + $directoryWrite = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $result = $this->_entityAdapter - ->setSource(\Magento\ImportExport\Model\Import\Adapter::findAdapterFor($sourceFile)) + ->setSource(\Magento\ImportExport\Model\Import\Adapter::findAdapterFor($sourceFile, $directoryWrite)) ->isDataValid(); $this->assertFalse($result, 'Validation result must be false.'); @@ -469,8 +476,13 @@ class AddressTest extends \PHPUnit_Framework_TestCase // set fixture CSV file $sourceFile = __DIR__ . '/../_files/address_import_delete.csv'; + + /** @var $objectManager \Magento\TestFramework\ObjectManager */ + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $filesystem = $objectManager->create('Magento\Filesystem'); + $directoryWrite = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); $result = $this->_entityAdapter - ->setSource(\Magento\ImportExport\Model\Import\Adapter::findAdapterFor($sourceFile)) + ->setSource(\Magento\ImportExport\Model\Import\Adapter::findAdapterFor($sourceFile, $directoryWrite)) ->isDataValid(); $this->assertTrue($result, 'Validation result must be true.'); 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 3ca0617ace8..2e59e589d11 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 @@ -39,12 +39,20 @@ class CustomerImportTest extends \PHPUnit_Framework_TestCase */ protected $_model; + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected $directoryWrite; + protected function setUp() { parent::setUp(); $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); } /** @@ -61,7 +69,12 @@ class CustomerImportTest extends \PHPUnit_Framework_TestCase // 3 customers will be imported. // 1 of this customers is already exist, but its first and last name were changed in file $expectAddedCustomers = 5; - $source = new \Magento\ImportExport\Model\Import\Source\Csv(__DIR__ . '/_files/customers_to_import.csv'); + + + $source = new \Magento\ImportExport\Model\Import\Source\Csv( + __DIR__ . '/_files/customers_to_import.csv', + $this->directoryWrite + ); /** @var $customersCollection \Magento\Customer\Model\Resource\Customer\Collection */ $customersCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() @@ -126,13 +139,17 @@ class CustomerImportTest extends \PHPUnit_Framework_TestCase { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); - $source = new \Magento\ImportExport\Model\Import\Source\Csv(__DIR__ . '/_files/customers_to_import.csv'); + $source = new \Magento\ImportExport\Model\Import\Source\Csv( + __DIR__ . '/_files/customers_to_import.csv', + $this->directoryWrite + ); /** @var $customerCollection \Magento\Customer\Model\Resource\Customer\Collection */ $customerCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Customer\Model\Resource\Customer\Collection'); $this->assertEquals(3, $customerCollection->count(), 'Count of existing customers are invalid'); + $this->_model->setParameters( array( 'behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE 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 c1d81ddbe4c..bcbf28caefb 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,7 +101,13 @@ class ProductTest extends \PHPUnit_Framework_TestCase $productsBeforeImport[] = $product; } - $source = new \Magento\ImportExport\Model\Import\Source\Csv(__DIR__ . '/_files/products_to_import.csv'); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); + $directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + + $source = new \Magento\ImportExport\Model\Import\Source\Csv( + __DIR__ . '/_files/products_to_import.csv', + $directory + ); $this->_model->setParameters(array( 'behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE, 'entity' => 'catalog_product' @@ -142,7 +148,12 @@ class ProductTest extends \PHPUnit_Framework_TestCase $stockItems[$productId] = $stockItem; } - $source = new \Magento\ImportExport\Model\Import\Source\Csv(__DIR__ . '/_files/products_to_import.csv'); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); + $directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $source = new \Magento\ImportExport\Model\Import\Source\Csv( + __DIR__ . '/_files/products_to_import.csv', + $directory + ); $this->_model->setParameters(array( 'behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE, 'entity' => 'catalog_product' @@ -180,7 +191,11 @@ class ProductTest extends \PHPUnit_Framework_TestCase { // import data from CSV file $pathToFile = __DIR__ . '/_files/product_with_custom_options.csv'; - $source = new \Magento\ImportExport\Model\Import\Source\Csv($pathToFile); + + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); + $directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + + $source = new \Magento\ImportExport\Model\Import\Source\Csv($pathToFile, $directory); $this->_model->setSource($source) ->setParameters(array('behavior' => $behavior)) ->isDataValid(); @@ -239,8 +254,12 @@ 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); + $source = new \Magento\ImportExport\Model\Import\Source\Csv( - __DIR__ . '/_files/products_to_import_with_datetime.csv' + __DIR__ . '/_files/products_to_import_with_datetime.csv', + $directory ); $this->_model->setParameters(array( 'behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE, @@ -440,6 +459,9 @@ class ProductTest extends \PHPUnit_Framework_TestCase */ public function testSaveMediaImage() { + $this->markTestSkipped( + 'The test is skipped due to incomplete story https://jira.corp.x.com/browse/MAGETWO-15713' + ); $attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Catalog\Model\Entity\Attribute'); $attribute->loadByCode('catalog_product', 'media_gallery'); @@ -457,6 +479,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase $attribute->getId(), 'magento_image.jpg', 'Image Label', '1', '0' )) . "\n"; $data = 'data://text/plain;base64,' . base64_encode($data); + $fixture = new \Magento\ImportExport\Model\Import\Source\Csv($data); foreach (\Magento\TestFramework\Helper\Bootstrap::getObjectManager() @@ -499,10 +522,12 @@ class ProductTest extends \PHPUnit_Framework_TestCase */ public static function mediaImportImageFixture() { - $dir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir('media') . '/import'; - mkdir($dir); - copy(__DIR__ . '/../../../../../Magento/Catalog/_files/magento_image.jpg', "{$dir}/magento_image.jpg"); + /** @var \Magento\Filesystem\Directory\Write $mediaDirectory */ + $mediaDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $mediaDirectory->create('import'); + $dirPath = $mediaDirectory->getAbsolutePath('import'); + copy(__DIR__ . '/../../../../../Magento/Catalog/_files/magento_image.jpg', "{$dirPath}/magento_image.jpg"); } /** @@ -510,10 +535,11 @@ class ProductTest extends \PHPUnit_Framework_TestCase */ public static function mediaImportImageFixtureRollback() { - $media = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir('media'); - \Magento\Io\File::rmdirRecursive("{$media}/import"); - \Magento\Io\File::rmdirRecursive("{$media}/catalog"); + /** @var \Magento\Filesystem\Directory\Write $mediaDirectory */ + $mediaDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $mediaDirectory->delete('import'); + $mediaDirectory->delete('catalog'); } /** @@ -545,4 +571,44 @@ class ProductTest extends \PHPUnit_Framework_TestCase } return $data; } + + /** + * Tests that an import will still work with an invalid import line and + * SKU data. + * + * In this case, the second product data has an invalid attribute set. + * + * @magentoDbIsolation enabled + */ + public function testInvalidSkuLink() + { + // 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); + $source = new \Magento\ImportExport\Model\Import\Source\Csv( + $pathToFile, + $directory + ); + $this->_model->setSource($source) + ->setParameters(array('behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND)) + ->isDataValid(); + $this->_model->importData(); + + $productCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Resource\Product\Collection'); + + $products = array(); + /** @var $product \Magento\Catalog\Model\Product */ + foreach ($productCollection as $product) { + $products[$product->getSku()] = $product; + } + $this->assertArrayHasKey("simple1", $products, "Simple Product should have been imported"); + $this->assertArrayHasKey("simple3", $products, "Simple Product 3 should have been imported"); + $this->assertArrayNotHasKey("simple2", $products, "Simple Product2 should not have been imported"); + + $upsellProductIds = $products["simple3"]->getUpSellProductIds(); + $this->assertEquals(0, count($upsellProductIds), "There should not be any linked upsell SKUs. The original" + . " product SKU linked does not import cleanly."); + } } diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/_files/products_to_import_invalid_attribute_set.csv b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/_files/products_to_import_invalid_attribute_set.csv new file mode 100644 index 00000000000..598100edcd6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/_files/products_to_import_invalid_attribute_set.csv @@ -0,0 +1,4 @@ +sku,price,name,_type,_attribute_set,_links_upsell_sku,description +simple1,25,"Simple Product",simple,Default,,description +simple2,NULL,"Simple Product2",invalid attribute set,Default,,Hi There +simple3,58,"Simple Product 3",simple,Default,simple2,description 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 80813fd9ea2..0a1f7562a83 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,11 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase */ public function testSaveValidatedBunches() { + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); + $directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); $source = new \Magento\ImportExport\Model\Import\Source\Csv( - __DIR__ . '/Entity/Eav/_files/customers_for_validation_test.csv' + __DIR__ . '/Entity/Eav/_files/customers_for_validation_test.csv', + $directory ); $source->rewind(); $expected = $source->current(); 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 9b6000059c4..79742ac5e50 100644 --- a/dev/tests/integration/testsuite/Magento/Index/Model/Process/FileTest.php +++ b/dev/tests/integration/testsuite/Magento/Index/Model/Process/FileTest.php @@ -35,18 +35,13 @@ class FileTest extends \PHPUnit_Framework_TestCase /** * Test lock name */ - const FILE_NAME = 'index_test.lock'; + const FILE_PATH = 'locks/index_test.lock'; /** * @var \Magento\TestFramework\ObjectManager */ protected $_objectManager; - /** - * @var string - */ - protected $_fileDirectory; - /** * @var resource */ @@ -57,14 +52,19 @@ class FileTest extends \PHPUnit_Framework_TestCase */ protected $_model; + /** + * @var \Magento\Filesystem\Directory\WriteInterface + */ + protected $_varDirectory; + protected function setUp() { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_model = $this->_objectManager->create('Magento\Index\Model\Process\File'); - /** @var $dir \Magento\App\Dir */ - $dir = $this->_objectManager->get('Magento\App\Dir'); - $this->_fileDirectory = $dir->getDir(\Magento\App\Dir::VAR_DIR) . DIRECTORY_SEPARATOR . 'locks'; - $fullFileName = $this->_fileDirectory . DIRECTORY_SEPARATOR . self::FILE_NAME; + $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + $filesystem = $this->_objectManager->create('Magento\Filesystem'); + $this->_varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + + $fullFileName = $this->_varDirectory->getAbsolutePath(self::FILE_PATH); $this->_testFileHandler = fopen($fullFileName, 'w'); } @@ -72,7 +72,7 @@ class FileTest extends \PHPUnit_Framework_TestCase { unset($this->_objectManager); unset($this->_model); - unset($this->_fileDirectory); + unset($this->_varDirectory); fclose($this->_testFileHandler); unset($this->_testFileHandler); } @@ -82,8 +82,10 @@ class FileTest extends \PHPUnit_Framework_TestCase */ protected function _openFile() { - $this->_model->cd($this->_fileDirectory); - $this->_model->streamOpen(self::FILE_NAME); + $this->_model = $this->_objectManager->create( + 'Magento\Index\Model\Process\File', + array('streamHandler' => $this->_varDirectory->openFile(self::FILE_PATH, 'w+')) + ); } /** @@ -104,11 +106,6 @@ class FileTest extends \PHPUnit_Framework_TestCase flock($this->_testFileHandler, LOCK_UN); } - public function testProcessLockNoStream() - { - $this->assertFalse($this->_model->processLock()); - } - /** * This test can't check non blocking lock case because its required two parallel test processes */ @@ -117,7 +114,8 @@ class FileTest extends \PHPUnit_Framework_TestCase $this->_openFile(); // can't take shared lock if file has exclusive lock - $this->assertTrue($this->_model->processLock()); + $this->_model->processLock(); + $this->assertFalse($this->_model->isProcessLocked()); $this->assertFalse($this->_tryGetSharedLock(), 'File must be locked'); $this->assertAttributeSame(true, '_streamLocked', $this->_model); $this->assertAttributeSame(false, '_processLocked', $this->_model); @@ -131,8 +129,9 @@ class FileTest extends \PHPUnit_Framework_TestCase // can't take exclusive lock if file has shared lock $this->assertTrue($this->_tryGetSharedLock(), 'File must not be locked'); - $this->assertFalse($this->_model->processLock()); - $this->assertAttributeSame(true, '_streamLocked', $this->_model); + $this->_model->processLock(); + $this->assertTrue($this->_model->isProcessLocked()); + $this->assertAttributeSame(false, '_streamLocked', $this->_model); $this->assertAttributeSame(true, '_processLocked', $this->_model); $this->_unlock(); @@ -142,17 +141,12 @@ class FileTest extends \PHPUnit_Framework_TestCase { $this->_openFile(); $this->_model->processLock(); - - $this->assertTrue($this->_model->processUnlock()); + $this->_model->processUnlock(); + $this->assertFalse($this->_model->isProcessLocked()); $this->assertAttributeSame(false, '_streamLocked', $this->_model); $this->assertAttributeSame(null, '_processLocked', $this->_model); } - public function testIsProcessLockedNoStream() - { - $this->assertNull($this->_model->isProcessLocked()); - } - public function testIsProcessLockedStoredFlag() { $this->_openFile(); diff --git a/dev/tests/integration/testsuite/Magento/Install/Block/AdminTest.php b/dev/tests/integration/testsuite/Magento/Install/Block/AdminTest.php index e5bf3d49d56..48a31f1129e 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Block/AdminTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Block/AdminTest.php @@ -38,7 +38,7 @@ class AdminTest extends \PHPUnit_Framework_TestCase 'password_confirmation' => 'password_with_1_number', ); - /** @var $session \Magento\Core\Model\Session\Generic */ + /** @var $session \Magento\Session\Generic */ $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Install\Model\Session'); $session->setAdminData(array_merge($preserve, $omit)); diff --git a/dev/tests/integration/testsuite/Magento/Install/Controller/WizardTest.php b/dev/tests/integration/testsuite/Magento/Install/Controller/WizardTest.php index 6a1db025300..53aa183e682 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Controller/WizardTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Controller/WizardTest.php @@ -41,17 +41,15 @@ class WizardTest extends \Magento\TestFramework\TestCase\AbstractController public static function setUpBeforeClass() { - $tmpDir = - \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir() - . DIRECTORY_SEPARATOR . 'WizardTest'; - if (is_file($tmpDir)) { - unlink($tmpDir); - } elseif (is_dir($tmpDir)) { - \Magento\Io\File::rmdirRecursive($tmpDir); - } + /** @var \Magento\Filesystem $filesystem */ + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); + $varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $tmpDir = 'WizardTest'; + $varDirectory->delete($tmpDir); // deliberately create a file instead of directory to emulate broken access to static directory - touch($tmpDir); - self::$_tmpDir = $tmpDir; + $varDirectory->touch($tmpDir); + + self::$_tmpDir = $varDirectory->getAbsolutePath($tmpDir); } public function testPreDispatch() @@ -69,49 +67,4 @@ class WizardTest extends \Magento\TestFramework\TestCase\AbstractController $this->assertEquals(302, $this->getResponse()->getHttpResponseCode()); $appState->setInstallDate(date('r', strtotime('now'))); } - - /** - * @param string $action - * @dataProvider actionsDataProvider - * @expectedException \Magento\BootstrapException - */ - public function testPreDispatchImpossibleToRenderPage($action) - { - $params = self::$_params; - $params[\Magento\App\Dir::PARAM_APP_DIRS][\Magento\App\Dir::STATIC_VIEW] = self::$_tmpDir; - \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize($params); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( - 'preferences' => array( - 'Magento\App\RequestInterface' => 'Magento\TestFramework\Request', - 'Magento\App\Response\Http' => 'Magento\TestFramework\Response' - ) - )); - $this->dispatch("install/wizard/{$action}"); - } - - /** - * @return array - */ - public function actionsDataProvider() - { - return array( - array('index'), - array('begin'), - array('beginPost'), - array('locale'), - array('localeChange'), - array('localePost'), - array('download'), - array('downloadPost'), - array('downloadAuto'), - array('install'), - array('downloadManual'), - array('config'), - array('configPost'), - array('installDb'), - array('administrator'), - array('administratorPost'), - array('end'), - ); - } } diff --git a/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php index 1222260bdb1..d005aaddbb8 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php @@ -53,13 +53,19 @@ class ConfigTest extends \PHPUnit_Framework_TestCase } $cacheState->persist(); - /** @var \Magento\App\Dir $dirs */ - $dirs = $this->_objectManager->create( - 'Magento\App\Dir', array( - 'baseDir' => BP, - 'dirs' => array( - \Magento\App\Dir::MODULES => __DIR__ . '/_files', - \Magento\App\Dir::CONFIG => __DIR__ . '/_files' + /** @var \Magento\Filesystem $filesystem */ + $filesystem = $this->_objectManager->create( + 'Magento\Filesystem', + array( + 'directoryList' => $this->_objectManager->create( + 'Magento\Filesystem\DirectoryList', + array( + 'root' => BP, + 'directories' => array( + \Magento\Filesystem::MODULES => array('path' => __DIR__ . '/_files'), + \Magento\Filesystem::CONFIG => array('path' => __DIR__ . '/_files'), + ) + ) ) ) ); @@ -67,7 +73,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Module\Declaration\FileResolver $modulesDeclarations */ $modulesDeclarations = $this->_objectManager->create( 'Magento\Module\Declaration\FileResolver', array( - 'applicationDirs' => $dirs, + 'filesystem' => $filesystem, ) ); @@ -89,7 +95,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Module\Dir\Reader $moduleReader */ $moduleReader = $this->_objectManager->create( 'Magento\Module\Dir\Reader', array( - 'moduleList' => $modulesList + 'moduleList' => $modulesList, + 'filesystem' => $filesystem ) ); $moduleReader->setModuleDir('Magento_Test', 'etc', __DIR__ . '/_files/Magento/Test/etc'); @@ -164,8 +171,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testMergeCompleteAndPartial() { $fileList = array( - __DIR__ . '/_files/install_wizard_complete.xml', - __DIR__ . '/_files/install_wizard_partial.xml' + file_get_contents(__DIR__ . '/_files/install_wizard_complete.xml'), + file_get_contents(__DIR__ . '/_files/install_wizard_partial.xml') ); $fileResolverMock = $this->getMockBuilder('Magento\Config\FileResolverInterface') ->setMethods(array('get')) 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 be363136958..df838bfea7c 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Model/Installer/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Model/Installer/ConfigTest.php @@ -30,16 +30,23 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ protected static $_tmpDir = ''; + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected static $_varDirectory; + public static function setUpBeforeClass() { - self::$_tmpDir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::VAR_DIR) . DIRECTORY_SEPARATOR . "ConfigTest"; - mkdir(self::$_tmpDir); + /** @var \Magento\Filesystem $filesystem */ + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); + self::$_varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + self::$_tmpDir = self::$_varDirectory->getAbsolutePath('ConfigTest'); + self::$_varDirectory->create(self::$_varDirectory->getRelativePath(self::$_tmpDir)); } public static function tearDownAfterClass() { - \Magento\Io\File::rmdirRecursive(self::$_tmpDir); + self::$_varDirectory->delete(self::$_varDirectory->getRelativePath(self::$_tmpDir)); } public function testInstall() @@ -57,18 +64,25 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $request->expects($this->once())->method('getDistroBaseUrl')->will($this->returnValue('http://example.com/')); $expectedContents = "test; <![CDATA[d-d-d-d-d]]>; <![CDATA[http://example.com/]]>; {{unknown}}"; - $dirs = new \Magento\App\Dir( - self::$_tmpDir, - array(), - array(\Magento\App\Dir::CONFIG => self::$_tmpDir) - ); $this->assertFileNotExists($expectedFile); - $filesystem = new \Magento\Filesystem(new \Magento\Filesystem\Adapter\Local); - $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Install\Model\Installer\Config', array( - 'request' => $request, 'dirs' => $dirs, 'filesystem' => $filesystem - )); + + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $directoryList = $objectManager->create( + 'Magento\Filesystem\DirectoryList', + array( + 'root' => self::$_tmpDir, + 'directories' => array( + \Magento\Filesystem::CONFIG => array('path' => self::$_tmpDir) + ), + ) + ); + $filesystem = $objectManager->create('Magento\Filesystem', array('directoryList' => $directoryList)); + $model = $objectManager->create( + 'Magento\Install\Model\Installer\Config', + array('request' => $request, 'filesystem' => $filesystem) + ); + $model->install(); $this->assertFileExists($expectedFile); $this->assertStringEqualsFile($expectedFile, $expectedContents); diff --git a/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php b/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php index 1edc55f9882..6b728079bc0 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php @@ -39,17 +39,24 @@ class InstallerTest extends \PHPUnit_Framework_TestCase */ protected static $_tmpConfigFile = ''; + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected static $_varDirectory; + public static function setUpBeforeClass() { - self::$_tmpDir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::VAR_DIR) . DIRECTORY_SEPARATOR . 'InstallerTest'; - self::$_tmpConfigFile = self::$_tmpDir . DIRECTORY_SEPARATOR . 'local.xml'; - mkdir(self::$_tmpDir); + /** @var \Magento\Filesystem $filesystem */ + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); + self::$_varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + self::$_tmpDir = self::$_varDirectory->getAbsolutePath('InstallerTest'); + self::$_tmpConfigFile = self::$_tmpDir . '/local.xml'; + self::$_varDirectory->create(self::$_varDirectory->getRelativePath(self::$_tmpDir)); } public static function tearDownAfterClass() { - \Magento\Io\File::rmdirRecursive(self::$_tmpDir); + self::$_varDirectory->delete(self::$_varDirectory->getRelativePath(self::$_tmpDir)); } /** @@ -62,13 +69,24 @@ class InstallerTest extends \PHPUnit_Framework_TestCase protected function _getModel($emulateConfig = false) { $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)); + if ($emulateConfig) { $installerConfig = new \Magento\Install\Model\Installer\Config( $objectManager->get('Magento\Install\Model\Installer'), $objectManager->get('Magento\App\RequestInterface'), - new \Magento\App\Dir(__DIR__, array(), array(\Magento\App\Dir::CONFIG => self::$_tmpDir)), - new \Magento\Filesystem(new \Magento\Filesystem\Adapter\Local()), - $objectManager->get('Magento\Core\Model\StoreManager') + $filesystem, + $objectManager->get('Magento\Core\Model\StoreManager'), + $objectManager->get('Magento\Message\Manager') ); $objectManager->addSharedInstance($installerConfig, 'Magento\Install\Model\Installer\Config'); } diff --git a/dev/tests/integration/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php b/dev/tests/integration/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php index 4216f45fc6c..c2cae6b1e12 100644 --- a/dev/tests/integration/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php +++ b/dev/tests/integration/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php @@ -91,7 +91,7 @@ class IntegrationTest extends \Magento\Backend\Utility\Controller $this->dispatch('backend/admin/integration/save'); $this->assertSessionMessages( $this->equalTo(array("The integration '$integrationName' has been saved.")), - \Magento\Message\Factory::SUCCESS + \Magento\Message\MessageInterface::TYPE_SUCCESS ); $this->assertRedirect($this->stringContains('backend/admin/integration/index/')); } @@ -110,7 +110,7 @@ class IntegrationTest extends \Magento\Backend\Utility\Controller $this->assertSessionMessages( $this->equalTo(array("The integration '$integrationName' has been saved.")), - \Magento\Message\Factory::SUCCESS + \Magento\Message\MessageInterface::TYPE_SUCCESS ); $this->assertRedirect($this->stringContains('backend/admin/integration/index/')); } diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/ReaderTest.php index 73960a607aa..47e20986645 100644 --- a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/ReaderTest.php @@ -52,8 +52,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function testRead() { $configFiles = array( - realpath(__DIR__ . '/_files/integrationA.xml'), - realpath(__DIR__ . '/_files/integrationB.xml') + file_get_contents(realpath(__DIR__ . '/_files/integrationA.xml')), + file_get_contents(realpath(__DIR__ . '/_files/integrationB.xml')) ); $this->_fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($configFiles)); diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/_files/integration.php b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/_files/integration.php index 0174f55ae61..82cf15eedea 100644 --- a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/_files/integration.php +++ b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/_files/integration.php @@ -24,11 +24,13 @@ return array( 'TestIntegration1' => array( 'email' => 'test-integration1@example.com', - 'endpoint_url' => 'http://example.com/endpoint1' + 'endpoint_url' => 'http://example.com/endpoint1', + 'identity_link_url' => 'http://www.example.com/identity1' ), 'TestIntegration2' => array( 'email' => 'test-integration2@example.com', - 'endpoint_url' => 'http://example.com/integration2' + 'endpoint_url' => 'http://example.com/integration2', + 'identity_link_url' => 'http://www.example.com/identity2' ), 'TestIntegration3' => array( 'email' => 'test-integration3@example.com', diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/_files/integrationA.xml b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/_files/integrationA.xml index 9adf046a90d..1671f7426d8 100644 --- a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/_files/integrationA.xml +++ b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/_files/integrationA.xml @@ -27,6 +27,7 @@ <integration name="TestIntegration1"> <email>test-integration1@example.com</email> <endpoint_url>http://example.com/endpoint1</endpoint_url> + <identity_link_url>http://www.example.com/identity1</identity_link_url> </integration> <integration name="TestIntegration2"> <email>test-integration2@example.com</email> diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/_files/integrationB.xml b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/_files/integrationB.xml index 5096a031de5..9fe22e91aff 100644 --- a/dev/tests/integration/testsuite/Magento/Integration/Model/Config/_files/integrationB.xml +++ b/dev/tests/integration/testsuite/Magento/Integration/Model/Config/_files/integrationB.xml @@ -27,6 +27,7 @@ <integration name="TestIntegration2"> <!--Extension of data provided in integrationA.xml--> <endpoint_url>http://example.com/integration2</endpoint_url> + <identity_link_url>http://www.example.com/identity2</identity_link_url> </integration> <integration name="TestIntegration3"> <email>test-integration3@example.com</email> diff --git a/dev/tests/integration/testsuite/Magento/Message/CollectionFactoryTest.php b/dev/tests/integration/testsuite/Magento/Message/CollectionFactoryTest.php new file mode 100644 index 00000000000..4bcf2426e44 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Message/CollectionFactoryTest.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Message; + +/** + * \Magento\Message\CollectionFactory test case + */ +class CollectionFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Message\CollectionFactory + */ + protected $model; + + /** + * @var \Magento\ObjectManager + */ + protected $objectManager; + + public function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->model = $this->objectManager->create('Magento\Message\CollectionFactory'); + } + + public function testCreate() + { + $message = $this->model->create(); + $this->assertInstanceOf('\Magento\Message\Collection', $message); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Message/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Message/FactoryTest.php new file mode 100644 index 00000000000..a706ccc8e5e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Message/FactoryTest.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. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Message; + +/** + * \Magento\Message\Factory test case + */ +class FactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Message\Factory + */ + protected $model; + + /** + * @var \Magento\ObjectManager + */ + protected $objectManager; + + public function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->model = $this->objectManager->create('Magento\Message\Factory'); + } + + /** + * @dataProvider createProvider + */ + public function testCreate($messageType) + { + $message = $this->model->create($messageType, 'some text'); + $this->assertInstanceOf('\Magento\Message\MessageInterface', $message); + } + + public function createProvider() + { + return array( + array(MessageInterface::TYPE_SUCCESS), + array(MessageInterface::TYPE_NOTICE), + array(MessageInterface::TYPE_WARNING), + array(MessageInterface::TYPE_ERROR), + ); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Wrong message type + */ + public function testCreateWrong() + { + $this->model->create('Wrong', 'some text'); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Message/ManagerTest.php b/dev/tests/integration/testsuite/Magento/Message/ManagerTest.php new file mode 100644 index 00000000000..ec8f07d8e24 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Message/ManagerTest.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Message; + +/** + * \Magento\Message\Manager test case + */ +class ManagerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Message\Manager + */ + protected $model; + + /** + * @var \Magento\ObjectManager + */ + protected $objectManager; + + public function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->model = $this->objectManager->create('Magento\Message\Manager'); + } + + /** + * @magentoAppIsolation enabled + */ + public function testAddMessage() + { + $errorMessage = $this->objectManager + ->create('Magento\Message\Error', array('text' => 'some text')); + $this->model->addMessage($errorMessage); + + $customGroup = 'custom-group'; + $errorMessageCustom = $this->objectManager + ->create('Magento\Message\Error', array('text' => 'some custom group')); + $this->model->addMessage($errorMessageCustom, $customGroup); + + $this->assertEquals($errorMessage, $this->model->getMessages()->getLastAddedMessage()); + $this->assertEquals($errorMessageCustom, $this->model->getMessages(false, $customGroup)->getLastAddedMessage()); + $this->assertEquals($errorMessageCustom, $this->model->getMessages(true, $customGroup)->getLastAddedMessage()); + + $this->assertEmpty($this->model->getMessages(false, $customGroup)->getItems()); + $this->assertEmpty($this->model->getMessages(false, $customGroup)->getLastAddedMessage()); + } + + /** + * @magentoAppIsolation enabled + */ + public function testAddMessages() + { + $customGroup = 'custom-group'; + $messages = array( + $this->objectManager->create('Magento\Message\Error', array('text' => 'some text 1')), + $this->objectManager->create('Magento\Message\Error', array('text' => 'some text 2')), + $this->objectManager->create('Magento\Message\Error', array('text' => 'some text 3')), + $this->objectManager->create('Magento\Message\Error', array('text' => 'some text 4')), + ); + + $this->model->addMessages($messages); + array_shift($messages); + $this->model->addMessages($messages, $customGroup); + $this->assertEquals(4, $this->model->getMessages()->getCount()); + $this->assertEquals(3, $this->model->getMessages(false, $customGroup)->getCount()); + } + + /** + * @magentoAppIsolation enabled + */ + public function testAddUniqueMessages() + { + $errorMessageFirst = $this->objectManager + ->create('Magento\Message\Error', array('text' => 'some text')); + $errorMessageSecond = $this->objectManager + ->create('Magento\Message\Error', array('text' => 'some text')); + $this->model->addUniqueMessages($errorMessageFirst); + $this->model->addUniqueMessages($errorMessageSecond); + + $this->assertEquals(1, $this->model->getMessages()->getCount()); + $this->assertEquals( + $errorMessageFirst->getText(), + $this->model->getMessages()->getLastAddedMessage()->getText() + ); + } + + /** + * @magentoAppIsolation enabled + */ + public function testAddError() + { + $customGroup = 'custom-group'; + $this->model->addError('some text'); + $this->model->addError('some text 2', $customGroup); + $this->assertEquals(1, $this->model->getMessages()->getCount()); + $this->assertEquals(1, $this->model->getMessages()->getCountByType(MessageInterface::TYPE_ERROR)); + $this->assertEquals(0, $this->model->getMessages()->getCountByType(MessageInterface::TYPE_WARNING)); + $this->assertEquals(0, $this->model->getMessages()->getCountByType(MessageInterface::TYPE_NOTICE)); + $this->assertEquals(0, $this->model->getMessages()->getCountByType(MessageInterface::TYPE_SUCCESS)); + $this->assertEquals( + 'some text', + $this->model->getMessages()->getLastAddedMessage()->getText() + ); + + $this->assertEquals(1, $this->model->getMessages(false, $customGroup)->getCount()); + $this->assertEquals( + 'some text 2', + $this->model->getMessages(false, $customGroup)->getLastAddedMessage()->getText() + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Adminhtml/NewsletterQueueTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Adminhtml/NewsletterQueueTest.php index 57eb3281b75..03cc4bf20e1 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Adminhtml/NewsletterQueueTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Adminhtml/NewsletterQueueTest.php @@ -71,13 +71,14 @@ class NewsletterQueueTest extends \Magento\Backend\Utility\Controller /** * Check that errors was generated and set to session */ - $this->assertSessionMessages($this->isEmpty(), \Magento\Message\Factory::ERROR); + $this->assertSessionMessages($this->isEmpty(), \Magento\Message\MessageInterface::TYPE_ERROR); /** * Check that success message is set */ $this->assertSessionMessages( - $this->equalTo(array('The newsletter queue has been saved.')), \Magento\Message\Factory::SUCCESS + $this->equalTo(array('The newsletter queue has been saved.')), + \Magento\Message\MessageInterface::TYPE_SUCCESS ); } } diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Adminhtml/NewsletterTemplateTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Adminhtml/NewsletterTemplateTest.php index e6a20aca050..5b50ebb2b1d 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Adminhtml/NewsletterTemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Adminhtml/NewsletterTemplateTest.php @@ -72,12 +72,13 @@ class NewsletterTemplateTest extends \Magento\Backend\Utility\Controller /** * Check that errors was generated and set to session */ - $this->assertSessionMessages($this->isEmpty(), \Magento\Message\Factory::ERROR); + $this->assertSessionMessages($this->isEmpty(), \Magento\Message\MessageInterface::TYPE_ERROR); /** * Check that success message is set */ $this->assertSessionMessages( - $this->equalTo(array('The newsletter template has been saved.')), \Magento\Message\Factory::SUCCESS + $this->equalTo(array('The newsletter template has been saved.')), + \Magento\Message\MessageInterface::TYPE_SUCCESS ); } @@ -94,13 +95,14 @@ class NewsletterTemplateTest extends \Magento\Backend\Utility\Controller /** * Check that errors was generated and set to session */ - $this->assertSessionMessages($this->isEmpty(), \Magento\Message\Factory::ERROR); + $this->assertSessionMessages($this->isEmpty(), \Magento\Message\MessageInterface::TYPE_ERROR); /** * Check that success message is set */ $this->assertSessionMessages( - $this->equalTo(array('The newsletter template has been saved.')), \Magento\Message\Factory::SUCCESS + $this->equalTo(array('The newsletter template has been saved.')), + \Magento\Message\MessageInterface::TYPE_SUCCESS ); } @@ -121,12 +123,14 @@ class NewsletterTemplateTest extends \Magento\Backend\Utility\Controller /** * Check that errors was generated and set to session */ - $this->assertSessionMessages($this->logicalNot($this->isEmpty()), \Magento\Message\Factory::ERROR); + $this->assertSessionMessages( + $this->logicalNot($this->isEmpty()), + \Magento\Message\MessageInterface::TYPE_ERROR); /** * Check that success message is not set */ - $this->assertSessionMessages($this->isEmpty(), \Magento\Message\Factory::SUCCESS); + $this->assertSessionMessages($this->isEmpty(), \Magento\Message\MessageInterface::TYPE_SUCCESS); } /** @@ -142,13 +146,14 @@ class NewsletterTemplateTest extends \Magento\Backend\Utility\Controller /** * Check that errors was generated and set to session */ - $this->assertSessionMessages($this->isEmpty(), \Magento\Message\Factory::ERROR); + $this->assertSessionMessages($this->isEmpty(), \Magento\Message\MessageInterface::TYPE_ERROR); /** * Check that success message is set */ $this->assertSessionMessages( - $this->equalTo(array('The newsletter template has been deleted.')), \Magento\Message\Factory::SUCCESS + $this->equalTo(array('The newsletter template has been deleted.')), + \Magento\Message\MessageInterface::TYPE_SUCCESS ); } } diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php index dd05faa4133..2a06232da31 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php @@ -84,7 +84,6 @@ class QueueTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Core\Model\Store\ConfigInterface'), $objectManager->get('Magento\Core\Model\ConfigInterface'), $objectManager->get('Magento\Email\Model\Template\FilterFactory'), - $objectManager->get('Magento\App\Dir'), $objectManager->get('Magento\Email\Model\Template\Config'), ) ); @@ -131,7 +130,6 @@ class QueueTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Core\Model\Store\ConfigInterface'), $objectManager->get('Magento\Core\Model\ConfigInterface'), $objectManager->get('Magento\Email\Model\Template\FilterFactory'), - $objectManager->get('Magento\App\Dir'), $objectManager->get('Magento\Email\Model\Template\Config'), ) ); diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php index 9f7c6f89a3b..f90cca090b0 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php @@ -45,36 +45,67 @@ class TemplateTest extends \PHPUnit_Framework_TestCase /** * This test expects next themes for areas: - * install/design/theme/full_name magento_basic - * current_store design/theme/full_name magento_iphone + * current_store design/theme/full_name magento_plushe * fixturestore_store design/theme/full_name magento_blank * * @magentoAppIsolation enabled - * @dataProvider getProcessedTemplateDataProvider + * @magentoAppArea adminhtml + * @dataProvider getProcessedTemplateFrontendDataProvider */ - public function testGetProcessedTemplate($area, $store, $design) + public function testGetProcessedTemplateFrontend($store, $design) { - $this->markTestIncomplete('Test partially fails bc of MAGETWO-557.'); $this->_model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}'); - $this->assertStringEndsWith('theme/frontend/magento_blank/en_US/Magento_Theme/favicon.ico', - $this->_model->getProcessedTemplate() - ); - $this->_model->emulateDesign($store, $area); - $expectedTemplateText = "theme/{$area}/{$design}/en_US/Magento_Theme/favicon.ico"; - $this->assertStringEndsWith($expectedTemplateText, $this->_model->getProcessedTemplate()); + if ($store != 'default') { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Config') + ->setValue(\Magento\Core\Model\View\Design::XML_PATH_THEME_ID, $design, 'store', $store); + } + $this->_model->emulateDesign($store, 'frontend'); + $processedTemplate = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->emulateAreaCode('frontend', array($this->_model, 'getProcessedTemplate')); + $expectedTemplateText = "frontend/{$design}/en_US/Magento_Theme/favicon.ico"; + $this->assertStringEndsWith($expectedTemplateText, $processedTemplate); $this->_model->revertDesign(); } /** * @return array */ - public function getProcessedTemplateDataProvider() + public function getProcessedTemplateFrontendDataProvider() + { + return array( + 'frontend' => array('default', 'magento_plushe'), + 'frontend store' => array('fixturestore', 'magento_blank') + ); + } + + /** + * This test expects next themes for areas: + * install/design/theme/full_name magento_basic + * adminhtml/design/theme/full_name magento_backend + * + * @magentoAppIsolation enabled + * @dataProvider getProcessedTemplateAreaDataProvider + */ + public function testGetProcessedTemplateArea($area, $design) + { + $this->_model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}'); + $this->_model->emulateDesign('default', $area); + $processedTemplate = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->emulateAreaCode($area, array($this->_model, 'getProcessedTemplate')); + $expectedTemplateText = "{$area}/{$design}/en_US/Magento_Theme/favicon.ico"; + $this->assertStringEndsWith($expectedTemplateText, $processedTemplate); + } + + /** + * @return array + */ + public function getProcessedTemplateAreaDataProvider() { + $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Core\Model\View\Design'); return array( - 'install' => array('install', 'default', 'magento_demo'), - 'backend' => array('adminhtml', 'admin', 'magento_backend'), - 'frontend' => array('frontend', 'default', 'magento_iphone'), - 'frontend store' => array('frontend', 'fixturestore', 'magento_blank'), + 'install' => array('install', $design->getConfigurationDesignTheme('install')), + 'backend' => array('adminhtml', 'magento_backend') ); } 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 23caad9aa86..79c1ee7bf5d 100644 --- a/dev/tests/integration/testsuite/Magento/Object/Copy/Config/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Object/Copy/Config/ReaderTest.php @@ -38,13 +38,18 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\App\Dir $dirs */ - $dirs = $objectManager->create( - 'Magento\App\Dir', array( - 'baseDir' => BP, - 'dirs' => array( - \Magento\App\Dir::MODULES => __DIR__ . '/_files', - \Magento\App\Dir::CONFIG => __DIR__ . '/_files' + /** @var \Magento\Filesystem $filesystem */ + $filesystem = $objectManager->create( + 'Magento\Filesystem', + array('directoryList' => $objectManager->create( + 'Magento\Filesystem\DirectoryList', + array( + 'root' => BP, + 'directories' => array( + \Magento\Filesystem::MODULES => array('path' => __DIR__ . '/_files'), + \Magento\Filesystem::CONFIG => array('path' => __DIR__ . '/_files'), + ) + ) ) ) ); @@ -52,7 +57,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Module\Declaration\FileResolver $modulesDeclarations */ $modulesDeclarations = $objectManager->create( 'Magento\Module\Declaration\FileResolver', array( - 'applicationDirs' => $dirs, + 'filesystem' => $filesystem, ) ); @@ -74,7 +79,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Module\Dir\Reader $moduleReader */ $moduleReader = $objectManager->create( 'Magento\Module\Dir\Reader', array( - 'moduleList' => $modulesList + 'moduleList' => $modulesList, + 'filesystem' => $filesystem ) ); $moduleReader->setModuleDir('Magento_Test', 'etc', __DIR__ . '/_files/Magento/Test/etc'); @@ -103,8 +109,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function testMergeCompleteAndPartial() { $fileList = array( - __DIR__ . '/_files/partialFieldsetFirst.xml', - __DIR__ . '/_files/partialFieldsetSecond.xml' + file_get_contents(__DIR__ . '/_files/partialFieldsetFirst.xml'), + file_get_contents(__DIR__ . '/_files/partialFieldsetSecond.xml') ); $fileResolverMock = $this->getMockBuilder('Magento\Config\FileResolverInterface') ->setMethods(array('get')) diff --git a/dev/tests/integration/testsuite/Magento/ObjectManager/Config/Reader/DomTest.php b/dev/tests/integration/testsuite/Magento/ObjectManager/Config/Reader/DomTest.php index e8ca88b8a83..8bc91a40d2c 100644 --- a/dev/tests/integration/testsuite/Magento/ObjectManager/Config/Reader/DomTest.php +++ b/dev/tests/integration/testsuite/Magento/ObjectManager/Config/Reader/DomTest.php @@ -62,10 +62,10 @@ class DomTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $fixturePath = realpath(__DIR__ . '/../../_files') . DIRECTORY_SEPARATOR; + $fixturePath = realpath(__DIR__ . '/../../_files') . '/'; $this->_fileList = array( - $fixturePath . 'config_one.xml', - $fixturePath . 'config_two.xml', + file_get_contents($fixturePath . 'config_one.xml'), + file_get_contents($fixturePath . 'config_two.xml'), ); $this->_fileResolverMock = $this->getMock( diff --git a/dev/tests/integration/testsuite/Magento/Payment/Model/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Payment/Model/Config/ReaderTest.php index 2606f365374..dc01c689289 100644 --- a/dev/tests/integration/testsuite/Magento/Payment/Model/Config/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Payment/Model/Config/ReaderTest.php @@ -50,7 +50,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function testRead() { - $fileList = array(__DIR__ . '/../_files/payment.xml'); + $fileList = array(file_get_contents(__DIR__ . '/../_files/payment.xml')); $this->_fileResolverMock->expects($this->any()) ->method('get') ->will($this->returnValue($fileList)); @@ -70,8 +70,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function testMergeCompleteAndPartial() { $fileList = array( - __DIR__ . '/../_files/payment.xml', - __DIR__ . '/../_files/payment2.xml' + file_get_contents(__DIR__ . '/../_files/payment.xml'), + file_get_contents(__DIR__ . '/../_files/payment2.xml') ); $this->_fileResolverMock->expects($this->any()) ->method('get') diff --git a/dev/tests/integration/testsuite/Magento/Payment/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Payment/Model/ConfigTest.php index 4e542e661c0..8099ca2c777 100644 --- a/dev/tests/integration/testsuite/Magento/Payment/Model/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Payment/Model/ConfigTest.php @@ -45,8 +45,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); $fileList = array( - __DIR__ . '/_files/payment.xml', - __DIR__ . '/_files/payment2.xml', + file_get_contents(__DIR__ . '/_files/payment.xml'), + file_get_contents(__DIR__ . '/_files/payment2.xml') ); $fileResolverMock->expects($this->any()) ->method('get') diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Adminhtml/Paypal/ReportsTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Adminhtml/Paypal/ReportsTest.php index fe2138d9a29..1848e75ef08 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Adminhtml/Paypal/ReportsTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Adminhtml/Paypal/ReportsTest.php @@ -43,7 +43,7 @@ class ReportsTest extends \Magento\Backend\Utility\Controller $this->dispatch('backend/admin/paypal_reports/fetch'); $this->assertSessionMessages( $this->equalTo(array("We couldn't fetch reports from 'login@127.0.0.1'.")), - \Magento\Message\Factory::ERROR + \Magento\Message\MessageInterface::TYPE_ERROR ); } } diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php index a726fadbc87..2aa10e4ca95 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php @@ -61,8 +61,8 @@ class ExpressTest extends \Magento\TestFramework\TestCase\AbstractController ->setLastOrderId($order->getId()) ->setLastQuoteId($order->getQuoteId()) ->setQuoteId($order->getQuoteId()); - /** @var $paypalSession \Magento\Core\Model\Session\Generic */ - $paypalSession = $this->_objectManager->get('Magento\Core\Model\Session\Generic'); + /** @var $paypalSession \Magento\Session\Generic */ + $paypalSession = $this->_objectManager->get('Magento\Session\Generic'); $paypalSession->setExpressCheckoutToken('token'); $this->dispatch('paypal/express/cancel'); 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 c2c5ab578dd..3ae44492456 100644 --- a/dev/tests/integration/testsuite/Magento/Persistent/Model/Persistent/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Persistent/Model/Persistent/ConfigTest.php @@ -37,8 +37,24 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function setUp() { + $directoryList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create( + 'Magento\Filesystem\DirectoryList', + array( + 'root' => \Magento\Filesystem::ROOT, + 'directories' => array( + \Magento\Filesystem::MODULES => array('path' => dirname(__DIR__)) + ), + ) + ); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Filesystem', array('directoryList' => $directoryList)); + $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_model = $this->_objectManager->create('Magento\Persistent\Model\Persistent\Config'); + $this->_model = $this->_objectManager->create( + 'Magento\Persistent\Model\Persistent\Config', + array('filesystem' => $filesystem) + ); } public function testCollectInstancesToEmulate() diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php index db90790bef4..78f3db85cd2 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php @@ -46,7 +46,7 @@ class AbstractTest ->setDefaultDesignTheme(); $arguments = array( $objectManager->get('Magento\Backend\Block\Template\Context'), - $objectManager->get('Magento\Adminhtml\Model\Session\Quote'), + $objectManager->get('Magento\Backend\Model\Session\Quote'), $objectManager->get('Magento\Sales\Model\AdminOrder\Create'), $objectManager->get('Magento\Data\FormFactory'), ); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php index 0f3d33bffcb..d757169f96d 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php @@ -41,12 +41,13 @@ class CommentsTest extends \PHPUnit_Framework_TestCase } /** - * @param mixed $commentedEntity + * @param string $commentedEntity * @param string $expectedClass * @dataProvider getCommentsDataProvider */ public function testGetComments($commentedEntity, $expectedClass) { + $commentedEntity = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create($commentedEntity); $this->_block->setEntity($commentedEntity); $comments = $this->_block->getComments(); $this->assertInstanceOf($expectedClass, $comments); @@ -59,18 +60,15 @@ class CommentsTest extends \PHPUnit_Framework_TestCase { return array( array( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Sales\Model\Order\Invoice'), + 'Magento\Sales\Model\Order\Invoice', 'Magento\Sales\Model\Resource\Order\Invoice\Comment\Collection' ), array( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Sales\Model\Order\Creditmemo'), + 'Magento\Sales\Model\Order\Creditmemo', 'Magento\Sales\Model\Resource\Order\Creditmemo\Comment\Collection' ), array( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Sales\Model\Order\Shipment'), + 'Magento\Sales\Model\Order\Shipment', 'Magento\Sales\Model\Resource\Order\Shipment\Comment\Collection' ) ); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php index dd08c848d79..474051fadef 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php @@ -47,7 +47,7 @@ $product->setTypeId('virtual') ->save(); $product->load(1); -$addressData = include(__DIR__ . DIRECTORY_SEPARATOR . 'address_data.php'); +$addressData = include(__DIR__ . '/address_data.php'); $billingAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Sales\Model\Quote\Address', diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/SessionTest.php b/dev/tests/integration/testsuite/Magento/Session/SaveHandler/DbTableTest.php similarity index 93% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/SessionTest.php rename to dev/tests/integration/testsuite/Magento/Session/SaveHandler/DbTableTest.php index 0f7e4c17b41..0ec371d3863 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/SessionTest.php +++ b/dev/tests/integration/testsuite/Magento/Session/SaveHandler/DbTableTest.php @@ -25,9 +25,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Session\SaveHandler; -class SessionTest extends \PHPUnit_Framework_TestCase +class DbTableTest extends \PHPUnit_Framework_TestCase { /** * Test session ID @@ -74,7 +74,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase /** * Model under test * - * @var \Magento\Core\Model\Resource\Session + * @var \Magento\Session\SaveHandler\DbTable */ protected $_model; @@ -95,7 +95,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_model = $this->_objectManager->get('Magento\Core\Model\Resource\Session'); + $this->_model = $this->_objectManager->get('Magento\Session\SaveHandler\DbTable'); /** @var $resource \Magento\App\Resource */ $resource = $this->_objectManager->get('Magento\App\Resource'); @@ -109,9 +109,11 @@ class SessionTest extends \PHPUnit_Framework_TestCase } } - public function testHasConnection() + public function testCheckConnection() { - $this->assertTrue($this->_model->hasConnection()); + $method = new \ReflectionMethod('Magento\Session\SaveHandler\DbTable', 'checkConnection'); + $method->setAccessible(true); + $this->assertNull($method->invoke($this->_model)); } public function testOpenAndClose() diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSessionTest.php b/dev/tests/integration/testsuite/Magento/Session/SessionManagerTest.php similarity index 80% rename from dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSessionTest.php rename to dev/tests/integration/testsuite/Magento/Session/SessionManagerTest.php index 1743b465f81..2e8c6fc578d 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSessionTest.php +++ b/dev/tests/integration/testsuite/Magento/Session/SessionManagerTest.php @@ -25,12 +25,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Session; +namespace Magento\Session; -class AbstractSessionTest extends \PHPUnit_Framework_TestCase +class SessionManagerTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Session\AbstractSession + * @var \Magento\Session\SessionManagerInterface */ protected $_model; @@ -46,26 +46,20 @@ class AbstractSessionTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Session\SidResolverInterface $sidResolver */ $this->_sidResolver = $objectManager->get('Magento\Session\SidResolverInterface'); - /** @var \Magento\Core\Model\Session\AbstractSession _model */ - $this->_model = $this->getMockForAbstractClass( - 'Magento\Core\Model\Session\AbstractSession', + /** @var \Magento\Session\SessionManager _model */ + $this->_model = $objectManager->create( + 'Magento\Session\SessionManager', array( - $objectManager->create('Magento\Core\Model\Session\Context'), + $objectManager->get('Magento\App\RequestInterface'), $this->_sidResolver, - $objectManager->create('Magento\Session\Config\ConfigInterface'), + $objectManager->get('Magento\Session\Config\ConfigInterface'), + $objectManager->get('Magento\Session\SaveHandlerInterface'), + $objectManager->get('Magento\Session\ValidatorInterface'), + $objectManager->get('Magento\Session\StorageInterface') ) ); } - public function testInit() - { - $this->_model->start('test'); - $this->_model->setTestData('test'); - $data = $this->_model->getData(); - $this->assertArrayHasKey('test_data', $data); - $this->assertSame($_SESSION['test'], $data); - } - public function testGetData() { $this->_model->setData(array('test_key' => 'test_value')); @@ -83,9 +77,9 @@ class AbstractSessionTest extends \PHPUnit_Framework_TestCase $this->assertEquals(session_name(), $this->_model->getName()); } - public function testSetSessionName() + public function testSetName() { - $this->_model->setSessionName('test'); + $this->_model->setName('test'); $this->assertEquals('test', $this->_model->getName()); } @@ -134,6 +128,7 @@ class AbstractSessionTest extends \PHPUnit_Framework_TestCase $this->_model->start('test'); $this->assertEmpty($this->_model->getSessionIdForHost('localhost')); $this->assertNotEmpty($this->_model->getSessionIdForHost('test')); + $this->_model->destroy(); } public function testIsValidForHost() @@ -147,10 +142,6 @@ class AbstractSessionTest extends \PHPUnit_Framework_TestCase $this->assertFalse($this->_model->isValidForHost('test.com')); $this->assertTrue($this->_model->isValidForHost('localhost')); - } - - public function testGetSessionSaveMethod() - { - $this->assertEquals('files', $this->_model->getSessionSaveMethod()); + $this->_model->destroy(); } } 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 2775630a659..66fb6f82320 100644 --- a/dev/tests/integration/testsuite/Magento/Sitemap/_files/sitemap_products.php +++ b/dev/tests/integration/testsuite/Magento/Sitemap/_files/sitemap_products.php @@ -26,16 +26,19 @@ */ // Copy images to tmp media path +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var \Magento\Catalog\Model\Product\Media\Config $config */ -$config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Catalog\Model\Product\Media\Config'); -$baseTmpMediaPath = $config->getBaseTmpMediaPath(); +$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); -/** @var \Magento\Filesystem $filesystem */ -$filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); -$filesystem->setIsAllowCreateDirectories(true); -$filesystem->copy(__DIR__ . '/magento_image_sitemap.png', $baseTmpMediaPath . '/magento_image_sitemap.png'); -$filesystem->copy(__DIR__ . '/second_image.png', $baseTmpMediaPath . '/second_image.png'); +$baseTmpMediaPath = $config->getBaseTmpMediaPath(); +$mediaDirectory->create($baseTmpMediaPath); +copy(__DIR__ . '/magento_image_sitemap.png', $mediaPath . '/' . $baseTmpMediaPath . '/magento_image_sitemap.png'); +copy(__DIR__ . '/second_image.png', $mediaPath . '/' . $baseTmpMediaPath . '/second_image.png'); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Catalog\Model\Product'); @@ -94,8 +97,8 @@ $product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) ->setImage('/s/e/second_image.png') ->setSmallImage('/m/a/magento_image_sitemap.png') ->setThumbnail('/m/a/magento_image_sitemap.png') - ->addImageToMediaGallery($baseTmpMediaPath . '/magento_image_sitemap.png', null, false, false) - ->addImageToMediaGallery($baseTmpMediaPath . '/second_image.png', null, false, false) + ->addImageToMediaGallery($mediaPath . '/' . $baseTmpMediaPath . '/magento_image_sitemap.png', null, false, false) + ->addImageToMediaGallery($mediaPath . '/' . $baseTmpMediaPath . '/second_image.png', null, false, false) ->setWebsiteIds(array(1)) ->setStockData(array('qty' => 100, 'is_in_stock' => 1)) ->setRelatedLinkData(array(1 => array('position' => 1))) diff --git a/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/ImportExportTest.php b/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/ImportExportTest.php index 0dce8062b2c..838f022f6b9 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/ImportExportTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/ImportExportTest.php @@ -29,7 +29,7 @@ namespace Magento\Tax\Block\Adminhtml\Rate; class ImportExportTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Adminhtml\Block\Tax\Rate\ImportExport + * @var \Magento\Tax\Block\Adminhtml\Rate\ImportExport */ protected $_block = null; diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/CsvImportHandlerTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/CsvImportHandlerTest.php index df583220e11..40368314245 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/CsvImportHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/CsvImportHandlerTest.php @@ -50,8 +50,7 @@ class CsvImportHandlerTest extends \PHPUnit_Framework_TestCase */ public function testImportFromCsvFileWithCorrectData() { - $importFileName = __DIR__ . DIRECTORY_SEPARATOR . '_files' - . DIRECTORY_SEPARATOR . 'correct_rates_import_file.csv'; + $importFileName = __DIR__ . '/_files/correct_rates_import_file.csv'; $this->_importHandler->importFromCsvFile(array('tmp_name' => $importFileName)); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); @@ -76,8 +75,7 @@ class CsvImportHandlerTest extends \PHPUnit_Framework_TestCase */ public function testImportFromCsvFileThrowsExceptionWhenCountryCodeIsInvalid() { - $importFileName = __DIR__ . DIRECTORY_SEPARATOR . '_files' - . DIRECTORY_SEPARATOR . 'rates_import_file_incorrect_country.csv'; + $importFileName = __DIR__ . '/_files/rates_import_file_incorrect_country.csv'; $this->_importHandler->importFromCsvFile(array('tmp_name' => $importFileName)); } } 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 704f30c6731..91f1b77ec1d 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\App\Dir') - ->getDir('lib') . str_replace('/', DIRECTORY_SEPARATOR, '/Magento/Acl/etc/acl.xsd'); + $this->_schemeFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem') + ->getPath(\Magento\Filesystem::LIB) . '/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\App\Dir') - ->getDir('app') . '/*/*/*/etc/adminhtml/acl.xml' + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem') + ->getPath(\Magento\Filesystem::APP) . '/*/*/*/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 809f544adc7..d6fd0d1d095 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php @@ -46,13 +46,12 @@ class DiConfigFilesTest extends \PHPUnit_Framework_TestCase protected function _prepareFiles() { //init primary configs - /** @var $dir \Magento\App\Dir */ - $dir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir'); - - $configPath = $dir->getDir(\Magento\App\Dir::APP) . DS . 'etc' . DS . '*' . DS; - self::$_primaryFiles = glob($configPath . DS. 'di.xml'); - array_unshift(self::$_primaryFiles, $dir->getDir(\Magento\App\Dir::APP) . DS . 'etc' . DS . 'di.xml'); - + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $filesystem \Magento\Filesystem */ + $filesystem = $objectManager->get('Magento\Filesystem'); + $configDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::CONFIG); + $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); + self::$_primaryFiles = $fileIteratorFactory->create($configDirectory, $configDirectory->search('#di\.xml$#')); //init module global configs /** @var $modulesReader \Magento\Module\Dir\Reader */ $modulesReader = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() @@ -62,26 +61,26 @@ class DiConfigFilesTest extends \PHPUnit_Framework_TestCase //init module area configs $areas = array('adminhtml', 'frontend'); foreach ($areas as $area) { - $moduleAreaFiles = $modulesReader->getConfigurationFiles($area . DS . 'di.xml'); + $moduleAreaFiles = $modulesReader->getConfigurationFiles($area . '/di.xml'); self::$_moduleAreaFiles[$area] = $moduleAreaFiles; } } /** - * @param string $file + * @param string $xml * @return void * @dataProvider linearFilesProvider */ - public function testDiConfigFileWithoutMerging($file) + public function testDiConfigFileWithoutMerging($xml) { /** @var \Magento\ObjectManager\Config\SchemaLocator $schemaLocator */ $schemaLocator = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\ObjectManager\Config\SchemaLocator'); $dom = new \DOMDocument(); - $dom->load($file); + $dom->loadXML($xml); if (!@$dom->schemaValidate($schemaLocator->getSchema())) { - $this->fail('File ' . $file . ' has invalid xml structure.'); + $this->fail('File ' . $xml . ' has invalid xml structure.'); } } @@ -91,10 +90,10 @@ class DiConfigFilesTest extends \PHPUnit_Framework_TestCase $this->_prepareFiles(); } - $common = array_merge(self::$_primaryFiles, self::$_moduleGlobalFiles); + $common = array_merge(self::$_primaryFiles->toArray(), self::$_moduleGlobalFiles->toArray()); foreach (self::$_moduleAreaFiles as $files) { - $common = array_merge($common, $files); + $common = array_merge($common, $files->toArray()); } $output = array(); @@ -131,22 +130,22 @@ class DiConfigFilesTest extends \PHPUnit_Framework_TestCase if (empty(self::$_primaryFiles)) { $this->_prepareFiles(); } - foreach (self::$_primaryFiles as $file) { - $primaryFiles[$file] = array(array($file)); + foreach (self::$_primaryFiles->toArray() as $file) { + $primaryFiles[] = array(array($file)); } - $primaryFiles['all primary config files'] = array(self::$_primaryFiles); + $primaryFiles['all primary config files'] = array(self::$_primaryFiles->toArray()); - foreach (self::$_moduleGlobalFiles as $file) { - $moduleFiles[$file] = array(array($file)); + foreach (self::$_moduleGlobalFiles->toArray() as $file) { + $moduleFiles[] = array(array($file)); } - $moduleFiles['all module global config files'] = array(self::$_moduleGlobalFiles); + $moduleFiles['all module global config files'] = array(self::$_moduleGlobalFiles->toArray()); $areaFiles = array(); foreach (self::$_moduleAreaFiles as $area => $files) { - foreach ($files as $file) { - $areaFiles[$file] = array(array($file)); + foreach ($files->toArray() as $file) { + $areaFiles[] = array(array($file)); } - $areaFiles["all $area config files"] = array(self::$_moduleAreaFiles[$area]); + $areaFiles["all $area config files"] = array(self::$_moduleAreaFiles[$area]->toArray()); } return $primaryFiles + $moduleFiles + $areaFiles; 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 9e8805a1846..3dc4174285b 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php @@ -32,12 +32,12 @@ class EavAttributesConfigFilesTest extends \PHPUnit_Framework_TestCase public function setUp() { - // List of all available import.xml - $xmlFiles = \Magento\TestFramework\Utility\Files::init()->getConfigFiles( - '{*/eav_attributes.xml,eav_attributes.xml}', - array('wsdl.xml', 'wsdl2.xml', 'wsi.xml'), - false - ); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $filesystem \Magento\Filesystem */ + $filesystem = $objectManager->get('Magento\Filesystem'); + $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); + $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/eav_attributes\.xml$#')); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); $validationStateMock->expects($this->any())->method('isValidated') 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 c0cd51d1e8d..c69b7e8c546 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php @@ -32,12 +32,12 @@ class ExportConfigFilesTest extends \PHPUnit_Framework_TestCase public function setUp() { - // List of all available export.xml - $xmlFiles = \Magento\TestFramework\Utility\Files::init()->getConfigFiles( - '{*/export.xml,export.xml}', - array('wsdl.xml', 'wsdl2.xml', 'wsi.xml'), - false - ); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $filesystem \Magento\Filesystem */ + $filesystem = $objectManager->get('Magento\Filesystem'); + $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); + $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/export\.xml$#')); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); $validationStateMock->expects($this->any())->method('isValidated') diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/FieldsetConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/FieldsetConfigFilesTest.php index ddd056af412..fd95efa3183 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/FieldsetConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/FieldsetConfigFilesTest.php @@ -40,13 +40,13 @@ class FieldsetConfigFilesTest extends \Magento\TestFramework\TestCase\AbstractCo /** * Returns a string that represents the path to the config file, starting in the app directory. * - * Format is glob, so * is allowed. + * Format is regex * * @return string */ - protected function _getConfigFilePathGlob() + protected function _getConfigFilePathRegex() { - return '/*/*/*/etc/fieldset.xml'; + return '#/etc/fieldset\.xml$#'; } /** 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 8f5508967fb..f7042a0a2eb 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php @@ -32,12 +32,12 @@ class ImportConfigFilesTest extends \PHPUnit_Framework_TestCase public function setUp() { - // List of all available import.xml - $xmlFiles = \Magento\TestFramework\Utility\Files::init()->getConfigFiles( - '{*/import.xml,import.xml}', - array('wsdl.xml', 'wsdl2.xml', 'wsi.xml'), - false - ); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $filesystem \Magento\Filesystem */ + $filesystem = $objectManager->get('Magento\Filesystem'); + $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); + $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/import\.xml$#')); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); $validationStateMock->expects($this->any())->method('isValidated') 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 3e7034e7eef..c77b6457430 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php @@ -32,12 +32,12 @@ class IndexerConfigFilesTest extends \PHPUnit_Framework_TestCase public function setUp() { - // List of all available import.xml - $xmlFiles = \Magento\TestFramework\Utility\Files::init()->getConfigFiles( - '{*/indexers.xml,indexers.xml}', - array('wsdl.xml', 'wsdl2.xml', 'wsi.xml'), - false - ); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $filesystem \Magento\Filesystem */ + $filesystem = $objectManager->get('Magento\Filesystem'); + $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); + $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/indexers\.xml$#')); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); $validationStateMock->expects($this->any())->method('isValidated') diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/InstallWizardConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/InstallWizardConfigFilesTest.php index 61028f5da93..4b317efa2e1 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/InstallWizardConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/InstallWizardConfigFilesTest.php @@ -41,13 +41,13 @@ class InstallWizardConfigFilesTest /** * Returns a string that represents the path to the config file, starting in the app directory. * - * Format is glob, so * is allowed. + * Format is regex * * @return string */ - protected function _getConfigFilePathGlob() + protected function _getConfigFilePathRegex() { - return '/*/*/*/etc/install_wizard.xml'; + return '#/etc/install_wizard\.xml$#'; } /** diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Email/EmailTemplateConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Email/EmailTemplateConfigFilesTest.php index 37e0e4e3859..a540f1dca61 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Email/EmailTemplateConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Email/EmailTemplateConfigFilesTest.php @@ -33,7 +33,7 @@ class EmailTemplateConfigFilesTest extends \PHPUnit_Framework_TestCase */ public function testFileFormat($file) { - $schemaFile = BP . '/app/code/Magento/Email/etc/email_templates_file.xsd'; + $schemaFile = BP . '/app/code/Magento/Email/etc/email_templates.xsd'; $dom = new \Magento\Config\Dom(file_get_contents($file)); $result = $dom->validate($schemaFile, $errors); $this->assertTrue($result, print_r($errors, true)); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MenuConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MenuConfigFilesTest.php index 8a520c5966d..38e6a9c9547 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MenuConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MenuConfigFilesTest.php @@ -38,7 +38,7 @@ class MenuConfigFilesTest extends \PHPUnit_Framework_TestCase { $moduleReader = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Module\Dir\Reader'); - $schemaFile = $moduleReader->getModuleDir('etc', 'Magento_Backend') . DIRECTORY_SEPARATOR . 'menu.xsd'; + $schemaFile = $moduleReader->getModuleDir('etc', 'Magento_Backend') . '/menu.xsd'; $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Backend\Model\Menu\Config\Reader', array( diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/PaymentConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/PaymentConfigFilesTest.php index c1d87d287bb..bae2e239233 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/PaymentConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/PaymentConfigFilesTest.php @@ -40,13 +40,13 @@ class PaymentConfigFilesTest extends \Magento\TestFramework\TestCase\AbstractCon /** * Returns a string that represents the path to the config file, starting in the app directory. * - * Format is glob, so * is allowed. + * Format is regex * * @return string */ - protected function _getConfigFilePathGlob() + protected function _getConfigFilePathRegex() { - return '/*/*/*/etc/payment.xml'; + return '#/etc/payment\.xml$#'; } /** 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 681cb8f5a93..7723f24484d 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php @@ -32,12 +32,14 @@ class ProductOptionsConfigFilesTest extends \PHPUnit_Framework_TestCase protected function setUp() { - // List of all available product_options.xml - $xmlFiles = \Magento\TestFramework\Utility\Files::init()->getConfigFiles( - '{*/product_options.xml,product_options.xml}', - array('wsdl.xml', 'wsdl2.xml', 'wsi.xml'), - false - ); + //init primary configs + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $filesystem \Magento\Filesystem */ + $filesystem = $objectManager->get('Magento\Filesystem'); + $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); + $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/product_options\.xml$#')); + $fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles)); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); 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 efac3006e53..21799175fd7 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php @@ -32,12 +32,13 @@ class ProductTypesConfigFilesTest extends \PHPUnit_Framework_TestCase protected function setUp() { - // List of all available product_types.xml - $xmlFiles = \Magento\TestFramework\Utility\Files::init()->getConfigFiles( - '{*/product_types.xml,product_types.xml}', - array('wsdl.xml', 'wsdl2.xml', 'wsi.xml'), - false - ); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $filesystem \Magento\Filesystem */ + $filesystem = $objectManager->get('Magento\Filesystem'); + $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); + $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/product_types\.xml$#')); + $fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles)); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); 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 cdf8e7082b7..06ddb67b5bc 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php @@ -32,12 +32,13 @@ class ResourcesConfigFilesTest extends \PHPUnit_Framework_TestCase protected function setUp() { - // List of all resources.xml - $xmlFiles = \Magento\TestFramework\Utility\Files::init()->getConfigFiles( - '{*/resources.xml,resources.xml}', - array('wsdl.xml', 'wsdl2.xml', 'wsi.xml'), - false - ); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $filesystem \Magento\Filesystem */ + $filesystem = $objectManager->get('Magento\Filesystem'); + $appDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); + $xmlFiles = $fileIteratorFactory->create($appDirectory, $appDirectory->search('#/resources\.xml$#')); + $fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles)); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ServiceCallsConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ServiceCallsConfigFilesTest.php index d15a5ea8e6f..17bc81c0771 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ServiceCallsConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ServiceCallsConfigFilesTest.php @@ -62,7 +62,9 @@ class ServiceCallsConfigFilesTest extends \PHPUnit_Framework_TestCase public function getServiceCallsConfigFiles() { return glob( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir('app') + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Filesystem') + ->getPath(\Magento\Filesystem::APP) . '/*/*/*/etc/service_calls.xml' ); } 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 58e76f0c5c0..65d8e1abcb6 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php @@ -38,9 +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); - /** @var $dirs \Magento\App\Dir */ - $dirs = $objectManager->get('Magento\App\Dir'); - $modulesDir = $dirs->getDir(\Magento\App\Dir::MODULES); + $modulesDir = $objectManager->get('Magento\Filesystem')->getPath(\Magento\Filesystem::MODULES); $fileList = glob($modulesDir . '/*/*/etc/adminhtml/system.xml'); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ThemeConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ThemeConfigFilesTest.php index f444b511f94..13e34e3ad8e 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ThemeConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ThemeConfigFilesTest.php @@ -40,13 +40,13 @@ class ThemeConfigFilesTest extends \Magento\TestFramework\TestCase\AbstractConfi /** * Returns a string that represents the path to the config file, starting in the app directory. * - * Format is glob, so * is allowed. + * Format is regex * * @return string */ - protected function _getConfigFilePathGlob() + protected function _getConfigFilePathRegex() { - return '/*/*/*/etc/page_layouts.xml'; + return '#/etc/page_layouts\.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 ced8f3c0bf0..4f026b1884f 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php @@ -35,9 +35,10 @@ class ViewConfigFilesTest extends \PHPUnit_Framework_TestCase */ public function testViewConfigFile($file) { - $domConfig = new \Magento\Config\Dom(file_get_contents($file)); + $domConfig = new \Magento\Config\Dom($file); $result = $domConfig->validate( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir('lib') + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Filesystem')->getPath(\Magento\Filesystem::LIB) . '/Magento/Config/etc/view.xsd', $errors ); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php index 0d04dad19a4..e1aea2b6329 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php @@ -162,7 +162,7 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity public function viewFilesFromModulesCodeDataProvider() { $allFiles = array(); - foreach (glob(__DIR__ . DS . '_files' . DS . 'view_files*.php') as $file) { + foreach (glob(__DIR__ . '/_files/view_files*.php') as $file) { $allFiles = array_merge($allFiles, include($file)); } return $this->_removeDisabledModulesFiles($allFiles); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/WidgetConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/WidgetConfigFilesTest.php index 5febe2f9967..1123fc1aea1 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/WidgetConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/WidgetConfigFilesTest.php @@ -40,13 +40,13 @@ class WidgetConfigFilesTest extends \Magento\TestFramework\TestCase\AbstractConf /** * Returns a string that represents the path to the config file, starting in the app directory. * - * Format is glob, so * is allowed. + * Format is regex * * @return string */ - protected function _getConfigFilePathGlob() + protected function _getConfigFilePathRegex() { - return '/*/*/*/etc/widget.xml'; + return '#/etc/widget\.xml$#'; } /** diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/_files/view_files_ce.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/_files/view_files_ce.php index 6547c18b0bd..b56373f81a7 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/_files/view_files_ce.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/_files/view_files_ce.php @@ -27,9 +27,7 @@ */ return array( array('adminhtml', 'images/ajax-loader.gif'), - array('adminhtml', 'Magento_Adminhtml::images/error_msg_icon.gif'), array('adminhtml', 'images/fam_bullet_disk.gif'), - array('adminhtml', 'Magento_Adminhtml::images/fam_bullet_success.gif'), array('adminhtml', 'images/fam_link.gif'), array('adminhtml', 'images/grid-cal.gif'), array('adminhtml', 'images/rule_chooser_trigger.gif'), 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 ea787fbb74d..9f3dea39adc 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php @@ -197,7 +197,7 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity return false; } $relativePath = trim($relativePath, '/\\'); - $parts = explode(DIRECTORY_SEPARATOR, $relativePath); + $parts = explode('/', $relativePath); $enabledModules = $this->_getEnabledModules(); foreach ($parts as $part) { if (!preg_match('/^[A-Z][[:alnum:]]*_[A-Z][[:alnum:]]*$/', $part)) { @@ -240,8 +240,8 @@ 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\App\Dir')->getDir('jslib') - . DIRECTORY_SEPARATOR . $file + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\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 9b0a355b60d..e316d6fa8eb 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php @@ -42,8 +42,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase } $this->_validateConfigFile( $file, - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir('lib') - . '/Magento/Config/etc/view.xsd' + $this->getPath(\Magento\Filesystem::LIB) . '/Magento/Config/etc/view.xsd' ); } @@ -54,8 +53,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase { $result = array(); $files = glob( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir('design') - . '/*/*/view.xml' + $this->getPath(\Magento\Filesystem::THEMES) . '/*/*/view.xml' ); foreach ($files as $file) { $result[$file] = array($file); @@ -79,8 +77,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase { $result = array(); $files = glob( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir('design') - . '/*/*', GLOB_ONLYDIR + $this->getPath(\Magento\Filesystem::THEMES) . '/*/*', GLOB_ONLYDIR ); foreach ($files as $themeDir) { $result[$themeDir] = array($themeDir); @@ -96,8 +93,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase { $this->_validateConfigFile( $file, - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir('lib') - . '/Magento/Config/etc/theme.xsd' + $this->getPath(\Magento\Filesystem::LIB) . '/Magento/Config/etc/theme.xsd' ); } @@ -122,8 +118,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase { $result = array(); $files = glob( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir('design') - . '/*/*/theme.xml' + $this->getPath(\Magento\Filesystem::THEMES) . '/*/*/theme.xml' ); foreach ($files as $file) { $result[$file] = array($file); @@ -148,4 +143,15 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase } $this->assertTrue($result, $message); } + + /** + * Get directory path by code + * + * @param string $code + * @return string + */ + protected function getPath($code) + { + return \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem')->getPath($code); + } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/ViewFileReferenceTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/ViewFileReferenceTest.php index 72117d0b084..cc3eb480c23 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/ViewFileReferenceTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/ViewFileReferenceTest.php @@ -267,7 +267,7 @@ class ViewFileReferenceTest extends \PHPUnit_Framework_TestCase */ protected static function _getArea($file) { - $file = str_replace(DIRECTORY_SEPARATOR, '/', $file); + $file = str_replace('\\', '/', $file); $areaPatterns = array( '#app/code/[^/]+/[^/]+/view/([^/]+)/#S', '#app/design/([^/]+)/#S', 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 09d54a26f53..bd2cacede15 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 @@ -59,10 +59,10 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase if (!extension_loaded('xsl')) { $this->markTestSkipped('XSL extension needed for XSLT Processor test'); } - $this->_testDir = realpath(__DIR__ . DS . '_files') . DS; + $this->_testDir = realpath(__DIR__ . '/_files') . '/'; - $dir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir'); - $this->_varDir = $dir->getDir(\Magento\App\Dir::VAR_DIR) . DS . 'references' . DS; + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); + $this->_varDir = $filesystem->getPath(\Magento\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 222f85a44b3..d3700966308 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 @@ -35,15 +35,11 @@ class ThemeControllerTest extends \Magento\Backend\Utility\Controller /** @var \Magento\Filesystem */ protected $_filesystem; - /** @var \Magento\App\Dir */ - protected $_dirs; - protected function setUp() { parent::setUp(); $this->_filesystem = $this->_objectManager->get('Magento\Filesystem'); - $this->_dirs = $this->_objectManager->get('Magento\App\Dir'); } /** @@ -61,6 +57,12 @@ 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, + array('path' => '/')); + $theme = $this->_objectManager->create('Magento\View\Design\ThemeInterface')->getCollection()->getFirstItem(); $this->getRequest()->setPost('id', $theme->getId()); @@ -81,13 +83,13 @@ class ThemeControllerTest extends \Magento\Backend\Utility\Controller * Copy file to writable directory. * Uploader can copy(upload) and then remove this temporary file. */ - $fileName = implode(DIRECTORY_SEPARATOR, array(__DIR__, '_files', 'simple-js-file.js')); - $varDir = $this->_dirs->getDir(\Magento\App\Dir::VAR_DIR); - $destinationFilePath = $varDir . DIRECTORY_SEPARATOR . 'simple-js-file.js'; + $fileName = __DIR__ . '/_files/simple-js-file.js'; + $varDir = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $rootDir = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $destinationFilePath = 'simple-js-file.js'; - $this->_filesystem->copy($fileName, $destinationFilePath); - $this->_filesystem->has($destinationFilePath); + $rootDir->copyFile($rootDir->getRelativePath($fileName), $destinationFilePath, $varDir); - return $destinationFilePath; + return $varDir->getAbsolutePath($destinationFilePath); } } diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/Config/ReaderTest.php index 4fd615055e9..0919cab168b 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/Config/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/Config/ReaderTest.php @@ -50,7 +50,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function testRead() { - $fileList = array(__DIR__ . '/../_files/page_layouts.xml'); + $fileList = array(file_get_contents(__DIR__ . '/../_files/page_layouts.xml')); $this->_fileResolverMock->expects($this->any()) ->method('get') ->will($this->returnValue($fileList)); @@ -77,8 +77,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function testMergeCompleteAndPartial() { $fileList = array( - __DIR__ . '/../_files/page_layouts.xml', - __DIR__ . '/../_files/page_layouts2.xml' + file_get_contents(__DIR__ . '/../_files/page_layouts.xml'), + file_get_contents(__DIR__ . '/../_files/page_layouts2.xml') ); $this->_fileResolverMock->expects($this->any()) ->method('get') diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/ConfigTest.php index 7f13dc37cdc..cabc1925eb3 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Layout/ConfigTest.php @@ -41,7 +41,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $fileResolverMock = $this->getMockBuilder('Magento\Config\FileResolverInterface') ->disableOriginalConstructor() ->getMock(); - $configFile = __DIR__ . '/_files/page_layouts.xml'; + $configFile = file_get_contents(__DIR__ . '/_files/page_layouts.xml'); $fileResolverMock->expects($this->any()) ->method('get') ->will($this->returnValue(array($configFile))); 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 bf50a24d53d..3092bf69e24 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php @@ -56,11 +56,37 @@ class StorageTest extends \PHPUnit_Framework_TestCase */ protected $_storageModel; + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected $directoryTmp; + + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected $directoryVar; + protected function setUp() { $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_filesystem = $this->_objectManager->get('Magento\Filesystem'); - $this->_filesystem->setIsAllowCreateDirectories(true); + + $directoryList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\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)); + + $this->_filesystem = $this->_objectManager->create( + 'Magento\Filesystem', array('directoryList' => $directoryList) + ); + $this->directoryVar = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->directoryTmp = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::TMP); /** @var $theme \Magento\View\Design\ThemeInterface */ $theme = $this->_objectManager->create('Magento\View\Design\ThemeInterface')->getCollection()->getFirstItem(); @@ -74,13 +100,14 @@ class StorageTest extends \PHPUnit_Framework_TestCase $this->_helperStorage = $this->_objectManager->get('Magento\Theme\Helper\Storage'); $this->_storageModel = $this->_objectManager->create('Magento\Theme\Model\Wysiwyg\Storage', array( - 'helper' => $this->_helperStorage + 'helper' => $this->_helperStorage, + 'filesystem' => $this->_filesystem )); } protected function tearDown() { - $this->_filesystem->delete($this->_helperStorage->getStorageRoot()); + $this->directoryTmp->delete($this->directoryTmp->getRelativePath($this->_helperStorage->getStorageRoot())); } /** @@ -92,14 +119,16 @@ class StorageTest extends \PHPUnit_Framework_TestCase $imagePath = realpath(__DIR__) . "/_files/theme/image/{$image}"; $tmpImagePath = $this->_copyFileToTmpCustomizationPath($imagePath); + $relativePath = $this->directoryTmp->getRelativePath($tmpImagePath); $method = $this->_getMethod('_createThumbnail'); - $result = $method->invokeArgs($this->_storageModel, array($tmpImagePath)); + $result = $method->invokeArgs($this->_storageModel, array($relativePath)); - $expectedResult = $this->_helperStorage->getThumbnailDirectory($tmpImagePath) - . \Magento\Filesystem::DIRECTORY_SEPARATOR . $image; + $expectedResult = $this->directoryTmp->getRelativePath( + $this->_helperStorage->getThumbnailDirectory($tmpImagePath) + . '/' . $image); $this->assertEquals($expectedResult, $result); - $this->assertFileExists($result); + $this->assertFileExists($this->directoryTmp->getAbsolutePath($result)); } /** @@ -123,11 +152,13 @@ class StorageTest extends \PHPUnit_Framework_TestCase protected function _copyFileToTmpCustomizationPath($sourceFile) { $targetFile = $this->_helperStorage->getStorageRoot() - . \Magento\Filesystem::DIRECTORY_SEPARATOR - . basename($sourceFile); - - $this->_filesystem->ensureDirectoryExists(pathinfo($targetFile, PATHINFO_DIRNAME)); - $this->_filesystem->copy($sourceFile, $targetFile); + . '/' . basename($sourceFile); + $this->directoryTmp->create(pathinfo($targetFile, PATHINFO_DIRNAME)); + $this->directoryVar->copyFile( + $this->directoryVar->getRelativePath($sourceFile), + $this->directoryTmp->getRelativePath($targetFile), + $this->directoryTmp + ); return $targetFile; } } diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php index e90ac067a87..a4832804622 100644 --- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php @@ -100,7 +100,8 @@ class AuthTest extends \Magento\Backend\Utility\Controller $this->getRequest()->setQuery('token', 'dummy')->setQuery('id', 1); $this->dispatch('backend/admin/auth/resetpassword'); $this->assertSessionMessages( - $this->equalTo(array('Your password reset link has expired.')), \Magento\Message\Factory::ERROR + $this->equalTo(array('Your password reset link has expired.')), + \Magento\Message\MessageInterface::TYPE_ERROR ); $this->assertRedirect(); } @@ -159,7 +160,8 @@ class AuthTest extends \Magento\Backend\Utility\Controller $this->getRequest()->setQuery('token', 'dummy')->setQuery('id', 1); $this->dispatch('backend/admin/auth/resetpasswordpost'); $this->assertSessionMessages( - $this->equalTo(array('Your password reset link has expired.')), \Magento\Message\Factory::ERROR + $this->equalTo(array('Your password reset link has expired.')), + \Magento\Message\MessageInterface::TYPE_ERROR ); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); @@ -203,7 +205,7 @@ class AuthTest extends \Magento\Backend\Utility\Controller $this->assertSessionMessages( $this->equalTo(array('Your password confirmation must match your password.')), - \Magento\Message\Factory::ERROR + \Magento\Message\MessageInterface::TYPE_ERROR ); $this->assertRedirect(); } diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php index 45316f34035..702acfd6518 100644 --- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php @@ -60,7 +60,7 @@ class UserTest extends \Magento\Backend\Utility\Controller $this->getRequest()->setPost('user_id', $userId); $this->dispatch('backend/admin/user/save'); $this->assertSessionMessages( - $this->equalTo(array('This user no longer exists.')), \Magento\Message\Factory::ERROR + $this->equalTo(array('This user no longer exists.')), \Magento\Message\MessageInterface::TYPE_ERROR ); $this->assertRedirect($this->stringContains('backend/admin/user/index/')); } @@ -72,7 +72,7 @@ class UserTest extends \Magento\Backend\Utility\Controller { $this->_createNew(); $this->assertSessionMessages( - $this->equalTo(array('You saved the user.')), \Magento\Message\Factory::SUCCESS + $this->equalTo(array('You saved the user.')), \Magento\Message\MessageInterface::TYPE_SUCCESS ); $this->assertRedirect($this->stringContains('backend/admin/user/index/')); } diff --git a/dev/tests/integration/testsuite/Magento/View/Asset/MergedTest.php b/dev/tests/integration/testsuite/Magento/View/Asset/MergedTest.php index 2231c1fd456..dff3cabb1ee 100644 --- a/dev/tests/integration/testsuite/Magento/View/Asset/MergedTest.php +++ b/dev/tests/integration/testsuite/Magento/View/Asset/MergedTest.php @@ -32,35 +32,32 @@ class MergedTest extends \PHPUnit_Framework_TestCase /** * Path to the public directory for view files * - * @var string + * @var \Magento\Filesystem\Directory\WriteInterface */ protected static $_themePublicDir; /** * Path to the public directory for merged view files * - * @var string + * @var \Magento\Filesystem\Directory\WriteInterface */ protected static $_viewPublicMergedDir; public static function setUpBeforeClass() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $service \Magento\View\Service */ - $service = $objectManager->get('Magento\View\Service'); - self::$_themePublicDir = $service->getPublicDir(); - - /** @var \Magento\App\Dir $dirs */ - $dirs = $objectManager->get('Magento\App\Dir'); - self::$_viewPublicMergedDir = $dirs->getDir(\Magento\App\Dir::PUB_VIEW_CACHE) - . DIRECTORY_SEPARATOR . \Magento\View\Asset\Merged::PUBLIC_MERGE_DIR; + /** @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); } protected function setUp() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\App\Dir::PARAM_APP_DIRS => array( - \Magento\App\Dir::THEMES => realpath(__DIR__ . '/../_files/design') + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::THEMES => array('path' => dirname(dirname(__DIR__)) . '/_files/design'), + \Magento\Filesystem::PUB => array('path' => BP), ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); @@ -70,9 +67,8 @@ class MergedTest extends \PHPUnit_Framework_TestCase protected function tearDown() { - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $filesystem->delete(self::$_themePublicDir . '/frontend'); - $filesystem->delete(self::$_viewPublicMergedDir); + self::$_themePublicDir->delete('frontend'); + self::$_viewPublicMergedDir->delete(\Magento\View\Asset\Merged::PUBLIC_MERGE_DIR); } /** @@ -107,7 +103,10 @@ class MergedTest extends \PHPUnit_Framework_TestCase */ public function testMerging($contentType, $files, $expectedFilename, $related = array()) { - $resultingFile = self::$_viewPublicMergedDir . '/' . $expectedFilename; + $this->markTestSkipped('Task: MAGETWO-18162'); + $resultingFile = self::$_viewPublicMergedDir->getAbsolutePath( + \Magento\View\Asset\Merged::PUBLIC_MERGE_DIR . '/' . $expectedFilename + ); $this->assertFileNotExists($resultingFile); $model = $this->_buildModel($files, $contentType); @@ -121,9 +120,7 @@ class MergedTest extends \PHPUnit_Framework_TestCase $this->assertFileExists($resultingFile); foreach ($related as $file) { - $this->assertFileExists( - self::$_themePublicDir . '/frontend/vendor_default/en_US/' . $file - ); + $this->assertFileExists(self::$_themePublicDir->getAbsolutePath('frontend/vendor_default/en_US/' . $file)); } } @@ -139,6 +136,7 @@ class MergedTest extends \PHPUnit_Framework_TestCase */ public function testMergingAndSigning($contentType, $files, $expectedFilename, $related = array()) { + $this->markTestSkipped('Task: MAGETWO-18162'); $model = $this->_buildModel($files, $contentType); $asset = $model->current(); @@ -148,9 +146,7 @@ class MergedTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expectedFilename, $mergedFileName); foreach ($related as $file) { - $this->assertFileExists( - self::$_themePublicDir . '/frontend/vendor_default/en_US/' . $file - ); + $this->assertFileExists(self::$_themePublicDir->getAbsolutePath('frontend/vendor_default/en_US/' . $file)); } } @@ -166,7 +162,7 @@ class MergedTest extends \PHPUnit_Framework_TestCase 'mage/calendar.css', 'css/file.css', ), - '67b062e295aeb5a09b62c86d2823632a.css', + 'e6ae894165d22b7d57a0f5644b6ef160.css', array( 'css/file.css', 'recursive.css', @@ -187,7 +183,7 @@ class MergedTest extends \PHPUnit_Framework_TestCase 'mage/calendar.js', 'scripts.js', ), - 'c1a0045f608acb03f57f285c162c9f95.js', + 'e81061cbad0d8b6fe328225d0df7dace.js', ), ); } 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 66720967479..b02487f98d8 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 @@ -49,8 +49,9 @@ class FallbackTest extends \PHPUnit_Framework_TestCase protected function setUp() { + $this->markTestSkipped('Task: MAGETWO-18162'); $this->_baseDir = realpath(__DIR__ . '/../../../_files/fallback'); - $this->_viewDir = $this->_baseDir . DIRECTORY_SEPARATOR . 'design'; + $this->_viewDir = $this->_baseDir . '/design'; } /** @@ -61,15 +62,24 @@ class FallbackTest extends \PHPUnit_Framework_TestCase protected function _buildModel() { // Prepare config with directories - $dirs = new \Magento\App\Dir( - $this->_baseDir, - array(), - array(\Magento\App\Dir::THEMES => $this->_viewDir) + $filesystem = Bootstrap::getObjectManager()->create( + 'Magento\Filesystem', + array( + 'directoryList' => Bootstrap::getObjectManager()->create( + 'Magento\Filesystem\DirectoryList', + array( + 'root' => $this->_baseDir, + 'directories' => array( + \Magento\Filesystem::THEMES => array('path' => $this->_viewDir) + ) + ) + ) + ) ); return Bootstrap::getObjectManager()->create( 'Magento\View\Design\FileResolution\Strategy\Fallback', - array('fallbackFactory' => new Factory($dirs)) + array('fallbackFactory' => new Factory($filesystem)) ); } @@ -85,8 +95,7 @@ class FallbackTest extends \PHPUnit_Framework_TestCase /** @var $collection \Magento\Core\Model\Theme\Collection */ $collection = Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Collection'); - $themeModel = $collection->setBaseDir($this->_viewDir) - ->addDefaultPattern() + $themeModel = $collection->addDefaultPattern() ->addFilter('theme_path', $themePath) ->addFilter('area', $area) ->getFirstItem(); @@ -108,7 +117,6 @@ class FallbackTest extends \PHPUnit_Framework_TestCase $model = $this->_buildModel($area, $themePath, null); $themeModel = $this->_getThemeModel($area, $themePath); - $expectedFilename = str_replace('/', DS, $expectedFilename); $actualFilename = $model->getFile($area, $themeModel, $file, $module); if ($expectedFilename) { $this->assertStringMatchesFormat($expectedFilename, $actualFilename); @@ -166,7 +174,6 @@ class FallbackTest extends \PHPUnit_Framework_TestCase $model = $this->_buildModel($area, $themePath, $locale); $themeModel = $this->_getThemeModel($area, $themePath); - $expectedFilename = str_replace('/', DIRECTORY_SEPARATOR, $expectedFilename); $actualFilename = $model->getFile($area, $themeModel, 'i18n/' . $locale . '.csv'); if ($expectedFilename) { @@ -213,7 +220,6 @@ class FallbackTest extends \PHPUnit_Framework_TestCase $model = $this->_buildModel(); $themeModel = $this->_getThemeModel($area, $themePath); - $expectedFilename = str_replace('/', DIRECTORY_SEPARATOR, $expectedFilename); $actualFilename = $model->getViewFile($area, $themeModel, $locale, $file, $module); if ($expectedFilename) { $this->assertStringMatchesFormat($expectedFilename, $actualFilename); diff --git a/dev/tests/integration/testsuite/Magento/View/Element/AbstractBlockTest.php b/dev/tests/integration/testsuite/Magento/View/Element/AbstractBlockTest.php index 55075fc6733..810574e3613 100644 --- a/dev/tests/integration/testsuite/Magento/View/Element/AbstractBlockTest.php +++ b/dev/tests/integration/testsuite/Magento/View/Element/AbstractBlockTest.php @@ -27,6 +27,8 @@ namespace Magento\View\Element; +use Magento\Filesystem\DirectoryList; + /** * @magentoAppIsolation enabled */ @@ -62,13 +64,13 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase */ public function testCssWithWrongImage() { - $dirPath = __DIR__ . DIRECTORY_SEPARATOR . '_files'; - /** @var $dirs \Magento\App\Dir */ - $dirs = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir'); - - $prepareFileName = new \ReflectionMethod($dirs, '_setDir'); - $prepareFileName->setAccessible(true); - $prepareFileName->invoke($dirs, \Magento\App\Dir::THEMES, $dirPath); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\Filesystem $filesystem */ + $relativePath = $objectManager->get('Magento\Filesystem')->getDirectoryRead(\Magento\Filesystem::ROOT) + ->getRelativePath(__DIR__ . '/_files'); + /** @var $directoryList \Magento\Filesystem\DirectoryList */ + $directoryList = $objectManager->get('Magento\Filesystem\DirectoryList'); + $directoryList->addDirectory(\Magento\Filesystem::THEMES, array('path' => $relativePath)); $cssUrl = $this->_block->getViewFileUrl('css/wrong.css', array( 'area' => 'frontend', @@ -506,21 +508,6 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase ); } - public function testHelper() - { - // Without layout - $this->assertInstanceOf('Magento\Core\Helper\Data', $this->_block->helper('Magento\Core\Helper\Data')); - - // With layout - $helper = $this->_block->helper('Magento\Core\Helper\Data'); - - try { - $this->assertInstanceOf('Magento\Core\Helper\Data', $helper); - } catch (\Exception $e) { - throw $e; - } - } - public function testFormatDate() { $locale = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( diff --git a/dev/tests/integration/testsuite/Magento/View/FileSystemTest.php b/dev/tests/integration/testsuite/Magento/View/FileSystemTest.php index 5f9979a1e30..649f44fabbd 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\App\Dir::PARAM_APP_DIRS => array( - \Magento\App\Dir::THEMES => dirname(__DIR__) . '/Core/Model/_files/design' + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/Core/Model/_files/design') ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); @@ -81,7 +81,6 @@ class FileSystemTest extends \PHPUnit_Framework_TestCase */ protected function _testExpectedVersusActualFilename($expected, $actual) { - $expected = str_replace('/', DIRECTORY_SEPARATOR, $expected); $this->assertStringMatchesFormat($expected, $actual); $this->assertFileExists($actual); } diff --git a/dev/tests/integration/testsuite/Magento/View/PublicationTest.php b/dev/tests/integration/testsuite/Magento/View/PublicationTest.php index a6d6b4436dc..ba62517d97c 100644 --- a/dev/tests/integration/testsuite/Magento/View/PublicationTest.php +++ b/dev/tests/integration/testsuite/Magento/View/PublicationTest.php @@ -49,23 +49,22 @@ class PublicationTest extends \PHPUnit_Framework_TestCase protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); - $this->_viewService = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\View\Service'); - $this->_fileSystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\View\FileSystem'); - $this->_viewUrl = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\View\Url'); - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\View\DesignInterface'); + $this->markTestSkipped(); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get('Magento\App\State')->setAreaCode('frontend'); + $this->_viewService = $objectManager->create('Magento\View\Service'); + $this->_fileSystem = $objectManager->create('Magento\View\FileSystem'); + $this->_viewUrl = $objectManager->create('Magento\View\Url'); + $this->_model = $objectManager->get('Magento\View\DesignInterface'); } protected function tearDown() { + /** @var \Magento\Filesystem $filesystem */ $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $publicDir = $this->_viewService->getPublicDir(); - $filesystem->delete($publicDir . '/adminhtml'); - $filesystem->delete($publicDir . '/frontend'); + $publicDir = $filesystem->getDirectoryWrite(\Magento\Filesystem::STATIC_VIEW); + $publicDir->delete('adminhtml'); + $publicDir->delete('frontend'); $this->_model = null; } @@ -74,9 +73,9 @@ class PublicationTest extends \PHPUnit_Framework_TestCase */ public function testGetPublicDir() { - /** @var $dirs \Magento\App\Dir */ - $dirs = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir'); - $expectedPublicDir = $dirs->getDir(\Magento\App\Dir::STATIC_VIEW); + /** @var $filesystem \Magento\Filesystem */ + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); + $expectedPublicDir = $filesystem->getPath(\Magento\Filesystem::STATIC_VIEW); $this->assertEquals($expectedPublicDir, $this->_viewService->getPublicDir()); } @@ -245,6 +244,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase */ public function testGetPublicFilePath($file, $designParams, $expectedFile) { + $this->markTestSkipped('Task: MAGETWO-18162'); $this->_initTestTheme(); $expectedFile = $this->_viewService->getPublicDir() . '/' . $expectedFile; @@ -295,6 +295,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase */ public function testPublishCssFileFromTheme() { + $this->markTestSkipped('Task: MAGETWO-18162'); $this->_initTestTheme(); $expectedFiles = array( 'css/file.css', @@ -330,6 +331,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase public function testPublishCssFileFromModule( $cssViewFile, $designParams, $expectedCssFile, $expectedCssContent, $expectedRelatedFiles ) { + $this->markTestSkipped('Task: MAGETWO-18162'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $this->_viewUrl->getViewFileUrl($cssViewFile, $designParams); @@ -438,8 +440,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase { $appInstallDir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir(); \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\App\Dir::PARAM_APP_DIRS => array( - \Magento\App\Dir::THEMES => "$appInstallDir/media_for_change", + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::THEMES => array('path' => "$appInstallDir/media_for_change"), ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); @@ -529,8 +531,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase { $appInstallDir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir(); \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\App\Dir::PARAM_APP_DIRS => array( - \Magento\App\Dir::THEMES => "$appInstallDir/media_for_change", + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::THEMES => array('path' => "$appInstallDir/media_for_change"), ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); @@ -577,8 +579,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase protected function _initTestTheme($allowDuplication = null) { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\App\Dir::PARAM_APP_DIRS => array( - \Magento\App\Dir::THEMES => dirname(__DIR__) . '/Core/Model/_files/design/' + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/Core/Model/_files/design/') ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); @@ -614,8 +616,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase public function testCssWithBase64Data() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\App\Dir::PARAM_APP_DIRS => array( - \Magento\App\Dir::THEMES => dirname(__DIR__) . '/Core/Model/_files/design/' + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/Core/Model/_files/design/') ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadAreaPart( @@ -626,8 +628,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase /** @var $themeCollection \Magento\Core\Model\Theme\Collection */ $themeCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Collection'); - $theme = $themeCollection->setBaseDir(dirname(__DIR__) . '/Core/Model/_files/design/') - ->addTargetPattern(implode(DIRECTORY_SEPARATOR, array('frontend', 'vendor_default', 'theme.xml'))) + $theme = $themeCollection + ->addTargetPattern('frontend/vendor_default/theme.xml') ->getFirstItem() ->save(); @@ -642,7 +644,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase // publish static content $this->_viewUrl->getViewFileUrl('css/base64.css', $params); - $this->assertFileEquals($filePath, str_replace('/', DIRECTORY_SEPARATOR, "{$publishedPath}/css/base64.css")); + $this->assertFileEquals($filePath, "{$publishedPath}/css/base64.css"); $this->_model->setDesignTheme(\Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\View\Design\ThemeInterface')); @@ -672,8 +674,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase public function testGetViewFilePublicPathExistingFile() { $filePath = 'mage/mage.js'; - $expectedFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::PUB_LIB) . '/' . $filePath; + $expectedFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem') + ->getPath(\Magento\Filesystem::PUB_LIB) . '/' . $filePath; $this->assertFileExists($expectedFile, 'Please verify existence of public library file'); $actualFile = $this->_viewUrl->getViewFilePublicPath($filePath); diff --git a/dev/tests/integration/testsuite/Magento/View/_files/design/frontend/test_default/Magento_Core/layout_test_handle_sample.xml b/dev/tests/integration/testsuite/Magento/View/_files/design/frontend/test_default/Magento_Core/layout_test_handle_sample.xml index 0ee1ef27ceb..3cf9822b6f4 100644 --- a/dev/tests/integration/testsuite/Magento/View/_files/design/frontend/test_default/Magento_Core/layout_test_handle_sample.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/design/frontend/test_default/Magento_Core/layout_test_handle_sample.xml @@ -27,8 +27,8 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Adminhtml\Block\Page" name="root" output="1" template="page.phtml"> - <block class="Magento\Adminhtml\Block\Page\Head" name="head" as="head" template="page/head.phtml"> + <block class="Magento\Backend\Block\Page" name="root" output="1" template="page.phtml"> + <block class="Magento\Backend\Block\Page\Head" name="head" as="head" template="page/head.phtml"> <action method="setTitle"> <argument translate="true" name="title" xsi:type="string">Magento Admin</argument> </action> @@ -43,7 +43,7 @@ </action> <block class="Magento\View\Element\Html\Calendar" name="head.calendar" as="calendar" template="page/js/calendar.phtml"/> </block> - <block class="Magento\Adminhtml\Block\Page\Header" name="header" as="header"/> + <block class="Magento\Backend\Block\Page\Header" name="header" as="header"/> <block class="Magento\Backend\Block\Menu" name="menu" as="menu"/> <block class="Magento\View\Element\Messages" name="messages" as="messages"/> <block class="Magento\View\Element\Text" as="no_name"/> diff --git a/dev/tests/integration/testsuite/Magento/View/_files/design/themes.php b/dev/tests/integration/testsuite/Magento/View/_files/design/themes.php index 513f228949e..c709cc84481 100644 --- a/dev/tests/integration/testsuite/Magento/View/_files/design/themes.php +++ b/dev/tests/integration/testsuite/Magento/View/_files/design/themes.php @@ -39,5 +39,5 @@ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Registration'); $registration->register( __DIR__, - implode(DIRECTORY_SEPARATOR, array('*', '*', 'theme.xml')) + implode('/', array('*', '*', 'theme.xml')) ); diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/Integration/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/Integration/ReaderTest.php index b60ba7e6a3d..125061f7bc3 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/Integration/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/Integration/ReaderTest.php @@ -52,8 +52,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function testRead() { $configFiles = array( - realpath(__DIR__ . '/_files/apiA.xml'), - realpath(__DIR__ . '/_files/apiB.xml') + file_get_contents(realpath(__DIR__ . '/_files/apiA.xml')), + file_get_contents(realpath(__DIR__ . '/_files/apiB.xml')) ); $this->_fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($configFiles)); diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/ReaderTest.php index 874f8e6eccb..4d54de92fca 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/ReaderTest.php @@ -52,8 +52,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function testRead() { $configFiles = array( - realpath(__DIR__ . '/_files/webapiA.xml'), - realpath(__DIR__ . '/_files/webapiB.xml') + file_get_contents(realpath(__DIR__ . '/_files/webapiA.xml')), + file_get_contents(realpath(__DIR__ . '/_files/webapiB.xml')) ); $this->_fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($configFiles)); 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 161a3aaac44..ce92806d451 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php @@ -37,25 +37,41 @@ class DataTest extends \PHPUnit_Framework_TestCase */ protected $_configData; + /** + * @var \Magento\Filesystem\DirectoryList + */ + protected $directoryList; + public function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\App\Dir $dirs */ - $dirs = $objectManager->create( - 'Magento\App\Dir', array( - 'baseDir' => BP, - 'dirs' => array( - \Magento\App\Dir::MODULES => __DIR__ . '/_files/code', - \Magento\App\Dir::CONFIG => __DIR__ . '/_files/code', - \Magento\App\Dir::THEMES => __DIR__ . '/_files/design', + /** @var \Magento\Filesystem $filesystem */ + $filesystem = $objectManager->create( + 'Magento\Filesystem', + array('directoryList' => $objectManager->create( + 'Magento\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') + ) + ) ) ) ); + $this->directoryList = $objectManager->get('Magento\Filesystem\DirectoryList'); + $dirPath = ltrim(str_replace($this->directoryList->getRoot(), '', str_replace('\\', '/', __DIR__)) + . '/_files', '/'); + $this->directoryList->addDirectory(\Magento\Filesystem::MODULES, array('path' => $dirPath)); + /** @var \Magento\Module\Declaration\FileResolver $modulesDeclarations */ $modulesDeclarations = $objectManager->create( 'Magento\Module\Declaration\FileResolver', array( - 'applicationDirs' => $dirs, + 'filesystem' => $filesystem, + 'fileIteratorFactory' => $objectManager->create('Magento\Config\FileIteratorFactory') ) ); @@ -77,7 +93,8 @@ class DataTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Module\Dir\Reader $moduleReader */ $moduleReader = $objectManager->create( 'Magento\Module\Dir\Reader', array( - 'moduleList' => $modulesList + 'moduleList' => $modulesList, + 'filesystem' => $filesystem ) ); $moduleReader->setModuleDir('Magento_Test', 'etc', __DIR__ . '/_files/code/Magento/Test/etc'); @@ -86,7 +103,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $fileResolver = $objectManager->create( 'Magento\Widget\Model\Config\FileResolver', array( 'moduleReader' => $moduleReader, - 'applicationDirs' => $dirs, + 'filesystem' => $filesystem, ) ); 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 9cc1bdb8002..232b6903a7a 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/FileResolverTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/FileResolverTest.php @@ -32,14 +32,30 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase */ private $_object; - /** @var \Magento\App\Dir/PHPUnit_Framework_MockObject_MockObject */ - private $_applicationDirsMock; + /** + * @var \Magento\Filesystem\DirectoryList + */ + protected $directoryList; public function setUp() { - $this->_applicationDirsMock = $this->getMockBuilder('Magento\App\Dir') - ->disableOriginalConstructor() - ->getMock(); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\Filesystem $filesystem */ + $filesystem = $objectManager->create( + 'Magento\Filesystem', + array('directoryList' => $objectManager->create( + 'Magento\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/'), + ) + ) + ) + ) + ); $moduleListMock = $this->getMockBuilder('Magento\Module\ModuleListInterface') ->disableOriginalConstructor() @@ -52,36 +68,39 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase 'active' => 'true' )))); - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $moduleReader = $objectManager->create('Magento\Module\Dir\Reader', array( - 'moduleList' => $moduleListMock + 'moduleList' => $moduleListMock, + 'filesystem' => $filesystem )); $moduleReader->setModuleDir('Magento_Test', 'etc', __DIR__ . '/_files/code/Magento/Test/etc'); $this->_object = $objectManager->create('Magento\Widget\Model\Config\FileResolver', array( 'moduleReader' => $moduleReader, - 'applicationDirs' => $this->_applicationDirsMock + 'filesystem' => $filesystem )); + + $this->directoryList = $objectManager->get('Magento\Filesystem\DirectoryList'); + $dirPath = ltrim(str_replace($this->directoryList->getRoot(), '', str_replace('\\', '/', __DIR__)) + . '/_files', '/'); + $this->directoryList->addDirectory(\Magento\Filesystem::MODULES, array('path' => $dirPath)); + } public function testGetDesign() { - $this->_applicationDirsMock->expects($this->any()) - ->method('getDir') - ->will($this->returnValue(__DIR__ . '/_files/design')); - $widgetConfigs = $this->_object->get('widget.xml', 'design'); - $expected = realpath(__DIR__ . '/_files/design/frontend/Test/etc/widget.xml'); + $widgetConfigs = $this->_object->get('widget.xml', 'design'); + $expected = realpath(__DIR__ . '/_files/design/frontend/Test/etc/widget.xml'); + $actual = $widgetConfigs->key(); $this->assertCount(1, $widgetConfigs); - $this->assertEquals($expected, realpath($widgetConfigs[0])); + $this->assertStringEndsWith($actual, $expected); } public function testGetGlobal() { - $this->_applicationDirsMock->expects($this->any()) - ->method('getDir') - ->will($this->returnValue(__DIR__ . '/_files/code')); - $widgetConfigs = $this->_object->get('widget.xml', 'global'); - $expected = realpath(__DIR__ . '/_files/code/Magento/Test/etc/widget.xml'); + $widgetConfigs = $this->_object->get('widget.xml', 'global'); + $expected = realpath(__DIR__ . '/_files/code/Magento/Test/etc/widget.xml'); + $actual = $widgetConfigs->key(); $this->assertCount(1, $widgetConfigs); - $this->assertEquals($expected, realpath($widgetConfigs[0])); + $this->assertStringEndsWith($actual, $expected); } } 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 92601066521..f62cd9b088f 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php @@ -27,33 +27,37 @@ namespace Magento\Widget\Model\Config; */ class ReaderTest extends \PHPUnit_Framework_TestCase { + /** + * @var \Magento\Filesystem\DirectoryList + */ + protected $directoryList; + /** * @var \Magento\Widget\Model\Config\Reader */ protected $_model; + public function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\App\Dir $dirs */ - $dirs = $objectManager->create( - 'Magento\App\Dir', array( - 'baseDir' => BP, - 'dirs' => array( - \Magento\App\Dir::MODULES => __DIR__ . '/_files/code', - \Magento\App\Dir::CONFIG => __DIR__ . '/_files/code' - ) - ) - ); + + $this->directoryList = $objectManager->get('Magento\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\Filesystem::CONFIG, array('path' => $dirPath)); + $this->directoryList->addDirectory(\Magento\Filesystem::ROOT, array('path' => $dirPath)); + + $filesystem = $objectManager->create('Magento\Filesystem', array('directoryList' => $this->directoryList)); /** @var \Magento\Module\Declaration\FileResolver $modulesDeclarations */ $modulesDeclarations = $objectManager->create( 'Magento\Module\Declaration\FileResolver', array( - 'applicationDirs' => $dirs, + 'filesystem' => $filesystem, ) ); - /** @var \Magento\Module\Declaration\Reader\Filesystem $filesystemReader */ $filesystemReader = $objectManager->create( 'Magento\Module\Declaration\Reader\Filesystem', array( @@ -71,7 +75,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Module\Dir\Reader $moduleReader */ $moduleReader = $objectManager->create( 'Magento\Module\Dir\Reader', array( - 'moduleList' => $modulesList + 'moduleList' => $modulesList, + 'filesystem' => $filesystem, ) ); $moduleReader->setModuleDir('Magento_Test', 'etc', __DIR__ . '/_files/code/Magento/Test/etc'); @@ -80,6 +85,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $fileResolver = $objectManager->create( 'Magento\Widget\Model\Config\FileResolver', array( 'moduleReader' => $moduleReader, + 'filesystem' => $filesystem ) ); @@ -104,7 +110,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function testReadFile() { - $result = $this->_model->readFile(__DIR__ . '/_files/code/Magento/Test/etc/widget.xml'); + $file = file_get_contents(__DIR__ . '/_files/code/Magento/Test/etc/widget.xml'); + $result = $this->_model->readFile($file); $expected = include '_files/expectedGlobalArray.php'; $this->assertEquals($expected, $result); } @@ -112,8 +119,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function testMergeCompleteAndPartial() { $fileList = array( - __DIR__ . '/_files/widgetFirst.xml', - __DIR__ . '/_files/widgetSecond.xml' + __DIR__ . '/_files/widgetFirst.xml' => file_get_contents(__DIR__ . '/_files/widgetFirst.xml'), + __DIR__ . '/_files/widgetSecond.xml' => file_get_contents(__DIR__ . '/_files/widgetSecond.xml') ); $fileResolverMock = $this->getMockBuilder('Magento\Config\FileResolverInterface') ->setMethods(array('get')) diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php index dd06f01af15..91e536bea73 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php @@ -65,16 +65,16 @@ class WidgetTest extends \PHPUnit_Framework_TestCase $this->markTestIncomplete('Functionality is failed because widget' . ' "app/design/frontend/magento_iphone_html5/etc/widget.xml" replaces' . ' "new_products" widget in Catalog module'); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get('Magento\Core\Model\App') ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setDesignTheme('magento_backend'); - $expectedPubFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::STATIC_VIEW) . "/adminhtml/magento_backend/en_US/{$expectedFile}"; + $objectManager->get('Magento\View\DesignInterface')->setDesignTheme('magento_backend'); + $expectedPubFile = $objectManager->get('Magento\Filesystem') + ->getPath(\Magento\Filesystem::STATIC_VIEW) . "/adminhtml/magento_backend/en_US/{$expectedFile}"; if (file_exists($expectedPubFile)) { unlink($expectedPubFile); } - $expectedPubFile = str_replace('/', DIRECTORY_SEPARATOR, $expectedPubFile); + $url = $this->_model->getPlaceholderImageUrl($type); $this->assertStringEndsWith($expectedFile, $url); $this->assertFileExists($expectedPubFile); @@ -106,16 +106,11 @@ class WidgetTest extends \PHPUnit_Framework_TestCase */ public function testGetPlaceholderImageUrlAtTheme() { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\App\Dir $dir */ - $dir = $objectManager->get('Magento\App\Dir'); - - $property = new \ReflectionProperty($dir, '_dirs'); - $property->setAccessible(true); - $dirs = $property->getValue($dir); - $dirs[\Magento\App\Dir::THEMES] = dirname(__DIR__) . '/_files/design'; - $property->setValue($dir, $dirs); - + \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( + \Magento\Filesystem::PARAM_APP_DIRS => array( + \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/_files/design') + ) + )); $actualFile = $this->testGetPlaceholderImageUrl( 'Magento\Catalog\Block\Product\Widget\NewWidget', 'Magento_Catalog/images/product_widget_new.gif' diff --git a/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php b/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php index fdbf1d76264..cc14299d49c 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php +++ b/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php @@ -30,6 +30,6 @@ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Registration'); $registration->register( - __DIR__ . DIRECTORY_SEPARATOR . 'design', - implode(DIRECTORY_SEPARATOR, array('*', '*', 'theme.xml')) + __DIR__ . '/design', + '*/*/theme.xml' ); diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php index 89b68ab5f80..31fc302ce60 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php @@ -44,7 +44,11 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Tax\Helper\Data'), $objectManager->get('Magento\Catalog\Helper\Data'), $objectManager->get('Magento\Math\Random'), + $objectManager->get('Magento\Checkout\Helper\Cart'), $objectManager->get('Magento\Wishlist\Helper\Data'), + $objectManager->get('Magento\Catalog\Helper\Product\Compare'), + $objectManager->get('Magento\Theme\Helper\Layout'), + $objectManager->get('Magento\Catalog\Helper\Image'), $objectManager->get('Magento\Customer\Model\Session'), $objectManager->get('Magento\Catalog\Model\ProductFactory'), )); diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php index 82c7b3ff9cf..5660db77498 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php @@ -34,6 +34,11 @@ class IndexTest extends \Magento\TestFramework\TestCase\AbstractController */ protected $_customerSession; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $_messages; + protected function setUp() { parent::setUp(); @@ -41,6 +46,10 @@ class IndexTest extends \Magento\TestFramework\TestCase\AbstractController $this->_customerSession = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Customer\Model\Session', array($logger)); $this->_customerSession->login('customer@example.com', 'password'); + + $this->_messages = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Message\ManagerInterface'); + } protected function tearDown() @@ -80,13 +89,13 @@ class IndexTest extends \Magento\TestFramework\TestCase\AbstractController public function testAddActionProductNameXss() { $this->dispatch('wishlist/index/add/product/1?nocookie=1'); - $messages = $this->_customerSession->getMessages()->getItems(); + $messages = $this->_messages->getMessages()->getItems(); $isProductNamePresent = false; foreach ($messages as $message) { - if (strpos($message->getCode(), '<script>alert("xss");</script>') !== false) { + if (strpos($message->getText(), '<script>alert("xss");</script>') !== false) { $isProductNamePresent = true; } - $this->assertNotContains('<script>alert("xss");</script>', (string)$message->getCode()); + $this->assertNotContains('<script>alert("xss");</script>', (string)$message->getText()); } $this->assertTrue($isProductNamePresent, 'Product name was not found in session messages'); } diff --git a/dev/tests/js/run_js_tests.php b/dev/tests/js/run_js_tests.php index d2dae7fa82c..d70eb490cea 100644 --- a/dev/tests/js/run_js_tests.php +++ b/dev/tests/js/run_js_tests.php @@ -134,7 +134,11 @@ if (count($serveFiles) > 0) { fclose($fh); $testOutput = __DIR__ . '/test-output'; -\Magento\Io\File::rmdirRecursive($testOutput); + +$filesystemAdapter = new \Magento\Filesystem\Driver\File(); +if ($filesystemAdapter->isExists($testOutput)) { + $filesystemAdapter->deleteDirectory($testOutput); +} mkdir($testOutput); $command diff --git a/dev/tests/performance/framework/Magento/TestFramework/Application.php b/dev/tests/performance/framework/Magento/TestFramework/Application.php index 2c85ec361e6..0846f9e518d 100644 --- a/dev/tests/performance/framework/Magento/TestFramework/Application.php +++ b/dev/tests/performance/framework/Magento/TestFramework/Application.php @@ -194,7 +194,10 @@ class Application */ protected function _updateFilesystemPermissions() { - \Magento\Io\File::chmodRecursive($this->getObjectManager()->get('Magento\App\Dir')->getDir('var'), 0777); + /** @var \Magento\Filesystem\Directory\Write $varDirectory */ + $varDirectory = $this->getObjectManager()->get('Magento\Filesystem') + ->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $varDirectory->changePermissions('', 0777); } /** diff --git a/dev/tests/performance/framework/Magento/TestFramework/Performance/Bootstrap.php b/dev/tests/performance/framework/Magento/TestFramework/Performance/Bootstrap.php index eb2d3e94828..79b17f7f0a7 100644 --- a/dev/tests/performance/framework/Magento/TestFramework/Performance/Bootstrap.php +++ b/dev/tests/performance/framework/Magento/TestFramework/Performance/Bootstrap.php @@ -60,8 +60,15 @@ class Bootstrap public function cleanupReports() { $reportDir = $this->_config->getReportDir(); - if (file_exists($reportDir) && !\Magento\Io\File::rmdirRecursive($reportDir)) { - throw new \Magento\Exception("Cannot cleanup reports directory '$reportDir'."); + try { + $filesystemAdapter = new \Magento\Filesystem\Driver\File(); + if ($filesystemAdapter->isExists($reportDir)) { + $filesystemAdapter->deleteDirectory($reportDir); + } + } catch (\Magento\Filesystem\FilesystemException $e) { + if (file_exists($reportDir)) { + throw new \Magento\Exception("Cannot cleanup reports directory '$reportDir'."); + } } mkdir($reportDir, 0777, true); } diff --git a/dev/tests/performance/framework/Magento/TestFramework/Performance/Config.php b/dev/tests/performance/framework/Magento/TestFramework/Performance/Config.php index b3903d70e34..b7fb35b5fdc 100644 --- a/dev/tests/performance/framework/Magento/TestFramework/Performance/Config.php +++ b/dev/tests/performance/framework/Magento/TestFramework/Performance/Config.php @@ -146,7 +146,7 @@ class Config */ protected function _getTestsRelativePath($path) { - return $this->_testsBaseDir . DIRECTORY_SEPARATOR . $path; + return $this->_testsBaseDir . '/' . $path; } /** diff --git a/dev/tests/performance/framework/Magento/TestFramework/Performance/Testsuite.php b/dev/tests/performance/framework/Magento/TestFramework/Performance/Testsuite.php index 56450dbeb01..49c3a634e43 100644 --- a/dev/tests/performance/framework/Magento/TestFramework/Performance/Testsuite.php +++ b/dev/tests/performance/framework/Magento/TestFramework/Performance/Testsuite.php @@ -153,7 +153,7 @@ class Testsuite */ protected function _getScenarioReportFile(\Magento\TestFramework\Performance\Scenario $scenario) { - $basePath = $this->_config->getReportDir() . DIRECTORY_SEPARATOR + $basePath = $this->_config->getReportDir() . '/' . pathinfo($scenario->getFile(), PATHINFO_FILENAME); $iteration = 1; do { diff --git a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/BootstrapTest.php b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/BootstrapTest.php index f6ec376929b..a5997afbbbc 100644 --- a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/BootstrapTest.php +++ b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/BootstrapTest.php @@ -34,7 +34,10 @@ class BootstrapTest extends \PHPUnit_Framework_TestCase { // Delete a directory, where tests do some temporary work $tmpDir = $this->_getBaseFixtureDir() . '/config_dist/tmp'; - \Magento\Io\File::rmdirRecursive($tmpDir); + $filesystemAdapter = new \Magento\Filesystem\Driver\File(); + if ($filesystemAdapter->isExists($tmpDir)) { + $filesystemAdapter->deleteDirectory($tmpDir); + } } /** diff --git a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/ConfigTest.php b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/ConfigTest.php index 883515495c6..e96ba66176f 100644 --- a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/ConfigTest.php +++ b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/ConfigTest.php @@ -46,7 +46,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_fixtureDir = __DIR__ . DIRECTORY_SEPARATOR . '_files'; + $this->_fixtureDir = __DIR__ . '/_files'; $this->_fixtureConfigData = require $this->_fixtureDir . '/config_data.php'; $this->_object = new \Magento\TestFramework\Performance\Config( $this->_fixtureConfigData, $this->_fixtureDir, $this->_getFixtureAppBaseDir() @@ -78,7 +78,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ protected function _getFixtureAppBaseDir() { - return __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'app_base_dir'; + return __DIR__ . '/_files/app_base_dir'; } /** @@ -95,49 +95,49 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ), 'invalid scenarios format' => array( require __DIR__ . '/_files/config_data_invalid_scenarios_format.php', - __DIR__ . DIRECTORY_SEPARATOR . '_files', + __DIR__ . '/_files', 'InvalidArgumentException', "'scenario' => 'scenarios' option must be an array", ), 'no scenario title' => array( require __DIR__ . '/_files/config_no_title.php', - __DIR__ . DIRECTORY_SEPARATOR . '_files', + __DIR__ . '/_files', 'InvalidArgumentException', 'Scenario must have a title', ), 'bad users scenario argument' => array( require __DIR__ . '/_files/config_bad_users.php', - __DIR__ . DIRECTORY_SEPARATOR . '_files', + __DIR__ . '/_files', 'InvalidArgumentException', "Scenario 'Scenario' must have a positive integer argument 'users'.", ), 'bad loops scenario argument' => array( require __DIR__ . '/_files/config_bad_loops.php', - __DIR__ . DIRECTORY_SEPARATOR . '_files', + __DIR__ . '/_files', 'InvalidArgumentException', "Scenario 'Scenario' must have a positive integer argument 'loops'.", ), 'invalid scenario fixtures format' => array( require __DIR__ . '/_files/config_invalid_fixtures_format.php', - __DIR__ . DIRECTORY_SEPARATOR . '_files', + __DIR__ . '/_files', 'InvalidArgumentException', "'fixtures' for scenario 'Scenario' must be represented by an array", ), 'no scenario file defined' => array( require __DIR__ . '/_files/config_no_file_defined.php', - __DIR__ . DIRECTORY_SEPARATOR . '_files', + __DIR__ . '/_files', 'InvalidArgumentException', "File is not defined for scenario 'Scenario'", ), 'non-existing scenario file' => array( require __DIR__ . '/_files/config_non_existing_file.php', - __DIR__ . DIRECTORY_SEPARATOR . '_files', + __DIR__ . '/_files', 'InvalidArgumentException', "File non_existing_file.jmx doesn't exist for scenario 'Scenario'", ), 'non-existing scenario fixture' => array( require __DIR__ . '/_files/config_non_existing_fixture.php', - __DIR__ . DIRECTORY_SEPARATOR . '_files', + __DIR__ . '/_files', 'InvalidArgumentException', "Fixture 'non_existing_fixture.php' doesn't exist", ), @@ -230,7 +230,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testGetReportDir() { - $expectedReportDir = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'report'; + $expectedReportDir = __DIR__ . '/_files/report'; $this->assertEquals($expectedReportDir, $this->_object->getReportDir()); } } diff --git a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/Scenario/Handler/JmeterTest.php b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/Scenario/Handler/JmeterTest.php index b17f3be1dcc..70c77d927d5 100644 --- a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/Scenario/Handler/JmeterTest.php +++ b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/Scenario/Handler/JmeterTest.php @@ -66,7 +66,7 @@ class JmeterTest extends \PHPUnit_Framework_TestCase $this->_scenario = new \Magento\TestFramework\Performance\Scenario('Scenario', $this->_scenarioFile, $scenarioArgs, array(), array()); - $this->_reportFile = realpath(__DIR__ . '/../../_files') . DIRECTORY_SEPARATOR . 'scenario.jtl'; + $this->_reportFile = realpath(__DIR__ . '/../../_files') . '/scenario.jtl'; $this->_shell = $this->getMock('Magento\Shell', array('execute')); $this->_object = new \Magento\TestFramework\Performance\Scenario\Handler\Jmeter($this->_shell, false); } diff --git a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/TestsuiteTest.php b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/TestsuiteTest.php index a6dff0e87f8..475f11531e2 100644 --- a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/TestsuiteTest.php +++ b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/TestsuiteTest.php @@ -74,8 +74,8 @@ class TestsuiteTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->_fixtureDir = __DIR__ . DIRECTORY_SEPARATOR . '_files'; - $fixtureConfigData = include($this->_fixtureDir . DIRECTORY_SEPARATOR . 'config_data.php'); + $this->_fixtureDir = __DIR__ . '/_files'; + $fixtureConfigData = include($this->_fixtureDir . '/config_data.php'); $shell = $this->getMock('Magento\Shell', array('execute')); $this->_config = new \Magento\TestFramework\Performance\Config( @@ -87,7 +87,8 @@ class TestsuiteTest extends \PHPUnit_Framework_TestCase 'Magento\TestFramework\Application', array('applyFixtures'), array($this->_config, $shell) ); $this->_handler = $this->getMockForAbstractClass( - 'Magento\TestFramework\Performance\Scenario\HandlerInterface'); + 'Magento\TestFramework\Performance\Scenario\HandlerInterface' + ); $this->_object = new \Magento\TestFramework\Performance\Testsuite($this->_config, $this->_application, $this->_handler); } @@ -114,7 +115,7 @@ class TestsuiteTest extends \PHPUnit_Framework_TestCase protected function _expectScenarioWarmUp( $scenarioTitle, $scenarioFile, $invocationIndex, \PHPUnit_Framework_MockObject_Stub $returnStub = null ) { - $scenarioFilePath = $this->_fixtureDir . DIRECTORY_SEPARATOR . $scenarioFile; + $scenarioFilePath = $this->_fixtureDir . '/' . $scenarioFile; /** @var $invocationMocker \PHPUnit_Framework_MockObject_Builder_InvocationMocker */ $invocationMocker = $this->_handler->expects($this->at($invocationIndex)); @@ -145,7 +146,7 @@ class TestsuiteTest extends \PHPUnit_Framework_TestCase protected function _expectScenarioRun( $scenarioTitle, $scenarioFile, $invocationIndex, \PHPUnit_Framework_MockObject_Stub $returnStub = null ) { - $scenarioFilePath = $this->_fixtureDir . DIRECTORY_SEPARATOR . $scenarioFile; + $scenarioFilePath = $this->_fixtureDir . '/' . $scenarioFile; $reportFile = basename($scenarioFile, '.jmx') . '.jtl'; /** @var $invocationMocker \PHPUnit_Framework_MockObject_Builder_InvocationMocker */ @@ -158,7 +159,7 @@ class TestsuiteTest extends \PHPUnit_Framework_TestCase $this->objectHasAttribute('_title', $scenarioTitle), $this->objectHasAttribute('_file', $scenarioFilePath) ), - $this->_fixtureDir . DIRECTORY_SEPARATOR . 'report' . DIRECTORY_SEPARATOR . $reportFile + $this->_fixtureDir . '/report/' . $reportFile ) ; if ($returnStub) { @@ -198,9 +199,9 @@ class TestsuiteTest extends \PHPUnit_Framework_TestCase }); $this->_object->run(); $this->assertEquals(array( - $this->_fixtureDir . DIRECTORY_SEPARATOR . 'scenario_error.jmx', - $this->_fixtureDir . DIRECTORY_SEPARATOR . 'scenario_failure.jmx', - $this->_fixtureDir . DIRECTORY_SEPARATOR . 'scenario.jmx' + $this->_fixtureDir . '/scenario_error.jmx', + $this->_fixtureDir . '/scenario_failure.jmx', + $this->_fixtureDir . '/scenario.jmx' ), $notifications); } diff --git a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php index a248feff7bb..8c875c0a438 100644 --- a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php +++ b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php @@ -84,7 +84,7 @@ class CodeMessDetector implode(',', $whiteList), 'xml', //report format $this->_rulesetFile, - '--exclude' , str_replace('/', DIRECTORY_SEPARATOR, implode(',', $blackList)), + '--exclude' , implode(',', $blackList), '--reportfile' , $this->_reportFile ); diff --git a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php index beb8d5f0a17..4d5505201ca 100644 --- a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php +++ b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php @@ -101,11 +101,11 @@ class CodeSniffer public function run(array $whiteList, array $blackList = array(), array $extensions = array()) { $whiteList = array_map(function ($item) { - return str_replace('/', DIRECTORY_SEPARATOR, $item); + return $item; }, $whiteList); $blackList = array_map(function ($item) { - return preg_quote(str_replace('/', DIRECTORY_SEPARATOR, $item)); + return preg_quote($item); }, $blackList); $this->_wrapper->checkRequirements(); diff --git a/dev/tests/static/framework/Magento/TestFramework/Inspection/WordsFinder.php b/dev/tests/static/framework/Magento/TestFramework/Inspection/WordsFinder.php index ac56354b81f..1356bb73e65 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Inspection/WordsFinder.php +++ b/dev/tests/static/framework/Magento/TestFramework/Inspection/WordsFinder.php @@ -81,7 +81,7 @@ class WordsFinder } // Add config files to whitelist, as they surely contain banned words - $basePath = $this->_baseDir . DIRECTORY_SEPARATOR; + $basePath = $this->_baseDir . '/'; $basePathLen = strlen($basePath); foreach ($configFiles as $configFile) { $configFile = realpath($configFile); @@ -191,7 +191,7 @@ class WordsFinder $whitelist = $this->_whitelist; $this->_whitelist = array(); foreach ($whitelist as $whitelistFile => $whitelistWords) { - $whitelistFile = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $whitelistFile); + $whitelistFile = str_replace('\\', '/', $whitelistFile); $this->_whitelist[$whitelistFile] = $whitelistWords; } } @@ -258,7 +258,7 @@ class WordsFinder */ protected function _removeWhitelistedWords($path, $foundWords) { - $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path); + $path = str_replace('\\', '/', $path); foreach ($this->_whitelist as $whitelistPath => $whitelistWords) { if (strncmp($whitelistPath, $path, strlen($whitelistPath)) != 0) { continue; diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/Classes.php b/dev/tests/static/framework/Magento/TestFramework/Utility/Classes.php index a736ae9f507..99a6cf845d6 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Utility/Classes.php +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/Classes.php @@ -299,7 +299,7 @@ class Classes | (?:addBlock | createBlock | getBlockSingleton)\(\s*[\'"]([^\'"]+)[\'"]\s*[\),] # various methods, first argument - | \->(?:initReport | setDataHelperName | setEntityModelClass + | \->(?:initReport | setEntityModelClass | setAttributeModel | setBackendModel | setFrontendModel | setSourceModel | setModel )\(\s*[\'"]([^\'"]+)[\'"]\s*[\),] diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php b/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php index 7afdea858ab..29a689e3363 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php @@ -618,7 +618,7 @@ class Files $classParts = explode('\\', $class); $className = array_pop($classParts); $namespace = implode('\\', $classParts); - $path = implode(DIRECTORY_SEPARATOR, explode('\\', $class)) . '.php'; + $path = implode('/', explode('\\', $class)) . '.php'; $directories = array( '/app/code/', '/lib/', '/downloader/app/', '/downloader/lib/', '/dev/tools/', '/dev/tests/api-functional/framework/', '/dev/tests/integration/framework/', @@ -629,7 +629,7 @@ class Files ); foreach ($directories as $dir) { - $fullPath = str_replace('/', DIRECTORY_SEPARATOR, $this->_path . $dir . $path); + $fullPath = $this->_path . $dir . $path; /** * Use realpath() instead of file_exists() to avoid incorrect work on Windows because of case insensitivity * of file names @@ -678,12 +678,7 @@ class Files */ public function getModuleFile($namespace, $module, $file) { - return $this->_path . DIRECTORY_SEPARATOR - . 'app'. DIRECTORY_SEPARATOR - . 'code'. DIRECTORY_SEPARATOR - . $namespace . DIRECTORY_SEPARATOR - . $module . DIRECTORY_SEPARATOR - . $file; + return $this->_path . '/app/code/' . $namespace . '/' . $module . '/' . $file; } /** diff --git a/dev/tests/static/framework/bootstrap.php b/dev/tests/static/framework/bootstrap.php index 88b23437ba3..6aa3c105c05 100644 --- a/dev/tests/static/framework/bootstrap.php +++ b/dev/tests/static/framework/bootstrap.php @@ -25,7 +25,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -define('DS', DIRECTORY_SEPARATOR); define('BP', realpath(__DIR__ . '/../../../../')); require BP . '/app/autoload.php'; \Magento\Autoload\IncludePath::addIncludePath(array( @@ -40,8 +39,8 @@ function tool_autoloader($className) if (strpos($className, 'Magento\\Tools\\') === false) { return false; } - $filePath = str_replace('\\', DS, $className); - $filePath = BP . DS . 'dev' . DS . 'tools' . DS . $filePath . '.php'; + $filePath = str_replace('\\', '/', $className); + $filePath = BP . '/dev/tools/' . $filePath . '.php'; if (file_exists($filePath)) { include_once($filePath); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/AdminhtmlTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/AdminhtmlTest.php deleted file mode 100644 index f46801e1a38..00000000000 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/AdminhtmlTest.php +++ /dev/null @@ -1,92 +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 tests - * @package static - * @subpackage Integrity - * @copyright Copyright (c) 2013 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; -use \Magento\TestFramework\Utility\Files; - -class AdminhtmlTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider decouplingDataProvider - * - * @param $file - */ - public function testAdminhtmlDecoupling($file) - { - $blackList = $this->_getDecouplingBlackList(); - $blackList = array_map( - function ($element) { - $element = str_replace('/', DIRECTORY_SEPARATOR, $element); - return preg_quote($element, '/'); - }, - $blackList - ); - $this->assertRegExp('/(' . implode('|', $blackList) . ')/', $file); - } - - /** - * @return array - */ - public function decouplingDataProvider() - { - $pathToModule = Files::init()->getPathToSource() - . DIRECTORY_SEPARATOR . 'app' - . DIRECTORY_SEPARATOR . 'code' - . DIRECTORY_SEPARATOR . 'Magento' - . DIRECTORY_SEPARATOR . 'Adminhtml' - ; - - $result = glob( - $pathToModule . DIRECTORY_SEPARATOR . '{Block,Controller,Helper,Model}'. DIRECTORY_SEPARATOR . '*', - GLOB_BRACE | GLOB_NOSORT - ); - // append views - $result = array_merge($result, glob( - $pathToModule . DIRECTORY_SEPARATOR . 'view[^layout]' - . DIRECTORY_SEPARATOR . 'adminhtml' . DIRECTORY_SEPARATOR . '*', - GLOB_BRACE | GLOB_NOSORT - )); - // append layouts - $result = array_merge($result, glob( - $pathToModule . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR . 'adminhtml' - . DIRECTORY_SEPARATOR . 'layout' . DIRECTORY_SEPARATOR . '*', - GLOB_BRACE | GLOB_NOSORT - )); - - return Files::composeDataSets($result); - } - - /** - * @return array - */ - protected function _getDecouplingBlackList() - { - return require __DIR__ . DIRECTORY_SEPARATOR - . '_files' . DIRECTORY_SEPARATOR - . 'blacklist' . DIRECTORY_SEPARATOR - . 'adminhtml_decoupling.php'; - } -} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php index 7b128a5f5e1..507e1d05242 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php @@ -57,7 +57,7 @@ class ClassesTest extends \PHPUnit_Framework_TestCase \:\:get(?:ResourceModel | BlockSingleton | Model | Singleton)?\(\s*[\'"]([a-z\d\\\\]+)[\'"]\s*[\),] # various methods, first argument - | \->(?:initReport | addBlock | createBlock | setDataHelperName + | \->(?:initReport | addBlock | createBlock | setAttributeModel | setBackendModel | setFrontendModel | setSourceModel | setModel )\(\s*\'([a-z\d\\\\]+)\'\s*[\),] @@ -253,7 +253,7 @@ class ClassesTest extends \PHPUnit_Framework_TestCase foreach ($fileList as $currentFile) { $absolutePath = \Magento\TestFramework\Utility\Files::init()->getPathToSource() . - DIRECTORY_SEPARATOR . + '/' . $currentFile; if (is_dir($absolutePath)) { $recursiveFiles = @@ -408,7 +408,7 @@ class ClassesTest extends \PHPUnit_Framework_TestCase protected function _setReferenceBlacklist() { if (!isset(self::$_referenceBlackList)) { - $blackList = file(__DIR__ . DIRECTORY_SEPARATOR . '_files/blacklist/reference.txt', FILE_IGNORE_NEW_LINES); + $blackList = file(__DIR__ . '/_files/blacklist/reference.txt', FILE_IGNORE_NEW_LINES); self::$_referenceBlackList = $blackList; } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php index 307c0cb0702..ac1d0f5d7ed 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php @@ -69,7 +69,7 @@ class CompilerTest extends \PHPUnit_Framework_TestCase { $this->_shell = new \Magento\Shell(); $basePath = \Magento\TestFramework\Utility\Files::init()->getPathToSource(); - $basePath = str_replace(DIRECTORY_SEPARATOR, '/', $basePath); + $basePath = str_replace('\\', '/', $basePath); $this->_tmpDir = realpath(__DIR__) . '/tmp'; $this->_generationDir = $this->_tmpDir . '/generation'; @@ -93,8 +93,10 @@ class CompilerTest extends \PHPUnit_Framework_TestCase protected function tearDown() { - $filesystem = new \Magento\Filesystem\Adapter\Local(); - $filesystem->delete($this->_tmpDir); + $filesystem = new \Magento\Filesystem\Driver\File(); + if ($filesystem->isExists($this->_tmpDir)) { + $filesystem->deleteDirectory($this->_tmpDir); + } } /** @@ -258,7 +260,11 @@ class CompilerTest extends \PHPUnit_Framework_TestCase public function testConstructorIntegrity() { $autoloader = new \Magento\Autoload\IncludePath(); - $generatorIo = new \Magento\Code\Generator\Io(new \Magento\Io\File(), $autoloader, $this->_generationDir); + $generatorIo = new \Magento\Code\Generator\Io( + new \Magento\Filesystem\Driver\File(), + $autoloader, + $this->_generationDir + ); $generator = new \Magento\Code\Generator(null, $autoloader, $generatorIo); $autoloader = new \Magento\Code\Generator\Autoloader($generator); spl_autoload_register(array($autoloader, 'load')); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/FilesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/FilesTest.php index 238377c90b7..c8be41ccfd2 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/FilesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/FilesTest.php @@ -37,7 +37,7 @@ class FilesTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_schemaFile = \Magento\TestFramework\Utility\Files::init()->getModuleFile( - 'Magento', 'Core', 'etc' . DIRECTORY_SEPARATOR . 'layout_single.xsd' + 'Magento', 'Core', 'etc/layout_single.xsd' ); } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php index 57e95653ec8..96f8f889f1c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php @@ -130,7 +130,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase { // @TODO: remove this code when class Magento\Data\Collection will fixed include_once BP . '/app/code/Magento/Core/Model/Option/ArrayInterface.php'; - $blackList = file(__DIR__ . DIRECTORY_SEPARATOR . '_files/blacklist.txt', FILE_IGNORE_NEW_LINES); + $blackList = file(__DIR__ . '/_files/blacklist.txt', FILE_IGNORE_NEW_LINES); $dataProvider = Files::init()->getClassFiles(false, false, false, false, false, true, true); foreach ($dataProvider as $key => $data) { 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 1acd5420c06..eb19033d294 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 @@ -63,3 +63,6 @@ lib/Magento/App/Helper/Context.php lib/Magento/View/DesignLoader.php lib/Magento/Session/SidResolverInterface.php + +lib/Magento/Filesystem/DirectoryList/Configuration.php +lib/Magento/Filesystem/Driver/Http.php diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/invalid_widget.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/invalid_widget.xml index 823ce8094fd..1f084d94ad4 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/invalid_widget.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/invalid_widget.xml @@ -99,7 +99,7 @@ <description>Link to a Specified Product</description> <parameter name="id_path" type="block" visible="true" required="true" sort_order="10" translate="label"> <label>Product</label> - <block class="Magento\Adminhtml\Block\Catalog\Product\Widget\Chooser"> + <block class="Magento\Backend\Block\Catalog\Product\Widget\Chooser"> <data> <item name="button" type="array"> <item name="open" type="string">Select Product...</item> @@ -131,7 +131,7 @@ <description>Link to a Specified Category</description> <parameter name="id_path" type="block" visible="true" required="true" sort_order="10" translate="label"> <label>Category</label> - <block class="Magento\Adminhtml\Block\Catalog\Category\Widget\Chooser"> + <block class="Magento\Backend\Block\Catalog\Category\Widget\Chooser"> <data> <item name="button" type="array"> <item name="open" type="string">Select Category...</item> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/widget.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/widget.xml index bbfc33e1d77..890676bbcdf 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/widget.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/widget.xml @@ -57,7 +57,7 @@ </parameter> <parameter name="id_path" xsi:type="block" visible="true" required="true" sort_order="10"> <label translate="true">Product</label> - <block class="Magento\Adminhtml\Block\Catalog\Product\Widget\Chooser"> + <block class="Magento\Backend\Block\Catalog\Product\Widget\Chooser"> <data> <item name="button" xsi:type="array"> <item name="open" xsi:type="string">Select Product...</item> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/PageType/FilesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/PageType/FilesTest.php index 643986f1cac..2bf5377cbe7 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/PageType/FilesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/PageType/FilesTest.php @@ -37,7 +37,7 @@ class FilesTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_schemaFile = \Magento\TestFramework\Utility\Files::init()->getModuleFile( - 'Magento', 'Core', 'etc' . DIRECTORY_SEPARATOR . 'page_types.xsd' + 'Magento', 'Core', 'etc/page_types.xsd' ); } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/adminhtml_decoupling.php b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/adminhtml_decoupling.php deleted file mode 100644 index 01efd8b50d3..00000000000 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/adminhtml_decoupling.php +++ /dev/null @@ -1,47 +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 tests - * @package static - * @subpackage Integrity - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -return array( - // Blocks - 'Block/Admin', - 'Block/Urlrewrite', - 'Block/Widget', - - // Controllers - 'Controller/Urlrewrite', - - // Helpers - 'Helper/Addresses', - 'Helper/Media', - 'Helper/Js', - - // Models - 'Model/Session', - - // Layouts - 'layout/adminhtml_urlrewrite', -); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt index 77e48029dc0..274783b42c9 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt @@ -54,6 +54,11 @@ dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeStyleTest/phpcs/input/n dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeStyleTest/phpcs/input/naming/property/underscore_absent.php dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeStyleTest/phpcs/input/naming/property/underscore_middle.php dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeStyleTest/phpcs/input/naming/property/underscore_start_public.php +dev/tests/unit/testsuite/Magento/Backup/_files/Fs.php +dev/tests/unit/testsuite/Magento/Backup/_files/Ftp.php +dev/tests/unit/testsuite/Magento/Backup/_files/Gz.php +dev/tests/unit/testsuite/Magento/Backup/_files/Helper.php +dev/tests/unit/testsuite/Magento/Backup/_files/Tar.php dev/tests/unit/testsuite/Magento/Code/Validator/_files/ClassesForConstructorIntegrity.php dev/tests/unit/testsuite/Magento/Code/Validator/_files/ClassesForContextAggregation.php dev/tests/unit/testsuite/Magento/Code/Reader/_files/ClassesForArgumentsReader.php diff --git a/dev/tests/static/testsuite/Magento/Test/Js/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Js/LiveCodeTest.php index dee51e035cc..7b3d783fccb 100644 --- a/dev/tests/static/testsuite/Magento/Test/Js/LiveCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Js/LiveCodeTest.php @@ -145,8 +145,7 @@ class LiveCodeTest extends \PHPUnit_Framework_TestCase } $map = function ($value) { return trim($value) ? - \Magento\TestFramework\Utility\Files::init()->getPathToSource() . DIRECTORY_SEPARATOR . - str_replace('/', DIRECTORY_SEPARATOR, trim($value)) : ''; + \Magento\TestFramework\Utility\Files::init()->getPathToSource() . '/' . trim($value) : ''; }; return array_filter(array_map($map, $result), 'file_exists'); } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php index 12757484913..3600c536d6e 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php @@ -63,7 +63,7 @@ class LicenseTest extends \PHPUnit_Framework_TestCase $root, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS )); - $rootFolderName = substr(strrchr($root, DIRECTORY_SEPARATOR), 1); + $rootFolderName = substr(strrchr($root, '/'), 1); $extensions = '(xml|css|php|phtml|js|dist|sample|additional)'; $paths = array( $rootFolderName . '/[^/]+\.' . $extensions, diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php index 26b1e034d57..2f626b97277 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\App\Dir' + 'The class \Magento\Core\Model\Config\Options is obsolete. Replacement suggestion: \Magento\Filesystem' ); } @@ -540,7 +540,7 @@ class ObsoleteCodeTest extends \PHPUnit_Framework_TestCase $ignored = array(); $appPath = \Magento\TestFramework\Utility\Files::init()->getPathToSource(); foreach ($blackList as $file) { - $ignored[] = realpath($appPath . DIRECTORY_SEPARATOR . $file); + $ignored[] = realpath($appPath . '/' . $file); } $files = \Magento\TestFramework\Utility\Files::init()-> getClassFiles(true, true, true, true, true, true, false); 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 993024bac9b..fa6250f03df 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 @@ -616,7 +616,16 @@ 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\App\Dir'), + array('Mage_Core_Model_Config_Options', 'Magento\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'), + array('Magento\Filesystem\AdapterInterface'), + array('Magento\Filesystem\Stream\FactoryInterface'), + array('Magento\Filesystem\Stream\Local'), + array('Magento\Filesystem\Stream\Mode'), + array('Magento\Filesystem\Stream\Zlib'), + array('Magento\Filesystem\Stream\Mode\Zlib'), array('Mage_Core_Model_Config_Module'), array('Mage_Core_Model_Config_System'), array('Mage_Core_Model_Design_Source_Apply'), @@ -655,7 +664,7 @@ return array( array('Mage_DesignEditor_Block_Page_Html_Head'), array('Mage_Directory_Model_Resource_Currency_Collection'), array('Mage_Downloadable_FileController', 'Magento\Downloadable\Controller\Adminhtml\Downloadable\File'), - array('Mage_Downloadable_Product_EditController', 'Magento\Adminhtml\Controller\Catalog\Product'), + array('Mage_Downloadable_Product_EditController', 'Magento\Backend\Controller\Catalog\Product'), array('Mage_Eav_Model_Convert_Adapter_Entity'), array('Mage_Eav_Model_Convert_Adapter_Grid'), array('Mage_Eav_Model_Convert_Parser_Abstract'), @@ -833,7 +842,7 @@ return array( array( 'Magento\Catalog\Block\Product\View\Media', 'Decomposed into \Magento\Catalog\Block\Product\View\Gallery' - . ' and \Magento\Catalog\Block\Product\View\BaseImage classes' + . ' and \Magento\Catalog\Block\Product\View\BaseImage classes' ), array('Magento\Wishlist\Block\Links', 'Magento\Wishlist\Block\Link'), array('Mage_Adminhtml_Block_Api_Tab_Userroles'), @@ -1446,7 +1455,7 @@ return array( array('Magento\Core\Model\Fieldset\Config\Converter', 'Magento\Object\Copy\Config\Converter'), array('Magento\Core\Model\Fieldset\Config\Data', 'Magento\Object\Copy\Config\Data'), array('Magento\Core\Model\Fieldset\Config\Reader', 'Magento\Object\Copy\Config\Reader'), - array('Magento\Core\Model\Fieldset\Config\SchemaLocator', 'Magento\Object\Copy\Config\SchemaLocator'), + array('Magento\Core\Model\Fieldset\Config\SchemaLocator', 'Magento\Object\Copy\Config\SchemaLocator'), array('Magento\Core\Model\ModuleManager', 'Magento\Module\Manager'), array('Magento\Core\Model\EntryPoint\Media', 'Magento\Core\App\Media'), array('Magento\Core\Controller\Varien\Action', 'Magento\App\Action\Action'), @@ -1474,7 +1483,8 @@ return array( array('Magento\Core\Block\Html\Calendar', 'Magento\View\Element\Html\Calendar'), array('Magento\Core\Block\Html\Link', 'Magento\View\Element\Html\Link'), array('Magento\Core\Block\Context', 'Magento\View\Element\Context'), - array('Magento\Core\Model\Factory\Helper', 'Magento\App\Helper\HelperFactory'), + array('Magento\Core\Model\Factory\Helper'), + array('Magento\App\Helper\HelperFactory'), array('Magento\Core\Helper\AbstractHelper', 'Magento\App\Helper\AbstractHelper'), array('Magento\Core\Helper\Context', 'Magento\App\Helper\Context'), array( @@ -1689,6 +1699,10 @@ return array( 'Magento\Adminhtml\Block\Report\Wishlist', 'Magento\Reports\Block\Adminhtml\Wishlist' ), + array( + 'Magento\App\Dir\Verification', + 'Magento\Filesystem\DirectoryList\Verification' + ), array('Magento\Core\Model\Cookie', 'Magento\Stdlib\Cookie'), array('Magento\Core\Model\Logger', 'Magento\Logger'), array('Magento\Core\Block\Template\Context', 'Magento\View\Element\Template\Context'), @@ -1755,4 +1769,8 @@ return array( 'Magento\View\Layout\PageType\Config\SchemaLocator' ), array('Magento\Core\Model\Theme\CopyService', 'Magento\Theme\Model\CopyService'), + array('Magento\Core\Model\Resource\Session', 'Magento\Session\SaveHandler\DbTable'), + array('Magento\Core\Model\Session\Exception', 'Magento\Session\Exception'), + array('Magento\Core\Model\Session\Context'), + array('Magento\Core\Model\Session\AbstractSession', 'Magento\Session\SessionManager'), ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php index 6ccaee11ed0..1ae73a4e667 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php @@ -53,7 +53,7 @@ return array( '/config/adminhtml/menu' => 'Move them to adminhtml.xml.', '/config/adminhtml/acl' => 'Move them to adminhtml.xml.', '/config/adminhtml/global_search' => - 'This configuration moved to Di configuration of \Magento\Adminhtml\Controller\Index', + 'This configuration moved to Di configuration of \Magento\Backend\Controller\Index', '/config/*[self::global|self::adminhtml|self::frontend]/di' => 'This configuration moved to di.xml file', '/config/*[self::global|self::adminhtml|self::frontend]/events' => 'This configuration moved to events.xml file', '/config/*[self::global|self::adminhtml|self::frontend]/routers' => @@ -64,7 +64,7 @@ return array( '/config/global/catalog/product/options' => 'This configuration moved to product_options.xml file', '/config/global/catalog/product/media/image_types' => 'This configuration moved to Di configuration of ' - . '\Magento\Adminhtml\Block\Catalog\Product\Frontend\Product\Watermark', + . '\Magento\Backend\Block\Catalog\Product\Frontend\Product\Watermark', '/config/global/eav_attributes' => 'This configuration moved to eav_attributes.xml file', '/config/global/index' => 'This configuration moved to indexers.xml file', '/config/global/catalogrule' => 'This configuration moved to Di configuration of \Magento\CatalogRule\Model\Rule', 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 718bf93d720..149e4a8b53a 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 @@ -28,6 +28,7 @@ return array( array('ADMIN_STORE_ID', 'Magento\Core\Model\AppInterface'), array('BACKORDERS_BELOW'), + array('DS'), array('BACKORDERS_YES'), array('CACHE_TAG', 'Magento\Api\Model\Config', 'Magento_Api_Model_Cache_Type::CACHE_TAG'), array('CACHE_TAG', 'Magento\Core\Model\AppInterface'), @@ -301,18 +302,8 @@ return array( array('XML_PATH_ENCRYPTION_MODEL', 'Magento\Core\Helper\Data'), array('CONFIG_KEY_PATH_TO_MAP_FILE', 'Magento\Core\Model\Resource\Setup\Migration'), array('XML_PATH_SKIP_PROCESS_MODULES_UPDATES', 'Magento\App\UpdaterInterface'), - array( - 'XML_NODE_SESSION_SAVE', - 'Magento\Core\Model\Session\AbstractSession', - 'Magento\Core\Model\Session\AbstractSession::PARAM_SESSION_SAVE_METHOD' - ), array('XML_PATH_IGNORE_DEV_MODE', 'Magento\Module\UpdaterInterface'), array('XML_PATH_SKIP_PROCESS_MODULES_UPDATES', 'Magento\Module\UpdaterInterface'), - array( - 'XML_NODE_SESSION_SAVE_PATH', - 'Magento\Core\Model\Session\AbstractSession', - 'Magento\Core\Model\Session\AbstractSession::PARAM_SESSION_SAVE_PATH' - ), array('XML_PATH_USE_CUSTOM_ADMIN_PATH', 'Magento\Backend\Helper\Data'), array('XML_PATH_CUSTOM_ADMIN_PATH', 'Magento\Backend\Helper\Data'), array('XML_PATH_BACKEND_AREA_FRONTNAME', 'Magento\Backend\Helper\Data'), @@ -349,7 +340,7 @@ return array( array( 'XML_PATH_PUBLIC_FILES_VALID_PATHS', '\Magento\Core\Helper\Data', - '\Magento\Adminhtml\Helper\Catalog::XML_PATH_PUBLIC_FILES_VALID_PATHS' + '\Magento\Catalog\Helper\Catalog::XML_PATH_PUBLIC_FILES_VALID_PATHS' ), array( 'TYPE_PHYSICAL', @@ -392,6 +383,8 @@ return array( '\Magento\Image\Adapter\AdapterInterface::ADAPTER_GD2' ), array('XML_PATH_IMAGE_TYPES', 'Magento\Adminhtml\Block\Catalog\Product\Frontend\Product\Watermark'), + array('XML_PATH_WEBHOOK', 'Magento\Webhook\Model\Source\Hook'), + array('XML_PATH_SUBSCRIPTIONS', 'Magento\Webhook\Model\Subscription\Config'), array('PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN', 'Magento\Paypal\Model\Express\Checkout'), array( 'XML_PATH_USE_FRONTEND_SID', @@ -431,18 +424,32 @@ return array( array( 'PARAM_SESSION_SAVE_PATH', '\Magento\Core\Model\Session\AbstractSession', - '\Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD' + '\Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_PATH' ), array( 'PARAM_SESSION_CACHE_LIMITER', '\Magento\Core\Model\Session\AbstractSession', - '\Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD' + '\Magento\Core\Model\Session\Config::PARAM_SESSION_CACHE_LIMITER' + ), + array( + 'XML_NODE_SESSION_SAVE_PATH', + 'Magento\Core\Model\Session\AbstractSession', + 'Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_PATH' + ), + array( + 'XML_NODE_SESSION_SAVE', + 'Magento\Core\Model\Session\AbstractSession', + 'Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD' + ), + array( + 'XML_PATH_LOG_EXCEPTION_FILE', + 'Magento\Core\Model\Session\AbstractSession' ), array( 'XML_PATH_ROBOTS_DEFAULT_CUSTOM_INSTRUCTIONS', 'Magento\Theme\Helper\Robots', - 'Magento\Adminhtml\Block\Page\System\Config\Robots::XML_PATH_ROBOTS_DEFAULT_CUSTOM_INSTRUCTIONS', + 'Magento\Backend\Block\Page\System\Config\Robots::XML_PATH_ROBOTS_DEFAULT_CUSTOM_INSTRUCTIONS', ), array( 'XML_PATH_MERGE_CSS_FILES', @@ -482,4 +489,8 @@ return array( '\Magento\Core\Model\View\Design', '\Magento\View\DesignInterface::XML_PATH_THEME_ID', ), + 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') ); 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 7d3380c3fb6..bbd7719d4c1 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 @@ -57,7 +57,7 @@ return array( array('_collectOrigData', 'Magento\Catalog\Model\Resource\AbstractResource'), array('_decodeInput', 'Magento\Catalog\Controller\Adminhtml\Product'), array('_emailOrderConfirmation', 'Magento\Checkout\Model\Type\AbstractType'), - array('_escapeValue', 'Magento\Adminhtml\Block\Widget\Grid\Column\Filter\AbstractFilter'), + array('_escapeValue', 'Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilter'), array('_extractData', 'Magento\ObjectManager\Config\Reader\Dom'), array('_filterPostData', 'Magento\Catalog\Controller\Adminhtml\Product\Attribute'), array('_generateCssHtml', 'Magento\Theme\Block\Html\Head'), @@ -77,7 +77,7 @@ return array( 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\Adminhtml\Controller\Report\Sales'), + array('_getCollectionNames', 'Magento\Backend\Controller\Report\Sales'), array('_getConnectionAdapterClassName', 'Magento\App\Resource'), array('_getConnenctionType', 'Magento\Install\Model\Installer\Db'), array('_getDateFromToHtml', 'Magento\ImportExport\Block\Adminhtml\Export\Filter'), @@ -108,7 +108,7 @@ return array( array('_getScopeCode', 'Magento\Core\Model\Config'), array('_getSectionConfig', 'Magento\Core\Model\Config'), array('_getSelectHtml', 'Magento\ImportExport\Block\Adminhtml\Export\Filter'), - array('_getSetData', 'Magento\Adminhtml\Block\Catalog\Product\Attribute\Set\Main'), + array('_getSetData', 'Magento\Backend\Block\Catalog\Product\Attribute\Set\Main'), array('_getSession', 'Magento\Paygate\Model\Authorizenet', 'Magento_Paygate_Model_Authorizenet::_session'), array('_getSHAInSet', '', 'Magento_Ogone_Model_Api::getHash'), array('_getStoreByGroup', 'Magento\Core\Model\App'), @@ -167,7 +167,7 @@ return array( array('_saveCustomerAfterOrder', 'Magento\Sales\Model\AdminOrder\Create'), array('_saveCustomers', 'Magento\Sales\Model\AdminOrder\Create'), array('_saveSectionCache', 'Magento\Core\Model\Config'), - array('_sendUploadResponse', 'Magento\Adminhtml\Controller\Customer'), + array('_sendUploadResponse', 'Magento\Backend\Controller\Customer'), array('_sendUploadResponse', 'Magento\Newsletter\Controller\Adminhtml\Subscriber'), array('_setAttribteValue'), array('_shouldSkipProcessUpdates', 'Magento\Core\Model\App'), @@ -270,7 +270,7 @@ return array( ), array('cleanVarFolder', '', 'Magento_Io_File::rmdirRecursive()'), array('cleanVarSubFolders', '', - 'glob() on \Magento\App\Dir::getBaseDir(\Magento\Core\Model\App\Dir::VAR_DIR)'), + '\Magento\Filesystem::getDirectoryRead(\Magento\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'), @@ -294,7 +294,7 @@ return array( array('displayZeroTax', 'Magento\Tax\Model\Config'), array('drawItem', 'Magento\Catalog\Block\Navigation'), array('dropKey', 'Magento\DB\Adapter\Pdo\Mysql'), - array('escapeJs', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Super\Config'), + array('escapeJs', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Super\Config'), array('eventClean', 'Magento\Reports\Model\Event\Observer'), array('exportOrderedCsvAction'), array('exportOrderedExcelAction'), @@ -312,7 +312,7 @@ return array( array('getAclPrivilegeSet', 'Magento\Admin\Model\Config'), array('getAclResourceList', 'Magento\Admin\Model\Config'), array('getAclResourceTree', 'Magento\Admin\Model\Config'), - array('getAddNewButtonHtml', 'Magento\Adminhtml\Block\Catalog\Product'), + array('getAddNewButtonHtml', 'Magento\Backend\Block\Catalog\Product'), array('getAddNewButtonHtml', 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions'), array('getAddToCartItemUrl', 'Magento\Wishlist\Block\Customer\Sidebar'), array('getAddToCartUrlBase64', '', '_getAddToCartUrl'), @@ -322,7 +322,7 @@ return array( array('getAllOrderEntityTypeIds', 'Magento\Rss\Model\Resource\Order'), array('getAnonSuffix'), array('getAttributeDataModelFactory', 'Magento\Eav\Model\Validator\Attribute\Data'), - array('getAttributesJson', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Super\Config', 'getAttributes'), + array('getAttributesJson', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Super\Config', 'getAttributes'), array('getBaseTaxAmount', 'Magento\Sales\Model\Quote\Item\AbstractItem'), array('getBlockClassName', 'Magento\Core\Model\Config'), array('getButtonsHtml', 'Magento_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search'), @@ -357,7 +357,7 @@ return array( array('getDebug', 'Magento\Ogone\Model\Api'), array('getDebug', 'Magento\Paypal\Model\Api\AbstractApi'), array('getDefaultBasePath', 'Magento\Core\Model\Store'), - array('getDeleteUrl', 'Magento\Adminhtml\Block\Catalog\Product\Edit'), + array('getDeleteUrl', 'Magento\Backend\Block\Catalog\Product\Edit'), array('getDirectOutput', 'Magento\View\Element\Template'), array('getDirectOutput', 'Magento\Core\Model\Layout'), array('getDirectOutput', 'Magento\View\LayoutInterface'), @@ -372,7 +372,7 @@ return array( array('getFallbackTheme'), array('getFileLayoutUpdatesXml', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), array('getFormated', '', "getFormated(true) -> format('html'), getFormated() -> format('text')"), - array('getFormObject', 'Magento\Adminhtml\Block\Widget\Form'), + array('getFormObject', 'Magento\Backend\Block\Widget\Form'), array('getGiftmessageHtml', 'Magento\Sales\Block\Adminhtml\Order\View\Tab\Info'), array('getHandles', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), array('getHeaderCssClass', 'Magento_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search'), @@ -488,12 +488,12 @@ return array( ), array('getResourceTypeConfig', 'Magento\Core\Model\Config'), array('getResTreeJson', 'Magento\User\Block\Role\Tab\Edit', 'getTree'), - array('getResTreeJson', 'Magento\Adminhtml\Block\Api\Tab\Rolesedit', 'getTree'), + array('getResTreeJson', 'Magento\Backend\Block\Api\Tab\Rolesedit', 'getTree'), array('getRouterByRoute', 'Magento\App\FrontController'), array('getRouterByFrontName', 'Magento\App\FrontController'), array('getRouters', 'Magento\Core\Model\Config'), array('getRowId', 'Magento\Sales\Block\Adminhtml\Order\Create\Customer\Grid'), - array('getRowId', 'Magento\Adminhtml\Block\Widget\Grid'), + array('getRowId', 'Magento\Backend\Block\Widget\Grid'), array('getSaveTemplateFlag', 'Magento\Newsletter\Model\Queue'), array('getSectionNode', 'Magento\Core\Model\Config'), array('getSecure', 'Magento\Backend\Model\Url', 'isSecure'), @@ -578,7 +578,7 @@ return array( array('initControllerRouters', 'Magento\Cms\Controller\Router'), array('initLabels', 'Magento\Catalog\Model\Resource\Eav\Attribute'), array('initLayoutMessages', 'Magento\App\Action\Action'), - array('initSerializerBlock', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Ajax\Serializer'), + array('initSerializerBlock', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Ajax\Serializer'), array('initSerializerBlock', 'Magento\Backend\Block\Widget\Grid\Serializer'), array('initSpecified', 'Magento\Core\Model\App'), array('insertProductPrice', 'Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice'), @@ -631,7 +631,7 @@ return array( 'Magento\View\Asset\MergeStrategyInterface' ), array('order_success_page_view', 'Magento\GoogleAnalytics\Model\Observer'), - array('orderedAction', 'Magento\Adminhtml\Controller\Report\Product'), + array('orderedAction', 'Magento\Backend\Controller\Report\Product'), array('output', 'Magento_Shell'), array('pageHandleExists', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), array('parseDateTime', 'Magento\Core\Model\Date'), @@ -774,18 +774,18 @@ return array( 'customerSaveAfter', 'Magento\Sales\Model\Observer', 'Magento_Sales_Model_Observer_Backend_CustomerQuote::dispatch' ), - array('_getUsers', 'Magento\Adminhtml\Block\Api\Role\Grid\User', 'getUsers'), - array('_getGridHtml', 'Magento\Adminhtml\Block\Api\Tab\Rolesusers', 'getGridHtml'), - array('_getSelectedRoles', 'Magento\Adminhtml\Block\Api\User\Edit\Tab\Roles', 'getSelectedRoles'), - array('_getProduct', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Super\Config\Matrix', 'getProduct'), - array('_getImageUploadUrl', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Super\Config\Matrix', + array('_getUsers', 'Magento\Backend\Block\Api\Role\Grid\User', 'getUsers'), + array('_getGridHtml', 'Magento\Backend\Block\Api\Tab\Rolesusers', 'getGridHtml'), + array('_getSelectedRoles', 'Magento\Backend\Block\Api\User\Edit\Tab\Roles', 'getSelectedRoles'), + array('_getProduct', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Super\Config\Matrix', 'getProduct'), + array('_getImageUploadUrl', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Super\Config\Matrix', 'getImageUploadUrl'), - array('_getProduct', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Super\Config\Simple', 'getProduct'), - array('_getProduct', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Super\Config', 'getProduct'), - array('_getProduct', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Super\Settings', 'getProduct'), - array('_getProduct', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Crosssell', 'getProduct'), - array('_getProduct', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Related', 'getProduct'), - array('_getProduct', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Upsell', 'getProduct'), + array('_getProduct', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Super\Config\Simple', 'getProduct'), + array('_getProduct', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Super\Config', 'getProduct'), + array('_getProduct', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Super\Settings', 'getProduct'), + array('_getProduct', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Crosssell', 'getProduct'), + array('_getProduct', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Related', 'getProduct'), + array('_getProduct', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Upsell', 'getProduct'), array( '_renderCellTemplate', 'Magento\Backend\Block\System\Config\Form\Field\Array\AbstractArray', @@ -843,7 +843,7 @@ return array( array('getHelper', 'Magento\Catalog\Model\Resource\Product\Type\Configurable\Attribute\Collection'), array('getHelper', 'Magento\Cms\Model\Wysiwyg\Images\Storage'), array('getHelper', 'Magento\Core\Model\App'), - array('getCatalogHelper', 'Magento\Adminhtml\Block\Catalog\Category\Tabs'), + array('getCatalogHelper', 'Magento\Backend\Block\Catalog\Category\Tabs'), array('getStabilityOptions', 'Magento\Connect\Model\Extension'), array('_getSession', 'Magento\Centinel\Model\Service'), array('_getValidationStateModel', 'Magento\Centinel\Model\Service'), @@ -859,8 +859,8 @@ return array( array('getProductStatusModel', 'Magento\CatalogInventory\Model\Stock\Status'), array('getStorage', 'Magento\Cms\Helper\Wysiwyg\Images'), array('_getSession', 'Magento\Review\Helper\Action\Pager'), - array('_getProductType', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Super\Config\Matrix'), - array('_getProductType', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Super\Config'), + array('_getProductType', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Super\Config\Matrix'), + array('_getProductType', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Super\Config'), array('_getSession', 'Magento\Sales\Model\AdminOrder'), array('setIsSerializable', 'Magento\App\State'), array('getIsSerializable', 'Magento\App\State'), @@ -922,7 +922,7 @@ return array( array('xmlToAssoc', '\Magento\Core\Helper\Data', '\Magento\Convert\Xml::xmlToAssoc'), array('checkLfiProtection', '\Magento\Core\Helper\Data', '\Magento\Filesystem::checkLfiProtection'), array('getProtectedFileExtensions', '\Magento\Core\Helper\Data', - '\Magento\Core\Model\File\Validator\NotProtectedExtension::getProtectedFileExtensions'), + '\Magento\Core\Model\File\Validator\NotProtectedExtension::getProtectedFileExtensions'), array('getStoreId', '\Magento\Core\Helper\Data'), array('getExactDivision', '\Magento\Core\Helper\Data', '\Magento\Math\Division::getExactDivision'), array('getPublicFilesValidPath', '\Magento\Core\Helper\Data'), @@ -1057,8 +1057,18 @@ return array( array('_getRequest', '\Magento\Stdlib\Cookie'), array('init', '\Magento\Core\Model\Session\AbstractSession', '\Magento\Core\Model\Session\AbstractSession::start'), array('getCacheLimiter', '\Magento\Core\Model\Session\Context', '\Magento\Core\Model\Session\Config'), + array('getSaveMethod', '\Magento\Core\Model\Session\Context', '\Magento\Core\Model\Session\Config'), + array('getAppState', '\Magento\Core\Model\Session\Context'), + array('getValidator', '\Magento\Core\Model\Session\Context'), array('getDir', '\Magento\Core\Model\Session\Context', '\Magento\Core\Model\Session\Config'), array('getSavePath', '\Magento\Core\Model\Session\Context', '\Magento\Core\Model\Session\Config'), + + array('getEventManager', '\Magento\Core\Model\Session\Context'), + array('getLogger', '\Magento\Core\Model\Session\Context'), + array('getStoreConfig', '\Magento\Core\Model\Session\Context'), + array('getStoreManager', '\Magento\Core\Model\Session\Context'), + array('getRequest', '\Magento\Core\Model\Session\Context'), + array('getSessionSavePath', '\Magento\Core\Model\Session\AbstractSession', '\Magento\Core\Model\Session\Config'), array('getMethod', '\Magento\GoogleCheckout\Block\Redirect', 'getFormMethod'), array('getCookie', 'Magento\View\Element\Js\Cookie'), @@ -1084,5 +1094,25 @@ return array( array('getUrlEncoded', 'Magento\View\Element\AbstractBlock'), array('getUrlBase64', 'Magento\View\Element\AbstractBlock'), array('getMessagesBlock', 'Magento\MultipleWishlist\Block\Info'), - array('addStoresToCollection', '\Magento\Rating\Model\Resource\Rating\Collection') + array('helper', 'Magento\View\Element\AbstractBlock'), + array('getDataHelperName', 'Magento\Backend\Block\Dashboard\AbstractDashboard'), + array('setDataHelperName', 'Magento\Backend\Block\Dashboard\AbstractDashboard'), + array('addStoresToCollection', '\Magento\Rating\Model\Resource\Rating\Collection'), + array('getLocalPackagesPath', 'Magento\Connect\Helper\Data'), + array('getLocalPackagesPathV1x', 'Magento\Connect\Helper\Data'), + array('getSessionSaveMethod', '\Magento\Core\Model\Session\AbstractSession', '\Magento\Core\Model\Session\Config'), + array('setSessionName', '\Magento\Core\Model\Session\AbstractSession', 'setName'), + array('getCode', '\Magento\Message\AbstractMessage', 'getText'), + array('setCode', '\Magento\Message\AbstractMessage', 'setText'), + array('setClass', '\Magento\Message\AbstractMessage'), + array('setMethod', '\Magento\Message\AbstractMessage'), + array('add', '\Magento\Message\Collection', 'addMessage'), + array('count', '\Magento\Message\Collection', 'getCountByType'), + array('error', '\Magento\Message\Factory', 'create'), + array('warning', '\Magento\Message\Factory', 'create'), + array('success', '\Magento\Message\Factory', 'create'), + array('notice', '\Magento\Message\Factory', 'create'), + array('getDisplayMode', '\Magento\Catalog\Model\Session'), + array('setEscapeMessageFlag', 'Magento\View\Block\Messages'), + array('shouldEscapeMessage', 'Magento\View\Block\Messages'), ); 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 2dbdbfe40bc..be771b19467 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 @@ -70,8 +70,8 @@ return array( array('_modulesReader', 'Magento\App\ObjectManager\ConfigLoader'), array('_moduleReader', 'Magento\Backend\Model\Menu\Config'), array('_option', 'Magento\Captcha\Helper\Data', '_dirs'), - array('_options', 'Magento\Core\Model\Config', 'Magento\App\Dir'), - array('_optionsMapping', null, '\Magento\App\Dir::getBaseDir($nodeKey)'), + array('_options', 'Magento\Core\Model\Config', 'Magento\Filesystem'), + array('_optionsMapping', null, '\Magento\Filesystem::getPath($nodeKey)'), array('_order', 'Magento\Checkout\Block\Onepage\Success'), array('_order_id'), array('_parent', 'Magento\Core\Block\AbstractBlock'), @@ -96,7 +96,7 @@ return array( array('_storeFilter', 'Magento\Catalog\Model\Product\Type\AbstractType'), array('_substServerVars'), array('_track_id'), - array('_varSubFolders', null, 'Magento\App\Dir'), + array('_varSubFolders', null, 'Magento\Filesystem'), array('_viewDir', 'Magento\View\Element\Template', '_dirs'), array('decoratedIsFirst', null, 'getDecoratedIsFirst'), array('decoratedIsEven', null, 'getDecoratedIsEven'), @@ -115,6 +115,10 @@ return array( array('_backendFrontName', 'Magento\Backend\Helper\Data'), array('_app', 'Magento\Backend\Block\Widget\Grid\Column\Renderer\Currency'), array('_enginePool', '\Magento\View\Element\Template\Context', '_engineFactory'), + array('_fileHandler', '\Magento\Sitemap\Model\Sitemap', '_stream'), + array('_fileIo', '\Magento\Theme\Model\Uploader\Service', '_filesystem'), + array('_streamFactory', '\Magento\Core\Model\File\Storage\Config', '_filesystem'), + array('_streamFactory', '\Magento\Core\Model\File\Storage\Synchronization', '_filesystem'), array('_allowedFormats', '\Magento\Core\Helper\Data', '\Magento\Core\Model\Locale'), array('types', '\Magento\Core\Model\Theme'), array('_collectionFactory', '\Magento\Install\Controller\Action', 'themeProvider'), @@ -139,9 +143,78 @@ return array( array('_savePath', '\Magento\Core\Model\Session\Context'), array('_cacheLimiter', '\Magento\Core\Model\Session\Context'), array('_dir', '\Magento\Core\Model\Session\Context'), + array('_saveMethod', '\Magento\Core\Model\Session\Context'), + array('_appState', '\Magento\Core\Model\Session\Context'), + array('_validator', '\Magento\Core\Model\Session\Context'), + array('_logger', '\Magento\Core\Model\Session\Context'), + array('_eventManager', '\Magento\Core\Model\Session\Context'), + array('_storeConfig', '\Magento\Core\Model\Session\Context'), + array('messageFactory', '\Magento\Core\Model\Session\Context'), + array('messagesFactory', '\Magento\Core\Model\Session\Context'), + array('_request', '\Magento\Core\Model\Session\Context'), + array('_storeManager', '\Magento\Core\Model\Session\Context'), array('_cacheLimiter', 'Magento\Core\Model\Session\AbstractSession'), + array('_saveMethod', 'Magento\Core\Model\Session\AbstractSession'), + array('_appState', 'Magento\Core\Model\Session\AbstractSession'), array('_dir', 'Magento\Core\Model\Session\AbstractSession'), array('_savePath', 'Magento\Core\Model\Session\AbstractSession'), + array('_filesystem', '\Magento\Cms\Helper\Wysiwyg\Images', '_directory'), + array('_filesystem', '\Magento\Cms\Model\Wysiwyg\Images\Storage', '_directory'), + array('_filesystem', '\Magento\Core\Model\Page\Asset\MergeStrategy\Direct', '_directory'), + array('_filesystem', '\Magento\Core\Model\Page\Asset\MergeStrategy\Checksum', '_directory'), + array('_filesystem', 'Magento\Sales\Model\Order\Pdf\AbstractPdf'), + array('_baseDir', 'Magento\Core\Model\Resource\Setup\Migration'), + array('_dir', 'Magento\Core\Model\Resource\Setup\Migration'), + array('_filesystem', 'Magento\Core\Model\Resource\Setup\Migration', '_directory'), + array('_filesystem', 'Magento\Core\Model\Theme\Collection', '_directory'), + array('_mediaBaseDirectory', 'Magento\Core\Model\Resource\File\Storage\File'), + array('_dbHelper', 'Magento\Core\Model\Resource\File\Storage\File'), + array('_filesystem', 'Magento\Core\Model\Theme\CopyService', '_directory'), + array('_baseDir', 'Magento\Core\Model\Theme\Collection'), + array('_filesystem', 'Magento\Downloadable\Controller\Adminhtml\Downloadable\File'), + array('_dirModel', 'Magento\Downloadable\Controller\Adminhtml\Downloadable\File'), + array('_dirModel', 'Magento\Downloadable\Model\Link'), + array('_dirModel', 'Magento\Downloadable\Model\Sample'), + array('_dir', 'Magento\App\Dir'), + array('_baseDir', 'Magento\Backup\Model\Fs\Collection'), + array('_filesystem', 'Magento\Backup\Model\Fs\Collection'), + array('_dir', 'Magento\Backup\Model\Fs\Collection'), + array('_dir', 'Magento\Cms\Model\Wysiwyg\Images\Storage'), + array('_dirs', 'Magento\Core\Helper\Theme'), + array('_dirs', 'Magento\Core\Model\Resource\Type\Db\Pdo\Mysql'), + array('_filesystem', 'Magento\GiftWrapping\Model\Wrapping'), + array('_dirs', 'Magento\Index\Model\Lock\Storage'), + array('_filesystem', 'Magento\Index\Model\Lock\Storage'), + array('_coreDir', 'Magento\Sales\Model\Order\Pdf\AbstractPdf'), + array('_coreDir', 'Magento\ScheduledImportExport\Model\Scheduled\Operation'), + array('_dir', 'Magento\Core\App\FrontController\Plugin\DispatchExceptionHandler'), + array('_dirs', 'Magento\Core\Block\Template'), + array('_applicationDirs', 'Magento\Core\Model\Config\FileResolver'), + array('_dir', 'Magento\Core\Model\File\Storage'), + array('_dir', 'Magento\Core\Model\Locale\Hierarchy\Config\FileResolver'), + array('_dirs', 'Magento\Core\Block\Template\Context'), + array('_dir', 'Magento\Core\Model\Page\Asset\MergeService'), + array('_dir', 'Magento\Core\Model\Page\Asset\MinifyService'), + array('_dir', 'Magento\Core\Model\Resource'), + array('_dir', 'Magento\Core\Model\Session\Context'), + array('dir', 'Magento\Core\Model\Theme\Image\Path'), + array('_dir', 'Magento\Install\App\Action\Plugin\Dir'), + array('_dirs', 'Magento\View\Block\Template\Context'), + array('_coreDir', 'Magento\Sales\Model\Order\Pdf\AbstractItems' ,'_rootDirectory'), + array('_dir', 'Magento\AdvancedCheckout\Model\Import', '_filesystem'), + array('_dir', 'Magento\Backup\Helper\Data'), + array('_dir', 'Magento\Backup\Model\Observer', '_filesystem'), + array('_dir', 'Magento\Catalog\Model\Category\Attribute\Backend\Image', '_filesystem'), + array('_dir', 'Magento\Catalog\Model\Resource\Product\Attribute\Backend\Image', '_filesystem'), + array('_dir', 'Magento\CatalogEvent\ModelEvent', '_filesystem'), + array('_dir', 'Magento\Cms\Helper\Wyiswig\Images'), + array('_dir', 'Magento\Email\Model\Template'), + array('_dir', 'Magento\ImportExport\Model\Import\Entity\Product', '_mediaDirectory'), + array('_dir', 'Magento\ImportExport\Model\AbstractModel', '_varDirectory'), + array('_coreDir', 'Magento\Install\Model\Installer\Console'), + array('_dir', 'Magento\Install\Model\Installer\Filesystem'), + array('_coreDir', 'Magento\Paypal\Model\Report\Settlement', '_filesystem'), + array('_applicationDirs', 'Magento\Widget\Model\Config\FileResolver', '_filesystem'), array('_formFields', 'Magento\View\Element\Redirect', 'formFields'), array('_formFactory', 'Magento\View\Element\Redirect', 'formFactory'), array('_dispersion', 'Magento\Theme\Block\Html\Pager'), @@ -189,4 +262,6 @@ return array( array('_frameOpenTag', 'Magento\View\Element\AbstractBlock'), array('_frameCloseTag', 'Magento\View\Element\AbstractBlock'), array('_messagesBlock', 'Magento\View\Element\AbstractBlock'), + array('_messagesBlock', 'Magento\Connect\Helper\Data'), + array('escapeMessageFlag', 'Magento\View\Block\Messages'), ); 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 5899263d209..630aa0f424b 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 @@ -110,4 +110,4 @@ Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer Magento/Newsletter/Model/Template/Filter Magento/Newsletter/Model/Resource/Subscriber Magento/CatalogInventory/Model/Resource/Stock/Item - +lib/Magento/Filesystem/Driver 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 9af9066bb00..1f9af532727 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 @@ -2,11 +2,11 @@ # Glob patterns are supported # app/bootstrap.php -app/code/Magento/Adminhtml/Block/Urlrewrite -app/code/Magento/Adminhtml/Controller/Urlrewrite.php app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php app/code/Magento/Backend/Block/System/Store/Edit app/code/Magento/Backend/Block/System/Store/Edit.php +app/code/Magento/Backend/Block/Urlrewrite +app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php app/code/Magento/Backend/Model/Observer.php app/code/Magento/Bundle/Model/Plugin app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php diff --git a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php index 9fec4ce355e..4dbec828036 100644 --- a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php +++ b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php @@ -69,9 +69,6 @@ class Adminhtml extends \PHPUnit_Framework_TestCase /** @var \Magento\Backend\Block\Template\Context */ protected $_context; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_dirMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $_loggerMock; @@ -84,9 +81,6 @@ class Adminhtml extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $_storeConfigMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_helperFactoryMock; - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\StoreManager */ protected $_storeManagerMock; @@ -112,13 +106,11 @@ class Adminhtml extends \PHPUnit_Framework_TestCase $this->_urlMock = $this->_makeMock('Magento\UrlInterface'); $this->_eventManagerMock = $this->_makeMock('Magento\Event\ManagerInterface'); $this->_controllerMock = $this->_makeMock('Magento\App\FrontController'); - $this->_dirMock = $this->_makeMock('Magento\App\Dir'); $this->_loggerMock = $this->_makeMock('Magento\Logger'); $this->_filesystemMock = $this->_makeMock('Magento\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'); - $this->_helperFactoryMock = $this->_makeMock('Magento\App\Helper\HelperFactory'); $viewUrlMock = $this->_makeMock('Magento\View\Url'); $viewConfigMock = $this->_makeMock('Magento\View\ConfigInterface'); $viewFileSystemMock = $this->_makeMock('Magento\View\FileSystem'); @@ -153,7 +145,6 @@ class Adminhtml extends \PHPUnit_Framework_TestCase $this->_sidResolver, $this->_storeConfigMock, $this->_controllerMock, - $this->_helperFactoryMock, $viewUrlMock, $viewConfigMock, $cacheStateMock, @@ -162,7 +153,6 @@ class Adminhtml extends \PHPUnit_Framework_TestCase $escaperMock, $filterManagerMock, $this->_localeMock, - $this->_dirMock, $this->_filesystemMock, $viewFileSystemMock, $templatePoolMock, diff --git a/dev/tests/unit/framework/bootstrap.php b/dev/tests/unit/framework/bootstrap.php index 6f62ed8039e..38d84001ade 100755 --- a/dev/tests/unit/framework/bootstrap.php +++ b/dev/tests/unit/framework/bootstrap.php @@ -23,8 +23,7 @@ */ define('BP', realpath(__DIR__ . '/../../../../')); -define('TESTS_TEMP_DIR', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'tmp'); -define('DS', DIRECTORY_SEPARATOR); +define('TESTS_TEMP_DIR', dirname(__DIR__) . '/tmp'); require BP . '/app/functions.php'; require BP . '/app/autoload.php'; @@ -36,7 +35,8 @@ require BP . '/app/autoload.php'; realpath(BP . '/lib'), )); if (is_dir(TESTS_TEMP_DIR)) { - \Magento\Io\File::rmdirRecursive(TESTS_TEMP_DIR); + $filesystemAdapter = new \Magento\Filesystem\Driver\File(); + $filesystemAdapter->deleteDirectory(TESTS_TEMP_DIR); } mkdir(TESTS_TEMP_DIR); @@ -47,8 +47,8 @@ function tool_autoloader($className) if (strpos($className, 'Magento\\Tools\\') === false) { return false; } - $filePath = str_replace('\\', DS, $className); - $filePath = BP . DS . 'dev' . DS . 'tools' . DS . $filePath . '.php'; + $filePath = str_replace('\\', '/', $className); + $filePath = BP . '/dev/tools/' . $filePath . '.php'; if (file_exists($filePath)) { include_once($filePath); diff --git a/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php b/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php index 761170154c7..2fa6568f048 100644 --- a/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php +++ b/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php @@ -41,7 +41,7 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase 'translator' => 'Magento\TranslateInterface', 'cache' => 'Magento\App\CacheInterface', 'design' => 'Magento\View\DesignInterface', - 'session' => 'Magento\Core\Model\Session', + 'session' => 'Magento\Session\SessionManagerInterface', 'storeConfig' => 'Magento\Core\Model\Store\Config', 'frontController' => 'Magento\App\FrontController' ); @@ -52,7 +52,7 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase * @var array */ protected $_modelDependencies = array( - 'eventManager' => 'Magento\Event\ManagerInterface', + 'eventManager' => 'Magento\Event\ManagerInterface', 'cacheManager' => 'Magento\App\CacheInterface', 'resource' => 'Magento\Core\Model\Resource\AbstractResource', 'resourceCollection' => 'Magento\Data\Collection\Db' diff --git a/dev/tests/unit/testsuite/Magento/Acl/Resource/Config/Converter/DomTest.php b/dev/tests/unit/testsuite/Magento/Acl/Resource/Config/Converter/DomTest.php index 5be31a1b765..beb0cf0346a 100644 --- a/dev/tests/unit/testsuite/Magento/Acl/Resource/Config/Converter/DomTest.php +++ b/dev/tests/unit/testsuite/Magento/Acl/Resource/Config/Converter/DomTest.php @@ -54,8 +54,8 @@ class DomTest extends \PHPUnit_Framework_TestCase { return array( array( - include __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'converted_valid_acl.php', - file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'valid_acl.xml'), + include __DIR__ . '/_files/converted_valid_acl.php', + file_get_contents(__DIR__ . '/_files/valid_acl.xml'), ), ); } diff --git a/dev/tests/unit/testsuite/Magento/Acl/Resource/TreeBuilderTest.php b/dev/tests/unit/testsuite/Magento/Acl/Resource/TreeBuilderTest.php index e08035f5dcb..35879cddded 100644 --- a/dev/tests/unit/testsuite/Magento/Acl/Resource/TreeBuilderTest.php +++ b/dev/tests/unit/testsuite/Magento/Acl/Resource/TreeBuilderTest.php @@ -40,11 +40,7 @@ class TreeBuilderTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_model = new \Magento\Acl\Resource\TreeBuilder(); - $this->_fixturePath = realpath(__DIR__ . '/../../') - . DIRECTORY_SEPARATOR . '_files' - . DIRECTORY_SEPARATOR . 'Acl' - . DIRECTORY_SEPARATOR . 'Resource' - . DIRECTORY_SEPARATOR; + $this->_fixturePath = realpath(__DIR__ . '/../../') . '/_files/Acl/Resource/'; } public function testBuild() 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 ccd85d7bd10..6c4efa13de1 100644 --- a/dev/tests/unit/testsuite/Magento/App/Cache/Frontend/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Cache/Frontend/FactoryTest.php @@ -173,25 +173,20 @@ class FactoryTest extends \PHPUnit_Framework_TestCase ->method('create') ->will($this->returnCallback($processFrontendFunc)); - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $filesystem->expects($this->any()) - ->method('isDirectory') - ->will($this->returnValue(true)); - $filesystem->expects($this->any()) - ->method('isWritable') - ->will($this->returnValue(true)); - $map = array( - array(\Magento\App\Dir::CACHE, 'CACHE_DIR'), - array(\Magento\App\Dir::CONFIG, 'CONFIG_DIR'), + array(\Magento\Filesystem::CACHE, 'CACHE_DIR'), + array(\Magento\Filesystem::CONFIG, 'CONFIG_DIR'), ); - $dirs = $this->getMock('Magento\App\Dir', array('getDir'), array(), '', false); - $resource = $this->getMock('Magento\App\Resource', array(), array(), '', false); - $dirs->expects($this->any()) - ->method('getDir') + + $filesystem = $this->getMock('Magento\Filesystem', array('getPath'), array(), '', false); + + $filesystem->expects($this->any()) + ->method('getPath') ->will($this->returnValueMap($map)); - $model = new \Magento\App\Cache\Frontend\Factory($objectManager, $filesystem, $dirs, $resource, + $resource = $this->getMock('Magento\App\Resource', array(), array(), '', false); + + $model = new \Magento\App\Cache\Frontend\Factory($objectManager, $filesystem, $resource, $enforcedOptions, $decorators); return $model; 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 518b774b0d0..d08bca65918 100644 --- a/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/PrimaryTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/PrimaryTest.php @@ -26,34 +26,35 @@ namespace Magento\App\Config\FileResolver; class PrimaryTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\App\Config\FileResolver\Primary - */ - protected $_model; - - protected function setUp() - { - $appConfigDir = __DIR__ . DIRECTORY_SEPARATOR - . '_files' . DIRECTORY_SEPARATOR . 'primary' - . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'etc'; - - $applicationDirsMock = $this->getMock('Magento\App\Dir', array(), array('getDir'), '', false); - $applicationDirsMock->expects($this->any()) - ->method('getDir') - ->with(\Magento\App\Dir::CONFIG) - ->will($this->returnValue($appConfigDir)); - - $this->_model = new \Magento\App\Config\FileResolver\Primary($applicationDirsMock); - } - - /** - * @param array $expectedResult + * @param array $fileList * @param string $scope * @param string $filename * @dataProvider getMethodDataProvider */ - public function testGet(array $expectedResult, $scope, $filename) + public function testGet(array $fileList, $scope, $filename) { - $this->assertEquals($expectedResult, $this->_model->get($filename, $scope)); + $directory = $this->getMock('Magento\Filesystem\Directory\Read', array('search'), array(), '', false); + $filesystem = $this->getMock('Magento\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) + ->will($this->returnValue($directory)); + + $directory->expects($this->once()) + ->method('search') + ->will($this->returnValue($fileList)); + + $iteratorFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue(true)); + + $model = new \Magento\App\Config\FileResolver\Primary($filesystem, $iteratorFactory); + + $this->assertTrue($model->get($filename, $scope)); } /** @@ -61,14 +62,11 @@ class PrimaryTest extends \PHPUnit_Framework_TestCase */ public function getMethodDataProvider() { - $appConfigDir = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'primary' - . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'etc'; - return array( array( array( - $appConfigDir . DIRECTORY_SEPARATOR . 'di.xml', - $appConfigDir . DIRECTORY_SEPARATOR . 'some_config' .DIRECTORY_SEPARATOR. 'di.xml', + 'config/di.xml', + 'config/some_config/di.xml', ), 'primary', 'di.xml', diff --git a/dev/tests/unit/testsuite/Magento/App/Config/LoaderTest.php b/dev/tests/unit/testsuite/Magento/App/Config/LoaderTest.php index 204ab3ee606..1c8d4528ea6 100644 --- a/dev/tests/unit/testsuite/Magento/App/Config/LoaderTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Config/LoaderTest.php @@ -28,24 +28,24 @@ namespace Magento\App\Config; class LoaderTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\App\Config\Loader + * @var Loader */ protected $_model; /** - * @var \Magento\App\Dir | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Filesystem\DirectoryList | \PHPUnit_Framework_MockObject_MockObject */ protected $_dirs; public function setUp() { - $this->_dirs = $this->getMock('\Magento\App\Dir', array('getDir'), array(), '', false); + $this->_dirs = $this->getMock('\Magento\Filesystem\DirectoryList', array('getDir'), array(), '', false); } public function testWithOneXmlFile() { $this->_dirs->expects($this->once())->method('getDir')->will($this->returnValue(__DIR__ . '/_files')); - $this->_model = new \Magento\App\Config\Loader($this->_dirs); + $this->_model = new Loader($this->_dirs); $expected = array( 'resource' => 'resource name', 'connection' => 'connection name', @@ -57,7 +57,7 @@ class LoaderTest extends \PHPUnit_Framework_TestCase public function testWithTwoXmlFileMerging() { $this->_dirs->expects($this->once())->method('getDir')->will($this->returnValue(__DIR__ . '/_files')); - $this->_model = new \Magento\App\Config\Loader($this->_dirs, 'other/local_developer.xml'); + $this->_model = new Loader($this->_dirs, 'other/local_developer.xml'); $expected = array( 'resource' => 'resource name2', 'connection' => 'connection name2', @@ -70,7 +70,7 @@ class LoaderTest extends \PHPUnit_Framework_TestCase public function testWithoutXmlFiles() { $this->_dirs->expects($this->once())->method('getDir')->will($this->returnValue(__DIR__ . '/notExistFolder')); - $this->_model = new \Magento\App\Config\Loader($this->_dirs); + $this->_model = new Loader($this->_dirs); $this->assertEquals(array(), $this->_model->load()); } } diff --git a/dev/tests/unit/testsuite/Magento/App/Dir/VerificationTest.php b/dev/tests/unit/testsuite/Magento/App/Dir/VerificationTest.php deleted file mode 100644 index 11a250abf17..00000000000 --- a/dev/tests/unit/testsuite/Magento/App/Dir/VerificationTest.php +++ /dev/null @@ -1,220 +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. - * - * @copyright Copyright (c) 2013 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\Dir; - -class VerificationTest extends \PHPUnit_Framework_TestCase -{ - /** - * @param string $mode - * @param array $expectedDirs - * @dataProvider createAndVerifyDirectoriesDataProvider - */ - public function testCreateAndVerifyDirectoriesNonExisting($mode, $expectedDirs) - { - $model = $this->_createModelForVerification($mode, false, $actualCreatedDirs, $actualVerifiedDirs); - $model->createAndVerifyDirectories(); - - // Check - $this->assertEquals($expectedDirs, $actualCreatedDirs); - $this->assertEmpty($actualVerifiedDirs, - 'Non-existing directories must be just created, no write access verification is needed'); - } - - /** - * @param string $mode - * @param array $expectedDirs - * @dataProvider createAndVerifyDirectoriesDataProvider - */ - public function testCreateAndVerifyDirectoriesExisting($mode, $expectedDirs) - { - $model = $this->_createModelForVerification($mode, true, $actualCreatedDirs, $actualVerifiedDirs); - $model->createAndVerifyDirectories(); - - // Check - $this->assertEmpty($actualCreatedDirs, 'Directories must not be created, when they exist'); - $this->assertEquals($expectedDirs, $actualVerifiedDirs); - } - - /** - * Create model to test creation of directories and verification of their write-access - * - * @param string $mode - * @param bool $isExist - * @param array $actualCreatedDirs - * @param array $actualVerifiedDirs - * @return \Magento\App\Dir\Verification - */ - protected function _createModelForVerification($mode, $isExist, &$actualCreatedDirs, &$actualVerifiedDirs) - { - $dirs = new \Magento\App\Dir('base_dir'); - $appState = new \Magento\App\State( - $this->getMockForAbstractClass('Magento\Config\ScopeInterface', array(), '', false), - time(), - $mode - ); - - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $filesystem->expects($this->any()) - ->method('isDirectory') - ->will($this->returnValue($isExist)); - - $actualCreatedDirs = array(); - $callbackCreate = function ($dir) use (&$actualCreatedDirs) { - $actualCreatedDirs[] = $dir; - }; - $filesystem->expects($this->any()) - ->method('createDirectory') - ->will($this->returnCallback($callbackCreate)); - - $actualVerifiedDirs = array(); - $callbackVerify = function ($dir) use (&$actualVerifiedDirs) { - $actualVerifiedDirs[] = $dir; - return true; - }; - $filesystem->expects($this->any()) - ->method('isWritable') - ->will($this->returnCallback($callbackVerify)); - - return new \Magento\App\Dir\Verification( - $filesystem, - $dirs, - $appState - ); - } - - /** - * @return array - */ - public static function createAndVerifyDirectoriesDataProvider() - { - return array( - 'developer mode' => array( - \Magento\App\State::MODE_DEVELOPER, - array( - 'base_dir/pub/media', - 'base_dir/pub/static', - 'base_dir/var', - 'base_dir/var/tmp', - 'base_dir/var/cache', - 'base_dir/var/log', - 'base_dir/var/session' - ), - ), - 'default mode' => array( - \Magento\App\State::MODE_DEFAULT, - array( - 'base_dir/pub/media', - 'base_dir/pub/static', - 'base_dir/var', - 'base_dir/var/tmp', - 'base_dir/var/cache', - 'base_dir/var/log', - 'base_dir/var/session' - ), - ), - 'production mode' => array( - \Magento\App\State::MODE_PRODUCTION, - array( - 'base_dir/pub/media', - 'base_dir/var', - 'base_dir/var/tmp', - 'base_dir/var/cache', - 'base_dir/var/log', - 'base_dir/var/session' - ), - ), - ); - } - - public function testCreateAndVerifyDirectoriesCreateException() - { - // Plan - $this->setExpectedException('Magento\BootstrapException', - 'Cannot create or verify write access: base_dir/var/log, base_dir/var/session'); - - $dirs = new \Magento\App\Dir('base_dir'); - $appState = new \Magento\App\State( - $this->getMockForAbstractClass('Magento\Config\ScopeInterface', array(), '', false), - time() - ); - - $callback = function ($dir) { - if (($dir == 'base_dir/var/log') || ($dir == 'base_dir/var/session')) { - throw new \Magento\Filesystem\FilesystemException(); - } - }; - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $filesystem->expects($this->any()) - ->method('createDirectory') - ->will($this->returnCallback($callback)); - - // Do - $model = new \Magento\App\Dir\Verification( - $filesystem, - $dirs, - $appState - ); - $model->createAndVerifyDirectories(); - } - - public function testCreateAndVerifyDirectoriesWritableException() - { - // Plan - $this->setExpectedException('Magento\BootstrapException', - 'Cannot create or verify write access: base_dir/var/log, base_dir/var/session'); - - $dirs = new \Magento\App\Dir('base_dir'); - $appState = new \Magento\App\State( - $this->getMockForAbstractClass('Magento\Config\ScopeInterface', array(), '', false), - time() - ); - - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $filesystem->expects($this->any()) - ->method('isDirectory') - ->will($this->returnValue(true)); - - $dirWritableMap = array( - array('base_dir/pub/media', null, true), - array('base_dir/pub/static', null, true), - array('base_dir/var', null, true), - array('base_dir/var/tmp', null, true), - array('base_dir/var/cache', null, true), - array('base_dir/var/log', null, false), - array('base_dir/var/session', null, false), - ); - $filesystem->expects($this->any()) - ->method('isWritable') - ->will($this->returnValueMap($dirWritableMap)); - - // Do - $model = new \Magento\App\Dir\Verification( - $filesystem, - $dirs, - $appState - ); - $model->createAndVerifyDirectories(); - } -} diff --git a/dev/tests/unit/testsuite/Magento/App/Error/HandlerTest.php b/dev/tests/unit/testsuite/Magento/App/Error/HandlerTest.php index 309e7846d90..d5b6ecf1e67 100644 --- a/dev/tests/unit/testsuite/Magento/App/Error/HandlerTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Error/HandlerTest.php @@ -28,74 +28,91 @@ namespace Magento\App\Error; class HandlerTest extends \PHPUnit_Framework_TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject + * Logger mock + * + * @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject */ - protected $_loggerMock; + protected $logger; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * Filesystem mock + * + * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ - protected $_dirMock; + protected $filesystem; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * App state mock + * + * @var \Magento\App\State|\PHPUnit_Framework_MockObject_MockObject */ - protected $_appStateMock; + protected $appState; + + /** + * Handler instance + * + * @var \Magento\App\Error\Handler + */ + protected $handler; protected function setUp() { - $this->_loggerMock = $this->getMock('Magento\Logger', array(), array(), '', false); - $this->_dirMock = $this->getMock('Magento\App\Dir', array(), array(BP), '', true); - $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); + $this->logger = $this->getMock('Magento\Logger', array(), array(), '', false); + $this->filesystem = $this->getMock('Magento\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); } /** + * Test for processException method print + * * @covers \Magento\Error\Handler::processException */ public function testProcessExceptionPrint() { - $handler = new \Magento\App\Error\Handler($this->_loggerMock, $this->_dirMock, $this->_appStateMock); - $this->_appStateMock->expects($this->any())->method('getMode') + $this->appState->expects($this->any())->method('getMode') ->will($this->returnValue(\Magento\App\State::MODE_DEVELOPER)); $exception = new \Exception('TestMessage'); ob_start(); - $handler->processException($exception); + $this->handler->processException($exception); $actualResult = ob_get_contents(); ob_end_clean(); $this->assertRegExp('/TestMessage/', $actualResult); } /** + * Test for processException method report + * * @covers \Magento\Error\Handler::processException */ public function testProcessExceptionReport() { - $handler = new \Magento\App\Error\Handler($this->_loggerMock, $this->_dirMock, $this->_appStateMock); - $this->_appStateMock->expects($this->any())->method('getMode') + $this->appState->expects($this->any())->method('getMode') ->will($this->returnValue(\Magento\App\State::MODE_DEFAULT)); - $this->_dirMock->expects($this->atLeastOnce()) - ->method('getDir') - ->with(\Magento\App\Dir::PUB) - ->will($this->returnValue(dirname(__DIR__) . DS . '..' . DS . '_files')); + $this->filesystem->expects($this->atLeastOnce()) + ->method('getPath') + ->with(\Magento\Filesystem::PUB) + ->will($this->returnValue(dirname(__DIR__) . '/../_files')); $exception = new \Exception('TestMessage'); - $handler->processException($exception); + $this->handler->processException($exception); } /** + * Test for setting error handler and logging + * * @covers \Magento\Error\Handler::handler * @throws \Exception */ public function testErrorHandlerLogging() { - $handler = new \Magento\App\Error\Handler($this->_loggerMock, $this->_dirMock, $this->_appStateMock); - $this->_appStateMock->expects($this->any())->method('getMode') + $this->appState->expects($this->any())->method('getMode') ->will($this->returnValue(\Magento\App\State::MODE_DEFAULT)); - $this->_loggerMock->expects($this->once()) + $this->logger->expects($this->once()) ->method('log') ->with($this->stringContains('testErrorHandlerLogging'), \Zend_Log::ERR); - set_error_handler(array($handler, 'handler')); + set_error_handler(array($this->handler, 'handler')); try { trigger_error('testErrorHandlerLogging', E_USER_NOTICE); restore_error_handler(); @@ -106,16 +123,17 @@ class HandlerTest extends \PHPUnit_Framework_TestCase } /** + * Test for setting error handler and printing + * * @covers \Magento\Error\Handler::handler * @expectedException \Exception * @throws \Exception */ public function testErrorHandlerPrint() { - $handler = new \Magento\App\Error\Handler($this->_loggerMock, $this->_dirMock, $this->_appStateMock); - $this->_appStateMock->expects($this->any())->method('getMode') + $this->appState->expects($this->any())->method('getMode') ->will($this->returnValue(\Magento\App\State::MODE_DEVELOPER)); - set_error_handler(array($handler, 'handler')); + set_error_handler(array($this->handler, 'handler')); try { trigger_error('testErrorHandlerPrint', E_USER_NOTICE); } catch (\Exception $e) { diff --git a/dev/tests/unit/testsuite/Magento/App/FrontControllerTest.php b/dev/tests/unit/testsuite/Magento/App/FrontControllerTest.php index 930a238c6b8..29e49e29d86 100644 --- a/dev/tests/unit/testsuite/Magento/App/FrontControllerTest.php +++ b/dev/tests/unit/testsuite/Magento/App/FrontControllerTest.php @@ -31,11 +31,6 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase */ protected $_model; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_response; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -53,14 +48,13 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_response = $this->getMock('Magento\App\Response\Http', array(), array(), '', false); $this->_request = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); $this->_router = $this->getMock('Magento\App\Router\AbstractRouter', array('match'), array(), '', false); $this->_routerList = $this->getMock('Magento\App\RouterList', array(), array(), '', false); $this->_routerList->expects($this->any()) ->method('getIterator')->will($this->returnValue($this->_routerList)); - $this->_model = new \Magento\App\FrontController($this->_response, $this->_routerList); + $this->_model = new \Magento\App\FrontController($this->_routerList); } /** diff --git a/dev/tests/unit/testsuite/Magento/App/Resource/Config/ConverterTest.php b/dev/tests/unit/testsuite/Magento/App/Resource/Config/ConverterTest.php index c16cdfaceb5..32c729dd7d0 100644 --- a/dev/tests/unit/testsuite/Magento/App/Resource/Config/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Resource/Config/ConverterTest.php @@ -42,7 +42,7 @@ class ConverterTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filePath = __DIR__ . '/_files' . DIRECTORY_SEPARATOR; + $this->_filePath = __DIR__ . '/_files/'; $this->_source = new \DOMDocument(); $this->_model = new \Magento\App\Resource\Config\Converter(); } diff --git a/dev/tests/unit/testsuite/Magento/App/Resource/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/App/Resource/Config/ReaderTest.php index 416cb8574e5..8a07947b7ea 100644 --- a/dev/tests/unit/testsuite/Magento/App/Resource/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Resource/Config/ReaderTest.php @@ -62,7 +62,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filePath = __DIR__ . '/_files' . DIRECTORY_SEPARATOR; + $this->_filePath = __DIR__ . '/_files/'; $this->_fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $this->_validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); @@ -107,7 +107,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->_fileResolverMock->expects($this->once()) ->method('get') - ->will($this->returnValue(array($this->_filePath . 'resources.xml'))); + ->will($this->returnValue(array(file_get_contents($this->_filePath . 'resources.xml')))); $this->_converterMock->expects($this->once()) ->method('convert') diff --git a/dev/tests/unit/testsuite/Magento/App/Resource/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/App/Resource/Config/SchemaLocatorTest.php index 9ff830d4b94..bcb10a428ee 100644 --- a/dev/tests/unit/testsuite/Magento/App/Resource/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Resource/Config/SchemaLocatorTest.php @@ -37,17 +37,17 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_expected = BP . str_replace('\\', DIRECTORY_SEPARATOR, '\lib\Magento\App\etc\resources.xsd'); + $this->_expected = str_replace('\\', '/', BP) . '/lib/Magento/App/etc/resources.xsd'; $this->_model = new \Magento\App\Resource\Config\SchemaLocator(); } public function testGetSchema() { - $this->assertEquals($this->_expected, $this->_model->getSchema()); + $this->assertEquals($this->_expected, str_replace('\\', '/', $this->_model->getSchema())); } public function testGetPerFileSchema() { - $this->assertEquals($this->_expected, $this->_model->getPerFileSchema()); + $this->assertEquals($this->_expected, str_replace('\\', '/', $this->_model->getPerFileSchema())); } } 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 4920e80b83f..b6eeb1c75f9 100644 --- a/dev/tests/unit/testsuite/Magento/App/Response/Http/FileFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Response/Http/FileFactoryTest.php @@ -30,11 +30,6 @@ class FileFactoryTest extends \PHPUnit_Framework_TestCase */ protected $_model; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_responseFactory; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -47,17 +42,18 @@ class FileFactoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_responseFactory = $this->getMock('Magento\App\ResponseFactory', array(), array(), '', false); - $this->_fileSystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_fileSystemMock = $this->getMock( + 'Magento\Filesystem', array('getFileSize', 'isFile'), array(), '', false + ); + $this->_fileSystemMock->expects($this->any())->method('getFileSize') + ->withAnyParameters()->will($this->returnValue(0)); + $this->_fileSystemMock->expects($this->any())->method('isFile') + ->withAnyParameters()->will($this->returnValue(0)); $this->_responseMock = $this->getMock('Magento\App\Response\Http', array('setHeader'), array(), '', false); - $this->_responseFactory - ->expects($this->any()) - ->method('create') - ->will($this->returnValue($this->_responseMock)); $this->_responseMock->expects($this->any())->method('setHeader') ->will($this->returnValue($this->_responseMock)); $this->_model = new \Magento\App\Response\Http\FileFactory( - $this->_responseFactory, + $this->_responseMock, $this->_fileSystemMock ); } @@ -81,8 +77,9 @@ class FileFactoryTest extends \PHPUnit_Framework_TestCase 'type' => 'filename', 'value' => $file ); - $this->_fileSystemMock->expects($this->once())->method('getFileSize')->will($this->returnValue('string')); - $this->_fileSystemMock->expects($this->once())->method('isFile')->with($file)->will($this->returnValue(false)); + $this->_fileSystemMock->expects($this->any()) + ->method('stat') + ->will($this->returnValue(array('size' => 'string'))); $this->_model->create('fileName', $content); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Authorizenet/Helper/BackendTest.php b/dev/tests/unit/testsuite/Magento/Authorizenet/Helper/BackendTest.php index 2f6dd2156a8..b5d97c981c5 100644 --- a/dev/tests/unit/testsuite/Magento/Authorizenet/Helper/BackendTest.php +++ b/dev/tests/unit/testsuite/Magento/Authorizenet/Helper/BackendTest.php @@ -44,9 +44,13 @@ class BackendTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_urlBuilder = $this->getMock('Magento\Backend\Model\Url', array('getUrl'), array(), '', false); + $contextMock = $this->getMock('Magento\App\Helper\Context', array(), array(), '', false); + $contextMock->expects($this->any()) + ->method('getUrlBuilder') + ->will($this->returnValue($this->_urlBuilder)); $this->_orderFactory = $this->getMock('Magento\Sales\Model\OrderFactory', array('create'), array(), '', false); $this->_model = new Backend( - $this->getMock('Magento\App\Helper\Context', array(), array(), '', false), + $contextMock, $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false), $this->_orderFactory, $this->_urlBuilder diff --git a/dev/tests/unit/testsuite/Magento/Backend/App/Response/Http/FileFactoryTest.php b/dev/tests/unit/testsuite/Magento/Backend/App/Response/Http/FileFactoryTest.php index 1e8fac0b3a2..5eea1848a85 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/App/Response/Http/FileFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/App/Response/Http/FileFactoryTest.php @@ -30,11 +30,6 @@ class FileFactoryTest extends \PHPUnit_Framework_TestCase */ protected $_model; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_responseFactory; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -58,12 +53,7 @@ class FileFactoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_responseFactory = $this->getMock('Magento\App\ResponseFactory', array(), array(), '', false); $this->_responseMock = $this->getMock('Magento\App\Response\Http', array('setRedirect'), array(), '', false); - $this->_responseFactory - ->expects($this->any()) - ->method('create') - ->will($this->returnValue($this->_responseMock)); $this->_responseMock ->expects($this->any()) ->method('setRedirect') @@ -73,7 +63,7 @@ class FileFactoryTest extends \PHPUnit_Framework_TestCase $this->_backendUrl = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false); $this->_authMock = $this->getMock('Magento\Backend\Model\Auth', array(), array(), '', false); $this->_model = $helper->getObject('Magento\Backend\App\Response\Http\FileFactory', array( - 'responseFactory' => $this->_responseFactory, + 'response' => $this->_responseMock, 'auth' => $this->_authMock, 'backendUrl' => $this->_backendUrl, 'session' => $this->_sessionMock, @@ -92,4 +82,4 @@ class FileFactoryTest extends \PHPUnit_Framework_TestCase $this->_sessionMock->expects($this->once())->method('setIsUrlNotice'); $this->_model->create('fileName', null); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/ExportTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/ExportTest.php index e44201052f1..0deb18a88ca 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/ExportTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/ExportTest.php @@ -34,20 +34,14 @@ class ExportTest extends \PHPUnit_Framework_TestCase */ protected $_object; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_helperFactoryMock; - protected function setUp() { - $this->_helperFactoryMock = $this->getMock('Magento\App\Helper\HelperFactory', - array(), array(), '', false, false - ); + $helperMock = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false, false); + $helperMock->expects($this->once())->method('getUrl')->with("*/*/exportTablerates", array('website' => 1)); $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_object = $objectManager->getObject('Magento\Backend\Block\System\Config\Form\Field\Export', array( - 'helperFactory' => $this->_helperFactoryMock) + 'helper' => $helperMock) ); } @@ -66,12 +60,6 @@ class ExportTest extends \PHPUnit_Framework_TestCase $requestMock = $this->getMock('Magento\App\RequestInterface', array(), array(), '', false, false); $requestMock->expects($this->once())->method('getParam')->with('website')->will($this->returnValue(1)); - $helperMock = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false, false); - $helperMock->expects($this->once())->method('getUrl')->with("*/*/exportTablerates", array('website' => 1)); - - $this->_helperFactoryMock->expects($this->any()) - ->method('get')->with('Magento\Backend\Helper\Data')->will($this->returnValue($helperMock)); - $mockData = $this->getMock('StdClass', array('toHtml')); $mockData->expects($this->once())->method('toHtml')->will($this->returnValue($expected)); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/FieldsetTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/FieldsetTest.php index c39c1b54b55..53c26c6885d 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/FieldsetTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/FieldsetTest.php @@ -65,9 +65,9 @@ class FieldsetTest extends \PHPUnit_Framework_TestCase protected $_testHelper; /** - * @var \Magento\App\Helper\HelperFactory + * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_helperFactoryMock; + protected $_helperMock; protected function setUp() { @@ -78,15 +78,14 @@ class FieldsetTest extends \PHPUnit_Framework_TestCase $groupMock = $this->getMock('Magento\Backend\Model\Config\Structure\Element\Group', array(), array(), '', false); $groupMock->expects($this->once())->method('getFieldsetCss')->will($this->returnValue('test_fieldset_css')); - $this->_helperFactoryMock = $this->getMock( - 'Magento\App\Helper\HelperFactory', array('get'), array(), '', false, false - ); + + $this->_helperMock = $this->getMock('Magento\Core\Helper\Js', array(), array(), '', false, false); $data = array( 'request' => $this->_requestMock, 'urlBuilder' => $this->_urlModelMock, 'layout' => $this->_layoutMock, - 'helperFactory' => $this->_helperFactoryMock, + 'jsHelper' => $this->_helperMock, 'data' => array( 'group' => $groupMock ) @@ -126,14 +125,6 @@ class FieldsetTest extends \PHPUnit_Framework_TestCase public function testRenderWithoutStoredElements() { - $helperMock = $this->getMock('Magento\Core\Helper\Js', array(), array(), '', false, false); - - $this->_helperFactoryMock - ->expects($this->once()) - ->method('get') - ->with('Magento\Core\Helper\Js') - ->will($this->returnValue($helperMock)); - $collection = $this->_testHelper->getObject('Magento\Data\Form\Element\Collection'); $this->_elementMock->expects($this->any())->method('getElements')->will($this->returnValue($collection)); $actualHtml = $this->_object->render($this->_elementMock); @@ -144,14 +135,7 @@ class FieldsetTest extends \PHPUnit_Framework_TestCase public function testRenderWithStoredElements() { - $helperMock = $this->getMock('Magento\Core\Helper\Js', array(), array(), '', false, false); - $helperMock->expects($this->any())->method('getScript')->will($this->returnArgument(0)); - - $this->_helperFactoryMock - ->expects($this->once()) - ->method('get') - ->with('Magento\Core\Helper\Js') - ->will($this->returnValue($helperMock)); + $this->_helperMock->expects($this->any())->method('getScript')->will($this->returnArgument(0)); $fieldMock = $this->getMock('Magento\Data\Form\Element\Text', array('getId', 'getTooltip', 'toHtml'), diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/TabsTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/TabsTest.php index 54465b9b580..6ac2ac7ba17 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/TabsTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/TabsTest.php @@ -49,11 +49,6 @@ class TabsTest extends \PHPUnit_Framework_TestCase */ protected $_urlBuilderMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Helper\HelperFactory - */ - protected $_helperFactoryMock; - protected function setUp() { $this->_requestMock = $this->getMock('Magento\App\RequestInterface', array(), array(), '', false); @@ -63,21 +58,10 @@ class TabsTest extends \PHPUnit_Framework_TestCase $this->_structureMock->expects($this->once())->method('getTabs')->will($this->returnValue(array())); $this->_urlBuilderMock = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false); - $this->_helperFactoryMock = $this->getMock( - 'Magento\App\Helper\HelperFactory', array('get'), array(), '', false, false - ); - $backendHelperMock = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false); - $this->_helperFactoryMock - ->expects($this->once()) - ->method('get') - ->with('Magento\Backend\Helper\Data', array()) - ->will($this->returnValue($backendHelperMock)); - $data = array( 'configStructure' => $this->_structureMock, 'request' => $this->_requestMock, 'urlBuilder' => $this->_urlBuilderMock, - 'helperFactory' => $this->_helperFactoryMock, ); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_object = $helper->getObject('Magento\Backend\Block\System\Config\Tabs', $data); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/UrlrewriteTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/UrlrewriteTest.php index cf4d341dae5..93136783eda 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/UrlrewriteTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/UrlrewriteTest.php @@ -36,15 +36,15 @@ class UrlrewriteTest extends \PHPUnit_Framework_TestCase */ public function testGetCreateUrl(array $modes, $expectedUrl) { - /** @var $selectorBlock \Magento\Adminhtml\Block\Urlrewrite\Selector */ + /** @var $selectorBlock \Magento\Backend\Block\Urlrewrite\Selector */ $selectorBlock = $modes - ? $this->getMock('Magento\Adminhtml\Block\Urlrewrite\Selector', array('getModes'), array(), '', false) + ? $this->getMock('Magento\Backend\Block\Urlrewrite\Selector', array('getModes'), array(), '', false) : false; if ($selectorBlock) { $selectorBlock->expects($this->once())->method('getModes')->with()->will($this->returnValue($modes)); } - $testedBlock = $this->getMock('Magento\Adminhtml\Block\Urlrewrite', array('getUrl'), array(), '', false); + $testedBlock = $this->getMock('Magento\Backend\Block\Urlrewrite', array('getUrl'), array(), '', false); $testedBlock->setSelectorBlock($selectorBlock); $testedBlock->expects($this->once()) ->method('getUrl') diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/ButtonTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/ButtonTest.php index fdd866eb34b..8ae8c8ede9e 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/ButtonTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/ButtonTest.php @@ -52,30 +52,18 @@ class ButtonTest extends \PHPUnit_Framework_TestCase */ protected $_buttonMock; - /** - * @var \Magento\App\Helper\HelperFactory - */ - protected $_helperFactoryMock; - protected function setUp() { $this->_layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false, false); - $this->_helperFactoryMock = $this->getMock( - 'Magento\App\Helper\HelperFactory', array('get'), array(), '', false, false - ); - $arguments = array( - 'urlBuilder' => - $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false, false), + 'urlBuilder' => $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false, false), 'layout' => $this->_layoutMock, - 'helperFactory' => $this->_helperFactoryMock, ); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_blockMock = - $objectManagerHelper->getObject('Magento\Backend\Block\Widget\Button', $arguments); + $this->_blockMock = $objectManagerHelper->getObject('Magento\Backend\Block\Widget\Button', $arguments); } protected function tearDown() @@ -90,20 +78,6 @@ class ButtonTest extends \PHPUnit_Framework_TestCase */ public function testGetAttributesHtml($data, $expect) { - $coreHelperMock = $this->getMock( - 'Magento\Core\Helper\Data', array(), array(), '', false, false - ); - $backendHelperMock = $this->getMock( - 'Magento\Backend\Helper\Data', array(), array(), '', false, false - ); - $this->_helperFactoryMock - ->expects($this->any()) - ->method('get') - ->will($this->returnValueMap(array( - array('Magento\Core\Helper\Data', array(), $coreHelperMock), - array('Magento\Backend\Helper\Data', array(), $backendHelperMock), - ))); - $this->_blockMock->setData($data); $attributes = $this->_blockMock->getAttributesHtml(); $this->assertRegExp($expect, $attributes); diff --git a/dev/tests/unit/testsuite/Magento/Adminhtml/Widget/Form/ContainerTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Form/ContainerTest.php similarity index 91% rename from dev/tests/unit/testsuite/Magento/Adminhtml/Widget/Form/ContainerTest.php rename to dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Form/ContainerTest.php index 78047e7da5f..19d8e89e6e9 100644 --- a/dev/tests/unit/testsuite/Magento/Adminhtml/Widget/Form/ContainerTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Form/ContainerTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Widget\Form; +namespace Magento\Backend\Block\Widget\Form; class ContainerTest extends \PHPUnit_Framework_TestCase { @@ -35,7 +35,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase $dataObject = new \Magento\Object; // _prepateLayout() is blocked, because it is used by block to instantly add 'form' child - $block = $this->getMock('Magento\Adminhtml\Block\Widget\Form\Container', array('getChildBlock'), array(), '', + $block = $this->getMock('Magento\Backend\Block\Widget\Form\Container', array('getChildBlock'), array(), '', false); $block->expects($this->once()) ->method('getChildBlock') diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php index d02b8e2bdd6..aec533457c1 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php @@ -37,11 +37,6 @@ class MassactionTest extends \PHPUnit_Framework_TestCase */ protected $_block; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_backendHelperMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -67,11 +62,6 @@ class MassactionTest extends \PHPUnit_Framework_TestCase */ protected $_requestMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Helper\HelperFactory - */ - protected $_helperFactoryMock; - protected function setUp() { $this->_gridMock = $this->getMock('Magento\Backend\Block\Widget\Grid', array('getId'), array(), '', false); @@ -83,10 +73,6 @@ class MassactionTest extends \PHPUnit_Framework_TestCase array(), '', false, false ); - $this->_backendHelperMock = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false); - $this->_layoutMock->expects($this->any()) - ->method('helper') - ->will($this->returnValue($this->_backendHelperMock)); $this->_layoutMock->expects($this->any()) ->method('getParentName') ->with('test_grid_massaction') @@ -100,20 +86,10 @@ class MassactionTest extends \PHPUnit_Framework_TestCase $this->_urlModelMock = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false); - $this->_helperFactoryMock = $this->getMock( - 'Magento\App\Helper\HelperFactory', array('get'), array(), '', false, false - ); - $this->_helperFactoryMock - ->expects($this->any()) - ->method('get') - ->with('Magento\Backend\Helper\Data') - ->will($this->returnValue($this->_backendHelperMock)); - $arguments = array( 'layout' => $this->_layoutMock, 'request' => $this->_requestMock, 'urlBuilder' => $this->_urlModelMock, - 'helperFactory' => $this->_helperFactoryMock, 'data' => array( 'massaction_id_field' => 'test_id', 'massaction_id_filter' => 'test_id' @@ -128,7 +104,6 @@ class MassactionTest extends \PHPUnit_Framework_TestCase protected function tearDown() { unset($this->_layoutMock); - unset($this->_backendHelperMock); unset($this->_eventManagerMock); unset($this->_gridMock); unset($this->_urlModelMock); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php b/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php index 03132e99598..ebef2bdf317 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php @@ -30,37 +30,58 @@ class CacheTest extends \PHPUnit_Framework_TestCase { // Wire object with mocks $response = $this->getMock('Magento\App\Response\Http', array(), array(), '', false); + $request = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $objectManager = $this->getMock('Magento\ObjectManager'); - $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $backendHelper = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false); + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $session = $this->getMock( - 'Magento\Core\Model\Session\AbstractSession', + 'Magento\Backend\Model\Session', + array('setIsUrlNotice'), + $helper->getConstructArguments('Magento\Backend\Model\Session') + ); + $messageManager = $this->getMock( + 'Magento\Message\Manager', array('addSuccess'), - array(), - '', - false + $helper->getConstructArguments('Magento\Message\Manager') ); - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $controller = $helper->getObject('Magento\Backend\Controller\Adminhtml\Cache', array( - 'objectManager' => $objectManager, + $context = $this->getMock( + 'Magento\Backend\App\Action\Context', + array('getRequest', 'getResponse', 'getMessageManager', 'getSession'), + $helper->getConstructArguments('Magento\Backend\App\Action\Context', array( + 'session' => $session, 'response' => $response, + 'objectManager' => $objectManager, 'helper' => $backendHelper, - 'eventManager' => $eventManager - ) + 'request' => $request, + 'messageManager' => $messageManager + )) ); + $context->expects($this->once())->method('getRequest')->will($this->returnValue($request)); + $context->expects($this->once())->method('getResponse')->will($this->returnValue($response)); + $context->expects($this->once())->method('getSession')->will($this->returnValue($session)); + $context->expects($this->once())->method('getMessageManager')->will($this->returnValue($messageManager)); + $controller = $helper->getObject('Magento\Backend\Controller\Adminhtml\Cache', array( + 'context' => $context + )); // Setup expectations $mergeService = $this->getMock('Magento\View\Asset\MergeService', array(), array(), '', false); $mergeService->expects($this->once()) ->method('cleanMergedJsCss'); - $session->expects($this->once()) + $messageManager->expects($this->once()) ->method('addSuccess') ->with('The JavaScript/CSS cache has been cleaned.'); + $session->expects($this->once()) + ->method('setIsUrlNotice') + ->will($this->returnSelf()); + $valueMap = array( array('Magento\View\Asset\MergeService', $mergeService), - array('Magento\Core\Model\Session\AbstractSession', $session), + array('Magento\Session\SessionManager', $session), ); $objectManager->expects($this->any()) ->method('get') diff --git a/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/AccountTest.php b/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/AccountTest.php index 21f2458898e..010cca26377 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/AccountTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/AccountTest.php @@ -41,8 +41,8 @@ class AccountTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\ObjectManager\ObjectManager */ protected $_objectManagerMock; - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\Model\Session */ - protected $_sessionMock; + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Message\ManagerInterface */ + protected $_messagesMock; /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\Helper\Data */ protected $_helperMock; @@ -84,10 +84,10 @@ class AccountTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->setMethods(array('getUrl')) ->getMock(); - $this->_sessionMock = $this->getMockBuilder('Magento\Backend\Model\Session') + $this->_messagesMock = $this->getMockBuilder('Magento\Message\Manager') ->disableOriginalConstructor() ->setMethods(array('addSuccess')) - ->getMock(); + ->getMockForAbstractClass(); $this->_authSessionMock = $this->getMockBuilder('Magento\Backend\Model\Auth\Session') ->disableOriginalConstructor() @@ -125,7 +125,8 @@ class AccountTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($frontControllerMock)); $contextMock->expects($this->any())->method('getHelper')->will($this->returnValue($this->_helperMock)); - $contextMock->expects($this->any())->method('getSession')->will($this->returnValue($this->_sessionMock)); + $contextMock->expects($this->any()) + ->method('getMessageManager')->will($this->returnValue($this->_messagesMock)); $contextMock->expects($this->any())->method('getTranslator')->will($this->returnValue($this->_translatorMock)); $args = array('context' => $contextMock); @@ -182,7 +183,7 @@ class AccountTest extends \PHPUnit_Framework_TestCase $this->_requestMock->setParams($requestParams); - $this->_sessionMock->expects($this->once())->method('addSuccess')->with($this->equalTo($testedMessage)); + $this->_messagesMock->expects($this->once())->method('addSuccess')->with($this->equalTo($testedMessage)); $this->_controller->saveAction(); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/Config/SaveTest.php b/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/Config/SaveTest.php index 7e1fd21540f..59cb4c0c862 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/Config/SaveTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/Config/SaveTest.php @@ -52,7 +52,7 @@ class SaveTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_sessionMock; + protected $messageManagerMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -89,7 +89,8 @@ class SaveTest extends \PHPUnit_Framework_TestCase false); $helperMock = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false, false); - $this->_sessionMock = $this->getMock('Magento\Backend\Model\Session', + + $this->messageManagerMock = $this->getMock('Magento\Message\Manager', array('addSuccess', 'addException'), array(), '', false, false ); @@ -114,10 +115,10 @@ class SaveTest extends \PHPUnit_Framework_TestCase $arguments = array( 'request' => $this->_requestMock, 'response' => $this->_responseMock, - 'session' => $this->_sessionMock, 'helper' => $helperMock, 'eventManager' => $this->_eventManagerMock, - 'auth' => $this->_authMock + 'auth' => $this->_authMock, + 'messageManager' => $this->messageManagerMock ); $context = $helper->getObject('Magento\Backend\App\Action\Context', $arguments); @@ -137,7 +138,7 @@ class SaveTest extends \PHPUnit_Framework_TestCase public function testIndexActionWithAllowedSection() { $this->_sectionMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); - $this->_sessionMock->expects($this->once())->method('addSuccess')->with('You saved the configuration.'); + $this->messageManagerMock->expects($this->once())->method('addSuccess')->with('You saved the configuration.'); $groups = array('some_key' => 'some_value'); $requestParamMap = array( @@ -175,8 +176,8 @@ class SaveTest extends \PHPUnit_Framework_TestCase $backendConfigMock = $this->getMock('Magento\Backend\Model\Config', array(), array(), '', false, false); $backendConfigMock->expects($this->never())->method('save'); $this->_eventManagerMock->expects($this->never())->method('dispatch'); - $this->_sessionMock->expects($this->never())->method('addSuccess'); - $this->_sessionMock->expects($this->once())->method('addException'); + $this->messageManagerMock->expects($this->never())->method('addSuccess'); + $this->messageManagerMock->expects($this->once())->method('addException'); $this->_configFactoryMock->expects($this->any())->method('create') ->will($this->returnValue($backendConfigMock)); @@ -202,7 +203,7 @@ class SaveTest extends \PHPUnit_Framework_TestCase { $this->_sectionMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); - $fixturePath = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; + $fixturePath = __DIR__ . '/_files/'; $groups = require_once($fixturePath . 'groups_array.php'); $requestParamMap = array( array('section', null, 'test_section'), diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/SchemaLocatorTest.php index 4ba7c7a3d8d..aca13302a4c 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/SchemaLocatorTest.php @@ -48,11 +48,11 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase public function testGetSchema() { - $this->assertEquals('schema_dir' . DIRECTORY_SEPARATOR . 'system.xsd', $this->_model->getSchema()); + $this->assertEquals('schema_dir/system.xsd', $this->_model->getSchema()); } public function testGetPerFileSchema() { - $this->assertEquals('schema_dir' . DIRECTORY_SEPARATOR . 'system_file.xsd', $this->_model->getPerFileSchema()); + $this->assertEquals('schema_dir/system_file.xsd', $this->_model->getPerFileSchema()); } } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/SchemaLocatorTest.php index 663e2cafb39..caebd9bedfa 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/SchemaLocatorTest.php @@ -47,7 +47,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase public function testGetSchema() { - $this->assertEquals('schema_dir' . DIRECTORY_SEPARATOR . 'menu.xsd', $this->_model->getSchema()); + $this->assertEquals('schema_dir/menu.xsd', $this->_model->getSchema()); } public function testGetPerFileSchema() diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Item/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Item/FactoryTest.php deleted file mode 100644 index 3de350f30af..00000000000 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Item/FactoryTest.php +++ /dev/null @@ -1,105 +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_Backend - * @subpackage unit_tests - * @copyright Copyright (c) 2013 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\Model\Menu\Item; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Backend\Model\Menu\Item\Factory - */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_helperFactoryMock; - - /** - * Constructor params - * - * @var array - */ - protected $_params = array(); - - protected function setUp() - { - $this->_objectFactoryMock = $this->getMock('Magento\ObjectManager'); - $this->_helperFactoryMock = $this->getMock('Magento\App\Helper\HelperFactory', array(), array(), '', false); - $this->_helperFactoryMock - ->expects($this->any()) - ->method('get') - ->will($this->returnValueMap(array( - array('Magento\Backend\Helper\Data', array(), 'backend_helper'), - array('Magento\User\Helper\Data', array(), 'user_helper') - ))); - - $this->_model = new \Magento\Backend\Model\Menu\Item\Factory($this->_objectFactoryMock, - $this->_helperFactoryMock); - } - - public function testCreate() - { - $this->_objectFactoryMock - ->expects($this->once()) - ->method('create') - ->with( - $this->equalTo('Magento\Backend\Model\Menu\Item'), - $this->equalTo(array( - 'helper' => 'user_helper', - 'data' => array( - 'title' => 'item1', - 'dependsOnModule' => 'Magento\User\Helper\Data', - ) - )) - ); - $this->_model->create(array( - 'module' => 'Magento\User\Helper\Data', - 'title' => 'item1', - 'dependsOnModule' => 'Magento\User\Helper\Data' - )); - } - - public function testCreateProvidesDefaultHelper() - { - $this->_objectFactoryMock->expects($this->once()) - ->method('create') - ->with( - $this->equalTo('Magento\Backend\Model\Menu\Item'), - $this->equalTo(array( - 'helper' => 'backend_helper', - 'data' => array() - )) - ); - $this->_model->create(array()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ItemTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ItemTest.php index a550df6cd33..a8261fa7bcb 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ItemTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ItemTest.php @@ -57,7 +57,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_helperMock; + protected $_moduleManager; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -89,7 +89,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase $this->_menuFactoryMock = $this ->getMock('Magento\Backend\Model\MenuFactory', array('create'), array(), '', false); $this->_urlModelMock = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false); - $this->_helperMock = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false); + $this->_moduleManager = $this->getMock('Magento\Module\Manager', array(), array(), '', false); $this->_validatorMock = $this->getMock('Magento\Backend\Model\Menu\Item\Validator'); $this->_validatorMock->expects($this->any()) ->method('validate'); @@ -102,8 +102,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase 'storeConfig' => $this->_storeConfigMock, 'menuFactory' => $this->_menuFactoryMock, 'urlModel' => $this->_urlModelMock, - 'helper' => $this->_helperMock, 'moduleList' => $this->_moduleListMock, + 'moduleManager' => $this->_moduleManager, 'data' => $this->_params )); } @@ -164,16 +164,16 @@ class ItemTest extends \PHPUnit_Framework_TestCase public function testIsDisabledReturnsTrueIfModuleOutputIsDisabled() { - $this->_helperMock->expects($this->once()) - ->method('isModuleOutputEnabled') + $this->_moduleManager->expects($this->once()) + ->method('isOutputEnabled') ->will($this->returnValue(false)); $this->assertTrue($this->_model->isDisabled()); } public function testIsDisabledReturnsTrueIfModuleDependenciesFail() { - $this->_helperMock->expects($this->once()) - ->method('isModuleOutputEnabled') + $this->_moduleManager->expects($this->once()) + ->method('isOutputEnabled') ->will($this->returnValue(true)); $this->_moduleListMock->expects($this->once()) @@ -185,8 +185,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase public function testIsDisabledReturnsTrueIfConfigDependenciesFail() { - $this->_helperMock->expects($this->once()) - ->method('isModuleOutputEnabled') + $this->_moduleManager->expects($this->once()) + ->method('isOutputEnabled') ->will($this->returnValue(true)); $this->_moduleListMock->expects($this->once()) @@ -198,8 +198,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase public function testIsDisabledReturnsFalseIfNoDependenciesFail() { - $this->_helperMock->expects($this->once()) - ->method('isModuleOutputEnabled') + $this->_moduleManager->expects($this->once()) + ->method('isOutputEnabled') ->will($this->returnValue(true)); $this->_moduleListMock->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Translate/Inline/ConfigFactoryTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Translate/Inline/ConfigFactoryTest.php index f792461ad4e..4e2dcbf0d07 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Translate/Inline/ConfigFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Translate/Inline/ConfigFactoryTest.php @@ -25,57 +25,16 @@ namespace Magento\Backend\Model\Translate\Inline; class ConfigFactoryTest extends \PHPUnit_Framework_TestCase { - /** - * @param string|null $area - * @param null|string $appStateArea - * @param string $expectedName - * @dataProvider createDataProvider - */ - public function testCreate($area, $appStateArea, $expectedName) + public function testCreate() { $result = 'result'; $objectManager = $this->getMockForAbstractClass('Magento\ObjectManager'); $objectManager ->expects($this->once()) ->method('create') - ->with($this->equalTo($expectedName)) + ->with($this->equalTo('Magento\Backend\Model\Translate\Inline\Config')) ->will($this->returnValue($result)); - $factory = new ConfigFactory($objectManager, $this->getAppState($appStateArea)); - $this->assertEquals($result, $factory->create($area)); - } - - public function createDataProvider() - { - return array( - array(null, 'some area', 'Magento\Core\Model\Translate\Inline\Config'), - array( - null, - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - 'Magento\Backend\Model\Translate\Inline\Config' - ), - array('some area', null, 'Magento\Core\Model\Translate\Inline\Config'), - array( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - null, - 'Magento\Backend\Model\Translate\Inline\Config' - ), - ); - } - - /** - * Get mock of app state - * - * @param null|string $area - * @return \PHPUnit_Framework_MockObject_MockObject - */ - protected function getAppState($area) - { - $appState = $this->getMock('Magento\App\State', array('getAreaCode'), array(), '', false); - if (isset($area)) { - $appState->expects($this->once())->method('getAreaCode')->will($this->returnValue($area)); - } else { - $appState->expects($this->never())->method('getAreaCode'); - } - return $appState; + $factory = new ConfigFactory($objectManager); + $this->assertEquals($result, $factory->create()); } } diff --git a/dev/tests/unit/testsuite/Magento/Backup/MediaTest.php b/dev/tests/unit/testsuite/Magento/Backup/MediaTest.php index 256b0e09c8c..216321345f3 100644 --- a/dev/tests/unit/testsuite/Magento/Backup/MediaTest.php +++ b/dev/tests/unit/testsuite/Magento/Backup/MediaTest.php @@ -26,59 +26,88 @@ */ namespace Magento\Backup; +require_once __DIR__ . '/_files/Gz.php'; +require_once __DIR__ . '/_files/Tar.php'; +require_once __DIR__ . '/_files/Fs.php'; +require_once __DIR__ . '/_files/Helper.php'; +require_once(__DIR__ . '/_files/io.php'); + class MediaTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_dirMock; + protected $_filesystemMock; /** * @var \Magento\Backup\Factory */ protected $_backupFactoryMock; + /** + * @var \Magento\Backup\Db + */ + protected $_backupDbMock; + protected function setUp() { - $this->_dirMock = $this->getMock('Magento\App\Dir', array(), array(), '', false); + $this->_backupDbMock = $this->getMock('Magento\Backup\Db', array(), array(), '', false); + $this->_backupDbMock->expects($this->any()) + ->method('setBackupExtension') + ->will($this->returnSelf()); + + $this->_backupDbMock->expects($this->any()) + ->method('setTime') + ->will($this->returnSelf()); + + $this->_backupDbMock->expects($this->any()) + ->method('setBackupsDir') + ->will($this->returnSelf()); + + $this->_backupDbMock->expects($this->any()) + ->method('setResourceModel') + ->will($this->returnSelf()); + + $this->_backupDbMock->expects($this->any()) + ->method('getBackupPath') + ->will($this->returnValue('\unexistingpath')); + + $this->_backupDbMock->expects($this->any()) + ->method('create') + ->will($this->returnValue(true)); + + $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); $this->_backupFactoryMock = $this->getMock('Magento\Backup\Factory', array(), array(), '', false); + $this->_backupFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->_backupDbMock)); } + /** * @param string $action * @dataProvider actionProvider */ public function testAction($action) { - $snapshot = $this->getMock( - 'Magento\Backup\Snapshot', - array('create', 'rollback', 'getDbBackupFilename'), - array($this->_dirMock, $this->_backupFactoryMock) - ); - $snapshot->expects($this->any()) - ->method('create') - ->will($this->returnValue(true)); - $snapshot->expects($this->any()) - ->method('rollback') - ->will($this->returnValue(true)); - $snapshot->expects($this->once()) - ->method('getDbBackupFilename') - ->will($this->returnValue('var/backup/2.gz')); + $this->_backupFactoryMock->expects($this->once())->method('create'); - $rootDir = __DIR__ . DIRECTORY_SEPARATOR . '_files'; + $rootDir = __DIR__ . '/_files/data'; - $model = new \Magento\Backup\Media($snapshot); + $model = new \Magento\Backup\Media($this->_filesystemMock, $this->_backupFactoryMock); $model->setRootDir($rootDir); + $model->$action(); + $this->assertTrue($model->getIsSuccess()); $this->assertTrue($model->$action()); - $this->assertEquals( - array( - $rootDir . DIRECTORY_SEPARATOR . 'code', - $rootDir . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'tmp', - ), - $snapshot->getIgnorePaths() - ); + $paths = $model->getIgnorePaths(); + $path1 = str_replace('\\', '/', $paths[0]); + $path2 = str_replace('\\', '/', $paths[1]); + $rootDir = str_replace('\\', '/', $rootDir); + + $this->assertEquals($rootDir . '/code', $path1); + $this->assertEquals($rootDir . '/var/log', $path2); } /** @@ -91,39 +120,4 @@ class MediaTest extends \PHPUnit_Framework_TestCase array('rollback'), ); } - - /** - * @param string $method - * @param $parameter - * @dataProvider methodsProvider - */ - public function testProxyMethod($method, $parameter) - { - $snapshot = $this->getMock('Magento\Backup\Snapshot', - array($method), - array($this->_dirMock, $this->_backupFactoryMock)); - $snapshot->expects($this->once()) - ->method($method) - ->with($parameter) - ->will($this->returnValue($snapshot)); - - $model = new \Magento\Backup\Media($snapshot); - $this->assertEquals($model, $model->$method($parameter)); - } - - /** - * @return array - */ - public function methodsProvider() - { - $snapshot = $this->getMock('Magento\Backup\Snapshot', array(), array(), '', false); - return array( - array('setBackupExtension', 'test'), - array('setResourceModel', new \Magento\Backup\Media($snapshot)), - array('setTime', 1), - array('setBackupsDir', 'test/test'), - array('addIgnorePaths', 'test/test'), - array('setRootDir', 'test/test'), - ); - } -} +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Backup/Model/BackupFactoryTest.php b/dev/tests/unit/testsuite/Magento/Backup/Model/BackupFactoryTest.php new file mode 100644 index 00000000000..eb0d2f19628 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Backup/Model/BackupFactoryTest.php @@ -0,0 +1,131 @@ +<?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_Backup + * @subpackage unit_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Backup\Model; + +class BackupFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Backup\Model\BackupFactory + */ + protected $_instance; + + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + /** + * @var \Magento\Backup\Model\Fs\Collection + */ + protected $_fsCollection; + + /** + * @var \Magento\Backup\Model\Backup + */ + protected $_backupModel; + + /** + * @var array + */ + protected $_data; + + protected function setUp() + { + $this->_data = array( + 'id' => '1385661590_snapshot', + 'time' => 1385661590, + 'path' => 'C:\test\test\var\backups', + 'name' => '', + 'type' => 'snapshot', + ); + $this->_fsCollection = $this->getMock( + 'Magento\Backup\Model\Fs\Collection', + array(), + array(), + '', + false + ); + $this->_fsCollection->expects($this->at(0))->method('getIterator') + ->will($this->returnValue(new \ArrayIterator(array(new \Magento\Object($this->_data))))); + + $this->_backupModel = $this->getMock( + 'Magento\Backup\Model\Backup', + array(), + array(), + '', + false + ); + + $this->_objectManager = $this->getMock('Magento\ObjectManager'); + $this->_objectManager->expects($this->at(0)) + ->method('get') + ->with('Magento\Backup\Model\Fs\Collection') + ->will($this->returnValue($this->_fsCollection)); + $this->_objectManager->expects($this->at(1)) + ->method('get') + ->with('Magento\Backup\Model\Backup') + ->will($this->returnValue($this->_backupModel)); + + $this->_instance = new \Magento\Backup\Model\BackupFactory($this->_objectManager); + } + + public function testCreate() + { + $this->_backupModel->expects($this->once()) + ->method('setType') + ->with($this->_data['type']) + ->will($this->returnSelf()); + $this->_backupModel->expects($this->once()) + ->method('setTime') + ->with($this->_data['time']) + ->will($this->returnSelf()); + $this->_backupModel->expects($this->once()) + ->method('setName') + ->with($this->_data['name']) + ->will($this->returnSelf()); + $this->_backupModel->expects($this->once()) + ->method('setPath') + ->with($this->_data['path']) + ->will($this->returnSelf()); + + $this->_instance->create('1385661590', 'snapshot'); + } + + public function testCreateInvalid() + { + $this->_backupModel->expects($this->never()) + ->method('setType'); + $this->_backupModel->expects($this->never()) + ->method('setTime'); + $this->_backupModel->expects($this->never()) + ->method('setName'); + $this->_backupModel->expects($this->never()) + ->method('setPath'); + + $this->_instance->create('451094400', 'snapshot'); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Backup/NomediaTest.php b/dev/tests/unit/testsuite/Magento/Backup/NomediaTest.php index 2f7f3fe4213..eae17c050f3 100644 --- a/dev/tests/unit/testsuite/Magento/Backup/NomediaTest.php +++ b/dev/tests/unit/testsuite/Magento/Backup/NomediaTest.php @@ -26,33 +26,95 @@ */ namespace Magento\Backup; +require_once __DIR__ . '/_files/Gz.php'; +require_once __DIR__ . '/_files/Tar.php'; +require_once __DIR__ . '/_files/Fs.php'; +require_once __DIR__ . '/_files/Helper.php'; +require_once(__DIR__ . '/_files/io.php'); class NomediaTest extends \PHPUnit_Framework_TestCase { - public function testCreate() + /** + * @var \Magento\Filesystem + */ + protected $_filesystemMock; + + /** + * @var \Magento\Backup\Factory + */ + protected $_backupFactoryMock; + + /** + * @var \Magento\Backup\Db + */ + protected $_backupDbMock; + + protected function setUp() { - $dir = $this->getMock('Magento\App\Dir', array(), array(), '', false); - $backupFactory = $this->getMock('Magento\Backup\Factory', array(), array(), '', false); - $snapshot = $this->getMock('Magento\Backup\Snapshot', array('create'), array($dir, $backupFactory)); - $snapshot->expects($this->any()) + $this->_backupDbMock = $this->getMock('Magento\Backup\Db', array(), array(), '', false); + $this->_backupDbMock->expects($this->any()) + ->method('setBackupExtension') + ->will($this->returnSelf()); + + $this->_backupDbMock->expects($this->any()) + ->method('setTime') + ->will($this->returnSelf()); + + $this->_backupDbMock->expects($this->any()) + ->method('setBackupsDir') + ->will($this->returnSelf()); + + $this->_backupDbMock->expects($this->any()) + ->method('setResourceModel') + ->will($this->returnSelf()); + + $this->_backupDbMock->expects($this->any()) + ->method('getBackupPath') + ->will($this->returnValue('\unexistingpath')); + + $this->_backupDbMock->expects($this->any()) ->method('create') ->will($this->returnValue(true)); + $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_backupFactoryMock = $this->getMock('Magento\Backup\Factory', array(), array(), '', false); + $this->_backupFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->_backupDbMock)); + } - $model = new \Magento\Backup\Nomedia($snapshot); + /** + * @param string $action + * @dataProvider actionProvider + */ + public function testAction($action) + { + $this->_backupFactoryMock->expects($this->once())->method('create'); - $rootDir = __DIR__ . DIRECTORY_SEPARATOR . '_files'; + $rootDir = __DIR__ . '/_files/data'; - $model = new \Magento\Backup\Nomedia($snapshot); + $model = new \Magento\Backup\Nomedia($this->_filesystemMock, $this->_backupFactoryMock); $model->setRootDir($rootDir); + $model->$action(); + $this->assertTrue($model->getIsSuccess()); - $this->assertTrue($model->create()); $this->assertEquals( array( - $rootDir . DIRECTORY_SEPARATOR . 'media', - $rootDir . DIRECTORY_SEPARATOR . 'pub' . DIRECTORY_SEPARATOR . 'media', + $rootDir . '/media', + $rootDir . '/pub/media', ), - $snapshot->getIgnorePaths() + $model->getIgnorePaths() + ); + } + + /** + * @return array + */ + public static function actionProvider() + { + return array( + array('create'), + array('rollback'), ); } } diff --git a/dev/tests/unit/testsuite/Magento/Backup/SnapshotTest.php b/dev/tests/unit/testsuite/Magento/Backup/SnapshotTest.php index 0c125082e25..51761a06623 100644 --- a/dev/tests/unit/testsuite/Magento/Backup/SnapshotTest.php +++ b/dev/tests/unit/testsuite/Magento/Backup/SnapshotTest.php @@ -31,16 +31,20 @@ class SnapshotTest extends \PHPUnit_Framework_TestCase { public function testGetDbBackupFilename() { - $dir = $this->getMock('Magento\App\Dir', array(), array(), '', false); + $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); $backupFactory = $this->getMock('Magento\Backup\Factory', array(), array(), '', false); - $manager = $this->getMock('Magento\Backup\Snapshot', array('getBackupFilename'), array($dir, $backupFactory)); + $manager = $this->getMock( + 'Magento\Backup\Snapshot', + array('getBackupFilename'), + array($filesystem, $backupFactory) + ); $file = 'var/backup/2.gz'; $manager->expects($this->once()) ->method('getBackupFilename') ->will($this->returnValue($file)); - $model = new \Magento\Backup\Snapshot($dir, $backupFactory); + $model = new \Magento\Backup\Snapshot($filesystem, $backupFactory); $model->setDbBackupManager($manager); $this->assertEquals($file, $model->getDbBackupFilename()); } diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Model/SessionTest.php b/dev/tests/unit/testsuite/Magento/Backup/_files/Fs.php similarity index 71% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Model/SessionTest.php rename to dev/tests/unit/testsuite/Magento/Backup/_files/Fs.php index ab04466cf58..aa5673185dd 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Model/SessionTest.php +++ b/dev/tests/unit/testsuite/Magento/Backup/_files/Fs.php @@ -19,24 +19,26 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backup * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Model; - /** - * @magentoAppArea adminhtml + * Mock rollback worker for rolling back via local filesystem */ -class SessionTest extends \PHPUnit_Framework_TestCase +namespace Magento\Backup\Filesystem\Rollback; + +class Fs extends AbstractRollback { - public function testConstructor() + /** + * Mock Files rollback implementation via local filesystem + * + * @see \Magento\Backup\Filesystem\Rollback\AbstractRollback::run() + */ + public function run() { - $this->assertInstanceOf( - 'Magento\Backend\Model\Session', - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Adminhtml\Model\Session') - ); + return; } -} +} \ No newline at end of file diff --git a/app/code/Magento/Adminhtml/Block/Widget/Accordion.php b/dev/tests/unit/testsuite/Magento/Backup/_files/Ftp.php similarity index 70% rename from app/code/Magento/Adminhtml/Block/Widget/Accordion.php rename to dev/tests/unit/testsuite/Magento/Backup/_files/Ftp.php index 865839a663e..4e705f16146 100644 --- a/app/code/Magento/Adminhtml/Block/Widget/Accordion.php +++ b/dev/tests/unit/testsuite/Magento/Backup/_files/Ftp.php @@ -19,20 +19,26 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backup + * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend + * Mock Rollback worker for rolling back via ftp */ -namespace Magento\Adminhtml\Block\Widget; +namespace Magento\Backup\Filesystem\Rollback; -class Accordion extends \Magento\Backend\Block\Widget\Accordion +class Fs extends AbstractRollback { - -} + /** + * Mock Files rollback implementation via ftp + * + * @see \Magento\Backup\Filesystem\Rollback\AbstractRollback::run() + */ + public function run() + { + return; + } +} \ No newline at end of file diff --git a/app/code/Magento/Adminhtml/Block/Widget/Breadcrumbs.php b/dev/tests/unit/testsuite/Magento/Backup/_files/Gz.php similarity index 69% rename from app/code/Magento/Adminhtml/Block/Widget/Breadcrumbs.php rename to dev/tests/unit/testsuite/Magento/Backup/_files/Gz.php index 6719048105d..661a17b0228 100644 --- a/app/code/Magento/Adminhtml/Block/Widget/Breadcrumbs.php +++ b/dev/tests/unit/testsuite/Magento/Backup/_files/Gz.php @@ -19,20 +19,29 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Archive + * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend + * Mock class to work with gz archives */ -namespace Magento\Adminhtml\Block\Widget; +namespace Magento\Archive; -class Breadcrumbs extends \Magento\Backend\Block\Widget\Breadcrumbs +class Gz { - -} + /** + * Mock pack file by GZ compressor. + * + * @param $source + * @param $destination + * @return string + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function pack($source, $destination) + { + return '\unexistingpath'; + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Backup/_files/Helper.php b/dev/tests/unit/testsuite/Magento/Backup/_files/Helper.php new file mode 100644 index 00000000000..683aef66cee --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Backup/_files/Helper.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. + * + * @category Magento + * @package Magento_Backup + * @subpackage integration_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Mock Filesystem helper + */ +namespace Magento\Backup\Filesystem; + +class Helper +{ + /** + * Constant can be used in getInfo() function as second parameter. + * Check whether directory and all files/sub directories are readable + * + * @const int + */ + const INFO_READABLE = 2; + + /** + * Constant can be used in getInfo() function as second parameter. + * Get directory size + * + * @const int + */ + const INFO_SIZE = 4; + + /** + * Mock Get information (readable, writable, size) about $path + * + * @param $path + * @param int $infoOptions + * @param array $skipFiles + * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getInfo($path, $infoOptions = self::INFO_ALL, $skipFiles = array()) + { + return array('readable' => true, 'size' => 1); + } +} \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/GridTest.php b/dev/tests/unit/testsuite/Magento/Backup/_files/Tar.php similarity index 58% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/GridTest.php rename to dev/tests/unit/testsuite/Magento/Backup/_files/Tar.php index 4e95f9f4b43..2f0b8fedcba 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/GridTest.php +++ b/dev/tests/unit/testsuite/Magento/Backup/_files/Tar.php @@ -19,26 +19,42 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backup * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Widget; - /** - * @magentoAppArea adminhtml + * Mock class to work with tar archives */ -class GridTest extends \PHPUnit_Framework_TestCase +namespace Magento\Backup\Archive; + +class Tar { - public function testGetMassactionBlock() + /** + * Mock set files that shouldn't be added to tarball + * + * @param array $skipFiles + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function setSkipFiles(array $skipFiles) + { + return $this; + } + + /** + * Mock pack file to TAR (Tape Archiver). + * + * @param $source + * @param $destination + * @param bool $skipRoot + * @return string + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function pack($source, $destination, $skipRoot = false) { - /** @var $layout \Magento\Core\Model\Layout */ - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); - /** @var $block \Magento\Adminhtml\Block\Widget\Grid */ - $block = $layout->createBlock('Magento\Adminhtml\Block\Widget\Grid', 'block'); - $child = $layout->addBlock('Magento\View\Element\Template', 'massaction', 'block'); - $this->assertSame($child, $block->getMassactionBlock()); + return '\unexistingpath'; } -} +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Backup/_files/pub/media/.gitignore b/dev/tests/unit/testsuite/Magento/Backup/_files/data/code/.gitignore similarity index 100% rename from dev/tests/unit/testsuite/Magento/Backup/_files/pub/media/.gitignore rename to dev/tests/unit/testsuite/Magento/Backup/_files/data/code/.gitignore diff --git a/dev/tests/unit/testsuite/Magento/Backup/_files/var/tmp/.gitignore b/dev/tests/unit/testsuite/Magento/Backup/_files/data/media/.gitignore similarity index 100% rename from dev/tests/unit/testsuite/Magento/Backup/_files/var/tmp/.gitignore rename to dev/tests/unit/testsuite/Magento/Backup/_files/data/media/.gitignore diff --git a/dev/tests/unit/testsuite/Magento/Backup/_files/data/pub/media/.gitignore b/dev/tests/unit/testsuite/Magento/Backup/_files/data/pub/media/.gitignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/tests/unit/testsuite/Magento/Backup/_files/data/var/log/.gitignore b/dev/tests/unit/testsuite/Magento/Backup/_files/data/var/log/.gitignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/tests/unit/testsuite/Magento/Backup/_files/io.php b/dev/tests/unit/testsuite/Magento/Backup/_files/io.php new file mode 100644 index 00000000000..b12d0677b70 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Backup/_files/io.php @@ -0,0 +1,105 @@ +<?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_Backup + * @subpackage integration_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Backup; + +/** + * Mock is_dir function + * + * @see \Magento\Backup\Filesystem + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ +function is_dir($path) +{ + return true; +} + +/** + * Mock is_dir function + * + * @see \Magento\Backup\Filesystem + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ +function is_writable($path) +{ + return true; +} + +/** + * Mock disk_free_space function + * + * @see \Magento\Backup\Filesystem + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ +function disk_free_space($path) +{ + return 2; +} + +/** + * Mock is_file function + * + * @see \Magento\Backup\Filesystem + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ +function is_file($path) +{ + return 2; +} + +/** + * Mock filesize function + * + * @see \Magento\Backup\Filesystem + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ +function filesize($path) +{ + return 1; +} + +/** + * Mock unlink function + * + * @see \Magento\Backup\Filesystem + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ +function unlink($path) +{ + return true; +} + +/** + * Mock rmdir function + * + * @see \Magento\Backup\Filesystem + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ +function rmdir($path) +{ + return true; +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Cache/Config/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Cache/Config/ConverterTest.php index 1b2ffbc55f1..ba4fe357660 100644 --- a/dev/tests/unit/testsuite/Magento/Cache/Config/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Cache/Config/ConverterTest.php @@ -38,10 +38,10 @@ class ConverterTest extends \PHPUnit_Framework_TestCase public function testConvert() { $dom = new \DOMDocument(); - $xmlFile = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'cache_config.xml'; + $xmlFile = __DIR__ . '/_files/cache_config.xml'; $dom->loadXML(file_get_contents($xmlFile)); - $convertedFile = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'cache_config.php'; + $convertedFile = __DIR__ . '/_files/cache_config.php'; $expectedResult = include $convertedFile; $this->assertEquals($expectedResult, $this->_model->convert($dom)); } 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 fc8a7412c47..54418b0c21a 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Helper/Adminhtml/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Helper/Adminhtml/DataTest.php @@ -48,12 +48,17 @@ class DataTest extends \PHPUnit_Framework_TestCase ->with('admin/captcha/qwe') ->will($this->returnValue('1')); + $filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); + + $filesystemMock->expects($this->any())->method('getDirectoryWrite')->will($this->returnValue($directoryMock)); + $directoryMock->expects($this->any())->method('getAbsolutePath')->will($this->returnArgument(0)); + $this->_model = new \Magento\Captcha\Helper\Adminhtml\Data( $this->getMock('Magento\App\Helper\Context', array(), array(), '', false), - $this->getMock('Magento\App\Dir', array(), array(), '', false), $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false), $this->getMock('Magento\Core\Model\Config', array(), array(), '', false), - $this->getMock('Magento\Filesystem', array(), array(), '', false), + $filesystemMock, $this->getMock('Magento\Captcha\Model\CaptchaFactory', array(), array(), '', false), $backendConfig ); diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php index edc6baad51a..21901f65166 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php @@ -32,11 +32,11 @@ class DataTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_dirMock; + protected $_filesystem; protected function setUp() { - $this->_dirMock = $this->getMock('Magento\App\Dir', array(), array(), '', false, false); + $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); } protected function _getHelper($store, $config, $factory) @@ -51,18 +51,10 @@ class DataTest extends \PHPUnit_Framework_TestCase ->method('getStore') ->will($this->returnValue($store)); - $adapterMock = $this->getMockBuilder('Magento\Filesystem\Adapter\Local') - ->getMock(); - $adapterMock->expects($this->any()) - ->method('isDirectory') - ->will($this->returnValue(true)); - - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $context = $this->getMock('Magento\App\Helper\Context', array(), array(), '', false); return new \Magento\Captcha\Helper\Data( - $context, $this->_dirMock, $storeManager, $config, $filesystem, $factory + $context, $storeManager, $config, $this->_filesystem, $factory ); } @@ -82,7 +74,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ->method('create') ->with($this->equalTo('Zend')) ->will($this->returnValue(new \Magento\Captcha\Model\DefaultModel( - $this->getMock('Magento\Core\Model\Session\AbstractSession', array(), array(), '', false), + $this->getMock('Magento\Session\SessionManager', array(), array(), '', false), $this->getMock('Magento\Captcha\Helper\Data', array(), array(), '', false), $this->getMock('Magento\Captcha\Model\Resource\LogFactory', array(), array(), '', false), 'user_create' @@ -111,9 +103,9 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetFonts() { - $this->_dirMock->expects($this->once()) - ->method('getDir') - ->with(\Magento\App\Dir::LIB) + $this->_filesystem->expects($this->once()) + ->method('getPath') + ->with(\Magento\Filesystem::LIB) ->will($this->returnValue(TESTS_TEMP_DIR . '/lib')); $factoryMock = $this->getMock('Magento\Captcha\Model\CaptchaFactory', array(), array(), '', false); @@ -134,17 +126,25 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetImgDir() { $factoryMock = $this->getMock('Magento\Captcha\Model\CaptchaFactory', array(), array(), '', false); - $this->_dirMock->expects($this->once()) - ->method('getDir') - ->with(\Magento\App\Dir::MEDIA) - ->will($this->returnValue(TESTS_TEMP_DIR . '/media')); + + $dirWriteMock = $this->getMock('Magento\Filesystem\Directory\Write', + array('changePermissions', 'create', 'getAbsolutePath'), array(), '', false); + + $this->_filesystem->expects($this->once()) + ->method('getDirectoryWrite') + ->with(\Magento\Filesystem::MEDIA) + ->will($this->returnValue($dirWriteMock)); + + $dirWriteMock->expects($this->once()) + ->method('getAbsolutePath') + ->with('/captcha/base') + ->will($this->returnValue(TESTS_TEMP_DIR . '/captcha/base')); $object = $this->_getHelper($this->_getStoreStub(), $this->_getConfigStub(), $factoryMock); $this->assertFileNotExists(TESTS_TEMP_DIR . '/captcha'); $result = $object->getImgDir(); - $result = str_replace('/', DIRECTORY_SEPARATOR, $result); $this->assertStringStartsWith(TESTS_TEMP_DIR, $result); - $this->assertStringEndsWith('captcha' . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR, $result); + $this->assertStringEndsWith('captcha/base/', $result); } /** diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Model/CronTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Model/CronTest.php index 9a81ea99ed5..08d7d545571 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Model/CronTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Model/CronTest.php @@ -49,6 +49,11 @@ class CronTest extends \PHPUnit_Framework_TestCase */ protected $_filesystem; + /** + * @var \Magento\Filesystem\DirectoryWriteInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_directory; + /** * @var \Magento\Core\Model\StoreManager|\PHPUnit_Framework_MockObject_MockObject */ @@ -72,8 +77,13 @@ 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->_directory = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); $this->_storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_filesystem->expects($this->once()) + ->method('getDirectoryWrite') + ->will($this->returnValue($this->_directory)); + $this->_model = new \Magento\Captcha\Model\Cron( $this->getMock('Magento\Captcha\Model\Resource\LogFactory', array(), array(), '', false), $this->_helper, @@ -111,15 +121,15 @@ class CronTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($timeout)); $timesToCall = isset($website) ? 2 : 1; - $this->_filesystem->expects($this->exactly($timesToCall)) - ->method('getNestedKeys') + $this->_directory->expects($this->exactly($timesToCall)) + ->method('read') ->will($this->returnValue(array($filename))); - $this->_filesystem->expects($this->exactly($timesToCall))->method('isFile')->will($this->returnValue($isFile)); - $this->_filesystem->expects($this->any())->method('getMTime')->will($this->returnValue($mTime)); + $this->_directory->expects($this->exactly($timesToCall))->method('isFile')->will($this->returnValue($isFile)); + $this->_directory->expects($this->any())->method('stat')->will($this->returnValue(array('mtime' => $mTime))); if ($mustDelete) { - $this->_filesystem->expects($this->exactly($timesToCall))->method('delete')->with($filename); + $this->_directory->expects($this->exactly($timesToCall))->method('delete')->with($filename); } else { - $this->_filesystem->expects($this->never())->method('delete'); + $this->_directory->expects($this->never())->method('delete'); } $this->_model->deleteExpiredImages(); } diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Model/DefaultTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Model/DefaultTest.php index 990d86615e9..d1d5fa7ae3f 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Model/DefaultTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Model/DefaultTest.php @@ -241,7 +241,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase array( 'user_create_word' => array( 'data' => 'AbCdEf5', - 'expires' => time() - 60 + 'expires' => time() - 360 ) ) ); @@ -255,7 +255,12 @@ class DefaultTest extends \PHPUnit_Framework_TestCase */ protected function _getSessionStub() { - $session = $this->getMock('Magento\Customer\Model\Session', array('isLoggedIn'), array(), '', false); + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $sessionArgs = $helper->getConstructArguments('Magento\Customer\Model\Session', array( + 'storage' => new \Magento\Session\Storage + )); + $session = $this->getMock('Magento\Customer\Model\Session', + array('isLoggedIn', 'getUserCreateWord'), $sessionArgs); $session->expects($this->any()) ->method('isLoggedIn') ->will($this->returnValue(false)); diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Model/ObserverTest.php index 990fe9ee274..6b8fbfc86fc 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Model/ObserverTest.php @@ -74,7 +74,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected $_objectManager; /** - * @var \Magento\TestFramework\Helper\ObjectManager + * @var \PHPUnit_Framework_MockObject_MockObject */ protected $_actionFlag; @@ -88,6 +88,11 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ protected $_customerData; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_messageManager; + protected function setUp() { $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); @@ -97,13 +102,14 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->method('create') ->will($this->returnValue($this->_getResourceModelStub())); - $this->_session = $this->getMock('Magento\Core\Model\Session\AbstractSession', array(), array(), '', false); + $this->_session = $this->getMock('Magento\Session\SessionManager', array(), array(), '', false); $this->_typeOnepage = $this->getMock('Magento\Checkout\Model\Type\Onepage', array(), array(), '', false); $this->_coreData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $this->_customerData = $this->getMock('Magento\Customer\Helper\Data', array(), array(), '', false); $this->_helper = $this->getMock('Magento\Captcha\Helper\Data', array(), array(), '', false); $this->_urlManager = $this->getMock('Magento\Core\Model\Url', array(), array(), '', false); $this->_actionFlag = $this->getMock('Magento\App\ActionFlag', array(), array(), '', false); + $this->_messageManager = $this->getMock('\Magento\Message\ManagerInterface', array(), array(), '', false); $this->_observer = $this->_objectManager->getObject( 'Magento\Captcha\Model\Observer', array( @@ -114,7 +120,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase 'customerData' => $this->_customerData, 'helper' => $this->_helper, 'urlManager' => $this->_urlManager, - 'actionFlag' => $this->_actionFlag + 'actionFlag' => $this->_actionFlag, + 'messageManager' => $this->_messageManager ) ); @@ -185,7 +192,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_helper->expects($this->any())->method('getCaptcha') ->with($formId) ->will($this->returnValue($this->_captcha)); - $this->_session->expects($this->once())->method('addError')->with($warningMessage); + $this->_messageManager->expects($this->once())->method('addError')->with($warningMessage); $this->_actionFlag->expects($this->once())->method('set') ->with('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); 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 50bb19c79b9..a1ecfaed4f7 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)); - $dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false); + $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); $urlBuilder = $this->getMock('Magento\UrlInterface', array(), array(), '', false); $urlBuilder->expects($this->once()) @@ -49,8 +49,8 @@ class GridTest extends \PHPUnit_Framework_TestCase ->method('getUrlBuilder') ->will($this->returnValue($urlBuilder)); $context->expects($this->any()) - ->method('getDirs') - ->will($this->returnValue($dirs)); + ->method('getFilesystem') + ->will($this->returnValue($filesystem)); $data = array( 'context' => $context, diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php index 525d7a7c904..c45b8b1d48e 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php @@ -69,7 +69,7 @@ class OptionsTest extends \PHPUnit_Framework_TestCase 'resource' => $this->_optionResource, 'optionValueFactory' => $optValFactoryMock, )); - $dateBlock = $this->getMock('Magento\Adminhtml\Block\Catalog\Product\Composite\Fieldset\Options', + $dateBlock = $this->getMock('Magento\Backend\Block\Catalog\Product\Composite\Fieldset\Options', array('setProduct', 'setOption'), array('context' => $context, 'option' => $option), '', false); $dateBlock->expects($this->any()) ->method('setProduct')->will($this->returnValue($dateBlock)); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Attribute/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Attribute/Config/ReaderTest.php index 4f257ee39f1..7231f91afb4 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Attribute/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Attribute/Config/ReaderTest.php @@ -58,8 +58,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ->method('get') ->with('catalog_attributes.xml', 'scope') ->will($this->returnValue(array( - __DIR__ . '/_files/attributes_config_one.xml', - __DIR__ . '/_files/attributes_config_two.xml', + file_get_contents(__DIR__ . '/_files/attributes_config_one.xml'), + file_get_contents(__DIR__ . '/_files/attributes_config_two.xml'), ))) ; 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 4f50e4b899f..d3d8e6744b7 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 @@ -58,14 +58,16 @@ class MediaTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue('table')); $mediaConfig = $this->getMock('Magento\Catalog\Model\Product\Media\Config', array(), array(), '', false); - $dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false); + $directory = $this->getMockBuilder('Magento\Filesystem\Directory\Write') + ->disableOriginalConstructor() + ->getMock(); $filesystem = $this->getMockBuilder('Magento\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, 'fileStorageDb' => $fileStorageDb, 'coreData' => $coreData, 'mediaConfig' => $mediaConfig, - 'dirs' => $dirs, 'filesystem' => $filesystem, 'resourceProductAttribute' => $resource, )); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FileTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FileTest.php deleted file mode 100644 index 55c6aed928f..00000000000 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FileTest.php +++ /dev/null @@ -1,81 +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) 2013 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\Option\Type; - -class FileTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider createWritableDirDataProvider - * @param boolean $isWritable - * @param boolean $throwException - */ - public function testCreateWritableDir($isWritable, $throwException) - { - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $filesystemMock->expects($this->once()) - ->method('isWritable') - ->will($this->returnValue($isWritable)); - if (!$isWritable) { - $filesystemMock->expects($this->once()) - ->method('createDirectory') - ->will($throwException - ? $this->throwException(new \Magento\Core\Exception) - : $this->returnValue(null) - ); - } else { - $filesystemMock->expects($this->never())->method('createDirectory'); - } - - if ($throwException) { - $this->setExpectedException('Magento\Core\Exception'); - } - - $optionFactoryMock = $this->getMock('Magento\Sales\Model\Quote\Item\OptionFactory', array(), array(), - '', false); - $model = $helper->getObject('Magento\Catalog\Model\Product\Option\Type\File', array( - 'filesystem' => $filesystemMock, - 'itemOptionFactory' => $optionFactoryMock, - )); - $method = new \ReflectionMethod('Magento\Catalog\Model\Product\Option\Type\File', '_createWritableDir'); - $method->setAccessible(true); - $method->invoke($model, 'dummy/path'); - } - - /** - * @see self::testCreateWritableDir() - * @return array - */ - public function createWritableDirDataProvider() - { - return array( - array(true, false), - array(false, false), - array(false, true), - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/ConverterTest.php index 6fa866c11c9..67a32ac398d 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/ConverterTest.php @@ -38,7 +38,7 @@ class ConverterTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_model = new \Magento\Catalog\Model\ProductTypes\Config\Converter(); - $this->_filePath = realpath(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; + $this->_filePath = realpath(__DIR__) . '/_files/'; } public function testConvertIfNodeNotExist() diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/SchemaLocatorTest.php index 23f9e94c558..42e1864959b 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/SchemaLocatorTest.php @@ -48,14 +48,14 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase public function testGetSchema() { $this->assertEquals( - 'schema_dir' . DIRECTORY_SEPARATOR . 'product_types_merged.xsd', + 'schema_dir/product_types_merged.xsd', $this->_model->getSchema() ); } public function testGetPerFileSchema() { - $this->assertEquals('schema_dir' . DIRECTORY_SEPARATOR . 'product_types.xsd', + $this->assertEquals('schema_dir/product_types.xsd', $this->_model->getPerFileSchema() ); } diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php index b301c6abed8..64e9e9ed6bf 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php @@ -64,13 +64,6 @@ class RendererTest extends \PHPUnit_Framework_TestCase $helperImage->expects($this->any())->method('resize')->will($this->returnValue($helperImage)); $helperImage->expects($this->any())->method('__toString')->will($this->returnValue($url)); - $helperFactory = $this->getMock( - 'Magento\App\Helper\HelperFactory', array('get'), array(), '', false, false - ); - $helperFactory->expects($this->any()) - ->method('get') - ->with('Magento\Catalog\Helper\Image', array()) - ->will($this->returnValue($helperImage)); $arguments = array( 'statusListFactory' => $this->getMock( @@ -92,7 +85,7 @@ class RendererTest extends \PHPUnit_Framework_TestCase 'Magento\Checkout\Block\Cart\Item\Renderer\Configurable', array( 'viewConfig' => $configManager, - 'helperFactory' => $helperFactory, + 'imageHelper' => $helperImage, )); $layout = $configurable->getLayout(); diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/LinkTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/LinkTest.php index 8f5aa3a9adb..d277f9464e1 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/LinkTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/LinkTest.php @@ -67,28 +67,15 @@ class LinkTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->setMethods(array('isOutputEnabled')) ->getMock(); - $helper = $this->getMockBuilder('Magento\Customer\Helper\Data') - ->disableOriginalConstructor() - ->getMock(); - $helperFactory = $this->getMockBuilder('Magento\App\Helper\HelperFactory') + $helper = $this->getMockBuilder('Magento\Checkout\Helper\Cart') ->disableOriginalConstructor() - ->setMethods(array('get')) ->getMock(); - $helperFactory->expects($this->any())->method('get')->will($this->returnValue($helper)); - - /** @var \Magento\View\Element\Template\Context $context */ - $context = $this->_objectManagerHelper->getObject( - 'Magento\View\Element\Template\Context', - array( - 'helperFactory' => $helperFactory - ) - ); /** @var \Magento\Checkout\Block\Cart\Link $block */ $block = $this->_objectManagerHelper->getObject( 'Magento\Checkout\Block\Cart\Link', array( - 'context' => $context, + 'cartHelper' => $helper, 'moduleManager' => $moduleManager ) ); @@ -108,25 +95,12 @@ class LinkTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->setMethods(array('getSummaryCount')) ->getMock(); - $helperFactory = $this->getMockBuilder('Magento\App\Helper\HelperFactory') - ->disableOriginalConstructor() - ->setMethods(array('get')) - ->getMock(); - $helperFactory->expects($this->any())->method('get')->will($this->returnValue($helper)); - - /** @var \Magento\View\Element\Template\Context $context */ - $context = $this->_objectManagerHelper->getObject( - 'Magento\View\Element\Template\Context', - array( - 'helperFactory' => $helperFactory - ) - ); /** @var \Magento\Checkout\Block\Cart\Link $block */ $block = $this->_objectManagerHelper->getObject( 'Magento\Checkout\Block\Cart\Link', array( - 'context' => $context, + 'cartHelper' => $helper, ) ); $helper->expects($this->any())->method('getSummaryCount')->will($this->returnValue($productCount)); diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/LinkTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/LinkTest.php index 04e521b5b44..d8c59ef1b0d 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/LinkTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/LinkTest.php @@ -61,34 +61,22 @@ class LinkTest extends \PHPUnit_Framework_TestCase */ public function testToHtml($canOnepageCheckout, $isOutputEnabled) { - $helper = $this->getMockBuilder('Magento\Customer\Helper\Data') + $helper = $this->getMockBuilder('Magento\Checkout\Helper\Data') ->disableOriginalConstructor() ->setMethods(array('canOnepageCheckout', 'isModuleOutputEnabled')) ->getMock(); - $helperFactory = $this->getMockBuilder('Magento\App\Helper\HelperFactory') - ->disableOriginalConstructor() - ->setMethods(array('get')) - ->getMock(); - $helperFactory->expects($this->any())->method('get')->will($this->returnValue($helper)); - $moduleManager = $this->getMockBuilder('Magento\Module\Manager') ->disableOriginalConstructor() ->setMethods(array('isOutputEnabled')) ->getMock(); - /** @var \Magento\View\Element\Template\Context $context */ - $context = $this->_objectManagerHelper->getObject( - 'Magento\View\Element\Template\Context', - array('helperFactory' => $helperFactory) - ); - /** @var \Magento\Checkout\Block\Link $block */ $block = $this->_objectManagerHelper->getObject( 'Magento\Checkout\Block\Link', array( - 'context' => $context, - 'moduleManager' => $moduleManager + 'moduleManager' => $moduleManager, + 'checkoutHelper' => $helper, ) ); $helper->expects($this->any())->method('canOnepageCheckout')->will($this->returnValue($canOnepageCheckout)); diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/SuccessTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/SuccessTest.php index 89eaca91080..66a961026c8 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/SuccessTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/SuccessTest.php @@ -40,12 +40,14 @@ class SuccessTest extends \PHPUnit_Framework_TestCase */ public function testToHtmlPreparesRecurringProfiles() { + $checkoutSessionArgs = $this->objectManager->getConstructArguments( + 'Magento\Checkout\Model\Session', + array('storage' => new \Magento\Session\Storage('checkout')) + ); $checkoutSession = $this->getMock( 'Magento\Checkout\Model\Session', ['getLastRecurringProfileIds'], - [], - '', - false + $checkoutSessionArgs ); $checkoutSession->expects($this->once()) ->method('getLastRecurringProfileIds') diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Model/SessionTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/SessionTest.php index 85a77fe0818..276db997d26 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Model/SessionTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Model/SessionTest.php @@ -26,6 +26,7 @@ * Test class for \Magento\Checkout\Model\Session */ namespace Magento\Checkout\Model; +include(__DIR__ . '/../_files/session.php'); class SessionTest extends \PHPUnit_Framework_TestCase { @@ -52,18 +53,25 @@ class SessionTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); + $appState = $this->getMock('\Magento\App\State', array(), array(), '', false); + $appState->expects($this->any())->method('isInstalled')->will($this->returnValue(true)); + + $request = $this->getMock('\Magento\App\Request\Http', array(), array(), '', false); + $request->expects($this->any())->method('getHttpHost')->will($this->returnValue(array())); + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $constructArguments = $objectManager->getConstructArguments( 'Magento\Checkout\Model\Session', array( - 'context' => $this->getMock('Magento\Core\Model\Session\Context', array(), array(), '', false), - 'orderFactory' => $orderFactory, - 'messageCollFactory' => $messageCollFactory, - 'quoteFactory' => $quoteFactory, + 'request' => $this->getMock('Magento\App\RequestInterface', array(), array(), '', false), + 'orderFactory' => $orderFactory, + 'messageCollFactory' => $messageCollFactory, + 'quoteFactory' => $quoteFactory, + 'storage' => new \Magento\Session\Storage ) ); /** @var \Magento\Checkout\Model\Session $session */ - $session = $this->getMock('Magento\Checkout\Model\Session', array('init'), $constructArguments); + $session = $objectManager->getObject('Magento\Checkout\Model\Session', $constructArguments); $session->setLastRealOrderId($orderId); $this->assertSame($orderMock, $session->getLastRealOrder()); diff --git a/dev/tests/unit/testsuite/Magento/Checkout/_files/session.php b/dev/tests/unit/testsuite/Magento/Checkout/_files/session.php new file mode 100644 index 00000000000..665769ee715 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/_files/session.php @@ -0,0 +1,48 @@ +<?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_Customer + * @subpackage integration_tests + * @copyright Copyright (c) 2013 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\Session; + +/** + * Mock headers_sent function to prevent check whether headers have been already sent + * + * @see \Magento\Core\Model\Session\AbstractSession + */ +function headers_sent() +{ + return false; +} + +/** + * Mock session_start function to prevent check whether headers have been already sent + * + * @see \Magento\Core\Model\Session\AbstractSession + */ +function session_start() +{ + return true; +} 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 a0423f1b0ed..a0aba0c13b9 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 @@ -25,6 +25,7 @@ namespace Magento\Cms\Model\Wysiwyg\Images; * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * * @SuppressWarnings(PHPMD.LongVariable) + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class StorageTest extends \PHPUnit_Framework_TestCase { @@ -58,11 +59,6 @@ class StorageTest extends \PHPUnit_Framework_TestCase */ protected $_resizeParameters; - /** - * @var \Magento\App\Dir|PHPUnit_Framework_MockObject_MockObject - */ - protected $_dirMock; - /** * @var \Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory|PHPUnit_Framework_MockObject_MockObject */ @@ -108,7 +104,6 @@ class StorageTest extends \PHPUnit_Framework_TestCase $this->_imageHelperMock = $this->getMock('Magento\Cms\Helper\Wysiwyg\Images', array(), array(), '', false); $this->_resizeParameters = array('width' => 100, 'height' => 50); - $this->_dirMock = $this->getMock('Magento\App\Dir', array(), array(), '', false); $this->_storageCollectionFactoryMock = $this->getMock( 'Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory'); $this->_storageFileFactoryMock = $this->getMock('Magento\Core\Model\File\Storage\FileFactory'); @@ -119,18 +114,6 @@ class StorageTest extends \PHPUnit_Framework_TestCase $this->_sessionMock = $this->getMock('Magento\Backend\Model\Session', array(), array(), '', false); $this->_backendUrlMock = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false); - $this->_imageHelperMock->expects($this->once()) - ->method('getStorageRoot') - ->will($this->returnValue('someDirectory')); - - $this->_filesystemMock->expects($this->once()) - ->method('setWorkingDirectory') - ->with('someDirectory'); - - $this->_filesystemMock->expects($this->once()) - ->method('setIsAllowCreateDirectories') - ->with(true); - $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_model = $objectManagerHelper->getObject('Magento\Cms\Model\Wysiwyg\Images\Storage', array( 'session' => $this->_sessionMock, @@ -141,7 +124,6 @@ class StorageTest extends \PHPUnit_Framework_TestCase 'filesystem' => $this->_filesystemMock, 'imageFactory' => $this->_adapterFactoryMock, 'viewUrl' => $this->_viewUrlMock, - 'dir' => $this->_dirMock, 'storageCollectionFactory' => $this->_storageCollectionFactoryMock, 'storageFileFactory' => $this->_storageFileFactoryMock, 'storageDatabaseFactory' => $this->_storageDatabaseFactoryMock, diff --git a/dev/tests/unit/testsuite/Magento/Code/Generator/IoTest.php b/dev/tests/unit/testsuite/Magento/Code/Generator/IoTest.php index d7225c13968..1885821d4b5 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Generator/IoTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Generator/IoTest.php @@ -32,10 +32,9 @@ class IoTest extends \PHPUnit_Framework_TestCase /**#@+ * Source and result class parameters */ - const DIRECTORY_SEPARATOR = '|'; const GENERATION_DIRECTORY = 'generation_directory'; const CLASS_NAME = 'class_name'; - const CLASS_FILE_NAME = 'class|file|name'; + const CLASS_FILE_NAME = 'class/file/name'; const FILE_NAME = 'test_file'; const FILE_CONTENT = "content"; /**#@-*/ @@ -53,26 +52,23 @@ class IoTest extends \PHPUnit_Framework_TestCase protected $_object; /** - * @var \Magento\Io\File|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ - protected $_ioObjectMock; + protected $_filesystemDriverMock; /** - * @var \Magento\Autoload\IncludePath|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Autoload\IncludePath|\PHPUnit_Framework_MockObject_MockObject */ protected $_autoLoaderMock; protected function setUp() { - $this->_generationDirectory - = rtrim(self::GENERATION_DIRECTORY, self::DIRECTORY_SEPARATOR) . self::DIRECTORY_SEPARATOR; + $this->_generationDirectory = rtrim(self::GENERATION_DIRECTORY, '/') . '/'; - $this->_ioObjectMock = $this->getMock('Magento\Io\File', - array('dirsep', 'isWriteable', 'mkdir', 'fileExists', 'write') + $this->_filesystemDriverMock = $this->getMock('Magento\Filesystem\Driver\File', + array('isWritable', 'filePutContents', 'createDirectory', 'isExists'), + array() ); - $this->_ioObjectMock->expects($this->any()) - ->method('dirsep') - ->will($this->returnValue(self::DIRECTORY_SEPARATOR)); $this->_autoLoaderMock = $this->getMock( 'Magento\Autoload\IncludePath', array('getFilePath'), array(), '', false @@ -82,7 +78,8 @@ class IoTest extends \PHPUnit_Framework_TestCase ->with(self::CLASS_NAME) ->will($this->returnValue(self::CLASS_FILE_NAME)); - $this->_object = new \Magento\Code\Generator\Io($this->_ioObjectMock, $this->_autoLoaderMock, + $this->_object = new \Magento\Code\Generator\Io($this->_filesystemDriverMock, + $this->_autoLoaderMock, self::GENERATION_DIRECTORY ); } @@ -90,27 +87,28 @@ class IoTest extends \PHPUnit_Framework_TestCase protected function tearDown() { unset($this->_generationDirectory); - unset($this->_ioObjectMock); + unset($this->_filesystemMock); unset($this->_autoLoaderMock); unset($this->_object); + unset($this->_filesystemDriverMock); } public function testGetResultFileDirectory() { - $expectedDirectory = self::GENERATION_DIRECTORY . self::DIRECTORY_SEPARATOR . 'class|file|'; + $expectedDirectory = self::GENERATION_DIRECTORY . '/' . 'class/file/'; $this->assertEquals($expectedDirectory, $this->_object->getResultFileDirectory(self::CLASS_NAME)); } public function testGetResultFileName() { - $expectedFileName = self::GENERATION_DIRECTORY . self::DIRECTORY_SEPARATOR . self::CLASS_FILE_NAME; + $expectedFileName = self::GENERATION_DIRECTORY . '/' . self::CLASS_FILE_NAME; $this->assertEquals($expectedFileName, $this->_object->getResultFileName(self::CLASS_NAME)); } public function testWriteResultFile() { - $this->_ioObjectMock->expects($this->once()) - ->method('write') + $this->_filesystemDriverMock->expects($this->once()) + ->method('filePutContents') ->with($this->equalTo(self::FILE_NAME), $this->equalTo("<?php\n" . self::FILE_CONTENT)) ->will($this->returnValue(true)); @@ -119,8 +117,8 @@ class IoTest extends \PHPUnit_Framework_TestCase public function testMakeGenerationDirectoryWritable() { - $this->_ioObjectMock->expects($this->once()) - ->method('isWriteable') + $this->_filesystemDriverMock->expects($this->once()) + ->method('isWritable') ->with($this->equalTo($this->_generationDirectory)) ->will($this->returnValue(true)); @@ -129,14 +127,14 @@ class IoTest extends \PHPUnit_Framework_TestCase public function testMakeGenerationDirectoryReadOnly() { - $this->_ioObjectMock->expects($this->once()) - ->method('isWriteable') + $this->_filesystemDriverMock->expects($this->once()) + ->method('isWritable') ->with($this->equalTo($this->_generationDirectory)) ->will($this->returnValue(false)); - $this->_ioObjectMock->expects($this->once()) - ->method('mkdir') - ->with($this->equalTo($this->_generationDirectory), $this->anything(), $this->isTrue()) + $this->_filesystemDriverMock->expects($this->once()) + ->method('createDirectory') + ->with($this->equalTo($this->_generationDirectory), $this->anything()) ->will($this->returnValue(true)); $this->assertTrue($this->_object->makeGenerationDirectory()); @@ -149,9 +147,9 @@ class IoTest extends \PHPUnit_Framework_TestCase public function testFileExists() { - $this->_ioObjectMock->expects($this->once()) - ->method('fileExists') - ->with($this->equalTo(self::FILE_NAME), $this->isTrue()) + $this->_filesystemDriverMock->expects($this->once()) + ->method('isExists') + ->with($this->equalTo(self::FILE_NAME)) ->will($this->returnValue(false)); $this->assertFalse($this->_object->fileExists(self::FILE_NAME)); diff --git a/dev/tests/unit/testsuite/Magento/Code/GeneratorTest.php b/dev/tests/unit/testsuite/Magento/Code/GeneratorTest.php index a050d061f2b..9c6506ff313 100644 --- a/dev/tests/unit/testsuite/Magento/Code/GeneratorTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/GeneratorTest.php @@ -62,6 +62,17 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase */ protected $_autoloader; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|Generator\Io + */ + protected $_ioObjectMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Filesystem + */ + protected $_filesystemMock; + + protected function setUp() { $this->_generator = $this->getMockForAbstractClass('Magento\Code\Generator\EntityAbstract', @@ -70,6 +81,12 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase $this->_autoloader = $this->getMock('Magento\Autoload\IncludePath', array('getFile'), array(), '', false ); + $this->_ioObjectMock = $this->getMockBuilder('\Magento\Code\Generator\Io') + ->disableOriginalConstructor() + ->getMock(); + $this->_filesystemMock = $this->getMockBuilder('\Magento\Filesystem') + ->disableOriginalConstructor() + ->getMock(); } protected function tearDown() @@ -90,7 +107,12 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase public function testGetGeneratedEntities() { - $this->_model = new \Magento\Code\Generator(); + $this->_model = new \Magento\Code\Generator( + $this->_generator, + $this->_autoloader, + $this->_ioObjectMock, + $this->_filesystemMock + ); $this->assertEquals(array_values($this->_expectedEntities), $this->_model->getGeneratedEntities()); } @@ -108,7 +130,12 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase ->method('generate') ->will($this->returnValue(true)); - $this->_model = new \Magento\Code\Generator($this->_generator, $this->_autoloader); + $this->_model = new \Magento\Code\Generator( + $this->_generator, + $this->_autoloader, + $this->_ioObjectMock, + $this->_filesystemMock + ); $this->assertEquals( \Magento\Code\Generator::GENERATION_SUCCESS, @@ -128,7 +155,12 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase ->with($className . $entityType) ->will($this->returnValue(true)); - $this->_model = new \Magento\Code\Generator($this->_generator, $this->_autoloader); + $this->_model = new \Magento\Code\Generator( + $this->_generator, + $this->_autoloader, + $this->_ioObjectMock, + $this->_filesystemMock + ); $this->assertEquals( \Magento\Code\Generator::GENERATION_SKIP, @@ -142,7 +174,12 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase $this->_autoloader->staticExpects($this->never()) ->method('getFile'); - $this->_model = new \Magento\Code\Generator($this->_generator, $this->_autoloader); + $this->_model = new \Magento\Code\Generator( + $this->_generator, + $this->_autoloader, + $this->_ioObjectMock, + $this->_filesystemMock + ); $this->assertEquals( \Magento\Code\Generator::GENERATION_ERROR, @@ -162,7 +199,12 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase ->method('generate') ->will($this->returnValue(false)); - $this->_model = new \Magento\Code\Generator($this->_generator, $this->_autoloader); + $this->_model = new \Magento\Code\Generator( + $this->_generator, + $this->_autoloader, + $this->_ioObjectMock, + $this->_filesystemMock + ); $expectedEntities = array_values($this->_expectedEntities); $resultClassName = self::SOURCE_CLASS . ucfirst(array_shift($expectedEntities)); 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 70593386065..98efbf6ee99 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Minifier/Strategy/GenerateTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Minifier/Strategy/GenerateTest.php @@ -24,8 +24,64 @@ namespace Magento\Code\Minifier\Strategy; +use Magento\Filesystem, + Magento\Filesystem\Directory\Write, + Magento\Filesystem\Directory\Read; + class GenerateTest extends \PHPUnit_Framework_TestCase { + /** + * @var Filesystem | \PHPUnit_Framework_MockObject_MockObject + */ + protected $filesystem; + + /** + * @var Read | \PHPUnit_Framework_MockObject_MockObject + */ + protected $rootDirectory; + + /** + * @var Write | \PHPUnit_Framework_MockObject_MockObject + */ + protected $pubViewCacheDir; + + /** + * @var \Magento\Code\Minifier\AdapterInterface | \PHPUnit_Framework_MockObject_MockObject + */ + protected $adapter; + + /** + * Set up before each test + */ + public function setUp() + { + $this->rootDirectory = $this->getMock( + 'Magento\Filesystem\Directory\Read', + array(), array(), '', false + ); + $this->pubViewCacheDir = $this->getMock( + 'Magento\Filesystem\Directory\Write', + array(), array(), '', false + ); + $this->filesystem = $this->getMock( + 'Magento\Filesystem', + array('getDirectoryWrite', 'getDirectoryRead', '__wakeup'), + array(), '', false + ); + $this->filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->with(\Magento\Filesystem::ROOT) + ->will($this->returnValue($this->rootDirectory)); + $this->filesystem->expects($this->once()) + ->method('getDirectoryWrite') + ->with(\Magento\Filesystem::PUB_VIEW_CACHE) + ->will($this->returnValue($this->pubViewCacheDir)); + $this->adapter = $this->getMockForAbstractClass('Magento\Code\Minifier\AdapterInterface', array(), '', false); + } + + /** + * Test for minifyFile if case update is needed + */ public function testGetMinifiedFile() { $originalFile = __DIR__ . '/original/some.js'; @@ -33,52 +89,58 @@ class GenerateTest extends \PHPUnit_Framework_TestCase $content = 'content'; $minifiedContent = 'minified content'; - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $filesystem->expects($this->once()) - ->method('read') + $this->rootDirectory->expects($this->once()) + ->method('readFile') ->with($originalFile) ->will($this->returnValue($content)); - $filesystem->expects($this->once()) - ->method('write') + $this->pubViewCacheDir->expects($this->once()) + ->method('getRelativePath') + ->will($this->returnArgument(0)); + $this->pubViewCacheDir->expects($this->once()) + ->method('writeFile') ->with($minifiedFile, $minifiedContent); - $adapter = $this->getMockForAbstractClass('Magento\Code\Minifier\AdapterInterface', array(), '', false); - $adapter->expects($this->once()) + $this->adapter->expects($this->once()) ->method('minify') ->with($content) ->will($this->returnValue($minifiedContent)); - $strategy = new \Magento\Code\Minifier\Strategy\Generate($adapter, $filesystem); + $strategy = new Generate($this->adapter, $this->filesystem); $strategy->minifyFile($originalFile, $minifiedFile); } + /** + * Test for minifyFile if case update is NOT needed + */ public function testGetMinifiedFileNoUpdateNeeded() { $originalFile = __DIR__ . '/original/some.js'; $minifiedFile = __DIR__ . '/some.min.js'; - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $filesystem->expects($this->once()) - ->method('has') - ->with($minifiedFile) - ->will($this->returnValue(true)); $mTimeMap = array( - array($originalFile, null, 1), - array($minifiedFile, null, 1), + array($originalFile, null, array('mtime' => 1)), + array($minifiedFile, null, array('mtime' => 1)), ); - $filesystem->expects($this->exactly(2)) - ->method('getMTime') + + $this->pubViewCacheDir->expects($this->once()) + ->method('isExist') + ->with($minifiedFile) + ->will($this->returnValue(true)); + $this->rootDirectory->expects($this->once()) + ->method('stat') ->will($this->returnValueMap($mTimeMap)); - $filesystem->expects($this->never()) - ->method('read'); - $filesystem->expects($this->never()) - ->method('write'); + $this->pubViewCacheDir->expects($this->once()) + ->method('stat') + ->will($this->returnValueMap($mTimeMap)); + + $this->rootDirectory->expects($this->never()) + ->method('readFile'); + $this->pubViewCacheDir->expects($this->never()) + ->method('writeFile'); - $adapter = $this->getMockForAbstractClass('Magento\Code\Minifier\AdapterInterface', array(), '', false); - $adapter->expects($this->never()) - ->method('minify'); + $this->adapter->expects($this->never())->method('minify'); - $strategy = new \Magento\Code\Minifier\Strategy\Generate($adapter, $filesystem); + $strategy = new Generate($this->adapter, $this->filesystem); $strategy->minifyFile($originalFile, $minifiedFile); } } 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 5c6d93924e8..b83be674e88 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Minifier/Strategy/LiteTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Minifier/Strategy/LiteTest.php @@ -24,8 +24,64 @@ namespace Magento\Code\Minifier\Strategy; +use Magento\Filesystem, + Magento\Filesystem\Directory\Read, + Magento\Filesystem\Directory\Write; + class LiteTest extends \PHPUnit_Framework_TestCase { + /** + * @var Filesystem | \PHPUnit_Framework_MockObject_MockObject + */ + protected $filesystem; + + /** + * @var Read | \PHPUnit_Framework_MockObject_MockObject + */ + protected $rootDirectory; + + /** + * @var Write | \PHPUnit_Framework_MockObject_MockObject + */ + protected $pubViewCacheDir; + + /** + * @var \Magento\Code\Minifier\AdapterInterface | \PHPUnit_Framework_MockObject_MockObject + */ + protected $adapter; + + /** + * Set up before each test + */ + public function setUp() + { + $this->rootDirectory = $this->getMock( + 'Magento\Filesystem\Directory\Read', + array(), array(), '', false + ); + $this->pubViewCacheDir = $this->getMock( + 'Magento\Filesystem\Directory\Write', + array(), array(), '', false + ); + $this->filesystem = $this->getMock( + 'Magento\Filesystem', + array('getDirectoryWrite', 'getDirectoryRead', '__wakeup'), + array(), '', false + ); + $this->filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->with(\Magento\Filesystem::ROOT) + ->will($this->returnValue($this->rootDirectory)); + $this->filesystem->expects($this->once()) + ->method('getDirectoryWrite') + ->with(\Magento\Filesystem::PUB_VIEW_CACHE) + ->will($this->returnValue($this->pubViewCacheDir)); + $this->adapter = $this->getMockForAbstractClass('Magento\Code\Minifier\AdapterInterface', array(), '', false); + } + + /** + * Test for minifyFile if case update is needed + */ public function testGetMinifiedFile() { $originalFile = __DIR__ . '/original/some.js'; @@ -33,46 +89,44 @@ class LiteTest extends \PHPUnit_Framework_TestCase $content = 'content'; $minifiedContent = 'minified content'; - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $filesystem->expects($this->once()) - ->method('read') + $this->rootDirectory->expects($this->once()) + ->method('readFile') ->with($originalFile) ->will($this->returnValue($content)); - $filesystem->expects($this->once()) - ->method('write') + $this->pubViewCacheDir->expects($this->once()) + ->method('writeFile') ->with($minifiedFile, $minifiedContent); - $adapter = $this->getMockForAbstractClass('Magento\Code\Minifier\AdapterInterface', array(), '', false); - $adapter->expects($this->once()) + $this->adapter->expects($this->once()) ->method('minify') ->with($content) ->will($this->returnValue($minifiedContent)); - $strategy = new \Magento\Code\Minifier\Strategy\Lite($adapter, $filesystem); + $strategy = new Lite($this->adapter, $this->filesystem); $strategy->minifyFile($originalFile, $minifiedFile); } + /** + * Test for minifyFile if case update is NOT needed + */ public function testGetMinifiedFileNoUpdateNeeded() { $originalFile = __DIR__ . '/original/some.js'; $minifiedFile = __DIR__ . '/some.min.js'; - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $filesystem->expects($this->once()) - ->method('has') + $this->pubViewCacheDir->expects($this->once()) + ->method('isExist') ->with($minifiedFile) ->will($this->returnValue(true)); - $filesystem->expects($this->never()) - ->method('read'); - $filesystem->expects($this->never()) - ->method('write'); - $adapter = $this->getMockForAbstractClass('Magento\Code\Minifier\AdapterInterface', array(), '', false); - $adapter->expects($this->never()) - ->method('minify'); + $this->rootDirectory->expects($this->never()) + ->method('readFile'); + $this->pubViewCacheDir->expects($this->never()) + ->method('writeFile'); - $strategy = new \Magento\Code\Minifier\Strategy\Lite($adapter, $filesystem); + $this->adapter->expects($this->never())->method('minify'); + $strategy = new Lite($this->adapter, $this->filesystem); $strategy->minifyFile($originalFile, $minifiedFile); } } diff --git a/dev/tests/unit/testsuite/Magento/Code/MinifierTest.php b/dev/tests/unit/testsuite/Magento/Code/MinifierTest.php index 2b256ad4796..a50d6303db9 100644 --- a/dev/tests/unit/testsuite/Magento/Code/MinifierTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/MinifierTest.php @@ -27,58 +27,148 @@ namespace Magento\Code; class MinifierTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Code\Minifier\StrategyInterface|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Code\Minifier\StrategyInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $_strategy; + protected $strategy; /** - * @var \Magento\Filesystem|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ - protected $_filesystem; + protected $filesystem; /** - * @var \Magento\Code\Minifier + * @var Minifier */ - protected $_minifier; + protected $minifier; + /** + * @var string + */ + protected $minifyDir = 'minify'; + + /** + * @var \Magento\Filesystem\Directory\Read|\PHPUnit_Framework_MockObject_MockObject + */ + protected $rootDirectory; + + /** + * @var \Magento\Filesystem\Directory\Read|\PHPUnit_Framework_MockObject_MockObject + */ + protected $pubViewCacheDir; + + /** + * Creat test mocks + */ protected function setUp() { - $this->_strategy = $this->getMockForAbstractClass('Magento\Code\Minifier\StrategyInterface'); - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $this->_minifier = new \Magento\Code\Minifier($this->_strategy, $this->_filesystem, __DIR__); + $this->strategy = $this->getMockForAbstractClass('Magento\Code\Minifier\StrategyInterface'); + $this->filesystem = $this->getMock( + 'Magento\Filesystem', + array('getDirectoryRead', '__wakeup'), + array(), + '', + false + ); + $this->rootDirectory = $this->getMock( + 'Magento\Filesystem\Directory\Read', + array('getRelativePath', 'isExist'), array(), '', false + ); + $this->pubViewCacheDir = $this->getMock( + 'Magento\Filesystem\Directory\Read', + array('getAbsolutePath', 'getRelativePath'), + array(), + '', + false + ); + $this->filesystem->expects($this->at(0)) + ->method('getDirectoryRead') + ->with(\Magento\Filesystem::ROOT) + ->will($this->returnValue($this->rootDirectory)); + $this->filesystem->expects($this->at(1)) + ->method('getDirectoryRead') + ->with(\Magento\Filesystem::PUB_VIEW_CACHE) + ->will($this->returnValue($this->pubViewCacheDir)); + $this->minifier = new Minifier($this->strategy, $this->filesystem, $this->minifyDir); } + /** + * Test for getMinifiedFile + */ public function testGetMinifiedFile() { - $originalFile = '/original/some.js'; + $originalFile = '/pub/cache/' . $this->minifyDir . '/original/some.js'; + $originalFileRelative = $this->minifyDir . '/original/some.js'; + $minifiedFileRelative = $this->minifyDir . '/original/some.min.js'; + + $this->rootDirectory->expects($this->at(0)) + ->method('getRelativePath') + ->with($originalFile) + ->will($this->returnValue($originalFileRelative)); + + $this->rootDirectory->expects($this->at(1)) + ->method('isExist') + ->with($minifiedFileRelative) + ->will($this->returnValue(false)); - $this->_strategy->expects($this->once()) + $this->pubViewCacheDir->expects($this->once()) + ->method('getAbsolutePath') + ->with($this->matches($this->minifyDir . '%ssome.min.js')) + ->will($this->returnValue('/pub/cache/' . $this->minifyDir . '/original/some.min.js')); + + $this->pubViewCacheDir->expects($this->once()) + ->method('getRelativePath') + ->with($this->matches($this->minifyDir . '%ssome.min.js')) + ->will($this->returnValue($this->minifyDir . '/original/some.min.js')); + + $this->strategy->expects($this->once()) ->method('minifyFile') - ->with($originalFile, $this->matches(__DIR__ . '%ssome.min.js')); - $minifiedFile = $this->_minifier->getMinifiedFile($originalFile); - $this->assertStringMatchesFormat(__DIR__ . '%ssome.min.js', $minifiedFile); + ->with($this->minifyDir . '/original/some.js', $this->matches($this->minifyDir . '%ssome.min.js')); + $minifiedFile = $this->minifier->getMinifiedFile($originalFile); + $this->assertStringMatchesFormat('/pub/cache/' . $this->minifyDir . '%ssome.min.js', $minifiedFile); } + /** + * Test for getMinifiedFile (in case when minified file is passed) + */ public function testGetMinifiedFileOriginalMinified() { $originalFile = 'file.min.js'; - $this->_strategy->expects($this->never()) + $this->strategy->expects($this->never()) ->method('minifyFile'); - $minifiedFile = $this->_minifier->getMinifiedFile($originalFile); + $minifiedFile = $this->minifier->getMinifiedFile($originalFile); $this->assertSame($originalFile, $minifiedFile); } + /** + * Test for getMinifiedFile (in case when minified file exists) + */ public function testGetMinifiedFileExistsMinified() { - $originalFile = __DIR__ . '/original/some.js'; - $expectedMinifiedFile = __DIR__ . '/original/some.min.js'; + $originalFile = '/pub/cache/' . $this->minifyDir . '/original/some.js'; + $expectedMinifiedFile = '/pub/cache/' . $this->minifyDir . '/original/some.min.js'; + $expectedMinifiedFileRelative = $this->minifyDir . '/original/some.min.js'; - $this->_filesystem->expects($this->once()) - ->method('has') - ->with($expectedMinifiedFile) + $this->rootDirectory->expects($this->at(0)) + ->method('getRelativePath') + ->with($originalFile) + ->will($this->returnValue($this->minifyDir . '/original/some.js')); + + $this->rootDirectory->expects($this->at(1)) + ->method('isExist') + ->with($this->minifyDir . '/original/some.min.js') ->will($this->returnValue(true)); - $minifiedFile = $this->_minifier->getMinifiedFile($originalFile, '/minified/some.min.js'); - $this->assertStringEndsWith($expectedMinifiedFile, $minifiedFile); + $this->pubViewCacheDir->expects($this->once()) + ->method('getAbsolutePath') + ->with($this->minifyDir . '/original/some.min.js') + ->will($this->returnValue($expectedMinifiedFile)); + + $this->pubViewCacheDir->expects($this->once()) + ->method('getRelativePath') + ->with($this->minifyDir . '/original/some.min.js') + ->will($this->returnValue($expectedMinifiedFileRelative)); + + $minifiedFile = $this->minifier->getMinifiedFile($originalFile); + $this->assertStringEndsWith($minifiedFile, $expectedMinifiedFile); } } diff --git a/dev/tests/unit/testsuite/Magento/Code/Plugin/InvocationChainTest.php b/dev/tests/unit/testsuite/Magento/Code/Plugin/InvocationChainTest.php index 6815aeeb14d..50675d4cd6c 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Plugin/InvocationChainTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Plugin/InvocationChainTest.php @@ -26,10 +26,10 @@ */ namespace Magento\Code\Plugin; -require_once __DIR__ . DIRECTORY_SEPARATOR . 'GeneratorTest' . DIRECTORY_SEPARATOR . 'SimpleClass.php'; -require_once __DIR__ . DIRECTORY_SEPARATOR . 'GeneratorTest' . DIRECTORY_SEPARATOR . 'SimpleClassPluginA.php'; -require_once __DIR__ . DIRECTORY_SEPARATOR . 'GeneratorTest' . DIRECTORY_SEPARATOR . 'SimpleClassPluginB.php'; -require_once __DIR__ . DIRECTORY_SEPARATOR . 'GeneratorTest' . DIRECTORY_SEPARATOR . 'SimpleObjectManager.php'; +require_once __DIR__ . '/GeneratorTest/SimpleClass.php'; +require_once __DIR__ . '/GeneratorTest/SimpleClassPluginA.php'; +require_once __DIR__ . '/GeneratorTest/SimpleClassPluginB.php'; +require_once __DIR__ . '/GeneratorTest/SimpleObjectManager.php'; class InvocationChainTest extends \PHPUnit_Framework_TestCase { diff --git a/dev/tests/unit/testsuite/Magento/Code/Validator/ArgumentSequenceTest.php b/dev/tests/unit/testsuite/Magento/Code/Validator/ArgumentSequenceTest.php index 8a061fdbdb3..1ee2740d9f4 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Validator/ArgumentSequenceTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Validator/ArgumentSequenceTest.php @@ -40,9 +40,8 @@ class ArgumentSequenceTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_fixturePath = realpath(__DIR__) - . DIRECTORY_SEPARATOR . '_files' - . DIRECTORY_SEPARATOR . 'ClassesForArgumentSequence.php'; + $path = realpath(__DIR__) . '/_files/ClassesForArgumentSequence.php'; + $this->_fixturePath = str_replace('\\', '/', $path); $this->_validator = new \Magento\Code\Validator\ArgumentSequence(); /** Build internal cache */ @@ -70,4 +69,4 @@ class ArgumentSequenceTest extends \PHPUnit_Framework_TestCase $this->setExpectedException('\Magento\Code\ValidationException', $message); $this->_validator->validate('\ArgumentSequence\InvalidChildClass'); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Code/Validator/ConstructorIntegrityTest.php b/dev/tests/unit/testsuite/Magento/Code/Validator/ConstructorIntegrityTest.php index 09d5d255de2..fb0e35c52d2 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Validator/ConstructorIntegrityTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Validator/ConstructorIntegrityTest.php @@ -62,6 +62,7 @@ class ConstructorIntegrityTest extends \PHPUnit_Framework_TestCase public function testValidateIfClassHasExtraArgumentInTheParentConstructor() { $fileName = realpath(__DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Four/Test.php'); + $fileName = str_replace('\\', '/', $fileName); $this->setExpectedException( '\Magento\Code\ValidationException', 'Extra parameters passed to parent construct: $factory. File: ' . $fileName @@ -72,6 +73,7 @@ class ConstructorIntegrityTest extends \PHPUnit_Framework_TestCase public function testValidateIfClassHasMissingRequiredArguments() { $fileName = realpath(__DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Five/Test.php'); + $fileName = str_replace('\\', '/', $fileName); $this->setExpectedException( '\Magento\Code\ValidationException', 'Missed required argument factory in parent::__construct call. File: ' . $fileName @@ -82,6 +84,7 @@ class ConstructorIntegrityTest extends \PHPUnit_Framework_TestCase public function testValidateIfClassHasIncompatibleArguments() { $fileName = realpath(__DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Six/Test.php'); + $fileName = str_replace('\\', '/', $fileName); $this->setExpectedException( '\Magento\Code\ValidationException', 'Incompatible argument type: Required type: \Magento\SomeModule\Model\Proxy. ' . @@ -92,8 +95,8 @@ class ConstructorIntegrityTest extends \PHPUnit_Framework_TestCase public function testValidateWrongOrderForParentArguments() { - $fileName = realpath(__DIR__) . DIRECTORY_SEPARATOR - . '_files' . DIRECTORY_SEPARATOR . 'ClassesForConstructorIntegrity.php'; + $fileName = realpath(__DIR__) . '/_files/ClassesForConstructorIntegrity.php'; + $fileName = str_replace('\\', '/', $fileName); $this->setExpectedException( '\Magento\Code\ValidationException', 'Incompatible argument type: Required type: \Context. ' . @@ -104,8 +107,8 @@ class ConstructorIntegrityTest extends \PHPUnit_Framework_TestCase public function testValidateWrongOptionalParamsType() { - $fileName = realpath(__DIR__) . DIRECTORY_SEPARATOR - . '_files' . DIRECTORY_SEPARATOR . 'ClassesForConstructorIntegrity.php'; + $fileName = realpath(__DIR__) . '/_files/ClassesForConstructorIntegrity.php'; + $fileName = str_replace('\\', '/', $fileName); $this->setExpectedException( '\Magento\Code\ValidationException', 'Incompatible argument type: Required type: array. ' . diff --git a/dev/tests/unit/testsuite/Magento/Code/Validator/ContextAggregationTest.php b/dev/tests/unit/testsuite/Magento/Code/Validator/ContextAggregationTest.php index 8ed355b6e7d..7f8d2c12b00 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Validator/ContextAggregationTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Validator/ContextAggregationTest.php @@ -42,8 +42,8 @@ class ContextAggregationTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_model = new \Magento\Code\Validator\ContextAggregation(); - $this->_fixturePath = realpath(__DIR__) . DIRECTORY_SEPARATOR - . '_files' . DIRECTORY_SEPARATOR . 'ClassesForContextAggregation.php'; + $this->_fixturePath = str_replace('\\', '/', realpath(__DIR__) . '/_files/ClassesForContextAggregation.php'); + } public function testClassArgumentAlreadyInjectedIntoContext() diff --git a/dev/tests/unit/testsuite/Magento/Code/Validator/TypeDuplicationTest.php b/dev/tests/unit/testsuite/Magento/Code/Validator/TypeDuplicationTest.php index 84755ea7830..3aa97d8d4cf 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Validator/TypeDuplicationTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Validator/TypeDuplicationTest.php @@ -40,9 +40,8 @@ class TypeDuplicationTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_fixturePath = realpath(__DIR__) - . DIRECTORY_SEPARATOR . '_files' - . DIRECTORY_SEPARATOR . 'ClassesForTypeDuplication.php'; + $path = realpath(__DIR__) . '/' . '_files' . '/' . 'ClassesForTypeDuplication.php'; + $this->_fixturePath = str_replace('\\', '/', $path); $this->_validator = new \Magento\Code\Validator\TypeDuplication(); } diff --git a/dev/tests/unit/testsuite/Magento/Config/Converter/Dom/FlatTest.php b/dev/tests/unit/testsuite/Magento/Config/Converter/Dom/FlatTest.php index 3365c3249f7..703fb3b7090 100644 --- a/dev/tests/unit/testsuite/Magento/Config/Converter/Dom/FlatTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/Converter/Dom/FlatTest.php @@ -43,11 +43,7 @@ class FlatTest extends \PHPUnit_Framework_TestCase '/root/multipleNode' => 'id' )); $this->_fixturePath = realpath(__DIR__ . '/../../') - . DIRECTORY_SEPARATOR . '_files' - . DIRECTORY_SEPARATOR . 'converter' - . DIRECTORY_SEPARATOR . 'dom' - . DIRECTORY_SEPARATOR . 'flat' - . DIRECTORY_SEPARATOR; + . '/_files/converter/dom/flat/'; } public function testConvert() diff --git a/dev/tests/unit/testsuite/Magento/Config/Dom/Converter/ArrayConverterTest.php b/dev/tests/unit/testsuite/Magento/Config/Dom/Converter/ArrayConverterTest.php index f7492f728f4..0cab017810e 100644 --- a/dev/tests/unit/testsuite/Magento/Config/Dom/Converter/ArrayConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/Dom/Converter/ArrayConverterTest.php @@ -41,10 +41,7 @@ class ArrayConverterTest extends \PHPUnit_Framework_TestCase { $this->_model = new \Magento\Config\Dom\Converter\ArrayConverter(); $this->_fixturePath = realpath(__DIR__ . '/../../') - . DIRECTORY_SEPARATOR . '_files' - . DIRECTORY_SEPARATOR . 'dom' - . DIRECTORY_SEPARATOR . 'converter' - . DIRECTORY_SEPARATOR; + . '/_files/dom/converter/'; } /** diff --git a/dev/tests/unit/testsuite/Magento/Config/Reader/FilesystemTest.php b/dev/tests/unit/testsuite/Magento/Config/Reader/FilesystemTest.php index 758bf9fe511..b1fffedee38 100644 --- a/dev/tests/unit/testsuite/Magento/Config/Reader/FilesystemTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/Reader/FilesystemTest.php @@ -52,7 +52,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_file = __DIR__ . '/../_files/reader/config.xml'; + $this->_file = file_get_contents(__DIR__ . '/../_files/reader/config.xml'); $this->_fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $this->_converterMock = $this->getMock('Magento\Config\ConverterInterface', array(), array(), '', false); $this->_schemaLocatorMock = $this->getMock('Magento\Config\SchemaLocatorInterface'); @@ -73,7 +73,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase ->expects($this->once())->method('get')->will($this->returnValue(array($this->_file))); $dom = new \DomDocument(); - $dom->loadXML(file_get_contents($this->_file)); + $dom->loadXML($this->_file); $this->_converterMock->expects($this->once())->method('convert')->with($dom); $model->read('scope'); } diff --git a/dev/tests/unit/testsuite/Magento/Config/ThemeTest.php b/dev/tests/unit/testsuite/Magento/Config/ThemeTest.php index 07211c3fd52..482b9dd96fd 100644 --- a/dev/tests/unit/testsuite/Magento/Config/ThemeTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/ThemeTest.php @@ -40,7 +40,7 @@ class ThemeTest extends \PHPUnit_Framework_TestCase public function testGetSchemaFile() { $config = new \Magento\Config\Theme(array( - sprintf('%s/_files/area/%s/theme.xml', __DIR__, 'default_default') + file_get_contents(sprintf('%s/_files/area/%s/theme.xml', __DIR__, 'default_default')) )); $this->assertFileExists($config->getSchemaFile()); @@ -54,7 +54,7 @@ class ThemeTest extends \PHPUnit_Framework_TestCase public function testGetThemeTitle($themePath, $expected) { $config = new \Magento\Config\Theme(array( - sprintf('%s/_files/area/%s/theme.xml', __DIR__, $themePath) + file_get_contents(sprintf('%s/_files/area/%s/theme.xml', __DIR__, $themePath)) )); $this->assertSame($expected, $config->getThemeTitle()); } @@ -78,7 +78,7 @@ class ThemeTest extends \PHPUnit_Framework_TestCase public function testGetParentTheme($themePath, $expected) { $config = new \Magento\Config\Theme(array( - sprintf('%s/_files/area/%s/theme.xml', __DIR__, $themePath) + file_get_contents(sprintf('%s/_files/area/%s/theme.xml', __DIR__, $themePath)) )); $this->assertSame($expected, $config->getParentTheme()); } diff --git a/dev/tests/unit/testsuite/Magento/Config/ViewTest.php b/dev/tests/unit/testsuite/Magento/Config/ViewTest.php index fd2d020fb8c..439cc07add0 100644 --- a/dev/tests/unit/testsuite/Magento/Config/ViewTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/ViewTest.php @@ -37,7 +37,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_model = new \Magento\Config\View(array( - __DIR__ . '/_files/view_one.xml', __DIR__ . '/_files/view_two.xml' + file_get_contents(__DIR__ . '/_files/view_one.xml'), file_get_contents(__DIR__ . '/_files/view_two.xml') )); } @@ -72,6 +72,6 @@ class ViewTest extends \PHPUnit_Framework_TestCase */ public function testInvalidXml() { - new \Magento\Config\View(array(__DIR__ . '/_files/view_invalid.xml')); + new \Magento\Config\View(array(file_get_contents(__DIR__ . '/_files/view_invalid.xml'))); } } diff --git a/dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php b/dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php index 0de1c55b2f1..7462f9f1a55 100644 --- a/dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php +++ b/dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php @@ -48,7 +48,7 @@ class ExcelTest extends \PHPUnit_Framework_TestCase */ protected function _getSampleOutputFile() { - return __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'output.txt'; + return __DIR__ . '/_files/output.txt'; } /** @@ -99,14 +99,11 @@ class ExcelTest extends \PHPUnit_Framework_TestCase */ protected function _writeFile($callback = false) { - $adapter = new \Magento\Filesystem\Adapter\Local(); - $filesystem = new \Magento\Filesystem($adapter); - $name = md5(microtime()); - $file = TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . $name . '.xml'; + $file = TESTS_TEMP_DIR . '/' . $name . '.xml'; - $stream = $filesystem->createAndOpenStream($file, 'w+', TESTS_TEMP_DIR); - $stream->lock(true); + $stream = new \Magento\Filesystem\File\Write($file, new \Magento\Filesystem\Driver\File(), 'w+'); + $stream->lock(); if (!$callback) { $convert = new \Magento\Convert\Excel(new \ArrayIterator($this->_testData)); diff --git a/dev/tests/unit/testsuite/Magento/Core/App/Action/FormKeyValidatorTest.php b/dev/tests/unit/testsuite/Magento/Core/App/Action/FormKeyValidatorTest.php index c597f863789..b83ebd26bea 100644 --- a/dev/tests/unit/testsuite/Magento/Core/App/Action/FormKeyValidatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/App/Action/FormKeyValidatorTest.php @@ -53,7 +53,7 @@ class FormKeyValidatorTest extends \PHPUnit_Framework_TestCase /** * @param string $formKey - * param bool $expected + * @param bool $expected * @dataProvider validateDataProvider */ public function testValidate($formKey, $expected) 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 fd2763214ef..54032b7c78b 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 @@ -38,15 +38,15 @@ class DispatchExceptionHandlerTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_dirMock; + protected $_filesystemMock; protected function setUp() { $this->_storeManagerMock = $this->getMock('\Magento\Core\Model\StoreManager', array(), array(), '', false); - $this->_dirMock = $this->getMock('\Magento\App\Dir', array(), array(), '', false); + $this->_filesystemMock = $this->getMock('\Magento\Filesystem', array(), array(), '', false); $this->_model = new DispatchExceptionHandler( $this->_storeManagerMock, - $this->_dirMock + $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 1de5691a351..e9e2687eac4 100644 --- a/dev/tests/unit/testsuite/Magento/Core/App/MediaTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/App/MediaTest.php @@ -75,6 +75,16 @@ class MediaTest extends \PHPUnit_Framework_TestCase */ protected $_responseMock; + /** + * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + */ + protected $filesystemMock; + + /** + * @var \Magento\Filesystem\Directory\Read|\PHPUnit_Framework_MockObject_MockObject + */ + protected $directoryReadMock; + protected function setUp() { $this->_requestMock = $this->getMock('Magento\Core\Model\File\Storage\Request', array(), array(), '', false); @@ -86,12 +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\App\Dir\Verification', array(), array(), '', false + 'Magento\Filesystem\DirectoryList\Verification', array(), array(), '', false ); + + $this->filesystemMock = $this->getMock('Magento\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) + ->will($this->returnValue($this->directoryReadMock)); + $this->_responseMock = $this->getMock('Magento\Core\Model\File\Storage\Response', array(), array(), '', false); $map = array( - array('Magento\App\Dir\Verification', $this->_dirVerificationMock), + array('Magento\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), @@ -105,7 +124,8 @@ class MediaTest extends \PHPUnit_Framework_TestCase 'baseDir', 'mediaDirectory', 'var', - 'params' + 'params', + $this->filesystemMock ); $this->_objectManagerMock->expects($this->any())->method('get')->will($this->returnValueMap($map)); } @@ -134,7 +154,8 @@ class MediaTest extends \PHPUnit_Framework_TestCase 'baseDir', false, 'var', - 'params' + 'params', + $this->filesystemMock ); $this->_appState->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); $this->_objectManagerMock->expects($this->once())->method('create') @@ -159,7 +180,8 @@ class MediaTest extends \PHPUnit_Framework_TestCase 'baseDir', false, 'var', - 'params' + 'params', + $this->filesystemMock ); $this->_appState->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); $this->_responseMock->expects($this->once())->method('sendNotFound'); @@ -184,15 +206,31 @@ class MediaTest extends \PHPUnit_Framework_TestCase public function testProcessRequestReturnsFileIfItsProperlySynchronized() { - $filePath = __DIR__ . DS . '_files'; + $relativeFilePath = '_files'; + $filePath = str_replace('\\', '/', __DIR__ . '/' . $relativeFilePath); $this->_appState->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); $this->_requestMock->expects($this->any())->method('getPathInfo') ->will($this->returnValue($this->_mediaDirectory . '/')); $this->_sync->expects($this->once())->method('synchronize'); $this->_requestMock->expects($this->any()) - ->method('getFilePath')->will($this->returnValue(realpath($filePath))); - $this->_responseMock->expects($this->once())->method('sendFile')->with($filePath); - $this->_responseMock->expects($this->never())->method('sendNotFound'); + ->method('getFilePath')->will($this->returnValue($filePath)); + + $this->directoryReadMock->expects($this->once()) + ->method('getRelativePath') + ->with($filePath) + ->will($this->returnValue($relativeFilePath)); + + $this->directoryReadMock->expects($this->once()) + ->method('isReadable') + ->with($relativeFilePath) + ->will($this->returnValue(true)); + $this->_responseMock + ->expects($this->once()) + ->method('sendFile') + ->with($filePath); + $this->_responseMock + ->expects($this->never()) + ->method('sendNotFound'); $this->assertEquals(0, $this->_model->execute()); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Helper/ThemeTest.php b/dev/tests/unit/testsuite/Magento/Core/Helper/ThemeTest.php index 5adf6aa6db4..d899f6ff7ee 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Helper/ThemeTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Helper/ThemeTest.php @@ -35,59 +35,6 @@ class ThemeTest extends \PHPUnit_Framework_TestCase const THEMES = '/zzz/qqq/design00'; const PUB_LIB = '/zzz/qqq/js00'; - /** - * @dataProvider getSafePathDataProvider - * @param string $filePath - * @param string $basePath - * @param string $expectedResult - */ - public function testGetSafePath($filePath, $basePath, $expectedResult) - { - /** @var $dirs \Magento\App\Dir */ - $dirs = $this->getMock('Magento\App\Dir', null, array(), '', false); - - /** @var $processorFactory \Magento\View\Layout\ProcessorFactory */ - $processorFactory = $this->getMock( - 'Magento\View\Layout\ProcessorFactory', - array('create'), - array(), - '', - false - ); - - /** @var $themeCollection \Magento\Core\Model\Resource\Theme\Collection */ - $themeCollection = $this->getMock('Magento\Core\Model\Resource\Theme\Collection', null, array(), '', false); - - /** @var $context \Magento\App\Helper\Context */ - $context = $this->getMock('Magento\App\Helper\Context', null, array(), '', false); - - $fileSystem = $this->getMockBuilder('Magento\View\FileSystem')->disableOriginalConstructor() - ->getMock(); - - $helper = new \Magento\Core\Helper\Theme( - $context, - $dirs, - $processorFactory, - $themeCollection, - $fileSystem - ); - - $result = $helper->getSafePath($filePath, $basePath); - - $this->assertEquals($expectedResult, $result); - } - - /** - * @return array - */ - public function getSafePathDataProvider() - { - return array( - array('/1/2/3/4/5/6.test', '/1/2/3/', '4/5/6.test'), - array('/1/2/3/4/5/6.test', '/1/2/3', '4/5/6.test'), - ); - } - /** * @dataProvider getCssFilesDataProvider * @param string $layoutStr @@ -102,19 +49,38 @@ class ThemeTest extends \PHPUnit_Framework_TestCase // 2. Get theme model $theme = $this->_getTheme($themeId, $themeArea); - // 3. Get dirs model - $dirs = $this->_getDirs(); + // 3. Get filesystem model + $filesystem = $this->_getFilesystem(); + + $directory = $this->getMock('Magento\Filesystem\Directory\Read', array('getRelativePath'), array(), '', false); + $directory->expects($this->any()) + ->method('getRelativePath') + ->will($this->returnValueMap(array( + array('/zzz/qqq/test1.css', 'qqq/test1.css'), + array('/zzz/qqq/test2.css', 'qqq/test2.css'), + array('/zzz/qqq/test3.css', 'qqq/test3.css'), + array('/zzz/qqq/test4.css', 'qqq/test4.css'), + array('/zzz/qqq/test21.css', 'qqq/test21.css'), + array('/zzz/qqq/test22.css', 'qqq/test22.css'), + array('/zzz/qqq/test23.css', 'qqq/test23.css'), + array('/zzz/qqq/test24.css', 'qqq/test24.css'), + ))); + + $filesystem->expects($this->any()) + ->method('getDirectoryRead') + ->will($this->returnValue($directory)); + // 4. Get layout merge model and factory $layoutMergeFactory = $this->_getLayoutMergeFactory($layoutStr); // 5. /** @var $themeCollection \Magento\Core\Model\Resource\Theme\Collection */ - $themeCollection = $this->getMock('Magento\Core\Model\Resource\Theme\Collection', null, array(), '', false); + $themeCollection = $this->getMock('Magento\Core\Model\Resource\Theme\Collection', array(), array(), '', false); // 6. /** @var $context \Magento\App\Helper\Context */ - $context = $this->getMock('Magento\App\Helper\Context', null, array(), '', false); + $context = $this->getMock('Magento\App\Helper\Context', array(), array(), '', false); // 7. Get view file system model mock $params = array( @@ -132,15 +98,15 @@ class ThemeTest extends \PHPUnit_Framework_TestCase array('Magento_Core::test23.css', $params, '/zzz/qqq/test23.css'), array('test24.css', $params, '/zzz/qqq/test24.css'), ); - $fileSystem = $this->_getFileSystem($map); + $fileSystemView = $this->_getFileSystemView($map); // 8. Run tested method $helper = new \Magento\Core\Helper\Theme( $context, - $dirs, + $filesystem, $layoutMergeFactory, $themeCollection, - $fileSystem + $fileSystemView ); $result = $helper->getCssFiles($theme); // 9. Compare actual result with expected data @@ -479,7 +445,7 @@ class ThemeTest extends \PHPUnit_Framework_TestCase * @param array $map * @return \Magento\View\FileSystem|\PHPUnit_Framework_MockObject_MockObject */ - protected function _getFileSystem($map) + protected function _getFileSystemView($map) { /** @var $fileSystem \Magento\View\FileSystem|\PHPUnit_Framework_MockObject_MockObject */ $fileSystem = $this->getMockBuilder('Magento\View\FileSystem', array()) @@ -515,23 +481,25 @@ class ThemeTest extends \PHPUnit_Framework_TestCase } /** - * @return \Magento\App\Dir|\PHPUnit_Framework_MockObject_MockObject + * @return \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ - protected function _getDirs() + protected function _getFilesystem() { - /** @var $dirs \Magento\App\Dir */ - $dirs = $this->getMock('Magento\App\Dir', array('getDir'), array(), '', false); - $dirs->expects($this->any()) - ->method('getDir') + /** @var $filesystem \Magento\Filesystem */ + $filesystem = $this->getMock('Magento\Filesystem', + array('getPath', '__wakeup', 'getDirectoryRead'), array(), '', false + ); + $filesystem->expects($this->any()) + ->method('getPath') ->will($this->returnValueMap(array( - array(\Magento\App\Dir::ROOT, self::ROOT), - array(\Magento\App\Dir::APP, self::APP), - array(\Magento\App\Dir::MODULES, self::MODULES), - array(\Magento\App\Dir::THEMES, self::THEMES), - array(\Magento\App\Dir::PUB_LIB, self::PUB_LIB), + 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), ))); - return $dirs; + return $filesystem; } /** @@ -570,7 +538,7 @@ class ThemeTest extends \PHPUnit_Framework_TestCase // 3. Get Design Package model // 4. Get dirs model - $dirs = $this->_getDirs(); + $dirs = $this->_getFileSystem(); // 5. Get layout merge model and factory /** @var $processorFactory \Magento\View\Layout\ProcessorFactory|\PHPUnit_Framework_MockObject_MockObject */ 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 e0b9688faed..476b5660f2f 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php @@ -26,104 +26,133 @@ namespace Magento\Core\Model\Config; class FileResolverTest extends \PHPUnit_Framework_TestCase { /** + * Files resolver + * * @var \Magento\Core\Model\Config\FileResolver */ - protected $_model; + protected $model; + + /** + * Filesystem + * + * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + */ + protected $filesystem; + + /** + * File iterator factory + * + * @var \Magento\Config\FileIteratorFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $iteratorFactory; + + /** + * @var \Magento\Module\Dir\Reader|\PHPUnit_Framework_MockObject_MockObject + */ + protected $moduleReader; protected function setUp() { - $appConfigDir = __DIR__ . DIRECTORY_SEPARATOR . 'FileResolver' - . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'etc'; + $this->iteratorFactory = $this->getMock( + 'Magento\Config\FileIteratorFactory', + array(), + array('getPath'), + '', + false + ); + $this->filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryRead'), array(), '', false); + $this->moduleReader = $this->getMock( + 'Magento\Module\Dir\Reader', + array(), + array('getConfigurationFiles'), + '', + false + ); + $this->model = new \Magento\Core\Model\Config\FileResolver( + $this->moduleReader, + $this->filesystem, + $this->iteratorFactory + ); + } - $applicationDirs = $this->getMock('Magento\App\Dir', array(), array('getDir'), '', false); - $applicationDirs->expects($this->any()) - ->method('getDir') - ->with(\Magento\App\Dir::CONFIG) - ->will($this->returnValue($appConfigDir)); + /** + * Test for get method with primary scope + * + * @dataProvider providerGet + * @param string $filename + * @param array $fileList + * @SuppressWarnings(PHPMD.UnusedLocalVariable) + */ + public function testGetPrimary($filename, $fileList) + { + $scope = 'primary'; + $directory = $this->getMock( + 'Magento\Filesystem\Directory\Read', + array('search', 'getRelativePath'), + array(), + '', + false + ); + $directory->expects($this->once()) + ->method('search') + ->with('#' . preg_quote($filename) . '$#') + ->will($this->returnValue($fileList)); + $this->filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->with(\Magento\Filesystem::CONFIG) + ->will($this->returnValue($directory)); + $this->iteratorFactory->expects($this->once()) + ->method('create') + ->with($directory, $fileList) + ->will($this->returnValue(true)); + $this->assertTrue($this->model->get($filename, $scope)); + } - $moduleReader = $this->getMock('Magento\Module\Dir\Reader', array(), - array('getConfigurationFiles'), '', false); - $moduleReader->expects($this->any()) + /** + * Test for get method with global scope + * + * @dataProvider providerGet + * @param string $filename + * @param array $fileList + */ + public function testGetGlobal($filename, $fileList) + { + $scope = 'global'; + $this->moduleReader->expects($this->once()) ->method('getConfigurationFiles') - ->will($this->returnValueMap( - array( - array( - 'adminhtml' . DIRECTORY_SEPARATOR . 'di.xml', - array( - 'app/code/Custom/FirstModule/adminhtml/di.xml', - 'app/code/Custom/SecondModule/adminhtml/di.xml', - ) - ), - array( - 'frontend' . DIRECTORY_SEPARATOR . 'di.xml', - array( - 'app/code/Custom/FirstModule/frontend/di.xml', - 'app/code/Custom/SecondModule/frontend/di.xml', - ) - ), - array( - 'di.xml', - array( - 'app/code/Custom/FirstModule/di.xml', - 'app/code/Custom/SecondModule/di.xml', - ) - ), - ) - )); - $this->_model = new \Magento\Core\Model\Config\FileResolver($moduleReader, $applicationDirs); + ->with($filename) + ->will($this->returnValue($fileList)); + $this->assertEquals($fileList, $this->model->get($filename, $scope)); } /** - * @param array $expectedResult - * @param string $scope + * Test for get method with default scope + * + * @dataProvider providerGet * @param string $filename - * @dataProvider getMethodDataProvider + * @param array $fileList */ - public function testGet(array $expectedResult, $scope, $filename) + public function testGetDefault($filename, $fileList) { - $this->assertEquals($expectedResult, $this->_model->get($filename, $scope)); + $scope = 'some_scope'; + $this->moduleReader->expects($this->once()) + ->method('getConfigurationFiles') + ->with($scope . '/' . $filename) + ->will($this->returnValue($fileList)); + $this->assertEquals($fileList, $this->model->get($filename, $scope)); } /** + * Data provider for get tests + * * @return array */ - public function getMethodDataProvider() + public function providerGet() { - $appConfigDir = __DIR__ . DIRECTORY_SEPARATOR . 'FileResolver' - . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'etc'; return array( - array( - array( - $appConfigDir . DIRECTORY_SEPARATOR . 'config.xml', - $appConfigDir . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . 'config.xml', - ), - 'primary', - 'config.xml', - ), - array( - array( - 'app/code/Custom/FirstModule/di.xml', - 'app/code/Custom/SecondModule/di.xml', - ), - 'global', - 'di.xml', - ), - array( - array( - 'app/code/Custom/FirstModule/frontend/di.xml', - 'app/code/Custom/SecondModule/frontend/di.xml', - ), - 'frontend', - 'di.xml', - ), - array( - array( - 'app/code/Custom/FirstModule/adminhtml/di.xml', - 'app/code/Custom/SecondModule/adminhtml/di.xml', - ), - 'adminhtml', - 'di.xml', - ), + array('di.xml', array('di.xml', 'anotherfolder/di.xml')), + array('no_files.xml', array()), + array('one_file.xml', array('one_file.xml')) ); } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/ConverterTest.php index e6382bfba13..a064362435d 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/ConverterTest.php @@ -37,7 +37,7 @@ class ConverterTest extends \PHPUnit_Framework_TestCase public function testConvert() { - $fixturePath = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; + $fixturePath = __DIR__ . '/_files/'; $dom = new \DOMDocument(); $dom->loadXML(file_get_contents($fixturePath . 'config.xml')); $expectedResult = include $fixturePath . 'converted_config.php'; 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 fe3dc925350..f0784aeb039 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,6 +23,8 @@ */ namespace Magento\Core\Model\Config\Initial; +use Magento\Filesystem; + class ReaderTest extends \PHPUnit_Framework_TestCase { /** @@ -31,12 +33,12 @@ class ReaderTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Config\FileResolverInterface + * @var \Magento\Config\FileResolverInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_fileResolverMock; /** - * @var \Magento\Core\Model\Config\Initial\Converter + * @var \Magento\Core\Model\Config\Initial\Converter|\PHPUnit_Framework_MockObject_MockObject */ protected $_converterMock; @@ -45,9 +47,14 @@ class ReaderTest extends \PHPUnit_Framework_TestCase */ protected $_filePath; + /** + * @var \Magento\Filesystem\Directory\Read|\PHPUnit_Framework_MockObject_MockObject + */ + protected $rootDirectory; + protected function setUp() { - $this->_filePath = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; + $this->_filePath = __DIR__ . '/_files/'; $this->_fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $this->_converterMock = $this->getMock('Magento\Core\Model\Config\Initial\Converter'); $schemaLocatorMock = @@ -56,6 +63,11 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $validationStateMock->expects($this->once())->method('isValidated')->will($this->returnValue(true)); $schemaFile = $this->_filePath . 'config.xsd'; $schemaLocatorMock->expects($this->once())->method('getSchema')->will($this->returnValue($schemaFile)); + $this->rootDirectory = $this->getMock( + 'Magento\Filesystem\Directory\Read', + array('readFile', 'getRelativePath'), + array(), '', false + ); $this->_model = new \Magento\Core\Model\Config\Initial\Reader( $this->_fileResolverMock, $this->_converterMock, @@ -88,10 +100,13 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function testReadValidConfig() { $testXmlFilesList = array( - $this->_filePath . 'initial_config1.xml', - $this->_filePath . 'initial_config2.xml' + file_get_contents($this->_filePath . 'initial_config1.xml'), + file_get_contents($this->_filePath . 'initial_config2.xml') + ); + $expectedConfig = array( + 'data' => array(), + 'metadata' => array() ); - $expectedConfig = include ($this->_filePath . 'initial_config_merged.php'); $this->_fileResolverMock->expects($this->at(0)) ->method('get') @@ -108,6 +123,14 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ->with($this->anything()) ->will($this->returnValue($expectedConfig)); + $this->rootDirectory->expects($this->any()) + ->method('getRelativePath') + ->will($this->returnArgument(0)); + + $this->rootDirectory->expects($this->any()) + ->method('readFile') + ->will($this->returnValue('<config></config>')); + $this->assertEquals($expectedConfig, $this->_model->read()); } } 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 index 66bdeda6981..434439e7f7a 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php @@ -43,9 +43,16 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $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( - array($path), + new \Magento\Config\FileIterator($directoryMock, array($path)), $this->_modulesReaderMock ); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DirTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DirTest.php deleted file mode 100644 index 59395f8b599..00000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DirTest.php +++ /dev/null @@ -1,132 +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. - * - * @copyright Copyright (c) 2013 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; - -class DirTest extends \PHPUnit_Framework_TestCase -{ - /** - * @param string $code - * @param string $value - * @expectedException \InvalidArgumentException - * @dataProvider invalidUriDataProvider - */ - public function testInvalidUri($code, $value) - { - new \Magento\App\Dir(__DIR__, array($code => $value)); - } - - /** - * @return array - */ - public function invalidUriDataProvider() - { - return array( - array(\Magento\App\Dir::MEDIA, '/'), - array(\Magento\App\Dir::MEDIA, '//'), - array(\Magento\App\Dir::MEDIA, '/value'), - array(\Magento\App\Dir::MEDIA, 'value/'), - array(\Magento\App\Dir::MEDIA, '/value/'), - array(\Magento\App\Dir::MEDIA, 'one\\two'), - array(\Magento\App\Dir::MEDIA, '../dir'), - array(\Magento\App\Dir::MEDIA, './dir'), - array(\Magento\App\Dir::MEDIA, 'one/../two'), - ); - } - - public function testGetUri() - { - $dir = new \Magento\App\Dir(__DIR__, array( - \Magento\App\Dir::PUB => '', - \Magento\App\Dir::MEDIA => 'test', - 'custom' => 'test2' - )); - - // arbitrary custom value - $this->assertEquals('test2', $dir->getUri('custom')); - - // setting empty value correctly adjusts its children - $this->assertEquals('', $dir->getUri(\Magento\App\Dir::PUB)); - $this->assertEquals('lib', $dir->getUri(\Magento\App\Dir::PUB_LIB)); - - // at the same time if another child has custom value, it must not be affected by its parent - $this->assertEquals('test', $dir->getUri(\Magento\App\Dir::MEDIA)); - $this->assertEquals('test/upload', $dir->getUri(\Magento\App\Dir::UPLOAD)); - } - - /** - * Test that URIs are not affected by custom dirs - */ - public function testGetUriIndependentOfDirs() - { - $fixtureDirs = array( - \Magento\App\Dir::ROOT => __DIR__ . '/root', - \Magento\App\Dir::MEDIA => __DIR__ . '/media', - 'custom' => 'test2' - ); - $default = new \Magento\App\Dir(__DIR__); - $custom = new \Magento\App\Dir(__DIR__, array(), $fixtureDirs); - foreach (array_keys($fixtureDirs) as $dirCode ) { - $this->assertEquals($default->getUri($dirCode), $custom->getUri($dirCode)); - } - } - - public function testGetDir() - { - $newRoot = __DIR__ . DIRECTORY_SEPARATOR . 'root'; - $newMedia = __DIR__ . DIRECTORY_SEPARATOR . 'media'; - $dir = new \Magento\App\Dir(__DIR__, array(), array( - \Magento\App\Dir::ROOT => $newRoot, - \Magento\App\Dir::MEDIA => $newMedia, - 'custom' => 'test2' - )); - - // arbitrary custom value - $this->assertEquals('test2', $dir->getDir('custom')); - - // new root has affected all its non-customized children - $this->assertStringStartsWith($newRoot, $dir->getDir(\Magento\App\Dir::APP)); - $this->assertStringStartsWith($newRoot, $dir->getDir(\Magento\App\Dir::MODULES)); - - // but it didn't affect the customized dirs - $this->assertEquals($newMedia, $dir->getDir(\Magento\App\Dir::MEDIA)); - $this->assertStringStartsWith($newMedia, $dir->getDir(\Magento\App\Dir::UPLOAD)); - } - - /** - * Test that dirs are not affected by custom URIs - */ - public function testGetDirIndependentOfUris() - { - $fixtureUris = array( - \Magento\App\Dir::PUB => '', - \Magento\App\Dir::MEDIA => 'test', - 'custom' => 'test2' - ); - $default = new \Magento\App\Dir(__DIR__); - $custom = new \Magento\App\Dir(__DIR__, $fixtureUris); - foreach (array_keys($fixtureUris) as $dirCode ) { - $this->assertEquals($default->getDir($dirCode), $custom->getDir($dirCode)); - } - } -} 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 7023e61589b..28281b81797 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 @@ -26,59 +26,49 @@ namespace Magento\Core\Model\File\Storage; class ConfigTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\File\Storage\Config + * Test for save method */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_streamMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_streamFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_fileStorageMock; - - /** - * @var array - */ - protected $_config = array(); - - protected function setUp() + public function testSave() { - $this->_fileStorageMock = $this->getMock('Magento\Core\Model\File\Storage', array(), array(), '', false); - $this->_fileStorageMock - ->expects($this->once()) - ->method('getScriptConfig') - ->will($this->returnValue($this->_config)); - $this->_streamFactoryMock = - $this->getMock('Magento\Filesystem\Stream\LocalFactory', array('create'), array(), '', false); - $this->_streamMock = $this->getMock('Magento\Filesystem\StreamInterface'); - $this->_streamFactoryMock - ->expects($this->any())->method('create')->will($this->returnValue($this->_streamMock)); - $this->_model = new \Magento\Core\Model\File\Storage\Config( - $this->_fileStorageMock, - $this->_streamFactoryMock, + $config = array(); + $fileStorageMock = $this->getMock('Magento\Core\Model\File\Storage', array(), array(), '', false); + $fileStorageMock + ->expects($this->once()) + ->method('getScriptConfig') + ->will($this->returnValue($config)); + + $file = $this->getMock( + 'Magento\Filesystem\File\Write', array('lock', 'write', 'unlock', 'close'), array(), '', false + ); + $file->expects($this->once()) + ->method('lock'); + $file->expects($this->once()) + ->method('write') + ->with(json_encode($config)); + $file->expects($this->once()) + ->method('unlock'); + $file->expects($this->once()) + ->method('close'); + $directory = $this->getMock( + 'Magento\Filesystem\Direcoty\Write', array('openFile', 'getRelativePath'), array(), '', false + ); + $directory->expects($this->once()) + ->method('getRelativePath') + ->will($this->returnArgument(0)); + $directory->expects($this->once()) + ->method('openFile') + ->with('cacheFile') + ->will($this->returnValue($file)); + $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryWrite'), array(), '', false); + $filesystem->expects($this->once()) + ->method('getDirectoryWrite') + ->with(\Magento\Filesystem::PUB) + ->will($this->returnValue($directory)); + $model = new \Magento\Core\Model\File\Storage\Config( + $fileStorageMock, + $filesystem, 'cacheFile' ); - } - - protected function tearDown() - { - unset($this->_model); - } - - public function testSave() - { - $this->_streamMock->expects($this->once())->method('open')->with('w'); - $this->_streamMock->expects($this->once())->method('write')->with(json_encode($this->_config)); - $this->_streamMock->expects($this->once())->method('close'); - $this->_model->save(); + $model->save(); } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/RequestTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/RequestTest.php index 1f58a1051f9..89e4fa789b3 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/RequestTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/RequestTest.php @@ -66,6 +66,6 @@ class RequestTest extends \PHPUnit_Framework_TestCase public function testGetFilePath() { - $this->assertEquals($this->_workingDir . DS . $this->_pathInfo, $this->_model->getFilePath()); + $this->assertEquals($this->_workingDir . '/' . $this->_pathInfo, $this->_model->getFilePath()); } } 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 225d124577a..433a873b4f8 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 @@ -26,78 +26,63 @@ namespace Magento\Core\Model\File\Storage; class SynchronizationTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\File\Storage\Synchronization + * Test fir synchronize method */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_storageMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_storageFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_streamMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_streamFactoryMock; - - /** - * @var string - */ - protected $_content = 'content'; - - protected function setUp() + public function testSynchronize() { - $this->_storageFactoryMock = - $this->getMock('Magento\Core\Model\File\Storage\DatabaseFactory', array('create'), array(), '', false); - $this->_storageMock = $this->getMock( + $content = 'content'; + $relativeFileName = 'config.xml'; + $filePath = realpath(__DIR__ . '/_files/'); + + $storageFactoryMock =$this->getMock( + 'Magento\Core\Model\File\Storage\DatabaseFactory', array('create', '_wakeup'), array(), '', false + ); + $storageMock = $this->getMock( 'Magento\Core\Model\File\Storage\Database', - array('getContent', 'getId', 'loadByFilename', '__wakeup'), - array(), - '', - false + array('getContent', 'getId', 'loadByFilename', '__wakeup'), array(), '', false ); - $this->_storageFactoryMock - ->expects($this->once()) - ->method('create') - ->will($this->returnValue($this->_storageMock)); - - $this->_storageMock->expects($this->once())->method('getContent')->will($this->returnValue($this->_content)); - $this->_streamFactoryMock = - $this->getMock('Magento\Filesystem\Stream\LocalFactory', array('create'), array(), '', false); - $this->_streamMock = $this->getMock('Magento\Filesystem\StreamInterface'); - $this->_streamFactoryMock - ->expects($this->any()) + $storageFactoryMock->expects($this->once()) ->method('create') - ->will($this->returnValue($this->_streamMock)); + ->will($this->returnValue($storageMock)); - $this->_model = new \Magento\Core\Model\File\Storage\Synchronization( - $this->_storageFactoryMock, $this->_streamFactoryMock); - } + $storageMock->expects($this->once()) + ->method('getContent') + ->will($this->returnValue($content)); + $storageMock->expects($this->once()) + ->method('getId') + ->will($this->returnValue(true)); + $storageMock->expects($this->once()) + ->method('loadByFilename'); - protected function tearDown() - { - unset($this->_model); - unset($this->_storageMock); - } + $file = $this->getMock( + 'Magento\Filesystem\File\Write', array('lock', 'write', 'unlock', 'close'), array(), '', false + ); + $file->expects($this->once()) + ->method('lock'); + $file->expects($this->once()) + ->method('write') + ->with($content); + $file->expects($this->once()) + ->method('unlock'); + $file->expects($this->once()) + ->method('close'); + $directory = $this->getMock( + 'Magento\Filesystem\Direcoty\Write', array('openFile', 'getRelativePath'), array(), '', false + ); + $directory->expects($this->once()) + ->method('getRelativePath') + ->will($this->returnArgument(0)); + $directory->expects($this->once()) + ->method('openFile') + ->with($filePath) + ->will($this->returnValue($file)); + $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryWrite'), array(), '', false); + $filesystem->expects($this->once()) + ->method('getDirectoryWrite') + ->with(\Magento\Filesystem::PUB) + ->will($this->returnValue($directory)); - public function testSynchronize() - { - $relativeFileName = 'config.xml'; - $filePath = realpath(__DIR__ . '/_files/'); - $this->_storageMock->expects($this->once())->method('getId')->will($this->returnValue(true)); - $this->_storageMock->expects($this->once())->method('loadByFilename'); - $this->_streamMock->expects($this->once())->method('open')->with('w'); - $this->_streamMock->expects($this->once())->method('write')->with($this->_content); - $this->_model->synchronize($relativeFileName, $filePath); + $model = new Synchronization($storageFactoryMock, $filesystem); + $model->synchronize($relativeFileName, $filePath); } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/AbstractHandlerTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/AbstractHandlerTest.php index 5b397a3a423..15c2c81535f 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/AbstractHandlerTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/AbstractHandlerTest.php @@ -63,8 +63,7 @@ class AbstractHandlerTest extends \PHPUnit_Framework_TestCase public function parseDataProvider() { $layout = simplexml_load_file( - __DIR__ . DIRECTORY_SEPARATOR . 'Handler' . DIRECTORY_SEPARATOR - . '_files' . DIRECTORY_SEPARATOR . 'arguments.xml', + __DIR__ . '/Handler/_files/arguments.xml', 'Magento\View\Layout\Element' ); $withoutUpdater = $layout->xpath('//argument[@name="testParseWithoutUpdater"]'); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ArrayTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ArrayTest.php index 36c0c0ce80c..7a5b6233173 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ArrayTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ArrayTest.php @@ -155,7 +155,7 @@ class ArrayTest extends \PHPUnit_Framework_TestCase public function parseDataProvider() { $layout = simplexml_load_file( - __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'arguments.xml', + __DIR__ . '/_files/arguments.xml', 'Magento\View\Layout\Element' ); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/BooleanTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/BooleanTest.php index 3ee35a12e11..3565736b6b5 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/BooleanTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/BooleanTest.php @@ -69,7 +69,7 @@ class BooleanTest extends \PHPUnit_Framework_TestCase public function parseDataProvider() { $layout = simplexml_load_file( - __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'arguments.xml', + __DIR__ . '/_files/arguments.xml', 'Magento\View\Layout\Element' ); $result = $this->processDataProvider(); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/HelperTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/HelperTest.php index 6bde44e9028..71061f10598 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/HelperTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/HelperTest.php @@ -44,7 +44,7 @@ class HelperTest extends \PHPUnit_Framework_TestCase protected function setUp() { - include_once(__DIR__ . DIRECTORY_SEPARATOR . 'TestHelper.php'); + include_once(__DIR__ . '/TestHelper.php'); $helperObjectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_objectManagerMock = $this->getMock('Magento\ObjectManager'); @@ -71,7 +71,7 @@ class HelperTest extends \PHPUnit_Framework_TestCase public function parseDataProvider() { $layout = simplexml_load_file( - __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'arguments.xml', + __DIR__ . '/_files/arguments.xml', 'Magento\View\Layout\Element' ); $result = $this->processDataProvider(); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/NumberTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/NumberTest.php index 2baa8496ac5..355b5e7f276 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/NumberTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/NumberTest.php @@ -69,7 +69,7 @@ class NumberTest extends \PHPUnit_Framework_TestCase public function parseDataProvider() { $layout = simplexml_load_file( - __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'arguments.xml', + __DIR__ . '/_files/arguments.xml', 'Magento\View\Layout\Element' ); $result = $this->processDataProvider(); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ObjectTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ObjectTest.php index 176bdcb55d5..e0bced71f40 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ObjectTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ObjectTest.php @@ -44,7 +44,7 @@ class ObjectTest extends \PHPUnit_Framework_TestCase protected function setUp() { - include_once(__DIR__ . DIRECTORY_SEPARATOR . 'TestObject.php'); + include_once(__DIR__ . '/TestObject.php'); $helperObjectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_objectManagerMock = $this->getMock('Magento\ObjectManager'); @@ -74,7 +74,7 @@ class ObjectTest extends \PHPUnit_Framework_TestCase public function parseDataProvider() { $layout = simplexml_load_file( - __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'arguments.xml', + __DIR__ . '/_files/arguments.xml', 'Magento\View\Layout\Element' ); $simpleObject = $layout->xpath('//argument[@name="testSimpleObject"]'); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/OptionsTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/OptionsTest.php index 9f97597da55..8a60fc7a3db 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/OptionsTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/OptionsTest.php @@ -44,7 +44,7 @@ class OptionsTest extends \PHPUnit_Framework_TestCase protected function setUp() { - include_once(__DIR__ . DIRECTORY_SEPARATOR . 'TestOptions.php'); + include_once(__DIR__ . '/TestOptions.php'); $helperObjectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_objectManagerMock = $this->getMock('Magento\ObjectManager'); @@ -71,7 +71,7 @@ class OptionsTest extends \PHPUnit_Framework_TestCase public function parseDataProvider() { $layout = simplexml_load_file( - __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'arguments.xml', + __DIR__ . '/_files/arguments.xml', 'Magento\View\Layout\Element' ); $optionsArguments = $layout->xpath('//argument[@name="testOptions"]'); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/StringTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/StringTest.php index 7497362f14e..c9e8928713f 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/StringTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/StringTest.php @@ -69,7 +69,7 @@ class StringTest extends \PHPUnit_Framework_TestCase public function parseDataProvider() { $layout = simplexml_load_file( - __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'arguments.xml', + __DIR__ . '/_files/arguments.xml', 'Magento\View\Layout\Element' ); $result = $this->processDataProvider(); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/UrlTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/UrlTest.php index d9aa18908cb..a6f581bedf5 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/UrlTest.php @@ -69,7 +69,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase public function parseDataProvider() { $layout = simplexml_load_file( - __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'arguments.xml', + __DIR__ . '/_files' . '/arguments.xml', 'Magento\View\Layout\Element' ); $result = $this->processDataProvider(); 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 c2f826ef7ba..158e6dd4826 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php @@ -66,6 +66,11 @@ class MergeTest extends \PHPUnit_Framework_TestCase */ protected $_logger; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_layoutValidator; + protected function setUp() { $files = array(); @@ -86,7 +91,11 @@ class MergeTest extends \PHPUnit_Framework_TestCase $this->_appState = $this->getMock('Magento\App\State', array(), array(), '', false); - $this->_logger = $this->getMock('Magento\Logger', array('log'), array(), '', false); + $this->_logger = $this->getMock('Magento\Logger', array(), array(), '', false); + + $this->_layoutValidator = $this->getMock( + 'Magento\Core\Model\Layout\Update\Validator', array(), array(), '', false + ); $this->_cache = $this->getMockForAbstractClass('Magento\Cache\FrontendInterface'); @@ -96,6 +105,21 @@ class MergeTest extends \PHPUnit_Framework_TestCase $this->_theme->expects($this->any())->method('getId')->will($this->returnValue(100)); $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + + $filesystem = $this->getMock('Magento\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)); + + $fileDriver = $objectHelper->getObject('Magento\Filesystem\Driver\File'); + $directory->expects($this->any()) + ->method('readFile') + ->will($this->returnCallback( + function ($filename) use ($fileDriver) { + return $fileDriver->fileGetContents($filename); + } + )); + $filesystem->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($directory)); + $this->_model = $objectHelper->getObject('Magento\Core\Model\Layout\Merge', array( 'design' => $design, 'storeManager' => $storeManager, @@ -104,7 +128,9 @@ class MergeTest extends \PHPUnit_Framework_TestCase 'appState' => $this->_appState, 'cache' => $this->_cache, 'theme' => $this->_theme, - 'logger' => $this->_logger + 'validator' => $this->_layoutValidator, + 'logger' => $this->_logger, + 'filesystem' => $filesystem, )); } @@ -322,4 +348,46 @@ class MergeTest extends \PHPUnit_Framework_TestCase $this->assertFalse($this->_model->isCustomerDesignAbstraction($expected['page_empty'])); $this->assertFalse($this->_model->isCustomerDesignAbstraction($expected['empty_data'])); } + + /** + * @expectedException \Magento\Exception + * @expectedExceptionMessage Invalid layout update handle + */ + public function testLoadWithInvalidArgumentThrowsException() + { + $this->_model->load(123); + } + + /** + * Test loading invalid layout + */ + public function testLoadWithInvalidLayout() + { + $this->_model->addPageHandles(array('default')); + + $this->_appState->expects($this->any()) + ->method('getMode') + ->will($this->returnValue('developer')); + + $this->_layoutValidator->expects($this->any()) + ->method('getMessages') + ->will($this->returnValue(array('testMessage1', 'testMessage2'))); + + $this->_layoutValidator->expects($this->any()) + ->method('isValid') + ->will($this->returnValue(false)); + + $suffix = md5(implode('|', $this->_model->getHandles())); + $cacheId = "LAYOUT_{$this->_theme->getArea()}_STORE{$this->_store->getId()}_{$this->_theme->getId()}{$suffix}"; + $messages = $this->_layoutValidator->getMessages(); + + // Testing error message is logged with logger + $this->_logger->expects($this->once()) + ->method('log') + ->with( + 'Cache file with merged layout: ' . $cacheId. ': ' . array_shift($messages), + \Zend_Log::ERR); + + $this->_model->load(); + } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Update/ValidatorTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Update/ValidatorTest.php index 3172fc1f43c..7dd8792c294 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Update/ValidatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Update/ValidatorTest.php @@ -62,7 +62,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase 'xml' => '<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . trim($layoutUpdate) . '</layout>', - 'schemaFile' => 'dummyDir' . DIRECTORY_SEPARATOR . 'layout_single.xsd' + 'schemaFile' => 'dummyDir/layout_single.xsd' ); $exceptionMessage = 'validation exception'; 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 f2b851e57f1..2f9faa39a10 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 @@ -31,14 +31,38 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem\Directory\Read */ - protected $_appDirsMock; + protected $_directoryMock; + + /** + * @var \Magento\Config\FileIteratorFactory + */ + protected $iteratorFactory; protected function setUp() { - $this->_appDirsMock = $this->getMock('Magento\App\Dir', array(), array(), '', false); - $this->_model = new \Magento\Core\Model\Locale\Hierarchy\Config\FileResolver($this->_appDirsMock); + $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryRead'), array(), '', false); + $this->_directoryMock = $this->getMock( + '\Magento\Filesystem\Directory\Read', + array('isExist', 'search'), + array(), + '', + false + ); + $filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->with(\Magento\Filesystem::APP) + ->will($this->returnValue($this->_directoryMock)); + $this->_directoryMock->expects($this->once()) + ->method('isExist') + ->with('locale') + ->will($this->returnValue(true)); + $this->iteratorFactory = $this->getMock('Magento\Config\FileIteratorFactory', array(), array(), '', false); + $this->_model = new \Magento\Core\Model\Locale\Hierarchy\Config\FileResolver( + $filesystem, + $this->iteratorFactory + ); } /** @@ -46,18 +70,20 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase */ public function testGet() { - $path = __DIR__ . DIRECTORY_SEPARATOR . '_files'; - - $this->_appDirsMock->expects($this->once()) - ->method('getDir') - ->with(\Magento\App\Dir::LOCALE) - ->will($this->returnValue($path)); - - $expectedFilesList = array( - $path . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . 'hierarchy_config.xml', - $path . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . 'hierarchy_config.xml' + $paths = array( + __DIR__ . '/_files/custom/hierarchy_config.xml', + __DIR__ . '/_files/default/hierarchy_config.xml' + ); + $expected = array( + 0 => $paths ); - $this->assertEquals($expectedFilesList, $this->_model->get('hierarchy_config.xml', 'scope')); + $this->_directoryMock->expects($this->once()) + ->method('search') + ->will($this->returnValue(array($paths))); + $this->iteratorFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue(array($paths))); + $this->assertEquals($expected, $this->_model->get('hierarchy_config.xml', 'scope')); } } 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 42fd76b180a..e5393a07971 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,10 +75,10 @@ class AbstractTest extends \PHPUnit_Framework_TestCase */ public function testGetConnectionInMemoryCaching() { - $dir = $this->getMock('Magento\App\Dir', array(), array(), '', false); + $filesystem = $this->getMock('Magento\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($dir, $string, $dateTime, array( + $connection = new \Magento\DB\Adapter\Pdo\Mysql($filesystem, $string, $dateTime, array( 'dbname' => 'test_dbname', 'username' => 'test_username', 'password' => 'test_password', diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/SessionTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/SessionTest.php index 11ca61ffb13..4ba21d3356c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/SessionTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/SessionTest.php @@ -57,7 +57,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase /** * Model under test * - * @var \Magento\Core\Model\Resource\Session + * @var \Magento\Session\SaveHandler\DbTable */ protected $_model; @@ -107,9 +107,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase ->method('getConnection') ->will($this->returnValue($connection)); - $this->_model = new \Magento\Core\Model\Resource\Session( - $resource, $this->getMock('Magento\App\Dir', array(), array(), '', false, false) - ); + $this->_model = new \Magento\Session\SaveHandler\DbTable($resource); } /** @@ -120,8 +118,11 @@ class SessionTest extends \PHPUnit_Framework_TestCase protected function _prepareMockForRead($isDataEncoded) { $connection = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', - array('select', 'from', 'where', 'fetchOne'), array(), '', false + array('select', 'from', 'where', 'fetchOne', 'isTableExists'), array(), '', false ); + $connection->expects($this->atLeastOnce()) + ->method('isTableExists') + ->will($this->returnValue(true)); $connection->expects($this->once()) ->method('select') ->will($this->returnSelf()); @@ -178,8 +179,11 @@ class SessionTest extends \PHPUnit_Framework_TestCase protected function _prepareMockForWrite($sessionExists) { $connection = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', - array('select', 'from', 'where', 'fetchOne', 'update', 'insert'), array(), '', false + array('select', 'from', 'where', 'fetchOne', 'update', 'insert', 'isTableExists'), array(), '', false ); + $connection->expects($this->atLeastOnce()) + ->method('isTableExists') + ->will($this->returnValue(true)); $connection->expects($this->once()) ->method('select') ->will($this->returnSelf()); 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 1616cd8b892..25a0a710637 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,6 +157,14 @@ 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); + $contextMock->expects($this->any()) + ->method('getFilesystem') + ->will($this->returnValue($filesystemMock)); + $modulesDirMock = $this->getMock('Magento\Filesystem\Directory\Read', array(), array(), '', false); + $filesystemMock->expects($this->any()) + ->method('getDirectoryRead') + ->will($this->returnValue($modulesDirMock)); $contextMock->expects($this->once()) ->method('getEventManager') @@ -179,9 +187,8 @@ class MigrationTest extends \PHPUnit_Framework_TestCase $setupModel = new \Magento\Core\Model\Resource\Setup\Migration( $contextMock, 'core_setup', - $this->getMock('Magento\Filesystem', array(), array(), '', false), $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false), - $this->getMock('Magento\App\Dir', array(), array(), '', false), + $this->getMock('Magento\Filesystem', array(), array(), '', false), '' ); @@ -236,7 +243,6 @@ class MigrationTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\App\Resource', array(), array(), '', false, false), $this->getMock('Magento\Filesystem', array(), array(), '', false), $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false), - $this->getMock('Magento\App\Dir', array(), array(), '', false), $this->getMock('Magento\Logger', array(), array(), '', false), $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), $this->getMock('Magento\Core\Model\Config', array(), array(), '', false, false), 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 76632ce7096..6fdbad1ea7a 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Session/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Session/ConfigTest.php @@ -60,9 +60,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected $_appState; /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_dir; + protected $_filesystem; protected function setUp() { @@ -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->_dir = $this->getMock('\Magento\App\Dir', array(), array(), '', false, false); + $this->_filesystem = $this->getMock('\Magento\Filesystem', array(), array(), '', false, false); $this->config = new \Magento\Core\Model\Session\Config( $this->_configMock, @@ -91,7 +91,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_stringHelperMock, $this->_requestMock, $this->_appState, - $this->_dir, + $this->_filesystem, + \Magento\Session\SaveHandlerInterface::DEFAULT_HANDLER, __DIR__ ); } @@ -342,17 +343,6 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->config->methodThatNotExist(); } - public function testRememberMeSecondsDefaultsToTwoWeeks() - { - $this->assertEquals(1209600, $this->config->getRememberMeSeconds()); - } - - public function testRememberMeSecondsIsMutable() - { - $this->config->setRememberMeSeconds(604800); - $this->assertEquals(604800, $this->config->getRememberMeSeconds()); - } - public function testCookieSecureDefaultsToIniSettings() { $this->assertSame((bool) ini_get('session.cookie_secure'), $this->config->getCookieSecure()); @@ -489,4 +479,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->config->setOption('referer_check', 'BARBAZ'); $this->assertEquals('BARBAZ', ini_get('session.referer_check')); } + + public function testSetSavePath() + { + $this->config->setSavePath('some_save_path'); + $this->assertEquals($this->config->getOption('save_path'), 'some_save_path'); + } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php index 12c3a6e7169..075fb28782c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php @@ -49,7 +49,7 @@ class StoreManagerTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_helperFactoryMock; + protected $_helperMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -60,13 +60,13 @@ class StoreManagerTest extends \PHPUnit_Framework_TestCase { $this->_factoryMock = $this->getMock('Magento\Core\Model\Store\StorageFactory', array(), array(), '', false); $this->_requestMock = $this->getMock('Magento\App\RequestInterface', array(), array(), '', false); - $this->_helperFactoryMock = $this->getMock('Magento\App\Helper\HelperFactory', array(), array(), '', false); + $this->_helperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $this->_storage = $this->getMock('Magento\Core\Model\Store\StorageInterface'); $this->_model = new \Magento\Core\Model\StoreManager( $this->_factoryMock, $this->_requestMock, - $this->_helperFactoryMock, + $this->_helperMock, 'scope_code', 'scope_type' ); @@ -151,14 +151,7 @@ class StoreManagerTest extends \PHPUnit_Framework_TestCase public function testIsSingleStoreModeWhenSingleStoreModeEnabledAndHasSingleStore() { - $helperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $helperMock->expects($this->once())->method('isSingleStoreModeEnabled')->will($this->returnValue(true)); - - $this->_helperFactoryMock - ->expects($this->any()) - ->method('get') - ->with('Magento\Core\Helper\Data') - ->will($this->returnValue($helperMock)); + $this->_helperMock->expects($this->once())->method('isSingleStoreModeEnabled')->will($this->returnValue(true)); $this->_storage->expects($this->once())->method('hasSingleStore')->will($this->returnValue(true)); @@ -169,14 +162,7 @@ class StoreManagerTest extends \PHPUnit_Framework_TestCase public function testIsSingleStoreModeWhenSingleStoreModeDisabledAndHasSingleStore() { - $helperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $helperMock->expects($this->once())->method('isSingleStoreModeEnabled')->will($this->returnValue(false)); - - $this->_helperFactoryMock - ->expects($this->any()) - ->method('get') - ->with('Magento\Core\Helper\Data') - ->will($this->returnValue($helperMock)); + $this->_helperMock->expects($this->once())->method('isSingleStoreModeEnabled')->will($this->returnValue(false)); $this->_storage->expects($this->once())->method('hasSingleStore')->will($this->returnValue(true)); 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 3eacb9cef12..c1c335a8faf 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 @@ -40,7 +40,7 @@ class PathTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_dirMock; + protected $_filesystem; /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\View\Url @@ -54,15 +54,15 @@ class PathTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_dirMock = $this->getMock('Magento\App\Dir', array(), array(), '', false); + $this->_filesystem = $this->getMock('Magento\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->_dirMock->expects($this->any())->method('getDir')->with(\Magento\App\Dir::MEDIA) + $this->_filesystem->expects($this->any())->method('getPath')->with(\Magento\Filesystem::MEDIA) ->will($this->returnValue('/media')); $this->_model = new Path( - $this->_dirMock, + $this->_filesystem, $this->_viewUrlMock, $this->_storeManagerMock ); @@ -71,7 +71,7 @@ class PathTest extends \PHPUnit_Framework_TestCase protected function tearDown() { $this->_model = null; - $this->_dirMock = null; + $this->_filesystem = null; $this->_viewUrlMock = null; $this->_storeManagerMock = null; } @@ -104,8 +104,8 @@ class PathTest extends \PHPUnit_Framework_TestCase public function testImagePreviewDirectoryGetter() { $this->assertEquals( - \Magento\Filesystem::fixSeparator('/media/theme/preview'), - \Magento\Filesystem::fixSeparator($this->_model->getImagePreviewDirectory()) + '/media/theme/preview', + $this->_model->getImagePreviewDirectory() ); } @@ -115,8 +115,8 @@ class PathTest extends \PHPUnit_Framework_TestCase public function testTemporaryDirectoryGetter() { $this->assertEquals( - \Magento\Filesystem::fixSeparator('/media/theme/origin'), - \Magento\Filesystem::fixSeparator($this->_model->getTemporaryDirectory()) + '/media/theme/origin', + $this->_model->getTemporaryDirectory() ); } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Translate/Inline/ConfigFactoryTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Translate/Inline/ConfigFactoryTest.php index 53a26037dd6..74d68d0c235 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Translate/Inline/ConfigFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Translate/Inline/ConfigFactoryTest.php @@ -38,6 +38,6 @@ class ConfigFactoryTest extends \PHPUnit_Framework_TestCase ->with($this->equalTo('Magento\Core\Model\Translate\Inline\Config')) ->will($this->returnValue($result)); $factory = new ConfigFactory($objectManager); - $this->assertEquals($result, $factory->create('any')); + $this->assertEquals($result, $factory->create()); } } diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php index 65446f35993..11e36b1b6f0 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php @@ -391,7 +391,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ public function testDispatchRunJob() { - require_once __DIR__ . DIRECTORY_SEPARATOR . 'CronJob.php'; + require_once __DIR__ . '/CronJob.php'; $testCronJob = new \Magento\Cron\Model\CronJob(); $jobConfig = array( diff --git a/dev/tests/unit/testsuite/Magento/Customer/Block/Account/AuthorizationLinkTest.php b/dev/tests/unit/testsuite/Magento/Customer/Block/Account/AuthorizationLinkTest.php index d5746f6a959..d0fff29bf88 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Block/Account/AuthorizationLinkTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Block/Account/AuthorizationLinkTest.php @@ -64,14 +64,12 @@ class AuthorizationLinkTest extends \PHPUnit_Framework_TestCase ->getMock(); $context = $this->_objectManager->getObject('Magento\View\Element\Template\Context'); - - $context->getHelperFactory()->expects($this->any())->method('get')->will($this->returnValue($this->_helper)); - $this->_block = $this->_objectManager->getObject( 'Magento\Customer\Block\Account\AuthorizationLink', array( 'context' => $context, 'session' => $this->_session, + 'customerHelper' => $this->_helper, ) ); } diff --git a/dev/tests/unit/testsuite/Magento/Customer/Block/Account/LinkTest.php b/dev/tests/unit/testsuite/Magento/Customer/Block/Account/LinkTest.php index fe239fc6599..91158de0554 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Block/Account/LinkTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Block/Account/LinkTest.php @@ -37,30 +37,17 @@ class LinkTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->setMethods(array('getAccountUrl')) ->getMock(); - - $helperFactory = $this->getMockBuilder('Magento\App\Helper\HelperFactory') - ->disableOriginalConstructor() - ->setMethods(array('get')) - ->getMock(); - $helperFactory->expects($this->any())->method('get')->will($this->returnValue($helper)); - $layout = $this->getMockBuilder('Magento\Core\Model\Layout') ->disableOriginalConstructor() ->setMethods(array('helper')) ->getMock(); - $context = $objectManager->getObject( - 'Magento\View\Element\Template\Context', - array( - 'layout' => $layout, - 'helperFactory' => $helperFactory - ) - ); $block = $objectManager->getObject( 'Magento\Customer\Block\Account\Link', array( - 'context' => $context, + 'layout' => $layout, + 'customerHelper' => $helper, ) ); $helper->expects($this->any())->method('getAccountUrl')->will($this->returnValue('account url')); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Block/Account/RegisterLinkTest.php b/dev/tests/unit/testsuite/Magento/Customer/Block/Account/RegisterLinkTest.php index 4be0dd7f73d..6f8edbbe482 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Block/Account/RegisterLinkTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Block/Account/RegisterLinkTest.php @@ -77,12 +77,11 @@ class RegisterLinkTest extends \PHPUnit_Framework_TestCase $context = $this->_objectManager->getObject('Magento\View\Element\Template\Context'); - $context->getHelperFactory()->expects($this->once())->method('get')->will($this->returnValue($helper)); - $block = $this->_objectManager->getObject( 'Magento\Customer\Block\Account\RegisterLink', array( 'context' => $context, + 'customerHelper' => $helper ) ); $this->assertEquals('register url', $block->getHref()); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index c65d91f80a4..e7ef3597a7e 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -74,6 +74,11 @@ class IndexTest extends \PHPUnit_Framework_TestCase */ protected $_helper; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * Prepare required values */ @@ -93,11 +98,21 @@ class IndexTest extends \PHPUnit_Framework_TestCase ->with($this->equalTo('X-Frame-Options')) ->will($this->returnValue(true)); - $this->_objectManager = $this->getMock('Magento\ObjectManager'); + $this->_objectManager = $this->getMockBuilder('Magento\App\ObjectManager') + ->disableOriginalConstructor() + ->setMethods(array('get', 'create')) + ->getMock(); + $frontControllerMock = $this->getMockBuilder('Magento\App\FrontController') + ->disableOriginalConstructor() + ->getMock(); + + $actionFlagMock = $this->getMockBuilder('Magento\App\ActionFlag') + ->disableOriginalConstructor() + ->getMock(); $this->_session = $this->getMockBuilder('Magento\Backend\Model\Session') ->disableOriginalConstructor() - ->setMethods(array('setIsUrlNotice', 'addSuccess')) + ->setMethods(array('setIsUrlNotice', '__wakeup')) ->getMock(); $this->_session->expects($this->any())->method('setIsUrlNotice'); @@ -106,21 +121,52 @@ class IndexTest extends \PHPUnit_Framework_TestCase ->setMethods(array('getUrl')) ->getMock(); - $helperObjectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_testedObject = $helperObjectManager->getObject('Magento\Customer\Controller\Adminhtml\Index', - array( - 'helper' => $this->_helper, - 'session' => $this->_session, - 'objectManager' => $this->_objectManager, - 'request' => $this->_request, - 'response' => $this->_response - - ) + $translator = $this->getMockBuilder('Magento\Core\Model\Translate') + ->disableOriginalConstructor() + ->setMethods(array('getTranslateInline', '__wakeup')) + ->getMock(); + + $this->messageManager = $this->getMockBuilder('Magento\Message\Manager') + ->disableOriginalConstructor() + ->setMethods(array('addSuccess')) + ->getMock(); + + $contextArgs = array( + 'getHelper', 'getSession', 'getAuthorization', 'getTranslator', 'getObjectManager', + 'getFrontController', 'getActionFlag', 'getMessageManager', + 'getLayoutFactory', 'getEventManager', 'getRequest', 'getResponse' ); + $contextMock = $this->getMockBuilder('\Magento\Backend\App\Action\Context') + ->disableOriginalConstructor() + ->setMethods($contextArgs) + ->getMock(); + $contextMock->expects($this->any())->method('getRequest')->will($this->returnValue($this->_request)); + $contextMock->expects($this->any())->method('getResponse')->will($this->returnValue($this->_response)); + $contextMock->expects($this->any()) + ->method('getObjectManager') + ->will($this->returnValue($this->_objectManager)); + $contextMock->expects($this->any()) + ->method('getFrontController') + ->will($this->returnValue($frontControllerMock)); + $contextMock->expects($this->any()) + ->method('getActionFlag') + ->will($this->returnValue($actionFlagMock)); + + $contextMock->expects($this->any())->method('getHelper')->will($this->returnValue($this->_helper)); + $contextMock->expects($this->any())->method('getSession')->will($this->returnValue($this->_session)); + $contextMock->expects($this->any())->method('getTranslator')->will($this->returnValue($translator)); + $contextMock->expects($this->any()) + ->method('getMessageManager') + ->will($this->returnValue($this->messageManager)); + + $args = array('context' => $contextMock); + + $helperObjectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_testedObject = $helperObjectManager->getObject('Magento\Customer\Controller\Adminhtml\Index', $args); } /** - * Test \Magento\Adminhtml\Controller\Customer::resetPasswordAction() + * Test \Magento\Backend\Controller\Customer::resetPasswordAction() */ public function testResetPasswordActionNoCustomer() { @@ -140,7 +186,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase } /** - * Test \Magento\Adminhtml\Controller\Customer::resetPasswordAction() + * Test \Magento\Backend\Controller\Customer::resetPasswordAction() */ public function testResetPasswordActionNoCustomerId() { @@ -201,8 +247,12 @@ class IndexTest extends \PHPUnit_Framework_TestCase ->method('generateResetPasswordLinkToken') ->will($this->returnValue($token)); - $coreHelperMock = $this->getMock('Magento\Core\Model\Url', array(), array(), '', false); + $coreHelperMock = $this->getMockBuilder('Magento\Core\Model\Url') + ->disableOriginalConstructor() + ->setMethods(array('getUrl', '__wakeup')) + ->getMock(); $coreHelperMock->expects($this->any())->method('getUrl')->will($this->returnValue($testUrl)); + $this->_objectManager->expects($this->at(0)) ->method('create') ->with($this->equalTo('Magento\Customer\Model\Customer')) @@ -218,7 +268,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase ->with($this->equalTo('Magento\Core\Model\Url')) ->will($this->returnValue($coreHelperMock)); - $this->_session->expects($this->once()) + $this->messageManager->expects($this->once()) ->method('addSuccess') ->with($this->equalTo('Customer will receive an email with a link to reset password.')); $this->_testedObject->resetPasswordAction(); @@ -233,11 +283,11 @@ class IndexTest extends \PHPUnit_Framework_TestCase */ protected function _getCustomerMock($customerId, $returnId = null) { - $customerMock = $this->getMock('Magento\Customer\Model\Customer', - array('setResetPasswordUrl', 'changeResetPasswordLinkToken', 'sendPasswordReminderEmail', 'load', - 'getId', '__wakeup', - ), - array(), '', false); + $customerMock = $this->getMockBuilder('Magento\Customer\Model\Customer') + ->disableOriginalConstructor() + ->setMethods(array('load', 'getId', 'changeResetPasswordLinkToken', 'setResetPasswordUrl', + 'sendPasswordReminderEmail', '__wakeup')) + ->getMock(); $customerMock->expects($this->any()) ->method('load') ->with($this->equalTo($customerId)); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Address/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Address/Config/ReaderTest.php index 7568b457434..f1faad2a3f2 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Address/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Address/Config/ReaderTest.php @@ -59,8 +59,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ->method('get') ->with('address_formats.xml', 'scope') ->will($this->returnValue(array( - __DIR__ . '/_files/formats_one.xml', - __DIR__ . '/_files/formats_two.xml', + file_get_contents(__DIR__ . '/_files/formats_one.xml'), + file_get_contents(__DIR__ . '/_files/formats_two.xml'), ))); $this->_converter = $this->getMock('Magento\Customer\Model\Address\Config\Converter', array('convert')); diff --git a/dev/tests/unit/testsuite/Magento/DB/Adapter/Pdo/MysqlTest.php b/dev/tests/unit/testsuite/Magento/DB/Adapter/Pdo/MysqlTest.php index 1fe2b83ca13..50f5131cf93 100644 --- a/dev/tests/unit/testsuite/Magento/DB/Adapter/Pdo/MysqlTest.php +++ b/dev/tests/unit/testsuite/Magento/DB/Adapter/Pdo/MysqlTest.php @@ -65,7 +65,7 @@ class MysqlTest extends \PHPUnit_Framework_TestCase $this->_adapter = $this->getMock( 'Magento\DB\Adapter\Pdo\Mysql', - array('_connect', '_beginTransaction', '_commit', '_rollBack', 'query'), + array('_connect', '_beginTransaction', '_commit', '_rollBack', 'query', '_debugWriteToFile'), array( 'dbname' => 'not_exists', 'username' => 'not_valid', diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/ContainerTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/ContainerTest.php index c1723270e96..670cb97120f 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/ContainerTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/ContainerTest.php @@ -55,11 +55,8 @@ class ContainerTest extends \PHPUnit_Framework_TestCase */ protected function _getBlockArguments() { - $helperFactory = $this->getMock('Magento\App\Helper\HelperFactory', array('get'), array(), '', false); - return array( 'urlBuilder' => $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false), - 'helperFactory' => $helperFactory ); } diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/JsTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/JsTest.php index b6e7d655da8..d75470eef4e 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/JsTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/JsTest.php @@ -54,6 +54,11 @@ class JsTest extends \PHPUnit_Framework_TestCase */ protected $_model; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_helperMock; + protected function setUp() { $this->_urlBuilder = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false); @@ -71,18 +76,18 @@ class JsTest extends \PHPUnit_Framework_TestCase $this->_themeContext->expects($this->any())->method('getStagingTheme') ->will($this->returnValue($this->_theme)); + $this->_helperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); + $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $constructArguments = $objectManagerHelper->getConstructArguments( + + $this->_model = $objectManagerHelper->getObject( 'Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Code\Js', array( 'urlBuilder' => $this->_urlBuilder, 'themeContext' => $this->_themeContext, 'formFactory' => $this->getMock('Magento\Data\FormFactory', array(), array(), '', false), - )); - $this->_model = $this->getMock( - 'Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Code\Js', - array('helper'), - $constructArguments + 'coreHelper' => $this->_helperMock + ) ); } @@ -142,10 +147,15 @@ class JsTest extends \PHPUnit_Framework_TestCase ->method('getFilesByType') ->with(\Magento\View\Design\Theme\Customization\File\Js::TYPE) ->will($this->returnValue(array())); - $helperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $this->_model->expects($this->once())->method('helper')->with('Magento\Core\Helper\Data') - ->will($this->returnValue($helperMock)); - $this->_model->getFiles(); + $customization->expects($this->once()) + ->method('generateFileInfo') + ->with(array()) + ->will($this->returnValue(array('js' => 'files'))); + + $this->_helperMock->expects($this->once()) + ->method('jsonEncode')->with(array('js' => 'files'))->will($this->returnValue('someData')); + + $this->assertEquals('someData', $this->_model->getFiles()); } } diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/ContentTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/ContentTest.php index 4c18956dd86..5f42436349e 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/ContentTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/ContentTest.php @@ -59,17 +59,15 @@ class ContentTest extends \PHPUnit_Framework_TestCase 'Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Files\Content', array( 'urlBuilder' => $this->_urlBuilder, - 'request' => $this->_request + 'request' => $this->_request, + 'storageHelper' => $this->_helperStorage, ) ); - $this->_filesContent = $this->getMock( - 'Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Files\Content', array('helper'), $constructArguments - ); - $this->_filesContent->expects($this->any()) - ->method('helper') - ->with('Magento\Theme\Helper\Storage') - ->will($this->returnValue($this->_helperStorage)); + $this->_filesContent = $objectManagerHelper->getObject( + 'Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Files\Content', + $constructArguments + ); } /** diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/TreeTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/TreeTest.php index d980d7d9ebf..0384290840a 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/TreeTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Files/TreeTest.php @@ -50,18 +50,11 @@ class TreeTest extends \PHPUnit_Framework_TestCase $this->_urlBuilder = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $constructArguments = $objectManagerHelper->getConstructArguments( - 'Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Files\Content', - array('urlBuilder' => $this->_urlBuilder) - ); - $this->_filesTree = $this->getMock( - 'Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Files\Tree', array('helper'), $constructArguments - ); - $this->_filesTree->expects($this->any()) - ->method('helper') - ->with('Magento\Theme\Helper\Storage') - ->will($this->returnValue($this->_helperStorage)); + $this->_filesTree = $objectManagerHelper->getObject( + 'Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Files\Tree', + array('urlBuilder' => $this->_urlBuilder, 'storageHelper' => $this->_helperStorage) + ); } public function testGetTreeLoaderUrl() diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/Config/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/Config/ConverterTest.php index 38ec630edf1..ee52c8e615c 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/Config/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/Config/ConverterTest.php @@ -40,8 +40,7 @@ class ConverterTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_model = new \Magento\Eav\Model\Entity\Attribute\Config\Converter(); - $this->_filePath = realpath(__DIR__) - . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; + $this->_filePath = realpath(__DIR__) . '/_files/'; } public function testConvert() 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 2bdad813ea6..8155bc909ea 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 @@ -63,13 +63,23 @@ class EditTest extends \PHPUnit_Framework_TestCase 'scope_id' => 'scope_id_1', 'path' => 'section1/group1/group2/field1', ), - array( + array( 'scope' => 'scope_11', 'scope_id' => 'scope_id_1', 'path' => 'section1/group1/group2/group3/field1', ), ); + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $directoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $filesystemMock; + protected function setUp() { $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); @@ -87,6 +97,15 @@ class EditTest extends \PHPUnit_Framework_TestCase 'Magento\Email\Model\Template\Config', array(), array(), '', false ); + $this->filesystemMock = $this->getMock('\Magento\Filesystem', + array('getFilesystem', '__wakeup', 'getPath', 'getDirectoryRead'), array(), '', false); + + $viewFilesystem = $this->getMock('\Magento\View\Filesystem', + array('getFilename'), array(), '', false + ); + $viewFilesystem->expects($this->any())->method('getFilename') + ->will($this->returnValue('var/www/magento\rootdir/app\custom/filename.phtml')); + $params = array( 'urlBuilder' => $urlBuilder, 'registry' => $this->_registryMock, @@ -94,6 +113,8 @@ class EditTest extends \PHPUnit_Framework_TestCase 'menuConfig' => $menuConfigMock, 'configStructure' => $this->_configStructureMock, 'emailConfig' => $this->_emailConfigMock, + 'filesystem' => $this->filesystemMock, + 'viewFileSystem' => $viewFilesystem, ); $arguments = $objectManager->getConstructArguments( 'Magento\Email\Block\Adminhtml\Template\Edit', @@ -187,6 +208,20 @@ 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/') + ); + + $this->directoryMock = $this->getMock('\Magento\Filesystem\Directory\Read', array(), array(), '', false); + $this->directoryMock->expects($this->any())->method('isFile')->will($this->returnValue(false)); + $this->directoryMock->expects($this->any())->method('getRelativePath')->will($this->returnValue('')); + + $this->filesystemMock->expects($this->any())->method('getDirectoryRead') + ->will($this->returnValue($this->directoryMock)); + $this->filesystemMock->expects($this->any())->method('getPath')->will($this->returnValueMap($dirValueMap)); + $this->_emailConfigMock ->expects($this->once()) ->method('getAvailableTemplates') @@ -203,6 +238,7 @@ class EditTest extends \PHPUnit_Framework_TestCase ->will($this->onConsecutiveCalls('Template B2', 'Template A', 'Template B1')) ; $this->assertEmpty($this->_block->getData('template_options')); + $this->_block->setTemplate('my/custom\template.phtml'); $this->_block->toHtml(); $expectedResult = array ( '' => array( diff --git a/dev/tests/unit/testsuite/Magento/Email/Model/Template/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Email/Model/Template/Config/ReaderTest.php index 035b1eba457..b1d03c7331b 100644 --- a/dev/tests/unit/testsuite/Magento/Email/Model/Template/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Email/Model/Template/Config/ReaderTest.php @@ -40,18 +40,32 @@ class ReaderTest extends \PHPUnit_Framework_TestCase */ protected $_moduleDirResolver; + /** + * @var \Magento\Filesystem\Directory\Read|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_filesystemDirectoryMock; + + /** + * Paths to fixtures + * + * @var array + */ + protected $_paths; + protected function setUp() { - $fileResolver = $this->getMock('Magento\Config\FileResolverInterface'); - $fileResolver - ->expects($this->once()) - ->method('get') - ->with('email_templates.xml', 'scope') - ->will($this->returnValue(array( - __DIR__ . '/_files/Fixture/ModuleOne/etc/email_templates_one.xml', - __DIR__ . '/_files/Fixture/ModuleTwo/etc/email_templates_two.xml', - ))) - ; + $fileResolver = $this->getMock( + 'Magento\Email\Model\Template\Config\FileResolver', + array(), + array(), + '', + false + ); + $this->_paths = array( + __DIR__ . '/_files/Fixture/ModuleOne/etc/email_templates_one.xml', + __DIR__ . '/_files/Fixture/ModuleTwo/etc/email_templates_two.xml', + ); + $this->_converter = $this->getMock('Magento\Email\Model\Template\Config\Converter', array('convert')); @@ -71,18 +85,46 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->_moduleDirResolver = $this->getMock( 'Magento\Module\Dir\ReverseResolver', array(), array(), '', false ); + $this->_filesystemDirectoryMock = $this->getMock( + '\Magento\Filesystem\Directory\Read', + array(), + array(), + '', + false + ); + + $this->_filesystemDirectoryMock->expects($this->any()) + ->method('getAbsolutePath') + ->will($this->returnArgument(0)); + + $fileIterator = new \Magento\Email\Model\Template\Config\FileIterator( + $this->_filesystemDirectoryMock, + $this->_paths, + $this->_moduleDirResolver + ); + $fileResolver->expects($this->once()) + ->method('get') + ->with('email_templates.xml', 'scope') + ->will($this->returnValue($fileIterator) + ); $this->_model = new \Magento\Email\Model\Template\Config\Reader( $fileResolver, $this->_converter, $schemaLocator, - $validationState, - $this->_moduleDirResolver + $validationState ); } public function testRead() { + + $this->_filesystemDirectoryMock->expects($this->at(0)) + ->method('readFile') + ->will($this->returnValue(file_get_contents($this->_paths[0]))); + $this->_filesystemDirectoryMock->expects($this->at(2)) + ->method('readFile') + ->will($this->returnValue(file_get_contents($this->_paths[1]))); $this->_moduleDirResolver ->expects($this->at(0)) ->method('getModuleName') @@ -95,10 +137,10 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ->with(__DIR__ . '/_files/Fixture/ModuleTwo/etc/email_templates_two.xml') ->will($this->returnValue('Fixture_ModuleTwo')) ; - $constraint = function (\DOMDOcument $actual) { + $constraint = function (\DOMDocument $actual) { try { - $expected = __DIR__ . '/_files/email_templates_merged.xml'; - \PHPUnit_Framework_Assert::assertXmlStringEqualsXmlFile($expected, $actual->saveXML()); + $expected = file_get_contents(__DIR__ . '/_files/email_templates_merged.xml'); + \PHPUnit_Framework_Assert::assertXmlStringEqualsXmlString($expected, $actual->saveXML()); return true; } catch (\PHPUnit_Framework_AssertionFailedError $e) { return false; @@ -111,6 +153,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ->with($this->callback($constraint)) ->will($this->returnValue($expectedResult)) ; + $this->assertSame($expectedResult, $this->_model->read('scope')); } diff --git a/dev/tests/unit/testsuite/Magento/Email/Model/Template/Config/XsdTest.php b/dev/tests/unit/testsuite/Magento/Email/Model/Template/Config/XsdTest.php index 63c8345ef12..74afbc8b3ab 100644 --- a/dev/tests/unit/testsuite/Magento/Email/Model/Template/Config/XsdTest.php +++ b/dev/tests/unit/testsuite/Magento/Email/Model/Template/Config/XsdTest.php @@ -27,78 +27,6 @@ namespace Magento\Email\Model\Template\Config; class XsdTest extends \PHPUnit_Framework_TestCase { - /** - * Test validation rules implemented by XSD schema for individual config files - * - * @param string $fixtureXml - * @param array $expectedErrors - * @dataProvider individualXmlDataProvider - */ - public function testIndividualXml($fixtureXml, array $expectedErrors) - { - $schemaFile = BP . '/app/code/Magento/Email/etc/email_templates_file.xsd'; - $this->_testXmlAgainstXsd($fixtureXml, $schemaFile, $expectedErrors); - } - - public function individualXmlDataProvider() - { - return array( - 'valid' => array( - '<config><template id="test" label="Test" file="test.html" type="html"/></config>', - array() - ), - 'empty root node' => array( - '<config/>', - array("Element 'config': Missing child element(s). Expected is ( template ).") - ), - 'irrelevant root node' => array( - '<template id="test" label="Test" file="test.html" type="html"/>', - array("Element 'template': No matching global declaration available for the validation root.") - ), - 'invalid node' => array( - '<config><invalid/></config>', - array("Element 'invalid': This element is not expected. Expected is ( template ).") - ), - 'node "template" with value' => array( - '<config><template id="test" label="Test" file="test.html" type="html">invalid</template></config>', - array("Element 'template': Character content is not allowed, because the content type is empty.") - ), - 'node "template" with children' => array( - '<config><template id="test" label="Test" file="test.html" type="html"><invalid/></template></config>', - array("Element 'template': Element content is not allowed, because the content type is empty.") - ), - 'node "template" without attribute "id"' => array( - '<config><template label="Test" file="test.html" type="html"/></config>', - array("Element 'template': The attribute 'id' is required but missing.") - ), - 'node "template" without attribute "label"' => array( - '<config><template id="test" file="test.html" type="html"/></config>', - array("Element 'template': The attribute 'label' is required but missing.") - ), - 'node "template" without attribute "file"' => array( - '<config><template id="test" label="Test" type="html"/></config>', - array("Element 'template': The attribute 'file' is required but missing.") - ), - 'node "template" without attribute "type"' => array( - '<config><template id="test" label="Test" file="test.html"/></config>', - array("Element 'template': The attribute 'type' is required but missing.") - ), - 'node "template" with invalid attribute "type"' => array( - '<config><template id="test" label="Test" file="test.html" type="invalid"/></config>', - array( - "Element 'template', attribute 'type': " - . "[facet 'enumeration'] The value 'invalid' is not an element of the set {'html', 'text'}.", - "Element 'template', attribute 'type': " - . "'invalid' is not a valid value of the atomic type 'emailTemplateFormatType'.", - ) - ), - 'node "template" with unknown attribute "module"' => array( - '<config><template id="test" label="Test" file="test.html" type="html" module="Test_Module"/></config>', - array("Element 'template', attribute 'module': The attribute 'module' is not allowed.") - ), - ); - } - /** * Test validation rules implemented by XSD schema for merged configs * diff --git a/dev/tests/unit/testsuite/Magento/Event/Config/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Event/Config/ConverterTest.php index d29717e7738..530c6b94927 100644 --- a/dev/tests/unit/testsuite/Magento/Event/Config/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Event/Config/ConverterTest.php @@ -42,7 +42,7 @@ class ConverterTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filePath = __DIR__ . DIRECTORY_SEPARATOR . '/_files' . DIRECTORY_SEPARATOR; + $this->_filePath = __DIR__ . '/_files/'; $this->_source = new \DOMDocument(); $this->_model = new \Magento\Event\Config\Converter(); } diff --git a/dev/tests/unit/testsuite/Magento/Event/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Event/Config/SchemaLocatorTest.php index 426c5308ca5..1cb12cd734f 100644 --- a/dev/tests/unit/testsuite/Magento/Event/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Event/Config/SchemaLocatorTest.php @@ -42,16 +42,16 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase public function testGetSchema() { - $expected = BP . str_replace('\\', DIRECTORY_SEPARATOR, '\lib\Magento\Event\etc\events.xsd'); - $actual = $this->_model->getSchema(); + $expected = str_replace('\\', '/', BP . '/lib/Magento/Event/etc/events.xsd'); + $actual = str_replace('\\', '/', $this->_model->getSchema()); $this->assertEquals($expected, $actual); } public function testGetPerFileSchema() { - $actual = $this->_model->getPerFileSchema(); - $expected = BP . str_replace('\\', DIRECTORY_SEPARATOR, '\lib\Magento\Event\etc\events.xsd'); + $actual = str_replace('\\', '/', $this->_model->getPerFileSchema()); + $expected = str_replace('\\', '/', BP . '/lib/Magento/Event/etc/events.xsd'); $this->assertEquals($expected, $actual); } } diff --git a/dev/tests/unit/testsuite/Magento/Filesystem/Directory/ReadTest.php b/dev/tests/unit/testsuite/Magento/Filesystem/Directory/ReadTest.php new file mode 100644 index 00000000000..b87ab89b179 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Filesystem/Directory/ReadTest.php @@ -0,0 +1,103 @@ +<?php +/** + * Unit Test for \Magento\Filesystem\Directory\Read + * + * 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) 2013 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\Directory; + +class ReadTest extends \PHPUnit_Framework_TestCase +{ + + /** + * \Magento\Filesystem\Driver + * + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $driver; + + /** + * @var \Magento\Filesystem\Directory\Read + */ + protected $read; + + /** + * \Magento\Filesystem\File\ReadFactory + * + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $fileFactory; + + /** + * Set up + */ + protected function setUp() + { + $this->driver = $this->getMock('Magento\Filesystem\Driver\File', array(), array(), '', false); + $this->fileFactory = $this->getMock('Magento\Filesystem\File\ReadFactory', array(), array(), '', false); + $this->read = new \Magento\Filesystem\Directory\Read(array(), $this->fileFactory, $this->driver); + } + + + /** + * Tear down + */ + protected function tearDown() + { + $this->driver = null; + $this->fileFactory = null; + $this->read = null; + } + + public function testIsExist() + { + $this->driver->expects($this->once()) + ->method('isExists') + ->will($this->returnValue(true)); + $this->assertTrue($this->read->isExist('correct-path')); + } + + public function testStat() + { + $this->driver->expects($this->once()) + ->method('isExists') + ->will($this->returnValue(true)); + $this->driver->expects($this->once()) + ->method('stat') + ->will($this->returnValue(array('some-stat-data'))); + $this->assertEquals(array('some-stat-data'), $this->read->stat('correct-path')); + } + + /** + * @expectedException \Magento\Filesystem\FilesystemException + */ + public function testAssertExist() + { + $this->driver->expects($this->once()) + ->method('isExists') + ->will($this->returnValue(false)); + $this->read->stat('wrong-path'); + } + + + +} diff --git a/dev/tests/unit/testsuite/Magento/Filesystem/Directory/WriteTest.php b/dev/tests/unit/testsuite/Magento/Filesystem/Directory/WriteTest.php new file mode 100644 index 00000000000..4cd707a9a02 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Filesystem/Directory/WriteTest.php @@ -0,0 +1,90 @@ +<?php +/** + * Unit Test for \Magento\Filesystem\Directory\Write + * + * 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) 2013 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\Directory; + +class WriteTest extends \PHPUnit_Framework_TestCase +{ + /** + * \Magento\Filesystem\Driver + * + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $driver; + + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected $write; + + /** + * \Magento\Filesystem\File\ReadFactory + * + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $fileFactory; + + /** + * Set up + */ + protected function setUp() + { + $this->driver = $this->getMock('Magento\Filesystem\Driver\File', array(), array(), '', false); + $this->fileFactory = $this->getMock('Magento\Filesystem\File\WriteFactory', array(), array(), '', false); + $this->write = new \Magento\Filesystem\Directory\Write( + array(), $this->fileFactory, $this->driver, 'cool-permissions'); + } + + + /** + * Tear down + */ + protected function tearDown() + { + $this->driver = null; + $this->fileFactory = null; + $this->write = null; + } + + public function testCreate() + { + $this->driver->expects($this->once()) + ->method('isDirectory') + ->will($this->returnValue(false)); + $this->driver->expects($this->once()) + ->method('createDirectory') + ->will($this->returnValue(true)); + + $this->assertTrue($this->write->create('correct-path')); + } + + public function testIsWritable() + { + $this->driver->expects($this->once()) + ->method('isWritable') + ->will($this->returnValue(true)); + $this->assertTrue($this->write->isWritable('correct-path')); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Filesystem/DirectoryList/VerificationTest.php b/dev/tests/unit/testsuite/Magento/Filesystem/DirectoryList/VerificationTest.php new file mode 100644 index 00000000000..b7ae0bf1c58 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Filesystem/DirectoryList/VerificationTest.php @@ -0,0 +1,249 @@ +<?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) 2013 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; + +use Magento\App\State; + +class VerificationTest extends \PHPUnit_Framework_TestCase +{ + /** + * Test for createAndVerifyDirectories method + * + * @param string $mode + * @param array $expectedDirs + * @dataProvider createAndVerifyDirectoriesDataProvider + */ + public function testCreateAndVerifyDirectories($mode, $expectedDirs) + { + $verification = $this->getVerificationInstance($expectedDirs, $mode); + $verification->createAndVerifyDirectories(); + } + + /** + * Data provider for testCreateAndVerifyDirectories + * + * @return array + */ + public static function createAndVerifyDirectoriesDataProvider() + { + return array( + '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') + ), + ), + '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') + ), + ), + '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') + ), + ), + ); + } + + /** + * Test for createAndVerifyDirectories method if some directories are not writable + * + * @param string $mode + * @param array $expectedDirs + * @dataProvider notWritableDataProvider + * @expectedException \Magento\BootstrapException + */ + public function testNotWritable($mode, $expectedDirs) + { + $verification = $this->getVerificationInstance($expectedDirs, $mode); + $verification->createAndVerifyDirectories(); + } + + /** + * Data provider for testNotWritable + * + * @return array + */ + public static function notWritableDataProvider() + { + return array( + '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') + ), + ) + ); + } + + /** + * Test for createAndVerifyDirectories method if some directories cannot be created + * + * @param string $mode + * @param array $expectedDirs + * @dataProvider createExceptionDataProvider + * @expectedException \Magento\BootstrapException + */ + public function testCreateException($mode, $expectedDirs) + { + $verification = $this->getVerificationInstance($expectedDirs, $mode); + $verification->createAndVerifyDirectories(); + } + + /** + * Data provider for testCreateException + * + * @return array + */ + public static function createExceptionDataProvider() + { + return array( + '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) + ), + ) + ); + } + + /** + * Get verification instance + * + * @param array $expectedDirs + * @param string $mode + * @return Verification + */ + protected function getVerificationInstance(array $expectedDirs, $mode) + { + $filesystem = $this->getFilesystemMock($expectedDirs); + $appState = $this->getMock('Magento\App\State', array('getMode'), array(), '', false); + $appState->expects($this->once()) + ->method('getMode') + ->will($this->returnValue($mode)); + return new Verification($filesystem, $appState); + } + + /** + * Get filesystem mock + * + * @param array $dirsToVerify + * @return \Magento\Filesystem | \PHPUnit_Framework_MockObject_MockObject + */ + protected function getFilesystemMock(array $dirsToVerify) + { + $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryWrite', '__wakeup'), array(), '', false); + $valueMap = array(); + foreach ($dirsToVerify as $code => $config) { + $createException = isset($config[3]) ? $config[3] : false; + $directory = $this->getDirectoryMock($config[0], $config[1], $config[2], $createException); + $valueMap[] = array($code, $directory); + } + $filesystem->expects($this->exactly(count($dirsToVerify))) + ->method('getDirectoryWrite') + ->will($this->returnValueMap($valueMap)); + + return $filesystem; + } + + /** + * Get directory mock + * + * @param bool $existing + * @param bool $writable + * @param string $absolutePath + * @param bool $createException + * @return \Magento\Filesystem\Directory\Write | \PHPUnit_Framework_MockObject_MockObject + */ + protected function getDirectoryMock($existing, $writable, $absolutePath, $createException) + { + $directory = $this->getMock( + 'Magento\Filesystem\Directory\Write', + array('isExist', 'isWritable', 'getAbsolutePath', 'create'), + array(), + '', + false + ); + $directory->expects($this->once()) + ->method('isExist') + ->will($this->returnValue($existing)); + + if (!$existing) { + if (!$createException) { + $directory->expects($this->once()) + ->method('create'); + } else { + $directory->expects($this->once()) + ->method('create') + ->will($this->throwException(new \Magento\Filesystem\FilesystemException(''))); + } + return $directory; + } + + $directory->expects($this->once()) + ->method('isWritable') + ->will($this->returnValue($writable)); + + if (!$writable) { + $directory->expects($this->once()) + ->method('getAbsolutePath') + ->will($this->returnValue($absolutePath)); + } + + return $directory; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Filesystem/DirectoryListTest.php b/dev/tests/unit/testsuite/Magento/Filesystem/DirectoryListTest.php new file mode 100644 index 00000000000..8fa1ea29aca --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Filesystem/DirectoryListTest.php @@ -0,0 +1,164 @@ +<?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) 2013 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; + +use Magento\Filesystem; + +class DirectoryListTest extends \PHPUnit_Framework_TestCase +{ + /** + * Test for add directory and getConfig methods + * + * @dataProvider providerConfig + * @param string $root + * @param array $directories + * @param array $configs + * @param array $expectedConfig + */ + public function testAddDirectoryGetConfig($root, array $directories, array $configs, array $expectedConfig) + { + $directoryList = new DirectoryList($root, $directories); + foreach ($configs as $code => $config) { + $directoryList->addDirectory($code, $config); + $this->assertEquals($expectedConfig[$code], $directoryList->getConfig($code)); + } + } + + /** + * Data provider for testAddDirectoryGetConfig + */ + public function providerConfig() + { + return array( + 'pub_lib' => array( + __DIR__, + array( + Filesystem::PUB_LIB => array('path' => 'pub/lib_basic') + ), + array( + Filesystem::PUB_LIB => array( + 'path' => 'pub/lib', + 'uri' => 'pub/lib', + 'permissions' => 0777, + 'read_only' => true, + 'allow_create_dirs' => true + ) + ), + array( + Filesystem::PUB_LIB => array( + 'path' => str_replace('\\', '/', __DIR__ . '/pub/lib'), + 'uri' => 'pub/lib', + 'permissions' => 0777, + 'read_only' => true, + 'allow_create_dirs' => true + ) + ), + ) + ); + } + + + /** + * Test for creating DirectoryList with invalid URI + * + * @param string $code + * @param string $value + * @expectedException \InvalidArgumentException + * @dataProvider invalidUriDataProvider + */ + public function testInvalidUri($code, $value) + { + new DirectoryList(__DIR__, array($code => array('uri' => $value))); + } + + /** + * Data provider for testInvalidUri + * + * @return array + */ + 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'), + ); + } + + /** + * Test for getting uri from DirectoryList + */ + public function testGetUri() + { + $dir = new DirectoryList(__DIR__, array( + Filesystem::PUB => array('uri' => ''), + Filesystem::MEDIA => 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']); + } + + /** + * Test for getting directory path from DirectoryList + */ + public function testGetDir() + { + $newRoot = __DIR__ . '/root'; + $newMedia = __DIR__ . '/media'; + $dir = new DirectoryList(__DIR__, array( + Filesystem::ROOT => array('path' => $newRoot), + Filesystem::MEDIA => 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']); + } + } +} diff --git a/dev/tests/unit/testsuite/Magento/Filesystem/Stream/Mode/ZlibTest.php b/dev/tests/unit/testsuite/Magento/Filesystem/Stream/Mode/ZlibTest.php deleted file mode 100644 index 4198e0a4956..00000000000 --- a/dev/tests/unit/testsuite/Magento/Filesystem/Stream/Mode/ZlibTest.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * Unit Test for \Magento\Filesystem\Stream\Mode\Zlib - * - * 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) 2013 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\Stream\Mode; - -class ZlibTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider modesDataProvider - * @param string $mode - * @param string $expectedMode - * @param int $ratio - * @param string $strategy - */ - public function testConstructor($mode, $expectedMode, $ratio, $strategy) - { - $object = new \Magento\Filesystem\Stream\Mode\Zlib($mode); - $this->assertEquals($expectedMode, $object->getMode()); - $this->assertEquals($ratio, $object->getRatio()); - $this->assertEquals($strategy, $object->getStrategy()); - } - - /** - * @return array - */ - public function modesDataProvider() - { - return array( - 'w' => array('w', 'w', 1, ''), - 'w+' => array('w+', 'w+', 1, ''), - 'r9' => array('r9', 'r', 9, ''), - 'a+8' => array('a+8', 'a+', 8, ''), - 'wb+7' => array('wb+7', 'wb+', 7, ''), - 'r9f' => array('r9f', 'r', 9, 'f'), - 'a+8h' => array('a+8h', 'a+', 8, 'h'), - 'wb+7f' => array('wb+7f', 'wb+', 7, 'f'), - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Filesystem/Stream/ModeTest.php b/dev/tests/unit/testsuite/Magento/Filesystem/Stream/ModeTest.php deleted file mode 100644 index b764a9062a0..00000000000 --- a/dev/tests/unit/testsuite/Magento/Filesystem/Stream/ModeTest.php +++ /dev/null @@ -1,275 +0,0 @@ -<?php -/** - * Unit Test for \Magento\Filesystem\Stream\Mode - * - * 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) 2013 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\Stream; - -class ModeTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider modesDataProvider - * @param string $mode - * @param string $base - * @param bool $hasPlus - * @param string $flag - */ - public function testConstructor($mode, $base, $hasPlus, $flag) - { - $streamMode = new \Magento\Filesystem\Stream\Mode($mode); - $this->assertAttributeEquals($base, '_base', $streamMode); - $this->assertAttributeEquals($hasPlus, '_plus', $streamMode); - $this->assertAttributeEquals($flag, '_flag', $streamMode); - $this->assertEquals($mode, $streamMode->getMode()); - } - - /** - * @return array - */ - public function modesDataProvider() - { - return array( - array('r', 'r', false, null), - array('rb', 'r', false, 'b'), - array('r+', 'r', true, null), - array('r+b', 'r', true, 'b'), - array('w', 'w', false, null), - array('wb', 'w', false, 'b'), - array('w+', 'w', true, null), - array('w+b', 'w', true, 'b'), - array('a', 'a', false, null), - array('ab', 'a', false, 'b'), - array('a+', 'a', true, null), - array('a+b', 'a', true, 'b'), - array('x', 'x', false, null), - array('xb', 'x', false, 'b'), - array('x+', 'x', true, null), - array('x+b', 'x', true, 'b'), - array('c', 'c', false, null), - array('cb', 'c', false, 'b'), - array('c+', 'c', true, null), - array('c+b', 'c', true, 'b'), - ); - } - - /** - * @dataProvider rModesDataProvider - * @param string $mode - */ - public function testAllowRead($mode) - { - $streamMode = new \Magento\Filesystem\Stream\Mode($mode); - $this->assertTrue($streamMode->isReadAllowed()); - } - - /** - * @return array - */ - public function rModesDataProvider() - { - return array(array('r'), array('rb')) + $this->plusModesDataProvider(); - } - - /** - * @dataProvider wModesDataProvider - * @param string $mode - */ - public function testAllowsWrite($mode) - { - $streamMode = new \Magento\Filesystem\Stream\Mode($mode); - $this->assertTrue($streamMode->isWriteAllowed()); - } - - /** - * @return array - */ - public function wModesDataProvider() - { - return array( - array('w'), array('wb'), - array('a'), array('ab'), - array('x'), array('xb'), - array('c'), array('cb'), - ) + $this->plusModesDataProvider(); - } - - /** - * @dataProvider nonXModesDataProvider - * @param string $mode - */ - public function testAllowsExistingFileOpening($mode) - { - $streamMode = new \Magento\Filesystem\Stream\Mode($mode); - $this->assertTrue($streamMode->isExistingFileOpenAllowed()); - } - - /** - * @return array - */ - public function nonXModesDataProvider() - { - return array( - array('r'), array('rb'), - array('w'), array('wb'), - array('a'), array('ab'), - array('c'), array('cb'), - array('r+'), array('r+b'), - array('w+'), array('w+b'), - array('a+'), array('a+b'), - array('c+'), array('c+b'), - ); - } - - /** - * @dataProvider nonRModesDataProvider - * @param string $mode - */ - public function testAllowsNewFileOpening($mode) - { - $streamMode = new \Magento\Filesystem\Stream\Mode($mode); - $this->assertTrue($streamMode->isNewFileOpenAllowed()); - } - - /** - * @return array - */ - public function nonRModesDataProvider() - { - return array( - array('x'), array('xb'), - array('w'), array('wb'), - array('a'), array('ab'), - array('c'), array('cb'), - array('w+'), array('w+b'), - array('a+'), array('a+b'), - array('c+'), array('c+b'), - ); - } - - /** - * @dataProvider onlyWModesDataProvider - * @param string $mode - */ - public function testImpliesExistingContentDeletion($mode) - { - $streamMode = new \Magento\Filesystem\Stream\Mode($mode); - $this->assertTrue($streamMode->isExistingContentDeletionImplied()); - } - - /** - * @return array - */ - public function onlyWModesDataProvider() - { - return array( - array('w'), array('wb'), - array('w+'), array('w+b'), - ); - } - - /** - * @dataProvider nonAModesDataProvider - * @param string $mode - */ - public function testImpliesPositioningCursorAtTheBeginning($mode) - { - $streamMode = new \Magento\Filesystem\Stream\Mode($mode); - $this->assertTrue($streamMode->isPositioningCursorAtTheBeginningImplied()); - } - - /** - * @return array - */ - public function nonAModesDataProvider() - { - return array( - array('r'), array('rb'), - array('x'), array('xb'), - array('w'), array('wb'), - array('c'), array('cb'), - array('w+'), array('w+b'), - array('r+'), array('r+b'), - array('c+'), array('c+b'), - ); - } - - /** - * @dataProvider onlyAModesDataProvider - * @param string $mode - */ - public function testImpliesPositioningCursorAtTheEnd($mode) - { - $streamMode = new \Magento\Filesystem\Stream\Mode($mode); - $this->assertTrue($streamMode->isPositioningCursorAtTheEndImplied()); - } - - /** - * @return array - */ - public function onlyAModesDataProvider() - { - return array( - array('a'), array('ab'), - array('a+'), array('a+b'), - ); - } - - /** - * @dataProvider onlyBModesDataProvider - * @param string $mode - */ - public function testIsBinary($mode) - { - $streamMode = new \Magento\Filesystem\Stream\Mode($mode); - $this->assertTrue($streamMode->isBinary()); - } - - /** - * @return array - */ - public function onlyBModesDataProvider() - { - return array( - array('rb'), array('r+b'), - array('ab'), array('a+b'), - array('wb'), array('w+b'), - array('xb'), array('x+b'), - array('cb'), array('c+b'), - ); - } - - - /** - * @return array - */ - public function plusModesDataProvider() - { - return array( - array('r+'), array('r+b'), - array('w+'), array('w+b'), - array('a+'), array('a+b'), - array('x+'), array('x+b'), - array('c+'), array('c+b'), - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/FilesystemTest.php b/dev/tests/unit/testsuite/Magento/FilesystemTest.php deleted file mode 100644 index 5814e4b4ddf..00000000000 --- a/dev/tests/unit/testsuite/Magento/FilesystemTest.php +++ /dev/null @@ -1,1027 +0,0 @@ -<?php -/** - * Unit Test for \Magento\Filesystem - * - * 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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - */ -namespace Magento; - -/** - * @SuppressWarnings(PHPMD.TooManyMethods) - * @SuppressWarnings(PHPMD.ExcessivePublicCount) - */ -class FilesystemTest extends \PHPUnit_Framework_TestCase -{ - public function testSetWorkingDirectory() - { - $filesystem = new \Magento\Filesystem($this->_getDefaultAdapterMock()); - $filesystem->setWorkingDirectory('/tmp'); - $this->assertEquals('/tmp', $filesystem->getWorkingDirectory()); - } - - /** - * @expectedException \InvalidArgumentException - * @exceptedExceptionMessage Working directory "/tmp" does not exists - */ - public function testSetWorkingDirectoryException() - { - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->once()) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(false)); - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - } - - /** - * @dataProvider allowCreateDirectoriesDataProvider - * @param bool $allow - * @param int $mode - */ - public function testSetIsAllowCreateDirectories($allow, $mode) - { - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $filesystem = new \Magento\Filesystem($adapterMock); - $this->assertSame($filesystem, $filesystem->setIsAllowCreateDirectories($allow, $mode)); - $this->assertAttributeEquals($allow, '_isAllowCreateDirs', $filesystem); - if (!$mode) { - $mode = 0777; - } - $this->assertAttributeEquals($mode, '_newDirPermissions', $filesystem); - } - - /** - * @return array - */ - public function allowCreateDirectoriesDataProvider() - { - return array( - array(true, 0644), - array(false, null) - ); - } - - /** - * @dataProvider twoFilesOperationsValidDataProvider - * - * @param string $method - * @param string $checkMethod - * @param string $source - * @param string $target - * @param string|null $workingDirectory - * @param string|null $targetDir - */ - public function testTwoFilesOperation($method, $checkMethod, $source, $target, $workingDirectory = null, - $targetDir = null - ) { - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->exactly(2)) - ->method('isDirectory') - ->will($this->returnValue(true)); - $adapterMock->expects($this->once()) - ->method($checkMethod) - ->will($this->returnValue(true)); - $adapterMock->expects($this->once()) - ->method($method) - ->with($source, $target); - - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $filesystem->$method($source, $target, $workingDirectory, $targetDir); - } - - /** - * @return array - */ - public function twoFilesOperationsValidDataProvider() - { - return array( - 'copy both tmp' => array('copy', 'isFile', '/tmp/path/file001.log', '/tmp/path/file001.bak'), - 'move both tmp' => array('rename', 'exists', '/tmp/path/file001.log', '/tmp/path/file001.bak'), - 'copy both tmp #2' => array('copy', 'isFile', '/tmp/path/file001.log', '/tmp/path/file001.bak', '/tmp'), - 'move both tmp #2' => array('rename', 'exists', '/tmp/path/file001.log', '/tmp/path/file001.bak', '/tmp'), - 'copy different' - => array('copy', 'isFile', '/tmp/path/file001.log', '/storage/file001.bak', null, '/storage'), - 'move different' - => array('rename', 'exists', '/tmp/path/file001.log', '/storage/file001.bak', null, '/storage'), - 'copy different #2' - => array('copy', 'isFile', '/tmp/path/file001.log', '/storage/file001.bak', '/tmp', '/storage'), - 'move different #2' - => array('rename', 'exists', '/tmp/path/file001.log', '/storage/file001.bak', '/tmp', '/storage'), - ); - } - - /** - * @dataProvider twoFilesOperationsInvalidDataProvider - * @param string $method - * @param string $source - * @param string $destination - * @param string $exceptionMessage - * @param string|null $workingDirectory - * @param string|null $targetDir - */ - public function testTwoFilesOperationsIsolationException( - $method, $source, $destination, $exceptionMessage, $workingDirectory = null, $targetDir = null - ) { - $adapterMock = $this->_getDefaultAdapterMock(); - $adapterMock->expects($this->never()) - ->method($method); - - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - - - $this->setExpectedException('InvalidArgumentException', $exceptionMessage); - $filesystem->$method($source, $destination, $workingDirectory, $targetDir); - } - - /** - * @return array - */ - public function twoFilesOperationsInvalidDataProvider() - { - return array( - 'copy first path invalid' => array( - 'copy', - '/tmp/../etc/passwd', - '/tmp/path001', - "Path '/tmp/../etc/passwd' is out of working directory '/tmp'", - ), - 'copy first path invalid #2' => array( - 'copy', - '/tmp/../etc/passwd', - '/tmp/path001', - "Path '/tmp/../etc/passwd' is out of working directory '/tmp'", - '/tmp' - ), - 'copy second path invalid' => array( - 'copy', - '/tmp/uploaded.txt', - '/tmp/../etc/passwd', - "Path '/tmp/../etc/passwd' is out of working directory '/tmp'", - ), - 'copy both path invalid' => array( - 'copy', - '/tmp/../etc/passwd', - '/tmp/../dev/null', - "Path '/tmp/../etc/passwd' is out of working directory '/tmp'", - ), - 'rename first path invalid' => array( - 'rename', - '/tmp/../etc/passwd', - '/tmp/path001', - "Path '/tmp/../etc/passwd' is out of working directory '/tmp'", - ), - 'rename first path invalid #2' => array( - 'rename', - '/tmp/../etc/passwd', - '/tmp/path001', - "Path '/tmp/../etc/passwd' is out of working directory '/tmp'", - '/tmp' - ), - 'rename second path invalid' => array( - 'rename', - '/tmp/uploaded.txt', - '/tmp/../etc/passwd', - "Path '/tmp/../etc/passwd' is out of working directory '/tmp'", - ), - 'rename both path invalid' => array( - 'rename', - '/tmp/../etc/passwd', - '/tmp/../dev/null', - "Path '/tmp/../etc/passwd' is out of working directory '/tmp'", - ), - 'copy target path invalid' => array( - 'copy', - '/tmp/passwd', - '/etc/../dev/null', - "Path '/etc/../dev/null' is out of working directory '/etc'", - null, - '/etc' - ), - 'rename target path invalid' => array( - 'rename', - '/tmp/passwd', - '/etc/../dev/null', - "Path '/etc/../dev/null' is out of working directory '/etc'", - null, - '/etc' - ), - 'copy target path invalid #2' => array( - 'copy', - '/tmp/passwd', - '/etc/../dev/null', - "Path '/etc/../dev/null' is out of working directory '/etc'", - '/tmp', - '/etc' - ), - 'rename target path invalid #2' => array( - 'rename', - '/tmp/passwd', - '/etc/../dev/null', - "Path '/etc/../dev/null' is out of working directory '/etc'", - '/tmp', - '/etc' - ), - ); - } - - public function testEnsureDirectoryExists() - { - $dir = '/tmp/path'; - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->at(0)) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->at(1)) - ->method('isDirectory') - ->with($dir) - ->will($this->returnValue(true)); - $adapterMock->expects($this->exactly(2)) - ->method('isDirectory'); - $adapterMock->expects($this->never()) - ->method('createDirectory'); - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $filesystem->ensureDirectoryExists($dir, 0644); - } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage Directory '/tmp/path' doesn't exist. - */ - public function testEnsureDirectoryExistsException() - { - $dir = '/tmp/path'; - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->at(0)) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->at(1)) - ->method('isDirectory') - ->with($dir) - ->will($this->returnValue(false)); - $adapterMock->expects($this->exactly(2)) - ->method('isDirectory'); - $adapterMock->expects($this->never()) - ->method('createDirectory'); - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $filesystem->ensureDirectoryExists($dir, 0644); - } - - public function testEnsureDirectoryExistsNoDir() - { - $dir = '/tmp/path1/path2'; - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->at(0)) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->at(1)) - ->method('isDirectory') - ->with($dir) - ->will($this->returnValue(false)); - $adapterMock->expects($this->at(2)) - ->method('isDirectory') - ->with('/tmp/path1') - ->will($this->returnValue(false)); - $adapterMock->expects($this->at(3)) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->exactly(4)) - ->method('isDirectory'); - $adapterMock->expects($this->at(4)) - ->method('createDirectory') - ->with('/tmp/path1'); - $adapterMock->expects($this->at(5)) - ->method('createDirectory') - ->with('/tmp/path1/path2'); - $adapterMock->expects($this->exactly(2)) - ->method('createDirectory'); - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $filesystem->setIsAllowCreateDirectories(true); - $filesystem->ensureDirectoryExists($dir, 0644); - } - - /** - * @dataProvider allowCreateDirsDataProvider - * @param bool $allowCreateDirs - */ - public function testTouch($allowCreateDirs) - { - $validPath = '/tmp/path/file.txt'; - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->exactly(2)) - ->method('isDirectory') - ->will($this->returnValue(true)); - - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setIsAllowCreateDirectories($allowCreateDirs); - $filesystem->setWorkingDirectory('/tmp'); - $filesystem->touch($validPath); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Path '/etc/passwd' is out of working directory '/tmp' - */ - public function testTouchIsolation() - { - $filesystem = new \Magento\Filesystem($this->_getDefaultAdapterMock()); - $filesystem->setWorkingDirectory('/tmp'); - $filesystem->touch('/etc/passwd'); - } - - /** - * @return array - */ - public function allowCreateDirsDataProvider() - { - return array(array(true), array(false)); - } - - public function testCreateStreamCustom() - { - $path = '/tmp/test.txt'; - $streamMock = $this->getMockBuilder('Magento\Filesystem\Stream\Local') - ->disableOriginalConstructor() - ->getMock(); - $adapterMock = $this->getMockBuilder('Magento\Filesystem\Adapter\Local') - ->getMock(); - $adapterMock->expects($this->once()) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->once()) - ->method('createStream') - ->with($path) - ->will($this->returnValue($streamMock)); - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $this->assertInstanceOf('Magento\Filesystem\Stream\Local', $filesystem->createStream($path)); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Path '/tmp/../etc/test.txt' is out of working directory '/tmp' - */ - public function testCreateStreamIsolation() - { - $adapterMock = $this->getMockBuilder('Magento\Filesystem\Adapter\Local') - ->getMock(); - $adapterMock->expects($this->once()) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $filesystem->createStream('/tmp/../etc/test.txt'); - } - - /** - * @expectedException \Magento\Filesystem\FilesystemException - * @expectedExceptionMessage Filesystem doesn't support streams. - */ - public function testCreateStreamException() - { - $filesystem = new \Magento\Filesystem($this->_getDefaultAdapterMock()); - $filesystem->setWorkingDirectory('/tmp'); - $filesystem->createStream('/tmp/test.txt'); - } - - /** - * @dataProvider modeDataProvider - * @param string|\Magento\Filesystem\Stream\Mode $mode - */ - public function testCreateAndOpenStream($mode) - { - $path = '/tmp/test.txt'; - $streamMock = $this->getMockBuilder('Magento\Filesystem\Stream\Local') - ->disableOriginalConstructor() - ->getMock(); - $streamMock->expects($this->once()) - ->method('open'); - $adapterMock = $this->getMockBuilder('Magento\Filesystem\Adapter\Local') - ->getMock(); - $adapterMock->expects($this->once()) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->once()) - ->method('createStream') - ->with($path) - ->will($this->returnValue($streamMock)); - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $this->assertInstanceOf('Magento\Filesystem\Stream\Local', $filesystem->createAndOpenStream($path, $mode)); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Wrong mode parameter - */ - public function testCreateAndOpenStreamException() - { - $path = '/tmp/test.txt'; - $streamMock = $this->getMockBuilder('Magento\Filesystem\Stream\Local') - ->disableOriginalConstructor() - ->getMock(); - $streamMock->expects($this->never()) - ->method('open'); - $adapterMock = $this->getMockBuilder('Magento\Filesystem\Adapter\Local') - ->getMock(); - $adapterMock->expects($this->once()) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->once()) - ->method('createStream') - ->with($path) - ->will($this->returnValue($streamMock)); - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $this->assertInstanceOf('Magento\Filesystem\Stream\Local', - $filesystem->createAndOpenStream($path, new \stdClass())); - } - - /** - * @return array - */ - public function modeDataProvider() - { - return array( - array('r'), - array(new \Magento\Filesystem\Stream\Mode('w')) - ); - } - - /** - * @dataProvider adapterMethods - * @param string $method - * @param string $adapterMethod - * @param array|null $params - */ - public function testAdapterMethods($method, $adapterMethod, array $params = null) - { - $validPath = '/tmp/path/file.txt'; - $adapterMock = $this->_getDefaultAdapterMock(); - $adapterMock->expects($this->once()) - ->method($adapterMethod) - ->with($validPath); - - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $params = (array)$params; - array_unshift($params, $validPath); - call_user_func_array(array($filesystem, $method), $params); - } - - /** - * @return array - */ - public function adapterMethods() - { - return array( - 'exists' => array('has', 'exists'), - 'delete' => array('delete', 'delete'), - 'isFile' => array('isFile', 'isFile'), - 'isWritable' => array('isWritable', 'isWritable'), - 'isReadable' => array('isReadable', 'isReadable'), - 'getNestedKeys' => array('getNestedKeys', 'getNestedKeys'), - 'changePermissions' => array('changePermissions', 'changePermissions', array(0777, true)), - 'exists #2' => array('has', 'exists', array('/tmp')), - 'delete #2' => array('delete', 'delete', array('/tmp')), - 'isFile #2' => array('isFile', 'isFile', array('/tmp')), - 'isWritable #2' => array('isWritable', 'isWritable', array('/tmp')), - 'isReadable #2' => array('isReadable', 'isReadable', array('/tmp')), - 'getNestedKeys #2' => array('getNestedKeys', 'getNestedKeys', array('/tmp')), - 'changePermissions #2' => array('changePermissions', 'changePermissions', array(0777, true, '/tmp')), - ); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Path '/tmp/../etc/passwd' is out of working directory '/tmp' - * @dataProvider adapterIsolationMethods - * @param string $method - * @param string $adapterMethod - * @param array|null $params - */ - public function testIsolationException($method, $adapterMethod, array $params = null) - { - $invalidPath = '/tmp/../etc/passwd'; - $adapterMock = $this->_getDefaultAdapterMock(); - $adapterMock->expects($this->never()) - ->method($adapterMethod); - - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $params = (array)$params; - array_unshift($params, $invalidPath); - call_user_func_array(array($filesystem, $method), $params); - } - - /** - * @return array - */ - public function adapterIsolationMethods() - { - return $this->adapterMethods() - + array( - 'mtime' => array('getMTime', 'getMTime'), - 'read' => array('read', 'read'), - 'read #2' => array('read', 'read', array('/tmp')), - 'createDirectory' => array('createDirectory', 'createDirectory', array(0777)), - 'createDirectory #2' => array('createDirectory', 'createDirectory', array(0777, '/tmp')), - 'getFileMd5' => array('getFileMd5', 'getFileMd5'), - 'getFileSize' => array('getFileSize', 'getFileSize') - ); - } - - /** - * @dataProvider adapterMethodsWithFileCheckDataProvider - * @param string $method - * @param string $adapterMethod - */ - public function testAdapterMethodsWithFileChecks($method, $adapterMethod) - { - $validPath = '/tmp/path/file.txt'; - $adapterMock = $this->_getDefaultAdapterMock(); - $adapterMock->expects($this->once()) - ->method('isFile') - ->with($validPath) - ->will($this->returnValue(true)); - $adapterMock->expects($this->once()) - ->method($adapterMethod) - ->with($validPath) - ->will($this->returnValue(1)); - - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $this->assertEquals(1, $filesystem->$method($validPath)); - } - - /** - * @return array - */ - public function adapterMethodsWithFileCheckDataProvider() - { - return array( - 'read' => array('read', 'read'), - 'getFileMd5' => array('getFileMd5', 'getFileMd5'), - 'getFileSize' => array('getFileSize', 'getFileSize') - ); - } - - /** - * @dataProvider workingDirDataProvider - * @param string|null $workingDirectory - */ - public function testCreateDirectory($workingDirectory) - { - $validPath = '/tmp/path'; - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->exactly(2)) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->once()) - ->method('createDirectory') - ->with($validPath); - - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $filesystem->createDirectory($validPath, 0777, $workingDirectory); - } - - /** - * @dataProvider workingDirDataProvider - * @param string|null $workingDirectory - */ - public function testWrite($workingDirectory) - { - $validPath = '/tmp/path/file.txt'; - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->at(0)) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->at(1)) - ->method('isDirectory') - ->with('/tmp/path') - ->will($this->returnValue(true)); - $adapterMock->expects($this->exactly(2)) - ->method('isDirectory'); - $adapterMock->expects($this->once()) - ->method('write') - ->with($validPath, 'TEST TEST'); - - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $filesystem->write($validPath, 'TEST TEST', $workingDirectory); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Path '/tmp/../path/file.txt' is out of working directory '/tmp' - * @dataProvider workingDirDataProvider - * @param string|null $workingDirectory - */ - public function testWriteIsolation($workingDirectory) - { - $invalidPath = '/tmp/../path/file.txt'; - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->once()) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->never()) - ->method('write'); - - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $filesystem->write($invalidPath, 'TEST TEST', $workingDirectory); - } - - /** - * @return array - */ - public function workingDirDataProvider() - { - return array( - array(null), array('/tmp') - ); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage "/tmp/test/file.txt" does not exists - * @dataProvider methodsWithFileChecksDataProvider - * @param string $method - * @param array|null $params - */ - public function testFileChecks($method, array $params = null) - { - $path = '/tmp/test/file.txt'; - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->once()) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->once()) - ->method('exists') - ->with($path) - ->will($this->returnValue(false)); - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $params = (array)$params; - array_unshift($params, $path); - call_user_func_array(array($filesystem, $method), $params); - } - - /** - * @return array - */ - public function methodsWithFileChecksDataProvider() - { - return array( - 'rename' => array('rename', array('/tmp/file001.txt')) - ); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage "/tmp/test/file.txt" does not exists - * @dataProvider methodsWithPathChecksDataProvider - * @param string $method - * @param array|null $params - */ - public function testPathChecks($method, array $params = null) - { - $path = '/tmp/test/file.txt'; - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->once()) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->once()) - ->method('isFile') - ->with($path) - ->will($this->returnValue(false)); - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $params = (array)$params; - array_unshift($params, $path); - call_user_func_array(array($filesystem, $method), $params); - } - - /** - * @return array - */ - public function methodsWithPathChecksDataProvider() - { - return array( - 'read' => array('read'), - 'copy' => array('copy', array('/tmp/file001.txt')), - ); - } - - /** - * Test isDirectory - * - * @dataProvider workingDirDataProvider - * @param string|null $workingDirectory - */ - public function testIsDirectory($workingDirectory) - { - $validPath = '/tmp/path'; - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->at(0)) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->at(1)) - ->method('isDirectory') - ->with($validPath) - ->will($this->returnValue(true)); - $adapterMock->expects($this->exactly(2)) - ->method('isDirectory'); - - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory('/tmp'); - $this->assertTrue($filesystem->isDirectory($validPath, $workingDirectory)); - } - - /** - * Test isDirectory isolation - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Path '/tmp/../etc/passwd' is out of working directory '/tmp' - * @dataProvider workingDirDataProvider - * @param string|null $workingDirectory - */ - public function testIsDirectoryIsolation($workingDirectory) - { - $validPath = '/tmp/../etc/passwd'; - $filesystem = new \Magento\Filesystem($this->_getDefaultAdapterMock()); - $filesystem->setWorkingDirectory('/tmp'); - $this->assertTrue($filesystem->isDirectory($validPath, $workingDirectory)); - } - - /** - * @dataProvider normalizePathDataProvider - * @param string $path - * @param bool $isRelative - * @param string $expected - */ - public function testNormalizePath($path, $isRelative, $expected) - { - $this->assertEquals($expected, \Magento\Filesystem::normalizePath($path, $isRelative)); - } - - /** - * @return array - */ - public static function normalizePathDataProvider() - { - return array( - array('/tmp/../file.txt', false, '/file.txt'), - array('/tmp/../etc/mysql/file.txt', false, '/etc/mysql/file.txt'), - array('/tmp/./file.txt', false, '/tmp/file.txt'), - array('/tmp/./../file.txt', false, '/file.txt'), - array('/tmp/path/file.txt', false, '/tmp/path/file.txt'), - array('/tmp/path\file.txt', false, '/tmp/path/file.txt'), - array('/tmp/path', false, '/tmp/path'), - array('../tmp/path', true, '../tmp/path'), - array('../tmp/../../path', true, '../../path'), - array('C:\\Windows', false, 'C:/Windows'), - array('C:\\Windows\\system32\\..', false, 'C:/Windows'), - ); - } - - - /** - * @param string $path - * @param bool $isRelative - * @dataProvider normalizePathExceptionDataProvider - */ - public function testNormalizePathException($path, $isRelative) - { - $this->setExpectedException('Magento\Filesystem\FilesystemException', "Invalid path '{$path}'."); - \Magento\Filesystem::normalizePath($path, $isRelative); - } - - /** - * @return array - */ - public static function normalizePathExceptionDataProvider() - { - return array( - array('./../file.txt', false), - array('/../file.txt', false), - array('/tmp/../../file.txt', false), - ); - } - - /** - * @return \PHPUnit_Framework_MockObject_MockObject - */ - protected function _getDefaultAdapterMock() - { - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $adapterMock->expects($this->once()) - ->method('isDirectory') - ->with('/tmp') - ->will($this->returnValue(true)); - $adapterMock->expects($this->any()) - ->method('exists') - ->will($this->returnValue(true)); - return $adapterMock; - } - - /** - * @dataProvider isPathInDirectoryDataProvider - * @param string $path - * @param string $directory - * @param boolean $expectedValue - */ - public function testIsPathInDirectory($path, $directory, $expectedValue) - { - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - - $filesystem = new \Magento\Filesystem($adapterMock); - $this->assertEquals($expectedValue, $filesystem->isPathInDirectory($path, $directory)); - } - - /** - * @return array - */ - public function isPathInDirectoryDataProvider() - { - return array( - array('/tmp/file', '/tmp', true), - array('/tmp/file', '/tmp/dir', false), - array('/tmp', '/tmp/', true), - array('/tmp/', '/tmp', true), - ); - } - - - /** - * @dataProvider testSearchFilesDataProvider - * @param string $workingDirectory - * @param string $baseDirectory - * @param string $pattern - * @param string $expectedValue - */ - public function testSearchFiles($workingDirectory, $baseDirectory, $pattern, $expectedValue) - { - $adapterMock = $this->getMock('Magento\Filesystem\AdapterInterface'); - - $adapterMock->expects($this->once()) - ->method('isDirectory') - ->with($workingDirectory) - ->will($this->returnValue(true)); - - $searchResult = array('result'); - $adapterMock->expects($this->once()) - ->method('searchKeys') - ->with($expectedValue) - ->will($this->returnValue($searchResult)); - - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory($workingDirectory); - $this->assertEquals($searchResult, $filesystem->searchKeys($baseDirectory, $pattern)); - } - - /** - * @return array - */ - public function testSearchFilesDataProvider() - { - return array( - array('/tmp', '/tmp/some/folder', '*', '/tmp/some/folder/*'), - array('/tmp', '/tmp/some/folder/', '/*', '/tmp/some/folder/*'), - array('/tmp', '/tmp/some/folder/', '/../../*', '/tmp/some/folder/../../*'), - ); - } - - /** - * @dataProvider searchFilesIsolationDataProvider - * @param string $workingDirectory - * @param string $baseDirectory - * @param string $pattern - * @param string $expectedMessage - */ - public function testSearchFilesIsolation($workingDirectory, $baseDirectory, $pattern, $expectedMessage) - { - $adapterMock = $this->getMock('Magento\Filesystem\AdapterInterface'); - - $adapterMock->expects($this->once()) - ->method('isDirectory') - ->with($workingDirectory) - ->will($this->returnValue(true)); - - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->setWorkingDirectory($workingDirectory); - - $this->setExpectedException('InvalidArgumentException', $expectedMessage); - $filesystem->searchKeys($baseDirectory, $pattern); - } - - /** - * @return array - */ - public function searchFilesIsolationDataProvider() - { - return array( - array( - '/tmp', - '/tmp/some/folder', - '/../../../*', - "Path '/tmp/some/folder/../../../*' is out of working directory '/tmp'" - ), - array( - '/tmp/log', - '/tmp/log/some/folder/../../../', - '*', - "Path '/tmp/log/some/folder/../../../' is out of working directory '/tmp/log'" - ), - ); - } - - public function testCheckLfiProtection() - { - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface')->getMock(); - $filesystem = new \Magento\Filesystem($adapterMock); - $this->assertTrue($filesystem->checkLfiProtection('/some/path/to/a/file.txt')); - $this->assertTrue($filesystem->checkLfiProtection('/some/path/to/a/file.with.dot.txt')); - $this->assertTrue($filesystem->checkLfiProtection('/some/path/to/a/dir')); - } - - /** - * @dataProvider checkLfiProtectionDataProvider - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Requested file may not include parent directory traversal ("../", "..\" notation) - */ - public function testCheckLfiProtectionException($path) - { - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface')->getMock(); - $filesystem = new \Magento\Filesystem($adapterMock); - $filesystem->checkLfiProtection($path); - } - - /** - * @return array - */ - public function checkLfiProtectionDataProvider() - { - return array( - array('../asd/'), - array('../../'), - array('asd/../asda'), - array('/asd/../asda'), - array('asd/../../asda'), - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Image/Adapter/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Image/Adapter/AbstractTest.php index d13ced31e7d..00632c2d0b2 100644 --- a/dev/tests/unit/testsuite/Magento/Image/Adapter/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Image/Adapter/AbstractTest.php @@ -37,18 +37,42 @@ class AbstractTest extends \PHPUnit_Framework_TestCase */ protected $_model; + /** + * @var \PHPUnit_Framework_MockObject_MockObject |\Magento\Filesystem\Directory\Write + */ + protected $directoryWriteMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject |\Magento\Filesystem + */ + protected $filesystemMock; + + protected function setUp() { - parent::setUp(); - $ioFile = $this->getMock('Magento\Io\File', array('mkdir')); - $ioFile->expects($this->any()) - ->method('mkdir') - ->will($this->returnValue(true)); - - $data = array('io' => $ioFile); - $this->_model = $this->getMockForAbstractClass('Magento\Image\Adapter\AbstractAdapter', array($data)); + $this->directoryWriteMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); + $this->filesystemMock = $this->getMock( + 'Magento\Filesystem', + array('getDirectoryWrite', 'createDirectory'), + array(), + '', + false + ); + $this->filesystemMock->expects($this->once()) + ->method('getDirectoryWrite') + ->will($this->returnValue($this->directoryWriteMock)); + + $this->_model = $this->getMockForAbstractClass('Magento\Image\Adapter\AbstractAdapter', + array($this->filesystemMock) + ); } + protected function tearDown() + { + $this->directoryWriteMock = null; + $this->_model = null; + $this->filesystemMock = null; + } /** * Test adaptResizeValues with null as a value one of parameters * @@ -117,10 +141,10 @@ class AbstractTest extends \PHPUnit_Framework_TestCase public function prepareDestinationDataProvider() { return array( - array(__DIR__, 'name.txt', __DIR__ . DIRECTORY_SEPARATOR . 'name.txt'), - array(__DIR__ . DIRECTORY_SEPARATOR . 'name.txt', null, __DIR__ . DIRECTORY_SEPARATOR . 'name.txt'), - array(null, 'name.txt', '_fileSrcPath' . DIRECTORY_SEPARATOR . 'name.txt'), - array(null, null, '_fileSrcPath' . DIRECTORY_SEPARATOR . '_fileSrcName'), + array(__DIR__, 'name.txt', __DIR__ . '/name.txt'), + array(__DIR__ . '/name.txt', null, __DIR__ . '/name.txt'), + array(null, 'name.txt', '_fileSrcPath' . '/name.txt'), + array(null, null, '_fileSrcPath' . '/_fileSrcName'), ); } diff --git a/dev/tests/unit/testsuite/Magento/Image/Adapter/ImageMagickTest.php b/dev/tests/unit/testsuite/Magento/Image/Adapter/ImageMagickTest.php index 13514fb7850..c2160324f57 100644 --- a/dev/tests/unit/testsuite/Magento/Image/Adapter/ImageMagickTest.php +++ b/dev/tests/unit/testsuite/Magento/Image/Adapter/ImageMagickTest.php @@ -33,8 +33,9 @@ class ImageMagickTest extends \PHPUnit_Framework_TestCase */ public function testWatermark($imagePath, $expectedMessage) { + $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); $this->setExpectedException('LogicException', $expectedMessage); - $object = new \Magento\Image\Adapter\ImageMagick; + $object = new \Magento\Image\Adapter\ImageMagick($filesystem); $object->watermark($imagePath); } diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Config/ConverterTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Config/ConverterTest.php index b3338fdc2d0..9707866ca05 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Config/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Config/ConverterTest.php @@ -37,7 +37,7 @@ class ConverterTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_filePath = realpath(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; + $this->_filePath = realpath(__DIR__) . '/_files/'; $this->_model = new \Magento\ImportExport\Model\Export\Config\Converter(); } diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Config/SchemaLocatorTest.php index 0ff470199d8..32e4741b16d 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Config/SchemaLocatorTest.php @@ -48,11 +48,11 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase public function testGetSchema() { - $this->assertEquals('schema_dir' . DIRECTORY_SEPARATOR . 'export_merged.xsd', $this->_model->getSchema()); + $this->assertEquals('schema_dir/export_merged.xsd', $this->_model->getSchema()); } public function testGetPerFileSchema() { - $this->assertEquals('schema_dir' . DIRECTORY_SEPARATOR . 'export.xsd', $this->_model->getPerFileSchema()); + $this->assertEquals('schema_dir/export.xsd', $this->_model->getPerFileSchema()); } } diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php index a5bbb35b23b..9d6f609ef3d 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php @@ -45,8 +45,15 @@ class AbstractEavTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_model = $this->getMockForAbstractClass('Magento\ImportExport\Model\Export\Entity\AbstractEav', array(), - '', false, true, true, array('_getExportAttributeCodes', 'getAttributeCollection', 'getAttributeOptions')); + $this->_model = $this->getMockForAbstractClass( + 'Magento\ImportExport\Model\Export\Entity\AbstractEav', + array(), + '', + false, + true, + true, + array('_getExportAttributeCodes', 'getAttributeCollection', 'getAttributeOptions', '__wakeup') + ); $this->_model->expects($this->once()) ->method('_getExportAttributeCodes') diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php index 1aceecc5c2f..dc77255bdcf 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); - $dir = $this->getMock('Magento\App\Dir', array(), array(), '', false); + $filesystem = $this->getMock('Magento\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);; @@ -86,7 +86,7 @@ class ExportTest extends \PHPUnit_Framework_TestCase $mockModelExport = $this->getMock( 'Magento\ImportExport\Model\Export', array('getEntityAdapter', '_getEntityAdapter', '_getWriter'), - array($logger, $dir, $adapterFactory, $this->_exportConfigMock, $entityFactory, $exportAdapterFac) + array($logger, $filesystem, $adapterFactory, $this->_exportConfigMock, $entityFactory, $exportAdapterFac) ); $mockModelExport->expects($this->any()) ->method('getEntityAdapter') diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Config/ConverterTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Config/ConverterTest.php index 8f1559fc5fa..0f74aae3111 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Config/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Config/ConverterTest.php @@ -37,7 +37,7 @@ class ConverterTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_filePath = realpath(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; + $this->_filePath = realpath(__DIR__) . '/_files/'; $this->_model = new \Magento\ImportExport\Model\Import\Config\Converter(); } diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Config/SchemaLocatorTest.php index 782d699d3ec..985736fccd0 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Config/SchemaLocatorTest.php @@ -48,11 +48,11 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase public function testGetSchema() { - $this->assertEquals('schema_dir' . DIRECTORY_SEPARATOR . 'import_merged.xsd', $this->_model->getSchema()); + $this->assertEquals('schema_dir/import_merged.xsd', $this->_model->getSchema()); } public function testGetPerFileSchema() { - $this->assertEquals('schema_dir' . DIRECTORY_SEPARATOR . 'import.xsd', $this->_model->getPerFileSchema()); + $this->assertEquals('schema_dir/import.xsd', $this->_model->getPerFileSchema()); } } diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php index b9ad6307a75..5b1e87950a4 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php @@ -782,7 +782,16 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase { $this->_getModelMockForPrepareRowForDb(); $pathToCsvFile = __DIR__ . '/_files/customer_composite_prepare_row_for_db.csv'; - $source = new \Magento\ImportExport\Model\Import\Source\Csv($pathToCsvFile); + $directoryMock = $this->getMock('\Magento\Filesystem\Directory\Write', array(), array(), '', false); + $directoryMock->expects($this->any()) + ->method('openFile') + ->will($this->returnValue( + new \Magento\Filesystem\File\Read( + $pathToCsvFile, + new \Magento\Filesystem\Driver\File() + ) + )); + $source = new \Magento\ImportExport\Model\Import\Source\Csv($pathToCsvFile, $directoryMock); $this->_model->setSource($source); $this->_model->validateData(); // assertions processed in self::verifyPrepareRowForDbData } diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php index ce66279843c..7436a730afa 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php @@ -160,6 +160,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { + $this->markTestSkipped(); $this->_objectManagerMock = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $this->_stringLib = new \Magento\Stdlib\String; 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 b727259d6e8..72bdc44d10e 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 @@ -26,18 +26,53 @@ namespace Magento\ImportExport\Model\Import\Source; class CsvTest extends \PHPUnit_Framework_TestCase { + /** + * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_filesystem; + + /** + * @var \Magento\Filesystem\Directory\Write|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_directoryMock; + + /** + * Set up properties for all tests + */ + protected function setUp() + { + $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); + } + /** * @expectedException \LogicException */ public function testConstructException() { - new \Magento\ImportExport\Model\Import\Source\Csv(__DIR__ . '/invalid_file'); + $this->_directoryMock->expects($this->any()) + ->method('openFile') + ->will($this->throwException(new \Magento\Filesystem\FilesystemException())); + new \Magento\ImportExport\Model\Import\Source\Csv(__DIR__ . '/invalid_file', $this->_directoryMock); } public function testConstructStream() { + $this->markTestSkipped('MAGETWO-17084'); $stream = 'data://text/plain;base64,' . base64_encode("column1,column2\nvalue1,value2\n"); - $model = new \Magento\ImportExport\Model\Import\Source\Csv($stream); + $this->_directoryMock->expects($this->any()) + ->method('openFile') + ->will($this->returnValue( + new \Magento\Filesystem\File\Read( + $stream, + new \Magento\Filesystem\Driver\Http() + ) + )); + $this->_filesystem->expects($this->any()) + ->method('getDirectoryWrite') + ->will($this->returnValue($this->_directoryMock)); + + $model = new \Magento\ImportExport\Model\Import\Source\Csv($stream, $this->_filesystem); foreach ($model as $value) { $this->assertSame(array('column1' => 'value1', 'column2' => 'value2'), $value); } @@ -51,8 +86,16 @@ class CsvTest extends \PHPUnit_Framework_TestCase */ public function testOptionalArgs($delimiter, $enclosure, $expectedColumns) { + $this->_directoryMock->expects($this->any()) + ->method('openFile') + ->will($this->returnValue( + new \Magento\Filesystem\File\Read( + __DIR__ . '/_files/test.csv', + new \Magento\Filesystem\Driver\File() + ) + )); $model = new \Magento\ImportExport\Model\Import\Source\Csv( - __DIR__ . '/_files/test.csv', $delimiter, $enclosure); + __DIR__ . '/_files/test.csv', $this->_directoryMock, $delimiter, $enclosure); $this->assertSame($expectedColumns, $model->getColNames()); } @@ -70,7 +113,18 @@ class CsvTest extends \PHPUnit_Framework_TestCase public function testRewind() { - $model = new \Magento\ImportExport\Model\Import\Source\Csv(__DIR__ . '/_files/test.csv'); + $this->_directoryMock->expects($this->any()) + ->method('openFile') + ->will($this->returnValue( + new \Magento\Filesystem\File\Read( + __DIR__ . '/_files/test.csv', + new \Magento\Filesystem\Driver\File() + ) + )); + $model = new \Magento\ImportExport\Model\Import\Source\Csv( + __DIR__ . '/_files/test.csv', + $this->_directoryMock + ); $this->assertSame(-1, $model->key()); $model->next(); $this->assertSame(0, $model->key()); diff --git a/dev/tests/unit/testsuite/Magento/Index/App/IndexerTest.php b/dev/tests/unit/testsuite/Magento/Index/App/IndexerTest.php index a5d890d2c5a..af29ea0deb2 100644 --- a/dev/tests/unit/testsuite/Magento/Index/App/IndexerTest.php +++ b/dev/tests/unit/testsuite/Magento/Index/App/IndexerTest.php @@ -45,7 +45,14 @@ class IndexerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryWrite'), array(), '', false); + $directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); + $directoryMock->expects($this->any()) + ->method('getRelativePath') + ->will($this->returnArgument(0)); + $this->_filesystem->expects($this->once()) + ->method('getDirectoryWrite') + ->will($this->returnValue($directoryMock)); $this->_indexFactoryMock = $this->getMock('Magento\Index\Model\IndexerFactory', array('create'), array(), '', false); $this->_entryPoint = new \Magento\Index\App\Indexer( diff --git a/dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/SchemaLocatorTest.php index a04eb58db39..424960b95c6 100644 --- a/dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/SchemaLocatorTest.php @@ -54,7 +54,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase */ public function testGetSchema() { - $expectedSchema = 'some_path' . DIRECTORY_SEPARATOR . 'indexers_merged.xsd'; + $expectedSchema = 'some_path/indexers_merged.xsd'; $this->assertEquals($expectedSchema, $this->_model->getSchema()); } @@ -63,7 +63,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase */ public function testGetPerFileSchema() { - $expectedSchema = 'some_path' . DIRECTORY_SEPARATOR . 'indexers.xsd'; + $expectedSchema = 'some_path/indexers.xsd'; $this->assertEquals($expectedSchema, $this->_model->getPerFileSchema()); } } 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 da7eed6f5fa..f0cfcceab67 100644 --- a/dev/tests/unit/testsuite/Magento/Index/Model/Lock/StorageTest.php +++ b/dev/tests/unit/testsuite/Magento/Index/Model/Lock/StorageTest.php @@ -42,42 +42,42 @@ class StorageTest extends \PHPUnit_Framework_TestCase public function testGetFile() { - $this->_dirsMock = $this->getMock('Magento\App\Dir', array(), array(), '', false, false); - $this->_dirsMock->expects($this->any()) - ->method('getDir') - ->with(\Magento\App\Dir::VAR_DIR) - ->will($this->returnValue(__DIR__ . DIRECTORY_SEPARATOR. 'var')); + $streamMock = $this->getMockBuilder('Magento\Filesystem\File\Write') + ->disableOriginalConstructor() + ->getMock(); - $fileModel = $this->getMock('Magento\Index\Model\Process\File', - array( - 'setAllowCreateFolders', - 'open', - 'streamOpen', - 'streamWrite', - ) - ); + $directoryMock = $this->getMockBuilder('Magento\Filesystem\Directory\Write') + ->disableOriginalConstructor() + ->getMock(); + $directoryMock->expects($this->exactly(2)) + ->method('create'); + + $directoryMock->expects($this->any()) + ->method('openFile') + ->will($this->returnValue($streamMock)); + + $filesystemMock = $this->getMockBuilder('Magento\Filesystem') + ->disableOriginalConstructor() + ->getMock(); + $filesystemMock->expects($this->once()) + ->method('getDirectoryWrite') + ->with(\Magento\Filesystem::VAR_DIR) + ->will($this->returnValue($directoryMock)); - $fileModel->expects($this->exactly(2)) - ->method('setAllowCreateFolders') - ->with(true); - $fileModel->expects($this->exactly(2)) - ->method('open') - ->with(array('path' => __DIR__ . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'locks')); - $fileModel->expects($this->exactly(2)) - ->method('streamOpen') - ->will($this->returnCallback(array($this, 'checkFilenameCallback'))); - $fileModel->expects($this->exactly(2)) - ->method('streamWrite') - ->with($this->isType('string')); + $fileModel = $this->getMock('Magento\Index\Model\Process\File', array(), array($streamMock), ''); - $fileFactory = $this->getMock('Magento\Index\Model\Process\FileFactory', array('create'), array(), '', + $fileFactory = $this->getMock( + 'Magento\Index\Model\Process\FileFactory', + array('create'), + array($streamMock), + '', false ); $fileFactory->expects($this->exactly(2)) ->method('create') ->will($this->returnValue($fileModel)); - $storage = new \Magento\Index\Model\Lock\Storage($this->_dirsMock, $fileFactory); + $storage = new \Magento\Index\Model\Lock\Storage($fileFactory, $filesystemMock); /** * List if test process IDs. diff --git a/dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php b/dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php index 502328f9a20..7dc007e6e02 100644 --- a/dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php +++ b/dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php @@ -130,7 +130,15 @@ class ProcessTest extends \PHPUnit_Framework_TestCase public function testUnlock() { - $this->_processFile = $this->getMock('Magento\Index\Model\Process\File', array('processUnlock')); + $streamLock = $this->getMockBuilder('Magento\Filesystem\File\Write') + ->setMethods(array('unlock')) + ->disableOriginalConstructor() + ->getMock(); + $this->_processFile = $this->getMock( + 'Magento\Index\Model\Process\File', + array('processUnlock', '__wakeup'), + array($streamLock) + ); $this->_processFile->expects($this->once()) ->method('processUnlock'); $this->_prepareIndexProcess(); @@ -158,7 +166,15 @@ class ProcessTest extends \PHPUnit_Framework_TestCase */ public function testIsLocked($needUnlock) { - $this->_processFile = $this->getMock('Magento\Index\Model\Process\File', array('isProcessLocked')); + $streamLock = $this->getMockBuilder('Magento\Filesystem\File\Write') + ->setMethods(array('unlock')) + ->disableOriginalConstructor() + ->getMock(); + $this->_processFile = $this->getMock( + 'Magento\Index\Model\Process\File', + array('isProcessLocked', '__wakeup'), + array($streamLock) + ); $this->_processFile->expects($this->once()) ->method('isProcessLocked') ->with($needUnlock) 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 f3f7285afec..30497c1c7e2 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 @@ -26,44 +26,70 @@ namespace Magento\Install\App\Action\Plugin; class DirTest extends \PHPUnit_Framework_TestCase { /** + * Dir plugin + * * @var \Magento\Install\App\Action\Plugin\Dir */ - protected $_plugin; + protected $plugin; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * App state mock + * + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\State */ - protected $_appStateMock; + protected $appStateMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * Var directory + * + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Filesystem\Directory\Write */ - protected $_dirMock; + protected $varDirectory; protected function setUp() { - $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); - $this->_dirMock = $this->getMock('Magento\App\Dir', array(), array(), '', false); - $this->_plugin = new \Magento\Install\App\Action\Plugin\Dir( - $this->_appStateMock, - $this->_dirMock + $this->appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); + $filesystem = $this->getMock('Magento\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) + ->will($this->returnValue($this->varDirectory)); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); + $this->plugin = new \Magento\Install\App\Action\Plugin\Dir( + $this->appStateMock, + $filesystem, + $logger ); } + /** + * Test when app is installed + */ public function testBeforeDispatchWhenAppIsInstalled() { - $this->_appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(false)); - $this->_dirMock - ->expects($this->once()) - ->method('getDir') - ->with(\Magento\App\Dir::VAR_DIR)->will($this->returnValue('dir_name')); - $this->assertEquals(array(), $this->_plugin->beforeDispatch(array())); + $directories = array('dir1', 'dir2'); + $this->appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(false)); + $this->varDirectory->expects($this->once()) + ->method('read') + ->will($this->returnValue($directories)); + $this->varDirectory->expects($this->exactly(count($directories))) + ->method('isDirectory') + ->will($this->returnValue(true)); + $this->varDirectory->expects($this->exactly(count($directories))) + ->method('delete'); + $this->assertEquals(array(), $this->plugin->beforeDispatch(array())); } + /** + * Test when app is not installed + */ public function testBeforeDispatchWhenAppIsNotInstalled() { - $this->_appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); - $this->_dirMock->expects($this->never())->method('getDir'); - $this->assertEquals(array(), $this->_plugin->beforeDispatch(array())); + $this->appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); + $this->varDirectory->expects($this->never())->method('read'); + $this->assertEquals(array(), $this->plugin->beforeDispatch(array())); } } \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Install/App/ConsoleTest.php b/dev/tests/unit/testsuite/Magento/Install/App/ConsoleTest.php index 38b152e6af5..38df4ff735f 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\App\Dir\Verification + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Filesystem\DirectoryList\Verification */ protected $_dirVerifierMock; @@ -69,7 +69,13 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase $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\App\Dir\Verification', array(), array(), '', false); + $this->_dirVerifierMock = $this->getMock( + 'Magento\Filesystem\DirectoryList\Verification', + array(), + array(), + '', + false + ); $this->_outputMock = $this->getMock('Magento\Install\App\Output', array(), array(), '', false); $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); $this->_configLoaderMock = $this->getMockBuilder('Magento\App\ObjectManager\ConfigLoader') @@ -87,8 +93,30 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase protected function _createModel($params = array()) { + $directory = $this->getMock( + 'Magento\Filesystem\Directory\Read', + array('isExist','getRelativePath'), + array(), + '', + false + ); + $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', false); + $filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->with(\Magento\Filesystem::ROOT) + ->will($this->returnValue($directory)); + if (isset($params['config'])) { + $directory->expects($this->once()) + ->method('getRelativePath') + ->with($params['config']) + ->will($this->returnValue($params['config'])); + $directory->expects($this->once()) + ->method('isExist') + ->with($params['config']) + ->will($this->returnValue(true)); + } return new \Magento\Install\App\Console($this->_instFactoryMock, $this->_outputMock, - $this->_appStateMock, $this->_configLoaderMock, $this->_objectManagerMock, $params + $this->_appStateMock, $this->_configLoaderMock, $this->_objectManagerMock, $filesystem, $params ); } diff --git a/dev/tests/unit/testsuite/Magento/Install/Block/BeginTest.php b/dev/tests/unit/testsuite/Magento/Install/Block/BeginTest.php index cac7d3dce9a..eaa30b41d9c 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Block/BeginTest.php +++ b/dev/tests/unit/testsuite/Magento/Install/Block/BeginTest.php @@ -50,11 +50,16 @@ class BeginTest extends \PHPUnit_Framework_TestCase */ public function testGetLicenseHtmlWhenFileExists($fileName, $expectedTxt) { + $directoryMock = $this->getMock('Magento\Filesystem\Directory\Read', array(), array(), '', false); + $directoryMock->expects($this->once()) + ->method('readFile') + ->with($this->equalTo($fileName)) + ->will($this->returnValue($expectedTxt)); + $fileSystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); $fileSystem->expects($this->once()) - ->method('read') - ->with($this->equalTo(BP . DS . $fileName)) - ->will($this->returnValue($expectedTxt)); + ->method('getDirectoryRead') + ->will($this->returnValue($directoryMock)); $block = $this->_objectManager->getObject('Magento\Install\Block\Begin', array('filesystem' => $fileSystem, 'eulaFile' => $fileName)); diff --git a/dev/tests/unit/testsuite/Magento/Install/Controller/WizardTest.php b/dev/tests/unit/testsuite/Magento/Install/Controller/WizardTest.php new file mode 100644 index 00000000000..7a06d7c671d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Install/Controller/WizardTest.php @@ -0,0 +1,232 @@ +<?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_Install + * @subpackage unit_tests + * @copyright Copyright (c) 2013 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\Install\Block\Wizard + */ +namespace Magento\Install\Controller; +/** + * Class WizardTest + * + * @package Magento\Install\Controller + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class WizardTest extends \PHPUnit_Framework_TestCase +{ + /** + * Locale to test + */ + const LOCALE = 'xx_XX'; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_objectManager; + + /** + * @var \Magento\Install\Block\Locale + */ + protected $_block; + + /** + * @var \Magento\App\ViewInterface + */ + protected $_viewMock; + + /** + * @var \Magento\Install\Model\Installer + */ + protected $_installerMock; + + /** + * @var \Magento\View\LayoutInterface + */ + protected $_layoutMock; + + /** + * @var \Magento\Install\Controller\Wizard + */ + protected $_controller; + + /** + * @var \Magento\App\Action\Context + */ + protected $_contextMock; + + /** + * @var \Magento\Install\Model\Wizard + */ + protected $_wizardMock; + + /** + * @var \Magento\Session\Generic + */ + protected $_sessionMock; + + /** + * @var \Magento\App\RequestInterface + */ + protected $_requestMock; + + /** + * @var \Magento\App\ResponseInterface + */ + protected $_responseMock; + + /** + * @var \Magento\App\ActionFlag + */ + protected $_actionFlagMock; + + /** + * @var \Magento\View\Element\Template\Context + */ + protected $_blockContextMock; + + /** + * Set up before test + */ + protected function setUp() + { + $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->_installerMock = $this->getMock( + '\Magento\Install\Model\Installer', array('isApplicationInstalled'), array(), '', false + ); + $this->_installerMock->expects($this->any())->method('isApplicationInstalled')->will($this->returnValue(true)); + + + $this->_blockMock = $this->getMock( + '\Magento\Install\Block\Locale', array(), array(), '', false + ); + + + + $this->_layoutMock = $this->getMock( + '\Magento\Core\Model\Layout', array('getBlock', 'initMessages', 'addBlock'), array(), '', false + + ); + + $this->_layoutMock->expects($this->any())->method('initMessages') + ->withAnyParameters()->will($this->returnValue(true)); + $this->_layoutMock->expects($this->any())->method('addBlock') + ->withAnyParameters()->will($this->returnValue(true));; + + + $this->_viewMock = $this->getMockForAbstractClass( + '\Magento\App\ViewInterface', array(), '', false, false, true, array('getLayout') + ); + $this->_viewMock->expects($this->any())->method('getLayout') + ->withAnyParameters()->will($this->returnValue($this->_layoutMock)); + + $this->_requestMock = $this->_getClearMock('\Magento\App\RequestInterface'); + $this->_responseMock = $this->_getClearMock('\Magento\App\ResponseInterface'); + $this->_actionFlagMock = $this->_getClearMock('\Magento\App\ActionFlag'); + + $this->_contextMock = $this->getMock('\Magento\App\Action\Context', array( + 'getView', 'getRequest', 'getResponse', 'getActionFlag'), array(), '', false + ); + $this->_contextMock->expects($this->any())->method('getView') + ->will($this->returnValue($this->_viewMock)); + $this->_contextMock->expects($this->any())->method('getRequest') + ->will($this->returnValue($this->_requestMock)); + $this->_contextMock->expects($this->any())->method('getResponse') + ->will($this->returnValue($this->_responseMock)); + $this->_contextMock->expects($this->any())->method('getActionFlag') + ->will($this->returnValue($this->_actionFlagMock)); + + + $this->_blockContextMock = $this->getMock( + '\Magento\View\Element\Template\Context', array(), array(), '', false + ); + + + + $this->_wizardMock = $this->getMock( + '\Magento\Install\Model\Wizard', array('getStepByRequest'), array(), '', false + ); + $this->_wizardMock + ->expects($this->any()) + ->method('getStepByRequest') + ->withAnyParameters() + ->will($this->returnValue(false)); + + $this->_sessionMock = $this->getMock( + '\Magento\Session\Generic', array('getLocale'), array(), '', false + ); + $this->_sessionMock->expects($this->any())->method('getLocale')->will($this->returnValue(self::LOCALE)); + + $this->_block = $this->_objectManager->getObject('Magento\Install\Block\Locale', array( + 'context' => $this->_blockContextMock, + 'installer' =>$this->_installerMock, + 'installWizard' => $this->_wizardMock, + 'session' => $this->_sessionMock, + 'data' => array() + )); + + $this->_layoutMock->expects($this->any())->method('getBlock') + ->with('install.locale')->will($this->returnValue($this->_block)); + + $this->_controller = $this->_objectManager->getObject('Magento\Install\Controller\Wizard', array( + 'context' => $this->_contextMock, + 'configScope' => $this->_getClearMock('Magento\Config\Scope'), + 'installer' => $this->_getClearMock('Magento\Install\Model\Installer'), + 'wizard' => $this->_wizardMock, + 'session' => $this->_sessionMock, + 'dbUpdater' => $this->_getClearMock('Magento\Module\UpdaterInterface'), + 'storeManager' => $this->_getClearMock('Magento\Core\Model\StoreManagerInterface'), + 'appState' => $this->_getClearMock('Magento\App\State'), + )); + + + } + + /** + * Get clear mock + * + * @param string $className + * + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function _getClearMock($className) + { + return $this->getMock($className, array(), array(), '', false); + } + + /** + * Test setting locale from session + */ + public function testLocaleAction() + { + $this->_controller->localeAction(); + $this->assertEquals( + $this->_block->getLocaleCode(), + self::LOCALE, + 'Failed asserting that locale is set from session' + ); + } +} 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 e54e9d9fee9..765a94139d9 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php @@ -32,7 +32,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase /** * @var string */ - protected $_tmpConfigFile = ''; + protected $_tmpConfigFile = 'local.xml'; /** * @var \Magento\Install\Model\Installer\Config @@ -44,17 +44,36 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ protected $_filesystemMock; + /** + * @var \Magento\Filesystem\Directory\Write|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_directoryMock; + + /** + * @var \Magento\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_messageManager; + protected function setUp() { - $this->_tmpConfigFile = TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . 'local.xml'; + $this->_directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); + $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystemMock->expects($this->any()) + ->method('getPath') + ->with(\Magento\Filesystem::CONFIG) + ->will($this->returnValue(TESTS_TEMP_DIR)); + $this->_filesystemMock->expects($this->any()) + ->method('getDirectoryWrite') + ->will($this->returnValue($this->_directoryMock)); + + $this->_messageManager = $this->getMock('\Magento\Message\ManagerInterface', array(), array(), '', false); $this->_model = new \Magento\Install\Model\Installer\Config( - $this->getMock('Magento\Install\Model\Installer', array(), array(), - '', false), + $this->getMock('Magento\Install\Model\Installer', array(), array(), '', false), $this->getMock('Magento\App\RequestInterface', array(), array(), '', false), - new \Magento\App\Dir(__DIR__, array(), array(\Magento\App\Dir::CONFIG => TESTS_TEMP_DIR)), $this->_filesystemMock, - $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false) + $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false), + $this->_messageManager ); } @@ -69,12 +88,12 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $fixtureConfigData = "<date>$datePlaceholder</date>"; $expectedConfigData = '<date>Sat, 19 Jan 2013 18:50:39 -0800</date>'; - $this->_filesystemMock->expects($this->once()) - ->method('read') + $this->_directoryMock->expects($this->once()) + ->method('readFile') ->with($this->equalTo($this->_tmpConfigFile)) ->will($this->returnValue($fixtureConfigData)); - $this->_filesystemMock->expects($this->once()) - ->method('write') + $this->_directoryMock->expects($this->once()) + ->method('writeFile') ->with($this->equalTo($this->_tmpConfigFile), $this->equalTo($expectedConfigData)) ->will($this->returnValue($fixtureConfigData)); @@ -87,12 +106,12 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $fixtureConfigData = "<key>$keyPlaceholder</key>"; $expectedConfigData = '<key>3c7cf2e909fd5e2268a6e1539ae3c835</key>'; - $this->_filesystemMock->expects($this->once()) - ->method('read') + $this->_directoryMock->expects($this->once()) + ->method('readFile') ->with($this->equalTo($this->_tmpConfigFile)) ->will($this->returnValue($fixtureConfigData)); - $this->_filesystemMock->expects($this->once()) - ->method('write') + $this->_directoryMock->expects($this->once()) + ->method('writeFile') ->with($this->equalTo($this->_tmpConfigFile), $this->equalTo($expectedConfigData)) ->will($this->returnValue($fixtureConfigData)); diff --git a/dev/tests/unit/testsuite/Magento/Install/Model/WizardTest.php b/dev/tests/unit/testsuite/Magento/Install/Model/WizardTest.php new file mode 100644 index 00000000000..b6e636a4d16 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Install/Model/WizardTest.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_Install + * @subpackage unit_tests + * @copyright Copyright (c) 2013 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\Install\Model\Wizard + */ +namespace Magento\Install\Model; + +/** + * Class WizardTest + * + * @package Magento\Install\Block + */ +class WizardTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Install\Model\Config + */ + protected $_configMock; + + /** + * @var \Magento\UrlInterface + */ + protected $_urlBuilderMock; + + /** + * @var \Magento\Install\Model\Wizard + */ + protected $_model; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_objectManager; + + /** + * @var \Magento\App\RequestInterface + */ + protected $_requestMock; + + /** + * Set up before test + */ + public function setUp() + { + $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_configMock = $this->getMock('\Magento\Install\Model\Config', array(), array(), '', false); + $this->_configMock->expects($this->any())->method('getWizardSteps')->will($this->returnValue(array())); + $this->_urlBuilderMock = $this->getMock('\Magento\UrlInterface', array(), array(), '', false); + $this->_requestMock = $this->getMock('\Magento\App\RequestInterface', array(), array(), '', false); + $this->_model = $this->_objectManager->getObject('Magento\Install\Model\Wizard', array( + 'urlBuilder' => $this->_urlBuilderMock, + 'installConfig' => $this->_configMock + )); + } + + /** + * Test get step with empty request + */ + public function testGetStepByRequest() + { + $this->assertFalse($this->_model->getStepByRequest($this->_requestMock)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php b/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php index d2cf11e0226..aea0c1f0959 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php @@ -28,62 +28,79 @@ namespace Magento\Integration\Controller\Adminhtml; use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info; use Magento\Integration\Model\Integration as IntegrationModel; +use Magento\View\Layout\Element as LayoutElement; /** * @SuppressWarnings(PHPMD.TooManyFields) + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class IntegrationTest extends \PHPUnit_Framework_TestCase { - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockObjectManager; - /** @var \Magento\Integration\Controller\Adminhtml\Integration */ - protected $_integrationContr; + protected $_controller; /** @var \Magento\TestFramework\Helper\ObjectManager $objectManagerHelper */ protected $_objectManagerHelper; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockApp; + /** @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject */ + protected $_objectManagerMock; + + /** @var \Magento\Core\Model\App|\PHPUnit_Framework_MockObject_MockObject */ + protected $_appMock; + + /** @var \Magento\Core\Model\Layout\Filter\Acl|\PHPUnit_Framework_MockObject_MockObject */ + protected $_layoutFilterMock; + + /** @var \Magento\Core\Model\Config|\PHPUnit_Framework_MockObject_MockObject */ + protected $_configMock; + + /** @var \Magento\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $_eventManagerMock; + + /** @var \Magento\Core\Model\Translate|\PHPUnit_Framework_MockObject_MockObject */ + protected $_translateModelMock; + + /** @var \Magento\Backend\Model\Session|\PHPUnit_Framework_MockObject_MockObject */ + protected $_backendSessionMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockLayoutFilter; + /** @var \Magento\Backend\App\Action\Context|\PHPUnit_Framework_MockObject_MockObject */ + protected $_backendActionCtxMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockConfig; + /** @var \Magento\Integration\Service\IntegrationV1|\PHPUnit_Framework_MockObject_MockObject */ + protected $_integrationSvcMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockEventManager; + /** @var \Magento\Integration\Service\OauthV1|\PHPUnit_Framework_MockObject_MockObject */ + protected $_oauthSvcMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockTranslateModel; + /** @var \Magento\Core\Model\Registry|\PHPUnit_Framework_MockObject_MockObject */ + protected $_registryMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockBackendModSess; + /** @var \Magento\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject */ + protected $_requestMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockBackendCntCtxt; + /** @var \Magento\App\Response\Http|\PHPUnit_Framework_MockObject_MockObject */ + protected $_responseMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockIntegrationSvc; + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_messageManager; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockOauthSvc; + /** @var \Magento\Config\ScopeInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $_configScopeMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockRegistry; + /** @var \Magento\Integration\Helper\Data|\PHPUnit_Framework_MockObject_MockObject */ + protected $_integrationHelperMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockRequest; + /** @var \Magento\App\ViewInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $_viewMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockResponse; + /** @var \Magento\Core\Model\Layout\Merge|\PHPUnit_Framework_MockObject_MockObject */ + protected $_layoutMergeMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockConfigScope; + /** @var \Magento\View\LayoutInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $_layoutMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockIntegrationData; + /** Sample integration ID */ + const INTEGRATION_ID = 1; /** * Setup object manager and initialize mocks @@ -92,48 +109,51 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase { /** @var \Magento\TestFramework\Helper\ObjectManager $objectManagerHelper */ $this->_objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_mockObjectManager = $this->getMockBuilder('Magento\ObjectManager') + $this->_objectManagerMock = $this->getMockBuilder('Magento\ObjectManager') ->disableOriginalConstructor() ->getMock(); // Initialize mocks which are used in several test cases - $this->_mockApp = $this->getMockBuilder('Magento\Core\Model\App') + $this->_appMock = $this->getMockBuilder('Magento\Core\Model\App') ->setMethods(array('getConfig')) ->disableOriginalConstructor() ->getMock(); - $this->_mockConfig = $this->getMockBuilder('Magento\Core\Model\Config')->disableOriginalConstructor() + $this->_configMock = $this->getMockBuilder('Magento\Core\Model\Config')->disableOriginalConstructor() ->getMock(); - $this->_mockApp->expects($this->any())->method('getConfig')->will($this->returnValue($this->_mockConfig)); - $this->_mockEventManager = $this->getMockBuilder('Magento\Event\ManagerInterface') + $this->_appMock->expects($this->any())->method('getConfig')->will($this->returnValue($this->_configMock)); + $this->_eventManagerMock = $this->getMockBuilder('Magento\Event\ManagerInterface') ->disableOriginalConstructor() ->getMock(); - $this->_mockLayoutFilter = $this->getMockBuilder('Magento\Core\Model\Layout\Filter\Acl') + $this->_layoutFilterMock = $this->getMockBuilder('Magento\Core\Model\Layout\Filter\Acl') ->disableOriginalConstructor() ->getMock(); - $this->_mockBackendModSess = $this->getMockBuilder('Magento\Backend\Model\Session') + $this->_backendSessionMock = $this->getMockBuilder('Magento\Backend\Model\Session') ->disableOriginalConstructor() ->getMock(); - $this->_mockTranslateModel = $this->getMockBuilder('Magento\Core\Model\Translate') + $this->_translateModelMock = $this->getMockBuilder('Magento\Core\Model\Translate') ->disableOriginalConstructor() ->getMock(); - $this->_mockIntegrationSvc = $this->getMockBuilder('Magento\Integration\Service\IntegrationV1') + $this->_integrationSvcMock = $this->getMockBuilder('Magento\Integration\Service\IntegrationV1') ->disableOriginalConstructor() ->getMock(); - $this->_mockOauthSvc = $this->getMockBuilder('Magento\Integration\Service\OauthV1') + $this->_oauthSvcMock = $this->getMockBuilder('Magento\Integration\Service\OauthV1') ->disableOriginalConstructor() ->getMock(); - $this->_mockRequest = $this->getMockBuilder('Magento\App\Request\Http') + $this->_requestMock = $this->getMockBuilder('Magento\App\Request\Http') ->disableOriginalConstructor() ->getMock(); - $this->_mockResponse = $this->getMockBuilder('Magento\App\Response\Http') + $this->_responseMock = $this->getMockBuilder('Magento\App\Response\Http') ->disableOriginalConstructor() ->getMock(); - $this->_mockRegistry = $this->getMockBuilder('Magento\Core\Model\Registry') + $this->_registryMock = $this->getMockBuilder('Magento\Core\Model\Registry') ->disableOriginalConstructor() ->getMock(); - $this->_mockConfigScope = $this->getMockBuilder('Magento\Config\ScopeInterface') + $this->_configScopeMock = $this->getMockBuilder('Magento\Config\ScopeInterface') ->disableOriginalConstructor() ->getMock(); - $this->_mockIntegrationData = $this->getMockBuilder('Magento\Integration\Helper\Data') + $this->_integrationHelperMock = $this->getMockBuilder('Magento\Integration\Helper\Data') + ->disableOriginalConstructor() + ->getMock(); + $this->_messageManager = $this->getMockBuilder('Magento\Message\ManagerInterface') ->disableOriginalConstructor() ->getMock(); } @@ -142,55 +162,61 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase { $this->_verifyLoadAndRenderLayout(); // renderLayout - $this->_integrationContr = $this->_createIntegrationController(); - $this->_integrationContr->indexAction(); + $this->_controller = $this->_createIntegrationController(); + $this->_controller->indexAction(); } public function testNewAction() { $this->_verifyLoadAndRenderLayout(); // verify the request is forwarded to 'edit' action - $this->_mockRequest->expects($this->any())->method('setActionName')->with('edit') - ->will($this->returnValue($this->_mockRequest)); + $this->_requestMock->expects($this->any())->method('setActionName')->with('edit') + ->will($this->returnValue($this->_requestMock)); $integrationContr = $this->_createIntegrationController(); $integrationContr->newAction(); } public function testEditAction() { - $this->_mockIntegrationSvc->expects($this->any())->method('get')->with(1)->will( - $this->returnValue($this->_getSampleIntegrationData()) - ); - $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); + $this->_integrationSvcMock + ->expects($this->any()) + ->method('get') + ->with($this->equalTo(self::INTEGRATION_ID)) + ->will($this->returnValue($this->_getSampleIntegrationData())); + $this->_requestMock + ->expects($this->any()) + ->method('getParam') + ->with($this->equalTo(Integration::PARAM_INTEGRATION_ID)) + ->will($this->returnValue(self::INTEGRATION_ID)); // put data in session, the magic function getFormData is called so, must match __call method name - $this->_mockBackendModSess->expects($this->any()) - ->method('__call')->will( - $this->returnValue( - array( - Info::DATA_ID => 1, - 'name' => 'testIntegration' - ) - ) - ); + $this->_backendSessionMock->expects($this->any()) + ->method('__call') + ->will($this->returnValueMap([ + ['setIntegrationData'], + ['getIntegrationData', [ + Info::DATA_ID => self::INTEGRATION_ID, + Info::DATA_NAME => 'testIntegration' + ]] + ])); $this->_verifyLoadAndRenderLayout(); - $integrationContr = $this->_createIntegrationController(); - $integrationContr->editAction(); + $controller = $this->_createIntegrationController(); + $controller->editAction(); } public function testEditActionNonExistentIntegration() { $exceptionMessage = 'This integration no longer exists.'; // verify the error - $this->_mockBackendModSess->expects($this->once()) + $this->_messageManager->expects($this->once()) ->method('addError') ->with($this->equalTo($exceptionMessage)); - $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); + $this->_requestMock->expects($this->any())->method('getParam')->will($this->returnValue(self::INTEGRATION_ID)); // put data in session, the magic function getFormData is called so, must match __call method name - $this->_mockBackendModSess->expects($this->any()) + $this->_backendSessionMock->expects($this->any()) ->method('__call')->will($this->returnValue(array('name' => 'nonExistentInt'))); $invalidIdException = new \Magento\Integration\Exception($exceptionMessage); - $this->_mockIntegrationSvc->expects($this->any()) + $this->_integrationSvcMock->expects($this->any()) ->method('get')->will($this->throwException($invalidIdException)); $this->_verifyLoadAndRenderLayout(); $integrationContr = $this->_createIntegrationController(); @@ -201,7 +227,7 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase { $exceptionMessage = 'Integration ID is not specified or is invalid.'; // verify the error - $this->_mockBackendModSess->expects($this->once()) + $this->_messageManager->expects($this->once()) ->method('addError') ->with($this->equalTo($exceptionMessage)); $this->_verifyLoadAndRenderLayout(); @@ -213,26 +239,30 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase { $exceptionMessage = 'Integration ID is not specified or is invalid.'; // verify the error - $this->_mockBackendModSess->expects($this->once()) + $this->_messageManager->expects($this->once()) ->method('addError') ->with($this->equalTo($exceptionMessage)); - $this->_integrationContr = $this->_createIntegrationController(); - $this->_integrationContr->editAction(); + $this->_controller = $this->_createIntegrationController(); + $this->_controller->editAction(); } public function testSaveAction() { // Use real translate model - $this->_mockTranslateModel = null; - $this->_mockRequest->expects($this->any()) - ->method('getPost')->will($this->returnValue(array(Integration::PARAM_INTEGRATION_ID => 1))); - $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); + $this->_translateModelMock = null; + $this->_requestMock->expects($this->any()) + ->method('getPost')->will($this->returnValue([Integration::PARAM_INTEGRATION_ID => self::INTEGRATION_ID])); + $this->_requestMock->expects($this->any())->method('getParam')->will($this->returnValue(self::INTEGRATION_ID)); $intData = $this->_getSampleIntegrationData(); - $this->_mockIntegrationSvc->expects($this->any())->method('get')->with(1)->will($this->returnValue($intData)); - $this->_mockIntegrationSvc->expects($this->any())->method('update')->with($this->anything()) + $this->_integrationSvcMock + ->expects($this->any()) + ->method('get') + ->with(self::INTEGRATION_ID) + ->will($this->returnValue($intData)); + $this->_integrationSvcMock->expects($this->any())->method('update')->with($this->anything()) ->will($this->returnValue($intData)); // verify success message - $this->_mockBackendModSess->expects($this->once())->method('addSuccess') + $this->_messageManager->expects($this->once())->method('addSuccess') ->with(__('The integration \'%1\' has been saved.', $intData[Info::DATA_NAME])); $integrationContr = $this->_createIntegrationController(); $integrationContr->saveAction(); @@ -240,16 +270,16 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase public function testSaveActionException() { - $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); + $this->_requestMock->expects($this->any())->method('getParam')->will($this->returnValue(self::INTEGRATION_ID)); // Have integration service throw an exception to test exception path $exceptionMessage = 'Internal error. Check exception log for details.'; - $this->_mockIntegrationSvc->expects($this->any()) + $this->_integrationSvcMock->expects($this->any()) ->method('get') - ->with(1) + ->with(self::INTEGRATION_ID) ->will($this->throwException(new \Magento\Core\Exception($exceptionMessage))); // Verify error - $this->_mockBackendModSess->expects($this->once())->method('addError') + $this->_messageManager->expects($this->once())->method('addError') ->with($this->equalTo($exceptionMessage)); $integrationContr = $this->_createIntegrationController(); $integrationContr->saveAction(); @@ -257,16 +287,17 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase public function testSaveActionIntegrationException() { - $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); + $this->_requestMock->expects($this->any())->method('getParam')->will($this->returnValue(self::INTEGRATION_ID)); // Have integration service throw an exception to test exception path $exceptionMessage = 'Internal error. Check exception log for details.'; - $this->_mockIntegrationSvc->expects($this->any()) + $this->_integrationSvcMock->expects($this->any()) ->method('get') - ->with(1) + ->with(self::INTEGRATION_ID) ->will($this->throwException(new \Magento\Integration\Exception($exceptionMessage))); // Verify error - $this->_mockBackendModSess->expects($this->once())->method('addError') + $this->_messageManager->expects($this->once()) + ->method('addError') ->with($this->equalTo($exceptionMessage)); $integrationContr = $this->_createIntegrationController(); $integrationContr->saveAction(); @@ -274,21 +305,23 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase public function testSaveActionNew() { - $intData = $this->_getSampleIntegrationData()->getData(); + $integration = $this->_getSampleIntegrationData(); //No id when New Integration is Post-ed - unset($intData[Info::DATA_ID]); - $this->_mockRequest->expects($this->any())->method('getPost')->will($this->returnValue($intData)); - $intData[Info::DATA_ID] = 1; - $this->_mockIntegrationSvc->expects($this->any())->method('create')->with($this->anything()) - ->will($this->returnValue($intData)); - $this->_mockIntegrationSvc->expects($this->any())->method('get')->with(1)->will( + $integration->unsetData(array(IntegrationModel::ID, 'id')); + $this->_requestMock->expects($this->any())->method('getPost')->will( + $this->returnValue($integration->getData()) + ); + $integration->setData('id', self::INTEGRATION_ID); + $this->_integrationSvcMock->expects($this->any())->method('create')->with($this->anything()) + ->will($this->returnValue($integration)); + $this->_integrationSvcMock->expects($this->any())->method('get')->with(self::INTEGRATION_ID)->will( $this->returnValue(null) ); // Use real translate model - $this->_mockTranslateModel = null; + $this->_translateModelMock = null; // verify success message - $this->_mockBackendModSess->expects($this->once())->method('addSuccess') - ->with(__('The integration \'%1\' has been saved.', $intData[Info::DATA_NAME])); + $this->_messageManager->expects($this->once())->method('addSuccess') + ->with(__('The integration \'%1\' has been saved.', $integration->getName())); $integrationContr = $this->_createIntegrationController(); $integrationContr->saveAction(); } @@ -296,15 +329,15 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase public function testDeleteAction() { $intData = $this->_getSampleIntegrationData(); - $this->_mockRequest->expects($this->once())->method('getParam')->will($this->returnValue('1')); - $this->_mockIntegrationSvc->expects($this->any())->method('get')->with($this->anything()) + $this->_requestMock->expects($this->once())->method('getParam')->will($this->returnValue(self::INTEGRATION_ID)); + $this->_integrationSvcMock->expects($this->any())->method('get')->with($this->anything()) ->will($this->returnValue($intData)); - $this->_mockIntegrationSvc->expects($this->any())->method('delete')->with($this->anything()) + $this->_integrationSvcMock->expects($this->any())->method('delete')->with($this->anything()) ->will($this->returnValue($intData)); // Use real translate model - $this->_mockTranslateModel = null; + $this->_translateModelMock = null; // verify success message - $this->_mockBackendModSess->expects($this->once())->method('addSuccess') + $this->_messageManager->expects($this->once())->method('addSuccess') ->with(__('The integration \'%1\' has been deleted.', $intData[Info::DATA_NAME])); $integrationContr = $this->_createIntegrationController(); $integrationContr->deleteAction(); @@ -314,17 +347,17 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase { $intData = $this->_getSampleIntegrationData(); $intData[Info::DATA_CONSUMER_ID] = 1; - $this->_mockRequest->expects($this->once())->method('getParam')->will($this->returnValue('1')); - $this->_mockIntegrationSvc->expects($this->any())->method('get')->with($this->anything()) + $this->_requestMock->expects($this->once())->method('getParam')->will($this->returnValue(self::INTEGRATION_ID)); + $this->_integrationSvcMock->expects($this->any())->method('get')->with($this->anything()) ->will($this->returnValue($intData)); - $this->_mockIntegrationSvc->expects($this->once())->method('delete')->with($this->anything()) + $this->_integrationSvcMock->expects($this->once())->method('delete')->with($this->anything()) ->will($this->returnValue($intData)); - $this->_mockOauthSvc->expects($this->once())->method('deleteConsumer')->with($this->anything()) + $this->_oauthSvcMock->expects($this->once())->method('deleteConsumer')->with($this->anything()) ->will($this->returnValue($intData)); // Use real translate model - $this->_mockTranslateModel = null; + $this->_translateModelMock = null; // verify success message - $this->_mockBackendModSess->expects($this->once())->method('addSuccess') + $this->_messageManager->expects($this->once())->method('addSuccess') ->with(__('The integration \'%1\' has been deleted.', $intData[Info::DATA_NAME])); $integrationContr = $this->_createIntegrationController(); $integrationContr->deleteAction(); @@ -334,31 +367,31 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase { $intData = $this->_getSampleIntegrationData(); $intData[Info::DATA_SETUP_TYPE] = IntegrationModel::TYPE_CONFIG; - $this->_mockRequest->expects($this->once())->method('getParam')->will($this->returnValue('1')); - $this->_mockIntegrationSvc->expects($this->any())->method('get')->with($this->anything()) + $this->_requestMock->expects($this->once())->method('getParam')->will($this->returnValue(self::INTEGRATION_ID)); + $this->_integrationSvcMock->expects($this->any())->method('get')->with($this->anything()) ->will($this->returnValue($intData)); - $this->_mockIntegrationData->expects($this->once())->method('isConfigType')->with($intData) + $this->_integrationHelperMock->expects($this->once())->method('isConfigType')->with($intData) ->will($this->returnValue(true)); // verify error message - $this->_mockBackendModSess->expects($this->once())->method('addError') + $this->_messageManager->expects($this->once())->method('addError') ->with(__('Uninstall the extension to remove integration \'%1\'.', $intData[Info::DATA_NAME])); - $this->_mockIntegrationSvc->expects($this->never())->method('delete'); + $this->_integrationSvcMock->expects($this->never())->method('delete'); // Use real translate model - $this->_mockTranslateModel = null; + $this->_translateModelMock = null; // verify success message - $this->_mockBackendModSess->expects($this->never())->method('addSuccess'); + $this->_messageManager->expects($this->never())->method('addSuccess'); $integrationContr = $this->_createIntegrationController(); $integrationContr->deleteAction(); } public function testDeleteActionMissingId() { - $this->_mockIntegrationSvc->expects($this->never())->method('get'); - $this->_mockIntegrationSvc->expects($this->never())->method('delete'); + $this->_integrationSvcMock->expects($this->never())->method('get'); + $this->_integrationSvcMock->expects($this->never())->method('delete'); // Use real translate model - $this->_mockTranslateModel = null; + $this->_translateModelMock = null; // verify error message - $this->_mockBackendModSess->expects($this->once())->method('addError') + $this->_messageManager->expects($this->once())->method('addError') ->with(__('Integration ID is not specified or is invalid.')); $integrationContr = $this->_createIntegrationController(); $integrationContr->deleteAction(); @@ -367,16 +400,16 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase public function testDeleteActionForServiceIntegrationException() { $intData = $this->_getSampleIntegrationData(); - $this->_mockIntegrationSvc->expects($this->any())->method('get')->with($this->anything()) + $this->_integrationSvcMock->expects($this->any())->method('get')->with($this->anything()) ->will($this->returnValue($intData)); - $this->_mockRequest->expects($this->once())->method('getParam')->will($this->returnValue('1')); + $this->_requestMock->expects($this->once())->method('getParam')->will($this->returnValue(self::INTEGRATION_ID)); // Use real translate model - $this->_mockTranslateModel = null; + $this->_translateModelMock = null; $exceptionMessage = __("Integration with ID '%1' doesn't exist.", $intData[Info::DATA_ID]); $invalidIdException = new \Magento\Integration\Exception($exceptionMessage); - $this->_mockIntegrationSvc->expects($this->once())->method('delete') + $this->_integrationSvcMock->expects($this->once())->method('delete') ->will($this->throwException($invalidIdException)); - $this->_mockBackendModSess->expects($this->once())->method('addError') + $this->_messageManager->expects($this->once())->method('addError') ->with($exceptionMessage); $integrationContr = $this->_createIntegrationController(); $integrationContr->deleteAction(); @@ -385,21 +418,124 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase public function testDeleteActionForServiceGenericException() { $intData = $this->_getSampleIntegrationData(); - $this->_mockIntegrationSvc->expects($this->any())->method('get')->with($this->anything()) + $this->_integrationSvcMock->expects($this->any())->method('get')->with($this->anything()) ->will($this->returnValue($intData)); - $this->_mockRequest->expects($this->once())->method('getParam')->will($this->returnValue('1')); + $this->_requestMock->expects($this->once())->method('getParam')->will($this->returnValue(self::INTEGRATION_ID)); // Use real translate model - $this->_mockTranslateModel = null; + $this->_translateModelMock = null; $exceptionMessage = __("Integration with ID '%1' doesn't exist.", $intData[Info::DATA_ID]); $invalidIdException = new \Exception($exceptionMessage); - $this->_mockIntegrationSvc->expects($this->once())->method('delete') + $this->_integrationSvcMock->expects($this->once())->method('delete') ->will($this->throwException($invalidIdException)); //Generic Exception(non-Service) should never add the message in session for user display - $this->_mockBackendModSess->expects($this->never())->method('addError'); + $this->_messageManager->expects($this->never())->method('addError'); $integrationContr = $this->_createIntegrationController(); $integrationContr->deleteAction(); } + public function testPermissionsDialog() + { + $controller = $this->_createIntegrationController(); + + $this->_requestMock + ->expects($this->any()) + ->method('getParam') + ->with($this->equalTo(Integration::PARAM_INTEGRATION_ID)) + ->will($this->returnValue(self::INTEGRATION_ID)); + + $this->_integrationSvcMock + ->expects($this->any()) + ->method('get') + ->with($this->equalTo(self::INTEGRATION_ID)) + ->will($this->returnValue($this->_getSampleIntegrationData())); + + // @codingStandardsIgnoreStart + $handle = <<<HANDLE +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <handle id="adminhtml_integration_activate_permissions_webapi"> + <referenceBlock name="integration.activate.permissions.tabs"> + <block class="Magento\Webapi\Block\Adminhtml\Integration\Activate\Permissions\Tab\Webapi" name="integration_activate_permissions_tabs_webapi" template="integration/activate/permissions/tab/webapi.phtml"/> + <action method="addTab"> + <argument name="name" xsi:type="string">integration_activate_permissions_tabs_webapi</argument> + <argument name="block" xsi:type="string">integration_activate_permissions_tabs_webapi</argument> + </action> + </referenceBlock> + </handle> +</layout> +HANDLE; + // @codingStandardsIgnoreEnd + + $layoutUpdates = new LayoutElement($handle); + $this->_registryMock->expects($this->any())->method('register'); + + $this->_layoutMergeMock + ->expects($this->once()) + ->method('getFileLayoutUpdatesXml') + ->will($this->returnValue($layoutUpdates)); + + $this->_viewMock + ->expects($this->once()) + ->method('loadLayout') + ->with($this->equalTo(['adminhtml_integration_activate_permissions_webapi'])); + + $controller->permissionsDialogAction(); + } + + public function testTokensDialog() + { + $controller = $this->_createIntegrationController(); + $this->_registryMock->expects($this->any())->method('register'); + + $this->_requestMock->expects($this->any())->method('getParam')->will($this->returnValueMap([ + [Integration::PARAM_INTEGRATION_ID, null, self::INTEGRATION_ID], + [Integration::PARAM_REAUTHORIZE, 0, 0] + ])); + + $this->_integrationSvcMock + ->expects($this->any()) + ->method('get') + ->with($this->equalTo(self::INTEGRATION_ID)) + ->will($this->returnValue($this->_getIntegrationModelMock())); + + $this->_oauthSvcMock->expects($this->once())->method('createAccessToken')->will($this->returnValue(true)); + + $this->_viewMock->expects($this->any())->method('loadLayout'); + $this->_viewMock->expects($this->any())->method('renderLayout'); + + $controller->tokensDialogAction(); + } + + public function testTokensExchangeReauthorize() + { + $controller = $this->_createIntegrationController(); + + $this->_requestMock->expects($this->any())->method('getParam')->will($this->returnValueMap([ + [Integration::PARAM_INTEGRATION_ID, null, self::INTEGRATION_ID], + [Integration::PARAM_REAUTHORIZE, 0, 1] + ])); + + $this->_integrationSvcMock + ->expects($this->once()) + ->method('get') + ->with($this->equalTo(self::INTEGRATION_ID)) + ->will($this->returnValue($this->_getIntegrationModelMock())); + + $this->_oauthSvcMock->expects($this->once())->method('deleteToken'); + $this->_oauthSvcMock->expects($this->once())->method('postToConsumer'); + + $this->_messageManager->expects($this->once())->method('addNotice'); + $this->_messageManager->expects($this->never())->method('addError'); + $this->_messageManager->expects($this->never())->method('addSuccess'); + + $this->_viewMock->expects($this->once())->method('loadLayout'); + $this->_viewMock->expects($this->once())->method('renderLayout'); + + $this->_responseMock->expects($this->once())->method('getBody'); + $this->_responseMock->expects($this->once())->method('setBody'); + + $controller->tokensExchangeAction(); + } + /** * Creates the IntegrationController to test. * @@ -408,16 +544,18 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase protected function _createIntegrationController() { // Mock Layout passed into constructor - $viewMock = $this->getMock('Magento\App\ViewInterface'); - $layoutMock = $this->getMock('Magento\View\LayoutInterface'); - $layoutMergeMock = $this->getMockBuilder('Magento\Core\Model\Layout\Merge') + $this->_viewMock = $this->getMock('Magento\App\ViewInterface'); + $this->_layoutMock = $this->getMock('Magento\View\LayoutInterface'); + $this->_layoutMergeMock = $this->getMockBuilder('Magento\Core\Model\Layout\Merge') ->disableOriginalConstructor() ->getMock(); - $layoutMock->expects($this->any())->method('getUpdate')->will($this->returnValue($layoutMergeMock)); + $this->_layoutMock->expects($this->any()) + ->method('getUpdate') + ->will($this->returnValue($this->_layoutMergeMock)); $testElement = new \Magento\Simplexml\Element('<test>test</test>'); - $layoutMock->expects($this->any())->method('getNode')->will($this->returnValue($testElement)); + $this->_layoutMock->expects($this->any())->method('getNode')->will($this->returnValue($testElement)); // for _setActiveMenu - $viewMock->expects($this->any())->method('getLayout')->will($this->returnValue($layoutMock)); + $this->_viewMock->expects($this->any())->method('getLayout')->will($this->returnValue($this->_layoutMock)); $blockMock = $this->getMockBuilder('Magento\Backend\Block\Menu') ->disableOriginalConstructor() ->getMock(); @@ -430,37 +568,38 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase $loggerMock->expects($this->any())->method('logException')->will($this->returnSelf()); $menuMock->expects($this->any())->method('getParentItems')->will($this->returnValue(array())); $blockMock->expects($this->any())->method('getMenuModel')->will($this->returnValue($menuMock)); - $layoutMock->expects($this->any())->method('getMessagesBlock')->will($this->returnValue($blockMock)); - $layoutMock->expects($this->any())->method('getBlock')->will($this->returnValue($blockMock)); + $this->_layoutMock->expects($this->any())->method('getMessagesBlock')->will($this->returnValue($blockMock)); + $this->_layoutMock->expects($this->any())->method('getBlock')->will($this->returnValue($blockMock)); $contextParameters = array( - 'view' => $viewMock, - 'objectManager' => $this->_mockObjectManager, - 'session' => $this->_mockBackendModSess, - 'translator' => $this->_mockTranslateModel, - 'request' => $this->_mockRequest, - 'response' => $this->_mockResponse, + 'view' => $this->_viewMock, + 'objectManager' => $this->_objectManagerMock, + 'session' => $this->_backendSessionMock, + 'translator' => $this->_translateModelMock, + 'request' => $this->_requestMock, + 'response' => $this->_responseMock, + 'messageManager' => $this->_messageManager ); - $this->_mockBackendCntCtxt = $this->_objectManagerHelper + $this->_backendActionCtxMock = $this->_objectManagerHelper ->getObject( 'Magento\Backend\App\Action\Context', $contextParameters ); $subControllerParams = array( - 'context' => $this->_mockBackendCntCtxt, - 'integrationService' => $this->_mockIntegrationSvc, - 'oauthService' => $this->_mockOauthSvc, - 'registry' => $this->_mockRegistry, + 'context' => $this->_backendActionCtxMock, + 'integrationService' => $this->_integrationSvcMock, + 'oauthService' => $this->_oauthSvcMock, + 'registry' => $this->_registryMock, 'logger' => $loggerMock, - 'integrationData' => $this->_mockIntegrationData + 'integrationData' => $this->_integrationHelperMock ); /** Create IntegrationController to test */ - $integrationContr = $this->_objectManagerHelper + $controller = $this->_objectManagerHelper ->getObject( 'Magento\Integration\Controller\Adminhtml\Integration', $subControllerParams ); - return $integrationContr; + return $controller; } /** @@ -471,13 +610,13 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase protected function _verifyLoadAndRenderLayout() { $map = array( - array('Magento\Core\Model\Config', $this->_mockConfig), - array('Magento\Core\Model\Layout\Filter\Acl', $this->_mockLayoutFilter), - array('Magento\Backend\Model\Session', $this->_mockBackendModSess), - array('Magento\Core\Model\Translate', $this->_mockTranslateModel), - array('Magento\Config\ScopeInterface', $this->_mockConfigScope) + array('Magento\Core\Model\Config', $this->_configMock), + array('Magento\Core\Model\Layout\Filter\Acl', $this->_layoutFilterMock), + array('Magento\Backend\Model\Session', $this->_backendSessionMock), + array('Magento\Core\Model\Translate', $this->_translateModelMock), + array('Magento\Config\ScopeInterface', $this->_configScopeMock) ); - $this->_mockObjectManager->expects($this->any()) + $this->_objectManagerMock->expects($this->any()) ->method('get') ->will($this->returnValueMap($map)); } @@ -485,16 +624,37 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase /** * Return sample Integration Data * - * @return array + * @return \Magento\Object */ protected function _getSampleIntegrationData() { return new \Magento\Object(array( Info::DATA_NAME => 'nameTest', - Info::DATA_ID => '1', + Info::DATA_ID => self::INTEGRATION_ID, + 'id' => self::INTEGRATION_ID, // This will allow usage of both getIntegrationId() and getId() Info::DATA_EMAIL => 'test@magento.com', Info::DATA_ENDPOINT => 'http://magento.ll/endpoint', Info::DATA_SETUP_TYPE => IntegrationModel::TYPE_MANUAL )); } + + /** + * Return integration model mock with sample data. + * + * @return \Magento\Integration\Model\Integration|\PHPUnit_Framework_MockObject_MockObject + */ + protected function _getIntegrationModelMock() + { + $integrationModelMock = $this->getMock( + 'Magento\Integration\Model\Integration', ['save', '__wakeup'], [], '', false + ); + + $integrationModelMock->expects($this->any())->method('setStatus')->will($this->returnSelf()); + $integrationModelMock + ->expects($this->any()) + ->method('getData') + ->will($this->returnValue($this->_getSampleIntegrationData())); + + return $integrationModelMock; + } } diff --git a/dev/tests/unit/testsuite/Magento/Integration/Model/Config/XsdTest.php b/dev/tests/unit/testsuite/Magento/Integration/Model/Config/XsdTest.php index 59ab1cd6f0f..b7c3886bb15 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Model/Config/XsdTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Model/Config/XsdTest.php @@ -65,6 +65,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase <integration name="TestIntegration"> <email>test-integration@magento.com</email> <endpoint_url>https://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> </integrations>', array() @@ -74,6 +75,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase <integration name="TestIntegration1"> <email>test-integration1@magento.com</email> <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> <integration name="TestIntegration2"> <email>test-integration2@magento.com</email> @@ -97,6 +99,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase '<integrations> <integration name="TestIntegration1"> <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> </integrations>', array("Element 'endpoint_url': This element is not expected. Expected is ( email ).") @@ -108,6 +111,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase <integration name="TestIntegration1"> <email></email> <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> </integrations>', array( @@ -129,7 +133,20 @@ class XsdTest extends \PHPUnit_Framework_TestCase "Element 'endpoint_url': '' is not a valid value of the atomic type 'urlType'." ) ), - + 'identity_link_url is empty' => array( + '<integrations> + <integration name="TestIntegration1"> + <email>test-integration1@magento.com</email> + <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url></identity_link_url> + </integration> + </integrations>', + array( + "Element 'identity_link_url': [facet 'minLength'] The value has a length of '0'; this underruns" + . " the allowed minimum length of '4'.", + "Element 'identity_link_url': '' is not a valid value of the atomic type 'urlType'." + ) + ), /** Invalid structure */ 'irrelevant root node' => array( '<integration name="TestIntegration"/>', @@ -140,6 +157,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase <integration name="TestIntegration1"> <email>test-integration1@magento.com</email> <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> <invalid/> </integrations>', @@ -150,6 +168,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase <integration name="TestIntegration1"> <email>test-integration1@magento.com</email> <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> <invalid/> </integration> </integrations>', @@ -160,6 +179,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase <integration name="TestIntegration1"> <email>test-integration1@magento.com</email> <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> <invalid/> </integration> </integrations>', @@ -172,6 +192,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase <integration name="TestIntegration1"> <email>test-integration1@magento.com</email> <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> </integrations>', array("Element 'integrations', attribute 'invalid': The attribute 'invalid' is not allowed.") @@ -181,6 +202,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase <integration name="TestIntegration1" invalid="invalid"> <email>test-integration1@magento.com</email> <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> </integrations>', array("Element 'integration', attribute 'invalid': The attribute 'invalid' is not allowed.") @@ -190,6 +212,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase <integration name="TestIntegration1"> <email invalid="invalid">test-integration1@magento.com</email> <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> </integrations>', array("Element 'email', attribute 'invalid': The attribute 'invalid' is not allowed.") @@ -199,17 +222,28 @@ class XsdTest extends \PHPUnit_Framework_TestCase <integration name="TestIntegration1"> <email>test-integration1@magento.com</email> <endpoint_url invalid="invalid">http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> </integrations>', array("Element 'endpoint_url', attribute 'invalid': The attribute 'invalid' is not allowed.") ), - + 'invalid attribute in identity_link_url' => array( + '<integrations> + <integration name="TestIntegration1"> + <email>test-integration1@magento.com</email> + <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url invalid="invalid">http://endpoint.url</identity_link_url> + </integration> + </integrations>', + array("Element 'identity_link_url', attribute 'invalid': The attribute 'invalid' is not allowed.") + ), /** Missing or empty required attributes */ 'integration without name' => array( '<integrations> <integration> <email>test-integration1@magento.com</email> <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> </integrations>', array("Element 'integration': The attribute 'name' is required but missing.") @@ -219,6 +253,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase <integration name=""> <email>test-integration1@magento.com</email> <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> </integrations>', array @@ -236,6 +271,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase <integration name="TestIntegration1"> <email>invalid</email> <endpoint_url>http://endpoint.url</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> </integrations>', array("Element 'email': [facet 'pattern'] The value 'invalid' " diff --git a/dev/tests/unit/testsuite/Magento/Integration/Model/Config/_files/integration.php b/dev/tests/unit/testsuite/Magento/Integration/Model/Config/_files/integration.php index 0ceac5204a7..987b9aca32f 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Model/Config/_files/integration.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Model/Config/_files/integration.php @@ -24,7 +24,8 @@ return array( 'TestIntegration1' => array( 'email' => 'test-integration1@magento.com', - 'endpoint_url' => 'http://endpoint.com' + 'endpoint_url' => 'http://endpoint.com', + 'identity_link_url' => 'http://www.example.com/identity' ), 'TestIntegration2' => array( 'email' => 'test-integration2@magento.com' diff --git a/dev/tests/unit/testsuite/Magento/Integration/Model/Config/_files/integration.xml b/dev/tests/unit/testsuite/Magento/Integration/Model/Config/_files/integration.xml index bd9569b0a2f..cd0c9121bf6 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Model/Config/_files/integration.xml +++ b/dev/tests/unit/testsuite/Magento/Integration/Model/Config/_files/integration.xml @@ -27,6 +27,7 @@ <integration name="TestIntegration1"> <email>test-integration1@magento.com</email> <endpoint_url>http://endpoint.com</endpoint_url> + <identity_link_url>http://www.example.com/identity</identity_link_url> </integration> <integration name="TestIntegration2"> <email>test-integration2@magento.com</email> diff --git a/dev/tests/unit/testsuite/Magento/Integration/Model/ManagerTest.php b/dev/tests/unit/testsuite/Magento/Integration/Model/ManagerTest.php index 60e2d3406f3..a03f68e1f9a 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Model/ManagerTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Model/ManagerTest.php @@ -90,7 +90,8 @@ class ManagerTest extends \PHPUnit_Framework_TestCase array( 'TestIntegration1' => array( 'email' => 'test-integration1@magento.com', - 'endpoint_url' => 'http://endpoint.com' + 'endpoint_url' => 'http://endpoint.com', + 'identity_link_url' => 'http://www.example.com/identity' ), 'TestIntegration2' => array( 'email' => 'test-integration2@magento.com' @@ -109,6 +110,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase Integration::NAME => 'TestIntegration1', Integration::EMAIL => 'test-integration1@magento.com', Integration::ENDPOINT => 'http://endpoint.com', + Integration::IDENTITY_LINK_URL => 'http://www.example.com/identity', Integration::SETUP_TYPE => 1, ); diff --git a/dev/tests/unit/testsuite/Magento/Integration/Service/IntegrationV1Test.php b/dev/tests/unit/testsuite/Magento/Integration/Service/IntegrationV1Test.php index f621310fa8e..c40969f9ec9 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Service/IntegrationV1Test.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Service/IntegrationV1Test.php @@ -36,6 +36,7 @@ class IntegrationV1Test extends \PHPUnit_Framework_TestCase const VALUE_INTEGRATION_EMAIL = 'test@magento.com'; const VALUE_INTEGRATION_SETUP_BACKEND = 0; const VALUE_INTEGRATION_ENDPOINT = 'http://magento.ll/endpoint'; + const VALUE_INTEGRATION_CONSUMER_ID = 1; /** @var \PHPUnit_Framework_MockObject_MockObject */ private $_integrationFactory; @@ -333,6 +334,36 @@ class IntegrationV1Test extends \PHPUnit_Framework_TestCase $this->_service->delete(self::VALUE_INTEGRATION_ID); } + public function testFindByConsumerId() + { + $this->_integrationMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue($this->_integrationData)); + + $this->_integrationMock->expects($this->once()) + ->method('load') + ->with(self::VALUE_INTEGRATION_CONSUMER_ID, 'consumer_id') + ->will($this->returnValue($this->_integrationMock)); + + $integration = $this->_service->findByConsumerId(self::VALUE_INTEGRATION_CONSUMER_ID); + $this->assertEquals($this->_integrationData[Integration::NAME], $integration->getData()[Integration::NAME]); + } + + public function testFindByConsumerIdNotFound() + { + $this->_emptyIntegrationMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue(null)); + + $this->_integrationMock->expects($this->once()) + ->method('load') + ->with(self::VALUE_INTEGRATION_CONSUMER_ID, 'consumer_id') + ->will($this->returnValue($this->_emptyIntegrationMock)); + + $integration = $this->_service->findByConsumerId(1); + $this->assertNull($integration->getData()); + } + /** * Set valid integration data */ diff --git a/dev/tests/unit/testsuite/Magento/Integration/Service/OauthV1Test.php b/dev/tests/unit/testsuite/Magento/Integration/Service/OauthV1Test.php index c2db478ba0b..72141aad62f 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Service/OauthV1Test.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Service/OauthV1Test.php @@ -27,31 +27,64 @@ namespace Magento\Integration\Service; use Magento\Integration\Model\Integration; +use Magento\Oauth\OauthInterface; +use Magento\Integration\Model\Oauth\Token; class OauthV1Test extends \PHPUnit_Framework_TestCase { const VALUE_CONSUMER_ID = 1; + const VALUE_CONSUMER_KEY = 'asdfghjklaqwerfdtyuiomnbgfdhbsoi'; + const VALUE_TOKEN_TYPE = 'access'; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Integration\Model\Oauth\Consumer\Factory|\PHPUnit_Framework_MockObject_MockObject */ protected $_consumerFactory; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Integration\Model\Oauth\Token\Provider|\PHPUnit_Framework_MockObject_MockObject */ + protected $_tokenProviderMock; + + /** @var \Magento\Integration\Model\Oauth\Consumer|\PHPUnit_Framework_MockObject_MockObject */ private $_consumerMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Integration\Model\Integration|\PHPUnit_Framework_MockObject_MockObject */ private $_emptyConsumerMock; + /** + * @var \Magento\Integration\Model\Oauth\Token|\PHPUnit_Framework_MockObject_MockObject + */ + private $_tokenMock; + /** @var \Magento\Integration\Service\OauthV1 */ private $_service; /** @var array */ private $_consumerData; + /** + * @var \Magento\Integration\Model\Oauth\Token\Factory|\PHPUnit_Framework_MockObject_MockObject + */ + private $_tokenFactoryMock; + protected function setUp() { $this->_consumerFactory = $this->getMockBuilder('Magento\Integration\Model\Oauth\Consumer\Factory') ->disableOriginalConstructor() ->getMock(); + $this->_tokenProviderMock = $this->getMockBuilder('Magento\Integration\Model\Oauth\Token\Provider') + ->disableOriginalConstructor() + ->getMock(); + $this->_tokenMock = $this->getMockBuilder('Magento\Integration\Model\Oauth\Token') + ->disableOriginalConstructor() + ->setMethods( + [ + 'createVerifierToken', + 'getType', + '__wakeup', + 'delete' + ] + ) + ->getMock(); + + $this->_tokenFactoryMock = $this->getMock('Magento\Integration\Model\Oauth\Token\Factory', [], [], '', false); $this->_consumerMock = $this->getMockBuilder('Magento\Integration\Model\Oauth\Consumer') ->disableOriginalConstructor() ->setMethods( @@ -67,7 +100,7 @@ class OauthV1Test extends \PHPUnit_Framework_TestCase ->getMock(); $this->_consumerData = array( 'entity_id' => self::VALUE_CONSUMER_ID, - 'key' => 'jhgjhgjgjiyuiuyuyhhhjkjlklkj', + 'key' => self::VALUE_CONSUMER_KEY, 'secret' => 'iuyytrfdsdfbnnhbmkkjlkjl', 'created_at' => '', 'updated_at' => '', @@ -81,12 +114,12 @@ class OauthV1Test extends \PHPUnit_Framework_TestCase $this->_service = new \Magento\Integration\Service\OauthV1( $this->getMock('Magento\Core\Model\StoreManagerInterface', [], [], '', false), $this->_consumerFactory, - $this->getMock('Magento\Integration\Model\Oauth\Token\Factory', [], [], '', false), + $this->_tokenFactoryMock, $this->getMock('Magento\Integration\Helper\Oauth\Data', [], [], '', false), $this->getMock('Magento\HTTP\ZendClient', [], [], '', false), $this->getMock('Magento\Logger', [], [], '', false), $this->getMock('Magento\Oauth\Helper\Oauth', [], [], '', false), - $this->getMock('Magento\Integration\Model\Oauth\Token\Provider', [], [], '', false) + $this->_tokenProviderMock ); $this->_emptyConsumerMock = $this->getMockBuilder('Magento\Integration\Model\Integration') ->disableOriginalConstructor() @@ -141,4 +174,218 @@ class OauthV1Test extends \PHPUnit_Framework_TestCase ->method('delete'); $this->_service->deleteConsumer(self::VALUE_CONSUMER_ID); } + + public function testCreateAccessTokenAndClearExisting() + { + + $this->_consumerMock->expects($this->any()) + ->method('load') + ->with(self::VALUE_CONSUMER_ID) + ->will($this->returnValue($this->_consumerMock)); + + $this->_tokenProviderMock->expects($this->any()) + ->method('getTokenByConsumerId') + ->will($this->returnValue($this->_tokenMock)); + + $this->_tokenProviderMock->expects($this->any()) + ->method('createRequestToken') + ->with($this->_consumerMock); + + $this->_tokenProviderMock->expects($this->any()) + ->method('getAccessToken') + ->with($this->_consumerMock); + + $this->_tokenFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->_tokenMock)); + + $this->_tokenMock->expects($this->once()) + ->method('delete'); + + $this->_tokenMock->expects($this->once()) + ->method('createVerifierToken') + ->with(self::VALUE_CONSUMER_ID); + + $this->_tokenProviderMock->expects($this->once()) + ->method('createRequestToken') + ->with($this->_consumerMock); + + $this->_tokenProviderMock->expects($this->once()) + ->method('getAccessToken') + ->with($this->_consumerMock); + + $this->assertTrue($this->_service->createAccessToken(self::VALUE_CONSUMER_ID, true)); + } + + public function testCreateAccessTokenWithoutClearingExisting() + { + $this->_consumerMock->expects($this->any()) + ->method('load') + ->with(self::VALUE_CONSUMER_ID) + ->will($this->returnValue($this->_consumerMock)); + + $this->_tokenProviderMock->expects($this->any()) + ->method('getTokenByConsumerId') + ->will($this->returnValue($this->_tokenMock)); + + $this->_tokenMock->expects($this->never()) + ->method('delete'); + + $this->assertFalse($this->_service->createAccessToken(self::VALUE_CONSUMER_ID, false)); + } + + public function testCreateAccessTokenInvalidConsumerId() + { + $this->_consumerMock->expects($this->any()) + ->method('load') + ->with(0) + ->will($this->returnValue($this->_consumerMock)); + + $this->_tokenProviderMock->expects($this->any()) + ->method('getTokenByConsumerId') + ->will($this->throwException( + new \Magento\Oauth\Exception( + 'A token with consumer ID 0 does not exist', + OauthInterface::ERR_TOKEN_REJECTED + ) + )); + + $this->_tokenMock->expects($this->never()) + ->method('delete'); + + $this->_tokenFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->_tokenMock)); + + $this->_tokenMock->expects($this->once()) + ->method('createVerifierToken'); + + $this->_tokenProviderMock->expects($this->once()) + ->method('createRequestToken'); + + $this->_tokenProviderMock->expects($this->once()) + ->method('getAccessToken'); + + $this->assertTrue($this->_service->createAccessToken(0, false)); + } + + public function testLoadConsumer() + { + $this->_consumerMock->expects($this->once()) + ->method('load') + ->with(self::VALUE_CONSUMER_ID) + ->will($this->returnValue($this->_consumerMock)); + $this->_consumerMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue($this->_consumerData)); + $consumer = $this->_service->loadConsumer(self::VALUE_CONSUMER_ID); + $consumerData = $consumer->getData(); + $this->assertEquals($this->_consumerData['entity_id'], $consumerData['entity_id']); + } + + /** + * @expectedException \Magento\Oauth\Exception + * @expectedExceptionMessage Unexpected error. Unable to load oAuth consumer account. + */ + public function testLoadConsumerException() + { + $this->_consumerMock->expects($this->once()) + ->method('load') + ->will($this->throwException( + new \Magento\Oauth\Exception('Unexpected error. Unable to load oAuth consumer account.'))); + $this->_service->loadConsumer(self::VALUE_CONSUMER_ID); + } + + public function testLoadConsumerByKey() + { + $this->_consumerMock->expects($this->once()) + ->method('load') + ->with(self::VALUE_CONSUMER_KEY, 'key') + ->will($this->returnValue($this->_consumerMock)); + $this->_consumerMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue($this->_consumerData)); + $consumer = $this->_service->loadConsumerByKey(self::VALUE_CONSUMER_KEY); + $consumerData = $consumer->getData(); + $this->assertEquals($this->_consumerData['key'], $consumerData['key']); + } + + /** + * @expectedException \Magento\Oauth\Exception + * @expectedExceptionMessage Unexpected error. Unable to load oAuth consumer account. + */ + public function testLoadConsumerByKeyException() + { + $this->_consumerMock->expects($this->once()) + ->method('load') + ->will($this->throwException( + new \Magento\Oauth\Exception('Unexpected error. Unable to load oAuth consumer account.'))); + $this->_service->loadConsumerByKey(self::VALUE_CONSUMER_KEY); + } + + public function testDeleteToken() + { + $this->_consumerMock->expects($this->any()) + ->method('load') + ->with(self::VALUE_CONSUMER_ID) + ->will($this->returnValue($this->_consumerMock)); + + $this->_tokenProviderMock->expects($this->any()) + ->method('getTokenByConsumerId') + ->will($this->returnValue($this->_tokenMock)); + + $this->_tokenMock->expects($this->once()) + ->method('delete'); + + $this->assertTrue($this->_service->deleteToken(self::VALUE_CONSUMER_ID)); + } + + public function testDeleteTokenNegative() + { + $this->_consumerMock->expects($this->any()) + ->method('load') + ->with(self::VALUE_CONSUMER_ID) + ->will($this->returnValue($this->_consumerMock)); + + $this->_tokenProviderMock->expects($this->any()) + ->method('getTokenByConsumerId') + ->will($this->returnValue($this->_tokenMock)); + + $this->_tokenMock->expects($this->never()) + ->method('delete'); + + $this->assertFalse($this->_service->deleteToken(null)); + } + + public function testGetAccessTokenNoAccess() + { + $this->_consumerMock->expects($this->any()) + ->method('load') + ->with(self::VALUE_CONSUMER_ID) + ->will($this->returnValue($this->_consumerMock)); + + $this->_tokenProviderMock->expects($this->any()) + ->method('getTokenByConsumerId') + ->will($this->returnValue($this->_tokenMock)); + + $this->assertFalse($this->_service->getAccessToken(self::VALUE_CONSUMER_ID), false); + } + + public function testGetAccessSuccess() + { + $this->_consumerMock->expects($this->any()) + ->method('load') + ->with(self::VALUE_CONSUMER_ID) + ->will($this->returnValue($this->_consumerMock)); + + $this->_tokenMock->expects($this->once()) + ->method('getType') + ->will($this->returnValue(Token::TYPE_ACCESS)); + + $this->_tokenProviderMock->expects($this->any()) + ->method('getTokenByConsumerId') + ->will($this->returnValue($this->_tokenMock)); + + $this->assertEquals($this->_service->getAccessToken(self::VALUE_CONSUMER_ID), $this->_tokenMock); + } } diff --git a/dev/tests/unit/testsuite/Magento/Interception/Config/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Interception/Config/ConfigTest.php index 86c468739fd..e21ff3cf3b7 100644 --- a/dev/tests/unit/testsuite/Magento/Interception/Config/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Interception/Config/ConfigTest.php @@ -46,14 +46,26 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $fixtureBasePath = __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/..'); + $fixtureBasePath = __DIR__ . '/..'; $fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $fileResolverMock->expects($this->any()) ->method('get') ->will($this->returnValueMap(array( - array('di.xml', 'global', array($fixtureBasePath . '/Custom/Module/etc/di.xml')), - array('di.xml', 'backend', array($fixtureBasePath . '/Custom/Module/etc/backend/di.xml')), - array('di.xml', 'frontend', array($fixtureBasePath . '/Custom/Module/etc/frontend/di.xml')), + array( + 'di.xml', + 'global', + array(file_get_contents($fixtureBasePath . '/Custom/Module/etc/di.xml')) + ), + array( + 'di.xml', + 'backend', + array(file_get_contents($fixtureBasePath . '/Custom/Module/etc/backend/di.xml')) + ), + array( + 'di.xml', + 'frontend', + array(file_get_contents($fixtureBasePath . '/Custom/Module/etc/frontend/di.xml')) + ), ))); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); diff --git a/dev/tests/unit/testsuite/Magento/Interception/PluginList/PluginListTest.php b/dev/tests/unit/testsuite/Magento/Interception/PluginList/PluginListTest.php index ed249d83339..2d6a2421aae 100644 --- a/dev/tests/unit/testsuite/Magento/Interception/PluginList/PluginListTest.php +++ b/dev/tests/unit/testsuite/Magento/Interception/PluginList/PluginListTest.php @@ -46,14 +46,18 @@ class PluginListTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $fixtureBasePath = __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/..'); + $fixtureBasePath = __DIR__ . '/..'; + $moduleEtcPath = $fixtureBasePath . '/Custom/Module/etc/di.xml'; + $moduleBackendEtcPath = $fixtureBasePath . '/Custom/Module/etc/backend/di.xml'; + $moduleFrontendEtcPath = $fixtureBasePath . '/Custom/Module/etc/frontend/di.xml'; + $fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $fileResolverMock->expects($this->any()) ->method('get') ->will($this->returnValueMap(array( - array('di.xml', 'global', array($fixtureBasePath . '/Custom/Module/etc/di.xml')), - array('di.xml', 'backend', array($fixtureBasePath . '/Custom/Module/etc/backend/di.xml')), - array('di.xml', 'frontend', array($fixtureBasePath . '/Custom/Module/etc/frontend/di.xml')), + array('di.xml', 'global', array($moduleEtcPath => file_get_contents($moduleEtcPath))), + array('di.xml', 'backend', array($moduleBackendEtcPath => file_get_contents($moduleBackendEtcPath))), + array('di.xml', 'frontend', array($moduleFrontendEtcPath => file_get_contents($moduleFrontendEtcPath))), ))); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); diff --git a/dev/tests/unit/testsuite/Magento/Io/FileTest.php b/dev/tests/unit/testsuite/Magento/Io/FileTest.php deleted file mode 100644 index d26bfaca7a1..00000000000 --- a/dev/tests/unit/testsuite/Magento/Io/FileTest.php +++ /dev/null @@ -1,92 +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. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * \Magento\Io\File test case - */ -namespace Magento\Io; - -class FileTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var string $_dir - */ - protected $_dir; - - /** - * @var string $_file - */ - protected $_file; - - protected function setUp() - { - try { - $this->_dir = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'directory'; - $this->_file = $this->_dir . DIRECTORY_SEPARATOR . 'file.txt'; - mkdir($this->_dir, 0700, true); - if (touch($this->_file)) { - chmod($this->_file, 0700); - } - } catch (\PHPUnit_Framework_Error_Warning $exception) { - $this->markTestSkipped("Problem with prepare test: " . $exception->getMessage()); - } - } - - protected function tearDown() - { - if (@file_exists($this->_file)) { - @unlink($this->_file); - } - if (@file_exists($this->_dir)) { - @rmdir($this->_dir); - } - } - - public function testChmodRecursive() - { - if (substr(PHP_OS, 0, 3) == 'WIN') { - $this->markTestSkipped("chmod may not work for Windows"); - } - - $permsBefore = 0700; - $expected = 0777; - $this->assertEquals($permsBefore, fileperms($this->_dir) & $permsBefore, - "Wrong permissions set for " . $this->_dir); - $this->assertEquals($permsBefore, fileperms($this->_file) & $permsBefore, - "Wrong permissions set for " . $this->_file); - \Magento\Io\File::chmodRecursive($this->_dir, $expected); - $this->assertEquals($expected, fileperms($this->_dir) & $expected, - "Directory permissions were changed incorrectly."); - $this->assertEquals($expected, fileperms($this->_file) & $expected, - "File permissions were changed incorrectly."); - - } - - public function testRmdirRecursive() - { - $this->assertFileExists($this->_file); - \Magento\Io\File::rmdirRecursive($this->_dir); - $this->assertFileNotExists($this->_dir); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Log/LoggerTest.php b/dev/tests/unit/testsuite/Magento/Log/LoggerTest.php index 0e661d98e14..1232c0ae91f 100644 --- a/dev/tests/unit/testsuite/Magento/Log/LoggerTest.php +++ b/dev/tests/unit/testsuite/Magento/Log/LoggerTest.php @@ -23,6 +23,9 @@ */ namespace Magento\Log; +use Magento\Filesystem, + Magento\Filesystem\Directory\Write; + class LoggerTest extends \PHPUnit_Framework_TestCase { /** @@ -40,16 +43,35 @@ class LoggerTest extends \PHPUnit_Framework_TestCase */ protected $_filesystemMock; + /** + * @var Write | \PHPUnit_Framework_MockObject_MockObject + */ + protected $_directory; + protected function setUp() { - $this->_filesystemMock = $this->getMock('Magento\Io\File', array(), array(), '', false, false); - $dirs = new \Magento\App\Dir(TESTS_TEMP_DIR); - $logDir = $dirs->getDir(\Magento\App\Dir::LOG); + $logDir = TESTS_TEMP_DIR . '/var/log'; + $this->_filesystemMock = $this->getMock('Magento\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) + ->will($this->returnValue($this->_directory)); + $this->_directory->expects($this->any()) + ->method('create') + ->will($this->returnValue(true)); + $this->_directory->expects($this->any()) + ->method('getAbsolutePath') + ->will($this->returnArgument(0)); + $this->_directory->expects($this->any()) + ->method('getRelativePath') + ->will($this->returnValue($logDir)); + if (!is_dir($logDir)) { mkdir($logDir, 0777, true); } - $this->_model = new \Magento\Logger($dirs, $this->_filesystemMock); + $this->_model = new \Magento\Logger($this->_filesystemMock); $this->_loggersProperty = new \ReflectionProperty($this->_model, '_loggers'); $this->_loggersProperty->setAccessible(true); } @@ -101,7 +123,6 @@ class LoggerTest extends \PHPUnit_Framework_TestCase */ public function testAddLogWithSpecificKey() { - $this->_filesystemMock->expects($this->once())->method('checkAndCreateFolder'); $key = uniqid(); $this->_model->addStreamLog($key); $this->assertTrue($this->_model->hasLog($key)); diff --git a/dev/tests/unit/testsuite/Magento/Log/Model/ShellTest.php b/dev/tests/unit/testsuite/Magento/Log/Model/ShellTest.php index 9fbb9b1636a..9ac63e6909c 100644 --- a/dev/tests/unit/testsuite/Magento/Log/Model/ShellTest.php +++ b/dev/tests/unit/testsuite/Magento/Log/Model/ShellTest.php @@ -44,10 +44,9 @@ class ShellTest extends \PHPUnit_Framework_TestCase { $this->_factoryMock = $this->getMock('Magento\Log\Model\Shell\Command\Factory', array(), array(), '', false); $filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $dirMock = $this->getMock('Magento\App\Dir', array(), array(), '', false); $this->_model = $this->getMock('Magento\Log\Model\Shell', array('_applyPhpVariables'), - array($filesystemMock, 'entryPoint.php', $dirMock, $this->_factoryMock) + 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 new file mode 100644 index 00000000000..1e718ff0119 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Message/AbstractMessageTest.php @@ -0,0 +1,116 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Message; + +/** + * \Magento\Message\AbstractMessage test case + */ +class AbstractMessageTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Message\AbstractMessage + */ + protected $model; + + public function setUp() + { + $this->model = $this->getMockBuilder('Magento\Message\AbstractMessage') + ->disableOriginalConstructor() + ->setMethods(array('getType')) + ->getMockForAbstractClass(); + } + + /** + * @cover \Magento\Message\AbstractMessage::getText + * @cover \Magento\Message\AbstractMessage::setText + * @dataProvider setTextGetTextProvider + */ + public function testSetTextGetText($text) + { + $this->model->setText($text); + $this->assertEquals($text, $this->model->getText()); + } + + /** + * @return array + */ + public function setTextGetTextProvider() + { + return array( + array(''), + array('some text'), + ); + } + + /** + * @cover \Magento\Message\AbstractMessage::getIdentifier + * @cover \Magento\Message\AbstractMessage::setIdentifier + * @dataProvider setIdentifierGetIdentifierProvider + */ + public function testSetIdentifierGetIdentifier($identifier) + { + $this->model->setIdentifier($identifier); + $this->assertEquals($identifier, $this->model->getIdentifier()); + } + + /** + * @return array + */ + public function setIdentifierGetIdentifierProvider() + { + return array( + array(''), + array('some identifier'), + ); + } + + /** + * @cover \Magento\Message\AbstractMessage::getIsSticky + * @cover \Magento\Message\AbstractMessage::setIsSticky + */ + public function testSetIsStickyGetIsSticky() + { + $this->assertFalse($this->model->getIsSticky()); + $this->model->setIsSticky(); + $this->assertTrue($this->model->getIsSticky()); + } + + /** + * @cover \Magento\Message\AbstractMessage::toString + */ + public function testToString() + { + $someText = 'some text'; + $expectedString = MessageInterface::TYPE_SUCCESS . ': ' . $someText; + + $this->model + ->expects($this->atLeastOnce()) + ->method('getType') + ->will($this->returnValue(MessageInterface::TYPE_SUCCESS)); + + $this->model->setText($someText); + $this->assertEquals($expectedString, $this->model->toString()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Message/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Message/CollectionTest.php new file mode 100644 index 00000000000..cb93b57580b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Message/CollectionTest.php @@ -0,0 +1,228 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Message; + +/** + * \Magento\Message\Collection test case + */ +class CollectionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Message\Collection + */ + protected $model; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + public function setUp() + { + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->model = $this->objectManager->getObject('Magento\Message\Collection'); + } + + /** + * @cover \Magento\Message\Collection::addMessage + * @cover \Magento\Message\Collection::getItemsByType + */ + public function testAddMessage() + { + $messages = array( + $this->objectManager->getObject('Magento\Message\Error'), + $this->objectManager->getObject('Magento\Message\Error'), + $this->objectManager->getObject('Magento\Message\Error'), + ); + + foreach ($messages as $message) { + $this->model->addMessage($message); + } + + $this->assertEquals($messages, $this->model->getItemsByType(MessageInterface::TYPE_ERROR)); + $this->assertEmpty($this->model->getItemsByType(MessageInterface::TYPE_SUCCESS)); + $this->assertEmpty($this->model->getItemsByType(MessageInterface::TYPE_NOTICE)); + $this->assertEmpty($this->model->getItemsByType(MessageInterface::TYPE_WARNING)); + } + + /** + * @cover \Magento\Message\Collection::addMessage + * @cover \Magento\Message\Collection::getItems + * @cover \Magento\Message\Collection::getLastAddedMessage + */ + public function testGetItems() + { + $messages = array( + $this->objectManager->getObject('Magento\Message\Error'), + $this->objectManager->getObject('Magento\Message\Notice'), + $this->objectManager->getObject('Magento\Message\Notice'), + $this->objectManager->getObject('Magento\Message\Warning'), + $this->objectManager->getObject('Magento\Message\Warning'), + $this->objectManager->getObject('Magento\Message\Success') + ); + + foreach ($messages as $message) { + $this->model->addMessage($message); + } + + $this->assertEquals($messages, $this->model->getItems()); + $this->assertEquals(end($messages), $this->model->getLastAddedMessage()); + } + + /** + * @cover \Magento\Message\Collection::addMessage + * @cover \Magento\Message\Collection::getItemsByType + * @cover \Magento\Message\Collection::getCount + * @cover \Magento\Message\Collection::getCountByType + */ + public function testGetItemsByType() + { + $messages = array( + $this->objectManager->getObject('Magento\Message\Error'), + $this->objectManager->getObject('Magento\Message\Notice'), + $this->objectManager->getObject('Magento\Message\Success'), + $this->objectManager->getObject('Magento\Message\Notice'), + $this->objectManager->getObject('Magento\Message\Success'), + $this->objectManager->getObject('Magento\Message\Warning'), + $this->objectManager->getObject('Magento\Message\Error') + ); + + $messageTypes = array( + MessageInterface::TYPE_SUCCESS => 2, + MessageInterface::TYPE_NOTICE => 2, + MessageInterface::TYPE_WARNING => 1, + MessageInterface::TYPE_ERROR => 2 + ); + + foreach ($messages as $message) { + $this->model->addMessage($message); + } + + $this->assertEquals(count($messages), $this->model->getCount()); + + foreach ($messageTypes as $type => $count) { + $messagesByType = $this->model->getItemsByType($type); + $this->assertEquals($count, $this->model->getCountByType($type)); + $this->assertEquals($count, count($messagesByType)); + + /** @var MessageInterface $message */ + foreach ($messagesByType as $message) { + $this->assertEquals($type, $message->getType()); + } + } + } + + /** + * @cover \Magento\Message\Collection::addMessage + * @cover \Magento\Message\Collection::getErrors + */ + public function testGetErrors() + { + $messages = array( + $this->objectManager->getObject('Magento\Message\Error'), + $this->objectManager->getObject('Magento\Message\Notice'), + $this->objectManager->getObject('Magento\Message\Error'), + $this->objectManager->getObject('Magento\Message\Error'), + $this->objectManager->getObject('Magento\Message\Warning'), + $this->objectManager->getObject('Magento\Message\Error') + ); + + foreach ($messages as $message) { + $this->model->addMessage($message); + } + + $this->assertEquals($this->model->getItemsByType(MessageInterface::TYPE_ERROR), $this->model->getErrors()); + $this->assertEquals(4, count($this->model->getErrors())); + } + + /** + * @cover \Magento\Message\Collection::getMessageByIdentifier + * @cover \Magento\Message\Collection::deleteMessageByIdentifier + */ + public function testGetMessageByIdentifier() + { + $messages = array( + $this->objectManager->getObject('Magento\Message\Error')->setIdentifier('error_id'), + $this->objectManager->getObject('Magento\Message\Notice')->setIdentifier('notice_id'), + $this->objectManager->getObject('Magento\Message\Warning')->setIdentifier('warning_id'), + ); + + foreach ($messages as $message) { + $this->model->addMessage($message); + } + + $message = $this->model->getMessageByIdentifier('notice_id'); + $this->assertEquals(MessageInterface::TYPE_NOTICE, $message->getType()); + $this->assertEquals('notice_id', $message->getIdentifier()); + + $this->assertEquals(count($messages), $this->model->getCount()); + $this->model->deleteMessageByIdentifier('notice_id'); + $this->assertEquals((count($messages) - 1), $this->model->getCount()); + + $this->assertEmpty($this->model->getMessageByIdentifier('notice_id')); + } + + /** + * @cover \Magento\Message\Collection::clear + */ + public function testClear() + { + $messages = array( + $this->objectManager->getObject('Magento\Message\Error'), + $this->objectManager->getObject('Magento\Message\Warning'), + $this->objectManager->getObject('Magento\Message\Notice'), + $this->objectManager->getObject('Magento\Message\Success') + ); + + foreach ($messages as $message) { + $this->model->addMessage($message); + } + + $this->assertEquals(count($messages), $this->model->getCount()); + $this->model->clear(); + $this->assertEmpty($this->model->getCount()); + } + + /** + * @cover \Magento\Message\Collection::clear + */ + public function testClearWithSticky() + { + $messages = array( + $this->objectManager->getObject('Magento\Message\Error'), + $this->objectManager->getObject('Magento\Message\Warning'), + $this->objectManager->getObject('Magento\Message\Notice')->setIsSticky(true), + $this->objectManager->getObject('Magento\Message\Success') + ); + + foreach ($messages as $message) { + $this->model->addMessage($message); + } + + $this->assertEquals(count($messages), $this->model->getCount()); + $this->model->clear(); + $this->assertEquals(1, $this->model->getCount()); + } +} diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/Reauthorize.php b/dev/tests/unit/testsuite/Magento/Message/ErrorTest.php similarity index 65% rename from app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/Reauthorize.php rename to dev/tests/unit/testsuite/Magento/Message/ErrorTest.php index 74bd75e6ee6..37ccf15819f 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Link/Reauthorize.php +++ b/dev/tests/unit/testsuite/Magento/Message/ErrorTest.php @@ -1,7 +1,5 @@ <?php /** - * Renders "Re-Authorize" link. - * * Magento * * NOTICE OF LICENSE @@ -24,18 +22,26 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Link; - -use Magento\Integration\Model\Integration; -use Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Link; +namespace Magento\Message; -class Reauthorize extends Link +/** + * \Magento\Message\Error test case + */ +class ErrorTest extends \PHPUnit_Framework_TestCase { /** - * {@inheritDoc} + * @var \Magento\Message\Error */ - public function isVisible() + protected $model; + + public function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->model = $objectManager->getObject('Magento\Message\Error'); + } + + public function testGetType() { - return $this->_row->getStatus() == Integration::STATUS_ACTIVE; + $this->assertEquals(MessageInterface::TYPE_ERROR, $this->model->getType()); } } diff --git a/dev/tests/unit/testsuite/Magento/Message/ManagerTest.php b/dev/tests/unit/testsuite/Magento/Message/ManagerTest.php new file mode 100644 index 00000000000..3ddbc05e622 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Message/ManagerTest.php @@ -0,0 +1,198 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Message; + +/** + * \Magento\Message\Manager test case + */ +class ManagerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + /** + * @var Factory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $messageFactory; + + /** + * @var CollectionFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $messagesFactory; + + /** + * @var Session|\PHPUnit_Framework_MockObject_MockObject + */ + protected $session; + + /** + * @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject + */ + protected $logger; + + /** + * @var \Magento\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $eventManager; + + /** + * @var \Magento\Message\Manager + */ + protected $model; + + public function setUp() + { + $this->messagesFactory = $this->getMockBuilder('Magento\Message\CollectionFactory') + ->disableOriginalConstructor() + ->setMethods(array('create')) + ->getMock(); + $this->messageFactory = $this->getMockBuilder('Magento\Message\Factory') + ->disableOriginalConstructor() + ->setMethods(array('create')) + ->getMock(); + $this->session = $this->getMockBuilder('Magento\Message\Session') + ->disableOriginalConstructor() + ->setMethods(array('getData', 'setData')) + ->getMock(); + $this->logger = $this->getMockBuilder('Magento\Logger') + ->setMethods(array('logFile')) + ->disableOriginalConstructor() + ->getMock(); + $this->eventManager = $this->getMockBuilder('Magento\Event\Manager') + ->setMethods(array('dispatch')) + ->disableOriginalConstructor() + ->getMock(); + + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->model = $this->objectManager->getObject('Magento\Message\Manager', array( + 'messagesFactory' => $this->messagesFactory, + 'messageFactory' => $this->messageFactory, + 'session' => $this->session, + 'eventManager' => $this->eventManager, + 'logger' => $this->logger + )); + } + + public function testGetDefaultGroup() + { + $this->assertEquals(ManagerInterface::DEFAULT_GROUP, $this->model->getDefaultGroup()); + + $customDefaultGroup = 'some_group'; + $customManager = $this->objectManager->getObject( + 'Magento\Message\Manager', + array('defaultGroup' => $customDefaultGroup) + ); + $this->assertEquals($customDefaultGroup, $customManager->getDefaultGroup()); + } + + public function testGetMessages() + { + $messageCollection = $this->getMockBuilder('Magento\Message\Collection') + ->disableOriginalConstructor() + ->setMethods(array('addMessage')) + ->getMock(); + + $this->messagesFactory->expects($this->atLeastOnce()) + ->method('create') + ->will($this->returnValue($messageCollection)); + + $this->session->expects($this->at(0)) + ->method('getData') + ->with(ManagerInterface::DEFAULT_GROUP) + ->will($this->returnValue(null)); + $this->session->expects($this->at(1)) + ->method('setData') + ->with(ManagerInterface::DEFAULT_GROUP, $messageCollection) + ->will($this->returnValue($this->session)); + $this->session->expects($this->at(2)) + ->method('getData') + ->with(ManagerInterface::DEFAULT_GROUP) + ->will($this->returnValue($messageCollection)); + + $this->eventManager->expects($this->never()) + ->method('dispatch'); + + $this->assertEquals($messageCollection, $this->model->getMessages()); + } + + public function testGetMessagesWithClear() + { + $messageCollection = $this->getMockBuilder('Magento\Message\Collection') + ->disableOriginalConstructor() + ->setMethods(array('addMessage', 'clear')) + ->getMock(); + + $messageCollection->expects($this->once()) + ->method('clear'); + + $this->session->expects($this->any()) + ->method('getData') + ->with(ManagerInterface::DEFAULT_GROUP) + ->will($this->returnValue($messageCollection)); + + $this->eventManager->expects($this->once()) + ->method('dispatch') + ->with('core_session_abstract_clear_messages'); + + $this->assertEquals($messageCollection, $this->model->getMessages(true)); + } + + public function testAddException() + { + $exceptionMessage = 'exception message'; + $alternativeText = 'alternative text'; + $logText = "Exception message: {$exceptionMessage}\nTrace:"; + + $messageError = $this->getMockBuilder('Magento\Message\Error') + ->setConstructorArgs(array('text' => $alternativeText)) + ->getMock(); + + $this->messageFactory->expects($this->atLeastOnce()) + ->method('create') + ->with(MessageInterface::TYPE_ERROR, $alternativeText) + ->will($this->returnValue($messageError)); + + $this->logger->expects($this->atLeastOnce()) + ->method('logFile') + ->with($this->stringStartsWith($logText), \Zend_Log::DEBUG, \Magento\Logger::LOGGER_EXCEPTION); + + $messageCollection = $this->getMockBuilder('Magento\Message\Collection') + ->disableOriginalConstructor() + ->setMethods(array('addMessage')) + ->getMock(); + $messageCollection->expects($this->atLeastOnce()) + ->method('addMessage') + ->with($messageError); + + $this->session->expects($this->atLeastOnce()) + ->method('getData') + ->with(ManagerInterface::DEFAULT_GROUP)->will($this->returnValue($messageCollection)); + + $exception = new \Exception($exceptionMessage); + $this->assertEquals($this->model, $this->model->addException($exception, $alternativeText)); + } +} diff --git a/lib/Magento/Filesystem/Stream/Zlib.php b/dev/tests/unit/testsuite/Magento/Message/NoticeTest.php similarity index 65% rename from lib/Magento/Filesystem/Stream/Zlib.php rename to dev/tests/unit/testsuite/Magento/Message/NoticeTest.php index f99e7467f9c..87724342634 100644 --- a/lib/Magento/Filesystem/Stream/Zlib.php +++ b/dev/tests/unit/testsuite/Magento/Message/NoticeTest.php @@ -1,7 +1,5 @@ <?php /** - * Magento filesystem zlib local stream - * * Magento * * NOTICE OF LICENSE @@ -23,21 +21,27 @@ * @copyright Copyright (c) 2013 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\Stream; -class Zlib extends \Magento\Filesystem\Stream\Local +namespace Magento\Message; + +/** + * \Magento\Message\Notice test case + */ +class NoticeTest extends \PHPUnit_Framework_TestCase { /** - * Opens the stream in the specified mode - * - * @param \Magento\Filesystem\Stream\Mode|string $mode + * @var \Magento\Message\Notice */ - public function open($mode) + protected $model; + + public function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->model = $objectManager->getObject('Magento\Message\Notice'); + } + + public function testGetType() { - if ($mode instanceof \Magento\Filesystem\Stream\Mode) { - $mode = $mode->getMode(); - } - $mode = new \Magento\Filesystem\Stream\Mode\Zlib($mode); - parent::open($mode); + $this->assertEquals(MessageInterface::TYPE_NOTICE, $this->model->getType()); } } diff --git a/dev/tests/unit/testsuite/Magento/Message/SuccessTest.php b/dev/tests/unit/testsuite/Magento/Message/SuccessTest.php new file mode 100644 index 00000000000..1799279d785 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Message/SuccessTest.php @@ -0,0 +1,47 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Message; + +/** + * \Magento\Message\Success test case + */ +class SuccessTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Message\Success + */ + protected $model; + + public function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->model = $objectManager->getObject('Magento\Message\Success'); + } + + public function testGetType() + { + $this->assertEquals(MessageInterface::TYPE_SUCCESS, $this->model->getType()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Message/WarningTest.php b/dev/tests/unit/testsuite/Magento/Message/WarningTest.php new file mode 100644 index 00000000000..0f3ad4b5dfb --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Message/WarningTest.php @@ -0,0 +1,47 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Message; + +/** + * \Magento\Message\Warning test case + */ +class WarningTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Message\Warning + */ + protected $model; + + public function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->model = $objectManager->getObject('Magento\Message\Warning'); + } + + public function testGetType() + { + $this->assertEquals(MessageInterface::TYPE_WARNING, $this->model->getType()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Module/Declaration/Converter/DomTest.php b/dev/tests/unit/testsuite/Magento/Module/Declaration/Converter/DomTest.php index e0eb0a888ad..db8fb098a99 100644 --- a/dev/tests/unit/testsuite/Magento/Module/Declaration/Converter/DomTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Declaration/Converter/DomTest.php @@ -37,10 +37,10 @@ class DomTest extends \PHPUnit_Framework_TestCase public function testConvertWithValidDom() { - $xmlFilePath = __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/_files/valid_module.xml'); + $xmlFilePath = __DIR__ . '/_files/valid_module.xml'; $dom = new \DOMDocument(); $dom->loadXML(file_get_contents($xmlFilePath)); - $expectedResult = include __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/_files/converted_valid_module.php'); + $expectedResult = include __DIR__ . '/_files/converted_valid_module.php'; $this->assertEquals($expectedResult, $this->_converter->convert($dom)); } diff --git a/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolverTest.php b/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolverTest.php index c8efc99b5a5..db05e69fcaa 100644 --- a/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolverTest.php @@ -26,42 +26,64 @@ namespace Magento\Module\Declaration; class FileResolverTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Module\Declaration\FileResolver + * Test for get method + * + * @dataProvider providerGet + * @param $baseDir + * @param $file + * @param $scope + * @param $expectedFileList */ - protected $_model; - - protected function setUp() + public function testGet($baseDir, $file, $scope, $expectedFileList) { - $baseDir = __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/FileResolver/_files'); + $fileResolver = $this->getFileResolver($baseDir); - $applicationDirs = $this->getMock('Magento\App\Dir', array(), array('getDir'), '', false); - $applicationDirs->expects($this->any()) - ->method('getDir') - ->will($this->returnValueMap(array( - array( - \Magento\App\Dir::CONFIG, - $baseDir . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR .'etc', - ), - array( - \Magento\App\Dir::MODULES, - $baseDir . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR .'code', - ), - ))); - $this->_model = new \Magento\Module\Declaration\FileResolver($applicationDirs); + $fileIterator = $fileResolver->get($file, $scope); + $fileList = array(); + foreach ($fileIterator as $filePath) { + $fileList[] = $filePath; + } + $this->assertEquals(sort($fileList), sort($expectedFileList)); } - public function testGet() + /** + * Data provider for testGet + * + * @return array + */ + public function providerGet() { - $expectedResult = array( - __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/FileResolver/_files/app/code/Module/Four/etc/module.xml'), - __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/FileResolver/_files/app/code/Module/One/etc/module.xml'), - __DIR__ . str_replace( - '/', DIRECTORY_SEPARATOR, '/FileResolver/_files/app/code/Module/Three/etc/module.xml' - ), - __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/FileResolver/_files/app/code/Module/Two/etc/module.xml'), - __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/FileResolver/_files/app/etc/custom/module.xml'), + return array( + array( + __DIR__ . '/FileResolver/_files', + 'module.xml', + 'global', + array( + file_get_contents(__DIR__ . '/FileResolver/_files/app/code/Module/Four/etc/module.xml'), + file_get_contents(__DIR__ . '/FileResolver/_files/app/code/Module/One/etc/module.xml'), + file_get_contents(__DIR__ . '/FileResolver/_files/app/code/Module/Three/etc/module.xml'), + file_get_contents(__DIR__ . '/FileResolver/_files/app/code/Module/Two/etc/module.xml'), + file_get_contents(__DIR__ . '/FileResolver/_files/app/etc/custom/module.xml') + ) + ) ); - $this->assertEquals($expectedResult, $this->_model->get('module.xml', 'global')); } + /** + * Get file resolver instance + * + * @param string $baseDir + * @return FileResolver + */ + protected function getFileResolver($baseDir) + { + $filesystem = new \Magento\Filesystem( + new \Magento\Filesystem\DirectoryList($baseDir), + new \Magento\Filesystem\Directory\ReadFactory(), + new \Magento\Filesystem\Directory\WriteFactory() + ); + $iteratorFactory = new \Magento\Config\FileIteratorFactory(); + + return new \Magento\Module\Declaration\FileResolver($filesystem, $iteratorFactory); + } } 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 02b4e711786..6001e14aef8 100644 --- a/dev/tests/unit/testsuite/Magento/Module/Declaration/Reader/FilesystemTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Declaration/Reader/FilesystemTest.php @@ -32,20 +32,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $baseDir = __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/../FileResolver/_files'); - $applicationDirs = $this->getMock('Magento\App\Dir', array(), array('getDir'), '', false); - $applicationDirs->expects($this->any())->method('getDir') - ->will($this->returnValueMap(array( - array( - \Magento\App\Dir::CONFIG, - $baseDir . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR .'etc', - ), - array( - \Magento\App\Dir::MODULES, - $baseDir . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR .'code', - ), - ))); - $fileResolver = new \Magento\Module\Declaration\FileResolver($applicationDirs); + $fileResolver = $this->getFileResolver(__DIR__ . '/../FileResolver/_files'); $converter = new \Magento\Module\Declaration\Converter\Dom(); $schemaLocatorMock = $this->getMock( 'Magento\Module\Declaration\SchemaLocator', array(), array(), '', false @@ -103,4 +90,22 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase ); $this->assertEquals($expectedResult, $this->_model->read('global')); } + + /** + * Get file resolver instance + * + * @param string $baseDir + * @return \Magento\Module\Declaration\FileResolver + */ + protected function getFileResolver($baseDir) + { + $filesystem = new \Magento\Filesystem( + new \Magento\Filesystem\DirectoryList($baseDir), + new \Magento\Filesystem\Directory\ReadFactory(), + new \Magento\Filesystem\Directory\WriteFactory() + ); + $iteratorFactory = new \Magento\Config\FileIteratorFactory(); + + return new \Magento\Module\Declaration\FileResolver($filesystem, $iteratorFactory); + } } diff --git a/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php index 2b6991f422d..7ad49b49e84 100644 --- a/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php @@ -62,10 +62,15 @@ 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); + $fileIteratorFactoryMock = $this->getMock('\Magento\Config\FileIteratorFactory', array(), array(), + '', false, false); $this->_model = new \Magento\Module\Dir\Reader( $this->_dirsMock, - $this->_moduleListMock + $this->_moduleListMock, + $filesystemMock, + $fileIteratorFactoryMock ); } diff --git a/dev/tests/unit/testsuite/Magento/Module/DirTest.php b/dev/tests/unit/testsuite/Magento/Module/DirTest.php index 889f5631738..d48e1d787f0 100644 --- a/dev/tests/unit/testsuite/Magento/Module/DirTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/DirTest.php @@ -31,42 +31,57 @@ class DirTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\App\Dir|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ - protected $_applicationDirs; + protected $filesystemMock; /** * @var \Magento\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject */ protected $_stringMock; + /** + * @var \Magento\Filesystem\Directory\ReadInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $directoryMock; + protected function setUp() { - $this->_applicationDirs = $this->getMock('Magento\App\Dir', array(), array(), '', false, false); - $this->_applicationDirs - ->expects($this->once()) - ->method('getDir') - ->with(\Magento\App\Dir::MODULES) - ->will($this->returnValue('app' . DIRECTORY_SEPARATOR . 'code')); + $this->filesystemMock = $this->getMock('Magento\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); + + $this->_stringMock->expects($this->once()) + ->method('upperCaseWords') + ->will($this->returnValue('Test/Module')); + + $this->filesystemMock->expects($this->once()) + ->method('getDirectoryRead') + ->will($this->returnValue($this->directoryMock)); - $this->_stringMock = $this->getMock('\Magento\Stdlib\String', array(), array(), '', false, false); - $this->_stringMock->expects($this->once())->method('upperCaseWords') - ->will($this->returnValue('Test' . DIRECTORY_SEPARATOR . 'Module')); - $this->_model = new \Magento\Module\Dir($this->_applicationDirs, $this->_stringMock); + $this->_model = new \Magento\Module\Dir($this->filesystemMock, $this->_stringMock); } public function testGetDirModuleRoot() { + $this->directoryMock->expects($this->once()) + ->method('getAbsolutePath') + ->with('Test/Module') + ->will($this->returnValue('/Test/Module')); $this->assertEquals( - str_replace('/', DIRECTORY_SEPARATOR, 'app/code/Test/Module'), + '/Test/Module', $this->_model->getDir('Test_Module') ); } public function testGetDirModuleSubDir() { + $this->directoryMock->expects($this->once()) + ->method('getAbsolutePath') + ->with('Test/Module/etc') + ->will($this->returnValue('/Test/Module/etc')); $this->assertEquals( - str_replace('/', DIRECTORY_SEPARATOR, 'app/code/Test/Module/etc'), + '/Test/Module/etc', $this->_model->getDir('Test_Module', 'etc') ); } diff --git a/dev/tests/unit/testsuite/Magento/Module/ResourceResolverTest.php b/dev/tests/unit/testsuite/Magento/Module/ResourceResolverTest.php index 5cf4e7b62cb..a1fd4b000c0 100644 --- a/dev/tests/unit/testsuite/Magento/Module/ResourceResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/ResourceResolverTest.php @@ -51,12 +51,12 @@ class ResourceResolverTest extends \PHPUnit_Framework_TestCase array( 'data', $moduleName, - __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/_files/Module/data'), + __DIR__ . '/_files/Module/data', ), array( 'sql', $moduleName, - __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/_files/Module/sql'), + __DIR__ . '/_files/Module/sql', ), ))); diff --git a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/DomTest.php b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/DomTest.php index 2421ef730a5..8380df94336 100644 --- a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/DomTest.php +++ b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/DomTest.php @@ -38,10 +38,10 @@ class DomTest extends \PHPUnit_Framework_TestCase public function testConvert() { $dom = new \DOMDocument(); - $xmlFile = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'simple_di_config.xml'; + $xmlFile = __DIR__ . '/_files/simple_di_config.xml'; $dom->loadXML(file_get_contents($xmlFile)); - $resultFile = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'mapped_simple_di_config.php'; + $resultFile = __DIR__ . '/_files/mapped_simple_di_config.php'; $expectedResult = include $resultFile; $this->assertEquals($expectedResult, $this->_mapper->convert($dom)); } diff --git a/dev/tests/unit/testsuite/Magento/Paygate/Model/Authorizenet/CardsTest.php b/dev/tests/unit/testsuite/Magento/Paygate/Model/Authorizenet/CardsTest.php new file mode 100644 index 00000000000..14da7037b8b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Paygate/Model/Authorizenet/CardsTest.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. + * + * @category Magento + * @package Magento_Paygate + * @subpackage unit_tests + * @copyright Copyright (c) 2013 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; + +class CardsTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Paygate\Model\Authorizenet\Card + */ + protected $_object; + + protected function setUp() + { + $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_object = $objectManagerHelper->getObject('Magento\Paygate\Model\Authorizenet\Cards'); + } + + /** + * @dataProvider setPaymentDataProvider + * @param string $cardId + * @param array $cardsData + * @param array $additionalInfo + * @param \Magento\Object $expectedResult + */ + public function testSetPayment($cardId, $cardsData, $additionalInfo, $expectedResult) + { + $paymentsMock = $this->getMockBuilder('\Magento\Payment\Model\Info') + ->disableOriginalConstructor() + ->getMock(); + + $paymentsMock->expects($this->at(0)) + ->method('getAdditionalInformation') + ->with('authorize_cards') + ->will($this->returnValue(array($cardId => $cardsData))); + + $paymentsMock->expects($this->at(1)) + ->method('getAdditionalInformation') + ->will($this->returnValue($additionalInfo)); + + $this->_object->setPayment($paymentsMock); + + $this->assertEquals( + $this->_object->getCard($cardId), + $expectedResult + ); + } + + /** + * @return array + */ + public function setPaymentDataProvider() + { + return array( + array( + 'cardId', array('key' => 'value'), array('key' => 'value'), + new \Magento\Object( + array( + 'key' => 'value', + 'additional_information' => array('key' => 'value') + ) + ), + ), + array( + 'cardId', array('key' => 'value'), array('key2' => 'value2'), + new \Magento\Object( + array( + 'key' => 'value', + 'additional_information' => array('key2' => 'value2') + ) + ), + ), + array( + 'cardId', array('key' => 'value'), array(), + new \Magento\Object( + array( + 'key' => 'value', + 'additional_information' => array() + ) + ), + ) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Payment/Block/InfoTest.php b/dev/tests/unit/testsuite/Magento/Payment/Block/InfoTest.php new file mode 100644 index 00000000000..f913d2d0482 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Payment/Block/InfoTest.php @@ -0,0 +1,132 @@ +<?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_Payment + * @subpackage unit_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Payment\Block; + +class InfoTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_object; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_storeManager; + + protected function setUp() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_storeManager = $this->getMockBuilder('\Magento\Core\Model\StoreManager') + ->setMethods(array('getStore')) + ->disableOriginalConstructor() + ->getMock(); + $context = $helper->getObject( + 'Magento\View\Element\Template\Context', array('storeManager' => $this->_storeManager) + ); + $this->_object = $helper->getObject('Magento\Payment\Block\Info', array('context' => $context)); + } + + /** + * @dataProvider getIsSecureModeDataProvider + * @param bool $isSecureMode + * @param bool $methodInstance + * @param bool $store + * @param string $storeCode + * @param bool $expectedResult + */ + public function testGetIsSecureMode($isSecureMode, $methodInstance, $store, $storeCode, $expectedResult) + { + if (isset($store)) { + $methodInstance = $this->_getMethodInstanceMock($store); + } + + if (isset($storeCode)) { + $storeMock = $this->_getStoreMock($storeCode); + $this->_storeManager->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($storeMock)); + } + + $paymentInfo = $this->getMockBuilder('\Magento\Payment\Model\Info') + ->disableOriginalConstructor() + ->getMock(); + $paymentInfo->expects($this->any()) + ->method('getMethodInstance') + ->will($this->returnValue($methodInstance)); + + $this->_object->setData('info', $paymentInfo); + $this->_object->setData('is_secure_mode', $isSecureMode); + $result = $this->_object->getIsSecureMode(); + $this->assertEquals($result, $expectedResult); + + } + + public function getIsSecureModeDataProvider() + { + return array( + array(false, true, null, null, false), + array(true, true, null, null, true), + array(null, false, null, null, true), + array(null, null, false, null, false), + array(null, null, true, 'default', true), + array(null, null, true, 'admin', false), + ); + } + + /** + * @param bool $store + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function _getMethodInstanceMock($store) + { + $methodInstance = $this->getMockBuilder('\Magento\Payment\Model\Method\AbstractMethod') + ->setMethods(array('getStore')) + ->disableOriginalConstructor() + ->getMock(); + $methodInstance->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($store)); + return $methodInstance; + } + + /** + * @param string $storeCode + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function _getStoreMock($storeCode) + { + $storeMock = $this->getMockBuilder('\Magento\Core\Model\Store') + ->disableOriginalConstructor() + ->getMock(); + $storeMock->expects($this->any()) + ->method('getCode') + ->will($this->returnValue($storeCode)); + return $storeMock; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Helper/CheckoutTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Helper/CheckoutTest.php index 243f513be02..b86ae27662d 100644 --- a/dev/tests/unit/testsuite/Magento/Paypal/Helper/CheckoutTest.php +++ b/dev/tests/unit/testsuite/Magento/Paypal/Helper/CheckoutTest.php @@ -52,11 +52,11 @@ class CheckoutTest extends \PHPUnit_Framework_TestCase { $this->_session = $this->getMockBuilder('Magento\Checkout\Model\Session') ->disableOriginalConstructor() - ->setMethods(array('getLastRealOrder', 'replaceQuote', 'unsLastRealOrderId')) + ->setMethods(array('getLastRealOrder', 'replaceQuote', 'unsLastRealOrderId', '__wakeup')) ->getMock(); $this->_quoteFactory = $this->getMockBuilder('Magento\Sales\Model\QuoteFactory') ->disableOriginalConstructor() - ->setMethods(array('create')) + ->setMethods(array('create', '__wakeup')) ->getMock(); $this->_checkout = new \Magento\Paypal\Helper\Checkout($this->_session, $this->_quoteFactory); diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Model/PayflowlinkTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Model/PayflowlinkTest.php index aa4c3846395..b77e181f7db 100644 --- a/dev/tests/unit/testsuite/Magento/Paypal/Model/PayflowlinkTest.php +++ b/dev/tests/unit/testsuite/Magento/Paypal/Model/PayflowlinkTest.php @@ -89,7 +89,7 @@ class PayflowlinkTest extends \PHPUnit_Framework_TestCase ->setMethods(array('getOrder', '__wakeup')) ->getMock(); $payment->expects($this->any()) - ->method('getOrder') + ->method('getOrder', '__wakeup') ->will($this->returnValue($order)); $request = new \Magento\Paypal\Model\Payflow\Request; $this->_modelClass = $this->getMock( diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Model/PayflowproTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Model/PayflowproTest.php new file mode 100644 index 00000000000..2830beab991 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Paypal/Model/PayflowproTest.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. + * + * @category Magento + * @package Magento_Paypal + * @subpackage unit_tests + * @copyright Copyright (c) 2013 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\Paypal\Model\Payflowpro + */ +namespace Magento\Paypal\Model; + +class PayflowproTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Payflowpro + */ + protected $_model; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_helper; + + protected function setUp() + { + $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_model = $this->_helper->getObject('Magento\Paypal\Model\Payflowpro'); + } + + /** + * @param mixed $amountPaid + * @param string $paymentType + * @param bool $expected + * @dataProvider canVoidDataProvider + */ + public function testCanVoid($amountPaid, $paymentType, $expected) + { + $payment = $this->_helper->getObject($paymentType); + $payment->setAmountPaid($amountPaid); + $this->assertEquals($expected, $this->_model->canVoid($payment)); + } + + public function canVoidDataProvider() + { + return array( + array(0, 'Magento\Sales\Model\Order\Invoice', false), + array(0, 'Magento\Sales\Model\Order\Creditmemo', false), + array(12.1, 'Magento\Sales\Model\Order\Payment', false), + array(0, 'Magento\Sales\Model\Order\Payment', true), + array(null, 'Magento\Sales\Model\Order\Payment', true), + ); + } + + public function testCanCapturePartial() + { + $this->assertTrue($this->_model->canCapturePartial()); + } + + public function testCanRefundPartialPerInvoice() + { + $this->assertTrue($this->_model->canRefundPartialPerInvoice()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Persistent/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Persistent/Helper/DataTest.php index b2cca77e31c..be59d78a745 100644 --- a/dev/tests/unit/testsuite/Magento/Persistent/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Persistent/Helper/DataTest.php @@ -56,6 +56,6 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->_modulesReader->expects($this->once())->method('getModuleDir') ->with('etc', 'Magento_Persistent') ->will($this->returnValue('path123')); - $this->assertEquals('path123'. DS . 'persistent.xml', $this->_helper->getPersistentConfigFilePath()); + $this->assertEquals('path123/persistent.xml', $this->_helper->getPersistentConfigFilePath()); } } diff --git a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractItemsTest.php b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractItemsTest.php index 7801ad18b4d..467fd280aba 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractItemsTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractItemsTest.php @@ -64,7 +64,9 @@ class AbstractItemsTest extends \PHPUnit_Framework_TestCase public function testGetItemRendererThrowsExceptionForNonexistentRenderer() { $renderer = $this->getMock('StdClass'); - $layout = $this->getMock('Magento\Core\Model\Layout', array('getChildName', 'getBlock'), array(), '', false); + $layout = $this->getMock( + 'Magento\Core\Model\Layout', array('getChildName', 'getBlock', '__wakeup'), array(), '', false + ); $layout->expects($this->at(0)) ->method('getChildName') ->with(null, 'some-type') diff --git a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php index e68822b8800..d476658cdc5 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php @@ -37,7 +37,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $renderer = $this->getMock('Magento\View\Element\AbstractBlock', array(), array(), '', false); $layout = $this->getMock('Magento\Core\Model\Layout', array( - 'getChildName', 'getBlock', 'getGroupChildNames' + 'getChildName', 'getBlock', 'getGroupChildNames', '__wakeup' ), array(), '', false); $layout->expects($this->at(0)) ->method('getChildName') @@ -66,7 +66,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $renderer = $this->getMock('StdClass'); $layout = $this->getMock('Magento\Core\Model\Layout', array( - 'getChildName', 'getBlock' + 'getChildName', 'getBlock', '__wakeup' ), array(), '', false); $layout->expects($this->at(0)) ->method('getChildName') diff --git a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Items/GridTest.php b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Items/GridTest.php index 2b51bd240f8..4f5eaf22ea3 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Items/GridTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Items/GridTest.php @@ -36,7 +36,13 @@ class GridTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $orderCreateMock = $this->getMock('Magento\Sales\Model\AdminOrder\Create', array(), array(), '', false); + $orderCreateMock = $this->getMock( + 'Magento\Sales\Model\AdminOrder\Create', + array('__wakeup'), + array(), + '', + false + ); $taxData = $this->getMockBuilder('Magento\Tax\Helper\Data') ->disableOriginalConstructor() @@ -46,9 +52,9 @@ class GridTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $sessionMock = $this->getMockBuilder('Magento\Adminhtml\Model\Session\Quote') + $sessionMock = $this->getMockBuilder('Magento\Backend\Model\Session\Quote') ->disableOriginalConstructor() - ->setMethods(array('getQuote')) + ->setMethods(array('getQuote', '__wakeup')) ->getMock(); $quoteMock = $this->getMockBuilder('Magento\Sales\Model\Quote') @@ -58,6 +64,7 @@ class GridTest extends \PHPUnit_Framework_TestCase $storeMock = $this->getMockBuilder('Magento\Core\Model\Store') ->disableOriginalConstructor() + ->setMethods(array('__wakeup', 'convertPrice')) ->getMock(); $storeMock->expects($this->any())->method('convertPrice')->will($this->returnArgument(0)); @@ -66,10 +73,11 @@ class GridTest extends \PHPUnit_Framework_TestCase $sessionMock->expects($this->any())->method('getQuote')->will($this->returnValue($quoteMock)); $wishlistFactoryMock = $this->getMockBuilder('Magento\Wishlist\Model\WishlistFactory') - ->setMethods(array('methods')) + ->setMethods(array('methods', '__wakeup')) ->getMock(); - $giftMessageSave = $this->getMockBuilder('Magento\GiftMessage\Model\Save') + $giftMessageSave = $this->getMockBuilder('Magento\Giftmessage\Model\Save') + ->setMethods(array('__wakeup')) ->disableOriginalConstructor() ->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Block/Recurring/Profile/Related/Orders/GridTest.php b/dev/tests/unit/testsuite/Magento/Sales/Block/Recurring/Profile/Related/Orders/GridTest.php index c95c113d3e1..0cfdb9cbae2 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Block/Recurring/Profile/Related/Orders/GridTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Block/Recurring/Profile/Related/Orders/GridTest.php @@ -82,9 +82,7 @@ class GridTest extends \PHPUnit_Framework_TestCase $locale = $this->getMock('\Magento\Core\Model\LocaleInterface'); $locale->expects($this->once())->method('formatDate') ->will($this->returnValue('11-11-1999')); - $helperFactory = $this->getMock('Magento\App\Helper\HelperFactory', array(), array(), '', false); $helper = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $helperFactory->expects($this->any())->method('get')->will($this->returnValue($helper)); $helper->expects($this->once())->method('formatCurrency') ->will($this->returnValue('10 USD')); $block = $this->_objectManagerHelper->getObject( @@ -94,7 +92,7 @@ class GridTest extends \PHPUnit_Framework_TestCase 'storeManager' => $storeManager, 'collection' => $collection, 'locale' => $locale, - 'helperFactory' => $helperFactory + 'coreHelper' => $helper ) ); $pagerBlock = $this->getMockBuilder('Magento\Theme\Block\Html\Pager') diff --git a/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreditmemoTest.php b/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreditmemoTest.php index 216cf67dc70..384cd1a715f 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreditmemoTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreditmemoTest.php @@ -31,25 +31,30 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase protected $_controller; /** - * @var \Magento\App\ResponseInterface|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_responseMock; /** - * @var \Magento\App\RequestInterface|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_requestMock; /** - * @var \Magento\Backend\Model\Session|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Backend\Model\Session|\PHPUnit_Framework_MockObject_MockObject */ protected $_sessionMock; /** - * @var \Magento\ObjectManager|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject */ protected $_objectManager; + /** + * @var \Magento\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_messageManager; + /** * Init model for future tests */ @@ -59,20 +64,26 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase $this->_responseMock = $this->getMock('Magento\App\Response\Http', array(), array(), '', false); $this->_responseMock->headersSentThrowsException = false; $this->_requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $constructArguments = $objectManager->getConstructArguments('Magento\Backend\Model\Session', + array('storage' => new \Magento\Session\Storage)); $this->_sessionMock = $this->getMock('Magento\Backend\Model\Session', - array('addError', 'setFormData'), array(), '', false); + array('setFormData'), $constructArguments + ); $this->_objectManager = $this->getMock('Magento\ObjectManager', array(), array(), '', false); $registryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false, false); $this->_objectManager->expects($this->any()) ->method('get') ->with($this->equalTo('Magento\Core\Model\Registry')) ->will($this->returnValue($registryMock)); + $this->_messageManager = $this->getMock('\Magento\Message\ManagerInterface', array(), array(), '', false); $arguments = array( 'response' => $this->_responseMock, 'request' => $this->_requestMock, 'session' => $this->_sessionMock, 'objectManager' => $this->_objectManager, + 'messageManager' => $this->_messageManager ); $context = $helper->getObject('Magento\Backend\App\Action\Context', $arguments); @@ -164,7 +175,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase */ protected function _setSaveActionExpectationForMageCoreException($data, $errorMessage) { - $this->_sessionMock->expects($this->once()) + $this->_messageManager->expects($this->once()) ->method('addError') ->with($this->equalTo($errorMessage)); $this->_sessionMock->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Config/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Config/ConverterTest.php index 575581469a4..62bf92ea291 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Config/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Config/ConverterTest.php @@ -100,7 +100,7 @@ class ConverterTest extends \PHPUnit_Framework_TestCase ) ); - $xmlFile = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'sales_valid.xml'; + $xmlFile = __DIR__ . '/_files/sales_valid.xml'; $dom = new \DOMDocument(); $dom->loadXML(file_get_contents($xmlFile)); $result = $this->_converter->convert($dom); @@ -114,7 +114,7 @@ class ConverterTest extends \PHPUnit_Framework_TestCase */ public function testConvertWrongConfiguration() { - $xmlFile = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'sales_invalid.xml'; + $xmlFile = __DIR__ . '/_files/sales_invalid.xml'; $dom = new \DOMDocument(); $dom->loadXML(file_get_contents($xmlFile)); $this->_converter->convert($dom); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/PaymentTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/PaymentTest.php new file mode 100644 index 00000000000..871c5fe886e --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/PaymentTest.php @@ -0,0 +1,49 @@ +<?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 + * @subpackage unit_tests + * @copyright Copyright (c) 2013 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\Order; + +class PaymentTest extends \PHPUnit_Framework_TestCase +{ + public function testCancel() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + /** @var Payment $model */ + $payment = $this->getMock('Magento\Payment\Model\Method\AbstractMethod', array('canVoid'), array(), '', false); + $paymentData = $this->getMock('Magento\Payment\Helper\Data', array('getMethodInstance'), array(), '', false); + $paymentData->expects($this->once())->method('getMethodInstance')->will($this->returnValue($payment)); + $model = $helper->getObject('Magento\Sales\Model\Order\Payment', array('paymentData' => $paymentData)); + $model->setMethod('any'); + // check fix for partial refunds in Payflow Pro + $payment->expects($this->once()) + ->method('canVoid') + ->with(new \PHPUnit_Framework_Constraint_IsIdentical($model)) + ->will($this->returnValue(false)); + + $model->cancel(); + } +} 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 33130276535..0d49649cf96 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,7 +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); - $coreDir = $this->getMock('Magento\App\Dir', array(), array(), '', false); + $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); $shippingConfig = $this->getMock('Magento\Shipping\Model\Config', 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 +108,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, $coreDir, $shippingConfig, + array($paymentData, $string, $coreStoreConfig, $translate, $filesystem, $shippingConfig, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, $localeMock), '', true, false, true, array('drawLineBlocks') ); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/ReaderTest.php index 74e86f31462..65e79e643ca 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/ReaderTest.php @@ -59,8 +59,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ->method('get') ->with('pdf.xml', 'scope') ->will($this->returnValue(array( - __DIR__ . '/_files/pdf_one.xml', - __DIR__ . '/_files/pdf_two.xml', + file_get_contents(__DIR__ . '/_files/pdf_one.xml'), + file_get_contents(__DIR__ . '/_files/pdf_two.xml'), ))); $this->_converter = $this->getMock('Magento\Sales\Model\Order\Pdf\Config\Converter', array('convert')); 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 fe1380ac6ee..89ff54bc630 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 @@ -42,10 +42,24 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase $stringMock = $this->getMock('Magento\Stdlib\String', array(), array(), '', false, false); $storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false, false); $translateMock = $this->getMock('Magento\Core\Model\Translate', array(), array(), '', false, false); - $coreDirMock = $this->getMock('Magento\App\Dir', array(), array(), '', false, false); - $coreDirMock->expects($this->once()) - ->method('getDir') - ->will($this->returnValue(BP)); + $directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false, false); + $directoryMock->expects($this->any()) + ->method('getAbsolutePath') + ->will( + $this->returnCallback( + function ($argument) { + return BP . '/' . $argument; + } + ) + ); + $filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false, false); + $filesystemMock->expects($this->any()) + ->method('getDirectoryRead') + ->will($this->returnValue($directoryMock)); + $filesystemMock->expects($this->any()) + ->method('getDirectoryWrite') + ->will($this->returnValue($directoryMock)); + $shippingConfigMock = $this->getMock('Magento\Shipping\Model\Config', array(), array(), '', false, false); $this->_pdfConfigMock = @@ -64,7 +78,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase $stringMock, $storeConfigMock, $translateMock, - $coreDirMock, + $filesystemMock, $shippingConfigMock, $this->_pdfConfigMock, $totalFactoryMock, diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/OrderTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/OrderTest.php index 0298e9b2141..c2a6572db15 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/OrderTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/OrderTest.php @@ -64,20 +64,19 @@ class OrderTest extends \PHPUnit_Framework_TestCase * Prepare payment for the order * * @param \PHPUnit_Framework_MockObject_MockObject $order - * @param bool $canReviewPayment - * @param bool $canUpdatePayment + * @param array $mockedMethods + * @return \Magento\Sales\Model\Order\Payment|\PHPUnit_Framework_MockObject_MockObject */ - protected function _prepareOrderPayment($order, $canReviewPayment, $canUpdatePayment) + protected function _prepareOrderPayment($order, $mockedMethods = array()) { $payment = $this->getMockBuilder('Magento\Sales\Model\Order\Payment') ->disableOriginalConstructor() ->getMock(); - $payment->expects($this->any()) - ->method('canReviewPayment') - ->will($this->returnValue($canReviewPayment)); - $payment->expects($this->any()) - ->method('canFetchTransactionInfo') - ->will($this->returnValue($canUpdatePayment)); + foreach ($mockedMethods as $method => $value) { + $payment->expects($this->any()) + ->method($method) + ->will($this->returnValue($value)); + } $payment->expects($this->any()) ->method('isDeleted') ->will($this->returnValue(false)); @@ -85,6 +84,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase $itemsProperty = new \ReflectionProperty('Magento\Sales\Model\Order', '_payments'); $itemsProperty->setAccessible(true); $itemsProperty->setValue($order, array($payment)); + return $payment; } /** @@ -99,16 +99,17 @@ class OrderTest extends \PHPUnit_Framework_TestCase */ public function testCanCancel($actionFlags, $orderState, $canReviewPayment, $canUpdatePayment, $allInvoiced) { - /** @var $order \Magento\Sales\Model\Order */ - $order = $this->getMockBuilder('Magento\Sales\Model\Order') - ->disableOriginalConstructor() - ->setMethods(array('__wakeup')) - ->getMock(); + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + /** @var Order $order */ + $order = $helper->getObject('Magento\Sales\Model\Order'); foreach ($actionFlags as $action => $flag) { $order->setActionFlag($action, $flag); } $order->setData('state', $orderState); - $this->_prepareOrderPayment($order, $canReviewPayment, $canUpdatePayment); + $this->_prepareOrderPayment($order, array( + 'canReviewPayment' => $canReviewPayment, + 'canFetchTransactionInfo' => $canUpdatePayment + )); $this->_prepareOrderItems($order, $allInvoiced); // Calculate result @@ -126,7 +127,8 @@ class OrderTest extends \PHPUnit_Framework_TestCase if ($allInvoiced || in_array($orderState, array( \Magento\Sales\Model\Order::STATE_CANCELED, \Magento\Sales\Model\Order::STATE_COMPLETE, - \Magento\Sales\Model\Order::STATE_CLOSED + \Magento\Sales\Model\Order::STATE_CLOSED, + \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW ))) { $expectedResult = false; } @@ -139,9 +141,14 @@ class OrderTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expectedResult, $order->canCancel()); } - public function canCancelDataProvider() + /** + * Get action flags + * + * @return array + */ + protected function _getActionFlagsValues() { - $actionFlagsValues = array( + return array( array(), array( \Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD => false, @@ -152,8 +159,16 @@ class OrderTest extends \PHPUnit_Framework_TestCase \Magento\Sales\Model\Order::ACTION_FLAG_CANCEL => true, ), ); - $boolValues = array(true, false); - $orderStatuses = array( + } + + /** + * Get order statuses + * + * @return array + */ + protected function _getOrderStatuses() + { + return array( \Magento\Sales\Model\Order::STATE_HOLDED, \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW, \Magento\Sales\Model\Order::STATE_CANCELED, @@ -161,10 +176,15 @@ class OrderTest extends \PHPUnit_Framework_TestCase \Magento\Sales\Model\Order::STATE_CLOSED, \Magento\Sales\Model\Order::STATE_PROCESSING, ); + } + + public function canCancelDataProvider() + { + $boolValues = array(true, false); $data = array(); - foreach ($actionFlagsValues as $actionFlags) { - foreach ($orderStatuses as $status) { + foreach ($this->_getActionFlagsValues() as $actionFlags) { + foreach ($this->_getOrderStatuses() as $status) { foreach ($boolValues as $canReviewPayment) { foreach ($boolValues as $canUpdatePayment) { foreach ($boolValues as $allInvoiced) { @@ -177,4 +197,55 @@ class OrderTest extends \PHPUnit_Framework_TestCase return $data; } + + /** + * @param array $actionFlags + * @param string $orderState + * @dataProvider canVoidPaymentDataProvider + */ + public function testCanVoidPayment($actionFlags, $orderState) + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + /** @var Order $order */ + $order = $helper->getObject('Magento\Sales\Model\Order'); + foreach ($actionFlags as $action => $flag) { + $order->setActionFlag($action, $flag); + } + $order->setData('state', $orderState); + $payment = $this->_prepareOrderPayment($order); + $canVoidOrder = true; + if ($orderState == \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW) { + $canVoidOrder = false; + } + if ($orderState == \Magento\Sales\Model\Order::STATE_HOLDED + && (!isset($actionFlags[\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD]) + || $actionFlags[\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD] !== false + ) + ) { + $canVoidOrder = false; + } + + $expected = false; + if ($canVoidOrder) { + $expected = 'some value'; + $payment->expects($this->once()) + ->method('canVoid') + ->with(new \PHPUnit_Framework_Constraint_IsIdentical($payment)) + ->will($this->returnValue($expected)); + } else { + $payment->expects($this->never())->method('canVoid'); + } + $this->assertEquals($expected, $order->canVoidPayment()); + } + + public function canVoidPaymentDataProvider() + { + $data = array(); + foreach ($this->_getActionFlagsValues() as $actionFlags) { + foreach ($this->_getOrderStatuses() as $status) { + $data[] = array($actionFlags, $status); + } + } + return $data; + } } diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/QuoteTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/QuoteTest.php new file mode 100644 index 00000000000..50e507b6c35 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/QuoteTest.php @@ -0,0 +1,102 @@ +<?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 + * @subpackage unit_tests + * @copyright Copyright (c) 2013 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\Resource; + +class QuoteTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Sales\Model\Resource\Quote + */ + protected $_model; + + /** + * @var \Magento\App\Resource + */ + protected $_resourceMock; + + /** + * @var \Magento\Eav\Model\Config + */ + protected $_configMock; + + /** + * @var \Magento\DB\Adapter\Pdo\Mysql + */ + protected $_adapterMock; + + /** + * @var \Magento\DB\Select + */ + protected $_selectMock; + + protected function setUp() + { + $this->_selectMock = $this->getMock('\Magento\DB\Select', array(), array(), '', false); + $this->_selectMock->expects($this->any())->method('from')->will($this->returnSelf()); + $this->_selectMock->expects($this->any())->method('where'); + + $this->_adapterMock = $this->getMock('\Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false); + $this->_adapterMock->expects($this->any())->method('select')->will($this->returnValue($this->_selectMock)); + + $this->_resourceMock = $this->getMock('\Magento\App\Resource', array(), array(), '', false); + $this->_resourceMock->expects($this->any()) + ->method('getConnection') + ->will($this->returnValue($this->_adapterMock)); + + $this->_configMock = $this->getMock('\Magento\Eav\Model\Config', array(), array(), '', false); + + $this->_model = new \Magento\Sales\Model\Resource\Quote( + $this->_resourceMock, + new \Magento\Stdlib\DateTime, + $this->_configMock + ); + } + + /** + * @param $value + * @dataProvider isOrderIncrementIdUsedDataProvider + */ + public function testIsOrderIncrementIdUsed($value) + { + $expectedBind = array(':increment_id' => $value); + $this->_adapterMock->expects($this->once())->method('fetchOne')->with($this->_selectMock, $expectedBind); + $this->_model->isOrderIncrementIdUsed($value); + } + + /** + * @return array + */ + public function isOrderIncrementIdUsedDataProvider() + { + return array( + array(100000001), + array('10000000001'), + array('M10000000001'), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php index 9b974423b49..3c83fdd51b1 100644 --- a/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php +++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php @@ -30,7 +30,7 @@ namespace Magento\SalesRule\Model; class ValidatorTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\SalesRule\Model\Validator|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\SalesRule\Model\Validator|\PHPUnit_Framework_MockObject_MockObject */ protected $_model; @@ -55,11 +55,11 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase } /** - * @return \Magento\Sales\Model\Quote\Item|PHPUnit_Framework_MockObject_MockObject + * @return \Magento\Sales\Model\Quote\Item|\PHPUnit_Framework_MockObject_MockObject */ protected function _getQuoteItemMock() { - $fixturePath = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; + $fixturePath = __DIR__ . '/_files/'; $itemDownloadable = $this->getMock( 'Magento\Sales\Model\Quote\Item', array('getAddress', '__wakeup'), diff --git a/dev/tests/unit/testsuite/Magento/Session/SaveHandler/DbTableTest.php b/dev/tests/unit/testsuite/Magento/Session/SaveHandler/DbTableTest.php new file mode 100644 index 00000000000..1f000882839 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Session/SaveHandler/DbTableTest.php @@ -0,0 +1,329 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Session\SaveHandler; + +class DbTableTest extends \PHPUnit_Framework_TestCase +{ + /** + * Session table name + */ + const SESSION_TABLE = 'session_table_name'; + + /**#@+ + * Table column names + */ + const COLUMN_SESSION_ID = 'session_id'; + const COLUMN_SESSION_DATA = 'session_data'; + const COLUMN_SESSION_EXPIRES = 'session_expires'; + /**#@-*/ + + /** + * Test select object + */ + const SELECT_OBJECT = 'select_object'; + + /**#@+ + * Test session data + */ + const SESSION_ID = 'custom_session_id'; + const SESSION_DATA = 'custom_session_data'; + /**#@-*/ + + /** + * Model under test + * + * @var \Magento\Session\SaveHandler\DbTable + */ + protected $_model; + + protected function tearDown() + { + unset($this->_model); + } + + /** + * Data provider for testRead + * + * @return array + */ + public function readDataProvider() + { + return array( + 'session_encoded' => array('$dataEncoded' => true), + 'session_not_encoded' => array('$dataEncoded' => false), + ); + } + + public function testCheckConnection() + { + $connection = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', + array('isTableExists'), array(), '', false + ); + $connection->expects($this->atLeastOnce())->method('isTableExists') + ->with($this->equalTo(self::SESSION_TABLE)) + ->will($this->returnValue(true)); + + $resource = $this->getMock('Magento\App\Resource', array('getTableName', 'getConnection'), + array(), '', false, false); + $resource->expects($this->once()) + ->method('getTableName') + ->will($this->returnValue(self::SESSION_TABLE)); + $resource->expects($this->once()) + ->method('getConnection') + ->will($this->returnValue($connection)); + + $this->_model = new \Magento\Session\SaveHandler\DbTable($resource); + + $method = new \ReflectionMethod('Magento\Session\SaveHandler\DbTable', 'checkConnection'); + $method->setAccessible(true); + $this->assertNull($method->invoke($this->_model)); + } + + /** + * @expectedException \Magento\Session\SaveHandlerException + * @expectedExceptionMessage Write DB connection is not available + */ + public function testCheckConnectionNoConnection() + { + $resource = $this->getMock('Magento\App\Resource', array('getTableName', 'getConnection'), + array(), '', false, false); + $resource->expects($this->once()) + ->method('getTableName') + ->will($this->returnValue(self::SESSION_TABLE)); + $resource->expects($this->once()) + ->method('getConnection') + ->will($this->returnValue(null)); + + $this->_model = new \Magento\Session\SaveHandler\DbTable($resource); + + $method = new \ReflectionMethod('Magento\Session\SaveHandler\DbTable', 'checkConnection'); + $method->setAccessible(true); + $this->assertNull($method->invoke($this->_model)); + } + + /** + * @expectedException \Magento\Session\SaveHandlerException + * @expectedExceptionMessage DB storage table does not exist + */ + public function testCheckConnectionNoTable() + { + $connection = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', + array('isTableExists'), array(), '', false + ); + $connection->expects($this->once())->method('isTableExists') + ->with($this->equalTo(self::SESSION_TABLE)) + ->will($this->returnValue(false)); + + $resource = $this->getMock('Magento\App\Resource', array('getTableName', 'getConnection'), + array(), '', false, false); + $resource->expects($this->once()) + ->method('getTableName') + ->will($this->returnValue(self::SESSION_TABLE)); + $resource->expects($this->once()) + ->method('getConnection') + ->will($this->returnValue($connection)); + + $this->_model = new \Magento\Session\SaveHandler\DbTable($resource); + + $method = new \ReflectionMethod('Magento\Session\SaveHandler\DbTable', 'checkConnection'); + $method->setAccessible(true); + $this->assertNull($method->invoke($this->_model)); + } + + /** + * @param bool $isDataEncoded + * + * @dataProvider readDataProvider + */ + public function testRead($isDataEncoded) + { + $this->_prepareMockForRead($isDataEncoded); + $result = $this->_model->read(self::SESSION_ID); + $this->assertEquals(self::SESSION_DATA, $result); + } + + /** + * Prepares mock for test model with specified connections + * + * @param \PHPUnit_Framework_MockObject_MockObject $connection + */ + protected function _prepareResourceMock($connection) + { + $resource = $this->getMock('Magento\App\Resource', array('getTableName', 'getConnection'), + array(), '', false, false); + $resource->expects($this->once()) + ->method('getTableName') + ->will($this->returnValue(self::SESSION_TABLE)); + $resource->expects($this->once()) + ->method('getConnection') + ->will($this->returnValue($connection)); + + $this->_model = new \Magento\Session\SaveHandler\DbTable($resource); + } + + /** + * Prepare mocks for testRead + * + * @param bool $isDataEncoded + */ + protected function _prepareMockForRead($isDataEncoded) + { + $connection = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', + array('select', 'from', 'where', 'fetchOne', 'isTableExists'), array(), '', false + ); + + $connection->expects($this->once()) + ->method('isTableExists') + ->will($this->returnValue(true)); + + $connection->expects($this->once()) + ->method('select') + ->will($this->returnSelf()); + $connection->expects($this->once()) + ->method('from') + ->with(self::SESSION_TABLE, array(self::COLUMN_SESSION_DATA)) + ->will($this->returnSelf()); + $connection->expects($this->once()) + ->method('where') + ->with(self::COLUMN_SESSION_ID . ' = :' . self::COLUMN_SESSION_ID) + ->will($this->returnValue(self::SELECT_OBJECT)); + + $sessionData = self::SESSION_DATA; + if ($isDataEncoded) { + $sessionData = base64_encode($sessionData); + } + $connection->expects($this->once()) + ->method('fetchOne') + ->with(self::SELECT_OBJECT, array(self::COLUMN_SESSION_ID => self::SESSION_ID)) + ->will($this->returnValue($sessionData)); + + $this->_prepareResourceMock($connection); + } + + /** + * Data provider for testWrite + * + * @return array + */ + public function writeDataProvider() + { + return array( + 'session_exists' => array('$sessionExists' => true), + 'session_not_exists' => array('$sessionExists' => false), + ); + } + + /** + * @param bool $sessionExists + * + * @dataProvider writeDataProvider + */ + public function testWrite($sessionExists) + { + $this->_prepareMockForWrite($sessionExists); + $this->assertTrue($this->_model->write(self::SESSION_ID, self::SESSION_DATA)); + } + + /** + * Prepare mocks for testWrite + * + * @param bool $sessionExists + */ + protected function _prepareMockForWrite($sessionExists) + { + $connection = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', + array('select', 'from', 'where', 'fetchOne', 'update', 'insert', 'isTableExists'), array(), '', false + ); + $connection->expects($this->once()) + ->method('isTableExists') + ->will($this->returnValue(true)); + $connection->expects($this->once()) + ->method('select') + ->will($this->returnSelf()); + $connection->expects($this->once()) + ->method('from') + ->with(self::SESSION_TABLE) + ->will($this->returnSelf()); + $connection->expects($this->once()) + ->method('where') + ->with(self::COLUMN_SESSION_ID . ' = :' . self::COLUMN_SESSION_ID) + ->will($this->returnValue(self::SELECT_OBJECT)); + $connection->expects($this->once()) + ->method('fetchOne') + ->with(self::SELECT_OBJECT, array(self::COLUMN_SESSION_ID => self::SESSION_ID)) + ->will($this->returnValue($sessionExists)); + + if ($sessionExists) { + $connection->expects($this->never()) + ->method('insert'); + $connection->expects($this->once()) + ->method('update') + ->will($this->returnCallback(array($this, 'verifyUpdate'))); + } else { + $connection->expects($this->once()) + ->method('insert') + ->will($this->returnCallback(array($this, 'verifyInsert'))); + $connection->expects($this->never()) + ->method('update'); + } + + $this->_prepareResourceMock($connection); + } + + /** + * Verify arguments of insert method + * + * @param string $table + * @param array $bind + */ + public function verifyInsert($table, array $bind) + { + $this->assertEquals(self::SESSION_TABLE, $table); + + $this->assertInternalType('int', $bind[self::COLUMN_SESSION_EXPIRES]); + $this->assertEquals(base64_encode(self::SESSION_DATA), $bind[self::COLUMN_SESSION_DATA]); + $this->assertEquals(self::SESSION_ID, $bind[self::COLUMN_SESSION_ID]); + } + + /** + * Verify arguments of update method + * + * @param string $table + * @param array $bind + * @param array $where + */ + public function verifyUpdate($table, array $bind, array $where) + { + $this->assertEquals(self::SESSION_TABLE, $table); + + $this->assertInternalType('int', $bind[self::COLUMN_SESSION_EXPIRES]); + $this->assertEquals(base64_encode(self::SESSION_DATA), $bind[self::COLUMN_SESSION_DATA]); + + $this->assertEquals(array(self::COLUMN_SESSION_ID . '=?' => self::SESSION_ID), $where); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Session/SaveHandlerFactoryTest.php b/dev/tests/unit/testsuite/Magento/Session/SaveHandlerFactoryTest.php new file mode 100644 index 00000000000..72e9adddcf8 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Session/SaveHandlerFactoryTest.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Session; + +class SaveHandlerFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider createDataProvider + */ + public function testCreate($handlers, $saveClass, $saveMethod) + { + $saveHandler = $this->getMock($saveClass, array(), array(), '', false); + $objectManager = $this->getMock('\Magento\ObjectManager\ObjectManager', array('create'), array(), '', false); + $objectManager->expects($this->once())->method('create') + ->with($this->equalTo($saveClass), $this->equalTo(array()))->will($this->returnValue($saveHandler)); + $model = new SaveHandlerFactory($objectManager, $handlers); + $result = $model->create($saveMethod); + $this->assertInstanceOf($saveClass, $result); + $this->assertInstanceOf('\Magento\Session\SaveHandler\Native', $result); + $this->assertInstanceOf('\SessionHandler', $result); + } + + /** + * @return array + */ + public static function createDataProvider() + { + return array( + array( + array(), 'Magento\Session\SaveHandler\Native', 'files' + ) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php b/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php index b955d043a4a..71e4801026b 100644 --- a/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php +++ b/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php @@ -27,6 +27,9 @@ namespace Magento\Sitemap\Model; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class SitemapTest extends \PHPUnit_Framework_TestCase { /** @@ -59,6 +62,21 @@ class SitemapTest extends \PHPUnit_Framework_TestCase */ protected $_sitemapCmsPageMock; + /** + * @var \Magento\Filesystem + */ + protected $_filesystemMock; + + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected $_directoryMock; + + /** + * @var \Magento\Filesystem\File\Write + */ + protected $_fileMock; + /** * Set helper mocks, create resource model mock */ @@ -106,14 +124,33 @@ class SitemapTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue('0.25')); $this->_resourceMock = $this->getMockBuilder('Magento\Sitemap\Model\Resource\Sitemap') - ->setMethods(array( - '_construct', 'beginTransaction', 'rollBack', 'save', 'addCommitCallback', 'commit', '__wakeup' - )) + ->setMethods( + array('_construct', 'beginTransaction', 'rollBack', 'save', 'addCommitCallback', 'commit', '__wakeup') + ) ->disableOriginalConstructor() ->getMock(); $this->_resourceMock->expects($this->any()) ->method('addCommitCallback') ->will($this->returnSelf()); + + $this->_fileMock = $this->getMockBuilder('Magento\Filesystem\File\Write') + ->disableOriginalConstructor() + ->getMock(); + + $this->_directoryMock = $this->getMockBuilder('Magento\Filesystem\Directory\Write') + ->disableOriginalConstructor() + ->getMock(); + $this->_directoryMock->expects($this->any()) + ->method('openFile') + ->will($this->returnValue($this->_fileMock)); + + $this->_filesystemMock = $this->getMockBuilder('Magento\Filesystem') + ->setMethods(array('getDirectoryWrite')) + ->disableOriginalConstructor() + ->getMock(); + $this->_filesystemMock->expects($this->any()) + ->method('getDirectoryWrite') + ->will($this->returnValue($this->_directoryMock)); } /** @@ -124,18 +161,8 @@ class SitemapTest extends \PHPUnit_Framework_TestCase */ public function testNotAllowedPath() { - $fileMock = $this->getMockBuilder('Magento\Io\File') - ->setMethods(array('allowedPath', 'getCleanPath')) - ->getMock(); - $fileMock->expects($this->once()) - ->method('allowedPath') - ->will($this->returnValue(false)); - - $fileMock->expects($this->any()) - ->method('getCleanPath') - ->will($this->returnArgument(0)); - - $model = $this->_getModelMock($fileMock); + $model = $this->_getModelMock(); + $model->setSitemapPath('../'); $model->save(); } @@ -147,20 +174,11 @@ class SitemapTest extends \PHPUnit_Framework_TestCase */ public function testPathNotExists() { - $fileMock = $this->getMockBuilder('Magento\Io\File') - ->setMethods(array('allowedPath', 'getCleanPath', 'fileExists')) - ->getMock(); - $fileMock->expects($this->once()) - ->method('allowedPath') - ->will($this->returnValue(true)); - $fileMock->expects($this->any()) - ->method('getCleanPath') - ->will($this->returnArgument(0)); - $fileMock->expects($this->once()) - ->method('fileExists') + $this->_directoryMock->expects($this->once()) + ->method('isExist') ->will($this->returnValue(false)); - $model = $this->_getModelMock($fileMock); + $model = $this->_getModelMock(); $model->save(); } @@ -172,24 +190,14 @@ class SitemapTest extends \PHPUnit_Framework_TestCase */ public function testPathNotWritable() { - $fileMock = $this->getMockBuilder('Magento\Io\File') - ->setMethods(array('allowedPath', 'getCleanPath', 'fileExists', 'isWriteable')) - ->getMock(); - $fileMock->expects($this->once()) - ->method('allowedPath') - ->will($this->returnValue(true)); - $fileMock->expects($this->any()) - ->method('getCleanPath') - ->will($this->returnArgument(0)); - $fileMock->expects($this->once()) - ->method('fileExists') + $this->_directoryMock->expects($this->once()) + ->method('isExist') ->will($this->returnValue(true)); - $fileMock->expects($this->once()) - ->method('isWriteable') + $this->_directoryMock->expects($this->once()) + ->method('isWritable') ->will($this->returnValue(false)); - /** @var $model \Magento\Sitemap\Model\Sitemap */ - $model = $this->_getModelMock($fileMock); + $model = $this->_getModelMock(); $model->save(); } @@ -203,23 +211,14 @@ class SitemapTest extends \PHPUnit_Framework_TestCase //@codingStandardsIgnoreEnd public function testFilenameInvalidChars() { - $fileMock = $this->getMockBuilder('Magento\Io\File') - ->setMethods(array('allowedPath', 'getCleanPath', 'fileExists', 'isWriteable')) - ->getMock(); - $fileMock->expects($this->once()) - ->method('allowedPath') + $this->_directoryMock->expects($this->once()) + ->method('isExist') ->will($this->returnValue(true)); - $fileMock->expects($this->any()) - ->method('getCleanPath') - ->will($this->returnArgument(0)); - $fileMock->expects($this->once()) - ->method('fileExists') - ->will($this->returnValue(true)); - $fileMock->expects($this->once()) - ->method('isWriteable') + $this->_directoryMock->expects($this->once()) + ->method('isWritable') ->will($this->returnValue(true)); - $model = $this->_getModelMock($fileMock); + $model = $this->_getModelMock(); $model->setSitemapFilename('*sitemap?.xml'); $model->save(); } @@ -237,15 +236,15 @@ class SitemapTest extends \PHPUnit_Framework_TestCase public static function sitemapDataProvider() { $expectedSingleFile = array( - 'sitemap-1-1.xml' => __DIR__ . '/_files/sitemap-single.xml' + '/sitemap-1-1.xml' => __DIR__ . '/_files/sitemap-single.xml' ); $expectedMultiFile = array( - 'sitemap-1-1.xml' => __DIR__ . '/_files/sitemap-1-1.xml', - 'sitemap-1-2.xml' => __DIR__ . '/_files/sitemap-1-2.xml', - 'sitemap-1-3.xml' => __DIR__ . '/_files/sitemap-1-3.xml', - 'sitemap-1-4.xml' => __DIR__ . '/_files/sitemap-1-4.xml', - 'sitemap.xml' => __DIR__ . '/_files/sitemap-index.xml' + '/sitemap-1-1.xml' => __DIR__ . '/_files/sitemap-1-1.xml', + '/sitemap-1-2.xml' => __DIR__ . '/_files/sitemap-1-2.xml', + '/sitemap-1-3.xml' => __DIR__ . '/_files/sitemap-1-3.xml', + '/sitemap-1-4.xml' => __DIR__ . '/_files/sitemap-1-4.xml', + '/sitemap.xml' => __DIR__ . '/_files/sitemap-index.xml' ); return array( @@ -288,15 +287,15 @@ class SitemapTest extends \PHPUnit_Framework_TestCase public static function robotsDataProvider() { $expectedSingleFile = array( - 'sitemap-1-1.xml' => __DIR__ . '/_files/sitemap-single.xml' + '/sitemap-1-1.xml' => __DIR__ . '/_files/sitemap-single.xml' ); $expectedMultiFile = array( - 'sitemap-1-1.xml' => __DIR__ . '/_files/sitemap-1-1.xml', - 'sitemap-1-2.xml' => __DIR__ . '/_files/sitemap-1-2.xml', - 'sitemap-1-3.xml' => __DIR__ . '/_files/sitemap-1-3.xml', - 'sitemap-1-4.xml' => __DIR__ . '/_files/sitemap-1-4.xml', - 'sitemap.xml' => __DIR__ . '/_files/sitemap-index.xml' + '/sitemap-1-1.xml' => __DIR__ . '/_files/sitemap-1-1.xml', + '/sitemap-1-2.xml' => __DIR__ . '/_files/sitemap-1-2.xml', + '/sitemap-1-3.xml' => __DIR__ . '/_files/sitemap-1-3.xml', + '/sitemap-1-4.xml' => __DIR__ . '/_files/sitemap-1-4.xml', + '/sitemap.xml' => __DIR__ . '/_files/sitemap-index.xml' ); return array( @@ -359,15 +358,14 @@ class SitemapTest extends \PHPUnit_Framework_TestCase * @param array $robotsInfo * @return \Magento\Sitemap\Model\Sitemap|PHPUnit_Framework_MockObject_MockObject */ - protected function _prepareSitemapModelMock(&$actualData, $maxLines, $maxFileSize, - $expectedFile, $expectedWrites, $robotsInfo + protected function _prepareSitemapModelMock( + &$actualData, + $maxLines, + $maxFileSize, + $expectedFile, + $expectedWrites, + $robotsInfo ) { - $fileMock = $this->getMockBuilder('Magento\Io\File') - ->setMethods(array('streamWrite', 'open', 'streamOpen', 'streamClose', - 'allowedPath', 'getCleanPath', 'fileExists', 'isWriteable', 'mv', 'read', 'write')) - ->getMock(); - $this->_prepareValidFileMock($fileMock); - // Check that all $expectedWrites lines were written $actualData = array(); $currentFile = ''; @@ -379,13 +377,13 @@ class SitemapTest extends \PHPUnit_Framework_TestCase }; // Check that all expected lines were written - $fileMock->expects($this->exactly($expectedWrites)) - ->method('streamWrite') + $this->_fileMock->expects($this->exactly($expectedWrites)) + ->method('write') ->will($this->returnCallback($streamWriteCallback)); // Check that all expected file descriptors were created - $fileMock->expects($this->exactly(count($expectedFile))) - ->method('streamOpen') + $this->_directoryMock->expects($this->exactly(count($expectedFile))) + ->method('openFile') ->will($this->returnCallback( function ($file) use (&$currentFile) { $currentFile = $file; @@ -393,16 +391,16 @@ class SitemapTest extends \PHPUnit_Framework_TestCase )); // Check that all file descriptors were closed - $fileMock->expects($this->exactly(count($expectedFile))) - ->method('streamClose'); + $this->_fileMock->expects($this->exactly(count($expectedFile))) + ->method('close'); if (count($expectedFile) == 1) { - $fileMock->expects($this->once()) - ->method('mv') + $this->_directoryMock->expects($this->once()) + ->method('renameFile') ->will($this->returnCallback( function ($from, $to) { - \PHPUnit_Framework_Assert::assertEquals('sitemap-1-1.xml', $from); - \PHPUnit_Framework_Assert::assertEquals('sitemap.xml', $to); + \PHPUnit_Framework_Assert::assertEquals('/sitemap-1-1.xml', $from); + \PHPUnit_Framework_Assert::assertEquals('/sitemap.xml', $to); } )); } @@ -416,12 +414,12 @@ class SitemapTest extends \PHPUnit_Framework_TestCase if (isset($robotsInfo['robotsFinish'])) { $robotsFinish = $robotsInfo['robotsFinish']; } - $fileMock->expects($this->any()) - ->method('read') + $this->_directoryMock->expects($this->any()) + ->method('readFile') ->will($this->returnValue($robotsStart)); - $fileMock->expects($this->any()) + $this->_directoryMock->expects($this->any()) ->method('write') - ->with($this->equalTo('/project/robots.txt'), $this->equalTo($robotsFinish)); + ->with($this->equalTo('robots.txt'), $this->equalTo($robotsFinish)); // Mock helper methods @@ -439,40 +437,18 @@ class SitemapTest extends \PHPUnit_Framework_TestCase ->method('getEnableSubmissionRobots') ->will($this->returnValue($pushToRobots)); - $model = $this->_getModelMock($fileMock, true); + $model = $this->_getModelMock(true); return $model; } - /** - * Prepare file io mock with all validation passed - * - * @param $fileMock - */ - protected function _prepareValidFileMock($fileMock) - { - $fileMock->expects($this->any()) - ->method('allowedPath') - ->will($this->returnValue(true)); - $fileMock->expects($this->any()) - ->method('getCleanPath') - ->will($this->returnArgument(0)); - $fileMock->expects($this->any()) - ->method('fileExists') - ->will($this->returnValue(true)); - $fileMock->expects($this->any()) - ->method('isWriteable') - ->will($this->returnValue(true)); - } - /** * Get model mock object * - * @param \Magento\Io\File|PHPUnit_Framework_MockObject_MockObject $fileIoMock * @param bool $mockBeforeSave * @return \Magento\Sitemap\Model\Sitemap|PHPUnit_Framework_MockObject_MockObject */ - protected function _getModelMock($fileIoMock = null, $mockBeforeSave = false) + protected function _getModelMock($mockBeforeSave = false) { $methods = array('_construct', '_getResource', '_getBaseDir', '_getFileObject', '_afterSave', '_getStoreBaseUrl', '_getCurrentDateTime', '_getCategoryItemsCollection', '_getProductItemsCollection', @@ -532,21 +508,12 @@ class SitemapTest extends \PHPUnit_Framework_TestCase $model->expects($this->any()) ->method('_getResource') ->will($this->returnValue($this->_resourceMock)); - $model->expects($this->any()) - ->method('_getBaseDir') - ->will($this->returnValue('/project')); $model->expects($this->any()) ->method('_getStoreBaseUrl') ->will($this->returnValue('http://store.com/')); - if ($fileIoMock) { - $model->expects($this->any()) - ->method('_getFileObject') - ->will($this->returnValue($fileIoMock)); - } $model->expects($this->any()) ->method('_getCurrentDateTime') ->will($this->returnValue('2012-12-21T00:00:00-08:00')); - $model->expects($this->any()) ->method('_getDocumentRoot') ->will($this->returnValue('/project')); @@ -587,11 +554,6 @@ class SitemapTest extends \PHPUnit_Framework_TestCase ->method('create') ->will($this->returnValue($this->_sitemapCmsPageMock)); - $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface') - ->getMock(); - $filesystem = new \Magento\Filesystem($adapterMock); - - $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $constructArguments = $objectManager->getConstructArguments('Magento\Sitemap\Model\Sitemap', array( 'categoryFactory' => $categoryFactory, @@ -599,7 +561,7 @@ class SitemapTest extends \PHPUnit_Framework_TestCase 'cmsFactory' => $cmsFactory, 'coreData' => $this->_helperMockCore, 'sitemapData' => $this->_helperMockSitemap, - 'filesystem' => $filesystem + 'filesystem' => $this->_filesystemMock )); $constructArguments['resource'] = null; return $constructArguments; diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/Db/FileReaderTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/Db/FileReaderTest.php index 2bcd0a62d95..2de13db4b67 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/Db/FileReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/Db/FileReaderTest.php @@ -43,8 +43,7 @@ class FileReaderTest extends \PHPUnit_Framework_TestCase public function testExtractData() { - $filePath = __DIR__ . DIRECTORY_SEPARATOR . '../_files' . DIRECTORY_SEPARATOR . 'log' - . DIRECTORY_SEPARATOR . 'AclXPathToAclId.log'; + $filePath = __DIR__ . '/../_files/log/AclXPathToAclId.log'; $expectedMap = array( "admin/test1/test2" => "Test1_Test2::all", "admin/test1/test2/test3" => "Test1_Test2::test3", diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/GeneratorRemoveTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/GeneratorRemoveTest.php index 040202ce005..fcf801157e7 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/GeneratorRemoveTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/GeneratorRemoveTest.php @@ -65,8 +65,8 @@ class GeneratorRemoveTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $fixturePath = realpath(__DIR__) . DIRECTORY_SEPARATOR . '_files'; - $path = $fixturePath . DIRECTORY_SEPARATOR . 'remove' . DIRECTORY_SEPARATOR; + $fixturePath = realpath(__DIR__) . '/_files'; + $path = $fixturePath . '/remove/'; $this->_emptyFile = $path . 'empty.xml'; $this->_notEmptyFile = $path . 'not_empty.xml'; diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/GeneratorSaveTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/GeneratorSaveTest.php index 5be0deb47c2..5a8337fed7c 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/GeneratorSaveTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/GeneratorSaveTest.php @@ -75,11 +75,11 @@ class GeneratorSaveTest extends \PHPUnit_Framework_TestCase $this->_fileManagerMock = $this->getMock('Magento\Tools\Migration\Acl\FileManager'); $this->_model = new \Magento\Tools\Migration\Acl\Generator($this->_xmlFormatterMock, $this->_fileManagerMock); - $this->_fixturePath = realpath(__DIR__) . DIRECTORY_SEPARATOR . '_files'; - $path = $this->_fixturePath . DIRECTORY_SEPARATOR . 'save' . DIRECTORY_SEPARATOR; + $this->_fixturePath = realpath(__DIR__) . '/_files'; + $path = $this->_fixturePath . '/save/'; $this->_originFile = $path . 'adminhtml.xml'; - $this->_aclFile = $path . 'adminhtml' . DIRECTORY_SEPARATOR . 'acl.xml'; + $this->_aclFile = $path . 'adminhtml/acl.xml'; $dom = new \DOMDocument(); $config = $dom->createElement('config'); diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/GeneratorTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/GeneratorTest.php index 030616576f2..f6e9aceaa52 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/GeneratorTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/GeneratorTest.php @@ -71,18 +71,16 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase $this->_fileManagerMock = $this->getMock('Magento\Tools\Migration\Acl\FileManager'); $this->_model = new \Magento\Tools\Migration\Acl\Generator($this->_xmlFormatterMock, $this->_fileManagerMock); - $this->_fixturePath = realpath(__DIR__) . DIRECTORY_SEPARATOR . '_files'; + $this->_fixturePath = realpath(__DIR__) . '/_files'; - $prefix = $this->_fixturePath . DIRECTORY_SEPARATOR - . 'app' . DIRECTORY_SEPARATOR - . 'code' . DIRECTORY_SEPARATOR; - $suffix = DIRECTORY_SEPARATOR . 'etc' . DIRECTORY_SEPARATOR . 'adminhtml.xml'; + $prefix = $this->_fixturePath . '/app/code/'; + $suffix = '/etc/adminhtml.xml'; $this->_adminhtmlFiles = array( - $prefix . 'local' . DIRECTORY_SEPARATOR . 'Namespace' . DIRECTORY_SEPARATOR . 'Module' . $suffix, - $prefix . 'community' . DIRECTORY_SEPARATOR . 'Namespace' . DIRECTORY_SEPARATOR . 'Module' . $suffix, - $prefix . 'core' . DIRECTORY_SEPARATOR . 'ANamespace' . DIRECTORY_SEPARATOR . 'Module' . $suffix, - $prefix . 'core' . DIRECTORY_SEPARATOR . 'BNamespace' . DIRECTORY_SEPARATOR . 'Module' . $suffix, + $prefix . 'local/Namespace/Module' . $suffix, + $prefix . 'community/Namespace/Module' . $suffix, + $prefix . 'core/ANamespace/Module' . $suffix, + $prefix . 'core/BNamespace/Module' . $suffix, ); $this->_model->setAdminhtmlFiles($this->_adminhtmlFiles); @@ -108,25 +106,11 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase { return array( array( - 'filePath' => DIRECTORY_SEPARATOR - . 'app' . DIRECTORY_SEPARATOR - . 'code' . DIRECTORY_SEPARATOR - . 'core' . DIRECTORY_SEPARATOR - . 'ANamespace' . DIRECTORY_SEPARATOR - . 'ModuleOne' . DIRECTORY_SEPARATOR - . 'etc' . DIRECTORY_SEPARATOR - . 'adminhtml.xml', + 'filePath' => '/app/code/core/ANamespace/ModuleOne/etc/adminhtml.xml', 'moduleName' => 'ANamespace_ModuleOne', ), array( - 'filePath' => DIRECTORY_SEPARATOR - . 'app' . DIRECTORY_SEPARATOR - . 'code' . DIRECTORY_SEPARATOR - . 'core' . DIRECTORY_SEPARATOR - . 'BNamespace' . DIRECTORY_SEPARATOR - . 'ModuleOne' . DIRECTORY_SEPARATOR - . 'etc' . DIRECTORY_SEPARATOR - . 'adminhtml.xml', + 'filePath' => '/app/code/core/BNamespace/ModuleOne/etc/adminhtml.xml', 'moduleName' => 'BNamespace_ModuleOne', ), ); @@ -177,24 +161,12 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase { return array( array( - 'expectedPath' => DIRECTORY_SEPARATOR - . 'app' . DIRECTORY_SEPARATOR - . 'code' . DIRECTORY_SEPARATOR - . '*' . DIRECTORY_SEPARATOR - . '*' . DIRECTORY_SEPARATOR - . '*' . DIRECTORY_SEPARATOR - . 'etc' . DIRECTORY_SEPARATOR, + 'expectedPath' => '/app/code/*/*/*/etc/', 'codePool' => '*', 'namespace' => '*', ), array( - 'expectedPath' => DIRECTORY_SEPARATOR - . 'app' . DIRECTORY_SEPARATOR - . 'code' . DIRECTORY_SEPARATOR - . 'core' . DIRECTORY_SEPARATOR - . 'Magento' . DIRECTORY_SEPARATOR - . '*' . DIRECTORY_SEPARATOR - . 'etc' . DIRECTORY_SEPARATOR, + 'expectedPath' => '/app/code/core/Magento/*/etc/', 'codePool' => 'core', 'namespace' => 'Magento', ), @@ -265,11 +237,11 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase $moduleName = 'Module_Name'; $sourceDom = new \DOMDocument(); - $sourceDom->load($this->_fixturePath . DIRECTORY_SEPARATOR . 'parse_node_source.xml'); + $sourceDom->load($this->_fixturePath . '/parse_node_source.xml'); $nodeList = $sourceDom->getElementsByTagName('resources'); $this->_model->parseNode($nodeList->item(0), $dom, $parentNode, $moduleName); $expectedDom = new \DOMDocument(); - $expectedDom->load($this->_fixturePath . DIRECTORY_SEPARATOR . 'parse_node_result.xml'); + $expectedDom->load($this->_fixturePath . '/parse_node_result.xml'); $this->assertEquals($expectedDom->saveXML($expectedDom->documentElement), $dom->saveXML($dom->documentElement)); } @@ -326,8 +298,8 @@ TEMPLATE; public function testUpdateChildAclNodes() { $dom = new \DOMDocument(); - $fileActual = $this->_fixturePath . DIRECTORY_SEPARATOR . 'update_child_acl_nodes_source.xml'; - $fileExpected = $this->_fixturePath . DIRECTORY_SEPARATOR . 'update_child_acl_nodes_result.xml'; + $fileActual = $this->_fixturePath . '/update_child_acl_nodes_source.xml'; + $fileExpected = $this->_fixturePath . '/update_child_acl_nodes_result.xml'; $dom->load($fileActual); $rootNode = $dom->getElementsByTagName('resources')->item(0); diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/Menu/GeneratorTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/Menu/GeneratorTest.php index 9700aa77757..c1a8bb1de05 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/Menu/GeneratorTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/Acl/Menu/GeneratorTest.php @@ -62,7 +62,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_fixturePath = realpath(__DIR__ . '/../') . DIRECTORY_SEPARATOR . '_files'; + $this->_fixturePath = realpath(__DIR__ . '/../') . '/_files'; $aclXPathToId = array( 'config/acl/resources/admin/system' => 'Module_Name::acl_resource', @@ -80,16 +80,14 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase false ); - $prefix = $this->_fixturePath . DIRECTORY_SEPARATOR - . 'app' . DIRECTORY_SEPARATOR - . 'code' . DIRECTORY_SEPARATOR; - $suffix = DIRECTORY_SEPARATOR . 'etc' . DIRECTORY_SEPARATOR . 'adminhtml' . DIRECTORY_SEPARATOR . 'menu.xml'; + $prefix = $this->_fixturePath . '/app/code/'; + $suffix = '/etc/adminhtml/menu.xml'; $this->_menuFiles = array( - $prefix . 'community' . DIRECTORY_SEPARATOR . 'Namespace' . DIRECTORY_SEPARATOR . 'Module' . $suffix, - $prefix . 'core' . DIRECTORY_SEPARATOR . 'ANamespace' . DIRECTORY_SEPARATOR . 'Module' . $suffix, - $prefix . 'core' . DIRECTORY_SEPARATOR . 'BNamespace' . DIRECTORY_SEPARATOR . 'Module' . $suffix, - $prefix . 'local' . DIRECTORY_SEPARATOR . 'Namespace' . DIRECTORY_SEPARATOR . 'Module' . $suffix, + $prefix . 'community/Namespace/Module' . $suffix, + $prefix . 'core/ANamespace/Module' . $suffix, + $prefix . 'core/BNamespace/Module' . $suffix, + $prefix . 'local/Namespace/Module' . $suffix, ); $this->_menuIdToXPath = array( @@ -104,13 +102,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase public function testGetEtcPattern() { - $path = $this->_fixturePath . DIRECTORY_SEPARATOR - . 'app' . DIRECTORY_SEPARATOR - . 'code' . DIRECTORY_SEPARATOR - . '*' . DIRECTORY_SEPARATOR - . '*' . DIRECTORY_SEPARATOR - . '*' . DIRECTORY_SEPARATOR - . 'etc' . DIRECTORY_SEPARATOR; + $path = $this->_fixturePath . '/app/code/*/*/*/etc/'; $this->assertEquals($path, $this->_model->getEtcDirPattern()); } @@ -215,8 +207,8 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase public function testUpdateMenuAttributes() { - $menuFileSource = $this->_fixturePath . DIRECTORY_SEPARATOR . 'update_menu_attributes_source.xml'; - $menuFileResult = $this->_fixturePath . DIRECTORY_SEPARATOR . 'update_menu_attributes_result.xml'; + $menuFileSource = $this->_fixturePath . '/update_menu_attributes_source.xml'; + $menuFileResult = $this->_fixturePath . '/update_menu_attributes_result.xml'; $domSource = new \DOMDocument(); $domSource->load($menuFileSource); 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 751f20ba196..fac4abc386e 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 @@ -29,14 +29,14 @@ require_once __DIR__ . '/../../../../../../../../tools/Magento/Tools/View/Genera class CopyRuleTest extends \PHPUnit_Framework_TestCase { /** - * @var Generator_CopyRule + * @var \Magento\Tools\View\Generator\CopyRule */ protected $_object; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_filesystem; + protected $_directoryMock; /** * @var \Magento\Core\Model\Theme\Collection @@ -50,22 +50,32 @@ class CopyRuleTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array('searchKeys', 'isDirectory'), array( - $this->getMockForAbstractClass('Magento\Filesystem\AdapterInterface') - )); + $filesystemMock = $this->getMock( + 'Magento\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', false + ); + $this->_directoryMock = $this->getMock( + '\Magento\Filesystem\Directory\Read', + array('search', 'isDirectory', 'getAbsolutePath'), + array(), + '', + false + ); + $filesystemMock->expects($this->any()) + ->method('getDirectoryRead') + ->will($this->returnValue($this->_directoryMock)); $this->_themeCollection = $this->getMock( 'Magento\Core\Model\Theme\Collection', array('isLoaded'), array( $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false), - $this->_filesystem, - new \Magento\App\Dir(__DIR__) + $filesystemMock, + $this->getMock('\Magento\Config\FileIteratorFactory', array(), array(), '', false) ) ); $this->_themeCollection->expects($this->any())->method('isLoaded')->will($this->returnValue(true)); $this->_fallbackRule = $this->getMockForAbstractClass('Magento\View\Design\Fallback\Rule\RuleInterface'); $this->_object = new \Magento\Tools\View\Generator\CopyRule( - $this->_filesystem, + $filesystemMock, $this->_themeCollection, $this->_fallbackRule ); @@ -74,7 +84,7 @@ class CopyRuleTest extends \PHPUnit_Framework_TestCase protected function tearDown() { $this->_object = null; - $this->_filesystem = null; + $this->_directoryMock = null; $this->_themeCollection = null; $this->_fallbackRule = null; } @@ -97,12 +107,17 @@ class CopyRuleTest extends \PHPUnit_Framework_TestCase ->method('getPatternDirs') ->will($this->returnValueMap($patternDirMap)) ; - $this->_filesystem + $this->_directoryMock ->expects($this->atLeastOnce()) - ->method('searchKeys') + ->method('search') ->will($this->returnValueMap($filesystemGlobMap)) ; - $this->_filesystem + $this->_directoryMock + ->expects($this->any()) + ->method('getAbsolutePath') + ->will($this->returnArgument(0)) + ; + $this->_directoryMock ->expects($this->atLeastOnce()) ->method('isDirectory') ->will($this->returnValue(true)) @@ -152,12 +167,6 @@ class CopyRuleTest extends \PHPUnit_Framework_TestCase $fixture['theme_customizing_no_modules']['expected_result'] ), ), - 'mixed directory separators in fallback pattern' => array( - array($fixture['fallback_pattern_mixing_slashes']['theme']), - $patternDirMap, - $filesystemGlobMap, - $fixture['fallback_pattern_mixing_slashes']['expected_result'], - ), ); } } 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 191386f8d1b..6b997f46553 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 @@ -41,18 +41,35 @@ class ThemeDeploymentTest extends \PHPUnit_Framework_TestCase */ protected $_tmpDir; + /** + * @var \Magento\Filesystem | \PHPUnit_Framework_MockObject_MockObject + */ + protected $filesystem; + + /** + * @var \Magento\Filesystem\Driver\File + */ + protected $filesystemAdapter; + protected function setUp() { - $filesystem = new \Magento\Filesystem(new \Magento\Filesystem\Adapter\Local()); - $dirs = new \Magento\App\Dir($filesystem->normalizePath(__DIR__ . '/../../../../../../')); - $this->_cssUrlResolver = new \Magento\View\Url\CssResolver($filesystem, $dirs); - $this->_tmpDir = TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . 'tool_theme_deployment'; - mkdir($this->_tmpDir); + $methods = array('getDirectoryWrite', 'getPath', '__wakeup'); + $this->filesystem = $this->getMock('Magento\Filesystem', $methods, array(), '', false); + $this->filesystem->expects($this->any()) + ->method('getPath') + ->with(\Magento\Filesystem::ROOT) + ->will($this->returnValue(BP)); + + $this->_cssUrlResolver = new \Magento\View\Url\CssResolver($this->filesystem); + $this->_tmpDir = TESTS_TEMP_DIR . '/tool_theme_deployment'; + + $this->filesystemAdapter = new \Magento\Filesystem\Driver\File(); + $this->filesystemAdapter->createDirectory($this->_tmpDir, 0777); } protected function tearDown() { - \Magento\Io\File::rmdirRecursive($this->_tmpDir); + $this->filesystemAdapter->deleteDirectory($this->_tmpDir); } /** @@ -102,6 +119,11 @@ class ThemeDeploymentTest extends \PHPUnit_Framework_TestCase $forbidden = __DIR__ . '/_files/ThemeDeployment/run/forbidden.php'; $fixture = include __DIR__ . '/_files/ThemeDeployment/run/fixture.php'; + $this->filesystem->expects($this->any()) + ->method('getPath') + ->with(\Magento\Filesystem::ROOT) + ->will($this->returnValue(BP)); + $object = new \Magento\Tools\View\Generator\ThemeDeployment($this->_cssUrlResolver, $this->_tmpDir, $permitted, $forbidden); $object->run($fixture['copyRules']); @@ -148,7 +170,7 @@ class ThemeDeploymentTest extends \PHPUnit_Framework_TestCase { rsort($paths, SORT_STRING); foreach ($paths as &$path) { - $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path); + $path = str_replace(array('/', '\\'), '/', $path); } return $paths; } @@ -167,7 +189,6 @@ class ThemeDeploymentTest extends \PHPUnit_Framework_TestCase $this->assertEmpty($actualPaths, 'Nothing must be copied/created in dry-run mode'); } - /** * @expectedException \Magento\Exception * @expectedExceptionMessage The file extension "php" must be added either to the permitted or forbidden list diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/_files/fixture_themes.php b/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/_files/fixture_themes.php index 341b2a9470e..213cc8694a9 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/_files/fixture_themes.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/_files/fixture_themes.php @@ -60,7 +60,7 @@ return array( ), 'filesystem_glob_map' => array( array( - '/base/dir/area_one/fixture/theme_one/', '*_*', + '#.*_.*#', '/base/dir/area_one/fixture/theme_one/', array('/base/dir/area_one/fixture/theme_one/Magento_Core'), ), ), @@ -103,7 +103,7 @@ return array( ), 'filesystem_glob_map' => array( array( - '/base/dir/area_one/fixture/theme_two/', '*_*', + '#.*_.*#', '/base/dir/area_one/fixture/theme_two/', array( '/base/dir/area_one/fixture/theme_two/Fixture_ModuleOne', '/base/dir/area_one/fixture/theme_two/Fixture_ModuleTwo', @@ -160,7 +160,7 @@ return array( ), 'filesystem_glob_map' => array( array( - '/base/dir/area_two/fixture/theme_three/', '*_*', + '#.*_.*#', '/base/dir/area_two/fixture/theme_three/', array(), ), ), @@ -176,40 +176,4 @@ return array( ), ), ), - 'fallback_pattern_mixing_slashes' => array( - 'theme' => $themeFour, - 'pattern_dir_map' => array( - array( - array('area' => 'area_two', 'theme' => $themeFour), - array( - '/base/dir/area_two\\fixture\\theme_four', - ), - ), - array( - array( - 'area' => 'area_two', 'theme' => $themeFour, 'namespace' => '%namespace%', 'module' => '%module%' - ), - array( - '/base/dir/area_two\\fixture\\theme_four\\%namespace%_%module%', - ), - ), - ), - 'filesystem_glob_map' => array( - array( - '/base/dir/area_two/fixture/theme_four/', '*_*', - array(), - ), - ), - 'expected_result' => array( - array( - 'source' => '/base/dir/area_two/fixture/theme_four', - 'destinationContext' => array( - 'area' => 'area_two', - 'themePath' => 'fixture/theme_four', - 'locale' => null, - 'module' => null, - ) - ), - ), - ), ); diff --git a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/CssTest.php b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/CssTest.php index 36bae277bcc..770601dab68 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/CssTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/CssTest.php @@ -63,7 +63,6 @@ class CssTest extends \PHPUnit_Framework_TestCase array( 'formFactory' => $this->getMock('Magento\Data\FormFactory', array(), array(), '', false), 'objectManager' => $this->_objectManager, - 'dirs' => new \Magento\App\Dir(__DIR__), 'uploaderService' => $this->getMock( 'Magento\Theme\Model\Uploader\Service', array(), array(), '', false ), diff --git a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/ContentTest.php b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/ContentTest.php index c87eae9c330..067ee0e1036 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/ContentTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/ContentTest.php @@ -59,17 +59,14 @@ class ContentTest extends \PHPUnit_Framework_TestCase 'Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content', array( 'urlBuilder' => $this->_urlBuilder, - 'request' => $this->_request + 'request' => $this->_request, + 'storageHelper' => $this->_helperStorage, ) ); - $this->_filesContent = $this->getMock( - 'Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content', array('helper'), $constructArguments + $this->_filesContent = $objectManagerHelper->getObject( + 'Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content', + $constructArguments ); - - $this->_filesContent->expects($this->any()) - ->method('helper') - ->with('Magento\Theme\Helper\Storage') - ->will($this->returnValue($this->_helperStorage)); } /** diff --git a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/TreeTest.php b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/TreeTest.php index 383f41b7065..8cd06d8e4f8 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/TreeTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/Wysiwyg/Files/TreeTest.php @@ -50,18 +50,11 @@ class TreeTest extends \PHPUnit_Framework_TestCase $this->_urlBuilder = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $constructArguments = $objectManagerHelper->getConstructArguments( - 'Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content', - array('urlBuilder' => $this->_urlBuilder) - ); - $this->_filesTree = $this->getMock( - 'Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Tree', array('helper'), $constructArguments - ); + $this->_filesTree = $objectManagerHelper->getObject( + 'Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Tree', + array('urlBuilder' => $this->_urlBuilder, 'storageHelper' => $this->_helperStorage) - $this->_filesTree->expects($this->any()) - ->method('helper') - ->with('Magento\Theme\Helper\Storage') - ->will($this->returnValue($this->_helperStorage)); + ); } public function testGetTreeLoaderUrl() 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 a0b89aaabb6..50f475c9681 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeaderTest.php @@ -34,16 +34,25 @@ class HeaderTest extends \PHPUnit_Framework_TestCase */ public function testGetLogoSrc() { + $filesystem = $this->getMock('\Magento\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); + + $urlBuilder = $this->getMock('Magento\UrlInterface'); + $storeConfig->expects($this->once()) ->method('getConfig') ->will($this->returnValue('default/image.gif')); - - $urlBuilder = $this->getMock('Magento\UrlInterface'); $urlBuilder->expects($this->once()) ->method('getBaseUrl') ->will($this->returnValue('http://localhost/pub/media/')); + $mediaDirectory->expects($this->any()) + ->method('isFile') + ->will($this->returnValue(true)); + $filesystem->expects($this->any()) + ->method('getDirectoryRead') + ->will($this->returnValue($mediaDirectory)); $helper = $this->getMock('Magento\Core\Helper\File\Storage\Database', array('checkDbUsage'), array(), '', false, false ); @@ -51,24 +60,13 @@ class HeaderTest extends \PHPUnit_Framework_TestCase ->method('checkDbUsage') ->will($this->returnValue(false)); - $helperFactory = $this->getMock('Magento\App\Helper\HelperFactory', array('get'), array(), '', false); - $helperFactory->expects($this->once()) - ->method('get') - ->will($this->returnValue($helper)); - - $dirsMock = $this->getMock('Magento\App\Dir', array('getDir'), array(), '', false); - $dirsMock->expects($this->any()) - ->method('getDir') - ->with(\Magento\App\Dir::MEDIA) - ->will($this->returnValue(__DIR__ . DIRECTORY_SEPARATOR . '_files')); - $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $arguments = array( 'storeConfig' => $storeConfig, 'urlBuilder' => $urlBuilder, - 'helperFactory' => $helperFactory, - 'dirs' => $dirsMock + 'fileStorageHelper' => $helper, + 'filesystem' => $filesystem ); $block = $objectManager->getObject('Magento\Theme\Block\Html\Header', $arguments); diff --git a/dev/tests/unit/testsuite/Magento/Theme/Helper/StorageTest.php b/dev/tests/unit/testsuite/Magento/Theme/Helper/StorageTest.php index d8315a11c0f..14d6c0c6ae0 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Helper/StorageTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Helper/StorageTest.php @@ -32,97 +32,129 @@ namespace Magento\Theme\Helper; class StorageTest extends \PHPUnit_Framework_TestCase { /** - * @var null|\Magento\Filesystem|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ - protected $_filesystem; + protected $filesystem; /** - * @var \Magento\Backend\Model\Session|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Backend\Model\Session|\PHPUnit_Framework_MockObject_MockObject */ - protected $_session; + protected $session; /** - * @var \Magento\View\Design\Theme\FlyweightFactory|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\View\Design\Theme\FlyweightFactory|\PHPUnit_Framework_MockObject_MockObject */ - protected $_themeFactory; + protected $themeFactory; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_request; + protected $request; /** * @var \Magento\Theme\Helper\Storage */ - protected $_storageHelper; + protected $helper; /** * @var string */ - protected $_customizationPath; + protected $customizationPath; - protected function setUp() - { - $this->_customizationPath = \Magento\Filesystem::DIRECTORY_SEPARATOR - . implode(\Magento\Filesystem::DIRECTORY_SEPARATOR, array('var', 'theme')); - - $this->_request = $this->getMock('\Magento\App\Request\Http', array(), array(), '', false); - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $this->_session = $this->getMock('Magento\Backend\Model\Session', array(), array(), '', false); - $this->_themeFactory = $this->getMock('Magento\View\Design\Theme\FlyweightFactory', array('create'), array(), - '', false); + /** + * @var \Magento\Filesystem\Directory\Write|\PHPUnit_Framework_MockObject_MockObject + */ + protected $directoryWrite; - $this->_storageHelper = $this->getMock('Magento\Theme\Helper\Storage', - array('_getRequest', 'urlDecode'), array(), '', false - ); - $this->_storageHelper->expects($this->any()) - ->method('_getRequest') - ->will($this->returnValue($this->_request)); - $this->_storageHelper->expects($this->any()) - ->method('urlDecode') - ->will($this->returnArgument(0)); - - $filesystemProperty = new \ReflectionProperty($this->_storageHelper, '_filesystem'); - $filesystemProperty->setAccessible(true); - $filesystemProperty->setValue($this->_storageHelper, $this->_filesystem); - - $sessionProperty = new \ReflectionProperty($this->_storageHelper, '_session'); - $sessionProperty->setAccessible(true); - $sessionProperty->setValue($this->_storageHelper, $this->_session); - - $themeFactoryProperty = new \ReflectionProperty($this->_storageHelper, '_themeFactory'); - $themeFactoryProperty->setAccessible(true); - $themeFactoryProperty->setValue($this->_storageHelper, $this->_themeFactory); - } + /** + * @var \Magento\App\Helper\Context|\PHPUnit_Framework_MockObject_MockObject + */ + protected $contextHelper; - protected function tearDown() - { - $this->_filesystem = null; - $this->_session = null; - $this->_themeFactory = null; - $this->_request = null; - $this->_storageHelper = null; - $this->_customizationPath = null; - } + /** + * @var \Magento\Core\Model\Theme|\PHPUnit_Framework_MockObject_MockObject + */ + protected $theme; /** - * @param $path + * @var \Magento\View\Design\Theme\Customization|\PHPUnit_Framework_MockObject_MockObject */ - protected function _mockStorageRoot($path) + protected $customization; + + protected $requestParams; + + protected function setUp() { - $storageRootProperty = new \ReflectionProperty($this->_storageHelper, '_storageRoot'); - $storageRootProperty->setAccessible(true); - $storageRootProperty->setValue($this->_storageHelper, $path); + $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->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); + $this->themeFactory = $this->getMock( + 'Magento\View\Design\Theme\FlyweightFactory', + array(), + array(), + '', + false + ); + $this->theme = $this->getMock('Magento\Core\Model\Theme', array(), array(), '', false); + $this->customization = $this->getMock( + 'Magento\View\Design\Theme\Customization', + array(), + array(), + '', + false + ); + + $this->filesystem->expects($this->once()) + ->method('getDirectoryWrite') + ->will($this->returnValue($this->directoryWrite)); + + $this->directoryWrite->expects($this->any()) + ->method('create') + ->will($this->returnValue(true)); + + $this->contextHelper->expects($this->once()) + ->method('getRequest') + ->will($this->returnValue($this->request)); + + $this->themeFactory->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->theme)); + + $this->theme->expects($this->any()) + ->method('getCustomization') + ->will($this->returnValue($this->customization)); + + $this->request->expects($this->at(0)) + ->method('getParam') + ->with(\Magento\Theme\Helper\Storage::PARAM_THEME_ID) + ->will($this->returnValue(6)); + $this->request->expects($this->at(1)) + ->method('getParam') + ->with(\Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE) + ->will($this->returnValue(\Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE)); + + $this->helper = new \Magento\Theme\Helper\Storage( + $this->contextHelper, + $this->filesystem, + $this->session, + $this->themeFactory + ); } - /** - * @param $path - */ - protected function _mockCurrentPath($path) + protected function tearDown() { - $currentPathProperty = new \ReflectionProperty($this->_storageHelper, '_currentPath'); - $currentPathProperty->setAccessible(true); - $currentPathProperty->setValue($this->_storageHelper, $path); + $this->request = null; + $this->filesystem = null; + $this->session = null; + $this->contextHelper = null; + $this->directoryWrite = null; + $this->themeFactory = null; + $this->theme = null; + $this->customization = null; } /** @@ -132,137 +164,85 @@ class StorageTest extends \PHPUnit_Framework_TestCase { $longFileName = 'veryLongFileNameMoreThanTwenty'; $expectedFileName = 'veryLongFileNameMore...'; - $this->assertEquals($expectedFileName, $this->_storageHelper->getShortFilename($longFileName, 20)); + $this->assertEquals($expectedFileName, $this->helper->getShortFilename($longFileName, 20)); } - /** - * @covers \Magento\Theme\Helper\Storage::getStorageRoot - * @covers \Magento\Theme\Helper\Storage::_getTheme - * @covers \Magento\Theme\Helper\Storage::getStorageType - */ public function testGetStorageRoot() { - $themeId = 6; - $requestMap = array( - array(\Magento\Theme\Helper\Storage::PARAM_THEME_ID, null, $themeId), - array( - \Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE, - null, - \Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE - ) - ); - $this->_request->expects($this->any()) - ->method('getParam') - ->will($this->returnValueMap($requestMap)); - - $themeModel = $this->getMock('Magento\Core\Model\Theme', array(), array(), '', false); - $this->_themeFactory->expects($this->any())->method('create')->will($this->returnValue($themeModel)); - $themeModel->expects($this->any())->method('getId')->will($this->returnValue($themeId)); - $customization = $this->getMock('Magento\View\Design\Theme\Customization', array(), array(), '', false); - $themeModel->expects($this->any())->method('getCustomization')->will($this->returnValue($customization)); - $customization->expects($this->any()) - ->method('getCustomizationPath') - ->will($this->returnValue($this->_customizationPath)); - - $expectedStorageRoot = implode(\Magento\Filesystem::DIRECTORY_SEPARATOR, array( - $this->_customizationPath, - \Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE - )); - $this->assertEquals($expectedStorageRoot, $this->_storageHelper->getStorageRoot()); + $expectedStorageRoot = '/' . \Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE; + $this->assertEquals($expectedStorageRoot, $this->helper->getStorageRoot()); } - /** - * @covers \Magento\Theme\Helper\Storage::getThumbnailDirectory - */ public function testGetThumbnailDirectory() { - $imagePath = implode(\Magento\Filesystem::DIRECTORY_SEPARATOR, array('root', 'image', 'image_name.jpg')); + $imagePath = implode('/', array('root', 'image', 'image_name.jpg')); $thumbnailDir = implode( - \Magento\Filesystem::DIRECTORY_SEPARATOR, + '/', array('root', 'image', \Magento\Theme\Model\Wysiwyg\Storage::THUMBNAIL_DIRECTORY) ); - $this->assertEquals($thumbnailDir, $this->_storageHelper->getThumbnailDirectory($imagePath)); + $this->assertEquals($thumbnailDir, $this->helper->getThumbnailDirectory($imagePath)); } - /** - * @covers \Magento\Theme\Helper\Storage::getThumbnailPath - */ public function testGetThumbnailPath() { $image = 'image_name.jpg'; - $storageRoot = $this->_customizationPath . \Magento\Filesystem::DIRECTORY_SEPARATOR - . \Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE; - $currentPath = $storageRoot . \Magento\Filesystem::DIRECTORY_SEPARATOR . 'some_dir'; - - $imagePath = $currentPath . \Magento\Filesystem::DIRECTORY_SEPARATOR . $image; - $thumbnailPath = implode( - \Magento\Filesystem::DIRECTORY_SEPARATOR, - array($currentPath, \Magento\Theme\Model\Wysiwyg\Storage::THUMBNAIL_DIRECTORY, $image) + $thumbnailPath = '/' . implode('/', array( + \Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE, + \Magento\Theme\Model\Wysiwyg\Storage::THUMBNAIL_DIRECTORY, $image) ); - $this->_filesystem->expects($this->atLeastOnce()) - ->method('has') - ->with($imagePath) - ->will($this->returnValue(true)); + $this->customization->expects($this->any()) + ->method('getCustomizationPath') + ->will($this->returnValue($this->customizationPath)); - $this->_filesystem->expects($this->atLeastOnce()) - ->method('isPathInDirectory') - ->with($imagePath, $storageRoot) + $this->directoryWrite->expects($this->any()) + ->method('isExist') ->will($this->returnValue(true)); - $this->_mockStorageRoot($storageRoot); - $this->_mockCurrentPath($currentPath); - - $this->assertEquals($thumbnailPath, $this->_storageHelper->getThumbnailPath($image)); + $this->assertEquals($thumbnailPath, $this->helper->getThumbnailPath($image)); } - /** - * @covers \Magento\Theme\Helper\Storage::getRequestParams - */ public function testGetRequestParams() { - $node = 'node'; - $themeId = 16; - $contentType = \Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE; - - $requestMap = array( - array(\Magento\Theme\Helper\Storage::PARAM_NODE, null, $node), - array(\Magento\Theme\Helper\Storage::PARAM_THEME_ID, null, $themeId), - array(\Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE, null, $contentType) - ); - $this->_request->expects($this->any()) + $this->request->expects($this->at(0)) ->method('getParam') - ->will($this->returnValueMap($requestMap)); + ->with(\Magento\Theme\Helper\Storage::PARAM_THEME_ID) + ->will($this->returnValue(6)); + $this->request->expects($this->at(1)) + ->method('getParam') + ->with(\Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE) + ->will($this->returnValue('image')); + $this->request->expects($this->at(2)) + ->method('getParam') + ->with(\Magento\Theme\Helper\Storage::PARAM_NODE) + ->will($this->returnValue('node')); $expectedResult = array( - \Magento\Theme\Helper\Storage::PARAM_THEME_ID => $themeId, - \Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE => $contentType, - \Magento\Theme\Helper\Storage::PARAM_NODE => $node + \Magento\Theme\Helper\Storage::PARAM_THEME_ID => 6, + \Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE => \Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE, + \Magento\Theme\Helper\Storage::PARAM_NODE => 'node' ); - $this->assertEquals($expectedResult, $this->_storageHelper->getRequestParams()); + $this->assertEquals($expectedResult, $this->helper->getRequestParams()); } - /** - * @covers \Magento\Theme\Helper\Storage::getAllowedExtensionsByType - */ public function testGetAllowedExtensionsByType() { - $this->_request->expects($this->at(0)) + $this->request->expects($this->at(0)) ->method('getParam') ->with(\Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE) ->will($this->returnValue(\Magento\Theme\Model\Wysiwyg\Storage::TYPE_FONT)); - $this->_request->expects($this->at(1)) + $this->request->expects($this->at(1)) ->method('getParam') ->with(\Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE) ->will($this->returnValue(\Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE)); - $fontTypes = $this->_storageHelper->getAllowedExtensionsByType(); + $fontTypes = $this->helper->getAllowedExtensionsByType(); $this->assertEquals(array('ttf', 'otf', 'eot', 'svg', 'woff'), $fontTypes); - $imagesTypes = $this->_storageHelper->getAllowedExtensionsByType(); + $imagesTypes = $this->helper->getAllowedExtensionsByType(); $this->assertEquals(array('jpg', 'jpeg', 'gif', 'png', 'xbm', 'wbmp'), $imagesTypes); } } diff --git a/dev/tests/unit/testsuite/Magento/Theme/Model/CopyServiceTest.php b/dev/tests/unit/testsuite/Magento/Theme/Model/CopyServiceTest.php index 57555b66d73..0f9454a1257 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/CopyServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/CopyServiceTest.php @@ -94,6 +94,8 @@ class CopyServiceTest extends \PHPUnit_Framework_TestCase */ protected $_sourceFiles = array(); + protected $_dirWriteMock; + protected function setUp() { $sourceFileOne = $this->getMock( @@ -144,9 +146,22 @@ class CopyServiceTest extends \PHPUnit_Framework_TestCase 'Magento\View\Design\Theme\FileFactory', array('create'), array(), '', false ); $this->_filesystem = $this->getMock( - 'Magento\Filesystem', array('isDirectory', 'searchKeys', 'copy', 'delete'), - array($this->getMockForAbstractClass('Magento\Filesystem\AdapterInterface')) + 'Magento\Filesystem', + array('getDirectoryWrite'), + array(), + '', + false ); + $this->_dirWriteMock = $this->getMock( + 'Magento\Filesystem\Directory\Write', + array('isDirectory', 'search', 'copy', 'delete', 'read', 'copyFile', 'isExist'), array(), + '', + false + ); + $this->_filesystem->expects($this->any()) + ->method('getDirectoryWrite') + ->with(\Magento\Filesystem::MEDIA) + ->will($this->returnValue($this->_dirWriteMock)); /* Init \Magento\Core\Model\Resource\Layout\Collection model */ $this->_updateFactory = $this->getMock('Magento\Core\Model\Layout\UpdateFactory', array('create'), @@ -378,28 +393,28 @@ class CopyServiceTest extends \PHPUnit_Framework_TestCase ->method('getCustomizationPath') ->will($this->returnValue('target/path')); - $this->_filesystem->expects($this->any()) + $this->_dirWriteMock->expects($this->any()) ->method('isDirectory')->will($this->returnValueMap(array( - array('source/path', null, true), + array('source/path', true), ))); - $this->_filesystem + $this->_dirWriteMock ->expects($this->any()) - ->method('searchKeys') + ->method('read') ->will($this->returnValueMap(array( - array('target/path', '*', array()), - array('source/path', '*', array('source/path/file_one.jpg', 'source/path/file_two.png')) + array('target/path', array()), + array('source/path', array('source/path/file_one.jpg', 'source/path/file_two.png')) ))); $expectedCopyEvents = array( - array('source/path/file_one.jpg', 'target/path/file_one.jpg', 'source/path', 'target/path'), - array('source/path/file_two.png', 'target/path/file_two.png', 'source/path', 'target/path'), + array('source/path/file_one.jpg', 'target/path/file_one.jpg', null), + array('source/path/file_two.png', 'target/path/file_two.png', null), ); $actualCopyEvents = array(); $recordCopyEvent = function () use (&$actualCopyEvents) { $actualCopyEvents[] = func_get_args(); }; - $this->_filesystem->expects($this->any())->method('copy')->will($this->returnCallback($recordCopyEvent)); + $this->_dirWriteMock->expects($this->any())->method('copyFile')->will($this->returnCallback($recordCopyEvent)); $this->_object->copy($this->_sourceTheme, $this->_targetTheme); 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 69183ee8110..82fc3e1a451 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/Uploader/ServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/Uploader/ServiceTest.php @@ -51,10 +51,15 @@ class ServiceTest extends \PHPUnit_Framework_TestCase protected $_fileSizeMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Io\File + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Filesystem */ protected $_filesystemMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Filesystem\Directory\Read + */ + protected $_directoryMock; + /** * @var int */ @@ -67,7 +72,11 @@ class ServiceTest extends \PHPUnit_Framework_TestCase 'Magento\Core\Model\File\UploaderFactory', array('create'), array(), '', false ); $this->_uploaderFactory->expects($this->any())->method('create')->will($this->returnValue($this->_uploader)); - $this->_filesystemMock = $this->getMock('Magento\Io\File', array('read'), array(), '', false); + $this->_directoryMock = $this->getMock('Magento\Filesystem\Directory\Read', array(), array(), '', false); + $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystemMock->expects($this->any()) + ->method('getDirectoryRead') + ->will($this->returnValue($this->_directoryMock)); /** @var $service \Magento\Theme\Model\Uploader\Service */ $this->_fileSizeMock = $this->getMockBuilder('Magento\File\Size') @@ -129,8 +138,17 @@ class ServiceTest extends \PHPUnit_Framework_TestCase public function testGetFileContent() { $fileName = 'file.name'; - $this->_filesystemMock->expects($this->once())->method('read')->with($fileName) + + $this->_directoryMock->expects($this->once()) + ->method('getRelativePath') + ->with($fileName) + ->will($this->returnValue($fileName)); + + $this->_directoryMock->expects($this->once()) + ->method('readFile') + ->with($fileName) ->will($this->returnValue('content from my file')); + $this->_service = new \Magento\Theme\Model\Uploader\Service( $this->_filesystemMock, $this->_fileSizeMock, @@ -154,8 +172,13 @@ class ServiceTest extends \PHPUnit_Framework_TestCase 'css' => '3M' ) ); + $this->_directoryMock->expects($this->once()) + ->method('getRelativePath') + ->with($fileName) + ->will($this->returnValue($fileName)); - $this->_filesystemMock->expects($this->once())->method('read')->with($fileName) + $this->_directoryMock->expects($this->once()) + ->method('readFile')->with($fileName) ->will($this->returnValue('content')); $this->_uploader->expects($this->once()) @@ -207,8 +230,14 @@ class ServiceTest extends \PHPUnit_Framework_TestCase 'js' => '500M' ) ); - - $this->_filesystemMock->expects($this->once())->method('read')->with($fileName) + $this->_directoryMock->expects($this->once()) + ->method('getRelativePath') + ->with($fileName) + ->will($this->returnValue($fileName)); + + $this->_directoryMock->expects($this->once()) + ->method('readFile') + ->with($fileName) ->will($this->returnValue('content')); $this->_uploader->expects($this->once()) 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 0f56634d23f..1f00f186c0f 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php @@ -61,12 +61,22 @@ class StorageTest extends \PHPUnit_Framework_TestCase */ protected $_imageFactory; + /** + * @var \Magento\Filesystem\Directory\Write|\PHPUnit_Framework_MockObject_MockObject + */ + protected $directoryWrite; + protected function setUp() { - $this->_filesystem = $this->getMock('Magento\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); + $this->_filesystem = $this->getMock('Magento\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); + $this->directoryWrite = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); + + $this->_filesystem->expects($this->once()) + ->method('getDirectoryWrite') + ->will($this->returnValue($this->directoryWrite)); $this->_storageModel = new \Magento\Theme\Model\Wysiwyg\Storage( $this->_filesystem, @@ -75,7 +85,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase $this->_imageFactory ); - $this->_storageRoot = \Magento\Filesystem::DIRECTORY_SEPARATOR . 'root'; + $this->_storageRoot = '/root'; } protected function tearDown() @@ -105,15 +115,14 @@ class StorageTest extends \PHPUnit_Framework_TestCase /** Prepare filesystem */ - $this->_filesystem->expects($this->any()) + $this->directoryWrite->expects($this->any()) ->method('isFile') ->will($this->returnValue(true)); - $this->_filesystem->expects($this->once()) + $this->directoryWrite->expects($this->once()) ->method('isReadable') ->will($this->returnValue(true)); - /** Prepare image */ $image = $this->getMock('Magento\Image\Adapter\Gd2', array(), array(), '', false); @@ -205,23 +214,18 @@ class StorageTest extends \PHPUnit_Framework_TestCase public function testCreateFolder($isWritable) { $newDirectoryName = 'dir1'; - $fullNewPath = $this->_storageRoot . \Magento\Filesystem::DIRECTORY_SEPARATOR . $newDirectoryName; + $fullNewPath = $this->_storageRoot . '/' . $newDirectoryName; - $this->_filesystem->expects($this->once()) + $this->directoryWrite->expects($this->any()) ->method('isWritable') ->with($this->_storageRoot) ->will($this->returnValue($isWritable)); - $this->_filesystem->expects($this->once()) - ->method('has') + $this->directoryWrite->expects($this->once()) + ->method('isExist') ->with($fullNewPath) ->will($this->returnValue(false)); - $this->_filesystem->expects($this->once()) - ->method('ensureDirectoryExists') - ->with($fullNewPath); - - $this->_helperStorage->expects($this->once()) ->method('getShortFilename') ->with($newDirectoryName) @@ -239,7 +243,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase $expectedResult = array( 'name' => $newDirectoryName, 'short_name' => $newDirectoryName, - 'path' => \Magento\Filesystem::DIRECTORY_SEPARATOR . $newDirectoryName, + 'path' => '/' . $newDirectoryName, 'id' => $newDirectoryName ); @@ -266,15 +270,15 @@ class StorageTest extends \PHPUnit_Framework_TestCase public function testCreateFolderDirectoryAlreadyExist() { $newDirectoryName = 'mew'; - $fullNewPath = $this->_storageRoot . \Magento\Filesystem::DIRECTORY_SEPARATOR . $newDirectoryName; + $fullNewPath = $this->_storageRoot . '/' . $newDirectoryName; - $this->_filesystem->expects($this->once()) + $this->directoryWrite->expects($this->any()) ->method('isWritable') ->with($this->_storageRoot) ->will($this->returnValue(true)); - $this->_filesystem->expects($this->once()) - ->method('has') + $this->directoryWrite->expects($this->once()) + ->method('isExist') ->with($fullNewPath) ->will($this->returnValue(true)); @@ -287,21 +291,20 @@ class StorageTest extends \PHPUnit_Framework_TestCase public function testGetDirsCollection() { $dirs = array( - $this->_storageRoot . \Magento\Filesystem::DIRECTORY_SEPARATOR . 'dir1', - $this->_storageRoot . \Magento\Filesystem::DIRECTORY_SEPARATOR . 'dir2' + $this->_storageRoot . '/dir1', + $this->_storageRoot . '/dir2' ); - $this->_filesystem->expects($this->once()) - ->method('has') + $this->directoryWrite->expects($this->any()) + ->method('isExist') ->with($this->_storageRoot) ->will($this->returnValue(true)); - $this->_filesystem->expects($this->once()) - ->method('searchKeys') - ->with($this->_storageRoot, '*') + $this->directoryWrite->expects($this->once()) + ->method('search') ->will($this->returnValue($dirs)); - $this->_filesystem->expects($this->any()) + $this->directoryWrite->expects($this->any()) ->method('isDirectory') ->will($this->returnValue(true)); @@ -314,8 +317,8 @@ class StorageTest extends \PHPUnit_Framework_TestCase */ public function testGetDirsCollectionWrongDirName() { - $this->_filesystem->expects($this->once()) - ->method('has') + $this->directoryWrite->expects($this->once()) + ->method('isExist') ->with($this->_storageRoot) ->will($this->returnValue(false)); @@ -341,16 +344,15 @@ class StorageTest extends \PHPUnit_Framework_TestCase $paths = array( - $this->_storageRoot . \Magento\Filesystem::DIRECTORY_SEPARATOR . 'font1.ttf', - $this->_storageRoot . \Magento\Filesystem::DIRECTORY_SEPARATOR . 'font2.ttf' + $this->_storageRoot . '/' . 'font1.ttf', + $this->_storageRoot . '/' . 'font2.ttf' ); - $this->_filesystem->expects($this->once()) - ->method('searchKeys') - ->with($this->_storageRoot, '*') + $this->directoryWrite->expects($this->once()) + ->method('search') ->will($this->returnValue($paths)); - $this->_filesystem->expects($this->any()) + $this->directoryWrite->expects($this->any()) ->method('isFile') ->will($this->returnValue(true)); @@ -379,17 +381,16 @@ class StorageTest extends \PHPUnit_Framework_TestCase ->will($this->returnArgument(0)); $paths = array( - $this->_storageRoot . \Magento\Filesystem::DIRECTORY_SEPARATOR . 'picture1.jpg' + $this->_storageRoot . '/picture1.jpg' ); - $this->_filesystem->expects($this->once()) - ->method('searchKeys') - ->with($this->_storageRoot, '*') + $this->directoryWrite->expects($this->once()) + ->method('search') ->will($this->returnValue($paths)); - $this->_filesystem->expects($this->once()) + $this->directoryWrite->expects($this->once()) ->method('isFile') - ->with($this->_storageRoot . \Magento\Filesystem::DIRECTORY_SEPARATOR . 'picture1.jpg') + ->with($this->_storageRoot . '/picture1.jpg') ->will($this->returnValue(true)); $result = $this->_storageModel->getFilesCollection(); @@ -404,10 +405,10 @@ class StorageTest extends \PHPUnit_Framework_TestCase */ public function testTreeArray() { - $currentPath = $this->_storageRoot . \Magento\Filesystem::DIRECTORY_SEPARATOR . 'dir'; + $currentPath = $this->_storageRoot . '/dir'; $dirs = array( - $currentPath . \Magento\Filesystem::DIRECTORY_SEPARATOR . 'dir_one', - $currentPath . \Magento\Filesystem::DIRECTORY_SEPARATOR . 'dir_two' + $currentPath . '/dir_one', + $currentPath . '/dir_two' ); $expectedResult = array( @@ -422,17 +423,16 @@ class StorageTest extends \PHPUnit_Framework_TestCase 'cls' => 'folder' )); - $this->_filesystem->expects($this->once()) - ->method('has') + $this->directoryWrite->expects($this->once()) + ->method('isExist') ->with($currentPath) ->will($this->returnValue(true)); - $this->_filesystem->expects($this->once()) - ->method('searchKeys') - ->with($currentPath, '*') + $this->directoryWrite->expects($this->once()) + ->method('search') ->will($this->returnValue($dirs)); - $this->_filesystem->expects($this->any()) + $this->directoryWrite->expects($this->any()) ->method('isDirectory') ->will($this->returnValue(true)); @@ -460,9 +460,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase { $image = 'image.jpg'; $storagePath = $this->_storageRoot; - $imagePath = $storagePath . \Magento\Filesystem::DIRECTORY_SEPARATOR . $image; - $thumbnailDir = $this->_storageRoot . \Magento\Filesystem::DIRECTORY_SEPARATOR - . \Magento\Theme\Model\Wysiwyg\Storage::THUMBNAIL_DIRECTORY; + $imagePath = $storagePath . '/' . $image; $session = $this->getMock('Magento\Backend\Model\Session', array('getStoragePath'), array(), '', false); $session->expects($this->atLeastOnce()) @@ -478,40 +476,20 @@ class StorageTest extends \PHPUnit_Framework_TestCase ->with($image) ->will($this->returnArgument(0)); - $this->_helperStorage->expects($this->atLeastOnce()) - ->method('getThumbnailDirectory') - ->with($imagePath) - ->will($this->returnValue($thumbnailDir)); - - $this->_helperStorage->expects($this->atLeastOnce()) - ->method('getStorageRoot') + $this->directoryWrite->expects($this->at(0)) + ->method('getRelativePath') + ->with($this->_storageRoot) ->will($this->returnValue($this->_storageRoot)); + $this->directoryWrite->expects($this->at(1)) + ->method('getRelativePath') + ->with($this->_storageRoot . '/' . $image) + ->will($this->returnValue($this->_storageRoot . '/' . $image)); - $filesystem = $this->_filesystem; - $filesystem::staticExpects($this->once()) - ->method('normalizePath') - ->with($imagePath) - ->will($this->returnValue($imagePath)); - - $this->_filesystem->expects($this->any()) - ->method('isPathInDirectory') - ->with($imagePath, $storagePath) - ->will($this->returnValue(true)); - - $this->_filesystem->expects($this->any()) - ->method('isPathInDirectory') - ->with($imagePath, $this->_storageRoot) - ->will($this->returnValue(true)); - - $this->_filesystem->expects($this->at(2)) + $this->directoryWrite->expects($this->any()) ->method('delete') ->with($imagePath); - $this->_filesystem->expects($this->at(3)) - ->method('delete') - ->with($thumbnailDir . \Magento\Filesystem::DIRECTORY_SEPARATOR . $image); - $this->assertInstanceOf('Magento\Theme\Model\Wysiwyg\Storage', $this->_storageModel->deleteFile($image)); } @@ -520,14 +498,13 @@ class StorageTest extends \PHPUnit_Framework_TestCase */ public function testDeleteDirectory() { - $directoryPath = $this->_storageRoot . \Magento\Filesystem::DIRECTORY_SEPARATOR . '..' - . \Magento\Filesystem::DIRECTORY_SEPARATOR . 'root'; + $directoryPath = $this->_storageRoot . '/../root'; $this->_helperStorage->expects($this->atLeastOnce()) ->method('getStorageRoot') ->will($this->returnValue($this->_storageRoot)); - $this->_filesystem->expects($this->once()) + $this->directoryWrite->expects($this->once()) ->method('delete') ->with($directoryPath); diff --git a/dev/tests/unit/testsuite/Magento/Validator/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Validator/ConfigTest.php index 18c1677e67e..4ddc39ccf0a 100644 --- a/dev/tests/unit/testsuite/Magento/Validator/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Validator/ConfigTest.php @@ -61,10 +61,14 @@ class ConfigTest extends \PHPUnit_Framework_TestCase if (null === $files) { $files = glob(__DIR__ . '/_files/validation/positive/*/validation.xml'); } + $configFiles = array(); + foreach ($files as $path) { + $configFiles[$path] = file_get_contents($path); + } $this->_config = $this->_objectManager->getObject( 'Magento\Validator\Config', array( - 'configFiles' => $files, + 'configFiles' => $configFiles, 'builderFactory' => new \Magento\Validator\UniversalFactory(new \Magento\ObjectManager\ObjectManager()), ) ); diff --git a/dev/tests/unit/testsuite/Magento/Validator/_files/validation/negative/invalid_content_for callback.xml b/dev/tests/unit/testsuite/Magento/Validator/_files/validation/negative/invalid_content_for_callback.xml similarity index 100% rename from dev/tests/unit/testsuite/Magento/Validator/_files/validation/negative/invalid_content_for callback.xml rename to dev/tests/unit/testsuite/Magento/Validator/_files/validation/negative/invalid_content_for_callback.xml diff --git a/dev/tests/unit/testsuite/Magento/View/Asset/MergeServiceTest.php b/dev/tests/unit/testsuite/Magento/View/Asset/MergeServiceTest.php index 1f7f705a5dc..39369aef7ff 100644 --- a/dev/tests/unit/testsuite/Magento/View/Asset/MergeServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Asset/MergeServiceTest.php @@ -49,7 +49,7 @@ class MergeServiceTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_dirs; + protected $_directory; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -61,14 +61,16 @@ 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->_dirs = $this->getMock('Magento\App\Dir', 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()) + ->method('getDirectoryWrite') + ->will($this->returnValue($this->_directory)); $this->_object = new \Magento\View\Asset\MergeService( $this->_objectManager, $this->_config, $this->_filesystem, - $this->_dirs, $this->_state ); } @@ -172,15 +174,10 @@ class MergeServiceTest extends \PHPUnit_Framework_TestCase public function testCleanMergedJsCss() { - $this->_dirs->expects($this->once()) - ->method('getDir') - ->with(\Magento\App\Dir::PUB_VIEW_CACHE) - ->will($this->returnValue('/pub/cache')); - - $mergedDir = '/pub/cache/' . \Magento\View\Asset\Merged::PUBLIC_MERGE_DIR; - $this->_filesystem->expects($this->once()) + $mergedDir = \Magento\View\Asset\Merged::PUBLIC_MERGE_DIR; + $this->_directory->expects($this->once()) ->method('delete') - ->with($mergedDir, null); + ->with($mergedDir); $this->_object->cleanMergedJsCss(); } 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 bcd6e0a5285..cd3bb109f8b 100644 --- a/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/ChecksumTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/ChecksumTest.php @@ -36,6 +36,11 @@ class ChecksumTest extends \PHPUnit_Framework_TestCase */ protected $_filesystem; + /** + * @var \Magento\Filesystem\Directory\Write | \PHPUnit_Framework_MockObject_MockObject + */ + protected $_directory; + /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -58,15 +63,22 @@ class ChecksumTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $this->_filesystem->expects($this->exactly(2)) - ->method('getMTime') + $this->_filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryWrite'), array(), '', false); + $this->_directory = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); + $this->_filesystem->expects($this->once()) + ->method('getDirectoryWrite') + ->will($this->returnValue($this->_directory)); + $this->_directory->expects($this->exactly(2)) + ->method('stat') ->will($this->returnValueMap( array( - array('file1.js', null, '123'), - array('file2.js', null, '456'), + array('file1.js', array('mtime' => '123')), + array('file2.js', array('mtime' => '456')), ) )); + $this->_directory->expects($this->any()) + ->method('getRelativePath') + ->will($this->returnArgument(0)); $this->_strategy = $this->getMock('Magento\View\Asset\MergeStrategyInterface'); @@ -79,33 +91,24 @@ class ChecksumTest extends \PHPUnit_Framework_TestCase */ public function testMergeFilesNoMergeRequired() { - $this->_filesystem + $this->_directory ->expects($this->exactly(2)) - ->method('has') - ->will($this->returnValueMap( - array( - array($this->_mergedFile, null, true), - array($this->_mergedMetaFile, null, true), - ) - )); - ; + ->method('isExist') + ->will($this->returnValue(true)); - $this->_filesystem + $this->_directory ->expects($this->once()) - ->method('read') + ->method('readFile') ->with($this->_mergedMetaFile) ->will($this->returnValue('123456')); - ; - $this->_filesystem + $this->_directory ->expects($this->never()) - ->method('write') - ; + ->method('writeFile'); $this->_strategy ->expects($this->never()) - ->method('mergeFiles') - ; + ->method('mergeFiles'); $this->_object->mergeFiles($this->_filesArray, $this->_mergedFile, 'contentType'); } @@ -117,27 +120,22 @@ class ChecksumTest extends \PHPUnit_Framework_TestCase */ public function testMergeFilesFilesDoNotExist($isFileExists, $isMetaFileExists) { - $this->_filesystem->expects($this->any()) - ->method('has') + $this->_directory + ->expects($this->any()) + ->method('isExist') ->will($this->returnValueMap( - array( - array($this->_mergedFile, null, $isFileExists), - array($this->_mergedMetaFile, null, $isMetaFileExists), - ) - )); - ; + array(array($this->_mergedFile, $isFileExists), array($this->_mergedMetaFile, $isMetaFileExists)))); + $this->_strategy ->expects($this->once()) ->method('mergeFiles') - ->with($this->_filesArray, $this->_mergedFile, 'contentType') - ; + ->with($this->_filesArray, $this->_mergedFile, 'contentType'); - $this->_filesystem + $this->_directory ->expects($this->once()) - ->method('write') - ->with($this->_mergedMetaFile, '123456') - ; + ->method('writeFile') + ->with($this->_mergedMetaFile, '123456'); $this->_object->mergeFiles($this->_filesArray, $this->_mergedFile, 'contentType'); } @@ -158,35 +156,26 @@ class ChecksumTest extends \PHPUnit_Framework_TestCase */ public function testMergeFilesExistWrongChecksum() { - $this->_filesystem + $this->_directory ->expects($this->exactly(2)) - ->method('has') - ->will($this->returnValueMap( - array( - array($this->_mergedFile, null, true), - array($this->_mergedMetaFile, null, true), - ) - )); - ; + ->method('isExist') + ->will($this->returnValue(true)); - $this->_filesystem + $this->_directory ->expects($this->once()) - ->method('read') + ->method('readFile') ->with($this->_mergedMetaFile) ->will($this->returnValue('000000')); - ; $this->_strategy ->expects($this->once()) ->method('mergeFiles') - ->with($this->_filesArray, $this->_mergedFile, 'contentType') - ; + ->with($this->_filesArray, $this->_mergedFile, 'contentType'); - $this->_filesystem + $this->_directory ->expects($this->once()) - ->method('write') - ->with($this->_mergedMetaFile, '123456') - ; + ->method('writeFile') + ->with($this->_mergedMetaFile, '123456'); $this->_object->mergeFiles($this->_filesArray, $this->_mergedFile, 'contentType'); } 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 3b37cd1f296..ea1573cfa52 100644 --- a/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/DirectTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/DirectTest.php @@ -24,6 +24,9 @@ namespace Magento\View\Asset\MergeStrategy; +use Magento\Filesystem, + Magento\Filesystem\Directory\Write; + class DirectTest extends \PHPUnit_Framework_TestCase { /** @@ -37,9 +40,9 @@ class DirectTest extends \PHPUnit_Framework_TestCase protected $_filesystem; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Write | \PHPUnit_Framework_MockObject_MockObject */ - protected $_dirs; + protected $_directory; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -50,10 +53,17 @@ class DirectTest extends \PHPUnit_Framework_TestCase { $this->_cssUrlResolver = $this->getMock('Magento\View\Url\CssResolver', array(), array(), '', false); $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $this->_dirs = $this->getMock('Magento\App\Dir', 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) + ->will($this->returnValue($this->_directory)); + $this->_directory->expects($this->any()) + ->method('getRelativePath') + ->will($this->returnArgument(0)); $this->_object = new \Magento\View\Asset\MergeStrategy\Direct( - $this->_filesystem, $this->_dirs, $this->_cssUrlResolver + $this->_filesystem, $this->_cssUrlResolver ); } @@ -98,33 +108,23 @@ class DirectTest extends \PHPUnit_Framework_TestCase { $mergedFile = '/merged_file.js'; - $this->_filesystem->expects($this->exactly(2)) - ->method('has') - ->will($this->returnValueMap( - array( - array('/pub/script_one.js', null, true), - array('/pub/script_two.js', null, true), - ) - )); - - $this->_filesystem->expects($this->exactly(2)) - ->method('read') - ->will($this->returnValueMap( - array( - array('/pub/script_one.js', null, 'script1'), - array('/pub/script_two.js', null, 'script2'), - ) - )); - - $this->_filesystem - ->expects($this->once()) - ->method('setIsAllowCreateDirectories') - ->with(true); - - $this->_filesystem->expects($this->once()) - ->method('write') - ->with($mergedFile, 'script1script2') - ; + $this->_directory + ->expects($this->any()) + ->method('isExist') + ->will($this->returnValue(true)); + + $this->_directory->expects($this->at(3)) + ->method('readFile') + ->with('/pub/script_one.js') + ->will($this->returnValue('script1')); + $this->_directory->expects($this->at(7)) + ->method('readFile') + ->with('/pub/script_two.js') + ->will($this->returnValue('script2')); + + $this->_directory->expects($this->once()) + ->method('writeFile') + ->with($mergedFile, 'script1script2'); $this->_object->mergeFiles(array('/pub/script_one.js', '/pub/script_two.js'), $mergedFile, $contentType); } 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 5945405b4d8..02d587a5638 100644 --- a/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/FileExistsTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/FileExistsTest.php @@ -36,6 +36,11 @@ class FileExistsTest extends \PHPUnit_Framework_TestCase */ protected $_filesystem; + /** + * @var \Magento\Filesystem\Directory\Write | \PHPUnit_Framework_MockObject_MockObject + */ + protected $_directory; + /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -53,7 +58,17 @@ class FileExistsTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystem = $this->getMock( + 'Magento\Filesystem', + array('getDirectoryWrite', 'getDirectoryRead'), + array(), + '', + false + ); + $this->_directory = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); + $this->_filesystem->expects($this->any()) + ->method('getDirectoryRead') + ->will($this->returnValue($this->_directory)); $this->_strategy = $this->getMock('Magento\View\Asset\MergeStrategyInterface'); $this->_object = new \Magento\View\Asset\MergeStrategy\FileExists( @@ -66,14 +81,11 @@ class FileExistsTest extends \PHPUnit_Framework_TestCase { $this->_strategy ->expects($this->never()) - ->method('mergeFiles') - ; + ->method('mergeFiles'); - $this->_filesystem->expects($this->once()) - ->method('has') - ->with($this->_mergedFile) - ->will($this->returnValue(true)) - ; + $this->_directory->expects($this->once()) + ->method('isExist') + ->will($this->returnValue(true)); $this->_object->mergeFiles($this->_filesArray, $this->_mergedFile, 'contentType'); } @@ -83,14 +95,11 @@ class FileExistsTest extends \PHPUnit_Framework_TestCase $this->_strategy ->expects($this->once()) ->method('mergeFiles') - ->with($this->_filesArray, $this->_mergedFile, 'contentType') - ; + ->with($this->_filesArray, $this->_mergedFile, 'contentType'); - $this->_filesystem->expects($this->once()) - ->method('has') - ->with($this->_mergedFile) - ->will($this->returnValue(false)) - ; + $this->_directory->expects($this->once()) + ->method('isExist') + ->will($this->returnValue(false)); $this->_object->mergeFiles($this->_filesArray, $this->_mergedFile, 'contentType'); } diff --git a/dev/tests/unit/testsuite/Magento/View/Asset/MergedTest.php b/dev/tests/unit/testsuite/Magento/View/Asset/MergedTest.php index afe75154f68..72687c11afb 100644 --- a/dev/tests/unit/testsuite/Magento/View/Asset/MergedTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Asset/MergedTest.php @@ -44,47 +44,51 @@ class MergedTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_dirs; + protected $_mergeStrategy; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mergeStrategy; + protected $_assetJsOne; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_assetJsOne; + protected $_assetJsTwo; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_assetJsTwo; + protected $_filesystem; protected function setUp() { $this->_assetJsOne = $this->getMockForAbstractClass('Magento\View\Asset\MergeableInterface'); $this->_assetJsOne->expects($this->any())->method('getContentType')->will($this->returnValue('js')); $this->_assetJsOne->expects($this->any())->method('getSourceFile') - ->will($this->returnValue('/pub/script_one.js')); + ->will($this->returnValue('pub/lib/script_one.js')); $this->_assetJsTwo = $this->getMockForAbstractClass('Magento\View\Asset\MergeableInterface'); $this->_assetJsTwo->expects($this->any())->method('getContentType')->will($this->returnValue('js')); $this->_assetJsTwo->expects($this->any())->method('getSourceFile') - ->will($this->returnValue('/pub/script_two.js')); + ->will($this->returnValue('pub/static/script_two.js')); $this->_logger = $this->getMock('Magento\Logger', array('logException'), array(), '', false); - $this->_dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false); - $this->_mergeStrategy = $this->getMock('Magento\View\Asset\MergeStrategyInterface'); $this->_objectManager = $this->getMockForAbstractClass( - 'Magento\ObjectManager', array(), '', true, true, true, array('create') + 'Magento\ObjectManager', array(), '', true, true, true, array('create', 'get') ); + $this->_filesystem = $this->getMock( + 'Magento\Filesystem', array(), array(), '', false); + $this->_objectManager->expects($this->any()) + ->method('get') + ->will($this->returnValue($this->_filesystem)); + $this->_object = new \Magento\View\Asset\Merged( - $this->_objectManager, $this->_logger, $this->_dirs, $this->_mergeStrategy, + $this->_objectManager, $this->_logger, $this->_mergeStrategy, array($this->_assetJsOne, $this->_assetJsTwo) ); } @@ -96,7 +100,7 @@ class MergedTest extends \PHPUnit_Framework_TestCase public function testConstructorNothingToMerge() { $this->_object = new \Magento\View\Asset\Merged( - $this->_objectManager, $this->_logger, $this->_dirs, $this->_mergeStrategy, array() + $this->_objectManager, $this->_logger, $this->_mergeStrategy, array() ); } @@ -108,7 +112,7 @@ class MergedTest extends \PHPUnit_Framework_TestCase { $assetUrl = new \Magento\View\Asset\Remote('http://example.com/style.css', 'css'); $this->_object = new \Magento\View\Asset\Merged( - $this->_objectManager, $this->_logger, $this->_dirs, $this->_mergeStrategy, + $this->_objectManager, $this->_logger, $this->_mergeStrategy, array($this->_assetJsOne, $assetUrl) ); } @@ -124,22 +128,45 @@ class MergedTest extends \PHPUnit_Framework_TestCase $assetCss->expects($this->any())->method('getSourceFile')->will($this->returnValue('style.css')); $this->_object = new \Magento\View\Asset\Merged( - $this->_objectManager, $this->_logger, $this->_dirs, $this->_mergeStrategy, + $this->_objectManager, $this->_logger, $this->_mergeStrategy, array($this->_assetJsOne, $assetCss) ); } public function testIteratorInterfaceMerge() { - $mergedFile = '/_merged/19b2d7c942efeb2327eadbcf04635b02.js'; + $hash = md5(implode('|', array('script_one.js', 'script_two.js'))); + $mergedFile = 'pub/cache/_merged/' . $hash . '.js'; $this->_logger->expects($this->never())->method('logException'); $publicFiles = array( - '/pub/script_one.js' => '/pub/script_one.js', - '/pub/script_two.js' => '/pub/script_two.js' + 'pub/lib/script_one.js' => 'pub/lib/script_one.js', + 'pub/static/script_two.js' => 'pub/static/script_two.js' ); + $this->_filesystem->expects($this->at(0)) + ->method('getPath') + ->with($this->equalTo(\Magento\Filesystem::PUB_LIB)) + ->will($this->returnValue('pub/lib')); + $this->_filesystem->expects($this->at(1)) + ->method('getPath') + ->with($this->equalTo(\Magento\Filesystem::STATIC_VIEW)) + ->will($this->returnValue('pub/static')); + $readDirectoryMock = $this->getMockBuilder('\Magento\Filesystem\Directory\Read') + ->disableOriginalConstructor() + ->getMock(); + $merged = $this->_object; + $readDirectoryMock->expects($this->once()) + ->method('getAbsolutePath') + ->with($this->equalTo($merged::PUBLIC_MERGE_DIR)) + ->will($this->returnValue('pub/cache/_merged')); + + $this->_filesystem->expects($this->any()) + ->method('getDirectoryRead') + ->with($this->equalTo(\Magento\Filesystem::PUB_VIEW_CACHE)) + ->will($this->returnValue($readDirectoryMock)); + $this->_mergeStrategy ->expects($this->once()) ->method('mergeFiles') @@ -155,6 +182,7 @@ class MergedTest extends \PHPUnit_Framework_TestCase ; $expectedResult = array($mergedAsset); + $this->_assertIteratorEquals($expectedResult, $this->_object); $this->_assertIteratorEquals($expectedResult, $this->_object); // ensure merging happens only once } @@ -168,7 +196,7 @@ class MergedTest extends \PHPUnit_Framework_TestCase ->will($this->throwException($mergeError)); $this->_object = new \Magento\View\Asset\Merged( - $this->_objectManager, $this->_logger, $this->_dirs, $this->_mergeStrategy, + $this->_objectManager, $this->_logger, $this->_mergeStrategy, array($this->_assetJsOne, $this->_assetJsTwo, $assetBroken) ); diff --git a/dev/tests/unit/testsuite/Magento/View/Asset/MinifyServiceTest.php b/dev/tests/unit/testsuite/Magento/View/Asset/MinifyServiceTest.php index 71549b54e78..9a3c826c99c 100644 --- a/dev/tests/unit/testsuite/Magento/View/Asset/MinifyServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Asset/MinifyServiceTest.php @@ -49,12 +49,22 @@ class MinifyServiceTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_config = $this->getMock('Magento\View\Asset\ConfigInterface', array(), array(), '', false); - $dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false); $this->_objectManager = $this->getMock('Magento\ObjectManager'); $this->_appState = $this->getMock('Magento\App\State', array(), array(), '', false); - - $this->_model = new \Magento\View\Asset\MinifyService($this->_config, $this->_objectManager, - $dirs, $this->_appState); + $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $directory = $this->getMock('Magento\Filesystem\Directory\Read', array(), array(), '', false); + $filesystem->expects($this->any()) + ->method('getDirectoryRead') + ->will($this->returnValue($directory)); + $directory->expects($this->any()) + ->method('getAbsolutePath') + ->will($this->returnArgument(0)); + $this->_model = new \Magento\View\Asset\MinifyService( + $this->_config, + $this->_objectManager, + $this->_appState, + $filesystem + ); } public function testGetAssets() diff --git a/dev/tests/unit/testsuite/Magento/View/DeployedFilesManagerTest.php b/dev/tests/unit/testsuite/Magento/View/DeployedFilesManagerTest.php index 364aa531b20..94d14c2ae5e 100644 --- a/dev/tests/unit/testsuite/Magento/View/DeployedFilesManagerTest.php +++ b/dev/tests/unit/testsuite/Magento/View/DeployedFilesManagerTest.php @@ -49,8 +49,8 @@ class DeployedFilesManagerTest extends \PHPUnit_Framework_TestCase public static function buildDeployedFilePathDataProvider() { return array( - 'no module' => array('a', 't', 'f', null, str_replace('/', DIRECTORY_SEPARATOR, 'a/t/f')), - 'with module' => array('a', 't', 'f', 'm', str_replace('/', DIRECTORY_SEPARATOR, 'a/t/m/f')), + 'no module' => array('a', 't', 'f', null, 'a/t/f'), + 'with module' => array('a', 't', 'f', 'm', 'a/t/m/f'), ); } } 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 1bc0b96ba58..6ddddf4b87e 100644 --- a/dev/tests/unit/testsuite/Magento/View/Design/Fallback/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Design/Fallback/FactoryTest.php @@ -43,12 +43,29 @@ class FactoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $dirs = new \Magento\App\Dir(__DIR__, array(), array( - \Magento\App\Dir::THEMES => 'themes', - \Magento\App\Dir::MODULES => 'modules', - \Magento\App\Dir::PUB_LIB => 'pub_lib', - )); - $this->model = new Factory($dirs); + $filesystemMock = $this->getMock( + '\Magento\Filesystem', + array('getPath', 'getDirectoryRead', '__wakeup'), + array('dir' => array( + \Magento\Filesystem::THEMES => 'themes', + \Magento\Filesystem::MODULES => 'modules', + \Magento\Filesystem::PUB_LIB => 'pub_lib', + ) + ), + '', + false + ); + $filesystemMock ->expects($this->any()) + ->method('getPath') + ->will($this->returnValueMap( + array( + (\Magento\Filesystem::THEMES) => 'themes', + (\Magento\Filesystem::MODULES) => 'modules', + (\Magento\Filesystem::PUB_LIB) => 'pub_lib', + )) + ); + + $this->model = new Factory($filesystemMock); $parentTheme = $this->getMockForAbstractClass('Magento\View\Design\ThemeInterface'); $parentTheme->expects($this->any())->method('getThemePath')->will($this->returnValue('parent_theme_path')); @@ -82,8 +99,8 @@ class FactoryTest extends \PHPUnit_Framework_TestCase public function testCreateLocaleFileRuleGetPatternDirs() { $expectedResult = array( - 'themes/area/current_theme_path/i18n/en_US', - 'themes/area/parent_theme_path/i18n/en_US', + '/area/current_theme_path/i18n/en_US', + '/area/parent_theme_path/i18n/en_US', ); $this->assertSame( $expectedResult, @@ -150,16 +167,16 @@ class FactoryTest extends \PHPUnit_Framework_TestCase 'modular' => array( array(), array( - 'themes/area/current_theme_path/namespace_module', - 'themes/area/parent_theme_path/namespace_module', - 'modules/namespace/module/view/area', + '/area/current_theme_path/namespace_module', + '/area/parent_theme_path/namespace_module', + '/namespace/module/view/area', ), ), 'non-modular' => array( array('namespace' => null, 'module' => null), array( - 'themes/area/current_theme_path', - 'themes/area/parent_theme_path', + '/area/current_theme_path', + '/area/parent_theme_path', ), ), ); @@ -203,38 +220,38 @@ class FactoryTest extends \PHPUnit_Framework_TestCase 'modular localized' => array( array(), array( - 'themes/area/current_theme_path/i18n/en_US/namespace_module', - 'themes/area/current_theme_path/namespace_module', - 'themes/area/parent_theme_path/i18n/en_US/namespace_module', - 'themes/area/parent_theme_path/namespace_module', - 'modules/namespace/module/view/area/i18n/en_US', - 'modules/namespace/module/view/area', + '/area/current_theme_path/i18n/en_US/namespace_module', + '/area/current_theme_path/namespace_module', + '/area/parent_theme_path/i18n/en_US/namespace_module', + '/area/parent_theme_path/namespace_module', + '/namespace/module/view/area/i18n/en_US', + '/namespace/module/view/area', ), ), 'modular non-localized' => array( array('locale' => null), array( - 'themes/area/current_theme_path/namespace_module', - 'themes/area/parent_theme_path/namespace_module', - 'modules/namespace/module/view/area', + '/area/current_theme_path/namespace_module', + '/area/parent_theme_path/namespace_module', + '/namespace/module/view/area', ), ), 'non-modular localized' => array( array('module' => null, 'namespace' => null), array( - 'themes/area/current_theme_path/i18n/en_US', - 'themes/area/current_theme_path', - 'themes/area/parent_theme_path/i18n/en_US', - 'themes/area/parent_theme_path', - 'pub_lib', + '/area/current_theme_path/i18n/en_US', + '/area/current_theme_path', + '/area/parent_theme_path/i18n/en_US', + '/area/parent_theme_path', + '', ), ), 'non-modular non-localized' => array( array('module' => null, 'namespace' => null, 'locale' => null), array( - 'themes/area/current_theme_path', - 'themes/area/parent_theme_path', - 'pub_lib', + '/area/current_theme_path', + '/area/parent_theme_path', + '', ), ), ); 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 2fbcb2ca639..a444c616d97 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 @@ -28,8 +28,6 @@ namespace Magento\View\Design\FileResolution\Strategy\Fallback; use Magento\Filesystem; -use Magento\Filesystem\Adapter\Local; -use Magento\Io\File; use Magento\TestFramework\Helper\ProxyTesting; /** @@ -67,9 +65,19 @@ class CachingProxyTest extends \PHPUnit_Framework_TestCase */ protected $themeModel; + /** + * Direcoty with write permissions + * + * @var \Magento\Filesystem\Directory\Write | \PHPUnit_Framework_MockObject_MockObject + */ + protected $directoryWrite; + + /** + * Set up + */ protected function setUp() { - $this->tmpDir = TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . 'fallback'; + $this->tmpDir = TESTS_TEMP_DIR . '/fallback'; mkdir($this->tmpDir); $this->fallback = $this->getMock( @@ -94,69 +102,81 @@ class CachingProxyTest extends \PHPUnit_Framework_TestCase $this->model = new CachingProxy( $this->fallback, - $this->createFilesystem(), + $this->getFilesystemMock(), $this->tmpDir, TESTS_TEMP_DIR, true ); } + /** + * Tear down + */ protected function tearDown() { - File::rmdirRecursive($this->tmpDir); + $filesystemDriver = new \Magento\Filesystem\Driver\File(); + $filesystemDriver->deleteDirectory($this->tmpDir); } /** + * Construct CachingProxy passing not a directory + * * @expectedException \InvalidArgumentException */ public function testConstructInvalidDir() { $this->model = new CachingProxy( $this->fallback, - $this->createFilesystem(), + $this->getFilesystemMock(false), $this->tmpDir, - TESTS_TEMP_DIR . '/invalid_dir' + TESTS_TEMP_DIR . 'invalid_dir' ); } + /** + * Test for __destruct method + */ public function testDestruct() { $this->fallback->expects($this->once()) ->method('getFile') - ->will($this->returnValue(TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . 'test.txt')); + ->will($this->returnValue(TESTS_TEMP_DIR . '/' . 'test.txt')); - $expectedFile = $this->tmpDir . DIRECTORY_SEPARATOR . 'a_t_.ser'; + $expectedFile = $this->tmpDir . '/a_t_.ser'; $this->model->getFile('a', $this->themeModel, 'does not matter', 'Some_Module'); $this->assertFileNotExists($expectedFile); unset($this->model); - $this->assertFileExists($expectedFile); - $contents = file_get_contents($expectedFile); - $this->assertContains('test.txt', $contents); - $this->assertContains('Some_Module', $contents); + $this->directoryWrite->expects($this->any()) + ->method('writeFile') + ->with($expectedFile, $this->contains('Some_Module')); } + /** + * Test for destruct method with canSaveMap = false + */ public function testDestructNoMapSaved() { $this->fallback->expects($this->once()) ->method('getFile') - ->will($this->returnValue(TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . 'test.txt')); + ->will($this->returnValue(TESTS_TEMP_DIR . '/test.txt')); $model = new CachingProxy( $this->fallback, - $this->createFilesystem(), + $this->getFilesystemMock(), $this->tmpDir, TESTS_TEMP_DIR, false ); - $unexpectedFile = $this->tmpDir . DIRECTORY_SEPARATOR . 'a_t_.ser'; - $model->getFile('a', $this->themeModel, 'does not matter', 'Some_Module'); unset($model); - $this->assertFileNotExists($unexpectedFile); + $this->directoryWrite->expects($this->never()) + ->method('writeFile'); } /** + * Test for all proxy methods + * * @param string $method * @param array $params * @param string $expectedResult @@ -179,6 +199,8 @@ class CachingProxyTest extends \PHPUnit_Framework_TestCase } /** + * Data provider for testProxyMethods + * * @return array */ public static function proxyMethodsDataProvider() @@ -196,7 +218,7 @@ class CachingProxyTest extends \PHPUnit_Framework_TestCase 'getFile' => array( 'getFile', array('area51', $themeModel, 'file.txt', 'Some_Module'), - TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . 'fallback' . DIRECTORY_SEPARATOR . 'file.txt', + TESTS_TEMP_DIR . '/fallback/file.txt', ), 'getLocaleFile' => array( 'getLocaleFile', @@ -211,9 +233,12 @@ class CachingProxyTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test for setViewFilePathToMap method + */ public function testSetViewFilePathToMap() { - $materializedFilePath = TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . 'path' . DIRECTORY_SEPARATOR . 'file.txt'; + $materializedFilePath = TESTS_TEMP_DIR . '/path/file.txt'; $result = $this->model->setViewFilePathToMap( 'area51', @@ -232,10 +257,44 @@ class CachingProxyTest extends \PHPUnit_Framework_TestCase } /** + * Get Filesystem mock + * + * @param bool $isDirectory * @return Filesystem */ - protected function createFilesystem() + protected function getFilesystemMock($isDirectory = true) { - return new Filesystem(new Local()); + $directoryRead = $this->getMock( + 'Magento\Filesystem\Directory\Read', + array('isDirectory', 'getRelativePath'), + array(), + '', + false + ); + $directoryRead->expects($this->once()) + ->method('isDirectory') + ->will($this->returnValue($isDirectory)); + $directoryRead->expects($this->any()) + ->method('getRelativePath') + ->will($this->returnArgument(0)); + $this->directoryWrite = $this->getMock( + 'Magento\Filesystem\Directory\Write', + array('getRelativePath','isFile', 'readFile', 'isDirectory', 'create', 'writeFile'), + array(), '', false + ); + $this->directoryWrite->expects($this->any()) + ->method('getRelativePath') + ->will($this->returnArgument(0)); + $methods = array('getDirectoryRead', 'getDirectoryWrite', '__wakeup'); + $filesystem = $this->getMock('Magento\Filesystem', $methods, array(), '', false); + $filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->with(\Magento\Filesystem::ROOT) + ->will($this->returnValue($directoryRead)); + $filesystem->expects($this->once()) + ->method('getDirectoryWrite') + ->with(\Magento\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 d9597c6d024..9ad3ae5495c 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\App\Dir', array(), array(), '', false)) + array($this->getMock('Magento\Filesystem', array(), array(), '', false)) ); $this->fallbackFactory ->expects($this->any())->method('createLocaleFileRule')->will($this->returnValue($this->fallbackLocale)); @@ -117,7 +117,7 @@ class FallbackTest extends \PHPUnit_Framework_TestCase $filename = $fallback->getFile('area', $this->theme, 'file.txt', $fullModuleName); - $this->assertEquals(str_replace('/', DIRECTORY_SEPARATOR, $expectedFileName), $filename); + $this->assertEquals($expectedFileName, $filename); } /** @@ -178,7 +178,7 @@ class FallbackTest extends \PHPUnit_Framework_TestCase $filename = $fallback->getLocaleFile('area', $this->theme, 'locale', 'file.txt'); - $this->assertEquals(str_replace('/', DIRECTORY_SEPARATOR, $expectedFileName), $filename); + $this->assertEquals($expectedFileName, $filename); } /** @@ -220,7 +220,7 @@ class FallbackTest extends \PHPUnit_Framework_TestCase $filename = $fallback->getViewFile('area', $this->theme, 'locale', 'file.txt', $fullModuleName); - $this->assertEquals(str_replace('/', DIRECTORY_SEPARATOR, $expectedFileName), $filename); + $this->assertEquals($expectedFileName, $filename); } /** @@ -229,11 +229,15 @@ class FallbackTest extends \PHPUnit_Framework_TestCase */ protected function getFileSystemMock($targetFile) { - $targetFile = str_replace('/', DIRECTORY_SEPARATOR, $targetFile); - - $filesystem = $this->getMock('Magento\Filesystem', array('has'), array(), '', false); - $filesystem->expects($this->any()) - ->method('has') + $directoryMock = $this->getMock( + 'Magento\Filesystem\Directory\Read', + array('isExist', 'getRelativePath'), array(), '', false + ); + $directoryMock->expects($this->any()) + ->method('getRelativePath') + ->will($this->returnArgument(0)); + $directoryMock->expects($this->any()) + ->method('isExist') ->will( $this->returnCallback( function ($tryFile) use ($targetFile) { @@ -241,6 +245,11 @@ class FallbackTest extends \PHPUnit_Framework_TestCase } ) ); + $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', false); + $filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->with(\Magento\Filesystem::ROOT) + ->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 aa446ae6317..a1847807c6e 100644 --- a/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/StrategyPoolTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/StrategyPoolTest.php @@ -27,7 +27,6 @@ namespace Magento\View\Design\FileResolution; use Magento\App\State; -use Magento\App\Dir; /** * StrategyPool Test @@ -46,11 +45,6 @@ class StrategyPoolTest extends \PHPUnit_Framework_TestCase */ protected $appState; - /** - * @var Dir|\PHPUnit_Framework_MockObject_MockObject - */ - protected $dirs; - /** * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ @@ -65,13 +59,18 @@ 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->dirs = new Dir('base_dir'); - $this->filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->filesystem = $this->getMock('Magento\Filesystem', array('getPath'), array(), '', false); + $pathMap = array( + array(\Magento\Filesystem::VAR_DIR, 'base_dir/var'), + array(\Magento\Filesystem::ROOT, 'base_dir') + ); + $this->filesystem->expects($this->any()) + ->method('getPath') + ->will($this->returnValueMap($pathMap)); $this->model = new StrategyPool( $this->objectManager, $this->appState, - $this->dirs, $this->filesystem ); } @@ -92,7 +91,6 @@ class StrategyPoolTest extends \PHPUnit_Framework_TestCase $strategy = new \StdClass; $mapDir = 'base_dir/var/' . StrategyPool::FALLBACK_MAP_DIR; - $mapDir = str_replace('/', DIRECTORY_SEPARATOR, $mapDir); $map = array( array( 'Magento\View\Design\FileResolution\Strategy\Fallback\CachingProxy', 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 d1c70dc0360..32ecd853c56 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 @@ -114,7 +114,7 @@ class AbstractFileTest extends \PHPUnit_Framework_TestCase /** @var $model \Magento\View\Design\Theme\Customization\AbstractFile */ /** @var $file \Magento\Core\Model\Theme\File */ - $this->assertEquals('/path' . DIRECTORY_SEPARATOR . 'file.path', $model->getFullPath($file)); + $this->assertEquals('/path' . '/' . 'file.path', $model->getFullPath($file)); } /** @@ -256,10 +256,14 @@ class AbstractFileTest extends \PHPUnit_Framework_TestCase 'sort_order' => 12 )); $model->expects($this->once())->method('getFullPath')->with($file)->will($this->returnValue('test_path')); - $this->_filesystem->expects($this->once())->method('delete')->with('test_path'); - $this->_filesystem->expects($this->once())->method('setIsAllowCreateDirectories')->with(true) - ->will($this->returnSelf()); - $this->_filesystem->expects($this->once())->method('write')->with('test_path', 'test content'); + + $directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', + array('writeFile', 'delete', 'getRelativePath'), array(), '', false); + $directoryMock->expects($this->once())->method('writeFile')->will($this->returnValue(true)); + $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)); /** @var $model \Magento\View\Design\Theme\Customization\AbstractFile */ /** @var $file \Magento\Core\Model\Theme\File */ $model->save($file); @@ -280,8 +284,14 @@ class AbstractFileTest extends \PHPUnit_Framework_TestCase 'content' => 'test content', 'sort_order' => 12 )); - $this->_filesystem->expects($this->once())->method('has')->with('test_path')->will($this->returnValue(true)); - $this->_filesystem->expects($this->once())->method('delete')->with('test_path'); + $directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', + array('touch', 'delete', 'getRelativePath'), array(), '', false); + $directoryMock->expects($this->once())->method('touch')->will($this->returnValue(true)); + $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)); + $model->expects($this->once())->method('getFullPath')->with($file)->will($this->returnValue('test_path')); /** @var $model \Magento\View\Design\Theme\Customization\AbstractFile */ /** @var $file \Magento\Core\Model\Theme\File */ 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 cd100d33bec..be7a1ce6430 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 @@ -52,6 +52,11 @@ class PathTest extends \PHPUnit_Framework_TestCase */ protected $_appState; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_directory; + protected function setUp() { $this->_theme = $this->getMock('Magento\Core\Model\Theme', array('__wakeup'), array(), '', false); @@ -59,14 +64,20 @@ class PathTest extends \PHPUnit_Framework_TestCase $appStateProperty = new \ReflectionProperty('\Magento\Core\Model\Theme', '_appState'); $appStateProperty->setAccessible(true); $appStateProperty->setValue($this->_theme, $this->_appState); - $this->_dir = $this->getMock('Magento\App\Dir', array(), array(), '', false); - $this->_model = new \Magento\View\Design\Theme\Customization\Path($this->_dir); + $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_directory = $this->getMock('\Magento\Filesystem\Directory\Read', array(), array(), '', false); + $filesystem->expects($this->any()) + ->method('getDirectoryRead') + ->will($this->returnValue($this->_directory)); + $this->_directory->expects($this->once())->method('getAbsolutePath') + ->will($this->returnArgument(0)); + $this->_model = new \Magento\View\Design\Theme\Customization\Path($filesystem); } protected function tearDown() { $this->_theme = null; - $this->_dir = null; + $this->_directory = null; $this->_model = null; } @@ -76,11 +87,9 @@ class PathTest extends \PHPUnit_Framework_TestCase */ public function testGetCustomizationPath() { - $this->_dir->expects($this->once())->method('getDir')->with(\Magento\App\Dir::MEDIA) - ->will($this->returnValue('/media_dir')); $expectedPath = implode( - DIRECTORY_SEPARATOR, - array('/media_dir', \Magento\View\Design\Theme\Customization\Path::DIR_NAME, '123') + '/', + array(\Magento\View\Design\Theme\Customization\Path::DIR_NAME, '123') ); $this->assertEquals($expectedPath, $this->_model->getCustomizationPath($this->_theme->setId(123))); $this->assertNull($this->_model->getCustomizationPath($this->_theme->setId(null))); @@ -92,15 +101,10 @@ class PathTest extends \PHPUnit_Framework_TestCase public function testGetThemeFilesPath() { $this->_appState->expects($this->any())->method('getAreaCode')->will($this->returnValue('area51')); - $this->_dir->expects($this->once())->method('getDir')->with(\Magento\App\Dir::THEMES) - ->will($this->returnValue('/themes_dir')); - $expectedPath = implode( - \Magento\Filesystem::DIRECTORY_SEPARATOR, - array('/themes_dir', 'area51', 'path') - ); + $expectedPath = implode('/', array('area51', 'path')); $this->assertEquals( - \Magento\Filesystem::fixSeparator($expectedPath), - \Magento\Filesystem::fixSeparator($this->_model->getThemeFilesPath($this->_theme->setThemePath('path'))) + $expectedPath, + $this->_model->getThemeFilesPath($this->_theme->setThemePath('path')) ); $this->assertNull($this->_model->getCustomizationPath($this->_theme->setThemePath(null))); } @@ -110,12 +114,13 @@ class PathTest extends \PHPUnit_Framework_TestCase */ public function testGetCustomViewConfigPath() { - $this->_dir->expects($this->once())->method('getDir')->with(\Magento\App\Dir::MEDIA) - ->will($this->returnValue('/media_dir')); $expectedPath = implode( - DIRECTORY_SEPARATOR, - array('/media_dir', \Magento\View\Design\Theme\Customization\Path::DIR_NAME, '123', - \Magento\Core\Model\Theme::FILENAME_VIEW_CONFIG) + '/', + array( + \Magento\View\Design\Theme\Customization\Path::DIR_NAME, + '123', + \Magento\Core\Model\Theme::FILENAME_VIEW_CONFIG + ) ); $this->assertEquals($expectedPath, $this->_model->getCustomViewConfigPath($this->_theme->setId(123))); $this->assertNull($this->_model->getCustomViewConfigPath($this->_theme->setId(null))); 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 9c44f576460..243f75f9699 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 @@ -33,7 +33,7 @@ namespace Magento\View\Design\Theme\Image; class UploaderTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\View\Design\Theme\Image\Uploader|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\View\Design\Theme\Image\Uploader|\PHPUnit_Framework_MockObject_MockObject */ protected $_model; @@ -96,7 +96,7 @@ class UploaderTest extends \PHPUnit_Framework_TestCase 'isValid' => true, 'checkAllowedExtension' => true, 'save' => true, - 'result' => '/tmp' . DIRECTORY_SEPARATOR . 'test_filename', + 'result' => '/tmp/test_filename', 'exception' => null ), array( @@ -156,8 +156,8 @@ class UploaderTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue('test_filename')); $this->assertEquals( - \Magento\Filesystem::fixSeparator($result), - \Magento\Filesystem::fixSeparator($this->_model->uploadPreviewImage($testScope, '/tmp')) + $result, + $this->_model->uploadPreviewImage($testScope, '/tmp') ); } } 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 b6fa90021a4..092c52cd9b6 100644 --- a/dev/tests/unit/testsuite/Magento/View/Design/Theme/ImageTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Design/Theme/ImageTest.php @@ -38,28 +38,43 @@ class ImageTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Filesystem|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $_filesystemMock; /** - * @var \Magento\Image|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Image|\PHPUnit_Framework_MockObject_MockObject */ protected $_imageMock; /** - * @var \Magento\View\Design\Theme\Image\Uploader|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\View\Design\Theme\Image\Uploader|\PHPUnit_Framework_MockObject_MockObject */ protected $_uploaderMock; /** - * @var \Magento\Core\Model\Theme|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Core\Model\Theme|\PHPUnit_Framework_MockObject_MockObject */ protected $_themeMock; + /** + * @var \Magento\Filesystem\Directory\Write|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_directoryMock; + protected function setUp() { - $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false, false); + $this->_directoryMock = $this->getMock( + 'Magento\Filesystem\Directory\Write', + array('isExist', 'copyFile', 'getRelativePath', 'delete'), array(), '', false, false + ); + $this->_filesystemMock = $this->getMock( + 'Magento\Filesystem', array('getDirectoryWrite', '__wakeup'), array(), '', false, false + ); + $this->_filesystemMock->expects($this->once()) + ->method('getDirectoryWrite') + ->with(\Magento\Filesystem::MEDIA) + ->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); $imageFactory->expects($this->any())->method('create')->will($this->returnValue($this->_imageMock)); @@ -70,7 +85,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase 'Magento\View\Design\Theme\Image\Uploader', array(), array(), - 'UploaderProxy', + '', false, false ); @@ -135,15 +150,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase */ public function testConstructor() { - $themeImage = new \Magento\View\Design\Theme\Image( - $this->_filesystemMock, - $this->getMock('Magento\Image\Factory', array(), array(), '', false, false), - $this->_uploaderMock, - $this->_getImagePathMock(), - $this->getMock('Magento\Logger', array(), array(), '', false, false), - $this->_themeMock - ); - $this->assertNotEmpty($themeImage); + $this->assertNotEmpty($this->_model); } /** @@ -167,9 +174,14 @@ class ImageTest extends \PHPUnit_Framework_TestCase $this->_themeMock->setData($this->_getThemeSampleData()); $this->_themeMock->setData('preview_image', $previewImage); - $this->_filesystemMock->expects($this->any())->method('copy') - ->with('/media_path/theme/preview', $this->anything()); - $this->assertFalse($this->_model->createPreviewImageCopy($previewImage)); + $this->_directoryMock->expects($this->exactly(2)) + ->method('getRelativePath') + ->will($this->returnArgument(0)); + $this->_directoryMock->expects($this->once()) + ->method('copyFile') + ->with('/media_path/theme/preview/test_preview.png', $this->anything()) + ->will($this->returnValue(true)); + $this->assertTrue($this->_model->createPreviewImageCopy($previewImage)); $this->assertEquals($previewImage, $this->_themeMock->getData('preview_image')); } @@ -180,7 +192,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase { $this->_themeMock->setData($this->_getThemeSampleData()); $this->_themeMock->setData('preview_image', 'test.png'); - $this->_filesystemMock->expects($this->once())->method('delete'); + $this->_directoryMock->expects($this->once())->method('delete'); $this->_model->removePreviewImage(); $this->assertNull($this->_themeMock->getData('preview_image')); } @@ -208,8 +220,12 @@ class ImageTest extends \PHPUnit_Framework_TestCase $this->_themeMock->setData('preview_image', 'test.png'); $this->_uploaderMock->expects($this->once())->method('uploadPreviewImage')->with($scope, '/media_path/tmp') ->will($this->returnValue($tmpFilePath)); - $this->_filesystemMock->expects($this->at(0))->method('delete')->with($this->stringContains('test.png')); - $this->_filesystemMock->expects($this->at(1))->method('delete')->with($tmpFilePath); + + $this->_directoryMock->expects($this->at(0))->method('getRelativePath')->will($this->returnArgument(0)); + $this->_directoryMock->expects($this->at(1))->method('delete')->with($this->stringContains('test.png')); + + $this->_directoryMock->expects($this->at(2))->method('delete')->with($tmpFilePath); + $this->_model->uploadPreviewImage($scope); } diff --git a/dev/tests/unit/testsuite/Magento/View/Element/TemplateTest.php b/dev/tests/unit/testsuite/Magento/View/Element/TemplateTest.php index c2840102d78..6d36c1b0e62 100644 --- a/dev/tests/unit/testsuite/Magento/View/Element/TemplateTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Element/TemplateTest.php @@ -51,13 +51,6 @@ class TemplateTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $dirMap = array( - array(\Magento\App\Dir::APP, __DIR__), - array(\Magento\App\Dir::THEMES, __DIR__ . '/design'), - ); - $dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false, false); - $dirs->expects($this->any())->method('getDir')->will($this->returnValueMap($dirMap)); - $this->_viewFileSystem = $this->getMock('\Magento\View\FileSystem', array(), array(), '', false); $this->_filesystem = $this->getMock('\Magento\Filesystem', array(), array(), '', false); @@ -77,7 +70,6 @@ class TemplateTest extends \PHPUnit_Framework_TestCase 'enginePool' => $this->_templateEngine, 'viewFileSystem' => $this->_viewFileSystem, 'appState' => $appState, - 'dirs' => $dirs, 'data' => array('template' => 'template.phtml', 'module_name' => 'Fixture_Module') ) ); @@ -93,25 +85,34 @@ class TemplateTest extends \PHPUnit_Framework_TestCase public function testFetchView() { $this->expectOutputString(''); - + $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('isPathInDirectory') - ->with('template.phtml', __DIR__) - ->will($this->returnValue(true)) - ; + ->method('getDirectoryRead') + ->will($this->returnValue($directoryMock) + ); $this->_filesystem - ->expects($this->once())->method('isFile')->with('template.phtml')->will($this->returnValue(true)); + ->expects($this->any()) + ->method('getPath') + ->will($this->returnValue('themedir') + ); + $directoryMock->expects($this->once()) + ->method('isFile') + ->with('themedir/template.phtml') + ->will($this->returnValue(true) + ); $output = '<h1>Template Contents</h1>'; $vars = array('var1' => 'value1', 'var2' => 'value2'); $this->_templateEngine ->expects($this->once()) ->method('render') - ->with($this->identicalTo($this->_block), 'template.phtml', $vars) ->will($this->returnValue($output)) ; $this->_block->assign($vars); - $this->assertEquals($output, $this->_block->fetchView('template.phtml')); + $this->assertEquals($output, $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 219b83e15c6..acb19c9e375 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,37 +24,42 @@ namespace Magento\View\Layout\File\Source; +use Magento\Filesystem, + Magento\Filesystem\Directory\Read, + Magento\View\Layout\File\Factory; + class BaseTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\View\Layout\File\Source\Base + * @var Base */ - private $_model; + private $model; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Read | \PHPUnit_Framework_MockObject_MockObject */ - private $_filesystem; + private $directory; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Factory | \PHPUnit_Framework_MockObject_MockObject */ - private $_dirs; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $_fileFactory; + private $fileFactory; protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $this->_dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false); - $this->_dirs->expects($this->any())->method('getDir')->will($this->returnArgument(0)); - $this->_fileFactory = $this->getMock('Magento\View\Layout\File\Factory', array(), array(), '', false); - $this->_model = new \Magento\View\Layout\File\Source\Base( - $this->_filesystem, $this->_dirs, $this->_fileFactory + $this->directory = $this->getMock( + 'Magento\Filesystem\Directory\Read', + array('getAbsolutePath', 'search'), array(), '', false + ); + $filesystem = $this->getMock( + 'Magento\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', false ); + $filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->with(\Magento\Filesystem::MODULES) + ->will($this->returnValue($this->directory)); + $this->fileFactory = $this->getMock('Magento\View\Layout\File\Factory', array(), array(), '', false); + $this->model = new Base($filesystem, $this->fileFactory); } /** @@ -74,12 +79,12 @@ class BaseTest extends \PHPUnit_Framework_TestCase $returnKeys[] = sprintf($handlePath, $file['module'], $file['handle']); } - $this->_filesystem - ->expects($this->once()) - ->method('searchKeys') - ->with('code', "*/*/view/area/layout/{$filePath}.xml") - ->will($this->returnValue($returnKeys)) - ; + $this->directory->expects($this->once()) + ->method('search') + ->will($this->returnValue($returnKeys)); + $this->directory->expects($this->any()) + ->method('getAbsolutePath') + ->will($this->returnArgument(0)); $checkResult = array(); foreach ($files as $key => $file) { @@ -90,7 +95,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase $theme ); - $this->_fileFactory + $this->fileFactory ->expects($this->at($key)) ->method('create') ->with(sprintf($handlePath, $file['module'], $file['handle']), $moduleName) @@ -98,7 +103,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase ; } - $this->assertSame($checkResult, $this->_model->getFiles($theme, $filePath)); + $this->assertSame($checkResult, $this->model->getFiles($theme, $filePath)); } /** 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 ad327780993..4b9692b713a 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,36 +24,43 @@ namespace Magento\View\Layout\File\Source\Override; +use Magento\Filesystem, + Magento\Filesystem\Directory\Read, + Magento\View\Layout\File\Factory; + class BaseTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\View\Layout\File\Source\Override\Base - */ - private $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Base */ - private $_filesystem; + private $model; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Read | \PHPUnit_Framework_MockObject_MockObject */ - private $_dirs; + private $directory; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Factory | \PHPUnit_Framework_MockObject_MockObject */ - private $_fileFactory; + private $fileFactory; protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $this->_dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false); - $this->_dirs->expects($this->any())->method('getDir')->will($this->returnArgument(0)); - $this->_fileFactory = $this->getMock('Magento\View\Layout\File\Factory', array(), array(), '', false); - $this->_model = new \Magento\View\Layout\File\Source\Override\Base( - $this->_filesystem, $this->_dirs, $this->_fileFactory + $this->directory = $this->getMock( + 'Magento\Filesystem\Directory\Read', + array('getAbsolutePath', 'search'), array(), '', false + ); + $filesystem = $this->getMock( + 'Magento\Filesystem', array('getDirectoryRead'), array(), '', false + ); + $filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->with(\Magento\Filesystem::THEMES) + ->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( + $filesystem, $this->fileFactory ); } @@ -74,17 +81,17 @@ class BaseTest extends \PHPUnit_Framework_TestCase $returnKeys[] = sprintf($handlePath, $file['module'], $file['handle']); } - $this->_filesystem - ->expects($this->once()) - ->method('searchKeys') - ->with('design', "area/theme/path/*_*/layout/override/base/{$filePath}.xml") - ->will($this->returnValue($returnKeys)) - ; + $this->directory->expects($this->once()) + ->method('search') + ->will($this->returnValue($returnKeys)); + $this->directory->expects($this->any()) + ->method('getAbsolutePath') + ->will($this->returnArgument(0)); $checkResult = array(); foreach ($files as $key => $file) { $checkResult[$key] = new \Magento\View\Layout\File($file['handle'] . '.xml', $file['module']); - $this->_fileFactory + $this->fileFactory ->expects($this->at($key)) ->method('create') ->with(sprintf($handlePath, $file['module'], $file['handle']), $file['module']) @@ -92,7 +99,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase ; } - $this->assertSame($checkResult, $this->_model->getFiles($theme, $filePath)); + $this->assertSame($checkResult, $this->model->getFiles($theme, $filePath)); } /** 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 da30f6bf96d..ca1eb089307 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 @@ -34,12 +34,7 @@ class ThemeTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - private $_filesystem; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $_dirs; + private $_directory; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -48,12 +43,16 @@ class ThemeTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $this->_dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false); - $this->_dirs->expects($this->any())->method('getDir')->will($this->returnArgument(0)); + $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryRead'), array(), '', false); + $this->_directory = $this->getMock('Magento\Filesystem\Directory\Read', array('search'), array(), '', false); + + $filesystem->expects($this->any())->method('getDirectoryRead') + ->with(\Magento\Filesystem::THEMES) + ->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( - $this->_filesystem, $this->_dirs, $this->_fileFactory + $filesystem, $this->_fileFactory ); } @@ -72,10 +71,9 @@ class ThemeTest extends \PHPUnit_Framework_TestCase $filePathOne = 'design/area/theme_path/Module_One/layout/override/theme/parent_theme/1.xml'; $filePathTwo = 'design/area/theme_path/Module_Two/layout/override/theme/grand_parent_theme/2.xml'; - $this->_filesystem - ->expects($this->once()) - ->method('searchKeys') - ->with('design', 'area/theme_path/*_*/layout/override/theme/*/*.xml') + $this->_directory->expects($this->once()) + ->method('search') + ->with('~area\/theme_path\/[\S]+_[\S]+\/layout\/override\/theme\/[\S]+\/[\S]+\.xml~') ->will($this->returnValue(array($filePathOne, $filePathTwo))) ; @@ -107,10 +105,9 @@ class ThemeTest extends \PHPUnit_Framework_TestCase $theme->expects($this->once())->method('getParentTheme')->will($this->returnValue($parentTheme)); $filePathOne = 'design/area/theme_path/Module_Two/layout/override/theme/grand_parent_theme/preset/3.xml'; - $this->_filesystem - ->expects($this->once()) - ->method('searchKeys') - ->with('design', 'area/theme_path/*_*/layout/override/theme/*/preset/3.xml') + $this->_directory->expects($this->once()) + ->method('search') + ->with('~area\/theme_path\/[\S]+_[\S]+\/layout\/override\/theme\/[\S]+\/preset\/3\.xml~') ->will($this->returnValue(array($filePathOne))) ; @@ -139,12 +136,11 @@ class ThemeTest extends \PHPUnit_Framework_TestCase $theme->expects($this->once())->method('getParentTheme')->will($this->returnValue(null)); $theme->expects($this->once())->method('getCode')->will($this->returnValue('theme_path')); - $this->_filesystem - ->expects($this->once()) - ->method('searchKeys') - ->with('design', 'area/theme_path/*_*/layout/override/theme/*/*.xml') - ->will($this->returnValue(array($filePath))) - ; + $this->_directory->expects($this->once()) + ->method('search') + ->with('~area\/theme_path\/[\S]+_[\S]+\/layout\/override\/theme\/[\S]+\/[\S]+\.xml~') + ->will($this->returnValue(array($filePath))); + $this->_model->getFiles($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 7d511a35d83..0d13c2c633a 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,36 +24,43 @@ namespace Magento\View\Layout\File\Source; +use Magento\Filesystem, + Magento\Filesystem\Directory\Read, + Magento\View\Layout\File\Factory; + class ThemeTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\View\Layout\File\Source\Theme - */ - private $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Base */ - private $_filesystem; + private $model; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Read | \PHPUnit_Framework_MockObject_MockObject */ - private $_dirs; + private $directory; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Factory | \PHPUnit_Framework_MockObject_MockObject */ - private $_fileFactory; + private $fileFactory; protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $this->_dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false); - $this->_dirs->expects($this->any())->method('getDir')->will($this->returnArgument(0)); - $this->_fileFactory = $this->getMock('Magento\View\Layout\File\Factory', array(), array(), '', false); - $this->_model = new \Magento\View\Layout\File\Source\Theme( - $this->_filesystem, $this->_dirs, $this->_fileFactory + $this->directory = $this->getMock( + 'Magento\Filesystem\Directory\Read', + array('getAbsolutePath', 'search'), array(), '', false + ); + $filesystem = $this->getMock( + 'Magento\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', false + ); + $filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->with(\Magento\Filesystem::THEMES) + ->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( + $filesystem, $this->fileFactory ); } @@ -73,24 +80,25 @@ class ThemeTest extends \PHPUnit_Framework_TestCase foreach ($files as $file) { $returnKeys[] = sprintf($handlePath, $file['module'], $file['handle']); } - $this->_filesystem - ->expects($this->once()) - ->method('searchKeys') - ->with('design', "area/theme/path/*_*/layout/{$filePath}.xml") - ->will($this->returnValue($returnKeys)) - ; + + $this->directory->expects($this->once()) + ->method('search') + ->will($this->returnValue($returnKeys)); + $this->directory->expects($this->any()) + ->method('getAbsolutePath') + ->will($this->returnArgument(0)); $checkResult = array(); foreach ($files as $key => $file) { $checkResult[$key] = new \Magento\View\Layout\File($file['handle'] . '.xml', $file['module'], $theme); - $this->_fileFactory + $this->fileFactory ->expects($this->at($key)) ->method('create') ->with(sprintf($handlePath, $file['module'], $file['handle']), $file['module'], $theme) ->will($this->returnValue($checkResult[$key])) ; } - $this->assertSame($checkResult, $this->_model->getFiles($theme, $filePath)); + $this->assertSame($checkResult, $this->model->getFiles($theme, $filePath)); } /** diff --git a/dev/tests/unit/testsuite/Magento/View/TemplateEngine/PhpTest.php b/dev/tests/unit/testsuite/Magento/View/TemplateEngine/PhpTest.php index 3f536204516..b19a9a2ec60 100644 --- a/dev/tests/unit/testsuite/Magento/View/TemplateEngine/PhpTest.php +++ b/dev/tests/unit/testsuite/Magento/View/TemplateEngine/PhpTest.php @@ -31,12 +31,18 @@ class PhpTest extends \PHPUnit_Framework_TestCase /** @var \Magento\View\TemplateEngine\Php */ protected $_phpEngine; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_helperFactoryMock; + /** * Create a PHP template engine to test. */ protected function setUp() { - $this->_phpEngine = new \Magento\View\TemplateEngine\Php(); + $this->_helperFactoryMock = $this->getMock('Magento\ObjectManager'); + $this->_phpEngine = new \Magento\View\TemplateEngine\Php($this->_helperFactoryMock); } /** @@ -83,4 +89,26 @@ class PhpTest extends \PHPUnit_Framework_TestCase $this->_phpEngine->render($blockMock, $filename); } + /** + * @expectedException \LogicException + */ + public function testHelperWithInvalidClass() + { + $class = 'Magento\Object'; + $object = $this->getMock($class, array(), array(), '', false); + $this->_helperFactoryMock->expects($this->once()) + ->method('get')->with($class)->will($this->returnValue($object)); + $this->_phpEngine->helper($class); + } + + public function testHelperWithValidClass() + { + $class = 'Magento\App\Helper\AbstractHelper'; + $object = $this->getMockForAbstractClass($class, array(), '', false); + $this->_helperFactoryMock->expects($this->once()) + ->method('get')->with($class)->will($this->returnValue($object)); + $this->assertEquals($object, $this->_phpEngine->helper($class)); + } + + } diff --git a/dev/tests/unit/testsuite/Magento/View/Url/CssResolverTest.php b/dev/tests/unit/testsuite/Magento/View/Url/CssResolverTest.php index 846473a7ced..b2c506258bb 100644 --- a/dev/tests/unit/testsuite/Magento/View/Url/CssResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Url/CssResolverTest.php @@ -29,13 +29,16 @@ class CssResolverTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\View\Url\CssResolver */ - protected $_object; + protected $object; protected function setUp() { - $filesystem = new \Magento\Filesystem(new \Magento\Filesystem\Adapter\Local()); - $dirs = new \Magento\App\Dir('/base_dir'); - $this->_object = new \Magento\View\Url\CssResolver($filesystem, $dirs); + $filesystem = $this->getMock('Magento\Filesystem', array('getPath', '__wakeup'), array(), '', false); + $filesystem->expects($this->any()) + ->method('getPath') + ->with(\Magento\Filesystem::ROOT) + ->will($this->returnValue('/base_dir/')); + $this->object = new CssResolver($filesystem); } /** @@ -48,7 +51,7 @@ class CssResolverTest extends \PHPUnit_Framework_TestCase */ public function testReplaceCssRelativeUrls($cssContent, $originalPath, $newPath, $callback, $expected) { - $actual = $this->_object->replaceCssRelativeUrls($cssContent, $originalPath, $newPath, $callback); + $actual = $this->object->replaceCssRelativeUrls($cssContent, $originalPath, $newPath, $callback); $this->assertEquals($expected, $actual); } @@ -147,7 +150,7 @@ class CssResolverTest extends \PHPUnit_Framework_TestCase */ public function testReplaceCssRelativeUrlsException($originalFile, $newFile) { - $this->_object->replaceCssRelativeUrls('body {background: url(body.gif);}', $originalFile, $newFile); + $this->object->replaceCssRelativeUrls('body {background: url(body.gif);}', $originalFile, $newFile); } /** diff --git a/dev/tests/unit/testsuite/Magento/View/UrlTest.php b/dev/tests/unit/testsuite/Magento/View/UrlTest.php index 3c865493a52..974bb50f1ba 100644 --- a/dev/tests/unit/testsuite/Magento/View/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/View/UrlTest.php @@ -38,7 +38,7 @@ 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 */ + /** @var $filesystem \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); $filesystem->expects($this->never()) ->method('isFile'); @@ -52,10 +52,8 @@ class UrlTest extends \PHPUnit_Framework_TestCase ->method('copy'); // 2. Get directories configuration - /** @var $dirs \Magento\App\Dir|PHPUnit_Framework_MockObject_MockObject */ - $dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false); - $dirs->expects($this->any()) - ->method('getDir') + $filesystem->expects($this->any()) + ->method('getPath') ->will($this->returnValue('some_dir')); // 3. Get url model @@ -71,7 +69,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($isSigned)); // 5. Get viewService model - /** @var $viewService \Magento\View\Service|PHPUnit_Framework_MockObject_MockObject */ + /** @var $viewService \Magento\View\Service|\PHPUnit_Framework_MockObject_MockObject */ $viewService = $this->getMock('Magento\View\Service', array('updateDesignParams', 'extractScope', 'isViewFileOperationAllowed'), array(), '', false ); @@ -85,14 +83,14 @@ class UrlTest extends \PHPUnit_Framework_TestCase ->method('updateDesignParams'); // 6. Get publisher model - /** @var $publisher \Magento\View\Publisher|PHPUnit_Framework_MockObject_MockObject */ + /** @var $publisher \Magento\View\Publisher|\PHPUnit_Framework_MockObject_MockObject */ $publisher = $this->getMock('Magento\View\Publisher', array(), array(), '', false); $publisher->expects($this->any()) ->method('getPublicFilePath') - ->will($this->returnValue(str_replace('/', DIRECTORY_SEPARATOR, 'some_dir/public_dir/a/t/m/file.js'))); + ->will($this->returnValue('some_dir/public_dir/a/t/m/file.js')); // 7. Get deployed file manager - /** @var $dFManager \Magento\View\DeployedFilesManager|PHPUnit_Framework_MockObject_MockObject */ + /** @var $dFManager \Magento\View\DeployedFilesManager|\PHPUnit_Framework_MockObject_MockObject */ $dFManager = $this->getMock('Magento\View\DeployedFilesManager', array(), array(), '', false ); @@ -101,9 +99,9 @@ class UrlTest extends \PHPUnit_Framework_TestCase $urlMap = array('fake' => array('key' => "some_key", 'value' => "some_value")); // Create model to be tested - /** @var $model \Magento\View\Url|PHPUnit_Framework_MockObject_MockObject */ + /** @var $model \Magento\View\Url|\PHPUnit_Framework_MockObject_MockObject */ $model = new \Magento\View\Url( - $filesystem, $dirs, $urlBuilder, $urlConfig, $viewService, $publisher, $dFManager, $urlMap + $filesystem, $urlBuilder, $urlConfig, $viewService, $publisher, $dFManager, $urlMap ); // Test diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php index 22e7442c63d..962dafaafcd 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php @@ -54,11 +54,17 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); + $filesystemMock = $this->getMockBuilder('\Magento\Filesystem') + ->disableOriginalConstructor() + ->getMock(); + /** Initialize SUT. */ + /** @var \Magento\TestFramework\Helper\ObjectManager $objectManager */ $this->_errorProcessor = new \Magento\Webapi\Controller\ErrorProcessor( $this->_helperMock, $this->_appMock, - $this->_loggerMock + $this->_loggerMock, + $filesystemMock ); parent::setUp(); 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 a26d906b84d..d87f96ebfd2 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php @@ -47,13 +47,11 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); $fileSystemMock = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); - $dirMock = $this->getMockBuilder('Magento\App\Dir')->disableOriginalConstructor()->getMock(); $this->_configMock = $this->getMockBuilder('Magento\Webapi\Model\Config') ->disableOriginalConstructor()->getMock(); $this->_soapConfig = new \Magento\Webapi\Model\Soap\Config( $objectManagerMock, $fileSystemMock, - $dirMock, $this->_configMock ); parent::setUp(); 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 205b4e93e45..d40bac011c5 100644 --- a/dev/tests/unit/testsuite/Magento/Widget/Model/Widget/InstanceTest.php +++ b/dev/tests/unit/testsuite/Magento/Widget/Model/Widget/InstanceTest.php @@ -53,6 +53,11 @@ class InstanceTest extends \PHPUnit_Framework_TestCase */ protected $_cacheTypesListMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_directoryMock; + public function setUp() { $this->_widgetModelMock = $this->getMockBuilder('Magento\Widget\Model\Widget') @@ -69,8 +74,20 @@ class InstanceTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); + $filesystemMock =$this->getMock('\Magento\Filesystem', array(), array(), '', false); + $this->_directoryMock = $this->getMock('\Magento\Filesystem\Directory\Read', array(), array(), '', false); + $filesystemMock->expects($this->any()) + ->method('getDirectoryRead') + ->will($this->returnValue($this->_directoryMock)); + $this->_directoryMock->expects($this->any()) + ->method('isReadable') + ->will($this->returnArgument(0)); + $this->_directoryMock->expects($this->any()) + ->method('getRelativePath') + ->will($this->returnArgument(0)); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $args = $objectManagerHelper->getConstructArguments('Magento\Widget\Model\Widget\Instance', array( + 'filesystem' => $filesystemMock, 'viewFileSystem' => $this->_viewFileSystemMock, 'cacheTypeList' => $this->_cacheTypesListMock, 'reader' => $this->_readerMock, diff --git a/dev/tests/unit/testsuite/Magento/Widget/Model/_files/widget.xml b/dev/tests/unit/testsuite/Magento/Widget/Model/_files/widget.xml index 3aa75369272..eec0841cac2 100644 --- a/dev/tests/unit/testsuite/Magento/Widget/Model/_files/widget.xml +++ b/dev/tests/unit/testsuite/Magento/Widget/Model/_files/widget.xml @@ -58,7 +58,7 @@ </parameter> <parameter name="id_path" xsi:type="block" visible="true" required="true" sort_order="10"> <label translate="true">Product</label> - <block class="Magento\Adminhtml\Block\Catalog\Product\Widget\Chooser"> + <block class="Magento\Backend\Block\Catalog\Product\Widget\Chooser"> <data> <item name="button" xsi:type="array"> <item name="open" xsi:type="string">Select Product...</item> diff --git a/dev/tests/unit/testsuite/Magento/Widget/Model/_files/widget_config.php b/dev/tests/unit/testsuite/Magento/Widget/Model/_files/widget_config.php index cef5b7728f2..7fc8ccfbcd8 100644 --- a/dev/tests/unit/testsuite/Magento/Widget/Model/_files/widget_config.php +++ b/dev/tests/unit/testsuite/Magento/Widget/Model/_files/widget_config.php @@ -78,7 +78,7 @@ return array( 'type' => 'complex', ), 'helper_block' => array( - 'type' => 'Magento\Adminhtml\Block\Catalog\Product\Widget\Chooser', + 'type' => 'Magento\Backend\Block\Catalog\Product\Widget\Chooser', 'data' => array( 'button' => array( 'open' => 'Select Product...' diff --git a/dev/tools/Magento/Tools/Di/Code/Scanner/XmlInterceptorScanner.php b/dev/tools/Magento/Tools/Di/Code/Scanner/XmlInterceptorScanner.php index d8a4df31c9c..b3e19ec369c 100644 --- a/dev/tools/Magento/Tools/Di/Code/Scanner/XmlInterceptorScanner.php +++ b/dev/tools/Magento/Tools/Di/Code/Scanner/XmlInterceptorScanner.php @@ -106,7 +106,7 @@ class XmlInterceptorScanner implements ScannerInterface if (!class_exists($className)) { $className = preg_replace('/[^a-zA-Z0-9_]/', '', $className); $className = preg_replace('/^([0-9A-Za-z]*)_([0-9A-Za-z]*)/', '\\1_\\2_controllers', $className); - $filePath = stream_resolve_include_path(str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'); + $filePath = stream_resolve_include_path(str_replace('_', '/', $className) . '.php'); if (file_exists($filePath)) { require_once $filePath; } diff --git a/dev/tools/Magento/Tools/Di/compiler.php b/dev/tools/Magento/Tools/Di/compiler.php index a2d5a6d8a9f..06008c74976 100644 --- a/dev/tools/Magento/Tools/Di/compiler.php +++ b/dev/tools/Magento/Tools/Di/compiler.php @@ -47,16 +47,16 @@ try { )); $opt->parse(); - $generationDir = $opt->getOption('generation') ? $opt->getOption('generation') : $rootDir . DS . 'var/generation'; + $generationDir = $opt->getOption('generation') ? $opt->getOption('generation') : $rootDir . '/var/generation'; \Magento\Autoload\IncludePath::addIncludePath($generationDir); - $diDir = $opt->getOption('di') ? $opt->getOption('di') : $rootDir . DS . 'var/di'; - $compiledFile = $diDir . DS . 'definitions.php'; - $relationsFile = $diDir . DS . 'relations.php'; - $pluginDefFile = $diDir . DS . 'plugins.php'; + $diDir = $opt->getOption('di') ? $opt->getOption('di') : $rootDir . '/var/di'; + $compiledFile = $diDir . '/definitions.php'; + $relationsFile = $diDir . '/relations.php'; + $pluginDefFile = $diDir . '/plugins.php'; $compilationDirs = array( - $rootDir . DS . 'app/code', + $rootDir . '/app/code', $rootDir . '/lib/Magento', $generationDir, ); @@ -91,7 +91,11 @@ try { $entities['interceptors'] = $interceptorScanner->collectEntities($files['di']); // 1.2 Generation of Factory and Additional Classes - $generatorIo = new \Magento\Code\Generator\Io(null, null, $generationDir); + $generatorIo = new \Magento\Code\Generator\Io( + new \Magento\Filesystem\Driver\File(), + null, + $generationDir + ); $generator = new \Magento\Code\Generator(null, null, $generatorIo); foreach (array('php', 'additional') as $type) { sort($entities[$type]); diff --git a/dev/tools/Magento/Tools/Di/entity_generator.php b/dev/tools/Magento/Tools/Di/entity_generator.php index 4b6f2a2f83d..a3b0f9a995a 100644 --- a/dev/tools/Magento/Tools/Di/entity_generator.php +++ b/dev/tools/Magento/Tools/Di/entity_generator.php @@ -27,7 +27,7 @@ require __DIR__ . '/../../../../../app/bootstrap.php'; // default generation dir -$generationDir = BP . DS . \Magento\Code\Generator\Io::DEFAULT_DIRECTORY; +$generationDir = BP . '/' . \Magento\Code\Generator\Io::DEFAULT_DIRECTORY; try { $opt = new Zend_Console_Getopt(array( @@ -74,7 +74,7 @@ try { \Magento\Autoload\IncludePath::addIncludePath($generationDir); //reinit generator with correct generation path -$io = new \Magento\Code\Generator\Io(null, null, $generationDir); +$io = new \Magento\Code\Generator\Io(new \Magento\Filesystem\Driver\File(), null, $generationDir); $generator = new \Magento\Code\Generator(null, null, $io); try { diff --git a/dev/tools/Magento/Tools/I18n/bootstrap.php b/dev/tools/Magento/Tools/I18n/bootstrap.php index 210073c3fd8..55fe328d87c 100644 --- a/dev/tools/Magento/Tools/I18n/bootstrap.php +++ b/dev/tools/Magento/Tools/I18n/bootstrap.php @@ -21,15 +21,15 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -define('BP', realpath(__DIR__) . DIRECTORY_SEPARATOR); +define('BP', realpath(__DIR__) . '/'); function i18n_tool_autoloader($className) { if (strpos($className, 'Magento\\Tools\\') !== false) { - $filePath = str_replace('\\', DIRECTORY_SEPARATOR, str_replace('Magento\\Tools\\I18n\\', '', $className)); + $filePath = str_replace('\\', '/', str_replace('Magento\\Tools\\I18n\\', '', $className)); $filePath = BP . $filePath . '.php'; } else if (strpos($className, 'Zend_') !== false) { - $filePath = BP . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; + $filePath = BP . str_replace('_', '/', $className) . '.php'; } if (isset($filePath) && file_exists($filePath)) { include_once($filePath); diff --git a/dev/tools/Magento/Tools/Migration/Acl/Generator.php b/dev/tools/Magento/Tools/Migration/Acl/Generator.php index b8b9e39ea13..29e2009e91a 100644 --- a/dev/tools/Magento/Tools/Migration/Acl/Generator.php +++ b/dev/tools/Magento/Tools/Migration/Acl/Generator.php @@ -135,7 +135,7 @@ class Generator $this->_basePath = realpath(__DIR__ . '/../../../../../..'); - $this->_artifactsPath = realpath(__DIR__) . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR; + $this->_artifactsPath = realpath(__DIR__) . '/log/'; } /** @@ -146,7 +146,7 @@ class Generator */ public function getModuleName($fileName) { - $parts = array_reverse(explode(DIRECTORY_SEPARATOR, $fileName)); + $parts = array_reverse(explode('/', $fileName)); $module = $parts[3] . '_' . $parts[2]; return $module; } @@ -231,13 +231,7 @@ class Generator */ public function getEtcDirPattern($codePool = '*', $namespace = '*') { - return $this->getBasePath() . DIRECTORY_SEPARATOR - . 'app' . DIRECTORY_SEPARATOR - . 'code' . DIRECTORY_SEPARATOR - . $codePool . DIRECTORY_SEPARATOR //code pool - . $namespace . DIRECTORY_SEPARATOR //namespace - . '*' . DIRECTORY_SEPARATOR //module name - . 'etc' . DIRECTORY_SEPARATOR; + return $this->getBasePath() . '/app/code/' . $codePool . '/' . $namespace . '/*/etc/'; } /** @@ -515,7 +509,7 @@ class Generator /** @var $dom \DOMDocument **/ foreach ($this->_parsedDomList as $originFile => $dom) { - $file = str_replace('adminhtml.xml', 'adminhtml' . DIRECTORY_SEPARATOR . 'acl.xml', $originFile); + $file = str_replace('adminhtml.xml', 'adminhtml' . '/acl.xml', $originFile); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; diff --git a/dev/tools/Magento/Tools/Migration/Acl/Menu/Generator.php b/dev/tools/Magento/Tools/Migration/Acl/Menu/Generator.php index f29b659a999..08ee27a4c9e 100644 --- a/dev/tools/Magento/Tools/Migration/Acl/Menu/Generator.php +++ b/dev/tools/Magento/Tools/Migration/Acl/Menu/Generator.php @@ -125,13 +125,7 @@ class Generator */ public function getEtcDirPattern() { - return $this->_basePath . DIRECTORY_SEPARATOR - . 'app' . DIRECTORY_SEPARATOR - . 'code' . DIRECTORY_SEPARATOR - . '*' . DIRECTORY_SEPARATOR //code pool - . '*' . DIRECTORY_SEPARATOR //namespace - . '*' . DIRECTORY_SEPARATOR //module name - . 'etc' . DIRECTORY_SEPARATOR; + return $this->_basePath . '/app/code/*/*/*/etc/'; } /** @@ -140,7 +134,7 @@ class Generator public function getMenuFiles() { if (null === $this->_menuFiles) { - $pattern = $this->getEtcDirPattern() . 'adminhtml' . DIRECTORY_SEPARATOR . 'menu.xml'; + $pattern = $this->getEtcDirPattern() . 'adminhtml/menu.xml'; $this->_menuFiles = (glob($pattern)); } return $this->_menuFiles; diff --git a/dev/tools/Magento/Tools/Migration/System/Configuration/Generator.php b/dev/tools/Magento/Tools/Migration/System/Configuration/Generator.php index ec0faba5115..6721e02e668 100644 --- a/dev/tools/Magento/Tools/Migration/System/Configuration/Generator.php +++ b/dev/tools/Magento/Tools/Migration/System/Configuration/Generator.php @@ -196,7 +196,7 @@ class Generator */ protected function _getPathToSave($fileName) { - return dirname($fileName) . DIRECTORY_SEPARATOR . 'adminhtml' . DIRECTORY_SEPARATOR . 'system.xml'; + return dirname($fileName) . '/adminhtml/system.xml'; } /** @@ -207,6 +207,6 @@ class Generator */ protected function _removeBasePath($filename) { - return str_replace($this->_basePath . DIRECTORY_SEPARATOR, '', $filename); + return str_replace($this->_basePath . '/', '', $filename); } } diff --git a/dev/tools/Magento/Tools/Migration/System/Configuration/Reader.php b/dev/tools/Magento/Tools/Migration/System/Configuration/Reader.php index ea59d39a919..b09d1b64b8a 100644 --- a/dev/tools/Magento/Tools/Migration/System/Configuration/Reader.php +++ b/dev/tools/Magento/Tools/Migration/System/Configuration/Reader.php @@ -81,7 +81,7 @@ class Reader public function getConfiguration() { $files = $this->_fileManager->getFileList( - $this->_basePath . DIRECTORY_SEPARATOR + $this->_basePath . '/' . \Magento\Tools\Migration\System\Configuration\Reader::SYSTEM_CONFIG_PATH_PATTERN ); $result = array(); diff --git a/dev/tools/Magento/Tools/View/Generator/Config.php b/dev/tools/Magento/Tools/View/Generator/Config.php index 3e746269d97..4456798a3f1 100644 --- a/dev/tools/Magento/Tools/View/Generator/Config.php +++ b/dev/tools/Magento/Tools/View/Generator/Config.php @@ -47,27 +47,28 @@ class Config private $_isDryRun; /** - * @param string $appBaseDir + * @param \Magento\Filesystem $filesystem * @param array $cmdOptions * @throws \Magento\Exception */ - public function __construct($appBaseDir, $cmdOptions) + public function __construct(\Magento\Filesystem $filesystem, $cmdOptions) { - $sourceDir = isset($cmdOptions['source']) ? $cmdOptions['source'] : $appBaseDir; - if (!is_dir($sourceDir)) { + $rootDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $sourceDir = isset($cmdOptions['source']) ? $cmdOptions['source'] : $rootDirectory->getAbsolutePath(); + if (!$rootDirectory->isDirectory($rootDirectory->getRelativePath($sourceDir))) { throw new \Magento\Exception('Source directory does not exist: ' . $sourceDir); } if (isset($cmdOptions['destination'])) { $destinationDir = $cmdOptions['destination']; } else { - $dirs = new \Magento\App\Dir($sourceDir); - $destinationDir = $dirs->getDir(\Magento\App\Dir::STATIC_VIEW); + $destinationDir = $filesystem->getPath(\Magento\Filesystem::STATIC_VIEW); } - if (!is_dir($destinationDir)) { + $destinationDirRelative = $rootDirectory->getRelativePath($destinationDir); + if (!$rootDirectory->isDirectory($destinationDirRelative)) { throw new \Magento\Exception('Destination directory does not exist: ' . $destinationDir); } - if (glob($destinationDir . DIRECTORY_SEPARATOR . '*')) { + if ($rootDirectory->read($destinationDirRelative)) { throw new \Magento\Exception("Destination directory must be empty: {$destinationDir}"); } diff --git a/dev/tools/Magento/Tools/View/Generator/CopyRule.php b/dev/tools/Magento/Tools/View/Generator/CopyRule.php index 5f396c728d8..9f65333cab0 100644 --- a/dev/tools/Magento/Tools/View/Generator/CopyRule.php +++ b/dev/tools/Magento/Tools/View/Generator/CopyRule.php @@ -100,7 +100,6 @@ class CopyRule array_reverse($nonModularLocations) ); foreach ($allDirPatterns as $pattern) { - $pattern = \Magento\Filesystem::fixSeparator($pattern); foreach ($this->_getMatchingDirs($pattern) as $srcDir) { $paramsFromDir = $this->_parsePlaceholders($srcDir, $pattern); if (!empty($paramsFromDir['namespace']) && !empty($paramsFromDir['module'])) { @@ -145,21 +144,33 @@ class CopyRule */ private function _getMatchingDirs($dirPattern) { - $patternGlob = preg_replace($this->_placeholderPcre, '*', $dirPattern, -1, $placeholderCount); + $dirPattern = preg_replace($this->_placeholderPcre, '*', $dirPattern, -1, $placeholderCount); + $directoryHandler = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); if ($placeholderCount) { // autodetect pattern base directory because the filesystem interface requires it - $firstPlaceholderPos = strpos($patternGlob, '*'); - $patternBaseDir = substr($patternGlob, 0, $firstPlaceholderPos); - $patternTrailing = substr($patternGlob, $firstPlaceholderPos); - $paths = $this->_filesystem->searchKeys($patternBaseDir, $patternTrailing); + $firstPlaceholderPos = strpos($dirPattern, '*'); + $patternBaseDir = substr($dirPattern, 0, $firstPlaceholderPos); + $patternTrailing = substr($dirPattern, $firstPlaceholderPos); + $patternTrailing = preg_replace_callback('/[\\\\^$.[\\]|()?*+{}\\-\\/]/', function ($matches) { + switch ($matches[0]) { + case '*': + return '.*'; + case '?': + return '.'; + default: + return '\\'.$matches[0]; + } + }, $patternTrailing, -1); + + $paths = $directoryHandler->search('#' . $patternTrailing . '#', $patternBaseDir); } else { // pattern is already a valid path containing no placeholders $paths = array($dirPattern); } $result = array(); foreach ($paths as $path) { - if ($this->_filesystem->isDirectory($path)) { - $result[] = $path; + if ($directoryHandler->isDirectory($path)) { + $result[] = $directoryHandler->getAbsolutePath($path); } } return $result; diff --git a/dev/tools/Magento/Tools/View/Generator/ThemeDeployment.php b/dev/tools/Magento/Tools/View/Generator/ThemeDeployment.php index 86657a32342..0bf1ff0de4e 100644 --- a/dev/tools/Magento/Tools/View/Generator/ThemeDeployment.php +++ b/dev/tools/Magento/Tools/View/Generator/ThemeDeployment.php @@ -143,7 +143,7 @@ class ThemeDeployment $this->_copyDirStructure( $copyRule['source'], - $this->_destinationHomeDir . DIRECTORY_SEPARATOR . $destDir, + $this->_destinationHomeDir . '/' . $destDir, $context ); } diff --git a/dev/tools/Magento/Tools/View/generator.php b/dev/tools/Magento/Tools/View/generator.php index 0e7e953b1e0..24fdedbefd0 100644 --- a/dev/tools/Magento/Tools/View/generator.php +++ b/dev/tools/Magento/Tools/View/generator.php @@ -62,22 +62,22 @@ if (isset($options['help'])) { $logger->log('Deploying...', \Zend_Log::INFO); try { - $config = new \Magento\Tools\View\Generator\Config(BP, $options); - - $filesystem = new \Magento\Filesystem(new \Magento\Filesystem\Adapter\Local); - $dirs = new \Magento\App\Dir($config->getSourceDir()); $objectManager = new \Magento\ObjectManager\ObjectManager(); $entityFactory = new Magento\Core\Model\EntityFactory($objectManager); - $themes = new \Magento\Core\Model\Theme\Collection($entityFactory, $filesystem, $dirs); + $filesystem = $entityFactory->create('Magento\Filesystem', array( + 'directoryList' => new \Magento\Filesystem\DirectoryList(BP) + )); + $config = new \Magento\Tools\View\Generator\Config($filesystem, $options); + $fileIteratorFactory = new \Magento\Config\FileIteratorFactory(); + $themes = new \Magento\Core\Model\Theme\Collection($entityFactory, $filesystem, $fileIteratorFactory); $themes->setItemObjectClass('\Magento\Tools\View\Generator\ThemeLight'); $themes->addDefaultPattern('*'); - $fallbackFactory = new \Magento\View\Design\Fallback\Factory($dirs); + $fallbackFactory = new \Magento\View\Design\Fallback\Factory($filesystem); $generator = new \Magento\Tools\View\Generator\CopyRule($filesystem, $themes, $fallbackFactory->createViewFileRule()); $copyRules = $generator->getCopyRules(); - - $cssUrlResolver = new \Magento\View\Url\CssResolver($filesystem, $dirs); + $cssUrlResolver = new \Magento\View\Url\CssResolver($filesystem); $deployment = new \Magento\Tools\View\Generator\ThemeDeployment( $cssUrlResolver, $config->getDestinationDir(), diff --git a/dev/tools/Magento/Tools/classmap/fs_generator.php b/dev/tools/Magento/Tools/classmap/fs_generator.php index feae0649692..06ed681a6eb 100644 --- a/dev/tools/Magento/Tools/classmap/fs_generator.php +++ b/dev/tools/Magento/Tools/classmap/fs_generator.php @@ -28,8 +28,8 @@ $path = false; if (isset($argv[1])) { if (realpath($argv[1])) { $path = realpath($argv[1]); - } elseif (realpath(getcwd() . DIRECTORY_SEPARATOR . $argv[1])) { - $path = realpath(getcwd() . DIRECTORY_SEPARATOR . $argv[1]); + } elseif (realpath(getcwd() . '/' . $argv[1])) { + $path = realpath(getcwd() . '/' . $argv[1]); } } @@ -39,7 +39,7 @@ if (!$path) { } -$basePath = realpath(__DIR__ . '/../../../') . DIRECTORY_SEPARATOR; +$basePath = realpath(__DIR__ . '/../../../') . '/'; $directory = new RecursiveDirectoryIterator($path); $iterator = new RecursiveIteratorIterator($directory); $regex = new RegexIterator($iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH); diff --git a/dev/tools/Magento/Tools/classmap/log_generator.php b/dev/tools/Magento/Tools/classmap/log_generator.php index f20d790b0c1..b7602614bfe 100644 --- a/dev/tools/Magento/Tools/classmap/log_generator.php +++ b/dev/tools/Magento/Tools/classmap/log_generator.php @@ -45,7 +45,7 @@ foreach ($files as $file) { } sort($classes); -$baseDir = realpath(__DIR__ . '/../../../../../') . DIRECTORY_SEPARATOR; +$baseDir = realpath(__DIR__ . '/../../../../../') . '/'; $sources = array('app/code', 'lib',); $map = array(); diff --git a/dev/tools/bootstrap.php b/dev/tools/bootstrap.php index 2d59fc79f45..82e3e176330 100644 --- a/dev/tools/bootstrap.php +++ b/dev/tools/bootstrap.php @@ -23,10 +23,9 @@ */ require_once __DIR__ . '/../../app/autoload.php'; define('BP', __DIR__ . '/../..'); -define('DS', DIRECTORY_SEPARATOR); \Magento\Autoload\IncludePath::addIncludePath(array( - BP . DS . 'app' . DS . 'code', - BP . DS . 'lib', + BP . '/app/code', + BP . '/lib', )); function tool_autoloader($className) @@ -34,8 +33,8 @@ function tool_autoloader($className) if (strpos($className, 'Magento\\Tools\\') === false) { return false; } - $filePath = str_replace('\\', DIRECTORY_SEPARATOR, $className); - $filePath = __DIR__ . DIRECTORY_SEPARATOR . $filePath . '.php'; + $filePath = str_replace('\\', '/', $className); + $filePath = __DIR__ . '/' . $filePath . '.php'; if (file_exists($filePath)) { include($filePath); } else { diff --git a/downloader/app/Magento/Downloader/Connect.php b/downloader/app/Magento/Downloader/Connect.php index 730e02dbb6c..8879c4b8958 100644 --- a/downloader/app/Magento/Downloader/Connect.php +++ b/downloader/app/Magento/Downloader/Connect.php @@ -28,14 +28,9 @@ namespace Magento\Downloader; error_reporting(E_ALL & ~E_NOTICE); -// just a shortcut -if (!defined('DS')) { - define('DS', DIRECTORY_SEPARATOR); -} - // add Magento lib in include_path if needed $_includePath = get_include_path(); -$_libDir = dirname(__DIR__) . DS . 'lib'; +$_libDir = dirname(__DIR__) . '/lib'; if (strpos($_includePath, $_libDir) === false) { if (substr($_includePath, 0, 2) === '.' . PATH_SEPARATOR) { $_includePath = '.' . PATH_SEPARATOR . $_libDir . PATH_SEPARATOR . substr($_includePath, 2); @@ -146,7 +141,7 @@ class Connect $this->_config=$config; $this->_sconfig=$cache; } - $this->_config->magento_root = dirname(__DIR__).DS.'..'; + $this->_config->magento_root = dirname(__DIR__) . '/..'; \Magento\Connect\Command::setConfigObject($this->_config); } return $this->_config; @@ -162,8 +157,8 @@ class Connect { if(!$this->_sconfig || $reload) { $this->_sconfig = new \Magento\Connect\Singleconfig( - $this->getConfig()->magento_root . DIRECTORY_SEPARATOR - . $this->getConfig()->downloader_path . DIRECTORY_SEPARATOR + $this->getConfig()->magento_root . '/' + . $this->getConfig()->downloader_path . '/' . \Magento\Connect\Singleconfig::DEFAULT_SCONFIG_FILENAME ); } @@ -228,7 +223,7 @@ class Connect $entries = @scandir($path); foreach ($entries as $entry) { if ($entry != '.' && $entry != '..') { - $this->delTree($path.DS.$entry); + $this->delTree($path . '/' . $entry); } } @rmdir($path); @@ -249,7 +244,7 @@ class Connect public function run($command, $options=array(), $params=array()) { @set_time_limit(0); - @ini_set('memory_limit', '256M'); + @ini_set('memory_limit', '2048M'); if (empty($this->_cmdCache[$command])) { \Magento\Connect\Command::getCommands(); diff --git a/downloader/app/Magento/Downloader/Controller.php b/downloader/app/Magento/Downloader/Controller.php index f6b48772f67..8a0405939e6 100755 --- a/downloader/app/Magento/Downloader/Controller.php +++ b/downloader/app/Magento/Downloader/Controller.php @@ -384,7 +384,7 @@ final class Controller return; } - $target = $this->_mageDir . DS . "var/" . uniqid() . $info['name']; + $target = $this->_mageDir . '/var/' . uniqid() . $info['name']; $res = move_uploaded_file($info['tmp_name'], $target); if(false === $res) { echo "Error moving uploaded file"; @@ -552,8 +552,7 @@ final class Controller */ public function getBootstrapPath() { - $ds = DIRECTORY_SEPARATOR; - return $this->getMageDir() . $ds . 'app' . $ds . 'bootstrap.php'; + return $this->getMageDir() . '/app/bootstrap.php'; } /** @@ -563,8 +562,7 @@ final class Controller */ public function getVarFilename() { - $ds = DIRECTORY_SEPARATOR; - return $this->getMageDir() . $ds . 'lib' . $ds . 'Magento' . $ds . 'Profiler.php'; + return $this->getMageDir() . '/lib/Magento/Profiler.php'; } /** @@ -575,8 +573,7 @@ final class Controller */ public function filepath($name = '') { - $ds = DIRECTORY_SEPARATOR; - return rtrim($this->getRootDir() . $ds . str_replace('/', $ds, $name), $ds); + return rtrim($this->getRootDir() . '/' . $name, '/'); } /** @@ -610,7 +607,7 @@ final class Controller } else { $class = 'Magento\Downloader\Model\\' . str_replace(' ', '\\', ucwords(str_replace('\\', ' ', $model))); if (!class_exists($class, false)) { - include_once str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; + include_once str_replace('_', '/', $class).'.php'; } } @@ -812,7 +809,7 @@ final class Controller public function isWritable() { if (is_null($this->_writable)) { - $this->_writable = is_writable($this->getMageDir() . DIRECTORY_SEPARATOR) + $this->_writable = is_writable($this->getMageDir() . '/') && is_writable($this->filepath()) && (!file_exists($this->filepath('config.ini') || is_writable($this->filepath('config.ini')))); } @@ -863,7 +860,7 @@ final class Controller protected function _getMaintenanceFilePath() { if (is_null($this->_maintenanceFile)) { - $path = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR; + $path = dirname(dirname(__DIR__)) . '/'; $this->_maintenanceFile = $path . 'maintenance.flag'; } return $this->_maintenanceFile; @@ -1030,7 +1027,7 @@ final class Controller ->setBackupExtension($this->_getExtensionType($type)) ->setTime(time()) ->setName($archiveName) - ->setBackupsDir(\Mage::getBaseDir('var') . DS . 'backups'); + ->setBackupsDir(\Mage::getBaseDir('var') . '/backups'); \Magento\App\ObjectManager::getInstance() ->get('Magento\Core\Model\Registry') @@ -1074,12 +1071,12 @@ final class Controller '.git', '.svn', 'maintenance.flag', - \Mage::getBaseDir('var') . DS . 'session', - \Mage::getBaseDir('var') . DS . 'cache', - \Mage::getBaseDir('var') . DS . 'full_page_cache', - \Mage::getBaseDir('var') . DS . 'locks', - \Mage::getBaseDir('var') . DS . 'log', - \Mage::getBaseDir('var') . DS . 'report' + \Mage::getBaseDir('var') . '/session', + \Mage::getBaseDir('var') . '/cache', + \Mage::getBaseDir('var') . '/full_page_cache', + \Mage::getBaseDir('var') . '/locks', + \Mage::getBaseDir('var') . '/log', + \Mage::getBaseDir('var') . '/report' ); } diff --git a/downloader/app/Magento/Downloader/Model/Config/AbstractConfig.php b/downloader/app/Magento/Downloader/Model/Config/AbstractConfig.php index 9ea95e6b2fe..204dd6028b3 100644 --- a/downloader/app/Magento/Downloader/Model/Config/AbstractConfig.php +++ b/downloader/app/Magento/Downloader/Model/Config/AbstractConfig.php @@ -83,7 +83,7 @@ class AbstractConfig extends \Magento\Downloader\Model { if ((!is_writable($this->getFilename())&&is_file($this->getFilename()))||(dirname($this->getFilename())!=''&&!is_writable(dirname($this->getFilename())))) { if(isset($this->_data['ftp'])&&!empty($this->_data['ftp'])&&strlen($this->get('downloader_path'))>0){ - $confFile=$this->get('downloader_path').DIRECTORY_SEPARATOR.basename($this->getFilename()); + $confFile=$this->get('downloader_path') . '/' . basename($this->getFilename()); $ftpObj = new \Magento\Connect\Ftp(); $ftpObj->connect($this->_data['ftp']); $tempFile = tempnam(sys_get_temp_dir(),'configini'); diff --git a/downloader/app/Magento/Downloader/Model/Connect.php b/downloader/app/Magento/Downloader/Model/Connect.php index 76db951fd63..10b72ce566f 100644 --- a/downloader/app/Magento/Downloader/Model/Connect.php +++ b/downloader/app/Magento/Downloader/Model/Connect.php @@ -388,7 +388,7 @@ class Connect extends \Magento\Downloader\Model if ('ftp' == $p['deployment_type'] || '1' == $p['inst_protocol']) { /*check ftp*/ - $confFile = $configObj->downloader_path.DIRECTORY_SEPARATOR.$configTestFile; + $confFile = $configObj->downloader_path . '/' . $configTestFile; try { $ftpObj = new \Magento\Connect\Ftp(); $ftpObj->connect($p['ftp']); diff --git a/downloader/lib/Magento/Archive.php b/downloader/lib/Magento/Archive.php index 4066c7deff5..408122465f0 100644 --- a/downloader/lib/Magento/Archive.php +++ b/downloader/lib/Magento/Archive.php @@ -127,7 +127,7 @@ class Archive if ($i == (count($archivers) - 1)) { $packed = $destination; } else { - $packed = dirname($destination) . DS . '~tmp-'. microtime(true) . $archivers[$i] . '.' . $archivers[$i]; + $packed = dirname($destination) . '/~tmp-'. microtime(true) . $archivers[$i] . '.' . $archivers[$i]; } $source = $this->_getArchiver($archivers[$i])->pack($source, $packed, $skipRoot); if ($interimSource && $i < count($archivers)) { @@ -157,9 +157,9 @@ class Archive break; } if ($i == 0) { - $packed = rtrim($destination, DS) . DS; + $packed = rtrim($destination, '/') . '/'; } else { - $packed = rtrim($destination, DS) . DS . '~tmp-'. microtime(true) . $archivers[$i-1] . '.' + $packed = rtrim($destination, '/') . '/~tmp-'. microtime(true) . $archivers[$i-1] . '.' . $archivers[$i-1]; } $source = $this->_getArchiver($archivers[$i])->unpack($source, $packed); diff --git a/downloader/lib/Magento/Archive/AbstractArchive.php b/downloader/lib/Magento/Archive/AbstractArchive.php index b09fe958f15..90639ef93e7 100644 --- a/downloader/lib/Magento/Archive/AbstractArchive.php +++ b/downloader/lib/Magento/Archive/AbstractArchive.php @@ -80,7 +80,7 @@ class AbstractArchive */ public function getFilename($source, $withExtension=false) { - $file = str_replace(dirname($source) . DS, '', $source); + $file = str_replace(dirname($source) . '/', '', $source); if (!$withExtension) { $file = substr($file, 0, strrpos($file, '.')); } diff --git a/downloader/lib/Magento/Archive/Tar.php b/downloader/lib/Magento/Archive/Tar.php index d0cb245011b..9307a123d3c 100644 --- a/downloader/lib/Magento/Archive/Tar.php +++ b/downloader/lib/Magento/Archive/Tar.php @@ -200,7 +200,7 @@ class Tar extends \Magento\Archive\AbstractArchive implements \Magento\Archive\A */ protected function _setCurrentFile($file) { - $this->_currentFile = $file .((!is_link($file) && is_dir($file) && substr($file, -1) != DS) ? DS : ''); + $this->_currentFile = $file .((!is_link($file) && is_dir($file) && substr($file, -1) != '/') ? '/' : ''); return $this; } @@ -235,9 +235,9 @@ class Tar extends \Magento\Archive\AbstractArchive implements \Magento\Archive\A protected function _setCurrentPath($path) { if ($this->_skipRoot && is_dir($path)) { - $this->_currentPath = $path.(substr($path, -1)!=DS?DS:''); + $this->_currentPath = $path.(substr($path, -1) != '/' ? '/' : ''); } else { - $this->_currentPath = dirname($path) . DS; + $this->_currentPath = dirname($path) . '/'; } return $this; } @@ -457,7 +457,7 @@ class Tar extends \Magento\Archive\AbstractArchive implements \Magento\Archive\A throw new \Magento\Exception('Failed to create directory ' . $currentFile); } } - $list[] = $currentFile . DS; + $list[] = $currentFile . '/'; } elseif ($header['type'] == '2') { //we do not interrupt unpack process if symlink creation failed as symlinks are not so important diff --git a/downloader/lib/Magento/Autoload/Simple.php b/downloader/lib/Magento/Autoload/Simple.php index 0b60f71cf0f..6a89c2c7db7 100644 --- a/downloader/lib/Magento/Autoload/Simple.php +++ b/downloader/lib/Magento/Autoload/Simple.php @@ -46,7 +46,7 @@ class Simple public function autoload($class) { - $classFile = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $class))); + $classFile = str_replace(' ', '/', ucwords(str_replace('_', ' ', $class))); $classFile.= '.php'; @include $classFile; } diff --git a/downloader/lib/Magento/Backup/AbstractBackup.php b/downloader/lib/Magento/Backup/AbstractBackup.php index da7e8ede317..01c96060445 100644 --- a/downloader/lib/Magento/Backup/AbstractBackup.php +++ b/downloader/lib/Magento/Backup/AbstractBackup.php @@ -212,7 +212,7 @@ abstract class AbstractBackup implements \Magento\Backup\BackupInterface */ public function getBackupPath() { - return $this->getBackupsDir() . DS . $this->getBackupFilename(); + return $this->getBackupsDir() . '/' . $this->getBackupFilename(); } /** diff --git a/downloader/lib/Magento/Backup/Factory.php b/downloader/lib/Magento/Backup/Factory.php index 4001ecf1d80..084b2d8683b 100644 --- a/downloader/lib/Magento/Backup/Factory.php +++ b/downloader/lib/Magento/Backup/Factory.php @@ -34,12 +34,37 @@ class Factory */ private $_objectManager; + /** + * Backup type constant for database backup + */ + const TYPE_DB = 'db'; + + /** + * Backup type constant for filesystem backup + */ + const TYPE_FILESYSTEM = 'filesystem'; + + /** + * Backup type constant for full system backup(database + filesystem) + */ + const TYPE_SYSTEM_SNAPSHOT = 'snapshot'; + + /** + * Backup type constant for media and database backup + */ + const TYPE_MEDIA = 'media'; + + /** + * Backup type constant for full system backup excluding media folder + */ + const TYPE_SNAPSHOT_WITHOUT_MEDIA = 'nomedia'; + /** * List of supported a backup types * * @var array */ - private $_allowedTypes = array('db', 'snapshot', 'filesystem', 'media', 'nomedia'); + protected $_allowedTypes; /** * @param \Magento\ObjectManager $objectManager @@ -47,6 +72,13 @@ class Factory public function __construct(\Magento\ObjectManager $objectManager) { $this->_objectManager = $objectManager; + $this->_allowedTypes = array( + self::TYPE_DB, + self::TYPE_FILESYSTEM, + self::TYPE_SYSTEM_SNAPSHOT, + self::TYPE_MEDIA, + self::TYPE_SNAPSHOT_WITHOUT_MEDIA, + ); } /** diff --git a/downloader/lib/Magento/Backup/Filesystem.php b/downloader/lib/Magento/Backup/Filesystem.php index 450192c6b81..02b8839d076 100755 --- a/downloader/lib/Magento/Backup/Filesystem.php +++ b/downloader/lib/Magento/Backup/Filesystem.php @@ -280,6 +280,6 @@ class Filesystem extends \Magento\Backup\AbstractBackup protected function _getTarTmpPath() { $tmpName = '~tmp-'. microtime(true) . '.tar'; - return $this->getBackupsDir() . DS . $tmpName; + return $this->getBackupsDir() . '/' . $tmpName; } } diff --git a/downloader/lib/Magento/Backup/Filesystem/Rollback/Ftp.php b/downloader/lib/Magento/Backup/Filesystem/Rollback/Ftp.php index 6733d5e1c74..d05511b485d 100755 --- a/downloader/lib/Magento/Backup/Filesystem/Rollback/Ftp.php +++ b/downloader/lib/Magento/Backup/Filesystem/Rollback/Ftp.php @@ -93,7 +93,7 @@ class Ftp extends \Magento\Backup\Filesystem\Rollback\AbstractRollback protected function _validateFtp() { $validationFilename = '~validation-' . microtime(true) . '.tmp'; - $validationFilePath = $this->_snapshot->getBackupsDir() . DS . $validationFilename; + $validationFilePath = $this->_snapshot->getBackupsDir() . '/' . $validationFilename; $fh = @fopen($validationFilePath, 'w'); @fclose($fh); @@ -103,7 +103,7 @@ class Ftp extends \Magento\Backup\Filesystem\Rollback\AbstractRollback } $rootDir = $this->_snapshot->getRootDir(); - $ftpPath = $this->_snapshot->getFtpPath() . DS . str_replace($rootDir, '', $validationFilePath); + $ftpPath = $this->_snapshot->getFtpPath() . '/' . str_replace($rootDir, '', $validationFilePath); $fileExistsOnFtp = $this->_ftpClient->fileExists($ftpPath); @unlink($validationFilePath); @@ -132,7 +132,7 @@ class Ftp extends \Magento\Backup\Filesystem\Rollback\AbstractRollback */ protected function _createTmpDir() { - $tmpDir = $this->_snapshot->getBackupsDir() . DS . '~tmp-' . microtime(true); + $tmpDir = $this->_snapshot->getBackupsDir() . '/~tmp-' . microtime(true); $result = @mkdir($tmpDir); @@ -157,8 +157,8 @@ class Ftp extends \Magento\Backup\Filesystem\Rollback\AbstractRollback $iterator = new \Magento\Backup\Filesystem\Iterator\Filter($filesystemIterator, $this->_snapshot->getIgnorePaths()); foreach ($iterator as $item) { - $ftpPath = $this->_snapshot->getFtpPath() . DS . str_replace($rootDir, '', $item->__toString()); - $ftpPath = str_replace(DS, '/', $ftpPath); + $ftpPath = $this->_snapshot->getFtpPath() . '/' . str_replace($rootDir, '', $item->__toString()); + $ftpPath = str_replace('\\', '/', $ftpPath); $this->_ftpClient->delete($ftpPath); } @@ -179,8 +179,8 @@ class Ftp extends \Magento\Backup\Filesystem\Rollback\AbstractRollback $iterator = new \Magento\Backup\Filesystem\Iterator\Filter($filesystemIterator, $this->_snapshot->getIgnorePaths()); foreach ($filesystemIterator as $item) { - $ftpPath = $this->_snapshot->getFtpPath() . DS . str_replace($tmpDir, '', $item->__toString()); - $ftpPath = str_replace(DS, '/', $ftpPath); + $ftpPath = $this->_snapshot->getFtpPath() . '/' . str_replace($tmpDir, '', $item->__toString()); + $ftpPath = str_replace('\\', '/', $ftpPath); if ($item->isLink()) { continue; diff --git a/downloader/lib/Magento/Backup/Media.php b/downloader/lib/Magento/Backup/Media.php index 78d99dedac6..905a168ab41 100644 --- a/downloader/lib/Magento/Backup/Media.php +++ b/downloader/lib/Magento/Backup/Media.php @@ -33,26 +33,10 @@ */ namespace Magento\Backup; -class Media extends \Magento\Backup\AbstractBackup +class Media extends \Magento\Backup\Snapshot { /** - * Snapshot backup manager instance - * - * @var \Magento\Backup\Snapshot - */ - protected $_snapshotManager; - - /** - * @param \Magento\Backup\Snapshot $snapshotManager - */ - public function __construct( - \Magento\Backup\Snapshot $snapshotManager - ) { - $this->_snapshotManager = $snapshotManager; - } - - /** - * Implementation Rollback functionality for Snapshot + * Implementation Rollback functionality for Media * * @throws \Magento\Exception * @return bool @@ -60,11 +44,11 @@ class Media extends \Magento\Backup\AbstractBackup public function rollback() { $this->_prepareIgnoreList(); - return $this->_snapshotManager->rollback(); + return parent::rollback(); } /** - * Implementation Create Backup functionality for Snapshot + * Implementation Create Backup functionality for Media * * @throws \Magento\Exception * @return bool @@ -72,7 +56,7 @@ class Media extends \Magento\Backup\AbstractBackup public function create() { $this->_prepareIgnoreList(); - return $this->_snapshotManager->create(); + return parent::create(); } /** @@ -93,95 +77,22 @@ class Media extends \Magento\Backup\AbstractBackup */ protected function _prepareIgnoreList() { - $rootDir = $this->_snapshotManager->getRootDir(); + $rootDir = $this->getRootDir(); $map = array( $rootDir => array('media', 'var', 'pub'), - $rootDir . DIRECTORY_SEPARATOR . 'pub' => array('media'), - $rootDir . DIRECTORY_SEPARATOR . 'var' => array($this->_snapshotManager->getDbBackupFilename()), + $rootDir . '/pub' => array('media'), + $rootDir . '/var' => array($this->getDbBackupFilename()), ); foreach ($map as $path => $whiteList) { foreach (new \DirectoryIterator($path) as $item) { $filename = $item->getFilename(); if (!$item->isDot() && !in_array($filename, $whiteList)) { - $this->_snapshotManager->addIgnorePaths($item->getPathname()); + $this->addIgnorePaths($item->getPathname()); } } } return $this; } - - /** - * Set Backup Extension - * - * @param string $backupExtension - * @return \Magento\Backup\BackupInterface - */ - public function setBackupExtension($backupExtension) - { - $this->_snapshotManager->setBackupExtension($backupExtension); - return $this; - } - - /** - * Set Resource Model - * - * @param object $resourceModel - * @return \Magento\Backup\BackupInterface - */ - public function setResourceModel($resourceModel) - { - $this->_snapshotManager->setResourceModel($resourceModel); - return $this; - } - - /** - * Set Time - * - * @param int $time - * @return \Magento\Backup\BackupInterface - */ - public function setTime($time) - { - $this->_snapshotManager->setTime($time); - return $this; - } - - /** - * Set path to directory where backups stored - * - * @param string $backupsDir - * @return \Magento\Backup\BackupInterface - */ - public function setBackupsDir($backupsDir) - { - $this->_snapshotManager->setBackupsDir($backupsDir); - return $this; - } - - /** - * Add path that should be ignoring when creating or rolling back backup - * - * @param string|array $paths - * @return \Magento\Backup\BackupInterface - */ - public function addIgnorePaths($paths) - { - $this->_snapshotManager->addIgnorePaths($paths); - return $this; - } - - /** - * Set root directory of Magento installation - * - * @param string $rootDir - * @throws \Magento\Exception - * @return \Magento\Backup\BackupInterface - */ - public function setRootDir($rootDir) - { - $this->_snapshotManager->setRootDir($rootDir); - return $this; - } } diff --git a/downloader/lib/Magento/Backup/Nomedia.php b/downloader/lib/Magento/Backup/Nomedia.php index 378708a207e..33b6936b5b7 100755 --- a/downloader/lib/Magento/Backup/Nomedia.php +++ b/downloader/lib/Magento/Backup/Nomedia.php @@ -53,10 +53,10 @@ class Nomedia extends \Magento\Backup\Media */ protected function _prepareIgnoreList() { - $rootDir = $this->_snapshotManager->getRootDir(); - $this->_snapshotManager->addIgnorePaths(array( - $rootDir . DIRECTORY_SEPARATOR . 'media', - $rootDir . DIRECTORY_SEPARATOR . 'pub' . DIRECTORY_SEPARATOR . 'media', + $rootDir = $this->getRootDir(); + $this->addIgnorePaths(array( + $rootDir . '/media', + $rootDir . '/pub/media', )); return $this; } diff --git a/downloader/lib/Magento/Backup/Snapshot.php b/downloader/lib/Magento/Backup/Snapshot.php index e08ca513690..c4db55c4fca 100755 --- a/downloader/lib/Magento/Backup/Snapshot.php +++ b/downloader/lib/Magento/Backup/Snapshot.php @@ -43,11 +43,11 @@ class Snapshot extends \Magento\Backup\Filesystem protected $_dbBackupManager; /** - * Dirs instance + * Filesystem instance * - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_dirs; + protected $_filesystem; /** * @var \Magento\Backup\Factory @@ -55,14 +55,14 @@ class Snapshot extends \Magento\Backup\Filesystem protected $_backupFactory; /** - * @param \Magento\App\Dir $dirs + * @param \Magento\Filesystem $filesystem * @param Factory $backupFactory */ public function __construct( - \Magento\App\Dir $dirs, + \Magento\Filesystem $filesystem, \Magento\Backup\Factory $backupFactory ) { - $this->_dirs = $dirs; + $this->_filesystem = $filesystem; $this->_backupFactory = $backupFactory; } @@ -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->_dirs->getDir('var')) + ->setBackupsDir($this->_filesystem->getPath(\Magento\Filesystem::VAR_DIR)) ->setResourceModel($this->getResourceModel()); } diff --git a/downloader/lib/Magento/Connect/Command.php b/downloader/lib/Magento/Connect/Command.php index cf0a8fbec7e..960a0885f86 100644 --- a/downloader/lib/Magento/Connect/Command.php +++ b/downloader/lib/Magento/Connect/Command.php @@ -319,7 +319,7 @@ class Command */ public static function registerCommands() { - $pathCommands = __DIR__.DIRECTORY_SEPARATOR.basename(__FILE__, ".php"); + $pathCommands = __DIR__ . '/' . basename(__FILE__, ".php"); $f = new \DirectoryIterator($pathCommands); foreach($f as $file) { /** @var $file \DirectoryIterator */ diff --git a/downloader/lib/Magento/Connect/Command/Install.php b/downloader/lib/Magento/Connect/Command/Install.php index 14127401d99..b1f1b7430ba 100644 --- a/downloader/lib/Magento/Connect/Command/Install.php +++ b/downloader/lib/Magento/Connect/Command/Install.php @@ -73,10 +73,10 @@ final class Install extends \Magento\Connect\Command $config->magento_root=dirname(dirname($_SERVER['SCRIPT_FILENAME'])); } chdir($config->magento_root); - $dirCache = DIRECTORY_SEPARATOR . $config->downloader_path . DIRECTORY_SEPARATOR + $dirCache = '/' . $config->downloader_path . '/' . \Magento\Connect\Config::DEFAULT_CACHE_PATH; - $dirTmp = DIRECTORY_SEPARATOR . \Magento\Connect\Package\Reader::PATH_TO_TEMPORARY_DIRECTORY; - $dirMedia = DIRECTORY_SEPARATOR . 'media'; + $dirTmp = '/' . \Magento\Connect\Package\Reader::PATH_TO_TEMPORARY_DIRECTORY; + $dirMedia = '/media'; $isWritable = true; if ($ftp) { $cwd=$ftpObj->getcwd(); @@ -92,7 +92,7 @@ final class Install extends \Magento\Connect\Command @mkdir($config->magento_root . $dirTmp,0777,true); @mkdir($config->magento_root . $dirMedia,0777,true); $isWritable = is_writable($config->magento_root) - && is_writable($config->magento_root . DIRECTORY_SEPARATOR . $config->downloader_path) + && is_writable($config->magento_root . '/' . $config->downloader_path) && is_writable($config->magento_root . $dirCache) && is_writable($config->magento_root . $dirTmp) && is_writable($config->magento_root . $dirMedia); @@ -307,7 +307,7 @@ final class Install extends \Magento\Connect\Command $this->ui()->output('Changed locally: '); foreach ($modifications as $row) { if (!$ftp) { - $this->ui()->output($config->magento_root . DS . $row); + $this->ui()->output($config->magento_root . '/' . $row); } else { $this->ui()->output($row); } @@ -317,8 +317,8 @@ final class Install extends \Magento\Connect\Command if ($ftp) { $cwd=$ftpObj->getcwd(); - $dir=$cwd . DIRECTORY_SEPARATOR .$config->downloader_path . DIRECTORY_SEPARATOR - . \Magento\Connect\Config::DEFAULT_CACHE_PATH . DIRECTORY_SEPARATOR . trim( $pChan, "\\/"); + $dir=$cwd . '/' .$config->downloader_path . '/' + . \Magento\Connect\Config::DEFAULT_CACHE_PATH . '/' . trim( $pChan, "\\/"); $ftpObj->mkdirRecursive($dir,0777); $ftpObj->chdir($cwd); } else { @@ -327,7 +327,7 @@ final class Install extends \Magento\Connect\Command } $dir = $config->getChannelCacheDir($pChan); $packageFileName = $pName . "-" . $pVer . ".tgz"; - $file = $dir . DIRECTORY_SEPARATOR . $packageFileName; + $file = $dir . '/' . $packageFileName; if (!@file_exists($file)) { $this->ui()->output("Starting to download $packageFileName ..."); $rest->downloadPackageFileOfRelease($pName, $pVer, $file); diff --git a/downloader/lib/Magento/Connect/Command/Registry.php b/downloader/lib/Magento/Connect/Command/Registry.php index adf6ad14315..396f8f05d0c 100644 --- a/downloader/lib/Magento/Connect/Command/Registry.php +++ b/downloader/lib/Magento/Connect/Command/Registry.php @@ -203,11 +203,11 @@ extends \Magento\Connect\Command $this->doSyncPear($command, $options, $params); } - $packageDir = $config->magento_root . DS . \Magento\Connect\Package::PACKAGE_XML_DIR; + $packageDir = $config->magento_root . '/' . \Magento\Connect\Package::PACKAGE_XML_DIR; if (is_dir($packageDir)) { $entries = scandir($packageDir); foreach ((array)$entries as $entry) { - $path = $packageDir. DS .$entry; + $path = $packageDir . '/' . $entry; $info = pathinfo($path); if ($entry == '.' || $entry == '..' || is_dir($path) || $info['extension'] != 'xml') { continue; @@ -269,13 +269,13 @@ extends \Magento\Connect\Command return $pkglist; } - $pearStorage = $config->magento_root . DS . $config->downloader_path . DS . self::PACKAGE_PEAR_DIR; + $pearStorage = $config->magento_root . '/' . $config->downloader_path . '/' . self::PACKAGE_PEAR_DIR; $channels = array( '.channel.connect.magentocommerce.com_community', '.channel.connect.magentocommerce.com_core' ); foreach ($channels as $channel) { - $channelDirectory = $pearStorage . DS . $channel; + $channelDirectory = $pearStorage . '/' . $channel; if (!file_exists($channelDirectory) || !is_dir($channelDirectory)) { continue; } @@ -296,7 +296,7 @@ extends \Magento\Connect\Command $package = new \Magento\Connect\Package(); foreach ($pkglist as $pkg) { - $pkgFilename = $pearStorage . DS . $pkg['channel'] . DS . $pkg['file']; + $pkgFilename = $pearStorage . '/' . $pkg['channel'] . '/' . $pkg['file']; if (!file_exists($pkgFilename)) { continue; } @@ -326,9 +326,9 @@ extends \Magento\Connect\Command $ftpObj->chdir($ftpDir); } } else { - $destDir = rtrim($config->magento_root, "\\/") . DS . \Magento\Connect\Package::PACKAGE_XML_DIR; + $destDir = rtrim($config->magento_root, "\\/") . '/' . \Magento\Connect\Package::PACKAGE_XML_DIR; $destFile = $package->getReleaseFilename() . '.xml'; - $dest = $destDir . DS . $destFile; + $dest = $destDir . '/' . $destFile; @mkdir($destDir, 0777, true); @file_put_contents($dest, $package->getPackageXml()); @@ -359,7 +359,7 @@ extends \Magento\Connect\Command * @return boolean */ protected function _checkPearData($config) { - $pearStorage = $config->magento_root . DS . $config->downloader_path . DS . self::PACKAGE_PEAR_DIR; + $pearStorage = $config->magento_root . '/' . $config->downloader_path . '/' . self::PACKAGE_PEAR_DIR; return (!$config->sync_pear) && file_exists($pearStorage) && is_dir($pearStorage); } diff --git a/downloader/lib/Magento/Connect/Command/Remote.php b/downloader/lib/Magento/Connect/Command/Remote.php index 92589528fe9..87721f11834 100644 --- a/downloader/lib/Magento/Connect/Command/Remote.php +++ b/downloader/lib/Magento/Connect/Command/Remote.php @@ -184,7 +184,7 @@ extends \Magento\Connect\Command } $version = $cache->detectVersionFromRestArray($c); $dir = $config->getChannelCacheDir($channel); - $file = $dir.DIRECTORY_SEPARATOR.$package."-".$version.".tgz"; + $file = $dir . '/' . $package."-".$version.".tgz"; $rest->downloadPackageFileOfRelease($package, $version, $file); if($ftp) { @unlink($config->getFilename()); diff --git a/downloader/lib/Magento/Connect/Config.php b/downloader/lib/Magento/Connect/Config.php index 313f0ce8d25..5906cba7f93 100644 --- a/downloader/lib/Magento/Connect/Config.php +++ b/downloader/lib/Magento/Connect/Config.php @@ -214,7 +214,7 @@ class Config implements \Iterator */ public function getDownloaderPath() { - return $this->magento_root . DIRECTORY_SEPARATOR . $this->downloader_path; + return $this->magento_root . '/' . $this->downloader_path; } /** @@ -224,7 +224,7 @@ class Config implements \Iterator */ public function getPackagesCacheDir() { - return $this->getDownloaderPath() . DIRECTORY_SEPARATOR . self::DEFAULT_CACHE_PATH; + return $this->getDownloaderPath() . '/' . self::DEFAULT_CACHE_PATH; } /** @@ -236,7 +236,7 @@ class Config implements \Iterator public function getChannelCacheDir($channel) { $channel = trim( $channel, "\\/"); - return $this->getPackagesCacheDir(). DIRECTORY_SEPARATOR . $channel; + return $this->getPackagesCacheDir(). '/' . $channel; } /** @@ -322,7 +322,7 @@ class Config implements \Iterator $data = serialize($this->toArray()); if (strlen($this->remote_config)>0) { //save config over ftp - $confFile = $this->downloader_path . DIRECTORY_SEPARATOR . "connect.cfg"; + $confFile = $this->downloader_path . '/' . "connect.cfg"; try { $ftpObj = new \Magento\Connect\Ftp(); $ftpObj->connect($this->remote_config); diff --git a/downloader/lib/Magento/Connect/Converter.php b/downloader/lib/Magento/Connect/Converter.php index b3e2c6eef52..fccf66c9c7d 100644 --- a/downloader/lib/Magento/Connect/Converter.php +++ b/downloader/lib/Magento/Connect/Converter.php @@ -256,7 +256,7 @@ final class Converter } $result = rtrim($result, "\\/"); - $packageXml = $result . DS . "package.xml"; + $packageXml = $result . '/package.xml'; if(!file_exists($packageXml)) { throw new \Exception("No package.xml found inside '{$sourceFile}'"); } @@ -275,7 +275,7 @@ final class Converter */ if(false === $destFile) { $pathinfo = pathinfo($sourceFile); - $destFile = $pathinfo['dirname'] . DS .$pathinfo['filename'].'-converted'; + $destFile = $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-converted'; if(isset($pathinfo['extension'])) { $destFile .= ".".$pathinfo['extension']; } @@ -286,7 +286,8 @@ final class Converter $mageObject->setTarget($target); $validRoles = array_keys($targets); $data = $pearObject->getFilelist(); - $pathSource = dirname($pearObject->getPackageFile()).DS.$pearObject->getName()."-".$pearObject->getVersion(); + $pathSource = dirname($pearObject->getPackageFile()) + . '/' . $pearObject->getName() . "-" . $pearObject->getVersion(); $filesToDo = array(); foreach($data as $file =>$row) { @@ -297,8 +298,8 @@ final class Converter } $baseName = ltrim($targets[$role], "\\/."); $baseName = rtrim($baseName, "\\/"); - $sourceFile = $pathSource.DS.$name; - $targetFile = $outDir . DS . $baseName . DS. $name; + $sourceFile = $pathSource . '/' . $name; + $targetFile = $outDir . '/' . $baseName . '/' . $name; if(file_exists($sourceFile)) { \Magento\System\Dirs::mkdirStrict(dirname($targetFile)); $copy = @copy($sourceFile, $targetFile); @@ -315,7 +316,7 @@ final class Converter } $mageObject->save(getcwd()); @chdir($cwd); - $filename = $outDir. DS . $mageObject->getReleaseFilename().".tgz"; + $filename = $outDir . '/' . $mageObject->getReleaseFilename() . ".tgz"; if(@file_exists($targetArchive)) { @unlink($targetArchive); } diff --git a/downloader/lib/Magento/Connect/Loader/Ftp.php b/downloader/lib/Magento/Connect/Loader/Ftp.php index 06df3fc5f9c..0972f2c3b15 100644 --- a/downloader/lib/Magento/Connect/Loader/Ftp.php +++ b/downloader/lib/Magento/Connect/Loader/Ftp.php @@ -104,12 +104,12 @@ class Ftp $uri = $this->_ftpUser.":".$this->_ftpPassword."@".$uri; $this->getFtp()->connect("ftp://".$uri); $this->getFtp()->pasv(true); - $tmpDir = self::TEMPORARY_DIR . DS; + $tmpDir = self::TEMPORARY_DIR . '/'; if (!is_dir($tmpDir)) { $tmpDir = sys_get_temp_dir(); } - if (substr($tmpDir, -1) != DS) { - $tmpDir .= DS; + if (substr($tmpDir, -1) != '/') { + $tmpDir .= '/'; } $localFile = $tmpDir . time() . ".xml"; diff --git a/downloader/lib/Magento/Connect/Package.php b/downloader/lib/Magento/Connect/Package.php index d17d65354a5..d0e8e6d9039 100644 --- a/downloader/lib/Magento/Connect/Package.php +++ b/downloader/lib/Magento/Connect/Package.php @@ -230,7 +230,7 @@ END; public function save($path) { $this->validate(); - $path = rtrim($path, "\\/") . DS; + $path = rtrim($path, "\\/") . '/'; $this->_savePackage($path); return $this; } @@ -493,7 +493,7 @@ END; $fileNode = $parent->addChild('file'); $fileNode->addAttribute('name', $fileName); $targetDir = $this->getTarget()->getTargetUri($targetName); - $hash = md5_file($targetDir.DS.$path); + $hash = md5_file($targetDir . '/' . $path); $fileNode->addAttribute('hash', $hash); } return $this; @@ -513,9 +513,9 @@ END; public function addContentDir($targetName, $path, $exclude=null, $include=null) { $targetDir = $this->getTarget()->getTargetUri($targetName); - $targetDirLen = strlen($targetDir . DS); + $targetDirLen = strlen($targetDir . '/'); //get all subdirectories and files. - $entries = @glob($targetDir. DS . $path . DS . "{,.}*", GLOB_BRACE); + $entries = @glob($targetDir . '/' . $path . '/' . "{,.}*", GLOB_BRACE); if (!empty($entries)) { foreach ($entries as $entry) { $filePath = substr($entry, $targetDirLen); @@ -903,7 +903,7 @@ END; $this->_contents[] = $path; } else { foreach($parent as $_content) { - $this->_getList($_content, ($path ? $path . DS : '') . $_content['name']); + $this->_getList($_content, ($path ? $path . '/' : '') . $_content['name']); } } } @@ -943,7 +943,7 @@ END; if (isset($_content['hash'])) { $contentHash = (string)$_content['hash']; } - $this->_getHashList($_content, ($path ? $path . DS : '') . $_content['name'], $contentHash); + $this->_getHashList($_content, ($path ? $path . '/' : '') . $_content['name'], $contentHash); } } } @@ -1297,7 +1297,7 @@ END; */ public function getRelaseDirFilename() { - return $this->getName() . DS . $this->getVersion() . DS . $this->getReleaseFilename(); + return $this->getName() . '/' . $this->getVersion() . '/' . $this->getReleaseFilename(); } /** diff --git a/downloader/lib/Magento/Connect/Package/Hotfix.php b/downloader/lib/Magento/Connect/Package/Hotfix.php index 56cbd346e94..ddb7dcc082f 100644 --- a/downloader/lib/Magento/Connect/Package/Hotfix.php +++ b/downloader/lib/Magento/Connect/Package/Hotfix.php @@ -111,7 +111,7 @@ END; { $targetDirLen = strlen($targetDir); //get all subdirectories and files. - $entries = @glob($targetDir.$path.DS."*"); + $entries = @glob($targetDir . $path . '/' . "*"); if (!empty($entries)) { foreach ($entries as $entry) { $filePath = substr($entry, $targetDirLen); diff --git a/downloader/lib/Magento/Connect/Package/Writer.php b/downloader/lib/Magento/Connect/Package/Writer.php index 0c6502ee895..ce9afe99fe1 100644 --- a/downloader/lib/Magento/Connect/Package/Writer.php +++ b/downloader/lib/Magento/Connect/Package/Writer.php @@ -125,11 +125,11 @@ class Writer if (is_dir($file) || is_file($file)) { $fileName = basename($file); $filePath = dirname($file); - @mkdir($root . DS . $filePath, 0777, true); + @mkdir($root . '/' . $filePath, 0777, true); if (is_file($file)) { - copy($file, $root . DS . $filePath . DS . $fileName); + copy($file, $root . '/' . $filePath . '/' . $fileName); } else { - @mkdir($root . DS . $filePath . $fileName, 0777); + @mkdir($root . '/' . $filePath . $fileName, 0777); } } } @@ -145,7 +145,7 @@ class Writer */ public function addPackageXml($content) { - file_put_contents($this->_temporaryPackageDir . DS . self::DEFAULT_NAME_PACKAGE_CONFIG, $content); + file_put_contents($this->_temporaryPackageDir . '/' . self::DEFAULT_NAME_PACKAGE_CONFIG, $content); return $this; } diff --git a/downloader/lib/Magento/Connect/Packager.php b/downloader/lib/Magento/Connect/Packager.php index 62d0386201f..503532e2f7b 100644 --- a/downloader/lib/Magento/Connect/Packager.php +++ b/downloader/lib/Magento/Connect/Packager.php @@ -266,16 +266,16 @@ class Packager foreach ($contents as $file) { $fileName = basename($file); $filePath = dirname($file); - $dest = $targetPath . DIRECTORY_SEPARATOR . $filePath . DIRECTORY_SEPARATOR . $fileName; + $dest = $targetPath . '/' . $filePath . '/' . $fileName; if(@file_exists($dest)) { @unlink($dest); $this->removeEmptyDirectory(dirname($dest)); } } - $destDir = $targetPath . DS . \Magento\Connect\Package::PACKAGE_XML_DIR; + $destDir = $targetPath . '/' . \Magento\Connect\Package::PACKAGE_XML_DIR; $destFile = $package->getReleaseFilename() . '.xml'; - @unlink($destDir . DS . $destFile); + @unlink($destDir . '/' . $destFile); } /** @@ -296,7 +296,7 @@ class Packager $ftp->delete($file); $this->removeEmptyDirectory(dirname($file), $ftp); } - $remoteXml = \Magento\Connect\Package::PACKAGE_XML_DIR . DS . $package->getReleaseFilename() . '.xml'; + $remoteXml = \Magento\Connect\Package::PACKAGE_XML_DIR . '/' . $package->getReleaseFilename() . '.xml'; $ftp->delete($remoteXml); $ftp->chdir($ftpDir); } @@ -371,13 +371,13 @@ class Packager $ftpDir = $ftp->getcwd(); $contents = $package->getContents(); $arc = $this->getArchiver(); - $target = dirname($file) . DS . $package->getReleaseFilename(); + $target = dirname($file) . '/' . $package->getReleaseFilename(); @mkdir($target, 0777, true); $tar = $arc->unpack($file, $target); $modeFile = $this->_getFileMode($configObj); $modeDir = $this->_getDirMode($configObj); foreach ($contents as $file) { - $source = $tar . DS . $file; + $source = $tar . '/' . $file; if (file_exists($source) && is_file($source)) { $args = array(ltrim($file,"/"), $source); if($modeDir||$modeFile) { @@ -390,7 +390,7 @@ class Packager $localXml = $tar . \Magento\Connect\Package\Reader::DEFAULT_NAME_PACKAGE; if (is_file($localXml)) { - $remoteXml = \Magento\Connect\Package::PACKAGE_XML_DIR . DS . $package->getReleaseFilename() . '.xml'; + $remoteXml = \Magento\Connect\Package::PACKAGE_XML_DIR . '/' . $package->getReleaseFilename() . '.xml'; $ftp->upload($remoteXml, $localXml, $modeDir, $modeFile); } @@ -410,7 +410,7 @@ class Packager { $contents = $package->getContents(); $arc = $this->getArchiver(); - $target = dirname($file) . DS . $package->getReleaseFilename(); + $target = dirname($file) . '/' . $package->getReleaseFilename(); @mkdir($target, 0777, true); $tar = $arc->unpack($file, $target); $modeFile = $this->_getFileMode($configObj); @@ -419,9 +419,9 @@ class Packager foreach ($contents as $file) { $fileName = basename($file); $filePath = dirname($file); - $source = $tar . DS . $file; - @mkdir($targetPath. DS . $filePath, $modeDir, true); - $dest = $targetPath . DS . $filePath . DS . $fileName; + $source = $tar . '/' . $file; + @mkdir($targetPath . '/' . $filePath, $modeDir, true); + $dest = $targetPath . '/' . $filePath . '/' . $fileName; if (is_file($source)) { @copy($source, $dest); if($modeFile) { @@ -434,9 +434,9 @@ class Packager $packageXml = $tar . \Magento\Connect\Package\Reader::DEFAULT_NAME_PACKAGE; if (is_file($packageXml)) { - $destDir = $targetPath . DS . \Magento\Connect\Package::PACKAGE_XML_DIR; + $destDir = $targetPath . '/' . \Magento\Connect\Package::PACKAGE_XML_DIR; $destFile = $package->getReleaseFilename() . '.xml'; - $dest = $destDir . DS . $destFile; + $dest = $destDir . '/' . $destFile; @copy($packageXml, $dest); @chmod($dest, $modeFile); @@ -460,7 +460,7 @@ class Packager $hashContents = $p->getHashContents(); $listModified = array(); foreach ($hashContents as $file=>$hash) { - if (md5_file($configObj->magento_root . DS . $file)!==$hash) { + if (md5_file($configObj->magento_root . '/' . $file)!==$hash) { $listModified[] = $file; } } diff --git a/downloader/lib/Magento/Connect/Validator.php b/downloader/lib/Magento/Connect/Validator.php index ee1952af2a5..112bc323ee7 100644 --- a/downloader/lib/Magento/Connect/Validator.php +++ b/downloader/lib/Magento/Connect/Validator.php @@ -472,7 +472,7 @@ class Validator $targetPath = rtrim($config->magento_root, "\\/"); foreach ($contents as $file) { - $dest = $targetPath . DS . $file; + $dest = $targetPath . '/' . $file; if (file_exists($dest)) { $this->addError("'{$file}' already exists"); return false; diff --git a/downloader/lib/Magento/HTTP/Client.php b/downloader/lib/Magento/HTTP/Client.php index 645c0b5f98a..61f110cc61a 100644 --- a/downloader/lib/Magento/HTTP/Client.php +++ b/downloader/lib/Magento/HTTP/Client.php @@ -60,7 +60,7 @@ class Client throw new \Exception("Cannot find frontend automatically, set it manually"); } - $class = __CLASS__ . "_" . str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $frontend))); + $class = __CLASS__ . "_" . str_replace(' ', '/', ucwords(str_replace('_', ' ', $frontend))); $obj = new $class(); return $obj; } diff --git a/downloader/lib/Magento/System/Dirs.php b/downloader/lib/Magento/System/Dirs.php index 7212dd69945..d2903b3f797 100644 --- a/downloader/lib/Magento/System/Dirs.php +++ b/downloader/lib/Magento/System/Dirs.php @@ -66,7 +66,7 @@ class Dirs continue; } // Unlink files and add directories to stack - $child = $entry . DIRECTORY_SEPARATOR . $child; + $child = $entry . '/' . $child; if (is_dir($child) && !is_link($child)) { $stack[] = $child; } else { diff --git a/downloader/mage.php b/downloader/mage.php index 930d38553d6..4bfb8a88534 100644 --- a/downloader/mage.php +++ b/downloader/mage.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -define('DS', DIRECTORY_SEPARATOR); define('PS', PATH_SEPARATOR); define('BP', dirname(__DIR__)); define('MAGENTO_ROOT', dirname(__DIR__)); @@ -47,18 +46,18 @@ class __cli_Magento_Connect $this->setIncludes(); require_once("Mage/Autoload/Simple.php"); \Magento\Autoload\Simple::register(); - chdir(BP . DS . 'downloader' . DS); + chdir(BP . '/downloader/'); return $this; } public function setIncludes() { if (defined('DEVELOPMENT_MODE')) { - $libPath = PS . dirname(BP) . DS . 'lib'; + $libPath = PS . dirname(BP) . '/lib'; } else { - $libPath = PS . BP . DS . 'downloader' . DS . 'lib'; + $libPath = PS . BP . '/downloader/lib'; } - $includePath = BP . DS . 'app' + $includePath = BP . '/app' . $libPath . PS . get_include_path(); set_include_path($includePath); @@ -124,8 +123,8 @@ class __cli_Magento_Connect { if(!$this->_sconfig) { $this->_sconfig = new \Magento\Connect\Singleconfig( - $this->getConfig()->magento_root . DS . - $this->getConfig()->downloader_path . DS . + $this->getConfig()->magento_root . '/' . + $this->getConfig()->downloader_path . '/' . \Magento\Connect\Singleconfig::DEFAULT_SCONFIG_FILENAME ); } diff --git a/index.php b/index.php index 0bedba34c92..705cc35d047 100644 --- a/index.php +++ b/index.php @@ -38,4 +38,4 @@ require __DIR__ . '/app/bootstrap.php'; $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $_SERVER); $result = $entryPoint->run('Magento\App\Http'); \Magento\Profiler::stop('magento'); -return $result; \ No newline at end of file +return $result; diff --git a/lib/Magento/App/Action/Action.php b/lib/Magento/App/Action/Action.php index 223d3aed31f..4fcc5c4d10d 100644 --- a/lib/Magento/App/Action/Action.php +++ b/lib/Magento/App/Action/Action.php @@ -26,6 +26,7 @@ namespace Magento\App\Action; use Magento\App\RequestInterface; +use Magento\App\ResponseInterface; class Action extends \Magento\App\Action\AbstractAction { @@ -74,6 +75,11 @@ class Action extends \Magento\App\Action\AbstractAction */ protected $_url; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param Context $context */ @@ -86,11 +92,14 @@ class Action extends \Magento\App\Action\AbstractAction $this->_actionFlag = $context->getActionFlag(); $this->_redirect = $context->getRedirect(); $this->_view = $context->getView(); + $this->messageManager = $context->getMessageManager(); } /** + * Dispatch request + * * @param RequestInterface $request - * @return mixed + * @return ResponseInterface * @throws NotFoundException */ public function dispatch(RequestInterface $request) @@ -125,6 +134,7 @@ class Action extends \Magento\App\Action\AbstractAction \Magento\Profiler::stop('action_body'); } \Magento\Profiler::stop($profilerKey); + return $this->_response; } /** @@ -163,11 +173,11 @@ class Action extends \Magento\App\Action\AbstractAction * * @param string $path * @param array $arguments - * @return \Magento\App\ActionInterface + * @return \Magento\App\ResponseInterface */ protected function _redirect($path, $arguments = array()) { $this->_redirect->redirect($this->getResponse(), $path, $arguments); - return $this; + return $this->getResponse(); } } diff --git a/lib/Magento/App/Action/Context.php b/lib/Magento/App/Action/Context.php index 4a5e065d015..f179a5dcf93 100644 --- a/lib/Magento/App/Action/Context.php +++ b/lib/Magento/App/Action/Context.php @@ -65,6 +65,11 @@ class Context implements \Magento\ObjectManager\ContextInterface */ protected $_view; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\App\RequestInterface $request * @param \Magento\App\ResponseInterface $response @@ -74,6 +79,7 @@ class Context implements \Magento\ObjectManager\ContextInterface * @param \Magento\App\Response\RedirectInterface $redirect * @param \Magento\App\ActionFlag $actionFlag * @param \Magento\App\ViewInterface $view + * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( \Magento\App\RequestInterface $request, @@ -83,7 +89,8 @@ class Context implements \Magento\ObjectManager\ContextInterface \Magento\UrlInterface $url, \Magento\App\Response\RedirectInterface $redirect, \Magento\App\ActionFlag $actionFlag, - \Magento\App\ViewInterface $view + \Magento\App\ViewInterface $view, + \Magento\Message\ManagerInterface $messageManager ) { $this->_request = $request; $this->_response = $response; @@ -93,6 +100,7 @@ class Context implements \Magento\ObjectManager\ContextInterface $this->_redirect = $redirect; $this->_actionFlag = $actionFlag; $this->_view = $view; + $this->messageManager = $messageManager; } /** @@ -158,4 +166,12 @@ class Context implements \Magento\ObjectManager\ContextInterface { return $this->_url; } + + /** + * @return \Magento\Message\ManagerInterface + */ + public function getMessageManager() + { + return $this->messageManager; + } } diff --git a/lib/Magento/App/Action/Forward.php b/lib/Magento/App/Action/Forward.php index 84e9961dedb..4e02aed3154 100644 --- a/lib/Magento/App/Action/Forward.php +++ b/lib/Magento/App/Action/Forward.php @@ -31,11 +31,12 @@ class Forward extends AbstractAction { /** * @param RequestInterface $request - * @return mixed|void + * @return \Magento\App\ResponseInterface|mixed * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function dispatch(RequestInterface $request) { $request->setDispatched(false); + return $this->_response; } } diff --git a/lib/Magento/App/Action/Redirect.php b/lib/Magento/App/Action/Redirect.php index c62b2df69b3..51a16ccf6ea 100644 --- a/lib/Magento/App/Action/Redirect.php +++ b/lib/Magento/App/Action/Redirect.php @@ -30,11 +30,14 @@ use \Magento\App\RequestInterface; class Redirect extends AbstractAction { /** + * Redirect response + * * @param RequestInterface $request - * @return mixed|void + * @return \Magento\App\ResponseInterface|mixed * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function dispatch(RequestInterface $request) { + return $this->_response; } } diff --git a/lib/Magento/App/ActionInterface.php b/lib/Magento/App/ActionInterface.php index f4d93567282..fdd31388a97 100644 --- a/lib/Magento/App/ActionInterface.php +++ b/lib/Magento/App/ActionInterface.php @@ -28,8 +28,10 @@ namespace Magento\App; interface ActionInterface { /** + * Dispatch request + * * @param RequestInterface $request - * @return mixed + * @return ResponseInterface */ public function dispatch(RequestInterface $request); } diff --git a/lib/Magento/App/Cache/Frontend/Factory.php b/lib/Magento/App/Cache/Frontend/Factory.php index f580e8cdbba..b0b7c520c00 100644 --- a/lib/Magento/App/Cache/Frontend/Factory.php +++ b/lib/Magento/App/Cache/Frontend/Factory.php @@ -46,11 +46,6 @@ class Factory */ private $_filesystem; - /** - * @var \Magento\App\Dir - */ - private $_dirs; - /** * Cache options to be enforced for all instances being created * @@ -97,7 +92,6 @@ class Factory /** * @param \Magento\ObjectManager $objectManager * @param \Magento\Filesystem $filesystem - * @param \Magento\App\Dir $dirs * @param \Magento\App\Resource $resource * @param array $enforcedOptions * @param array $decorators @@ -105,14 +99,12 @@ class Factory public function __construct( \Magento\ObjectManager $objectManager, \Magento\Filesystem $filesystem, - \Magento\App\Dir $dirs, \Magento\App\Resource $resource, array $enforcedOptions = array(), array $decorators = array() ) { $this->_objectManager = $objectManager; $this->_filesystem = $filesystem; - $this->_dirs = $dirs; $this->_resource = $resource; $this->_enforcedOptions = $enforcedOptions; $this->_decorators = $decorators; @@ -130,21 +122,20 @@ class Factory foreach (array('backend_options', 'slow_backend_options') as $section) { if (!empty($options[$section]['cache_dir'])) { - $dir = $this->_dirs->getDir(\Magento\App\Dir::VAR_DIR) . DS . $options[$section]['cache_dir']; - $this->_filesystem->setIsAllowCreateDirectories(true); - $this->_filesystem->ensureDirectoryExists($dir, 0777); - $options[$section]['cache_dir'] = $dir; + $directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $directory->create($options[$section]['cache_dir']); + $options[$section]['cache_dir'] = $directory->getAbsolutePath($options[$section]['cache_dir']); } } - $this->_backendOptions['cache_dir'] = $this->_dirs->getDir(\Magento\App\Dir::CACHE); + $this->_backendOptions['cache_dir'] = $this->_filesystem->getPath(\Magento\Filesystem::CACHE); $idPrefix = isset($options['id_prefix']) ? $options['id_prefix'] : ''; if (!$idPrefix && isset($options['prefix'])) { $idPrefix = $options['prefix']; } if (empty($idPrefix)) { - $idPrefix = substr(md5($this->_dirs->getDir(\Magento\App\Dir::CONFIG)), 0, 3) . '_'; + $idPrefix = substr(md5($this->_filesystem->getPath(\Magento\Filesystem::CONFIG)), 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 37c7a6ca471..1c8d7520ed8 100644 --- a/lib/Magento/App/Config/FileResolver/Primary.php +++ b/lib/Magento/App/Config/FileResolver/Primary.php @@ -28,37 +28,44 @@ namespace Magento\App\Config\FileResolver; /*** * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ + class Primary implements \Magento\Config\FileResolverInterface { /** - * @var \Magento\App\Dir + * Module configuration file reader + * + * @var \Magento\Module\Dir\Reader */ - protected $_applicationDirs; + protected $_moduleReader; /** - * @param \Magento\App\Dir $dirs + * @var \Magento\Filesystem\Directory\ReadInterface */ - public function __construct(\Magento\App\Dir $dirs) - { - $this->_applicationDirs = $dirs; - } + protected $configDirectory; /** - * Retrieve the list of configuration files with given name that relate to specified scope - * - * @param string $filename - * @param string $scope - * @return array - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @var FileIteratorFactory + */ + protected $iteratorFactory; + + /** + * @param \Magento\Filesystem $filesystem + * @param \Magento\Config\FileIteratorFactory $iteratorFactory + */ + public function __construct( + \Magento\Filesystem $filesystem, + \Magento\Config\FileIteratorFactory $iteratorFactory + ) { + $this->configDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::CONFIG); + $this->iteratorFactory = $iteratorFactory; + } + /** + * @inheritdoc */ public function get($filename, $scope) { - $configDir = $this->_applicationDirs->getDir(\Magento\App\Dir::CONFIG); - $fileList = glob($configDir . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . $filename); - - if (file_exists($configDir . DIRECTORY_SEPARATOR . $filename)) { - array_unshift($fileList, $configDir . DIRECTORY_SEPARATOR . $filename); - } - return $fileList; + return $this->iteratorFactory->create( + $this->configDirectory, $this->configDirectory->search('#' . preg_quote($filename) . '$#') + ); } } diff --git a/lib/Magento/App/Config/Loader.php b/lib/Magento/App/Config/Loader.php index f0e830c767b..4c2b134afcd 100644 --- a/lib/Magento/App/Config/Loader.php +++ b/lib/Magento/App/Config/Loader.php @@ -25,8 +25,6 @@ */ namespace Magento\App\Config; -use \Magento\App\Dir; - class Loader { /** @@ -44,7 +42,7 @@ class Loader * * @var string */ - protected $_dirs; + protected $_dir; /** * Custom config file @@ -61,12 +59,12 @@ class Loader protected $_idAttributes = array('/config/resource' => 'name', '/config/connection' => 'name'); /** - * @param Dir $dirs + * @param \Magento\Filesystem\DirectoryList $dirList * @param string $customFile */ - public function __construct(Dir $dirs, $customFile = null) + public function __construct(\Magento\Filesystem\DirectoryList $dirList, $customFile = null) { - $this->_dir = $dirs->getDir(Dir::CONFIG); + $this->_dir = $dirList->getDir(\Magento\Filesystem::CONFIG); $this->_customFile = $customFile; } @@ -79,14 +77,14 @@ class Loader { $localConfig = new \Magento\Config\Dom('<config/>', $this->_idAttributes); - $localConfigFile = $this->_dir . DIRECTORY_SEPARATOR . self::LOCAL_CONFIG_FILE; + $localConfigFile = $this->_dir . '/' . self::LOCAL_CONFIG_FILE; if (file_exists($localConfigFile)) { // 1. app/etc/local.xml $localConfig->merge(file_get_contents($localConfigFile)); // 2. app/etc/<dir>/<file>.xml if (preg_match('/^[a-z\d_-]+(\/|\\\)+[a-z\d_-]+\.xml$/', $this->_customFile)) { - $localConfigExtraFile = $this->_dir . DIRECTORY_SEPARATOR . $this->_customFile; + $localConfigExtraFile = $this->_dir . '/' . $this->_customFile; $localConfig->merge(file_get_contents($localConfigExtraFile)); } } diff --git a/lib/Magento/App/Dir.php b/lib/Magento/App/Dir.php deleted file mode 100644 index 3e68f380adc..00000000000 --- a/lib/Magento/App/Dir.php +++ /dev/null @@ -1,339 +0,0 @@ -<?php -/** - * Application file system directories dictionary - * - * Provides information about what directories are available in the application - * Serves as customization point to specify different directories or add own - * - * 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) 2013 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 Dir -{ - /** - * Custom application dirs - */ - const PARAM_APP_DIRS = 'app_dirs'; - - /** - * Custom application uris - */ - const PARAM_APP_URIS = 'app_uris'; - - /** - * 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'; - - /** - * Default values for directories (and URIs) - * - * Format: array(<code> => <relative_path>) - * - * @var array - */ - private static $_defaults = array( - self::ROOT => '', - self::APP => 'app', - self::MODULES => 'app/code', - self::THEMES => 'app/design', - self::CONFIG => 'app/etc', - self::LIB => 'lib', - self::VAR_DIR => 'var', - self::TMP => 'var/tmp', - self::CACHE => 'var/cache', - self::LOG => 'var/log', - self::SESSION => 'var/session', - self::DI => 'var/di', - self::GENERATION => 'var/generation', - self::PUB => 'pub', - self::PUB_LIB => 'pub/lib', - self::MEDIA => 'pub/media', - self::UPLOAD => 'pub/media/upload', - self::STATIC_VIEW => 'pub/static', - self::PUB_VIEW_CACHE => 'pub/cache', - ); - - /** - * Paths of URIs designed for building URLs - * - * Values are to be initialized in constructor. - * They are declared like this here for convenience of distinguishing which directories are intended to be URIs. - * - * @var array - */ - private $_uris = array( - self::PUB => '', - self::PUB_LIB => '', - self::MEDIA => '', - self::STATIC_VIEW => '', - self::PUB_VIEW_CACHE => '', - self::UPLOAD => '', - ); - - /** - * Absolute paths to directories - * - * @var array - */ - private $_dirs = array(); - - /** - * Initialize URIs and paths - * - * @param string $baseDir - * @param array $uris custom URIs - * @param array $dirs custom directories (full system paths) - */ - public function __construct($baseDir, array $uris = array(), array $dirs = array()) - { - // uris - foreach (array_keys($this->_uris) as $code) { - $this->_uris[$code] = self::$_defaults[$code]; - } - foreach ($uris as $code => $uri) { - $this->_setUri($code, $uri); - } - foreach ($this->_getDefaultReplacements($uris) as $code => $replacement) { - $this->_setUri($code, $replacement); - } - - // dirs - foreach (self::$_defaults as $code => $path) { - $this->_setDir($code, $baseDir . ($path ? DIRECTORY_SEPARATOR . $path : '')); - } - foreach ($dirs as $code => $path) { - $this->_setDir($code, $path); - } - foreach ($this->_getDefaultReplacements($dirs) as $code => $replacement) { - $this->_setDir($code, $replacement); - } - } - - /** - * URI getter - * - * @param string $code - * @return string|bool - */ - public function getUri($code) - { - return isset($this->_uris[$code]) ? $this->_uris[$code] : false; - } - - /** - * Set URI - * - * The method is private on purpose: it must be used only in constructor. Users of this object must not be able - * to alter its state, otherwise it may compromise application integrity. - * Path must be usable as a fragment of a URL path. - * For interoperability and security purposes, no uppercase or "upper directory" paths like "." or ".." - * - * @param $code - * @param $uri - * @throws \InvalidArgumentException - */ - private function _setUri($code, $uri) - { - if (!preg_match('/^([a-z0-9_]+[a-z0-9\._]*(\/[a-z0-9_]+[a-z0-9\._]*)*)?$/', $uri)) { - throw new \InvalidArgumentException( - "Must be relative directory path in lowercase with '/' directory separator: '{$uri}'" - ); - } - $this->_uris[$code] = $uri; - } - - /** - * \Directory path getter - * - * @param string $code One of self const - * @return string|bool - */ - public function getDir($code = self::ROOT) - { - return isset($this->_dirs[$code]) ? $this->_dirs[$code] : false; - } - - /** - * Set directory - * - * @param string $code - * @param string $path - */ - private function _setDir($code, $path) - { - $this->_dirs[$code] = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $path); - } - - /** - * Using default relations, find replacements for child directories if their parent has changed - * - * For example, "var" has children "var/tmp" and "var/cache". If "var" is customized as "var.test", and its children - * are not, then they will be automatically replaced to "var.test/tmp" and "var.test/cache" - * - * @param array $source - * @return array - */ - private function _getDefaultReplacements(array $source) - { - $result = array(); - foreach ($source as $parentCode => $parent) { - foreach ($this->_getChildren($parentCode) as $childCode) { - if (!isset($source[$childCode])) { - if (empty(self::$_defaults[$parentCode])) { - $fragment = self::$_defaults[$childCode]; - } else { - $fragment = str_replace(self::$_defaults[$parentCode], '', self::$_defaults[$childCode]); - } - $fragment = ltrim($fragment, '/'); - if (!empty($parent)) { - $fragment = '/' . $fragment; - } - $result[$childCode] = $parent . $fragment; - } - } - } - return $result; - } - - /** - * Analyze defaults and determine child codes of specified element - * - * @param string $code - * @return array - */ - private function _getChildren($code) - { - $result = array(); - if (!isset(self::$_defaults[$code])) { - return $result; - } - $parent = self::$_defaults[$code]; - foreach (self::$_defaults as $childCode => $child) { - if ($code != $childCode) { - if ($parent && $child && 0 === strpos($child, $parent)) { - $result[] = $childCode; - } elseif (empty($parent)) { - $result[] = $childCode; - } - } - } - return $result; - } -} diff --git a/lib/Magento/App/Error/Handler.php b/lib/Magento/App/Error/Handler.php index b59e9000010..d8aa0e1a963 100644 --- a/lib/Magento/App/Error/Handler.php +++ b/lib/Magento/App/Error/Handler.php @@ -35,9 +35,9 @@ class Handler extends \Magento\Error\Handler protected $_logger; /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_dir; + protected $_filesystem; /** * @var \Magento\App\State @@ -46,16 +46,16 @@ class Handler extends \Magento\Error\Handler /** * @param \Magento\Logger $logger - * @param \Magento\App\Dir $dir + * @param \Magento\Filesystem $filesystem * @param \Magento\App\State $appState */ public function __construct( \Magento\Logger $logger, - \Magento\App\Dir $dir, + \Magento\Filesystem $filesystem, \Magento\App\State $appState ) { $this->_logger = $logger; - $this->_dir = $dir; + $this->_filesystem = $filesystem; $this->_appState = $appState; } @@ -80,7 +80,7 @@ class Handler extends \Magento\Error\Handler $reportData['script_name'] = $_SERVER['SCRIPT_NAME']; } } - require_once($this->_dir->getDir(\Magento\App\Dir::PUB) . DS . 'errors' . DS . 'report.php'); + require_once($this->_filesystem->getPath(\Magento\Filesystem::PUB) . '/errors/report.php'); } } diff --git a/lib/Magento/App/FrontController.php b/lib/Magento/App/FrontController.php index d2ad0effdaf..dc5c5a8eeb6 100644 --- a/lib/Magento/App/FrontController.php +++ b/lib/Magento/App/FrontController.php @@ -33,18 +33,11 @@ class FrontController implements FrontControllerInterface protected $_routerList; /** - * @var \Magento\App\ResponseInterface - */ - protected $_response; - - /** - * @param \Magento\App\ResponseInterface $response * @param RouterList $routerList */ - public function __construct(ResponseInterface $response, RouterList $routerList) + public function __construct(RouterList $routerList) { $this->_routerList = $routerList; - $this->_response = $response; } /** @@ -58,13 +51,14 @@ class FrontController implements FrontControllerInterface { \Magento\Profiler::start('routers_match'); $routingCycleCounter = 0; + $response = null; while (!$request->isDispatched() && $routingCycleCounter++ < 100) { foreach ($this->_routerList as $router) { try { $actionInstance = $router->match($request); if ($actionInstance) { $request->setDispatched(true); - $actionInstance->dispatch($request); + $response = $actionInstance->dispatch($request); break; } } catch (Action\NotFoundException $e) { @@ -79,6 +73,6 @@ class FrontController implements FrontControllerInterface if ($routingCycleCounter > 100) { throw new \LogicException('Front controller reached 100 router match iterations'); } - return $this->_response; + return $response; } } diff --git a/lib/Magento/App/Http.php b/lib/Magento/App/Http.php index 62574c60d20..421eee7cebc 100644 --- a/lib/Magento/App/Http.php +++ b/lib/Magento/App/Http.php @@ -25,9 +25,9 @@ */ namespace Magento\App; -use \Magento\Config\Scope, - \Magento\App\ObjectManager\ConfigLoader, - \Magento\Event; +use Magento\Config\Scope, + Magento\App\ObjectManager\ConfigLoader, + Magento\Event; class Http implements \Magento\AppInterface { @@ -67,9 +67,9 @@ class Http implements \Magento\AppInterface protected $_state; /** - * @var Dir + * @var \Magento\Filesystem */ - protected $_dir; + protected $_filesystem; /** * @param \Magento\ObjectManager $objectManager @@ -79,7 +79,7 @@ class Http implements \Magento\AppInterface * @param Scope $configScope * @param ConfigLoader $configLoader * @param State $state - * @param Dir $dir + * @param \Magento\Filesystem $filesystem */ public function __construct( \Magento\ObjectManager $objectManager, @@ -89,7 +89,7 @@ class Http implements \Magento\AppInterface Scope $configScope, ConfigLoader $configLoader, State $state, - Dir $dir + \Magento\Filesystem $filesystem ) { $this->_objectManager = $objectManager; $this->_eventManager = $eventManager; @@ -98,7 +98,7 @@ class Http implements \Magento\AppInterface $this->_configScope = $configScope; $this->_configLoader = $configLoader; $this->_state = $state; - $this->_dir = $dir; + $this->_filesystem = $filesystem; } /** @@ -139,7 +139,7 @@ class Http implements \Magento\AppInterface $reportData['script_name'] = $_SERVER['SCRIPT_NAME']; } } - require_once ($this->_dir->getDir(Dir::PUB) . DS . 'errors' . DS . 'report.php'); + require_once ($this->_filesystem->getPath(\Magento\Filesystem::PUB) . '/errors/report.php'); } } catch (\Exception $exception) { $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP 1.1'; diff --git a/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php b/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php index 253b364fd38..503f1d890be 100644 --- a/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php +++ b/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php @@ -35,17 +35,19 @@ class Primary protected $_appMode; /** - * @var \Magento\App\Dir + * @var string */ - protected $_dirs; + protected $_configDirectoryPath; /** - * @param \Magento\App\Dir $dirs + * @param string $configDirectoryPath * @param string $appMode */ - public function __construct(\Magento\App\Dir $dirs, $appMode = \Magento\App\State::MODE_DEFAULT) - { - $this->_dirs = $dirs; + public function __construct( + $configDirectoryPath, + $appMode = \Magento\App\State::MODE_DEFAULT + ) { + $this->_configDirectoryPath = $configDirectoryPath; $this->_appMode = $appMode; } @@ -57,7 +59,14 @@ class Primary public function load() { $reader = new \Magento\ObjectManager\Config\Reader\Dom( - new \Magento\App\Config\FileResolver\Primary($this->_dirs), + new \Magento\App\Config\FileResolver\Primary( + new \Magento\Filesystem( + new \Magento\Filesystem\DirectoryList($this->_configDirectoryPath), + new \Magento\Filesystem\Directory\ReadFactory(), + new \Magento\Filesystem\Directory\WriteFactory() + ), + new \Magento\Config\FileIteratorFactory() + ), new \Magento\ObjectManager\Config\Mapper\Dom(), new \Magento\ObjectManager\Config\SchemaLocator(), new \Magento\App\Config\ValidationState($this->_appMode) diff --git a/lib/Magento/App/ObjectManagerFactory.php b/lib/Magento/App/ObjectManagerFactory.php index f8173c767d5..9f8b89a4690 100644 --- a/lib/Magento/App/ObjectManagerFactory.php +++ b/lib/Magento/App/ObjectManagerFactory.php @@ -26,10 +26,9 @@ namespace Magento\App; -use Magento\App\Dir, - Magento\App\Config, - Magento\ObjectManager\Factory\Factory, - Magento\Profiler; +use Magento\App\Config, + Magento\Profiler, + Magento\Filesystem; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -65,13 +64,14 @@ class ObjectManagerFactory */ public function create($rootDir, array $arguments) { - $directories = new Dir( + $directories = new \Magento\Filesystem\DirectoryList( $rootDir, - isset($arguments[Dir::PARAM_APP_URIS]) ? $arguments[Dir::PARAM_APP_URIS] : array(), - isset($arguments[Dir::PARAM_APP_DIRS]) ? $arguments[Dir::PARAM_APP_DIRS] : array() + isset($arguments[\Magento\Filesystem::PARAM_APP_DIRS]) + ? $arguments[\Magento\Filesystem::PARAM_APP_DIRS] + : array() ); - \Magento\Autoload\IncludePath::addIncludePath(array($directories->getDir(Dir::GENERATION))); + \Magento\Autoload\IncludePath::addIncludePath(array($directories->getDir(\Magento\Filesystem::GENERATION))); $options = new Config( $arguments, @@ -84,8 +84,9 @@ class ObjectManagerFactory ); $definitionFactory = new \Magento\ObjectManager\DefinitionFactory( - $directories->getDir(DIR::DI), - $directories->getDir(DIR::GENERATION), + new \Magento\Filesystem\Driver\File(), + $directories->getDir(\Magento\Filesystem::DI), + $directories->getDir(\Magento\Filesystem::GENERATION), $options->get('definition.format', 'serialized') ); @@ -96,25 +97,25 @@ class ObjectManagerFactory $diConfig = new $configClass($relations, $definitions); $appMode = $options->get(State::PARAM_MODE, State::MODE_DEFAULT); - $configData = $this->_loadPrimaryConfig($directories, $appMode); + $configData = $this->_loadPrimaryConfig($directories->getDir(\Magento\Filesystem::ROOT), $appMode); if ($configData) { $diConfig->extend($configData); } - $factory = new Factory($diConfig, null, $definitions, $options->get()); + $factory = new \Magento\ObjectManager\Factory\Factory($diConfig, null, $definitions, $options->get()); $className = $this->_locatorClassName; /** @var \Magento\ObjectManager $locator */ $locator = new $className($factory, $diConfig, array( 'Magento\App\Config' => $options, - 'Magento\App\Dir' => $directories + 'Magento\Filesystem\DirectoryList' => $directories )); - \Magento\App\ObjectManager::setInstance($locator); + \Magento\App\ObjectManager::setInstance($locator); - /** @var \Magento\App\Dir\Verification $verification */ - $verification = $locator->get('Magento\App\Dir\Verification'); + /** @var \Magento\Filesystem\DirectoryList\Verification $verification */ + $verification = $locator->get('Magento\Filesystem\DirectoryList\Verification'); $verification->createAndVerifyDirectories(); $diConfig->setCache($locator->get('Magento\App\ObjectManager\ConfigCache')); @@ -142,21 +143,25 @@ class ObjectManagerFactory 'pluginList' => $pluginList )); $locator->setFactory($factory); + + $directoryListConfig = $locator->get('Magento\Filesystem\DirectoryList\Configuration'); + $directoryListConfig->configure($directories); + return $locator; } /** * Load primary config data * - * @param Dir $directories + * @param string $configDirectoryPath * @param string $appMode * @return array * @throws \Magento\BootstrapException */ - protected function _loadPrimaryConfig(Dir $directories, $appMode) + protected function _loadPrimaryConfig($configDirectoryPath, $appMode) { $configData = null; - $primaryLoader = new \Magento\App\ObjectManager\ConfigLoader\Primary($directories, $appMode); + $primaryLoader = new \Magento\App\ObjectManager\ConfigLoader\Primary($configDirectoryPath, $appMode); try { $configData = $primaryLoader->load(); } catch (\Exception $e) { diff --git a/lib/Magento/App/Response/Http/FileFactory.php b/lib/Magento/App/Response/Http/FileFactory.php index a565e3c78c0..480bb31a43c 100644 --- a/lib/Magento/App/Response/Http/FileFactory.php +++ b/lib/Magento/App/Response/Http/FileFactory.php @@ -28,9 +28,9 @@ namespace Magento\App\Response\Http; class FileFactory { /** - * @var \Magento\App\ResponseFactory + * @var \Magento\App\ResponseInterface */ - protected $_responseFactory; + protected $_response; /** * @var \Magento\Filesystem @@ -38,12 +38,14 @@ class FileFactory protected $_filesystem; /** - * @param \Magento\App\ResponseFactory $responseFactory + * @param \Magento\App\ResponseInterface $response * @param \Magento\Filesystem $filesystem */ - public function __construct(\Magento\App\ResponseFactory $responseFactory, \Magento\Filesystem $filesystem) - { - $this->_responseFactory = $responseFactory; + public function __construct( + \Magento\App\ResponseInterface $response, + \Magento\Filesystem $filesystem + ) { + $this->_response = $response; $this->_filesystem = $filesystem; } @@ -54,10 +56,10 @@ class FileFactory * @param string|array $content set to null to avoid starting output, $contentLength should be set explicitly in * that case * @param string $contentType - * @param int $contentLength explicit content length, if strlen($content) isn't applicable + * @param int $contentLength explicit content length, if strlen($content) isn't applicable * @throws \Exception * @throws \InvalidArgumentException - * @return \Magento\App\ActionInterface + * @return \Magento\App\ResponseInterface * * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -67,50 +69,49 @@ class FileFactory { $filesystem = $this->_filesystem; $isFile = false; - $file = null; + $file = null; if (is_array($content)) { if (!isset($content['type']) || !isset($content['value'])) { throw new \InvalidArgumentException("Invalid arguments. Keys 'type' and 'value' are required."); } if ($content['type'] == 'filename') { - $isFile = true; - $file = $content['value']; - $contentLength = $filesystem->getFileSize($file); + $isFile = true; + $file = $content['value']; + $contentLength = $filesystem->getFileSize($file); } } - $response = $this->_responseFactory->create(); - $response->setHttpResponseCode(200) + $this->_response->setHttpResponseCode(200) ->setHeader('Pragma', 'public', true) ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true) ->setHeader('Content-type', $contentType, true) ->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength, true) - ->setHeader('Content-Disposition', 'attachment; filename="'.$fileName.'"', true) + ->setHeader('Content-Disposition', 'attachment; filename="' . $fileName . '"', true) ->setHeader('Last-Modified', date('r'), true); if (!is_null($content)) { if ($isFile) { - $response->clearBody(); - $response->sendHeaders(); + $this->_response->clearBody(); + $this->_response->sendHeaders(); if (!$filesystem->isFile($file)) { throw new \Exception(__('File not found')); } - $stream = $filesystem->createAndOpenStream($file, 'r'); - while ($buffer = $stream->read(1024)) { + $stream = $filesystem->fileOpen($file, 'r'); + while ($buffer = $filesystem->fileRead($stream, 1024)) { print $buffer; } flush(); - $stream->close(); + $filesystem->fileClose($stream); if (!empty($content['rm'])) { - $filesystem->delete($file); + $filesystem->deleteFile($file); } exit(0); } else { - $response->setBody($content); + $this->_response->setBody($content); } } - return $response; + return $this->_response; } -} \ No newline at end of file +} diff --git a/lib/Magento/App/State.php b/lib/Magento/App/State.php index 311ee875349..114a498e44c 100644 --- a/lib/Magento/App/State.php +++ b/lib/Magento/App/State.php @@ -200,15 +200,16 @@ class State * * @param string $areaCode * @param callable $callback + * @param array $params * @return mixed * @throws \Exception */ - public function emulateAreaCode($areaCode, $callback) + public function emulateAreaCode($areaCode, $callback, $params = array()) { $currentArea = $this->_areaCode; $this->_areaCode = $areaCode; try { - $result = call_user_func($callback); + $result = call_user_func_array($callback, $params); } catch (\Exception $e) { $this->_areaCode = $currentArea; throw $e; diff --git a/lib/Magento/Archive.php b/lib/Magento/Archive.php index cca7837ce70..d954c741cde 100644 --- a/lib/Magento/Archive.php +++ b/lib/Magento/Archive.php @@ -86,7 +86,7 @@ class Archive } else { $format = self::DEFAULT_ARCHIVER; } - $class = '\\Magento\Archive_'.ucfirst($format); + $class = '\\Magento\Archive\\'.ucfirst($format); $this->_archiver = new $class(); return $this->_archiver; } @@ -127,7 +127,7 @@ class Archive if ($i == (count($archivers) - 1)) { $packed = $destination; } else { - $packed = dirname($destination) . DS . '~tmp-'. microtime(true) . $archivers[$i] . '.' . $archivers[$i]; + $packed = dirname($destination) . '/~tmp-'. microtime(true) . $archivers[$i] . '.' . $archivers[$i]; } $source = $this->_getArchiver($archivers[$i])->pack($source, $packed, $skipRoot); if ($interimSource && $i < count($archivers)) { @@ -158,9 +158,10 @@ class Archive break; } if ($i == 0) { - $packed = rtrim($destination, DS) . DS; + $packed = rtrim($destination, '/') . '/'; } else { - $packed = rtrim($destination, DS) . DS . '~tmp-'. microtime(true) . $archivers[$i-1] . '.' . $archivers[$i-1]; + $packed = rtrim($destination, '/') . '/~tmp-'. microtime(true) + . $archivers[$i-1] . '.' . $archivers[$i-1]; } $source = $this->_getArchiver($archivers[$i])->unpack($source, $packed); diff --git a/lib/Magento/Archive/AbstractArchive.php b/lib/Magento/Archive/AbstractArchive.php index 24a384c1858..8110a2324b9 100644 --- a/lib/Magento/Archive/AbstractArchive.php +++ b/lib/Magento/Archive/AbstractArchive.php @@ -80,7 +80,7 @@ class AbstractArchive */ public function getFilename($source, $withExtension=false) { - $file = str_replace(dirname($source) . DS, '', $source); + $file = str_replace(dirname($source) . '/', '', $source); if (!$withExtension) { $file = substr($file, 0, strrpos($file, '.')); } diff --git a/lib/Magento/Archive/Tar.php b/lib/Magento/Archive/Tar.php index d0cb245011b..ceb56337a4d 100644 --- a/lib/Magento/Archive/Tar.php +++ b/lib/Magento/Archive/Tar.php @@ -200,7 +200,7 @@ class Tar extends \Magento\Archive\AbstractArchive implements \Magento\Archive\A */ protected function _setCurrentFile($file) { - $this->_currentFile = $file .((!is_link($file) && is_dir($file) && substr($file, -1) != DS) ? DS : ''); + $this->_currentFile = $file .((!is_link($file) && is_dir($file) && substr($file, -1) != '/') ? '/' : ''); return $this; } @@ -235,9 +235,9 @@ class Tar extends \Magento\Archive\AbstractArchive implements \Magento\Archive\A protected function _setCurrentPath($path) { if ($this->_skipRoot && is_dir($path)) { - $this->_currentPath = $path.(substr($path, -1)!=DS?DS:''); + $this->_currentPath = $path . (substr($path, -1) != '/' ? '/' : ''); } else { - $this->_currentPath = dirname($path) . DS; + $this->_currentPath = dirname($path) . '/'; } return $this; } @@ -457,7 +457,7 @@ class Tar extends \Magento\Archive\AbstractArchive implements \Magento\Archive\A throw new \Magento\Exception('Failed to create directory ' . $currentFile); } } - $list[] = $currentFile . DS; + $list[] = $currentFile . '/'; } elseif ($header['type'] == '2') { //we do not interrupt unpack process if symlink creation failed as symlinks are not so important diff --git a/lib/Magento/Autoload/ClassMap.php b/lib/Magento/Autoload/ClassMap.php index 1ac316c415d..78920588b86 100644 --- a/lib/Magento/Autoload/ClassMap.php +++ b/lib/Magento/Autoload/ClassMap.php @@ -68,7 +68,7 @@ class ClassMap public function getFile($class) { if (isset($this->_map[$class])) { - return $this->_baseDir . DIRECTORY_SEPARATOR . $this->_map[$class]; + return $this->_baseDir . '/' . $this->_map[$class]; } return false; } diff --git a/lib/Magento/Autoload/IncludePath.php b/lib/Magento/Autoload/IncludePath.php index c9519ce3cd1..e8b38973708 100644 --- a/lib/Magento/Autoload/IncludePath.php +++ b/lib/Magento/Autoload/IncludePath.php @@ -56,7 +56,7 @@ class IncludePath if (strpos($class, self::NS_SEPARATOR) !== false) { $class = ltrim(str_replace(self::NS_SEPARATOR, '_', $class), '_'); } - return str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; + return str_replace('_', '/', $class) . '.php'; } /** diff --git a/lib/Magento/Autoload/Simple.php b/lib/Magento/Autoload/Simple.php index 5cf47d8d04b..9a70a9c125f 100644 --- a/lib/Magento/Autoload/Simple.php +++ b/lib/Magento/Autoload/Simple.php @@ -46,7 +46,7 @@ class Simple public function autoload($class) { - $classFile = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $class))); + $classFile = str_replace(' ', '/', ucwords(str_replace('_', ' ', $class))); $classFile.= '.php'; @include $classFile; } diff --git a/lib/Magento/Backup/AbstractBackup.php b/lib/Magento/Backup/AbstractBackup.php index da7e8ede317..01c96060445 100644 --- a/lib/Magento/Backup/AbstractBackup.php +++ b/lib/Magento/Backup/AbstractBackup.php @@ -212,7 +212,7 @@ abstract class AbstractBackup implements \Magento\Backup\BackupInterface */ public function getBackupPath() { - return $this->getBackupsDir() . DS . $this->getBackupFilename(); + return $this->getBackupsDir() . '/' . $this->getBackupFilename(); } /** diff --git a/lib/Magento/Backup/Filesystem.php b/lib/Magento/Backup/Filesystem.php index 450192c6b81..b730c938b17 100644 --- a/lib/Magento/Backup/Filesystem.php +++ b/lib/Magento/Backup/Filesystem.php @@ -95,6 +95,7 @@ class Filesystem extends \Magento\Backup\AbstractBackup $rollbackWorker->run(); $this->_lastOperationSucceed = true; + return $this->_lastOperationSucceed; } /** @@ -152,6 +153,7 @@ class Filesystem extends \Magento\Backup\AbstractBackup @unlink($tarTmpPath); $this->_lastOperationSucceed = true; + return $this->_lastOperationSucceed; } /** @@ -280,6 +282,6 @@ class Filesystem extends \Magento\Backup\AbstractBackup protected function _getTarTmpPath() { $tmpName = '~tmp-'. microtime(true) . '.tar'; - return $this->getBackupsDir() . DS . $tmpName; + return $this->getBackupsDir() . '/' . $tmpName; } } diff --git a/lib/Magento/Backup/Filesystem/Rollback/Ftp.php b/lib/Magento/Backup/Filesystem/Rollback/Ftp.php index 6733d5e1c74..d05511b485d 100644 --- a/lib/Magento/Backup/Filesystem/Rollback/Ftp.php +++ b/lib/Magento/Backup/Filesystem/Rollback/Ftp.php @@ -93,7 +93,7 @@ class Ftp extends \Magento\Backup\Filesystem\Rollback\AbstractRollback protected function _validateFtp() { $validationFilename = '~validation-' . microtime(true) . '.tmp'; - $validationFilePath = $this->_snapshot->getBackupsDir() . DS . $validationFilename; + $validationFilePath = $this->_snapshot->getBackupsDir() . '/' . $validationFilename; $fh = @fopen($validationFilePath, 'w'); @fclose($fh); @@ -103,7 +103,7 @@ class Ftp extends \Magento\Backup\Filesystem\Rollback\AbstractRollback } $rootDir = $this->_snapshot->getRootDir(); - $ftpPath = $this->_snapshot->getFtpPath() . DS . str_replace($rootDir, '', $validationFilePath); + $ftpPath = $this->_snapshot->getFtpPath() . '/' . str_replace($rootDir, '', $validationFilePath); $fileExistsOnFtp = $this->_ftpClient->fileExists($ftpPath); @unlink($validationFilePath); @@ -132,7 +132,7 @@ class Ftp extends \Magento\Backup\Filesystem\Rollback\AbstractRollback */ protected function _createTmpDir() { - $tmpDir = $this->_snapshot->getBackupsDir() . DS . '~tmp-' . microtime(true); + $tmpDir = $this->_snapshot->getBackupsDir() . '/~tmp-' . microtime(true); $result = @mkdir($tmpDir); @@ -157,8 +157,8 @@ class Ftp extends \Magento\Backup\Filesystem\Rollback\AbstractRollback $iterator = new \Magento\Backup\Filesystem\Iterator\Filter($filesystemIterator, $this->_snapshot->getIgnorePaths()); foreach ($iterator as $item) { - $ftpPath = $this->_snapshot->getFtpPath() . DS . str_replace($rootDir, '', $item->__toString()); - $ftpPath = str_replace(DS, '/', $ftpPath); + $ftpPath = $this->_snapshot->getFtpPath() . '/' . str_replace($rootDir, '', $item->__toString()); + $ftpPath = str_replace('\\', '/', $ftpPath); $this->_ftpClient->delete($ftpPath); } @@ -179,8 +179,8 @@ class Ftp extends \Magento\Backup\Filesystem\Rollback\AbstractRollback $iterator = new \Magento\Backup\Filesystem\Iterator\Filter($filesystemIterator, $this->_snapshot->getIgnorePaths()); foreach ($filesystemIterator as $item) { - $ftpPath = $this->_snapshot->getFtpPath() . DS . str_replace($tmpDir, '', $item->__toString()); - $ftpPath = str_replace(DS, '/', $ftpPath); + $ftpPath = $this->_snapshot->getFtpPath() . '/' . str_replace($tmpDir, '', $item->__toString()); + $ftpPath = str_replace('\\', '/', $ftpPath); if ($item->isLink()) { continue; diff --git a/lib/Magento/Backup/Media.php b/lib/Magento/Backup/Media.php index 78d99dedac6..905a168ab41 100644 --- a/lib/Magento/Backup/Media.php +++ b/lib/Magento/Backup/Media.php @@ -33,26 +33,10 @@ */ namespace Magento\Backup; -class Media extends \Magento\Backup\AbstractBackup +class Media extends \Magento\Backup\Snapshot { /** - * Snapshot backup manager instance - * - * @var \Magento\Backup\Snapshot - */ - protected $_snapshotManager; - - /** - * @param \Magento\Backup\Snapshot $snapshotManager - */ - public function __construct( - \Magento\Backup\Snapshot $snapshotManager - ) { - $this->_snapshotManager = $snapshotManager; - } - - /** - * Implementation Rollback functionality for Snapshot + * Implementation Rollback functionality for Media * * @throws \Magento\Exception * @return bool @@ -60,11 +44,11 @@ class Media extends \Magento\Backup\AbstractBackup public function rollback() { $this->_prepareIgnoreList(); - return $this->_snapshotManager->rollback(); + return parent::rollback(); } /** - * Implementation Create Backup functionality for Snapshot + * Implementation Create Backup functionality for Media * * @throws \Magento\Exception * @return bool @@ -72,7 +56,7 @@ class Media extends \Magento\Backup\AbstractBackup public function create() { $this->_prepareIgnoreList(); - return $this->_snapshotManager->create(); + return parent::create(); } /** @@ -93,95 +77,22 @@ class Media extends \Magento\Backup\AbstractBackup */ protected function _prepareIgnoreList() { - $rootDir = $this->_snapshotManager->getRootDir(); + $rootDir = $this->getRootDir(); $map = array( $rootDir => array('media', 'var', 'pub'), - $rootDir . DIRECTORY_SEPARATOR . 'pub' => array('media'), - $rootDir . DIRECTORY_SEPARATOR . 'var' => array($this->_snapshotManager->getDbBackupFilename()), + $rootDir . '/pub' => array('media'), + $rootDir . '/var' => array($this->getDbBackupFilename()), ); foreach ($map as $path => $whiteList) { foreach (new \DirectoryIterator($path) as $item) { $filename = $item->getFilename(); if (!$item->isDot() && !in_array($filename, $whiteList)) { - $this->_snapshotManager->addIgnorePaths($item->getPathname()); + $this->addIgnorePaths($item->getPathname()); } } } return $this; } - - /** - * Set Backup Extension - * - * @param string $backupExtension - * @return \Magento\Backup\BackupInterface - */ - public function setBackupExtension($backupExtension) - { - $this->_snapshotManager->setBackupExtension($backupExtension); - return $this; - } - - /** - * Set Resource Model - * - * @param object $resourceModel - * @return \Magento\Backup\BackupInterface - */ - public function setResourceModel($resourceModel) - { - $this->_snapshotManager->setResourceModel($resourceModel); - return $this; - } - - /** - * Set Time - * - * @param int $time - * @return \Magento\Backup\BackupInterface - */ - public function setTime($time) - { - $this->_snapshotManager->setTime($time); - return $this; - } - - /** - * Set path to directory where backups stored - * - * @param string $backupsDir - * @return \Magento\Backup\BackupInterface - */ - public function setBackupsDir($backupsDir) - { - $this->_snapshotManager->setBackupsDir($backupsDir); - return $this; - } - - /** - * Add path that should be ignoring when creating or rolling back backup - * - * @param string|array $paths - * @return \Magento\Backup\BackupInterface - */ - public function addIgnorePaths($paths) - { - $this->_snapshotManager->addIgnorePaths($paths); - return $this; - } - - /** - * Set root directory of Magento installation - * - * @param string $rootDir - * @throws \Magento\Exception - * @return \Magento\Backup\BackupInterface - */ - public function setRootDir($rootDir) - { - $this->_snapshotManager->setRootDir($rootDir); - return $this; - } } diff --git a/lib/Magento/Backup/Nomedia.php b/lib/Magento/Backup/Nomedia.php index 378708a207e..33b6936b5b7 100644 --- a/lib/Magento/Backup/Nomedia.php +++ b/lib/Magento/Backup/Nomedia.php @@ -53,10 +53,10 @@ class Nomedia extends \Magento\Backup\Media */ protected function _prepareIgnoreList() { - $rootDir = $this->_snapshotManager->getRootDir(); - $this->_snapshotManager->addIgnorePaths(array( - $rootDir . DIRECTORY_SEPARATOR . 'media', - $rootDir . DIRECTORY_SEPARATOR . 'pub' . DIRECTORY_SEPARATOR . 'media', + $rootDir = $this->getRootDir(); + $this->addIgnorePaths(array( + $rootDir . '/media', + $rootDir . '/pub/media', )); return $this; } diff --git a/lib/Magento/Backup/Snapshot.php b/lib/Magento/Backup/Snapshot.php index 9b55053a542..6587cc32e75 100644 --- a/lib/Magento/Backup/Snapshot.php +++ b/lib/Magento/Backup/Snapshot.php @@ -43,11 +43,11 @@ class Snapshot extends \Magento\Backup\Filesystem protected $_dbBackupManager; /** - * Dirs instance + * Filesystem facade * - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_dirs; + protected $_filesystem; /** * @var \Magento\Backup\Factory @@ -55,14 +55,14 @@ class Snapshot extends \Magento\Backup\Filesystem protected $_backupFactory; /** - * @param \Magento\App\Dir $dirs + * @param \Magento\Filesystem $filesystem * @param \Magento\Backup\Factory $backupFactory */ public function __construct( - \Magento\App\Dir $dirs, + \Magento\Filesystem $filesystem, \Magento\Backup\Factory $backupFactory ) { - $this->_dirs = $dirs; + $this->_filesystem = $filesystem; $this->_backupFactory = $backupFactory; } @@ -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->_dirs->getDir('var')) + ->setBackupsDir($this->_filesystem->getPath(\Magento\Filesystem::VAR_DIR)) ->setResourceModel($this->getResourceModel()); } diff --git a/lib/Magento/Code/Generator.php b/lib/Magento/Code/Generator.php index 5335734ea67..431bc35e3e2 100644 --- a/lib/Magento/Code/Generator.php +++ b/lib/Magento/Code/Generator.php @@ -57,18 +57,22 @@ class Generator ); /** - * @param \Magento\Code\Generator\EntityAbstract $generator + * @param Generator\EntityAbstract $generator * @param \Magento\Autoload\IncludePath $autoloader - * @param \Magento\Code\Generator\Io $ioObject + * @param Generator\Io $ioObject + * @param \Magento\Filesystem $filesystem */ public function __construct( \Magento\Code\Generator\EntityAbstract $generator = null, \Magento\Autoload\IncludePath $autoloader = null, - \Magento\Code\Generator\Io $ioObject = null + \Magento\Code\Generator\Io $ioObject = null, + \Magento\Filesystem $filesystem = null ) { - $this->_generator = $generator; - $this->_autoloader = $autoloader ? : new \Magento\Autoload\IncludePath(); - $this->_ioObject = $ioObject ? : new \Magento\Code\Generator\Io(new \Magento\Io\File(), $this->_autoloader); + //todo: remove $filesystem from constructor + $this->_generator = $generator; + $this->_autoloader = $autoloader ? : new \Magento\Autoload\IncludePath(); + $this->_ioObject = $ioObject ? : new \Magento\Code\Generator\Io( + new \Magento\Filesystem\Driver\File(), $this->_autoloader); } /** diff --git a/lib/Magento/Code/Generator/EntityAbstract.php b/lib/Magento/Code/Generator/EntityAbstract.php index b5c1dd3d2be..96c1b743094 100644 --- a/lib/Magento/Code/Generator/EntityAbstract.php +++ b/lib/Magento/Code/Generator/EntityAbstract.php @@ -72,10 +72,10 @@ abstract class EntityAbstract protected $_classGenerator; /** - * @param string $sourceClassName - * @param string $resultClassName - * @param \Magento\Code\Generator\Io $ioObject - * @param \Magento\Code\Generator\CodeGenerator\CodeGeneratorInterface $classGenerator + * @param null $sourceClassName + * @param null $resultClassName + * @param Io $ioObject + * @param CodeGenerator\CodeGeneratorInterface $classGenerator * @param \Magento\Autoload\IncludePath $autoLoader */ public function __construct( @@ -93,7 +93,10 @@ abstract class EntityAbstract if ($ioObject) { $this->_ioObject = $ioObject; } else { - $this->_ioObject = new \Magento\Code\Generator\Io(new \Magento\Io\File(), $this->_autoloader); + $this->_ioObject = new \Magento\Code\Generator\Io( + new \Magento\Filesystem\Driver\File(), + $this->_autoloader + ); } if ($classGenerator) { $this->_classGenerator = $classGenerator; @@ -257,7 +260,7 @@ abstract class EntityAbstract && !in_array($pathParts[2], array('Block', 'Helper', 'Model')) ) { $controllerPath = preg_replace('/^([0-9A-Za-z]*)_([0-9A-Za-z]*)/', '\\1_\\2_controllers', $sourceClassName); - $filePath = stream_resolve_include_path(str_replace('_', DIRECTORY_SEPARATOR, $controllerPath) . '.php'); + $filePath = stream_resolve_include_path(str_replace('_', '/', $controllerPath) . '.php'); $isSourceClassValid = !empty($filePath); } else { $isSourceClassValid =$autoloader::getFile($sourceClassName); diff --git a/lib/Magento/Code/Generator/Io.php b/lib/Magento/Code/Generator/Io.php index b974aabb5fd..92f0e24246d 100644 --- a/lib/Magento/Code/Generator/Io.php +++ b/lib/Magento/Code/Generator/Io.php @@ -30,7 +30,7 @@ class Io { /** * Default code generation directory - * Should correspond the value from \Magento\App\Dir + * Should correspond the value from \Magento\Filesystem */ const DEFAULT_DIRECTORY = 'var/generation'; @@ -46,11 +46,6 @@ class Io */ private $_generationDirectory; - /** - * @var \Magento\Io\IoInterface - */ - private $_ioObject; - /** * Autoloader instance * @@ -59,29 +54,36 @@ class Io private $_autoloader; /** - * @var string + * @var \Magento\Filesystem\Driver\File */ - private $_directorySeparator; - + private $filesystemDriver; /** - * @param \Magento\Io\IoInterface $ioObject - * @param \Magento\Autoload\IncludePath $autoLoader - * @param string $generationDirectory + * @param \Magento\Filesystem\Driver\File $filesystemDriver + * @param \Magento\Autoload\IncludePath $autoLoader + * @param null $generationDirectory */ - public function __construct(\Magento\Io\IoInterface $ioObject = null, \Magento\Autoload\IncludePath $autoLoader = null, + public function __construct( + \Magento\Filesystem\Driver\File $filesystemDriver, + \Magento\Autoload\IncludePath $autoLoader = null, $generationDirectory = null ) { - $this->_ioObject = $ioObject ? : new \Magento\Io\File(); - $this->_autoloader = $autoLoader ? : new \Magento\Autoload\IncludePath(); - $this->_directorySeparator = $this->_ioObject->dirsep(); + $this->_autoloader = $autoLoader ? : new \Magento\Autoload\IncludePath(); + $this->filesystemDriver = $filesystemDriver; + $this->initGeneratorDirectory($generationDirectory); + } - if ($generationDirectory) { - $this->_generationDirectory - = rtrim($generationDirectory, $this->_directorySeparator) . $this->_directorySeparator; + /** + * Get path to generation directory + * + * @param $directory + * @return string + */ + protected function initGeneratorDirectory($directory = null) + { + if ($directory) { + $this->_generationDirectory = rtrim($directory, '/') . '/'; } else { - $this->_generationDirectory - = realpath(__DIR__ . str_replace('/', $this->_directorySeparator, '/../../../../')) - . $this->_directorySeparator . self::DEFAULT_DIRECTORY . $this->_directorySeparator; + $this->_generationDirectory = realpath(__DIR__ . '/../../../../') . '/' . self::DEFAULT_DIRECTORY . '/'; } } @@ -92,10 +94,10 @@ class Io public function getResultFileDirectory($className) { $fileName = $this->getResultFileName($className); - $pathParts = explode($this->_directorySeparator, $fileName); + $pathParts = explode('/', $fileName); unset($pathParts[count($pathParts) - 1]); - return implode($this->_directorySeparator, $pathParts) . $this->_directorySeparator; + return implode('/', $pathParts) . '/'; } /** @@ -117,7 +119,7 @@ class Io public function writeResultFile($fileName, $content) { $content = "<?php\n" . $content; - return $this->_ioObject->write($fileName, $content); + return $this->filesystemDriver->filePutContents($fileName, $content); } /** @@ -151,7 +153,7 @@ class Io */ public function fileExists($fileName) { - return $this->_ioObject->fileExists($fileName, true); + return $this->filesystemDriver->isExists($fileName); } /** @@ -160,9 +162,14 @@ class Io */ private function _makeDirectory($directory) { - if ($this->_ioObject->isWriteable($directory)) { + if ($this->filesystemDriver->isWritable($directory)) { + return true; + } + try { + $this->filesystemDriver->createDirectory($directory, self::DIRECTORY_PERMISSION); return true; + } catch (\Magento\Filesystem\FilesystemException $e) { + return false; } - return $this->_ioObject->mkdir($directory, self::DIRECTORY_PERMISSION, true); } } diff --git a/lib/Magento/Code/Minifier.php b/lib/Magento/Code/Minifier.php index 1deae3a86ff..434a408da57 100644 --- a/lib/Magento/Code/Minifier.php +++ b/lib/Magento/Code/Minifier.php @@ -24,6 +24,8 @@ namespace Magento\Code; +use Magento\Filesystem\Directory\Read; + class Minifier { /** @@ -32,28 +34,34 @@ class Minifier private $_strategy; /** - * @var \Magento\Filesystem + * @var Read + */ + private $rootDirectory; + + /** + * @var string directory name where minified files are saved */ - private $_filesystem; + private $directoryName; /** - * @var string directory where minified files are saved + * @var Read */ - private $_baseDir; + private $pubViewCacheDir; /** * @param \Magento\Code\Minifier\StrategyInterface $strategy * @param \Magento\Filesystem $filesystem - * @param string $baseDir + * @param string $directoryName */ public function __construct( \Magento\Code\Minifier\StrategyInterface $strategy, \Magento\Filesystem $filesystem, - $baseDir + $directoryName ) { $this->_strategy = $strategy; - $this->_filesystem = $filesystem; - $this->_baseDir = $baseDir; + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->pubViewCacheDir = $filesystem->getDirectoryRead(\Magento\Filesystem::PUB_VIEW_CACHE); + $this->directoryName = $directoryName; } /** @@ -67,13 +75,15 @@ class Minifier if ($this->_isFileMinified($originalFile)) { return $originalFile; } - $minifiedFile = $this->_findOriginalMinifiedFile($originalFile); + $originalFileRelative = $this->rootDirectory->getRelativePath($originalFile); + $minifiedFile = $this->_findOriginalMinifiedFile($originalFileRelative); if (!$minifiedFile) { - $minifiedFile = $this->_baseDir . '/' . $this->_generateMinifiedFileName($originalFile); - $this->_strategy->minifyFile($originalFile, $minifiedFile); + $minifiedFile = $this->directoryName . '/' . $this->_generateMinifiedFileName($originalFile); + $this->_strategy->minifyFile($originalFileRelative, $minifiedFile); } - return $minifiedFile; + $minifiedFile = $this->pubViewCacheDir->getRelativePath($minifiedFile); + return $this->pubViewCacheDir->getAbsolutePath($minifiedFile); } /** @@ -111,7 +121,7 @@ class Minifier { $fileInfo = pathinfo($originalFile); $minifiedFile = $fileInfo['dirname'] . '/' . $fileInfo['filename'] . '.min.' . $fileInfo['extension']; - if ($this->_filesystem->has($minifiedFile)) { + if ($this->rootDirectory->isExist($minifiedFile)) { return $minifiedFile; } return false; diff --git a/lib/Magento/Code/Minifier/Strategy/Generate.php b/lib/Magento/Code/Minifier/Strategy/Generate.php index e15690c8080..1952f61fa70 100644 --- a/lib/Magento/Code/Minifier/Strategy/Generate.php +++ b/lib/Magento/Code/Minifier/Strategy/Generate.php @@ -27,17 +27,25 @@ */ namespace Magento\Code\Minifier\Strategy; +use Magento\Filesystem\Directory\Read, + Magento\Filesystem\Directory\Write; + class Generate implements \Magento\Code\Minifier\StrategyInterface { /** * @var \Magento\Code\Minifier\AdapterInterface */ - protected $_adapter; + protected $adapter; /** - * @var \Magento\Filesystem + * @var Read */ - protected $_filesystem; + protected $rootDirectory; + + /** + * @var Write + */ + protected $pubViewCacheDir; /** * @param \Magento\Code\Minifier\AdapterInterface $adapter @@ -47,37 +55,42 @@ class Generate implements \Magento\Code\Minifier\StrategyInterface \Magento\Code\Minifier\AdapterInterface $adapter, \Magento\Filesystem $filesystem ) { - $this->_adapter = $adapter; - $this->_filesystem = $filesystem; - $this->_filesystem->setIsAllowCreateDirectories(true); + $this->adapter = $adapter; + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->pubViewCacheDir = $filesystem->getDirectoryWrite(\Magento\Filesystem::PUB_VIEW_CACHE); } /** * Get path to minified file for specified original file * - * @param string $originalFile path to original file - * @param string $targetFile + * @param string $originalFile path to original file relative to pub/view_cache + * @param string $targetFile path relative to pub/view_cache */ public function minifyFile($originalFile, $targetFile) { if ($this->_isUpdateNeeded($originalFile, $targetFile)) { - $content = $this->_filesystem->read($originalFile); - $content = $this->_adapter->minify($content); - $this->_filesystem->write($targetFile, $content); - $this->_filesystem->touch($targetFile, $this->_filesystem->getMTime($originalFile)); + $content = $this->rootDirectory->readFile($originalFile); + $content = $this->adapter->minify($content); + $targetFile = $this->pubViewCacheDir->getRelativePath($targetFile); + $this->pubViewCacheDir->writeFile($targetFile, $content); + $this->pubViewCacheDir->touch($targetFile, $this->rootDirectory->stat($originalFile)['mtime']); } } /** * Check whether minified file should be created/updated * - * @param string $originalFile - * @param string $minifiedFile + * @param string $originalFile path to original file relative to pub/view_cache + * @param string $minifiedFile path relative to pub/view_cache * @return bool */ protected function _isUpdateNeeded($originalFile, $minifiedFile) { - return !$this->_filesystem->has($minifiedFile) - || ($this->_filesystem->getMTime($originalFile) != $this->_filesystem->getMTime($minifiedFile)); + if (!$this->pubViewCacheDir->isExist($minifiedFile)) { + return true; + } + $originalFileMtime = $this->rootDirectory->stat($originalFile)['mtime']; + $minifiedFileMtime = $this->pubViewCacheDir->stat($minifiedFile)['mtime']; + return ($originalFileMtime != $minifiedFileMtime); } } diff --git a/lib/Magento/Code/Minifier/Strategy/Lite.php b/lib/Magento/Code/Minifier/Strategy/Lite.php index ab56fba0304..5cea56fa111 100644 --- a/lib/Magento/Code/Minifier/Strategy/Lite.php +++ b/lib/Magento/Code/Minifier/Strategy/Lite.php @@ -30,17 +30,25 @@ */ namespace Magento\Code\Minifier\Strategy; +use Magento\Filesystem\Directory\Read, + Magento\Filesystem\Directory\Write; + class Lite implements \Magento\Code\Minifier\StrategyInterface { /** * @var \Magento\Code\Minifier\AdapterInterface */ - protected $_adapter; + protected $adapter; + + /** + * @var Read + */ + protected $rootDirectory; /** - * @var \Magento\Filesystem + * @var Write */ - protected $_filesystem; + protected $pubViewCacheDir; /** * @param \Magento\Code\Minifier\AdapterInterface $adapter @@ -50,34 +58,34 @@ class Lite implements \Magento\Code\Minifier\StrategyInterface \Magento\Code\Minifier\AdapterInterface $adapter, \Magento\Filesystem $filesystem ) { - $this->_adapter = $adapter; - $this->_filesystem = $filesystem; - $this->_filesystem->setIsAllowCreateDirectories(true); + $this->adapter = $adapter; + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->pubViewCacheDir = $filesystem->getDirectoryWrite(\Magento\Filesystem::PUB_VIEW_CACHE); } /** * Get path to minified file for specified original file * - * @param string $originalFile path to original file - * @param string $targetFile + * @param string $originalFile path to original file relative to pub/view_cache + * @param string $targetFile path relative to pub/view_cache */ public function minifyFile($originalFile, $targetFile) { if ($this->_isUpdateNeeded($targetFile)) { - $content = $this->_filesystem->read($originalFile); - $content = $this->_adapter->minify($content); - $this->_filesystem->write($targetFile, $content); + $content = $this->rootDirectory->readFile($originalFile); + $content = $this->adapter->minify($content); + $this->pubViewCacheDir->writeFile($targetFile, $content); } } /** * Check whether minified file should be created * - * @param string $minifiedFile + * @param string $minifiedFile path relative to pub/view_cache * @return bool */ protected function _isUpdateNeeded($minifiedFile) { - return !$this->_filesystem->has($minifiedFile); + return !$this->pubViewCacheDir->isExist($minifiedFile); } } diff --git a/lib/Magento/Code/Minifier/StrategyInterface.php b/lib/Magento/Code/Minifier/StrategyInterface.php index d79aade63bf..e670bd3be18 100644 --- a/lib/Magento/Code/Minifier/StrategyInterface.php +++ b/lib/Magento/Code/Minifier/StrategyInterface.php @@ -32,8 +32,8 @@ interface StrategyInterface /** * Generates minified file * - * @param string $originalFile - * @param string $targetFile + * @param string $originalFile path relative to pub/view_cache + * @param string $targetFile path relative to pub/view_cache */ public function minifyFile($originalFile, $targetFile); } diff --git a/lib/Magento/Code/Validator/ArgumentSequence.php b/lib/Magento/Code/Validator/ArgumentSequence.php index 37f5fe2636d..e824dba6167 100644 --- a/lib/Magento/Code/Validator/ArgumentSequence.php +++ b/lib/Magento/Code/Validator/ArgumentSequence.php @@ -77,20 +77,25 @@ class ArgumentSequence implements ValidatorInterface if (isset($this->_cache[$parentClass])) { $parentCall = $this->_argumentsReader->getParentCall($class, array()); - if ($parentCall) { + if (empty($classArguments) || $parentCall) { $parentArguments = $this->_cache[$parentClass]; } } } + if (empty($classArguments)) { + $classArguments = $parentArguments; + } + $requiredSequence = $this->_buildsSequence($classArguments, $parentArguments); if (!empty($requiredSequence)) { $this->_cache[$className] = $requiredSequence; } if (false == $this->_checkArgumentSequence($classArguments, $requiredSequence)) { + $classPath = str_replace('\\', '/', $class->getFileName()); throw new ValidationException( - 'Incorrect argument sequence in class ' . $className . ' in ' . $class->getFileName() . PHP_EOL + 'Incorrect argument sequence in class ' . $className . ' in ' . $classPath . PHP_EOL . 'Required: $' . implode(', $', array_keys($requiredSequence)) . PHP_EOL . 'Actual : $' . implode(', $', array_keys($classArguments)) . PHP_EOL ); @@ -142,7 +147,7 @@ class ArgumentSequence implements ValidatorInterface { $output = array(); if (empty($classArguments)) { - return $output; + return $parentArguments; } $classArgumentList = $this->_sortArguments($classArguments); diff --git a/lib/Magento/Code/Validator/ConstructorIntegrity.php b/lib/Magento/Code/Validator/ConstructorIntegrity.php index b75e6d20cde..774324fd6d0 100644 --- a/lib/Magento/Code/Validator/ConstructorIntegrity.php +++ b/lib/Magento/Code/Validator/ConstructorIntegrity.php @@ -89,8 +89,9 @@ class ConstructorIntegrity implements ValidatorInterface continue; } + $classPath = str_replace('\\', '/', $class->getFileName()); throw new \Magento\Code\ValidationException('Missed required argument ' . $requiredArgument['name'] - . ' in parent::__construct call. File: ' . $class->getFileName() + . ' in parent::__construct call. File: ' . $classPath ); } @@ -99,9 +100,10 @@ class ConstructorIntegrity implements ValidatorInterface $actualArgument['type'] ); if (false == $isCompatibleTypes) { + $classPath = str_replace('\\', '/', $class->getFileName()); throw new \Magento\Code\ValidationException('Incompatible argument type: Required type: ' . $requiredArgument['type'] . '. Actual type: ' . $actualArgument['type'] - . '; File: ' . PHP_EOL .$class->getFileName() . PHP_EOL + . '; File: ' . PHP_EOL . $classPath . PHP_EOL ); } } @@ -117,10 +119,11 @@ class ConstructorIntegrity implements ValidatorInterface $names[] = '$' . $param['name']; } + $classPath = str_replace('\\', '/', $class->getFileName()); throw new \Magento\Code\ValidationException( 'Extra parameters passed to parent construct: ' . implode(', ', $names) - . '. File: ' . $class->getFileName() + . '. File: ' . $classPath ); } return true; diff --git a/lib/Magento/Code/Validator/ContextAggregation.php b/lib/Magento/Code/Validator/ContextAggregation.php index bb2a6924a58..9ca876a0610 100644 --- a/lib/Magento/Code/Validator/ContextAggregation.php +++ b/lib/Magento/Code/Validator/ContextAggregation.php @@ -80,8 +80,9 @@ class ContextAggregation implements ValidatorInterface } if (false == empty($errors)) { + $classPath = str_replace('\\', '/', $class->getFileName()); throw new ValidationException( - 'Incorrect dependency in class ' . $className . ' in ' . $class->getFileName() . PHP_EOL + 'Incorrect dependency in class ' . $className . ' in ' . $classPath . PHP_EOL . implode(PHP_EOL, $errors) ); } diff --git a/lib/Magento/Code/Validator/TypeDuplication.php b/lib/Magento/Code/Validator/TypeDuplication.php index c91af83cbae..c03f67810d7 100644 --- a/lib/Magento/Code/Validator/TypeDuplication.php +++ b/lib/Magento/Code/Validator/TypeDuplication.php @@ -78,8 +78,9 @@ class TypeDuplication implements ValidatorInterface if (!empty($errors)) { if (false == $this->_ignoreWarning($class)) { + $classPath = str_replace('\\', '/', $class->getFileName()); throw new ValidationException('Argument type duplication in class ' . $class->getName() - . ' in ' . $class->getFileName() . PHP_EOL . implode(PHP_EOL, $errors) + . ' in ' . $classPath . PHP_EOL . implode(PHP_EOL, $errors) ); } } diff --git a/lib/Magento/Config/AbstractXml.php b/lib/Magento/Config/AbstractXml.php index 3e37f32ce18..d344d86828a 100644 --- a/lib/Magento/Config/AbstractXml.php +++ b/lib/Magento/Config/AbstractXml.php @@ -48,10 +48,10 @@ abstract class AbstractXml /** * Instantiate with the list of files to merge * - * @param array $configFiles + * @param $configFiles * @throws \InvalidArgumentException */ - public function __construct(array $configFiles) + public function __construct($configFiles) { if (empty($configFiles)) { throw new \InvalidArgumentException('There must be at least one configuration file specified.'); @@ -93,14 +93,11 @@ abstract class AbstractXml */ protected function _merge($configFiles) { - foreach ($configFiles as $file) { - if (!file_exists($file)) { - throw new \Magento\Exception("File does not exist: {$file}"); - } + foreach ($configFiles as $key => $content) { try { - $this->_getDomConfigModel()->merge(file_get_contents($file)); + $this->_getDomConfigModel()->merge($content); } catch (\Magento\Config\Dom\ValidationException $e) { - throw new \Magento\Exception("Invalid XML in file " . $file . ":\n" . $e->getMessage()); + throw new \Magento\Exception("Invalid XML in file " . $key . ":\n" . $e->getMessage()); } } if ($this->_isRuntimeValidated()) { diff --git a/lib/Magento/Config/FileIterator.php b/lib/Magento/Config/FileIterator.php new file mode 100644 index 00000000000..43eb73366b0 --- /dev/null +++ b/lib/Magento/Config/FileIterator.php @@ -0,0 +1,128 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Config; + +/** + * Class FileIterator + */ +class FileIterator implements \Iterator, \Countable +{ + /** + * @var array + */ + protected $cached = array(); + + /** + * @var array + */ + protected $paths = array(); + + /** + * @var int + */ + protected $position; + + /** + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $directoryRead; + + /** + * @param \Magento\Filesystem\Directory\ReadInterface $directory + * @param array $paths + */ + public function __construct( + \Magento\Filesystem\Directory\ReadInterface $directory, + array $paths + ) { + $this->paths = $paths; + $this->position = 0; + $this->directoryRead = $directory; + } + + /** + * + */ + function rewind() + { + reset($this->paths); + } + + /** + * @return string + */ + function current() + { + if (!isset($this->cached[$this->key()])) { + $this->cached[$this->key()] = $this->directoryRead->readFile($this->key()); + } + return $this->cached[$this->key()]; + + } + + /** + * @return mixed + */ + function key() + { + return current($this->paths); + } + + /** + * + */ + function next() + { + next($this->paths); + } + + /** + * @return bool + */ + function valid() + { + return (boolean)$this->key(); + } + + /** + * @return array + */ + public function toArray() + { + $result = []; + foreach($this as $item) { + $result[$this->key()] = $item; + } + return $result; + } + + /** + * @return int + */ + public function count() + { + return count($this->paths); + } +} diff --git a/lib/Magento/Config/FileIteratorFactory.php b/lib/Magento/Config/FileIteratorFactory.php new file mode 100644 index 00000000000..c26cdfd37a9 --- /dev/null +++ b/lib/Magento/Config/FileIteratorFactory.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Config; + +class FileIteratorFactory +{ + public function create(\Magento\Filesystem\Directory\ReadInterface $readDirectory, $paths) + { + return new \Magento\Config\FileIterator($readDirectory, $paths); + } +} diff --git a/lib/Magento/Config/Reader/Filesystem.php b/lib/Magento/Config/Reader/Filesystem.php index 51e35c4a631..6c163a210f5 100644 --- a/lib/Magento/Config/Reader/Filesystem.php +++ b/lib/Magento/Config/Reader/Filesystem.php @@ -146,24 +146,24 @@ class Filesystem implements \Magento\Config\ReaderInterface * @return array * @throws \Magento\Exception */ - protected function _readFiles(array $fileList) + protected function _readFiles($fileList) { /** @var \Magento\Config\Dom $domDocument */ $domDocument = null; - foreach ($fileList as $file) { + foreach ($fileList as $key => $content) { try { if (is_null($domDocument)) { $class = $this->_domDocumentClass; $domDocument = new $class( - $this->_readFileContents($file), + $content, $this->_idAttributes, $this->_perFileSchema ); } else { - $domDocument->merge($this->_readFileContents($file)); + $domDocument->merge($content); } } catch (\Magento\Config\Dom\ValidationException $e) { - throw new \Magento\Exception("Invalid XML in file " . $file . ":\n" . $e->getMessage()); + throw new \Magento\Exception("Invalid XML in file " . $key . ":\n" . $e->getMessage()); } } if ($this->_isValidated) { @@ -180,16 +180,4 @@ class Filesystem implements \Magento\Config\ReaderInterface } return $output; } - - /** - * Retrieve contents of a file. To be overridden by descendants to perform contents post processing, if needed. - * - * @param string $filename - * @return string - * @todo Use \Magento\Filesystem - */ - protected function _readFileContents($filename) - { - return file_get_contents($filename); - } } diff --git a/lib/Magento/Connect/Command.php b/lib/Magento/Connect/Command.php index e0390b20a7a..83b4b34aa03 100644 --- a/lib/Magento/Connect/Command.php +++ b/lib/Magento/Connect/Command.php @@ -275,7 +275,7 @@ class Command */ public static function registerCommands() { - $pathCommands = __DIR__.DIRECTORY_SEPARATOR.basename(__FILE__, ".php"); + $pathCommands = __DIR__ . '/' . basename(__FILE__, ".php"); $f = new \DirectoryIterator($pathCommands); foreach($f as $file) { if (! $file->isFile()) { diff --git a/lib/Magento/Connect/Command/Install.php b/lib/Magento/Connect/Command/Install.php index 8bf93b2b195..17a05aba463 100644 --- a/lib/Magento/Connect/Command/Install.php +++ b/lib/Magento/Connect/Command/Install.php @@ -254,7 +254,7 @@ extends \Magento\Connect\Command $this->ui()->output('Changed locally: '); foreach ($modifications as $row) { if(!$ftp) { - $this->ui()->output($config->magento_root.DS.$row); + $this->ui()->output($config->magento_root . '/' . $row); } else { $this->ui()->output($row); } @@ -266,7 +266,7 @@ extends \Magento\Connect\Command $dir = $config->getChannelCacheDir($pChan); @mkdir($dir, 0777, true); - $file = $dir.DIRECTORY_SEPARATOR.$pName."-".$pVer.".tgz"; + $file = $dir . '/' . $pName."-".$pVer.".tgz"; if(!@file_exists($file)) { $rest->downloadPackageFileOfRelease($pName, $pVer, $file); } diff --git a/lib/Magento/Connect/Command/Remote.php b/lib/Magento/Connect/Command/Remote.php index 10812f69564..fa440b8b974 100644 --- a/lib/Magento/Connect/Command/Remote.php +++ b/lib/Magento/Connect/Command/Remote.php @@ -179,7 +179,7 @@ extends \Magento\Connect\Command } $version = $cache->detectVersionFromRestArray($c); $dir = $config->getChannelCacheDir($channel); - $file = $dir.DIRECTORY_SEPARATOR.$package."-".$version.".tgz"; + $file = $dir . '/' . $package."-".$version.".tgz"; $rest->downloadPackageFileOfRelease($package, $version, $file); if($ftp) { @unlink($config->getFilename()); diff --git a/lib/Magento/Connect/Config.php b/lib/Magento/Connect/Config.php index 6827de5affa..02f6a13cdda 100644 --- a/lib/Magento/Connect/Config.php +++ b/lib/Magento/Connect/Config.php @@ -102,18 +102,18 @@ implements \Iterator public function getDownloaderPath() { - return $this->magento_root . DIRECTORY_SEPARATOR . $this->downloader_path; + return $this->magento_root . '/' . $this->downloader_path; } public function getPackagesCacheDir() { - return $this->getDownloaderPath() . DIRECTORY_SEPARATOR . self::DEFAULT_CACHE_PATH; + return $this->getDownloaderPath() . '/' . self::DEFAULT_CACHE_PATH; } public function getChannelCacheDir($channel) { $channel = trim( $channel, "\\/"); - return $this->getPackagesCacheDir(). DIRECTORY_SEPARATOR . $channel; + return $this->getPackagesCacheDir() . '/' . $channel; } diff --git a/lib/Magento/Connect/Converter.php b/lib/Magento/Connect/Converter.php index a0836ca4bde..4e0bb787740 100644 --- a/lib/Magento/Connect/Converter.php +++ b/lib/Magento/Connect/Converter.php @@ -257,7 +257,7 @@ final class Converter } $result = rtrim($result, "\\/"); - $packageXml = $result . DS . "package.xml"; + $packageXml = $result . '/package.xml'; if(!file_exists($packageXml)) { throw new \Exception("No package.xml found inside '{$sourceFile}'"); } @@ -276,9 +276,9 @@ final class Converter */ if(false === $destFile) { $pathinfo = pathinfo($sourceFile); - $destFile = $pathinfo['dirname'] . DS .$pathinfo['filename'].'-converted'; + $destFile = $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-converted'; if(isset($pathinfo['extension'])) { - $destFile .= ".".$pathinfo['extension']; + $destFile .= "." . $pathinfo['extension']; } } @@ -287,7 +287,8 @@ final class Converter $mageObject->setTarget($target); $validRoles = array_keys($targets); $data = $pearObject->getFilelist(); - $pathSource = dirname($pearObject->getPackageFile()).DS.$pearObject->getName()."-".$pearObject->getVersion(); + $pathSource = dirname($pearObject->getPackageFile()) + . '/' . $pearObject->getName() . "-" . $pearObject->getVersion(); $filesToDo = array(); foreach($data as $file =>$row) { @@ -298,8 +299,8 @@ final class Converter } $baseName = ltrim($targets[$role], "\\/."); $baseName = rtrim($baseName, "\\/"); - $sourceFile = $pathSource.DS.$name; - $targetFile = $outDir . DS . $baseName . DS. $name; + $sourceFile = $pathSource . '/' . $name; + $targetFile = $outDir . '/' . $baseName . '/' . $name; if(file_exists($sourceFile)) { \Magento\System\Dirs::mkdirStrict(dirname($targetFile)); $copy = @copy($sourceFile, $targetFile); @@ -316,7 +317,7 @@ final class Converter } $mageObject->save(getcwd()); @chdir($cwd); - $filename = $outDir. DS . $mageObject->getReleaseFilename().".tgz"; + $filename = $outDir . '/' . $mageObject->getReleaseFilename() . '.tgz'; if(@file_exists($targetArchive)) { @unlink($targetArchive); } diff --git a/lib/Magento/Connect/Loader/Ftp.php b/lib/Magento/Connect/Loader/Ftp.php index b7274e60f4c..6a27c434c28 100644 --- a/lib/Magento/Connect/Loader/Ftp.php +++ b/lib/Magento/Connect/Loader/Ftp.php @@ -89,7 +89,7 @@ class Ftp $uri = self::FTP_USER.":".self::FTP_PASS."@".$uri; $this->getFtp()->connect("ftp://".$uri); $this->getFtp()->pasv(true); - $localFile = self::TEMPORARY_DIR.DS.time().".xml"; + $localFile = self::TEMPORARY_DIR . '/' . time() . '.xml'; if ($this->getFtp()->get($localFile, $remoteFile)) { $this->_responseBody = file_get_contents($localFile); diff --git a/lib/Magento/Connect/Package.php b/lib/Magento/Connect/Package.php index c01fb071df6..918d2a4e8b0 100644 --- a/lib/Magento/Connect/Package.php +++ b/lib/Magento/Connect/Package.php @@ -230,7 +230,7 @@ END; public function save($path) { $this->validate(); - $path = rtrim($path, "\\/") . DS; + $path = rtrim($path, "\\/") . '/'; $this->_savePackage($path); return $this; } @@ -244,7 +244,7 @@ END; public function saveV1x($path) { $this->validate(); - $path = rtrim($path, "\\/") . DS; + $path = rtrim($path, "\\/") . '/'; $this->_savePackageV1x($path); return $this; } @@ -652,7 +652,7 @@ END; $fileNode = $parent->addChild('file'); $fileNode->addAttribute('name', $fileName); $targetDir = $this->getTarget()->getTargetUri($targetName); - $hash = md5_file($targetDir.DS.$path); + $hash = md5_file($targetDir . '/' . $path); $fileNode->addAttribute('hash', $hash); } return $this; @@ -672,9 +672,9 @@ END; public function addContentDir($targetName, $path, $exclude=null, $include=null) { $targetDir = $this->getTarget()->getTargetUri($targetName); - $targetDirLen = strlen($targetDir . DS); + $targetDirLen = strlen($targetDir . '/'); //get all subdirectories and files. - $entries = @glob($targetDir. DS . $path . DS . "{,.}*", GLOB_BRACE); + $entries = @glob($targetDir . '/' . $path . '/' . "{,.}*", GLOB_BRACE); if (!empty($entries)) { foreach ($entries as $entry) { $filePath = substr($entry, $targetDirLen); @@ -1088,7 +1088,7 @@ END; $this->_contents[] = $path; } else { foreach($parent as $_content) { - $this->_getList($_content, ($path ? $path . DS : '') . $_content['name']); + $this->_getList($_content, ($path ? $path . '/' : '') . $_content['name']); } } } @@ -1128,7 +1128,7 @@ END; if (isset($_content['hash'])) { $contentHash = (string)$_content['hash']; } - $this->_getHashList($_content, ($path ? $path . DS : '') . $_content['name'], $contentHash); + $this->_getHashList($_content, ($path ? $path . '/' : '') . $_content['name'], $contentHash); } } } @@ -1474,7 +1474,7 @@ END; */ public function getRelaseDirFilename() { - return $this->getName() . DS . $this->getVersion() . DS . $this->getReleaseFilename(); + return $this->getName() . '/' . $this->getVersion() . '/' . $this->getReleaseFilename(); } /** diff --git a/lib/Magento/Connect/Package/Hotfix.php b/lib/Magento/Connect/Package/Hotfix.php index 56cbd346e94..c96bb5e09d2 100644 --- a/lib/Magento/Connect/Package/Hotfix.php +++ b/lib/Magento/Connect/Package/Hotfix.php @@ -111,7 +111,7 @@ END; { $targetDirLen = strlen($targetDir); //get all subdirectories and files. - $entries = @glob($targetDir.$path.DS."*"); + $entries = @glob($targetDir . $path . '/*'); if (!empty($entries)) { foreach ($entries as $entry) { $filePath = substr($entry, $targetDirLen); diff --git a/lib/Magento/Connect/Package/Writer.php b/lib/Magento/Connect/Package/Writer.php index 1a3933706a7..9489fc2498d 100644 --- a/lib/Magento/Connect/Package/Writer.php +++ b/lib/Magento/Connect/Package/Writer.php @@ -125,11 +125,11 @@ class Writer if (is_dir($file) || is_file($file)) { $fileName = basename($file); $filePath = dirname($file); - @mkdir($root . DS . $filePath, 0777, true); + @mkdir($root . '/' . $filePath, 0777, true); if (is_file($file)) { - copy($file, $root . DS . $filePath . DS . $fileName); + copy($file, $root . '/' . $filePath . '/' . $fileName); } else { - @mkdir($root . DS . $filePath . $fileName, 0777); + @mkdir($root . '/' . $filePath . $fileName, 0777); } } } @@ -150,18 +150,18 @@ class Writer @mkdir(self::PATH_TO_TEMPORARY_DIRECTORY, 0777, true); $root = self::PATH_TO_TEMPORARY_DIRECTORY . basename($this->_namePackage); @mkdir($root, 0777, true); - $packageFilesDir = $root . DS . basename($this->_namePackage); + $packageFilesDir = $root . '/' . basename($this->_namePackage); @mkdir($packageFilesDir, 0777, true); foreach ($this->_files as $index => $file) { $destinationFile = $destinationFiles[$index]; if (is_dir($file) || is_file($file)) { $fileName = basename($destinationFile); $filePath = dirname($destinationFile); - @mkdir($packageFilesDir . DS . $filePath, 0777, true); + @mkdir($packageFilesDir . '/' . $filePath, 0777, true); if (is_file($file)) { - copy($file, $packageFilesDir . DS . $filePath . DS . $fileName); + copy($file, $packageFilesDir . '/' . $filePath . '/' . $fileName); } else { - @mkdir($packageFilesDir . DS . $filePath . $fileName, 0777); + @mkdir($packageFilesDir . '/' . $filePath . $fileName, 0777); } } } @@ -177,7 +177,7 @@ class Writer */ public function addPackageXml($content) { - file_put_contents($this->_temporaryPackageDir . DS . self::DEFAULT_NAME_PACKAGE_CONFIG, $content); + file_put_contents($this->_temporaryPackageDir . '/' . self::DEFAULT_NAME_PACKAGE_CONFIG, $content); return $this; } diff --git a/lib/Magento/Connect/Packager.php b/lib/Magento/Connect/Packager.php index 3f20ad32365..f067298003b 100644 --- a/lib/Magento/Connect/Packager.php +++ b/lib/Magento/Connect/Packager.php @@ -186,7 +186,7 @@ class Packager foreach($contents as $file) { $fileName = basename($file); $filePath = dirname($file); - $dest = $targetPath . DIRECTORY_SEPARATOR . $filePath . DIRECTORY_SEPARATOR . $fileName; + $dest = $targetPath . '/' . $filePath . '/' . $fileName; if(@file_exists($dest)) { //var_dump($dest); @unlink($dest); @@ -223,7 +223,7 @@ class Packager $ftpDir = $ftp->getcwd(); $contents = $package->getContents(); $arc = $this->getArchiver(); - $target = dirname($file).DS.$package->getReleaseFilename(); + $target = dirname($file) . '/' . $package->getReleaseFilename(); @mkdir($target, 0777, true); $mode = $configObj->global_dir_mode; $tar = $arc->unpack($file, $target); @@ -232,7 +232,7 @@ class Packager foreach($contents as $file) { $fileName = basename($file); $filePath = $this->convertFtpPath(dirname($file)); - $source = $tar.DS.$file; + $source = $tar . '/' . $file; if (file_exists($source) && is_file($source)) { $args = array(ltrim($file,"/"), $source); if($modeDir) { @@ -256,7 +256,7 @@ class Packager { $contents = $package->getContents(); $arc = $this->getArchiver(); - $target = dirname($file).DS.$package->getReleaseFilename(); + $target = dirname($file) . '/' . $package->getReleaseFilename(); @mkdir($target, 0777, true); $mode = $configObj->global_dir_mode; $tar = $arc->unpack($file, $target); @@ -265,10 +265,10 @@ class Packager foreach($contents as $file) { $fileName = basename($file); $filePath = dirname($file); - $source = $tar.DS.$file; + $source = $tar . '/' . $file; $targetPath = rtrim($configObj->magento_root, "\\/"); - @mkdir($targetPath. DS . $filePath, $modeDir, true); - $dest = $targetPath . DS . $filePath . DS . $fileName; + @mkdir($targetPath . '/' . $filePath, $modeDir, true); + $dest = $targetPath . '/' . $filePath . '/' . $fileName; if (is_file($source)) { @copy($source, $dest); if($modeFile) { @@ -296,7 +296,7 @@ class Packager $hashContents = $p->getHashContents(); $listModified = array(); foreach ($hashContents as $file=>$hash) { - if (md5_file($configObj->magento_root . DS . $file)!==$hash) { + if (md5_file($configObj->magento_root . '/' . $file)!==$hash) { $listModified[] = $file; } } diff --git a/lib/Magento/Convert/Excel.php b/lib/Magento/Convert/Excel.php index b4121b2c370..cc64225849f 100644 --- a/lib/Magento/Convert/Excel.php +++ b/lib/Magento/Convert/Excel.php @@ -200,10 +200,10 @@ class Excel /** * Write Converted XML Data to Temporary File * - * @param \Magento\Filesystem\StreamInterface $stream + * @param \Magento\Filesystem\File\WriteInterface $stream * @param string $sheetName */ - public function write(\Magento\Filesystem\StreamInterface $stream, $sheetName = '') + public function write(\Magento\Filesystem\File\WriteInterface $stream, $sheetName = '') { $stream->write($this->_getXmlHeader($sheetName)); diff --git a/lib/Magento/DB/Adapter/Pdo/Mysql.php b/lib/Magento/DB/Adapter/Pdo/Mysql.php index ddb5666d2ae..12cfe8ccea5 100644 --- a/lib/Magento/DB/Adapter/Pdo/Mysql.php +++ b/lib/Magento/DB/Adapter/Pdo/Mysql.php @@ -141,11 +141,11 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad protected $_debugFile = 'var/debug/pdo_mysql.log'; /** - * Io File Adapter + * Filesystem class * - * @var \Magento\Io\File + * @var \Magento\Filesystem */ - protected $_debugIoAdapter; + protected $_filesystem; /** * Debug timer start value @@ -217,13 +217,6 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad */ protected $_queryHook = null; - /** - * Dirs instance - * - * @var \Magento\App\Dir - */ - protected $_dirs; - /** * @var \Magento\Stdlib\String */ @@ -235,18 +228,18 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad protected $dateTime; /** - * @param \Magento\App\Dir $dirs + * @param \Magento\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Stdlib\DateTime $dateTime * @param array $config */ public function __construct( - \Magento\App\Dir $dirs, + \Magento\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Stdlib\DateTime $dateTime, array $config = array() ) { - $this->_dirs = $dirs; + $this->_filesystem = $filesystem; $this->string = $string; $this->dateTime = $dateTime; parent::__construct($config); @@ -1425,20 +1418,12 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad protected function _debugWriteToFile($str) { $str = '## ' . date('Y-m-d H:i:s') . "\r\n" . $str; - if (!$this->_debugIoAdapter) { - $this->_debugIoAdapter = new \Magento\Io\File(); - $dir = $this->_dirs->getDir(\Magento\App\Dir::ROOT) - . DS . $this->_debugIoAdapter->dirname($this->_debugFile); - $this->_debugIoAdapter->checkAndCreateFolder($dir); - $this->_debugIoAdapter->open(array('path' => $dir)); - $this->_debugFile = basename($this->_debugFile); - } - - $this->_debugIoAdapter->streamOpen($this->_debugFile, 'a'); - $this->_debugIoAdapter->streamLock(); - $this->_debugIoAdapter->streamWrite($str); - $this->_debugIoAdapter->streamUnlock(); - $this->_debugIoAdapter->streamClose(); + + $stream = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT)->openFile($this->_debugFile, 'a'); + $stream->lock(); + $stream->write($str); + $stream->unlock(); + $stream->close(); } /** diff --git a/lib/Magento/Data/Collection/Filesystem.php b/lib/Magento/Data/Collection/Filesystem.php index f83f747419c..af7b79a08c9 100644 --- a/lib/Magento/Data/Collection/Filesystem.php +++ b/lib/Magento/Data/Collection/Filesystem.php @@ -233,7 +233,7 @@ class Filesystem extends \Magento\Data\Collection $dir = array($dir); } foreach ($dir as $folder) { - if ($nodes = glob($folder . DIRECTORY_SEPARATOR . '*')) { + if ($nodes = glob($folder . '/*')) { foreach ($nodes as $node) { $collectedResult[] = $node; } diff --git a/lib/Magento/Data/Form/Element/Gallery.php b/lib/Magento/Data/Form/Element/Gallery.php index 96f77f82eff..83a209404da 100644 --- a/lib/Magento/Data/Form/Element/Gallery.php +++ b/lib/Magento/Data/Form/Element/Gallery.php @@ -58,7 +58,7 @@ class Gallery extends \Magento\Data\Form\Element\AbstractElement $html = '<table id="gallery" class="gallery" border="0" cellspacing="3" cellpadding="0">'; $html .= '<thead id="gallery_thead" class="gallery"><tr class="gallery"><td class="gallery" valign="middle" align="center">Big Image</td><td class="gallery" valign="middle" align="center">Thumbnail</td><td class="gallery" valign="middle" align="center">Small Thumb</td><td class="gallery" valign="middle" align="center">Sort Order</td><td class="gallery" valign="middle" align="center">Delete</td></tr></thead>'; $widgetButton = $this->getForm()->getParent()->getLayout(); - $buttonHtml = $widgetButton->createBlock('Magento\Adminhtml\Block\Widget\Button') + $buttonHtml = $widgetButton->createBlock('Magento\Backend\Block\Widget\Button') ->setData( array( 'label' => 'Add New Image', diff --git a/lib/Magento/Data/Form/FormKey.php b/lib/Magento/Data/Form/FormKey.php index 32e9c84585c..743a58a881c 100644 --- a/lib/Magento/Data/Form/FormKey.php +++ b/lib/Magento/Data/Form/FormKey.php @@ -39,19 +39,17 @@ class FormKey protected $mathRandom; /** - * @var \Magento\Core\Model\Session\AbstractSession + * @var \Magento\Session\SessionManagerInterface */ protected $session; /** - * @todo Abstract session will be moved into libraries. Dependency from core module will be replaced. - * * @param \Magento\Math\Random $mathRandom - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session */ public function __construct( \Magento\Math\Random $mathRandom, - \Magento\Core\Model\Session\AbstractSession $session + \Magento\Session\SessionManagerInterface $session ) { $this->mathRandom = $mathRandom; $this->session = $session; diff --git a/lib/Magento/File/Uploader.php b/lib/Magento/File/Uploader.php index 13af9eb646c..b1f996da9f6 100644 --- a/lib/Magento/File/Uploader.php +++ b/lib/Magento/File/Uploader.php @@ -243,7 +243,7 @@ class Uploader if ($this->_result) { chmod($destinationFile, 0777); if ($this->_enableFilesDispersion) { - $fileName = str_replace(DIRECTORY_SEPARATOR, '/', + $fileName = str_replace('\\', '/', self::_addDirSeparator($this->_dispretionPath)) . $fileName; } $this->_uploadedFileName = $fileName; @@ -379,8 +379,8 @@ class Uploader */ static protected function _addDirSeparator($dir) { - if (substr($dir, -1) != DIRECTORY_SEPARATOR) { - $dir .= DIRECTORY_SEPARATOR; + if (substr($dir, -1) != '/') { + $dir .= '/'; } return $dir; } @@ -551,7 +551,7 @@ class Uploader return $this; } - if (substr($destinationFolder, -1) == DIRECTORY_SEPARATOR) { + if (substr($destinationFolder, -1) == '/') { $destinationFolder = substr($destinationFolder, 0, -1); } @@ -573,7 +573,7 @@ class Uploader if (file_exists($destinationFile)) { $index = 1; $baseName = $fileInfo['filename'] . '.' . $fileInfo['extension']; - while (file_exists($fileInfo['dirname'] . DIRECTORY_SEPARATOR . $baseName)) { + while (file_exists($fileInfo['dirname'] . '/' . $baseName)) { $baseName = $fileInfo['filename'] . '_' . $index . '.' . $fileInfo['extension']; $index++; } @@ -597,7 +597,7 @@ class Uploader $dispertionPath = ''; while (($char < 2) && ($char < strlen($fileName))) { if (empty($dispertionPath)) { - $dispertionPath = DIRECTORY_SEPARATOR + $dispertionPath = '/' . ('.' == $fileName[$char] ? '_' : $fileName[$char]); } else { $dispertionPath = self::_addDirSeparator($dispertionPath) diff --git a/lib/Magento/Filesystem.php b/lib/Magento/Filesystem.php index 9ab844fa1f6..c2af1340df3 100644 --- a/lib/Magento/Filesystem.php +++ b/lib/Magento/Filesystem.php @@ -25,529 +25,285 @@ */ namespace Magento; +use Magento\Filesystem\FilesystemException; + class Filesystem { - const DIRECTORY_SEPARATOR = '/'; + /**#@+ + * Content wrappers + */ + const WRAPPER_CONTENT_ZLIB = 'compress.zlib'; + const WRAPPER_CONTENT_PHAR = 'phar'; + const WRAPPER_CONTENT_RAR = 'rar'; + const WRAPPER_CONTENT_OGG = 'ogg'; + /**#@-*/ - /** - * @var \Magento\Filesystem\AdapterInterface + /**#@+ + * Directories for remote access */ - protected $_adapter; + const FTP = 'ftp'; + const FTPS = 'ftps'; + const SSH2 = 'ssh2'; + /**#@-*/ - /** - * @var string + /**#@+ + * Remote resource Access Protocols */ - protected $_workingDirectory; + const HTTP = 'http'; + const HTTPS = 'https'; + /**#@-*/ /** - * @var bool + * Custom application dirs */ - protected $_isAllowCreateDirs = false; + const PARAM_APP_DIRS = 'app_dirs'; /** - * @var int + * Code base root */ - protected $_newDirPermissions = 0777; + const ROOT = 'base'; /** - * Initialize adapter and default working directory. - * - * @param \Magento\Filesystem\AdapterInterface $adapter + * Most of entire application */ - public function __construct(\Magento\Filesystem\AdapterInterface $adapter) - { - $this->_adapter = $adapter; - $this->_workingDirectory = self::normalizePath(__DIR__ . '/../..'); - } + const APP = 'app'; /** - * Sets working directory to restrict operations with filesystem. - * - * @param string $dir - * @return \Magento\Filesystem - * @throws \InvalidArgumentException + * Modules */ - public function setWorkingDirectory($dir) - { - $dir = self::normalizePath($dir); - if (!$this->_adapter->isDirectory($dir)) { - throw new \InvalidArgumentException(sprintf('Working directory "%s" does not exists', $dir)); - } - $this->_workingDirectory = $dir; - return $this; - } + const MODULES = 'code'; /** - * Get current working directory. - * - * @return string + * Themes */ - public function getWorkingDirectory() - { - return $this->_workingDirectory; - } + const THEMES = 'design'; /** - * Allows to create directories when process operations - * - * @param bool $allow - * @param int $permissions - * @return \Magento\Filesystem + * Initial configuration of the application */ - public function setIsAllowCreateDirectories($allow, $permissions = null) - { - $this->_isAllowCreateDirs = (bool)$allow; - if (null !== $permissions) { - $this->_newDirPermissions = $permissions; - } - return $this; - } + const CONFIG = 'etc'; /** - * Checks the file existence. - * - * @param string $key - * @param string|null $workingDirectory - * @return bool + * Libraries or third-party components */ - public function has($key, $workingDirectory = null) - { - return $this->_adapter->exists($this->_getCheckedPath($key, $workingDirectory)); - } + const LIB = 'lib'; /** - * Reads content of the file. - * - * @param string $key - * @param string|null $workingDirectory - * @return string + * Files with translation of system labels and messages from en_US to other languages */ - public function read($key, $workingDirectory = null) - { - $path = $this->_getCheckedPath($key, $workingDirectory); - $this->_checkFileExists($path); - return $this->_adapter->read($path); - } + const LOCALE = 'i18n'; /** - * Writes content into the file. - * - * @param string $key - * @param string $content - * @param string|null $workingDirectory - * @return int The number of bytes that were written. + * \Directory within document root of a web-server to access static view files publicly */ - public function write($key, $content, $workingDirectory = null) - { - $path = $this->_getCheckedPath($key, $workingDirectory); - $this->ensureDirectoryExists(dirname($path)); - return $this->_adapter->write($path, $content); - } + const PUB = 'pub'; /** - * Deletes the key. - * - * @param string $key - * @param string|null $workingDirectory - * @return bool + * Libraries/components that need to be accessible publicly through web-server (such as various DHTML components) */ - public function delete($key, $workingDirectory = null) - { - $path = $this->_getCheckedPath($key, $workingDirectory); - return $this->_adapter->delete($path); - } + const PUB_LIB = 'pub_lib'; /** - * Renames the file. - * - * @param string $source - * @param string $target - * @param string|null $workingDirectory - * @param string|null $targetDirectory - * @return bool + * Storage of files entered or generated by the end-user */ - public function rename($source, $target, $workingDirectory = null, $targetDirectory = null) - { - if ($workingDirectory && null === $targetDirectory) { - $targetDirectory = $workingDirectory; - } - $sourcePath = $this->_getCheckedPath($source, $workingDirectory); - $targetPath = $this->_getCheckedPath($target, $targetDirectory); - $this->_checkExists($sourcePath); - $this->ensureDirectoryExists(dirname($targetPath), $this->_newDirPermissions, $targetDirectory); - return $this->_adapter->rename($sourcePath, $targetPath); - } + const MEDIA = 'media'; /** - * Copy the file. - * - * @param string $source - * @param string $target - * @param string|null $workingDirectory - * @param string|null $targetDirectory - * @return bool + * Storage of static view files that are needed on HTML-pages, emails or similar content */ - public function copy($source, $target, $workingDirectory = null, $targetDirectory = null) - { - if ($workingDirectory && null === $targetDirectory) { - $targetDirectory = $workingDirectory; - } - $sourcePath = $this->_getCheckedPath($source, $workingDirectory); - $targetPath = $this->_getCheckedPath($target, $targetDirectory); - $this->_checkFileExists($sourcePath); - $this->ensureDirectoryExists(dirname($targetPath), $this->_newDirPermissions, $targetDirectory); - return $this->_adapter->copy($sourcePath, $targetPath); - } + const STATIC_VIEW = 'static'; /** - * Check if key is directory. - * - * @param string $key - * @param string|null $workingDirectory - * @return bool + * Public view files, stored to avoid repetitive run-time calculation, and can be re-generated any time */ - public function isDirectory($key, $workingDirectory = null) - { - return $this->_adapter->isDirectory($this->_getCheckedPath($key, $workingDirectory)); - } + const PUB_VIEW_CACHE = 'view_cache'; /** - * Check if key is file. - * - * @param string $key - * @param string|null $workingDirectory - * @return bool + * Various files generated by the system in runtime */ - public function isFile($key, $workingDirectory = null) - { - return $this->_adapter->isFile($this->_getCheckedPath($key, $workingDirectory)); - } + const VAR_DIR = 'var'; /** - * Check if key exists and is writable - * - * @param string $key - * @param string|null $workingDirectory - * @return bool + * Temporary files */ - public function isWritable($key, $workingDirectory = null) - { - return $this->_adapter->isWritable($this->_getCheckedPath($key, $workingDirectory)); - } + const TMP = 'tmp'; /** - * Check if key exists and is readable - * - * @param string $key - * @param string|null $workingDirectory - * @return bool + * File system caching directory (if file system caching is used) */ - public function isReadable($key, $workingDirectory = null) - { - return $this->_adapter->isReadable($this->_getCheckedPath($key, $workingDirectory)); - } + const CACHE = 'cache'; /** - * Change permissions of key - * - * @param string $key - * @param int $permissions - * @param bool $recursively - * @param string|null $workingDirectory + * Logs of system messages and errors */ - public function changePermissions($key, $permissions, $recursively = false, $workingDirectory = null) - { - $this->_adapter->changePermissions($this->_getCheckedPath($key, $workingDirectory), $permissions, $recursively); - } + const LOG = 'log'; /** - * Gets list of all nested keys - * - * @param string $key - * @param string|null $workingDirectory - * @return array + * File system session directory (if file system session storage is used) */ - public function getNestedKeys($key, $workingDirectory = null) - { - return $this->_adapter->getNestedKeys($this->_getCheckedPath($key, $workingDirectory)); - } + const SESSION = 'session'; /** - * Gets list of all matched keys + * Dependency injection related file directory * - * @param string $baseDirectory - * @param string $pattern - * @return array */ - public function searchKeys($baseDirectory, $pattern) - { - $baseDirectory = $this->_getCheckedPath($baseDirectory); - $this->_checkPathInWorkingDirectory( - rtrim($baseDirectory, self::DIRECTORY_SEPARATOR) - . self::DIRECTORY_SEPARATOR - . ltrim($pattern, self::DIRECTORY_SEPARATOR) - ); - return $this->_adapter->searchKeys( - rtrim($baseDirectory, self::DIRECTORY_SEPARATOR) - . self::DIRECTORY_SEPARATOR - . ltrim(self::fixSeparator($pattern), self::DIRECTORY_SEPARATOR) - ); - } + const DI = 'di'; /** - * Creates new directory - * - * @param string $key - * @param int $permissions - * @param string|null $workingDirectory + * Relative directory key for generated code */ - public function createDirectory($key, $permissions = 0777, $workingDirectory = null) - { - $path = $this->_getCheckedPath($key, $workingDirectory); - $parentPath = dirname($path); - if (!$this->isDirectory($parentPath)) { - $this->createDirectory($parentPath, $permissions, $workingDirectory); - } - $this->_adapter->createDirectory($path, $permissions); - } + const GENERATION = 'generation'; /** - * Create directory if it does not exists. - * - * @param string $key - * @param int $permissions - * @param string|null $workingDirectory - * @throws \Magento\Filesystem\FilesystemException + * Temporary directory for uploading files by end-user */ - public function ensureDirectoryExists($key, $permissions = 0777, $workingDirectory = null) - { - if (!$this->isDirectory($key, $workingDirectory)) { - if ($this->_isAllowCreateDirs) { - $this->createDirectory($key, $permissions, $workingDirectory); - } else { - throw new \Magento\Filesystem\FilesystemException("Directory '$key' doesn't exist."); - } - } - } + const UPLOAD = 'upload'; /** - * Sets access and modification time of file. - * - * @param string $key - * @param int|null $fileModificationTime - * @param string|null $workingDirectory + * System base temporary folder */ - public function touch($key, $fileModificationTime = null, $workingDirectory = null) - { - $key = $this->_getCheckedPath($key, $workingDirectory); - $this->ensureDirectoryExists(dirname($key), $this->_newDirPermissions); - $this->_adapter->touch($key, $fileModificationTime); - } + const SYS_TMP = 'sys_tmp'; /** - * Get file modification time. - * - * @param string $key - * @param string|null $workingDirectory - * @return int + * @var \Magento\Filesystem\DirectoryList */ - public function getMTime($key, $workingDirectory = null) - { - $key = $this->_getCheckedPath($key, $workingDirectory); - $this->_checkExists($key); - return $this->_adapter->getMTime($key); - } + protected $directoryList; /** - * Get file size. - * - * @param string $key - * @param string|null $workingDirectory - * @return int + * @var \Magento\Filesystem\Directory\ReadFactory */ - public function getFileSize($key, $workingDirectory = null) - { - $key = $this->_getCheckedPath($key, $workingDirectory); - $this->_checkFileExists($key); - return $this->_adapter->getFileSize($key); - } + protected $readFactory; /** - * Creates stream object - * - * @param string $key - * @param string|null $workingDirectory - * @return \Magento\Filesystem\StreamInterface - * @throws \Magento\Filesystem\FilesystemException + * @var \Magento\Filesystem\Directory\WriteFactory */ - public function createStream($key, $workingDirectory = null) - { - $key = $this->_getCheckedPath($key, $workingDirectory); - if ($this->_adapter instanceof \Magento\Filesystem\Stream\FactoryInterface) { - return $this->_adapter->createStream($key); - } else { - throw new \Magento\Filesystem\FilesystemException("Filesystem doesn't support streams."); - } - } + protected $writeFactory; /** - * Creates stream object and opens it - * - * @param string $key - * @param \Magento\Filesystem\Stream\Mode|string $mode - * @param string|null $workingDirectory - * @return \Magento\Filesystem\StreamInterface - * @throws \InvalidArgumentException + * @var \Magento\Filesystem\File\ReadFactory */ - public function createAndOpenStream($key, $mode, $workingDirectory = null) - { - $stream = $this->createStream($key, $workingDirectory); - if (!$mode instanceof \Magento\Filesystem\Stream\Mode && !is_string($mode)) { - throw new \InvalidArgumentException('Wrong mode parameter'); - } - $stream->open($mode); - return $stream; - } + protected $fileReadFactory; /** - * Calculates the md5 hash of a given file - * - * @param string $key - * @param string $workingDirectory - * @return string + * @var \Magento\Filesystem\Directory\ReadInterface[] */ - public function getFileMd5($key, $workingDirectory = null) - { - $key = $this->_getCheckedPath($key, $workingDirectory); - $this->_checkFileExists($key); - return $this->_adapter->getFileMd5($key); - } + protected $readInstances = array(); /** - * Check that file exists - * - * @param string $path - * @throws \InvalidArgumentException + * @var \Magento\Filesystem\WrapperFactory */ - protected function _checkFileExists($path) - { - if (!$this->_adapter->isFile($path)) { - throw new \InvalidArgumentException(sprintf('"%s" does not exists', $path)); - } - } + protected $wrapperFactory; + + /** + * @var \Magento\Filesystem\Directory\WriteInterface[] + */ + protected $writeInstances = array(); /** - * Check that file or directory exists - * - * @param string $path - * @throws \InvalidArgumentException + * @var \Magento\Filesystem\File\ReadInterface[] */ - protected function _checkExists($path) - { - if (!$this->_adapter->exists($path)) { - throw new \InvalidArgumentException(sprintf('"%s" does not exists', $path)); - } - } + protected $remoteResourceInstances = array(); /** - * Get absolute checked path - * - * @param string $key - * @param string|null $workingDirectory - * @return string + * @param Filesystem\DirectoryList $directoryList + * @param Filesystem\Directory\ReadFactory $readFactory + * @param Filesystem\Directory\WriteFactory $writeFactory + * @param Filesystem\File\ReadFactory $fileReadFactory + * @param Filesystem\File\WriteFactory $fileWriteFactory */ - protected function _getCheckedPath($key, $workingDirectory = null) - { - $this->_checkPathInWorkingDirectory($key, $workingDirectory); - return self::normalizePath($key); + public function __construct( + \Magento\Filesystem\DirectoryList $directoryList, + \Magento\Filesystem\Directory\ReadFactory $readFactory, + \Magento\Filesystem\Directory\WriteFactory $writeFactory, + \Magento\Filesystem\File\ReadFactory $fileReadFactory = null, + \Magento\Filesystem\File\WriteFactory $fileWriteFactory = null + ) { + $this->directoryList = $directoryList; + $this->readFactory = $readFactory; + $this->writeFactory = $writeFactory; + $this->fileReadFactory = $fileReadFactory; + $this->fileWriteFactory = $fileWriteFactory; + + $this->driverFactory = new \Magento\Filesystem\DriverFactory($this->directoryList); } /** - * Asserts path in working directory + * Create an instance of directory with write permissions * - * @param string $key - * @param string|null $workingDirectory - * @return string - * @throws \InvalidArgumentException + * @param string $code + * @return \Magento\Filesystem\Directory\ReadInterface */ - protected function _checkPathInWorkingDirectory($key, $workingDirectory = null) + public function getDirectoryRead($code) { - $workingDirectory = $workingDirectory ? $workingDirectory : $this->_workingDirectory; - if (!$this->isPathInDirectory($key, $workingDirectory)) { - throw new \InvalidArgumentException("Path '$key' is out of working directory '$workingDirectory'"); + if (!array_key_exists($code, $this->readInstances)) { + $config = $this->directoryList->getConfig($code); + $this->readInstances[$code] = $this->readFactory->create($config, $this->driverFactory); } + return $this->readInstances[$code]; } /** - * Normalize the specified path by removing excessive '.', '..' and fixing directory separator + * Create an instance of directory with read permissions * - * @param string $path - * @param bool $isRelative Flag that identify, that filename is relative, so '..' at the beginning is supported - * @return string - * @throws \Magento\Filesystem\FilesystemException if file can't be normalized + * @param string $code + * @return \Magento\Filesystem\Directory\WriteInterface + * @throws \Magento\Filesystem\FilesystemException */ - public static function normalizePath($path, $isRelative = false) + public function getDirectoryWrite($code) { - $fixedPath = self::fixSeparator($path); - $parts = explode(self::DIRECTORY_SEPARATOR, $fixedPath); - $result = array(); - - foreach ($parts as $part) { - if ('..' === $part) { - if ($isRelative) { - if (!count($result) || ($result[count($result) - 1] == '..')) { - $result[] = $part; - } else { - array_pop($result); - } - } else if (!array_pop($result)) { - throw new \Magento\Filesystem\FilesystemException("Invalid path '{$path}'."); - } - } else if ('.' !== $part) { - $result[] = $part; + if (!array_key_exists($code, $this->writeInstances)) { + $config = $this->directoryList->getConfig($code); + if (isset($config['read_only']) && $config['read_only']) { + throw new FilesystemException(sprintf('The "%s" directory doesn\'t allow write operations', $code)); } + + $this->writeInstances[$code] = $this->writeFactory->create($config, $this->driverFactory); } - return implode(self::DIRECTORY_SEPARATOR, $result); + return $this->writeInstances[$code]; } /** - * Update directory separator - * - * @static * @param string $path - * @return string + * @param string $protocol + * @return mixed */ - public static function fixSeparator($path) + public function getRemoteResource($path, $protocol) { - return rtrim(str_replace('\\', self::DIRECTORY_SEPARATOR, $path), self::DIRECTORY_SEPARATOR); + if (!$this->fileReadFactory) { + // case when a temporary Filesystem object is used for loading primary configuration + return null; + } + + if (!array_key_exists($protocol, $this->remoteResourceInstances)) { + $this->remoteResourceInstances[$protocol] + = $this->fileReadFactory->create($path, $protocol); + } + return $this->remoteResourceInstances[$protocol]; } /** - * Checks is directory contains path + * Retrieve absolute path for for given code * - * @param string $path - * @param string $directory - * @return bool + * @param string $code + * @return string */ - public function isPathInDirectory($path, $directory) + public function getPath($code = self::ROOT) { - return 0 === strpos(self::normalizePath($path), self::normalizePath($directory)); + $config = $this->directoryList->getConfig($code); + $path = isset($config['path']) ? $config['path'] : ''; + return str_replace('\\', '/', $path); } /** - * Check LFI protection + * Retrieve uri for given code * - * @throws \InvalidArgumentException - * @param string $name - * @return bool + * @param string $code + * @return string */ - public function checkLfiProtection($name) + public function getUri($code) { - if (preg_match('#\.\.[\\\/]#', $name)) { - throw new \InvalidArgumentException( - 'Requested file may not include parent directory traversal ("../", "..\\" notation)' - ); - } - return true; + $config = $this->directoryList->getConfig($code); + return isset($config['uri']) ? $config['uri'] : ''; } + } diff --git a/lib/Magento/Filesystem/Adapter/Local.php b/lib/Magento/Filesystem/Adapter/Local.php deleted file mode 100644 index a7d1626b5cb..00000000000 --- a/lib/Magento/Filesystem/Adapter/Local.php +++ /dev/null @@ -1,371 +0,0 @@ -<?php -/** - * Adapter for local filesystem - * - * 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) 2013 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\Adapter; - -class Local implements - \Magento\Filesystem\AdapterInterface, - \Magento\Filesystem\Stream\FactoryInterface -{ - /** - * Checks the file existence. - * - * @param string $key - * @return bool - */ - public function exists($key) - { - return file_exists($key); - } - - /** - * Reads content of the file. - * - * @param string $key - * @return string - * @throws \Magento\Filesystem\FilesystemException - */ - public function read($key) - { - $result = @file_get_contents($key); - if (false === $result) { - throw new \Magento\Filesystem\FilesystemException("Failed to read contents of '{$key}'"); - } - return $result; - } - - /** - * Writes content into the file. - * - * @param string $key - * @param string $content - * @return bool true if write was success - * @throws \Magento\Filesystem\FilesystemException - */ - public function write($key, $content) - { - $result = @file_put_contents($key, $content); - if (false === $result) { - throw new \Magento\Filesystem\FilesystemException("Failed to write contents to '{$key}'"); - } - return true; - } - - /** - * Renames the file. - * - * @param string $source - * @param string $target - * @return bool - * @throws \Magento\Filesystem\FilesystemException - */ - public function rename($source, $target) - { - $result = @rename($source, $target); - if (!$result) { - throw new \Magento\Filesystem\FilesystemException("Failed to rename '{$source}' to '{$target}'"); - } - return true; - } - - /** - * Copy the file. - * - * @param string $source - * @param string $target - * @return bool - * @throws \Magento\Filesystem\FilesystemException - */ - public function copy($source, $target) - { - $result = @copy($source, $target); - if (!$result) { - throw new \Magento\Filesystem\FilesystemException("Failed to copy '{$source}' to '{$target}'"); - } - return true; - } - - /** - * Calculates the MD5 hash of the file specified - * - * @param $key - * @return string - * @throws \Magento\Filesystem\FilesystemException - */ - public function getFileMd5($key) - { - $hash = @md5_file($key); - if (false === $hash) { - throw new \Magento\Filesystem\FilesystemException("Failed to get hash of '{$key}'"); - } - return $hash; - } - - /** - * Deletes the file or directory recursively. - * - * @param string $key - * @throws \Magento\Filesystem\FilesystemException - */ - public function delete($key) - { - if (!file_exists($key) && !is_link($key)) { - return; - } - - if (is_file($key) || is_link($key)) { - if (true !== @unlink($key)) { - throw new \Magento\Filesystem\FilesystemException("Failed to remove file '{$key}'"); - } - return; - } - - $this->_deleteNestedKeys($key); - - if (true !== @rmdir($key)) { - throw new \Magento\Filesystem\FilesystemException("Failed to remove directory '{$key}'"); - } - } - - /** - * Deletes all nested keys - * - * @param string $key - * @throws \Magento\Filesystem\FilesystemException - */ - protected function _deleteNestedKeys($key) - { - foreach ($this->getNestedKeys($key) as $nestedKey) { - if (is_dir($nestedKey) && !is_link($nestedKey)) { - if (true !== @rmdir($nestedKey)) { - throw new \Magento\Filesystem\FilesystemException("Failed to remove directory '{$nestedKey}'"); - } - } else { - // https://bugs.php.net/bug.php?id=52176 - if (defined('PHP_WINDOWS_VERSION_MAJOR') && is_dir($nestedKey)) { - if (true !== @rmdir($nestedKey)) { - throw new \Magento\Filesystem\FilesystemException("Failed to remove file '{$nestedKey}'"); - } - } else { - if (true !== @unlink($nestedKey)) { - throw new \Magento\Filesystem\FilesystemException("Failed to remove file '{$nestedKey}'"); - } - } - } - } - } - - /** - * Changes permissions of filesystem key - * - * @param string $key - * @param int $permissions - * @param bool $recursively - * @throws \Magento\Filesystem\FilesystemException - */ - public function changePermissions($key, $permissions, $recursively) - { - if (!@chmod($key, $permissions)) { - throw new \Magento\Filesystem\FilesystemException("Failed to change mode of '{$key}'"); - } - - if (is_dir($key) && $recursively) { - foreach ($this->getNestedKeys($key) as $nestedKey) { - if (!@chmod($nestedKey, $permissions)) { - throw new \Magento\Filesystem\FilesystemException("Failed to change mode of '{$nestedKey}'"); - } - } - } - } - - /** - * Gets list of all nested keys - * - * @param string $key - * @return array - * @throws \Magento\Filesystem\FilesystemException - */ - public function getNestedKeys($key) - { - $result = array(); - - if (!is_dir($key)) { - throw new \Magento\Filesystem\FilesystemException("The directory '{$key}' does not exist."); - } - - try { - $iterator = new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($key, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS), - \RecursiveIteratorIterator::CHILD_FIRST - ); - } catch (\Exception $e) { - $iterator = new \EmptyIterator; - } - - - /** @var \SplFileInfo $file */ - foreach ($iterator as $file) { - $result[] = $file->getPathname(); - } - - return $result; - } - - /** - * Gets list of all matched keys - * - * @param string $pattern - * @return array - * @throws \Magento\Filesystem\FilesystemException - */ - public function searchKeys($pattern) - { - $result = @glob($pattern); - if (false === $result) { - throw new \Magento\Filesystem\FilesystemException("Failed to resolve the file pattern '{$pattern}'"); - } - return $result; - } - - /** - * Check if key is a directory. - * - * @param string $key - * @return bool - */ - public function isDirectory($key) - { - return is_dir($key); - } - - /** - * Check if key is a file. - * - * @param string $key - * @return bool - */ - public function isFile($key) - { - return is_file($key); - } - - /** - * Check if key exists and is writable - * - * @param string $key - * @return bool - */ - public function isWritable($key) - { - return is_writable($key); - } - - /** - * Check if key exists and is readable - * - * @param string $key - * @return bool - */ - public function isReadable($key) - { - return is_readable($key); - } - - /** - * Creates new directory - * - * @param string $key - * @param int $mode - * @throws \Magento\Filesystem\FilesystemException - */ - public function createDirectory($key, $mode) - { - if (!@mkdir($key, $mode, true)) { - throw new \Magento\Filesystem\FilesystemException("Failed to create '{$key}'"); - } - } - - /** - * Touches a file - * - * @param string $key - * @param int|null $fileModificationTime - * @throws \Magento\Filesystem\FilesystemException - */ - public function touch($key, $fileModificationTime = null) - { - if ($fileModificationTime === null) { - $success = @touch($key); - } else { - $success = @touch($key, $fileModificationTime); - } - if (!$success) { - throw new \Magento\Filesystem\FilesystemException("Failed to touch '{$key}'"); - } - } - - /** - * Get file modification time. - * - * @param string $key - * @return int - * @throws \Magento\Filesystem\FilesystemException - */ - public function getMTime($key) - { - $mtime = @filemtime($key); - if (false === $mtime) { - throw new \Magento\Filesystem\FilesystemException("Failed to get modification time of '{$key}'"); - } - return $mtime; - } - - /** - * Get file size. - * - * @param string $key - * @return int - * @throws \Magento\Filesystem\FilesystemException - */ - public function getFileSize($key) - { - $size = @filesize($key); - if (false === $size) { - throw new \Magento\Filesystem\FilesystemException("Failed to get file size of '{$key}'"); - } - return $size; - } - - /** - * Create stream object - * - * @param string $path - * @return \Magento\Filesystem\Stream\Local - */ - public function createStream($path) - { - return new \Magento\Filesystem\Stream\Local($path); - } -} diff --git a/lib/Magento/Filesystem/Adapter/Zlib.php b/lib/Magento/Filesystem/Adapter/Zlib.php deleted file mode 100644 index 67a3213ef3d..00000000000 --- a/lib/Magento/Filesystem/Adapter/Zlib.php +++ /dev/null @@ -1,131 +0,0 @@ -<?php -/** - * Adapter for local compressed filesystem - * - * 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) 2013 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\Adapter; - -class Zlib extends \Magento\Filesystem\Adapter\Local -{ - /** - * @var int - */ - protected $_compressRatio; - - /** - * @var string - */ - protected $_strategy; - - /** - * @var null|bool - */ - protected $_hasCompression = null; - - /** - * Initialize Zlib adapter. - * - * @param int $ratio - * @param string $strategy - */ - public function __construct($ratio = 1, $strategy = '') - { - $this->_compressRatio = $ratio; - $this->_strategy = $strategy; - } - - /** - * Read compressed file file - * - * @param string $key - * @return string - * @throws \Magento\Filesystem\FilesystemException - */ - public function read($key) - { - $stream = $this->createStream($key); - $stream->open('rb'); - - $info = unpack("lcompress/llength", $stream->read(8)); - - $compressed = (bool)$info['compress']; - if ($compressed && !$this->_isCompressionAvailable()) { - $stream->close(); - throw new \Magento\Filesystem\FilesystemException( - 'The file was compressed, but zlib extension is not installed.' - ); - } - if ($compressed) { - $content = gzuncompress($stream->read($info['length'])); - } else { - $content = $stream->read($info['length']); - } - - $stream->close(); - return $content; - } - - /** - * Write compressed file. - * - * @param string $key - * @param string $content - * @return bool - */ - public function write($key, $content) - { - $compress = $this->_isCompressionAvailable(); - if ($compress) { - $rawContent = gzcompress($content, $this->_compressRatio); - } else { - $rawContent = $content; - } - - $fileHeaders = pack("ll", (int)$compress, strlen($rawContent)); - return parent::write($key, $fileHeaders . $rawContent); - } - - /** - * Create Zlib stream - * - * @param string $path - * @return \Magento\Filesystem\Stream\Zlib - */ - public function createStream($path) - { - return new \Magento\Filesystem\Stream\Zlib($path); - } - - /** - * Check that zlib extension loaded. - * - * @return bool - */ - protected function _isCompressionAvailable() - { - if (is_null($this->_hasCompression)) { - $this->_hasCompression = extension_loaded("zlib"); - } - return $this->_hasCompression; - } -} diff --git a/lib/Magento/Filesystem/AdapterInterface.php b/lib/Magento/Filesystem/AdapterInterface.php deleted file mode 100644 index 25c16c1f575..00000000000 --- a/lib/Magento/Filesystem/AdapterInterface.php +++ /dev/null @@ -1,183 +0,0 @@ -<?php -/** - * Interface of Magento filesystem adapter - * - * 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) 2013 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; - -interface AdapterInterface -{ - /** - * Checks the file existence. - * - * @param string $key - * @return bool - */ - public function exists($key); - - /** - * Reads content of the file. - * - * @param string $key - * @return string - */ - public function read($key); - - /** - * Writes content into the file. - * - * @param string $key - * @param string $content - * @return bool true if write was success - */ - public function write($key, $content); - - /** - * Renames the file. - * - * @param string $source - * @param string $target - * @return bool - */ - public function rename($source, $target); - - /** - * Copy the file. - * - * @param string $source - * @param string $target - * @return bool - */ - public function copy($source, $target); - - /** - * Deletes the file or directory recursively. - * - * @param string $key - * @throws \Magento\Filesystem\FilesystemException - */ - public function delete($key); - - /** - * Changes permissions of filesystem key - * - * @param string $key - * @param int $permissions - * @param bool $recursively - * @throws \Magento\Filesystem\FilesystemException - */ - public function changePermissions($key, $permissions, $recursively); - - /** - * Gets list of all nested keys - * - * @param string $key - * @return array - * @throws \Magento\Filesystem\FilesystemException - */ - public function getNestedKeys($key); - - /** - * Gets list of all matched keys - * - * @param string $pattern - * @return array - * @throws \Magento\Filesystem\FilesystemException - */ - public function searchKeys($pattern); - - /** - * Check if key is directory. - * - * @param string $key - * @return bool - */ - public function isDirectory($key); - - /** - * Check if key is file. - * - * @param string $key - * @return bool - */ - public function isFile($key); - - /** - * Check if file exists and is writable - * - * @param string $key - * @return bool - */ - public function isWritable($key); - - /** - * Check if file exists and is readable - * - * @param string $key - * @return bool - */ - public function isReadable($key); - - /** - * Calculates the MD5 hash of the file specified - * - * @param $key - * @return string - * @throws \Magento\Filesystem\FilesystemException - */ - public function getFileMd5($key); - - /** - * Creates new directory - * - * @param string $key - * @param int $mode - * @throws \Magento\Filesystem\FilesystemException If cannot create directory - */ - public function createDirectory($key, $mode); - - /** - * Touches a file - * - * @param string $key - * @param int|null $fileModificationTime - * @throws \Magento\Filesystem\FilesystemException - */ - public function touch($key, $fileModificationTime = null); - - /** - * Get file modification time. - * - * @param string $key - * @return int - */ - public function getMTime($key); - - /** - * Get file size. - * - * @param string $key - * @return int - */ - public function getFileSize($key); -} diff --git a/lib/Magento/Filesystem/Directory/Read.php b/lib/Magento/Filesystem/Directory/Read.php index 2a25785a916..debaafdec96 100644 --- a/lib/Magento/Filesystem/Directory/Read.php +++ b/lib/Magento/Filesystem/Directory/Read.php @@ -18,6 +18,8 @@ * 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 * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,59 +31,103 @@ use Magento\Filesystem\FilesystemException; class Read implements ReadInterface { /** + * Directory path + * * @var string */ protected $path; /** + * @var string + */ + protected $scheme; + + /** + * File factory + * * @var \Magento\Filesystem\File\ReadFactory */ protected $fileFactory; /** - * @param string $path + * Filesystem driver + * + * @var \Magento\Filesystem\DriverInterface + */ + protected $driver; + + /** + * Constructor. Set properties. + * + * @param array $config * @param \Magento\Filesystem\File\ReadFactory $fileFactory + * @param \Magento\Filesystem\DriverInterface $driver */ - public function __construct($path, \Magento\Filesystem\File\ReadFactory $fileFactory) - { - $this->path = rtrim($path, '/') . '/'; + public function __construct + ( + array $config, + \Magento\Filesystem\File\ReadFactory $fileFactory, + \Magento\Filesystem\DriverInterface $driver + ) { + $this->setProperties($config); $this->fileFactory = $fileFactory; + $this->driver = $driver; } /** + * Set properties from config + * + * @param array $config + * @throws \Magento\Filesystem\FilesystemException + */ + protected function setProperties(array $config) + { + if (!empty($config['path'])) { + $this->path = rtrim(str_replace('\\', '/', $config['path']), '/') . '/'; + } + + if (!empty($config['protocol'])) { + $this->scheme = $config['protocol']; + } + } + + /** + * Retrieves absolute path + * E.g.: /var/www/application/file.txt + * * @param string $path + * @param string $schema * @return string */ - public function getAbsolutePath($path) + public function getAbsolutePath($path = null, $schema = null) { - return $this->path . ltrim($path, '/'); + return $this->driver->getAbsolutePath($this->path, $path, $schema); } /** + * Retrieves relative path + * * @param string $path * @return string */ - protected function getRelativePath($path) + public function getRelativePath($path = null) { - if (strpos($path, $this->path) === 0) { - $result = substr($path, strlen($this->path)); - } else { - $result = $path; - } - return $result; + return $this->driver->getRelativePath($this->path, $path); } - /** * Validate of path existence * * @param string $path - * @throws FilesystemException + * @return bool + * @throws \Magento\Filesystem\FilesystemException */ protected function assertExist($path) { - if ($this->isExist($path) === false) { - throw new FilesystemException(sprintf('The path "%s" doesn\'t exist', $this->getAbsolutePath($path))); + $absolutePath = $this->driver->getAbsolutePath($this->path, $path); + if ($this->driver->isExists($absolutePath) === false) { + throw new FilesystemException(sprintf('The path "%s" doesn\'t exist', $absolutePath)); } + return true; } /** @@ -95,12 +141,13 @@ class Read implements ReadInterface $this->assertExist($path); $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS; - $iterator = new \FilesystemIterator($this->getAbsolutePath($path), $flags); + $iterator = new \FilesystemIterator($this->driver->getAbsolutePath($this->path, $path), $flags); $result = array(); /** @var \FilesystemIterator $file */ foreach ($iterator as $file) { $result[] = $this->getRelativePath($file->getPathname()); } + sort($result); return $result; } @@ -108,16 +155,22 @@ class Read implements ReadInterface * Search all entries for given regex pattern * * @param string $pattern + * @param string $path [optional] * @return array */ - public function search($pattern) + public function search($pattern, $path = null) { clearstatcache(); + if ($path) { + $absolutePath = $this->driver->getAbsolutePath($this->path, $this->getRelativePath($path)); + } else { + $absolutePath = $this->path; + } $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS; $iterator = new \RegexIterator( new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($this->path, $flags) + new \RecursiveDirectoryIterator($absolutePath, $flags), \RecursiveIteratorIterator::CHILD_FIRST ), $pattern ); @@ -126,20 +179,20 @@ class Read implements ReadInterface foreach ($iterator as $file) { $result[] = $this->getRelativePath($file->getPathname()); } + sort($result); return $result; } /** * Check a file or directory exists * - * @param string|null $path + * @param string $path [optional] * @return bool + * @throws \Magento\Filesystem\FilesystemException */ public function isExist($path = null) { - clearstatcache(); - - return file_exists($this->getAbsolutePath($path)); + return $this->driver->isExists($this->driver->getAbsolutePath($this->path, $path)); } /** @@ -147,12 +200,12 @@ class Read implements ReadInterface * * @param string $path * @return array + * @throws \Magento\Filesystem\FilesystemException */ public function stat($path) { $this->assertExist($path); - - return stat($this->getAbsolutePath($path)); + return $this->driver->stat($this->driver->getAbsolutePath($this->path, $path)); } /** @@ -160,41 +213,77 @@ class Read implements ReadInterface * * @param string $path * @return bool + * @throws \Magento\Filesystem\FilesystemException */ public function isReadable($path) { - clearstatcache(); - - return is_readable($this->getAbsolutePath($path)); + return $this->driver->isReadable($this->driver->getAbsolutePath($this->path, $path)); } /** * Open file in read mode * * @param string $path + * @param string|null $protocol + * * @return \Magento\Filesystem\File\ReadInterface */ - public function openFile($path) + public function openFile($path, $protocol = null) { - return $this->fileFactory->create($this->getAbsolutePath($path)); + return $this->fileFactory->create($this->driver->getAbsolutePath($this->path, $path), $protocol, $this->driver); } /** * Retrieve file contents from given path * * @param string $path + * @param string|null $flag + * @param resource|null $context + * @param string|null $protocol * @return string * @throws FilesystemException */ - public function readFile($path) + public function readFile($path, $flag = null, $context = null, $protocol = null) { - $absolutePath = $this->getAbsolutePath($path); - clearstatcache(); - if (is_file($absolutePath) === false) { - throw new FilesystemException( - sprintf('The file "%s" either doesn\'t exist or not a file', $absolutePath) - ); - } - return file_get_contents($absolutePath); + $absolutePath = $this->driver->getAbsolutePath($this->path, $path, $protocol); + + /** @var \Magento\Filesystem\File\Read $fileReader */ + $fileReader = $this->fileFactory->create($absolutePath, $protocol, $this->driver); + return $fileReader->readAll($flag, $context); + } + + /** + * Check whether given path is file + * + * @param string $path + * @return bool + */ + public function isFile($path) + { + return $this->driver->isFile($this->driver->getAbsolutePath($this->path, $path)); + } + + /** + * Check whether given path is directory + * + * @param string $path + * @return bool + */ + public function isDirectory($path) + { + 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); } -} \ No newline at end of file +} diff --git a/lib/Magento/Filesystem/Directory/ReadFactory.php b/lib/Magento/Filesystem/Directory/ReadFactory.php new file mode 100644 index 00000000000..575d902a90a --- /dev/null +++ b/lib/Magento/Filesystem/Directory/ReadFactory.php @@ -0,0 +1,44 @@ +<?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) 2013 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\Directory; + +class ReadFactory +{ + /** + * Create a readable directory + * + * @param array $config + * @param \Magento\Filesystem\DriverFactory $driverFactory + * @return \Magento\Filesystem\File\ReadInterface + */ + public function create(array $config, \Magento\Filesystem\DriverFactory $driverFactory) + { + $directoryDriver = isset($config['driver']) ? $config['driver'] : null; + $driver = $driverFactory->get($directoryDriver); + $factory = new \Magento\Filesystem\File\ReadFactory($driverFactory); + + return new \Magento\Filesystem\Directory\Read($config, $factory, $driver); + } +} \ No newline at end of file diff --git a/lib/Magento/Filesystem/Directory/ReadInterface.php b/lib/Magento/Filesystem/Directory/ReadInterface.php index b663a30390c..893f137718c 100644 --- a/lib/Magento/Filesystem/Directory/ReadInterface.php +++ b/lib/Magento/Filesystem/Directory/ReadInterface.php @@ -28,18 +28,26 @@ interface ReadInterface /** * Get absolute path * - * @param string $path + * @param string $path [optional] * @return string mixed */ - public function getAbsolutePath($path); + public function getAbsolutePath($path = null); /** - * Retrieve list of all entities in given path + * Get relative path * * @param string $path + * @return string + */ + public function getRelativePath($path = null); + + /** + * Retrieve list of all entities in given path + * + * @param string $path [optional] * @return array */ - public function read($path); + public function read($path = null); /** * Search all entries for given regex pattern @@ -52,10 +60,10 @@ interface ReadInterface /** * Check a file or directory exists * - * @param string $path + * @param string $path [optional] * @return bool */ - public function isExist($path); + public function isExist($path = null); /** * Gathers the statistics of the given path @@ -73,6 +81,22 @@ interface ReadInterface */ public function isReadable($path); + /** + * Check whether given path is file + * + * @param string $path + * @return bool + */ + public function isFile($path); + + /** + * Check whether given path is directory + * + * @param string $path + * @return bool + */ + public function isDirectory($path); + /** * Open file in read mode * @@ -85,8 +109,19 @@ interface ReadInterface * Retrieve file contents from given path * * @param string $path + * @param string|null $flag + * @param resource|null $context * @return string * @throws \Magento\Filesystem\FilesystemException */ - public function readFile($path); + 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 3ff27809ea1..bd176cd29bf 100644 --- a/lib/Magento/Filesystem/Directory/Write.php +++ b/lib/Magento/Filesystem/Directory/Write.php @@ -31,51 +31,79 @@ use Magento\Filesystem\FilesystemException; class Write extends Read implements WriteInterface { /** + * Is directory creation + * + * @var bool + */ + protected $allowCreateDirs; + + /** + * Permissions for new directories and files + * * @var int */ - protected $permissions; + protected $permissions = 0777; /** - * @param string $path + * Constructor + * + * @param array $config * @param \Magento\Filesystem\File\WriteFactory $fileFactory - * @param $permissions + * @param \Magento\Filesystem\DriverInterface $driver */ - public function __construct($path, \Magento\Filesystem\File\WriteFactory $fileFactory, $permissions) - { - $this->path = rtrim($path, '/') . '/'; + public function __construct + ( + array $config, + \Magento\Filesystem\File\WriteFactory $fileFactory, + \Magento\Filesystem\DriverInterface $driver + ) { + $this->setProperties($config); $this->fileFactory = $fileFactory; - $this->permissions = $permissions; + $this->driver = $driver; } /** - * Check it directory is writable + * Set properties from config + * + * @param array $config + * @throws \Magento\Filesystem\FilesystemException + */ + protected function setProperties(array $config) + { + parent::setProperties($config); + if (isset($config['permissions'])) { + $this->permissions = $config['permissions']; + } + if (isset($config['allow_create_dirs'])) { + $this->allowCreateDirs = (bool) $config['allow_create_dirs']; + } + } + + /** + * Check if directory is writable * * @throws \Magento\Filesystem\FilesystemException */ protected function assertWritable($path) { - clearstatcache(); - $absolutePath = $this->getAbsolutePath($path); - if (is_writable($absolutePath) === false) { - throw new FilesystemException(sprintf('The path "%s" is not writable', $absolutePath)); + if ($this->isWritable($path) === false) { + $path = $this->getAbsolutePath($this->path, $path); + throw new FilesystemException(sprintf('The path "%s" is not writable', $path)); } } /** - * Recursively asserts parent folder are either not exists or exists and have write permissions + * Check if given path is exists and is file * - * @param string $absolutePath + * @param string $path * @throws \Magento\Filesystem\FilesystemException */ - protected function assertParentsWritable($absolutePath) + protected function assertIsFile($path) { clearstatcache(); - if (!is_writable($absolutePath)) { - if (file_exists($absolutePath)) { - throw new FilesystemException(sprintf('The path "%s" is not writable', $absolutePath)); - } else { - $this->assertParentsWritable(dirname($absolutePath)); - } + $absolutePath = $this->driver->getAbsolutePath($this->path, $path); + if (!$this->driver->isFile($absolutePath)) { + throw new FilesystemException(sprintf('The "%s" file doesn\'t exist or not a file', $absolutePath)); } } @@ -86,26 +114,17 @@ class Write extends Read implements WriteInterface * @return bool * @throws FilesystemException */ - public function create($path) + public function create($path = null) { - clearstatcache(); - $absolutePath = $this->getAbsolutePath($path); - if (is_dir($absolutePath)) { + $absolutePath = $this->driver->getAbsolutePath($this->path, $path); + if ($this->driver->isDirectory($absolutePath)) { return true; - } elseif (is_file($absolutePath)) { - throw new FilesystemException(sprintf('The "%s" file already exists', $absolutePath)); - } - $this->assertParentsWritable($absolutePath); - - $result = mkdir($absolutePath, $this->permissions, true); - if ($result === false) { - throw new FilesystemException(sprintf('Directory "%s" cannot be created', $absolutePath)); } - return $result; + return $this->driver->createDirectory($absolutePath, $this->permissions); } /** - * Renames a source to into new name + * Rename a file * * @param string $path * @param string $newPath @@ -113,20 +132,17 @@ class Write extends Read implements WriteInterface * @return bool * @throws FilesystemException */ - public function rename($path, $newPath, WriteInterface $targetDirectory = null) + public function renameFile($path, $newPath, WriteInterface $targetDirectory = null) { - $this->assertExist($path); - + $this->assertIsFile($path); $targetDirectory = $targetDirectory ? : $this; - if (!$targetDirectory->isExist(dirname($newPath))) { - $targetDirectory->create(dirname($newPath)); + if (!$targetDirectory->isExist($this->driver->getParentDirectory($newPath))) { + $targetDirectory->create($this->driver->getParentDirectory($newPath)); } - - $absolutePath = $this->getAbsolutePath($path); - $absoluteNewPath = $targetDirectory->getAbsolutePath($newPath); - - $result = rename($absolutePath, $absoluteNewPath); - if ($result === null) { + $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) ); @@ -135,7 +151,7 @@ class Write extends Read implements WriteInterface } /** - * Copy a source to into destination + * Copy a file * * @param string $path * @param string $destination @@ -143,22 +159,21 @@ class Write extends Read implements WriteInterface * @return bool * @throws FilesystemException */ - public function copy($path, $destination, WriteInterface $targetDirectory = null) + public function copyFile($path, $destination, WriteInterface $targetDirectory = null) { - $this->assertExist($path); + $this->assertIsFile($path); $targetDirectory = $targetDirectory ? : $this; - if (!$targetDirectory->isExist(dirname($destination))) { - $targetDirectory->create(dirname($destination)); + if (!$targetDirectory->isExist($this->driver->getParentDirectory($destination))) { + $targetDirectory->create($this->driver->getParentDirectory($destination)); } + $absolutePath = $this->driver->getAbsolutePath($this->path, $path); + $absoluteDestination = $targetDirectory->getAbsolutePath($destination); - $absolutePath = $this->getAbsolutePath($path); - $absoluteDestinationPath = $targetDirectory->getAbsolutePath($destination); - - $result = copy($absolutePath, $absoluteDestinationPath); - if ($result === null) { + $result = $this->driver->copy($absolutePath, $absoluteDestination); + if (!$result) { throw new FilesystemException( - sprintf('The "%s" path cannot be renamed into "%s"', $absolutePath, $absoluteDestinationPath) + sprintf('The "%s" path cannot be renamed into "%s"', $absolutePath, $absoluteDestination) ); } return $result; @@ -173,21 +188,16 @@ class Write extends Read implements WriteInterface */ public function delete($path = null) { - $this->assertExist($path); - - $absolutePath = $this->getAbsolutePath($path); - if (is_file($absolutePath)) { - $result = unlink($this->getAbsolutePath($path)); - } else { - foreach ($this->read($path) as $subPath) { - $this->delete($subPath); - } - $result = rmdir($absolutePath); + if (!$this->isExist($path)) { + return true; } - if ($result === false) { - throw new FilesystemException(sprintf('The file or directory "%s" cannot be deleted', $absolutePath)); + $absolutePath = $this->driver->getAbsolutePath($this->path, $path); + if ($this->driver->isFile($absolutePath)) { + $this->driver->deleteFile($absolutePath); + } else { + $this->driver->deleteDirectory($absolutePath); } - return $result; + return true; } /** @@ -201,17 +211,12 @@ class Write extends Read implements WriteInterface public function changePermissions($path, $permissions) { $this->assertExist($path); - - $absolutePath = $this->getAbsolutePath($path); - $result = chmod($absolutePath, $permissions); - if ($result === false) { - throw new FilesystemException(sprintf('Cannot change permissions for "%s" path', $absolutePath)); - } - return $result; + $absolutePath = $this->driver->getAbsolutePath($this->path, $path); + return $this->driver->changePermissions($absolutePath, $permissions); } /** - * Sets access and modification time of file. + * Sets modification time of file, if file does not exist - creates file * * @param string $path * @param int|null $modificationTime @@ -220,34 +225,22 @@ class Write extends Read implements WriteInterface */ public function touch($path, $modificationTime = null) { - $absolutePath = $this->getAbsolutePath($path); - - $folder = dirname($path); + $folder = $this->driver->getParentDirectory($path); $this->create($folder); $this->assertWritable($folder); - - if ($modificationTime === null) { - $result = touch($absolutePath); - } else { - $result = touch($absolutePath, $modificationTime); - } - if ($result === false) { - throw new FilesystemException(sprintf('The file or directory "%s" cannot be touched', $absolutePath)); - } - return $result; + return $this->driver->touch($this->driver->getAbsolutePath($this->path, $path), $modificationTime); } /** * Check if given path is writable * - * @param string|null $path + * @param null $path * @return bool + * @throws \Magento\Filesystem\FilesystemException */ public function isWritable($path = null) { - clearstatcache(); - - return is_writable($this->getAbsolutePath($path)); + return $this->driver->isWritable($this->driver->getAbsolutePath($this->path, $path)); } /** @@ -255,40 +248,30 @@ class Write extends Read implements WriteInterface * * @param string $path * @param string $mode + * @param string|null $protocol * @return \Magento\Filesystem\File\WriteInterface */ - public function openFile($path, $mode = 'w') + public function openFile($path, $mode = 'w', $protocol = null) { - $absolutePath = $this->getAbsolutePath($path); - $folder = dirname($path); $this->create($folder); $this->assertWritable($folder); - - return $this->fileFactory->create($absolutePath, $mode); + $absolutePath = $this->driver->getAbsolutePath($this->path, $path); + return $this->fileFactory->create($absolutePath, $protocol, $this->driver, $mode); } /** - * Open file in given path + * Write contents to file in given mode * * @param string $path * @param string $content * @param string|null $mode + * @param string|null $protocol * @return int The number of bytes that were written. * @throws FilesystemException */ - public function writeFile($path, $content, $mode = null) + public function writeFile($path, $content, $mode = 'w+', $protocol = null) { - $absolutePath = $this->getAbsolutePath($path); - - $folder = dirname($path); - $this->create($folder); - $this->assertWritable($folder); - - $result = file_put_contents($absolutePath, $content, $mode); - if ($result === null) { - throw new FilesystemException(sprintf('The specified "%s" file could not be written', $absolutePath)); - } - return $result; + return $this->openFile($path, $mode, $protocol)->write($content); } -} \ No newline at end of file +} diff --git a/lib/Magento/Filesystem/Directory/WriteFactory.php b/lib/Magento/Filesystem/Directory/WriteFactory.php new file mode 100644 index 00000000000..dd8eb779900 --- /dev/null +++ b/lib/Magento/Filesystem/Directory/WriteFactory.php @@ -0,0 +1,46 @@ +<?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 + * @copyright Copyright (c) 2013 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\Directory; + +class WriteFactory +{ + /** + * Create a readable directory + * + * @param array $config + * @param \Magento\Filesystem\DriverFactory $driverFactory + * @return \Magento\Filesystem\File\ReadInterface + */ + public function create(array $config, \Magento\Filesystem\DriverFactory $driverFactory) + { + $directoryDriver = isset($config['driver']) ? $config['driver'] : null; + $driver = $driverFactory->get($directoryDriver); + $factory = new \Magento\Filesystem\File\WriteFactory($driverFactory); + + return new \Magento\Filesystem\Directory\Write($config, $factory, $driver); + } +} diff --git a/lib/Magento/Filesystem/Directory/WriteInterface.php b/lib/Magento/Filesystem/Directory/WriteInterface.php index a40eaca25fa..ea0f6edf4d1 100644 --- a/lib/Magento/Filesystem/Directory/WriteInterface.php +++ b/lib/Magento/Filesystem/Directory/WriteInterface.php @@ -28,42 +28,42 @@ interface WriteInterface extends ReadInterface /** * Create directory if it does not exists * - * @param string $path + * @param string $path [optional] * @return bool * @throws \Magento\Filesystem\FilesystemException */ - public function create($path); + public function create($path = null); /** - * Renames a source to into new name + * Delete given path * - * @param string $path - * @param string $newPath - * @param WriteInterface $targetDirectory + * @param string $path [optional] * @return bool * @throws \Magento\Filesystem\FilesystemException */ - public function rename($path, $newPath, WriteInterface $targetDirectory = null); + public function delete($path = null); /** - * Copy a file + * Rename a file * * @param string $path - * @param string $destination - * @param WriteInterface $targetDirectory + * @param string $newPath + * @param WriteInterface $targetDirectory [optional] * @return bool * @throws \Magento\Filesystem\FilesystemException */ - public function copy($path, $destination, WriteInterface $targetDirectory = null); + public function renameFile($path, $newPath, WriteInterface $targetDirectory = null); /** - * Delete given path + * Copy a file * * @param string $path + * @param string $destination + * @param WriteInterface $targetDirectory [optional] * @return bool * @throws \Magento\Filesystem\FilesystemException */ - public function delete($path); + public function copyFile($path, $destination, WriteInterface $targetDirectory = null); /** * Change permissions of given path @@ -79,7 +79,7 @@ interface WriteInterface extends ReadInterface * Sets access and modification time of file. * * @param string $path - * @param int|null $modificationTime + * @param int $modificationTime [optional] * @return bool * @throws \Magento\Filesystem\FilesystemException */ @@ -88,26 +88,27 @@ interface WriteInterface extends ReadInterface /** * Check if given path is writable * - * @param string $path + * @param string $path [optional] * @return bool */ - public function isWritable($path); + public function isWritable($path = null); /** * Open file in given mode * * @param string $path - * @param string|null $mode + * @param string $mode + * @param string|null $protocol * @return \Magento\Filesystem\File\WriteInterface */ - public function openFile($path, $mode = 'w'); + public function openFile($path, $mode = 'w', $protocol = null); /** * Open file in given path * * @param string $path * @param string $content - * @param string|null $mode + * @param string $mode [optional] * @return int The number of bytes that were written. * @throws \Magento\Filesystem\FilesystemException */ diff --git a/lib/Magento/Filesystem/DirectoryList.php b/lib/Magento/Filesystem/DirectoryList.php new file mode 100644 index 00000000000..c967bf446f3 --- /dev/null +++ b/lib/Magento/Filesystem/DirectoryList.php @@ -0,0 +1,263 @@ +<?php +/** + * Application file system directories dictionary + * + * Provides information about what directories are available in the application + * Serves as customizaiton point to specify different directories or add own + * + * 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) 2013 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; + +use Magento\Filesystem; + +class DirectoryList +{ + /** + * Root path + * + * @var string + */ + protected $root; + + /** + * Directories configurations + * + * @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' => '') + ); + + /** + * @var array + */ + protected $protocol = array(); + + /** + * @param string $root + * @param array $directories + */ + public function __construct($root, array $directories = array()) + { + $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 ($directories as $code => $configuration) { + $baseConfiguration = isset($this->directories[$code]) ? $this->directories[$code] : array(); + $this->directories[$code] = array_merge($baseConfiguration, $configuration); + + if (isset($configuration['path'])) { + $this->setPath($code, $configuration['path']); + } + if (isset($configuration['uri'])) { + $this->setUri($code, $configuration['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 + */ + public function addDirectory($code, array $configuration) + { + if (!isset($configuration['path'])) { + $configuration['path'] = null; + } + if (!$this->isAbsolute($configuration['path'])) { + $configuration['path'] = $this->makeAbsolute($configuration['path']); + } + + $this->directories[$code] = $configuration; + } + + /** + * Set protocol wrapper + * + * @param string $wrapperCode + * @param array $configuration + */ + public function addProtocol($wrapperCode, array $configuration) + { + $wrapperCode = isset($configuration['protocol']) ? $configuration['protocol'] : $wrapperCode; + if (isset($configuration['wrapper'])) { + $flag = isset($configuration['url_stream']) ? $configuration['url_stream'] : 0; + $wrapperClass = $configuration['wrapper']; + stream_wrapper_register($wrapperCode, $wrapperClass, $flag); + } + + $this->protocol[$wrapperCode] = $configuration; + } + + /** + * Add root dir for relative path + * + * @param string $path + * @return string + */ + protected function makeAbsolute($path) + { + if ($path === null) { + $result = ''; + } else { + $result = $this->getRoot(); + if (!empty($path)) { + $result .= '/' . $path; + } + } + + return $result; + } + + /** + * Verify if path is absolute + * + * @param string $path + * @return bool + */ + protected function isAbsolute($path) + { + $path = strtr($path, '\\', '/'); + $isUnixRoot = strpos($path, '/') === 0; + $isWindowsRoot = preg_match('#^\w{1}:/#', $path); + $isWindowsLetter = parse_url($path, PHP_URL_SCHEME) !== null; + + return $isUnixRoot || $isWindowsRoot || $isWindowsLetter; + } + + /** + * Retrieve root path + * + * @return string + */ + public function getRoot() + { + return $this->root; + } + + /** + * Get configuration for directory code + * + * @param string $code + * @return array + * @throws \Magento\Filesystem\FilesystemException + */ + public function getConfig($code) + { + if (!isset($this->directories[$code])) { + throw new \Magento\Filesystem\FilesystemException( + sprintf('The "%s" directory is not specified in configuration', $code) + ); + } + return $this->directories[$code]; + } + + /** + * Return protocol configuration + * + * @param string $wrapperCode + * @return null|array + */ + public function getProtocolConfig($wrapperCode) + { + return isset($this->protocol[$wrapperCode]) ? $this->protocol[$wrapperCode] : null; + } + + /** + * \Directory path getter + * + * @param string $code One of self const + * @return string|bool + */ + public function getDir($code = Filesystem::ROOT) + { + return isset($this->directories[$code]['path']) ? $this->directories[$code]['path'] : false; + } + + /** + * Set URI + * + * The method is private on purpose: it must be used only in constructor. Users of this object must not be able + * to alter its state, otherwise it may compromise application integrity. + * Path must be usable as a fragment of a URL path. + * For interoperability and security purposes, no uppercase or "upper directory" paths like "." or ".." + * + * @param $code + * @param $uri + * @throws \InvalidArgumentException + */ + private function setUri($code, $uri) + { + if (!preg_match('/^([a-z0-9_]+[a-z0-9\._]*(\/[a-z0-9_]+[a-z0-9\._]*)*)?$/', $uri)) { + throw new \InvalidArgumentException( + "Must be relative directory path in lowercase with '/' directory separator: '{$uri}'" + ); + } + $this->directories[$code]['uri'] = $uri; + } + + /** + * Set directory + * + * @param string $code + * @param string $path + */ + private function setPath($code, $path) + { + $this->directories[$code]['path'] = str_replace('\\', '/', $path); + } +} diff --git a/lib/Magento/Filesystem/DirectoryList/Configuration.php b/lib/Magento/Filesystem/DirectoryList/Configuration.php new file mode 100644 index 00000000000..e7556c8d956 --- /dev/null +++ b/lib/Magento/Filesystem/DirectoryList/Configuration.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) 2013 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; + +use Magento\Filesystem\DirectoryList; + +class Configuration +{ + /** + * Path to filesystem directory configuration + * + * @var string + */ + const XML_FILESYSTEM_DIRECTORY_PATH = 'system/filesystem/directory'; + + /** + * Declaration wrapper configuration + */ + const XML_FILESYSTEM_WRAPPER_PATH = 'system/filesystem/protocol'; + + /** + * Filesystem Directory configuration + * + * @var array + */ + protected $directories; + + /** + * Filesystem protocols configuration + * + * @var array + */ + protected $protocols; + + /** + * Store directory configuration + * + * @param \Magento\Core\Model\ConfigInterface $config + */ + public function __construct(\Magento\Core\Model\ConfigInterface $config) + { + $this->directories = $config->getValue(self::XML_FILESYSTEM_DIRECTORY_PATH) ?: array(); + $this->protocols = $config->getValue(self::XML_FILESYSTEM_WRAPPER_PATH) ?: array(); + } + + /** + * Add directories from configuration to Filesystem + * + * @param DirectoryList $directoryList + */ + public function configure(DirectoryList $directoryList) + { + foreach ($this->directories as $code => $directoryConfiguration) { + $directoryList->addDirectory($code, $directoryConfiguration); + } + + foreach ($this->protocols as $code => $protocolConfiguration) { + $directoryList->addProtocol($code, $protocolConfiguration); + } + } +} diff --git a/lib/Magento/App/Dir/Verification.php b/lib/Magento/Filesystem/DirectoryList/Verification.php similarity index 53% rename from lib/Magento/App/Dir/Verification.php rename to lib/Magento/Filesystem/DirectoryList/Verification.php index c3859764f88..783d77c6711 100644 --- a/lib/Magento/App/Dir/Verification.php +++ b/lib/Magento/Filesystem/DirectoryList/Verification.php @@ -23,7 +23,11 @@ * @copyright Copyright (c) 2013 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\Dir; +namespace Magento\Filesystem\DirectoryList; + +use Magento\App\State, + Magento\Filesystem, + Magento\Filesystem\FilesystemException; class Verification { @@ -32,13 +36,13 @@ class Verification * * @var array */ - protected static $_productionDirs = array( - \Magento\App\Dir::MEDIA, - \Magento\App\Dir::VAR_DIR, - \Magento\App\Dir::TMP, - \Magento\App\Dir::CACHE, - \Magento\App\Dir::LOG, - \Magento\App\Dir::SESSION, + protected static $productionDirs = array( + Filesystem::MEDIA, + Filesystem::VAR_DIR, + Filesystem::TMP, + Filesystem::CACHE, + Filesystem::LOG, + Filesystem::SESSION, ); /** @@ -46,66 +50,51 @@ class Verification * * @var array */ - protected static $_nonProductionDirs = array( - \Magento\App\Dir::MEDIA, - \Magento\App\Dir::STATIC_VIEW, - \Magento\App\Dir::VAR_DIR, - \Magento\App\Dir::TMP, - \Magento\App\Dir::CACHE, - \Magento\App\Dir::LOG, - \Magento\App\Dir::SESSION, + protected static $nonProductionDirs = array( + Filesystem::MEDIA, + Filesystem::STATIC_VIEW, + Filesystem::VAR_DIR, + Filesystem::TMP, + Filesystem::CACHE, + Filesystem::LOG, + Filesystem::SESSION, ); /** * @var \Magento\Filesystem */ - protected $_filesystem; - - /** - * @var \Magento\App\Dir - */ - protected $_dirs; + protected $filesystem; /** * Cached list of directories to create and verify write access * * @var array */ - protected $_dirsToVerify = array(); + protected $dirsToVerify = array(); /** * Constructor - initialize object with required dependencies, determine application state * - * @param \Magento\Filesystem $filesystem - * @param \Magento\App\Dir $dirs - * @param \Magento\App\State $appState + * @param Filesystem $filesystem + * @param State $appState */ - public function __construct( - \Magento\Filesystem $filesystem, - \Magento\App\Dir $dirs, - \Magento\App\State $appState - ) { - $this->_filesystem = $filesystem; - $this->_dirs = $dirs; - $this->_dirsToVerify = $this->_getDirsToVerify($appState); + public function __construct(Filesystem $filesystem, State $appState) { + $this->filesystem = $filesystem; + $this->dirsToVerify = $this->_getDirsToVerify($appState); } /** * Return list of directories, that must be verified according to the application mode * - * @param \Magento\App\State $appState + * @param State $appState * @return array */ - protected function _getDirsToVerify(\Magento\App\State $appState) + protected function _getDirsToVerify(State $appState) { - $result = array(); - $codes = ($appState->getMode() == \Magento\App\State::MODE_PRODUCTION) - ? self::$_productionDirs - : self::$_nonProductionDirs; - foreach ($codes as $code) { - $result[] = str_replace(DIRECTORY_SEPARATOR, '/', $this->_dirs->getDir($code)); - } - return $result; + $codes = ($appState->getMode() == State::MODE_PRODUCTION) + ? self::$productionDirs + : self::$nonProductionDirs; + return $codes; } /** @@ -114,16 +103,17 @@ class Verification public function createAndVerifyDirectories() { $fails = array(); - foreach ($this->_dirsToVerify as $dir) { - if ($this->_filesystem->isDirectory($dir)) { - if (!$this->_filesystem->isWritable($dir)) { - $fails[] = $dir; + foreach ($this->dirsToVerify as $code) { + $directory = $this->filesystem->getDirectoryWrite($code); + if ($directory->isExist()) { + if (!$directory->isWritable()) { + $fails[] = $directory->getAbsolutePath(); } } else { try { - $this->_filesystem->createDirectory($dir); - } catch (\Magento\Filesystem\FilesystemException $e) { - $fails[] = $dir; + $directory->create(); + } catch (FilesystemException $e) { + $fails[] = $directory->getAbsolutePath(); } } } diff --git a/lib/Magento/Filesystem/Driver/File.php b/lib/Magento/Filesystem/Driver/File.php new file mode 100644 index 00000000000..a112896d8e5 --- /dev/null +++ b/lib/Magento/Filesystem/Driver/File.php @@ -0,0 +1,706 @@ +<?php +/** + * Origin filesystem driver + * + * 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) 2013 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\Driver; + +use Magento\Filesystem\FilesystemException; + +class File implements \Magento\Filesystem\DriverInterface +{ + /** + * @var string + */ + protected $scheme = ''; + + /** + * Returns last warning message string + * + * @return string + */ + protected function getWarningMessage() + { + $warning = error_get_last(); + if ($warning && $warning['type'] == E_WARNING) { + return 'Warning!' . $warning['message']; + } + return null; + } + + /** + * Is file or directory exist in file system + * + * @param $path + * @return bool + * @throws FilesystemException + */ + public function isExists($path) + { + clearstatcache(); + $result = @file_exists($this->getScheme() . $path); + if ($result === null) { + throw new FilesystemException( + sprintf('Error occurred during execution %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Gathers the statistics of the given path + * + * @param string $path + * @return array + * @throws \Magento\Filesystem\FilesystemException + */ + public function stat($path) + { + clearstatcache(); + $result = @stat($this->getScheme() . $path); + if (!$result) { + throw new FilesystemException( + sprintf('Cannot gather stats! %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Check permissions for reading file or directory + * + * @param string $path + * @return bool + * @throws \Magento\Filesystem\FilesystemException + */ + public function isReadable($path) + { + clearstatcache(); + $result = @is_readable($this->getScheme() . $path); + if ($result === null) { + throw new FilesystemException( + sprintf('Error occurred during execution %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Tells whether the filename is a regular file + * + * @param string $path + * @return bool + * @throws \Magento\Filesystem\FilesystemException + */ + public function isFile($path) + { + clearstatcache(); + $result = @is_file($this->getScheme() . $path); + if ($result === null) { + throw new FilesystemException( + sprintf('Error occurred during execution %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Tells whether the filename is a regular directory + * + * @param string $path + * @return bool + * @throws \Magento\Filesystem\FilesystemException + */ + public function isDirectory($path) + { + clearstatcache(); + $result = @is_dir($this->getScheme() . $path); + if ($result === null) { + throw new FilesystemException( + sprintf('Error occurred during execution %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Retrieve file contents from given path + * + * @param string $path + * @param string|null $flag + * @param resource|null $context + * @return string + * @throws FilesystemException + */ + public function fileGetContents($path, $flag = null, $context = null) + { + clearstatcache(); + $result = @file_get_contents($this->getScheme() . $path, $flag, $context); + if (!$result) { + throw new FilesystemException( + sprintf('Cannot read contents from file "%s" %s', + $path, + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Check if given path is writable + * + * @param string $path + * @return bool + * @throws \Magento\Filesystem\FilesystemException + */ + public function isWritable($path) + { + clearstatcache(); + $result = @is_writable($this->getScheme() . $path); + if ($result === null) { + throw new FilesystemException( + sprintf('Error occurred during execution %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Returns parent directory's path + * + * @param string $path + * @return string + */ + public function getParentDirectory($path) + { + return dirname($this->getScheme() . $path); + } + + /** + * Create directory + * + * @param string $path + * @param int $permissions + * @return bool + * @throws FilesystemException + */ + public function createDirectory($path, $permissions) + { + $result = @mkdir($this->getScheme() . $path, $permissions, true); + if (!$result) { + throw new FilesystemException(sprintf('Directory "%s" cannot be created %s', + $path, + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Renames a file or directory + * + * @param string $oldPath + * @param string $newPath + * @return bool + * @throws FilesystemException + */ + public function rename($oldPath, $newPath) + { + $result = @rename($this->getScheme() . $oldPath, $newPath); + if (!$result) { + throw new FilesystemException( + sprintf('The "%s" path cannot be renamed into "%s" %s', + $oldPath, + $newPath, + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Copy source into destination + * + * @param string $source + * @param string $destination + * @return bool + * @throws FilesystemException + */ + public function copy($source, $destination) + { + $result = @copy($this->getScheme() . $source, $destination); + if (!$result) { + throw new FilesystemException( + sprintf('The file or directory "%s" cannot be copied to "%s" %s', + $source, + $destination, + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Delete file + * + * @param string $path + * @return bool + * @throws FilesystemException + */ + public function deleteFile($path) + { + $result = @unlink($this->getScheme() . $path); + if (!$result) { + throw new FilesystemException( + sprintf('The file "%s" cannot be deleted %s', + $path, + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Recursive delete directory + * + * @param string $path + * @return bool + * @throws FilesystemException + */ + public function deleteDirectory($path) + { + $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS; + $iterator = new \FilesystemIterator($path, $flags); + /** @var \FilesystemIterator $entity */ + foreach ($iterator as $entity) { + if ($entity->isDir()) { + $this->deleteDirectory($entity->getPathname()); + } else { + $this->deleteFile($entity->getPathname()); + } + } + $result = @rmdir($this->getScheme() . $path); + if (!$result) { + throw new FilesystemException( + sprintf('The directory "%s" cannot be deleted %s', + $path, + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Change permissions of given path + * + * @param string $path + * @param int $permissions + * @return bool + * @throws FilesystemException + */ + public function changePermissions($path, $permissions) + { + $result = @chmod($this->getScheme() . $path, $permissions); + if (!$result) { + throw new FilesystemException( + sprintf('Cannot change permissions for path "%s" %s', + $path, + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Sets access and modification time of file. + * + * @param string $path + * @param int|null $modificationTime + * @return bool + * @throws FilesystemException + */ + public function touch($path, $modificationTime = null) + { + if (!$modificationTime) { + $result = @touch($this->getScheme() . $path); + } else { + $result = @touch($this->getScheme() . $path, $modificationTime); + } + if (!$result) { + throw new FilesystemException( + sprintf('The file or directory "%s" cannot be touched %s', + $path, + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Write contents to file in given path + * + * @param string $path + * @param string $content + * @param string|null $mode + * @return int The number of bytes that were written. + * @throws FilesystemException + */ + public function filePutContents($path, $content, $mode = null) + { + $result = @file_put_contents($this->getScheme() . $path, $content, $mode); + if (!$result) { + throw new FilesystemException( + sprintf('The specified "%s" file could not be written %s', + $path, + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Open file + * + * @param string $path + * @param string $mode + * @return resource file + * @throws FilesystemException + */ + public function fileOpen($path, $mode) + { + $result = @fopen($this->getScheme() . $path, $mode); + if (!$result) { + throw new FilesystemException( + sprintf('File "%s" cannot be opened %s', + $path, + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Reads the line content from file pointer (with specified number of bytes from the current position). + * + * @param resource $resource + * @param int $length + * @param string $ending [optional] + * @return string + * @throws FilesystemException + */ + public function fileReadLine($resource, $length, $ending = null) + { + $result = @stream_get_line($resource, $length, $ending); + if (!$result) { + throw new FilesystemException( + sprintf('File cannot be read %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Reads the specified number of bytes from the current position. + * + * @param resource $resource + * @param int $length + * @return string + * @throws FilesystemException + */ + public function fileRead($resource, $length) + { + $result = @fread($resource, $length); + if ($result === false) { + throw new FilesystemException( + sprintf('File cannot be read %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Reads one CSV row from the file + * + * @param resource $resource + * @param int $length [optional] + * @param string $delimiter [optional] + * @param string $enclosure [optional] + * @param string $escape [optional] + * @return array|bool|null + * @throws FilesystemException + */ + public function fileGetCsv($resource, $length = 0, $delimiter = ',', $enclosure = '"', $escape = '\\') + { + $result = @fgetcsv($resource, $length, $delimiter, $enclosure, $escape); + if ($result === null) { + throw new FilesystemException( + sprintf('Wrong CSV handle %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Returns position of read/write pointer + * + * @param resource $resource + * @return int + * @throws FilesystemException + */ + public function fileTell($resource) + { + $result = @ftell($resource); + if ($result === null) { + throw new FilesystemException( + sprintf('Error occurred during execution %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Seeks to the specified offset + * + * @param resource $resource + * @param int $offset + * @param int $whence + * @return int + * @throws FilesystemException + */ + public function fileSeek($resource, $offset, $whence = SEEK_SET) + { + $result = @fseek($resource, $offset, $whence); + if ($result === -1) { + throw new FilesystemException( + sprintf('Error occurred during execution of fileSeek %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Returns true if pointer at the end of file or in case of exception + * + * @param resource $resource + * @return boolean + */ + public function endOfFile($resource) + { + return feof($resource); + } + + /** + * Close file + * + * @param resource $resource + * @return boolean + * @throws FilesystemException + */ + public function fileClose($resource) + { + $result = @fclose($resource); + if (!$result) { + throw new FilesystemException( + sprintf('Error occurred during execution of fileClose %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Writes data to file + * + * @param resource $resource + * @param string $data + * @return int + * @throws FilesystemException + */ + public function fileWrite($resource, $data) + { + $result = @fwrite($resource, $data); + if (!$result) { + throw new FilesystemException( + sprintf('Error occurred during execution of fileWrite %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Writes one CSV row to the file. + * + * @param resource $resource + * @param array $data + * @param string $delimiter + * @param string $enclosure + * @return int + * @throws FilesystemException + */ + public function filePutCsv($resource, array $data, $delimiter = ',', $enclosure = '"') + { + $result = @fputcsv($resource, $data, $delimiter, $enclosure); + if (!$result) { + throw new FilesystemException( + sprintf('Error occurred during execution of filePutCsv %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Flushes the output + * + * @param resource $resource + * @return bool + * @throws FilesystemException + */ + public function fileFlush($resource) + { + $result = @fflush($resource); + if (!$result) { + throw new FilesystemException( + sprintf('Error occurred during execution of fileFlush %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Lock file in selected mode + * + * @param $resource + * @param int $lockMode + * @return bool + * @throws FilesystemException + */ + public function fileLock($resource, $lockMode = LOCK_EX) + { + $result = @flock($resource, $lockMode); + if (!$result) { + throw new FilesystemException( + sprintf('Error occurred during execution of fileLock %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Unlock file + * + * @param $resource + * @return bool + * @throws FilesystemException + */ + public function fileUnlock($resource) + { + $result = @flock($resource, LOCK_UN); + if (!$result) { + throw new FilesystemException( + sprintf('Error occurred during execution of fileUnlock %s', + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * @param string $basePath + * @param string $path + * @param string|null $scheme + * @return string + */ + public function getAbsolutePath($basePath, $path, $scheme = null) + { + return $this->getScheme($scheme) . $basePath . ltrim($this->fixSeparator($path), '/'); + } + + /** + * Retrieves relative path + * + * @param string $basePath + * @param string $path + * @return string + */ + public function getRelativePath($basePath, $path = null) + { + $path = $this->fixSeparator($path); + if ((strpos($path, $basePath) === 0) || ($basePath == $path . '/')) { + $result = substr($path, strlen($basePath)); + } else { + $result = $path; + } + return $result; + } + + /** + * Fixes path separator + * Utility method. + * + * @param string $path + * @return string + */ + protected function fixSeparator($path) + { + return str_replace('\\', '/', $path); + } + + /** + * Return path with scheme + * + * @param null|string $scheme + * @return string + */ + protected function getScheme($scheme = null) + { + 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)); + } +} diff --git a/lib/Magento/Filesystem/Driver/Http.php b/lib/Magento/Filesystem/Driver/Http.php new file mode 100644 index 00000000000..cd8c9bd378b --- /dev/null +++ b/lib/Magento/Filesystem/Driver/Http.php @@ -0,0 +1,245 @@ +<?php +/** + * Origin filesystem driver + * + * 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) 2013 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\Driver; + +use Magento\Filesystem\FilesystemException; + +/** + * Class Http + * + * @package Magento\Filesystem\Driver + */ +class Http extends File +{ + /** + * @var string + */ + protected $scheme = 'http'; + + /** + * @param $path + * @return bool + * @throws FilesystemException + */ + public function isExists($path) + { + $headers = array_change_key_case(get_headers($this->getScheme() . $path, 1), CASE_LOWER); + + $status = $headers[0]; + + if (strpos($status, '200 OK') === false) { + $result = false; + } else { + $result = true; + } + + return $result; + } + + /** + * Gathers the statistics of the given path + * + * @param string $path + * @return array + * @throws \Magento\Filesystem\FilesystemException + */ + public function stat($path) + { + $headers = array_change_key_case(get_headers($path, 1), CASE_LOWER); + + $result = array( + 'dev' => 0, + 'ino' => 0, + 'mode' => 0, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'atime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0, + 'size' => isset($headers['content-length']) ? $headers['content-length'] : 0, + 'type' => isset($headers['content-type']) ? $headers['content-type'] : '', + 'mtime' => isset($headers['last-modified']) ? $headers['last-modified'] : 0, + 'disposition' => isset($headers['content-disposition']) ? $headers['content-disposition'] : null + ); + return $result; + } + + /** + * Retrieve file contents from given path + * + * @param string $path + * @param string|null $flags + * @param resource|null $context + * @return string + * @throws FilesystemException + */ + public function fileGetContents($path, $flags = null, $context = null) + { + clearstatcache(); + $result = @file_get_contents($path, $flags, $context); + if (!$result) { + throw new FilesystemException( + sprintf( + 'Cannot read contents from file "%s" %s', + $path, + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Open file in given path + * + * @param string $path + * @param string $content + * @param string|null $mode + * @param string|null $context + * @return int The number of bytes that were written + * @throws FilesystemException + */ + public function filePutContents($path, $content, $mode = null, $context = null) + { + $result = @file_put_contents($path, $content, $mode, $context); + if (!$result) { + throw new FilesystemException( + sprintf( + 'The specified "%s" file could not be written %s', + $path, + $this->getWarningMessage() + )); + } + return $result; + } + + /** + * Open file + * + * @param string $path + * @param string $mode + * @return resource file + * @throws FilesystemException + */ + public function fileOpen($path, $mode) + { + $urlProp = parse_url($this->getScheme() . $path); + if (!isset($urlProp['scheme']) || strtolower($urlProp['scheme'] != 'http')) { + throw new FilesystemException(__('Please correct the download URL scheme.')); + } + + if (!isset($urlProp['host'])) { + throw new FilesystemException(__('Please correct the download URL host.')); + } + + $hostname = $urlProp['host']; + $port = 80; + if (isset($urlProp['port'])) { + $port = (int)$urlProp['port']; + } + + $path = '/'; + if (isset($urlProp['path'])) { + $path = $urlProp['path']; + } + + $query = ''; + if (isset($urlProp['query'])) { + $query = '?' . $urlProp['query']; + } + + try { + $result = fsockopen($hostname, $port, $errorNumber, $errorMessage); + } catch (\Exception $e) { + throw new FilesystemException($e->getMessage()); + } + + if ($result === false) { + throw new FilesystemException( + __('Something went wrong connecting to the host. Error#%1 - %2.', $errorNumber, $errorMessage) + ); + } + + $headers = 'GET ' . $path . $query . ' HTTP/1.0' . "\r\n" + . 'Host: ' . $hostname . "\r\n" + . 'User-Agent: Magento ver/' . \Magento\Core\Model\App::VERSION . "\r\n" + . 'Connection: close' . "\r\n" + . "\r\n"; + + fwrite($result, $headers); + + // trim headers + while (!feof($result)) { + $str = fgets($result, 1024); + if ($str == "\r\n") { + break; + } + } + + return $result; + } + + /** + * Reads the line content from file pointer (with specified number of bytes from the current position). + * + * @param resource $resource + * @param int $length + * @param string $ending [optional] + * @return string + * @throws FilesystemException + */ + public function fileReadLine($resource, $length, $ending = null) + { + $result = @stream_get_line($resource, $length, $ending); + + return $result; + } + + /** + * @param string $basePath + * @param string $path + * @param string|null $scheme + * @return string + */ + public function getAbsolutePath($basePath, $path, $scheme = null) + { + return $this->getScheme() . $basePath . $path; + } + + /** + * Return path with scheme + * + * @param null|string $scheme + * @return string + */ + protected function getScheme($scheme = null) + { + $scheme = $scheme ?: $this->scheme; + return $scheme ? $scheme . '://' : ''; + } +} diff --git a/lib/Magento/Filesystem/Stream/FactoryInterface.php b/lib/Magento/Filesystem/Driver/Https.php similarity index 77% rename from lib/Magento/Filesystem/Stream/FactoryInterface.php rename to lib/Magento/Filesystem/Driver/Https.php index af2df2b4cae..10e360855c4 100644 --- a/lib/Magento/Filesystem/Stream/FactoryInterface.php +++ b/lib/Magento/Filesystem/Driver/Https.php @@ -1,6 +1,6 @@ <?php /** - * Interface of Magento filesystem stream factory + * Origin filesystem driver * * Magento * @@ -23,15 +23,19 @@ * @copyright Copyright (c) 2013 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\Stream; +namespace Magento\Filesystem\Driver; -interface FactoryInterface +use Magento\Filesystem\FilesystemException; + +/** + * Class Https + * + * @package Magento\Filesystem\Driver + */ +class Https extends Http { /** - * Create stream object - * - * @param string $key - * @return \Magento\Filesystem\StreamInterface + * @var string */ - public function createStream($key); + protected $scheme = 'https'; } diff --git a/lib/Magento/Filesystem/Driver/Zlib.php b/lib/Magento/Filesystem/Driver/Zlib.php new file mode 100644 index 00000000000..0cb9bb38b7b --- /dev/null +++ b/lib/Magento/Filesystem/Driver/Zlib.php @@ -0,0 +1,34 @@ +<?php +/** + * Magento filesystem zlib driver + * + * 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) 2013 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\Driver; + +class Zlib extends File +{ + /** + * @var string + */ + protected $scheme = 'compress.zlib'; +} diff --git a/lib/Magento/Filesystem/DriverFactory.php b/lib/Magento/Filesystem/DriverFactory.php new file mode 100644 index 00000000000..198dabb28df --- /dev/null +++ b/lib/Magento/Filesystem/DriverFactory.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. + * + * @category Magento + * @package Magento + * @copyright Copyright (c) 2013 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; + +class DriverFactory +{ + /** + * @var \Magento\Filesystem\DriverInterface[] + */ + protected $drivers = array(); + + /** + * @var \Magento\Filesystem\DirectoryList + */ + protected $directoryList; + + public function __construct(\Magento\Filesystem\DirectoryList $directoryList) + { + $this->directoryList = $directoryList; + } + + /** + * Get a driver instance according the given scheme. + * + * @param null|string $protocolCode + * @param DriverInterface $driver + * @return DriverInterface + * @throws FilesystemException + */ + public function get($protocolCode = null, DriverInterface $driver = null) + { + $driverClass = '\Magento\Filesystem\Driver\File'; + if ($protocolCode !== null) { + $driverClass = $this->directoryList->getProtocolConfig($protocolCode)['driver']; + } + if (!isset($this->drivers[$driverClass])) { + $this->drivers[$driverClass] = new $driverClass($driver); + if (!$this->drivers[$driverClass] instanceof \Magento\Filesystem\DriverInterface) { + throw new \Magento\Filesystem\FilesystemException("Invalid filesystem driver class: " . $driverClass); + } + } + return $this->drivers[$driverClass]; + } +} diff --git a/lib/Magento/Filesystem/DriverInterface.php b/lib/Magento/Filesystem/DriverInterface.php new file mode 100644 index 00000000000..b594c25cadd --- /dev/null +++ b/lib/Magento/Filesystem/DriverInterface.php @@ -0,0 +1,337 @@ +<?php +/** + * Interface of Magento filesystem driver + * + * 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) 2013 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; + +/** + * Class Driver + * @package Magento\Filesystem + */ +interface DriverInterface +{ + /** + * + * @param string $path + * @return bool + * @throws FilesystemException + */ + public function isExists($path); + + /** + * Gathers the statistics of the given path + * + * @param string $path + * @return array + * @throws \Magento\Filesystem\FilesystemException + */ + public function stat($path); + + /** + * Check permissions for reading file or directory + * + * @param string $path + * @return bool + * @throws \Magento\Filesystem\FilesystemException + */ + public function isReadable($path); + + /** + * Tells whether the filename is a regular file + * + * @param string $path + * @return bool + * @throws \Magento\Filesystem\FilesystemException + */ + public function isFile($path); + + /** + * Tells whether the filename is a regular directory + * + * @param string $path + * @return bool + * @throws \Magento\Filesystem\FilesystemException + */ + public function isDirectory($path); + + /** + * Retrieve file contents from given path + * + * @param string $path + * @param string|null $flag + * @param resource|null $context + * @return string + * @throws FilesystemException + */ + public function fileGetContents($path, $flag = null, $context = null); + + /** + * Check if given path is writable + * + * @param string $path + * @return bool + * @throws \Magento\Filesystem\FilesystemException + */ + public function isWritable($path); + + /** + * Returns parent directory's path + * + * @param string $path + * @return string + */ + public function getParentDirectory($path); + + /** + * Create directory + * + * @param string $path + * @param int $permissions + * @return bool + * @throws FilesystemException + */ + public function createDirectory($path, $permissions); + + /** + * Renames a file or directory + * + * @param string $oldPath + * @param string $newPath + * @return bool + * @throws FilesystemException + */ + public function rename($oldPath, $newPath); + + /** + * Copy source into destination + * + * @param string $source + * @param string $destination + * @return bool + * @throws FilesystemException + */ + public function copy($source, $destination); + + /** + * Delete file + * + * @param string $path + * @return bool + * @throws FilesystemException + */ + public function deleteFile($path); + + /** + * Delete directory + * + * @param string $path + * @return bool + * @throws FilesystemException + */ + public function deleteDirectory($path); + + /** + * Change permissions of given path + * + * @param string $path + * @param int $permissions + * @return bool + * @throws FilesystemException + */ + public function changePermissions($path, $permissions); + + /** + * Sets access and modification time of file. + * + * @param string $path + * @param int|null $modificationTime + * @return bool + * @throws FilesystemException + */ + public function touch($path, $modificationTime = null); + + /** + * Put contents into given file + * + * @param string $path + * @param string $content + * @param string|null $mode + * @return int The number of bytes that were written. + * @throws FilesystemException + */ + public function filePutContents($path, $content, $mode = null); + + /** + * Open file + * + * @param string $path + * @param string $mode + * @return resource + * @throws FilesystemException + */ + public function fileOpen($path, $mode); + + /** + * Reads the line content from file pointer (with specified number of bytes from the current position). + * + * @param resource $resource + * @param int $length + * @param string $ending [optional] + * @return string + * @throws FilesystemException + */ + public function fileReadLine($resource, $length, $ending = null); + + /** + * Reads the specified number of bytes from the current position. + * + * @param resource $resource + * @param int $length + * @return string + * @throws FilesystemException + */ + public function fileRead($resource, $length); + + /** + * Reads one CSV row from the file + * + * @param resource $resource + * @param int $length [optional] + * @param string $delimiter [optional] + * @param string $enclosure [optional] + * @param string $escape [optional] + * @return array|bool|null + * @throws FilesystemException + */ + public function fileGetCsv($resource, $length = 0, $delimiter = ',', $enclosure = '"', $escape = '\\'); + + /** + * Returns position of read/write pointer + * + * @param resource $resource + * @return int + * @throws FilesystemException + */ + public function fileTell($resource); + + /** + * Seeks to the specified offset + * + * @param resource $resource + * @param int $offset + * @param int $whence + * @return int + * @throws FilesystemException + */ + public function fileSeek($resource, $offset, $whence = SEEK_SET); + + /** + * Returns true if pointer at the end of file or in case of exception + * + * @param resource $resource + * @return boolean + */ + public function endOfFile($resource); + + /** + * Close file + * + * @param resource $resource + * @return boolean + * @throws FilesystemException + */ + public function fileClose($resource); + + /** + * Writes data to file + * + * @param resource $resource + * @param string $data + * @return int + * @throws FilesystemException + */ + public function fileWrite($resource, $data); + + /** + * Writes one CSV row to the file. + * + * @param resource $resource + * @param array $data + * @param string $delimiter + * @param string $enclosure + * @return int + * @throws FilesystemException + */ + public function filePutCsv($resource, array $data, $delimiter = ',', $enclosure = '"'); + + /** + * Flushes the output + * + * @param resource $resource + * @return bool + * @throws FilesystemException + */ + public function fileFlush($resource); + + /** + * Lock file in selected mode + * + * @param $resource + * @param int $lockMode + * @return bool + * @throws FilesystemException + */ + public function fileLock($resource, $lockMode = LOCK_EX); + + /** + * Unlock file + * + * @param $resource + * @return bool + * @throws FilesystemException + */ + public function fileUnlock($resource); + + /** + * @param string $basePath + * @param string $path + * @param string|null $scheme + * @return mixed + */ + public function getAbsolutePath($basePath, $path, $scheme = null); + + /** + * @param string $basePath + * @param null $path + * @return mixed + */ + public function getRelativePath($basePath, $path = null); + + /** + * @param $path + * @param $directory + * @return mixed + */ + public function isPathInDirectory($path, $directory); +} diff --git a/lib/Magento/Filesystem/File/Read.php b/lib/Magento/Filesystem/File/Read.php index d6e740233c8..c69568223e1 100644 --- a/lib/Magento/Filesystem/File/Read.php +++ b/lib/Magento/Filesystem/File/Read.php @@ -24,6 +24,7 @@ namespace Magento\Filesystem\File; +use Magento\Filesystem\DriverInterface; use Magento\Filesystem\FilesystemException; class Read implements ReadInterface @@ -50,11 +51,22 @@ class Read implements ReadInterface protected $resource; /** - * @param string $path + * @var \Magento\Filesystem\DriverInterface */ - public function __construct($path) + protected $driver; + + /** + * Constructor + * + * @param $path + * @param DriverInterface $driver + */ + public function __construct($path, DriverInterface $driver) { $this->path = $path; + + $this->driver = $driver; + $this->open(); } @@ -62,28 +74,27 @@ class Read implements ReadInterface * Open file * * @throws FilesystemException + * @return $this */ protected function open() { $this->assertValid(); - $this->resource = fopen($this->path, $this->mode); - if ($this->resource === false) { - throw new FilesystemException(sprintf('The file "%s" cannot be opened', $this->path)); - } + $this->resource = $this->driver->fileOpen($this->path, $this->mode); + return $this; } /** * Assert file existence * - * @throws FilesystemException + * @return bool + * @throws \Magento\Filesystem\FilesystemException */ protected function assertValid() { - clearstatcache(); - - if (!file_exists($this->path)) { + if (!$this->driver->isExists($this->path)) { throw new FilesystemException(sprintf('The file "%s" doesn\'t exist', $this->path)); } + return true; } /** @@ -94,7 +105,31 @@ class Read implements ReadInterface */ public function read($length) { - return fread($this->resource, $length); + return $this->driver->fileRead($this->resource, $length); + } + + /** + * Return file content + * + * @param string|null $flag + * @param resource|null $context + * @return string + */ + public function readAll($flag = null, $context = null) + { + return $this->driver->fileGetContents($this->path, $flag, $context); + } + + /** + * Reads the line with specified number of bytes from the current position. + * + * @param int $length The number of bytes to read + * @param string $ending [optional] + * @return string + */ + public function readLine($length, $ending = null) + { + return $this->driver->fileReadLine($this->resource, $length, $ending); } /** @@ -108,17 +143,17 @@ class Read implements ReadInterface */ public function readCsv($length = 0, $delimiter = ',', $enclosure = '"', $escape = '\\') { - return fgetcsv($this->resource, $length, $delimiter, $enclosure, $escape); + return $this->driver->fileGetCsv($this->resource, $length, $delimiter, $enclosure, $escape); } /** - * Returns the current position + * Returns the current cursor position * * @return int */ public function tell() { - return ftell($this->resource); + return $this->driver->fileTell($this->resource); } /** @@ -130,7 +165,7 @@ class Read implements ReadInterface */ public function seek($offset, $whence = SEEK_SET) { - return fseek($this->resource, $offset, $whence); + return $this->driver->fileSeek($this->resource, $offset, $whence); } /** @@ -140,7 +175,7 @@ class Read implements ReadInterface */ public function eof() { - return feof($this->resource); + return $this->driver->endOfFile($this->resource); } /** @@ -150,6 +185,6 @@ class Read implements ReadInterface */ public function close() { - return fclose($this->resource); + return $this->driver->fileClose($this->resource); } } \ No newline at end of file diff --git a/lib/Magento/Filesystem/File/ReadFactory.php b/lib/Magento/Filesystem/File/ReadFactory.php index 22994093207..928a63c2fdf 100644 --- a/lib/Magento/Filesystem/File/ReadFactory.php +++ b/lib/Magento/Filesystem/File/ReadFactory.php @@ -24,29 +24,37 @@ namespace Magento\Filesystem\File; +use Magento\Filesystem\DriverInterface; + class ReadFactory { /** - * @var \Magento\ObjectManager + * @var \Magento\Filesystem\DriverFactory */ - protected $objectManager; + protected $driverFactory; /** - * @param \Magento\ObjectManager $objectManager + * @param \Magento\Filesystem\DriverFactory $driverFactory */ - public function __construct(\Magento\ObjectManager $objectManager) + public function __construct(\Magento\Filesystem\DriverFactory $driverFactory) { - $this->objectManager = $objectManager; + $this->driverFactory = $driverFactory; } /** * Create a readable file * * @param string $path + * @param string|null $protocol + * @param DriverInterface $directoryDriver [optional] * @return \Magento\Filesystem\File\ReadInterface */ - public function create($path) + public function create($path, $protocol, DriverInterface $directoryDriver = null) { - return $this->objectManager->create('Magento\Filesystem\File\Read', array('path' => $path)); + $fileDriver = $directoryDriver; + if ($protocol) { + $fileDriver = $this->driverFactory->get($protocol, $directoryDriver); + } + return new \Magento\Filesystem\File\Read($path, $fileDriver); } } \ No newline at end of file diff --git a/lib/Magento/Filesystem/File/ReadInterface.php b/lib/Magento/Filesystem/File/ReadInterface.php index a8b02a5dc17..1892ef91d30 100644 --- a/lib/Magento/Filesystem/File/ReadInterface.php +++ b/lib/Magento/Filesystem/File/ReadInterface.php @@ -33,6 +33,15 @@ interface ReadInterface */ public function read($length); + /** + * Reads the line with specified number of bytes from the current position. + * + * @param int $length The number of bytes to read + * @param string $ending [optional] + * @return string + */ + public function readLine($length, $ending = null); + /** * Reads one CSV row from the file * diff --git a/lib/Magento/Filesystem/File/Write.php b/lib/Magento/Filesystem/File/Write.php index 4a62f815dfa..865dbb604a0 100644 --- a/lib/Magento/Filesystem/File/Write.php +++ b/lib/Magento/Filesystem/File/Write.php @@ -18,24 +18,31 @@ * 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 * @copyright Copyright (c) 2013 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\File; +use Magento\Filesystem\DriverInterface; use Magento\Filesystem\FilesystemException; +use Magento\Webapi\Exception; class Write extends Read implements WriteInterface { /** + * Constructor + * * @param string $path + * @param DriverInterface $driver * @param string $mode */ - public function __construct($path, $mode) + public function __construct($path, DriverInterface $driver, $mode) { $this->mode = $mode; - parent::__construct($path); + parent::__construct($path, $driver); } /** @@ -45,9 +52,7 @@ class Write extends Read implements WriteInterface */ protected function assertValid() { - clearstatcache(); - - $fileExists = file_exists($this->path); + $fileExists = $this->driver->isExists($this->path); if (!$fileExists && preg_match('/r/', $this->mode)) { throw new FilesystemException(sprintf('The file "%s" doesn\'t exist', $this->path)); } elseif ($fileExists && preg_match('/x/', $this->mode)) { @@ -64,11 +69,15 @@ class Write extends Read implements WriteInterface */ public function write($data) { - $result = fwrite($this->resource, $data); - if ($result === false) { - throw new FilesystemException(sprintf('Cannot write to the "%s" file', $this->path)); + try { + return $this->driver->fileWrite($this->resource, $data); + } catch (FilesystemException $e) { + throw new FilesystemException( + sprintf('Cannot write to the "%s" file. %s', + $this->path, + $e->getMessage() + )); } - return $result; } /** @@ -82,11 +91,15 @@ class Write extends Read implements WriteInterface */ public function writeCsv(array $data, $delimiter = ',', $enclosure = '"') { - $result = fputcsv($this->resource, $data, $delimiter, $enclosure); - if ($result === false) { - throw new FilesystemException(sprintf('Cannot write to the "%s" file', $this->path)); + try { + return $this->driver->filePutCsv($this->resource, $data, $delimiter, $enclosure); + } catch (FilesystemException $e) { + throw new FilesystemException( + sprintf('Cannot write to the "%s" file. %s', + $this->path, + $e->getMessage() + )); } - return $result; } /** @@ -97,23 +110,26 @@ class Write extends Read implements WriteInterface */ public function flush() { - $result = fflush($this->resource); - if ($result === false) { - throw new FilesystemException(sprintf('Cannot flush the "%s" file', $this->path)); + try { + return $this->driver->fileFlush($this->resource); + } catch (FilesystemException $e) { + throw new FilesystemException( + sprintf('Cannot flush the "%s" file. %s', + $this->path, + $e->getMessage() + )); } - return $result; } /** * Portable advisory file locking * - * @param bool $exclusive + * @param int $lockMode * @return bool */ - public function lock($exclusive = true) + public function lock($lockMode = LOCK_EX) { - $lock = $exclusive ? LOCK_EX : LOCK_SH; - return flock($this->resource, $lock); + return $this->driver->fileLock($this->resource, $lockMode); } /** @@ -123,21 +139,6 @@ class Write extends Read implements WriteInterface */ public function unlock() { - return flock($this->resource, LOCK_UN); - } - - /** - * Closes the file. - * - * @return bool - * @throws FilesystemException - */ - public function close() - { - $result = fclose($this->resource); - if ($result === false) { - throw new FilesystemException(sprintf('Cannot close the "%s" file', $this->path)); - } - return $result; + return $this->driver->fileUnlock($this->resource); } } \ No newline at end of file diff --git a/lib/Magento/Filesystem/File/WriteFactory.php b/lib/Magento/Filesystem/File/WriteFactory.php index 7635fcd064a..a1e2263c1e9 100644 --- a/lib/Magento/Filesystem/File/WriteFactory.php +++ b/lib/Magento/Filesystem/File/WriteFactory.php @@ -18,36 +18,46 @@ * 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 * @copyright Copyright (c) 2013 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\File; +use Magento\Filesystem\DriverInterface; + class WriteFactory { /** - * @var \Magento\ObjectManager + * @var \Magento\Filesystem\DriverFactory */ - protected $objectManager; + protected $driverFactory; /** - * @param \Magento\ObjectManager $objectManager + * @param \Magento\Filesystem\DriverFactory $driverFactory */ - public function __construct(\Magento\ObjectManager $objectManager) + public function __construct(\Magento\Filesystem\DriverFactory $driverFactory) { - $this->objectManager = $objectManager; + $this->driverFactory = $driverFactory; } /** - * Create a readable file + * Create a readable file. * - * @param string $path + * @param $path + * @param string|null $protocol + * @param DriverInterface $directoryDriver [optional] * @param string $mode - * @return \Magento\Filesystem\File\WriteInterface + * @return Write */ - public function create($path, $mode) + public function create($path, $protocol, DriverInterface $directoryDriver = null, $mode = 'r') { - return $this->objectManager->create('Magento\Filesystem\File\Write', array('path' => $path, 'mode' => $mode)); + $fileDriver = $directoryDriver; + if ($protocol) { + $fileDriver = $this->driverFactory->get($protocol, $directoryDriver); + } + return new \Magento\Filesystem\File\Write($path, $fileDriver, $mode); } } \ No newline at end of file diff --git a/lib/Magento/Filesystem/File/WriteInterface.php b/lib/Magento/Filesystem/File/WriteInterface.php index 1ae2728eb20..e211029c745 100644 --- a/lib/Magento/Filesystem/File/WriteInterface.php +++ b/lib/Magento/Filesystem/File/WriteInterface.php @@ -56,10 +56,10 @@ interface WriteInterface extends ReadInterface /** * Portable advisory file locking * - * @param bool $exclusive + * @param int $lockMode * @return bool */ - public function lock($exclusive = true); + public function lock($lockMode = LOCK_EX); /** * File unlocking diff --git a/lib/Magento/Filesystem/Stream/Local.php b/lib/Magento/Filesystem/Stream/Local.php deleted file mode 100644 index 9056a5b656a..00000000000 --- a/lib/Magento/Filesystem/Stream/Local.php +++ /dev/null @@ -1,325 +0,0 @@ -<?php -/** - * Magento filesystem local stream - * - * 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) 2013 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\Stream; - -class Local implements \Magento\Filesystem\StreamInterface -{ - /** - * @var \Magento\Filesystem - */ - protected $_filesystem; - - /** - * Stream path - * - * @var string - */ - protected $_path; - - /** - * Stream mode - * - * @var \Magento\Filesystem\Stream\Mode - */ - protected $_mode; - - /** - * Stream file resource handle - * - * @var - */ - protected $_fileHandle; - - /** - * Is stream locked - * - * @var bool - */ - protected $_isLocked = false; - - /** - * Constructor - * - * @param string $path - */ - public function __construct($path) - { - $this->_path = $path; - } - - /** - * Opens the stream in the specified mode - * - * @param \Magento\Filesystem\Stream\Mode|string $mode - * @throws \Magento\Filesystem\FilesystemException If stream cannot be opened - */ - public function open($mode) - { - if (is_string($mode)) { - $mode = new \Magento\Filesystem\Stream\Mode($mode); - } - $fileHandle = @fopen($this->_path, $mode->getMode()); - if (false === $fileHandle) { - throw new \Magento\Filesystem\FilesystemException( - sprintf('The stream "%s" cannot be opened', $this->_path) - ); - } - $this->_mode = $mode; - $this->_fileHandle = $fileHandle; - } - - /** - * Reads the specified number of bytes from the current position. - * - * @param integer $count The number of bytes to read - * @return string - * @throws \Magento\Filesystem\FilesystemException If stream wasn't read. - */ - public function read($count) - { - $this->_assertReadable(); - $result = @fread($this->_fileHandle, $count); - if ($result === false) { - throw new \Magento\Filesystem\FilesystemException('Read of the stream caused an error.'); - } - return $result; - } - - /** - * Reads one CSV row from the stream - * - * @param int $count [optional] <p> - * Must be greater than the longest line (in characters) to be found in - * the CSV file (allowing for trailing line-end characters). It became - * optional in PHP 5. Omitting this parameter (or setting it to 0 in PHP - * 5.0.4 and later) the maximum line length is not limited, which is - * slightly slower. - * @param string $delimiter - * @param string $enclosure - * @return array|bool false on end of file - * @throws \Magento\Filesystem\FilesystemException - */ - public function readCsv($count = 0, $delimiter = ',', $enclosure = '"') - { - $this->_assertReadable(); - $result = @fgetcsv($this->_fileHandle, $count); - if ($result === false && $this->eof()) { - return false; - } - if (!is_array($result)) { - throw new \Magento\Filesystem\FilesystemException('Read of the stream caused an error.'); - } - return $result; - } - - /** - * Writes the data to stream. - * - * @param string $data - * @return integer - * @throws \Magento\Filesystem\FilesystemException - */ - public function write($data) - { - $this->_assertWritable(); - $result = @fwrite($this->_fileHandle, $data); - if (false === $result) { - throw new \Magento\Filesystem\FilesystemException('Write to the stream caused an error.'); - } - return $result; - } - - /** - * Writes one CSV row to the stream. - * - * @param array $data - * @param string $delimiter - * @param string $enclosure - * @return integer - * @throws \Magento\Filesystem\FilesystemException - */ - public function writeCsv(array $data, $delimiter = ',', $enclosure = '"') - { - $this->_assertWritable(); - $result = fputcsv($this->_fileHandle, $data, $delimiter, $enclosure); - if (false === $result) { - throw new \Magento\Filesystem\FilesystemException('Write to the stream caused an error.'); - } - return $result; - } - - /** - * Closes the stream. - * - * @throws \Magento\Filesystem\FilesystemException - */ - public function close() - { - $this->_assertOpened(); - if ($this->_isLocked) { - $this->unlock(); - } - $result = @fclose($this->_fileHandle); - - if (false === $result) { - throw new \Magento\Filesystem\FilesystemException('Close of the stream caused an error.'); - } - - $this->_mode = null; - $this->_fileHandle = null; - } - - /** - * Flushes the output. - * - * @throws \Magento\Filesystem\FilesystemException - */ - public function flush() - { - $this->_assertOpened(); - $result = @fflush($this->_fileHandle); - if (!$result) { - throw new \Magento\Filesystem\FilesystemException('Flush of the stream caused an error.'); - } - } - - /** - * Seeks to the specified offset - * - * @param int $offset - * @param int $whence - * @throws \Magento\Filesystem\FilesystemException - */ - public function seek($offset, $whence = SEEK_SET) - { - $this->_assertOpened(); - $result = fseek($this->_fileHandle, $offset, $whence); - if (0 !== $result) { - throw new \Magento\Filesystem\FilesystemException('seek operation on the stream caused an error.'); - } - } - - /** - * Returns the current position - * - * @return int - * @throws \Magento\Filesystem\FilesystemException - */ - public function tell() - { - $this->_assertOpened(); - $result = ftell($this->_fileHandle); - if (false === $result) { - throw new \Magento\Filesystem\FilesystemException('tell operation on the stream caused an error.'); - } - return $result; - } - - /** - * Checks if the current position is the end-of-file - * - * @return bool - */ - public function eof() - { - $this->_assertOpened(); - return (bool)@feof($this->_fileHandle); - } - - /** - * Asserts the stream is readable - * - * @throws \Magento\Filesystem\FilesystemException - */ - protected function _assertReadable() - { - $this->_assertOpened(); - if (false === $this->_mode->isReadAllowed()) { - throw new \Magento\Filesystem\FilesystemException('The stream does not allow read.'); - } - } - - /** - * Asserts the stream is writable - * - * @throws \Magento\Filesystem\FilesystemException - */ - protected function _assertWritable() - { - $this->_assertOpened(); - if (false === $this->_mode->isWriteAllowed()) { - throw new \Magento\Filesystem\FilesystemException('The stream does not allow write.'); - } - } - - /** - * Asserts the stream is opened - * - * @throws \Magento\Filesystem\FilesystemException - */ - protected function _assertOpened() - { - if (!$this->_fileHandle) { - throw new \Magento\Filesystem\FilesystemException(sprintf('The stream "%s" is not opened', $this->_path)); - } - } - - /** - * Portable advisory file locking - * - * @param bool $exclusive - * @throws \Magento\Filesystem\FilesystemException - */ - public function lock($exclusive = true) - { - $this->_assertOpened(); - $lock = $exclusive ? LOCK_EX : LOCK_SH; - $this->_isLocked = flock($this->_fileHandle, $lock); - if (!$this->_isLocked) { - throw new \Magento\Filesystem\FilesystemException( - sprintf('The stream "%s" can not be locked', $this->_path) - ); - } - } - - /** - * File unlocking - * - * @throws \Magento\Filesystem\FilesystemException - */ - public function unlock() - { - $this->_assertOpened(); - if ($this->_isLocked) { - if (!flock($this->_fileHandle, LOCK_UN)) { - throw new \Magento\Filesystem\FilesystemException( - sprintf('The stream "%s" can not be unlocked', $this->_path) - ); - } - } - $this->_isLocked = false; - } -} diff --git a/lib/Magento/Filesystem/Stream/Mode.php b/lib/Magento/Filesystem/Stream/Mode.php deleted file mode 100644 index c06da0b0a1c..00000000000 --- a/lib/Magento/Filesystem/Stream/Mode.php +++ /dev/null @@ -1,172 +0,0 @@ -<?php -/** - * Magento filesystem stream mode - * - * 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) 2013 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\Stream; - -class Mode -{ - /** - * A stream mode as for the use of fopen() - * - * @var string - */ - protected $_mode; - - /** - * Base mode (e.g "r", "w", "a") - * - * @var string - */ - protected $_base; - - /** - * Is mode has plus (e.g. "w+") - * - * @var string - */ - protected $_plus; - - /** - * Additional mode of stream (e.g. "rb") - * - * @var string - */ - protected $_flag; - - /** - * Constructor - * - * @param string $mode - */ - public function __construct($mode) - { - $this->_mode = $mode; - - $mode = substr($mode, 0, 3); - $rest = substr($mode, 1); - - $this->_base = substr($mode, 0, 1); - $this->_plus = false !== strpos($rest, '+'); - $this->_flag = trim($rest, '+'); - } - - /** - * Returns the underlying mode - * - * @return string - */ - public function getMode() - { - return $this->_mode; - } - - /** - * Indicates whether the mode allows to read - * - * @return bool - */ - public function isReadAllowed() - { - if ($this->_plus) { - return true; - } - - return 'r' === $this->_base; - } - - /** - * Checks whether the mode allows to write. - * - * @return bool - */ - public function isWriteAllowed() - { - if ($this->_plus) { - return true; - } - - return 'r' !== $this->_base; - } - - /** - * Checks whether the mode allows to open an existing file. - * - * @return bool - */ - public function isExistingFileOpenAllowed() - { - return 'x' !== $this->_base; - } - - /** - * Checks whether the mode allows to create a new file. - * - * @return bool - */ - public function isNewFileOpenAllowed() - { - return 'r' !== $this->_base; - } - - /** - * Indicates whether the mode implies to delete the existing content of the file when it already exists - * - * @return bool - */ - public function isExistingContentDeletionImplied() - { - return 'w' === $this->_base; - } - - /** - * Indicates whether the mode implies positioning the cursor at the beginning of the file - * - * @return bool - */ - public function isPositioningCursorAtTheBeginningImplied() - { - return 'a' !== $this->_base; - } - - /** - * Indicates whether the mode implies positioning the cursor at the end of the file - * - * @return bool - */ - public function isPositioningCursorAtTheEndImplied() - { - return 'a' === $this->_base; - } - - /** - * Indicates whether the stream is in binary mode - * - * @return bool - */ - public function isBinary() - { - return 'b' === $this->_flag; - } -} diff --git a/lib/Magento/Filesystem/Stream/Mode/Zlib.php b/lib/Magento/Filesystem/Stream/Mode/Zlib.php deleted file mode 100644 index fa7530a184c..00000000000 --- a/lib/Magento/Filesystem/Stream/Mode/Zlib.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento filesystem zlib stream mode - * - * 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) 2013 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\Stream\Mode; - -class Zlib extends \Magento\Filesystem\Stream\Mode -{ - /** - * Compression ratio - * - * @var int - */ - protected $_ratio = 1; - - /** - * Compression strategy - * - * @var string - */ - protected $_strategy = ''; - - /** - * @param string $mode - */ - public function __construct($mode) - { - $searchPattern = '/(r|w|a|x|c)(b)?(\+)?(\d*)(f|h)?/'; - preg_match($searchPattern, $mode, $ratios); - if (count($ratios) > 4 && $ratios[4]) { - $this->_ratio = (int)$ratios[4]; - } - if (count($ratios) == 6) { - $this->_strategy = $ratios[5]; - } - $mode = preg_replace($searchPattern, '\1\2\3', $mode); - parent::__construct($mode); - } - - /** - * Get compression ratio - * - * @return int - */ - public function getRatio() - { - return $this->_ratio; - } - - /** - * Get compression strategy - * - * @return null|string - */ - public function getStrategy() - { - return $this->_strategy; - } -} diff --git a/lib/Magento/Filesystem/StreamInterface.php b/lib/Magento/Filesystem/StreamInterface.php deleted file mode 100644 index bd8ad25833d..00000000000 --- a/lib/Magento/Filesystem/StreamInterface.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php -/** - * Interface of Magento filesystem stream - * - * 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) 2013 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; - -interface StreamInterface -{ - /** - * Opens the stream in the specified mode - * - * @param \Magento\Filesystem\Stream\Mode|string $mode - * @throws \Magento\Filesystem\FilesystemException - */ - public function open($mode); - - /** - * Reads the specified number of bytes from the current position. - * - * @param integer $count The number of bytes to read - * @return string - * @throws \Magento\Filesystem\FilesystemException - */ - public function read($count); - - /** - * Reads one CSV row from the stream - * - * @param int $count [optional] <p> - * Must be greater than the longest line (in characters) to be found in - * the CSV file (allowing for trailing line-end characters). It became - * optional in PHP 5. Omitting this parameter (or setting it to 0 in PHP - * 5.0.4 and later) the maximum line length is not limited, which is - * slightly slower. - * @param string $delimiter - * @param string $enclosure - * @return array|bool false on end of file - * @throws \Magento\Filesystem\FilesystemException - */ - public function readCsv($count = 0, $delimiter = ',', $enclosure = '"'); - - /** - * Writes the data to stream. - * - * @param string $data - * @return integer - * @throws \Magento\Filesystem\FilesystemException - */ - public function write($data); - - /** - * Writes one CSV row to the stream - * - * @param array $data - * @param string $delimiter - * @param string $enclosure - * @return integer - * @throws \Magento\Filesystem\FilesystemException - */ - public function writeCsv(array $data, $delimiter = ',', $enclosure = '"'); - - /** - * Closes the stream. - * - * @throws \Magento\Filesystem\FilesystemException - */ - public function close(); - - /** - * Flushes the output. - * - * @throws \Magento\Filesystem\FilesystemException - */ - public function flush(); - - /** - * Seeks to the specified offset - * - * @param int $offset - * @param int $whence - * @throws \Magento\Filesystem\FilesystemException - */ - public function seek($offset, $whence = SEEK_SET); - - /** - * Returns the current position - * - * @return int - * @throws \Magento\Filesystem\FilesystemException - */ - public function tell(); - - /** - * Checks if the current position is the end-of-file - * - * @return bool - * @throws \Magento\Filesystem\FilesystemException - */ - public function eof(); - - /** - * Portable advisory file locking - * - * @param bool $exclusive - * @throws \Magento\Filesystem\FilesystemException - */ - public function lock($exclusive = true); - - /** - * File unlocking - * - * @throws \Magento\Filesystem\FilesystemException - */ - public function unlock(); -} diff --git a/lib/Magento/Filesystem/WrapperFactory.php b/lib/Magento/Filesystem/WrapperFactory.php new file mode 100644 index 00000000000..ddfe82db09e --- /dev/null +++ b/lib/Magento/Filesystem/WrapperFactory.php @@ -0,0 +1,67 @@ +<?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 + * @copyright Copyright (c) 2013 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; + +/** + * Class WrapperFactory + * + * @package Magento\Filesystem + */ +class WrapperFactory +{ + /** + * @var array + */ + private $wrappers = array(); + + /** + * @var \Magento\Filesystem\DirectoryList + */ + protected $directoryList; + + public function __construct(\Magento\Filesystem\DirectoryList $directoryList) + { + $this->directoryList = $directoryList; + } + + /** + * Return specific wrapper + * + * @param string $protocolCode + * @param DriverInterface $driver + */ + public function get($protocolCode, \Magento\Filesystem\DriverInterface $driver) + { + $wrapperClass = $this->directoryList->getProtocolConfig($protocolCode)['driver']; + + if (!isset($this->wrappers[$protocolCode])) { + $this->wrappers[$protocolCode] = new $wrapperClass($driver); + } + + return $this->wrappers[$protocolCode]; + } +} diff --git a/lib/Magento/Filesystem/WrapperInterface.php b/lib/Magento/Filesystem/WrapperInterface.php new file mode 100644 index 00000000000..2b3740f5805 --- /dev/null +++ b/lib/Magento/Filesystem/WrapperInterface.php @@ -0,0 +1,174 @@ +<?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 + * @copyright Copyright (c) 2013 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; + +interface WrapperInterface +{ + /** + * @return mixed + */ + public function dir_closedir(); + + /** + * @param $path + * @param $options + * @return mixed + */ + public function dir_opendir($path, $options); + + /** + * @return mixed + */ + public function dir_readdir(); + + /** + * @return mixed + */ + public function dir_rewinddir(); + + /** + * @param $path + * @param $mode + * @param $options + * @return mixed + */ + public function mkdir($path, $mode, $options); + + /** + * @param $from + * @param $to + * @return mixed + */ + public function rename($from, $to); + + /** + * @param $path + * @param $options + * @return mixed + */ + public function rmdir($path, $options); + + /** + * @param $cast + * @return mixed + */ + public function stream_cast($cast); + + /** + * @return mixed + */ + public function stream_close(); + + /** + * @return mixed + */ + public function stream_eof(); + + /** + * @return mixed + */ + public function stream_flush(); + + /** + * @param $operation + * @return mixed + */ + public function stream_lock($operation); + + /** + * @param $path + * @param $option + * @param $value + * @return mixed + */ + public function stream_metadata($path, $option, $value); + + /** + * @param $path + * @param $mode + * @param $options + * @param $openedPath + * @return mixed + */ + public function stream_open($path, $mode, $options, &$openedPath); + + /** + * @param $count + * @return mixed + */ + public function stream_read($count); + + /** + * @param $offset + * @param int $whence + * @return mixed + */ + public function stream_seek($offset, $whence = SEEK_SET); + + /** + * @param $option + * @param $arg1 + * @param $arg2 + * @return mixed + */ + public function stream_set_option($option, $arg1, $arg2); + + /** + * @return mixed + */ + public function stream_stat(); + + /** + * @return mixed + */ + public function stream_tell(); + + /** + * @param $newSize + * @return mixed + */ + public function stream_truncate ($newSize); + + /** + * @param $data + * @return mixed + */ + public function stream_write($data); + + /** + * @param $path + * @return mixed + */ + public function unlink($path); + + /** + * @param $path + * @param $flags + * @return mixed + */ + public function url_stat($path, $flags); +} diff --git a/lib/Magento/HTTP/Client.php b/lib/Magento/HTTP/Client.php index 76c4b4f45d0..81c229e2392 100644 --- a/lib/Magento/HTTP/Client.php +++ b/lib/Magento/HTTP/Client.php @@ -62,7 +62,7 @@ class Client throw new \Exception("Cannot find frontend automatically, set it manually"); } - $class = __CLASS__."_".str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $frontend))); + $class = __CLASS__."_".str_replace(' ', '/', ucwords(str_replace('_', ' ', $frontend))); $obj = new $class(); return $obj; } diff --git a/lib/Magento/Image/Adapter/AbstractAdapter.php b/lib/Magento/Image/Adapter/AbstractAdapter.php index 299f64eda89..407f738f628 100644 --- a/lib/Magento/Image/Adapter/AbstractAdapter.php +++ b/lib/Magento/Image/Adapter/AbstractAdapter.php @@ -78,10 +78,21 @@ abstract class AbstractAdapter implements AdapterInterface protected $_constrainOnly; /** - * IO model to work with files - * @var \Magento\Io\File + * Filesystem instance + * + * @var \Magento\Filesystem + */ + protected $_filesystem; + + /** + * @var \Magento\Filesystem\Directory\Write + */ + protected $directoryWrite; + + /** + * @var \Magento\Logger */ - protected $_ioFile; + protected $logger; abstract public function open($fileName); @@ -130,11 +141,12 @@ abstract class AbstractAdapter implements AdapterInterface /** * Initialize default values * + * @param \Magento\Filesystem $filesystem, * @param array $data */ - public function __construct(array $data = array()) - { - $this->_ioFile = isset($data['io']) ? $data['io'] : new \Magento\Io\File(); + public function __construct(\Magento\Filesystem $filesystem, array $data = array()) { + $this->_filesystem = $filesystem; + $this->directoryWrite = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); } /** @@ -530,16 +542,14 @@ abstract class AbstractAdapter implements AdapterInterface } else { $newFileName = $newName; } - $fileName = $destination . DIRECTORY_SEPARATOR . $newFileName; + $fileName = $destination . '/' . $newFileName; if (!is_writable($destination)) { try { - $result = $this->_ioFile->mkdir($destination); - } catch (\Exception $e) { - $result = false; - } - - if (!$result) { + $this->directoryWrite->create($this->directoryWrite->getRelativePath($destination)); + } catch (\Magento\Filesystem\FilesystemException $e) { + $this->logger->addStreamLog(\Magento\Logger::LOGGER_SYSTEM); + $this->logger->log($e->getMessage()); throw new \Exception('Unable to write file into directory ' . $destination . '. Access forbidden.'); } } diff --git a/lib/Magento/Io/File.php b/lib/Magento/Io/File.php index 2dd30904d73..6944f009e53 100644 --- a/lib/Magento/Io/File.php +++ b/lib/Magento/Io/File.php @@ -403,7 +403,7 @@ class File extends \Magento\Io\AbstractIo if (!strcmp($item, '.') || !strcmp($item, '..')) { continue; } - self::_recursiveCallback($dir . DIRECTORY_SEPARATOR . $item, $fileCallback, $dirCallback); + self::_recursiveCallback($dir . '/' . $item, $fileCallback, $dirCallback); } $callback = $dirCallback[0]; if (!is_callable($callback)) { @@ -721,7 +721,7 @@ class File extends \Magento\Io\AbstractIo while (($entry = readdir($dirHandler)) !== false) { $listItem = Array(); - $fullPath = $dir . DIRECTORY_SEPARATOR . $entry; + $fullPath = $dir . '/' . $entry; if (($grep == self::GREP_DIRS) && (!is_dir($fullPath))) { continue; @@ -872,7 +872,7 @@ class File extends \Magento\Io\AbstractIo */ public function dirsep() { - return DIRECTORY_SEPARATOR; + return '/'; } /** diff --git a/lib/Magento/Io/Sftp.php b/lib/Magento/Io/Sftp.php index 51fb706ae82..1192d88eede 100644 --- a/lib/Magento/Io/Sftp.php +++ b/lib/Magento/Io/Sftp.php @@ -42,7 +42,7 @@ class Sftp extends \Magento\Io\AbstractIo implements \Magento\Io\IoInterface const SSH2_PORT = 22; /** - * @var Net_SFTP $_connection + * @var \Net_SFTP $_connection */ protected $_connection = null; diff --git a/lib/Magento/Logger.php b/lib/Magento/Logger.php index 160a5e45626..466f85b40b7 100644 --- a/lib/Magento/Logger.php +++ b/lib/Magento/Logger.php @@ -42,28 +42,17 @@ class Logger protected $_loggers = array(); /** - * @var \Magento\App\Dir + * @var \Magento\Filesystem */ - protected $_dirs = null; + protected $_filesystem; /** - * @var \Magento\Io\File - */ - protected $_fileSystem; - - - /** - * @param \Magento\App\Dir $dirs - * @param \Magento\Io\File $fileSystem + * @param \Magento\Filesystem $filesystem * @param string $defaultFile */ - public function __construct( - \Magento\App\Dir $dirs, - \Magento\Io\File $fileSystem, - $defaultFile = '' - ) { - $this->_dirs = $dirs; - $this->_fileSystem = $fileSystem; + public function __construct(\Magento\Filesystem $filesystem, $defaultFile = '') + { + $this->_filesystem = $filesystem; $this->addStreamLog(self::LOGGER_SYSTEM, $defaultFile) ->addStreamLog(self::LOGGER_EXCEPTION, $defaultFile); } @@ -83,9 +72,9 @@ class Logger { $file = $fileOrWrapper ?: "{$loggerKey}.log"; if (!preg_match('#^[a-z][a-z0-9+.-]*\://#i', $file)) { - $logDir = $this->_dirs->getDir(\Magento\App\Dir::LOG); - $this->_fileSystem->checkAndCreateFolder($logDir); - $file = $logDir . DIRECTORY_SEPARATOR . $file; + $logDir = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::LOG); + $logDir->create(); + $file = $logDir->getAbsolutePath($file); } if (!$writerClass || !is_subclass_of($writerClass, 'Zend_Log_Writer_Stream')) { $writerClass = 'Zend_Log_Writer_Stream'; diff --git a/lib/Magento/Message/AbstractMessage.php b/lib/Magento/Message/AbstractMessage.php index 6665116d7a4..773a90f7037 100644 --- a/lib/Magento/Message/AbstractMessage.php +++ b/lib/Magento/Message/AbstractMessage.php @@ -27,27 +27,12 @@ namespace Magento\Message; /** * Abstract message model */ -abstract class AbstractMessage +abstract class AbstractMessage implements MessageInterface { /** * @var string */ - protected $type; - - /** - * @var string - */ - protected $code; - - /** - * @var mixed - */ - protected $class; - - /** - * @var mixed - */ - protected $method; + protected $text; /** * @var mixed @@ -60,79 +45,47 @@ abstract class AbstractMessage protected $isSticky = false; /** - * @param string $code + * @param string $text */ - public function __construct($code = '') + public function __construct($text) { - $this->code = $code; + $this->text = $text; } /** - * Get message code + * Getter message type * * @return string */ - public function getCode() - { - return $this->code; - } + abstract public function getType(); /** - * Get message text + * Getter for text of message * * @return string */ public function getText() { - return $this->getCode(); + return $this->text; } /** - * Get message type + * Setter message text * - * @return string + * @param string $text + * @return $this */ - public function getType() + public function setText($text) { - return $this->type; - } - - /** - * Get message class - * - * @param $class - */ - public function setClass($class) - { - $this->class = $class; - } - - /** - * Get message method - * - * @param $method - */ - public function setMethod($method) - { - $this->method = $method; - } - - /** - * Convert message to string - * - * @return string - */ - public function toString() - { - $out = $this->getType() . ': ' . $this->getText(); - return $out; + $this->text = $text; + return $this; } /** - * Set message identifier + * Setter message identifier * * @param string $identifier - * @return AbstractMessage + * @return $this */ public function setIdentifier($identifier) { @@ -141,7 +94,7 @@ abstract class AbstractMessage } /** - * Get message identifier + * Getter message identifier * * @return string */ @@ -151,10 +104,10 @@ abstract class AbstractMessage } /** - * Set message sticky status + * Setter for flag. Whether message is sticky * * @param bool $isSticky - * @return AbstractMessage + * @return $this */ public function setIsSticky($isSticky = true) { @@ -163,7 +116,7 @@ abstract class AbstractMessage } /** - * Get whether message is sticky + * Getter for flag. Whether message is sticky * * @return bool */ @@ -173,14 +126,13 @@ abstract class AbstractMessage } /** - * Set code + * Retrieve message as a string * - * @param string $code - * @return AbstractMessage + * @return string */ - public function setCode($code) + public function toString() { - $this->code = $code; - return $this; + $out = $this->getType() . ': ' . $this->getText(); + return $out; } } diff --git a/lib/Magento/Message/Collection.php b/lib/Magento/Message/Collection.php index 20f96d8e48e..e54ac07ee98 100644 --- a/lib/Magento/Message/Collection.php +++ b/lib/Magento/Message/Collection.php @@ -37,28 +37,17 @@ class Collection protected $messages = array(); /** - * @var string + * @var MessageInterface */ protected $lastAddedMessage; /** * Adding new message to collection * - * @param AbstractMessage $message + * @param MessageInterface $message * @return Collection */ - public function add(AbstractMessage $message) - { - return $this->addMessage($message); - } - - /** - * Adding new message to collection - * - * @param AbstractMessage $message - * @return Collection - */ - public function addMessage(AbstractMessage $message) + public function addMessage(MessageInterface $message) { if (!isset($this->messages[$message->getType()])) { $this->messages[$message->getType()] = array(); @@ -77,7 +66,7 @@ class Collection { foreach ($this->messages as $type => $messages) { foreach ($messages as $id => $message) { - /** @var $message AbstractMessage */ + /** @var $message MessageInterface */ if (!$message->getIsSticky()) { unset($this->messages[$type][$id]); } @@ -86,13 +75,16 @@ class Collection unset($this->messages[$type]); } } + if ($this->lastAddedMessage instanceof MessageInterface && !$this->lastAddedMessage->getIsSticky()) { + $this->lastAddedMessage = null; + } return $this; } /** * Get last added message if any * - * @return AbstractMessage|null + * @return MessageInterface|null */ public function getLastAddedMessage() { @@ -103,13 +95,13 @@ class Collection * Get first even message by identifier * * @param string $identifier - * @return AbstractMessage|null + * @return MessageInterface|null */ public function getMessageByIdentifier($identifier) { foreach ($this->messages as $messages) { foreach ($messages as $message) { - /** @var $message AbstractMessage */ + /** @var $message MessageInterface */ if ($identifier === $message->getIdentifier()) { return $message; } @@ -126,7 +118,7 @@ class Collection { foreach ($this->messages as $type => $messages) { foreach ($messages as $id => $message) { - /** @var $message AbstractMessage */ + /** @var $message MessageInterface */ if ($identifier === $message->getIdentifier()) { unset($this->messages[$type][$id]); } @@ -140,21 +132,16 @@ class Collection /** * Retrieve messages collection items * - * @param string $type * @return array */ - public function getItems($type = null) + public function getItems() { - if ($type) { - return isset($this->messages[$type]) ? $this->messages[$type] : array(); - } - - $arrRes = array(); + $result = array(); foreach ($this->messages as $messages) { - $arrRes = array_merge($arrRes, $messages); + $result = array_merge($result, $messages); } - return $arrRes; + return $result; } /** @@ -175,37 +162,35 @@ class Collection */ public function getErrors() { - return $this->getItemsByType(Factory::ERROR); + return $this->getItemsByType(MessageInterface::TYPE_ERROR); } /** - * @return string + * Retrieve messages count by type + * + * @param string $type + * @return int */ - public function toString() + public function getCountByType($type) { - $out = ''; - $arrItems = $this->getItems(); - foreach ($arrItems as $item) { - $out .= $item->toString(); + $result = 0; + if (isset($this->messages[$type])) { + $result = count($this->messages[$type]); } - - return $out; + return $result; } /** * Retrieve messages count * - * @param null|string $type * @return int */ - public function count($type = null) + public function getCount() { - if ($type) { - if (isset($this->messages[$type])) { - return count($this->messages[$type]); - } - return 0; + $result = 0; + foreach ($this->messages as $messages) { + $result += count($messages); } - return count($this->messages); + return $result; } } diff --git a/lib/Magento/Message/Error.php b/lib/Magento/Message/Error.php index 59f694976f5..0f69cde151c 100644 --- a/lib/Magento/Message/Error.php +++ b/lib/Magento/Message/Error.php @@ -30,7 +30,12 @@ namespace Magento\Message; class Error extends AbstractMessage { /** - * @var string + * Getter message type + * + * @return string */ - protected $type = Factory::ERROR; + public function getType() + { + return MessageInterface::TYPE_ERROR; + } } diff --git a/lib/Magento/Message/Factory.php b/lib/Magento/Message/Factory.php index 27de2b825a1..34fcbce496d 100644 --- a/lib/Magento/Message/Factory.php +++ b/lib/Magento/Message/Factory.php @@ -29,36 +29,16 @@ namespace Magento\Message; */ class Factory { - /** - * Error type - */ - const ERROR = 'error'; - - /** - * Warning type - */ - const WARNING = 'warning'; - - /** - * Notice type - */ - const NOTICE = 'notice'; - - /** - * Success type - */ - const SUCCESS = 'success'; - /** * Allowed message types * * @var array */ protected $types = array( - self::ERROR, - self::WARNING, - self::NOTICE, - self::SUCCESS, + MessageInterface::TYPE_ERROR, + MessageInterface::TYPE_WARNING, + MessageInterface::TYPE_NOTICE, + MessageInterface::TYPE_SUCCESS, ); /** @@ -81,80 +61,23 @@ class Factory /** * Create message instance with specified parameters * - * @param $type - * @param string $code - * @param string $class - * @param string $method + * @param string $type + * @param string $text * @throws \InvalidArgumentException - * @return AbstractMessage + * @return MessageInterface */ - public function create($type, $code = '', $class = '', $method = '') + public function create($type, $text) { if (!in_array($type, $this->types)) { throw new \InvalidArgumentException('Wrong message type'); } $className = 'Magento\Message\\' . ucfirst($type); - $message = $this->objectManager->create($className, array('code' => $code)); - if (!($message instanceof AbstractMessage)) { - throw new \InvalidArgumentException($className . ' doesn\'t extends \Magento\Message\AbstractMessage'); + $message = $this->objectManager->create($className, array('text' => $text)); + if (!($message instanceof MessageInterface)) { + throw new \InvalidArgumentException($className . ' doesn\'t implement \Magento\Message\MessageInterface'); } - $message->setClass($class); - $message->setMethod($method); - return $message; } - - /** - * Create error message - * - * @param $code - * @param string $class - * @param string $method - * @return Error - */ - public function error($code, $class='', $method='') - { - return $this->create(self::ERROR, $code, $class, $method); - } - - /** - * Create warning message - * - * @param $code - * @param string $class - * @param string $method - * @return Warning - */ - public function warning($code, $class='', $method='') - { - return $this->create(self::WARNING, $code, $class, $method); - } - - /** - * Create notice message - * - * @param $code - * @param string $class - * @param string $method - * @return Notice - */ - public function notice($code, $class='', $method='') - { - return $this->create(self::NOTICE, $code, $class, $method); - } - - /** - * Create success message - * - * @param $code - * @param string $class - * @param string $method - * @return Success - */ - public function success($code, $class='', $method='') - { - return $this->create(self::SUCCESS, $code, $class, $method); - } } diff --git a/lib/Magento/Message/Manager.php b/lib/Magento/Message/Manager.php new file mode 100644 index 00000000000..56aae5d271a --- /dev/null +++ b/lib/Magento/Message/Manager.php @@ -0,0 +1,275 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Message; + +/** + * Message manager model + */ +class Manager implements ManagerInterface +{ + /** + * @var Session + */ + protected $session; + + /** + * @var Factory + */ + protected $messageFactory; + + /** + * @var CollectionFactory + */ + protected $messagesFactory; + + /** + * @var \Magento\Event\ManagerInterface + */ + protected $eventManager; + + /** + * @var \Magento\Logger + */ + protected $logger; + + /** + * @var $string + */ + protected $defaultGroup; + + /** + * @param Session $session + * @param Factory $messageFactory + * @param CollectionFactory $messagesFactory + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\Logger $logger + * @param string $defaultGroup + */ + public function __construct( + Session $session, + Factory $messageFactory, + CollectionFactory $messagesFactory, + \Magento\Event\ManagerInterface $eventManager, + \Magento\Logger $logger, + $defaultGroup = self::DEFAULT_GROUP + ) { + $this->session = $session; + $this->messageFactory = $messageFactory; + $this->messagesFactory = $messagesFactory; + $this->eventManager = $eventManager; + $this->logger = $logger; + $this->defaultGroup = $defaultGroup; + } + + /** + * Retrieve default message group + * + * @return string + */ + public function getDefaultGroup() + { + return $this->defaultGroup; + } + + /** + * Retrieve default message group or custom if was set + * + * @param string|null $group + * @return string + */ + protected function prepareGroup($group) + { + return !empty($group) ? $group : $this->defaultGroup; + } + + /** + * Retrieve messages + * + * @param string|null $group + * @param bool $clear + * @return Collection + */ + public function getMessages($clear = false, $group = null) + { + $group = $this->prepareGroup($group); + if (!$this->session->getData($group)) { + $this->session->setData($group, $this->messagesFactory->create()); + } + + if ($clear) { + $messages = clone $this->session->getData($group); + $this->session->getData($group)->clear(); + $this->eventManager->dispatch('core_session_abstract_clear_messages'); + return $messages; + } + return $this->session->getData($group); + } + + /** + * Adding new message to message collection + * + * @param MessageInterface $message + * @param string|null $group + * @return $this + */ + public function addMessage(MessageInterface $message, $group = null) + { + $this->getMessages(false, $group)->addMessage($message); + $this->eventManager->dispatch('core_session_abstract_add_message'); + return $this; + } + + /** + * Adding messages array to message collection + * + * @param array $messages + * @param string|null $group + * @return $this + */ + public function addMessages(array $messages, $group = null) + { + foreach ($messages as $message) { + $this->addMessage($message, $group); + } + return $this; + } + + /** + * Adding new error message + * + * @param string $message + * @param string|null $group + * @return $this + */ + public function addError($message, $group = null) + { + $this->addMessage($this->messageFactory->create(MessageInterface::TYPE_ERROR, $message), $group); + return $this; + } + + /** + * Adding new warning message + * + * @param string $message + * @param string|null $group + * @return $this + */ + public function addWarning($message, $group = null) + { + $this->addMessage($this->messageFactory->create(MessageInterface::TYPE_WARNING, $message), $group); + return $this; + } + + /** + * Adding new notice message + * + * @param string $message + * @param string|null $group + * @return $this + */ + public function addNotice($message, $group = null) + { + $this->addMessage($this->messageFactory->create(MessageInterface::TYPE_NOTICE, $message), $group); + return $this; + } + + /** + * Adding new success message + * + * @param string $message + * @param string|null $group + * @return $this + */ + public function addSuccess($message, $group = null) + { + $this->addMessage($this->messageFactory->create(MessageInterface::TYPE_SUCCESS, $message), $group); + return $this; + } + + /** + * Adds messages array to message collection, but doesn't add duplicates to it + * + * @param array|MessageInterface $messages + * @param string|null $group + * @return $this + */ + public function addUniqueMessages($messages, $group = null) + { + if (!is_array($messages)) { + $messages = array($messages); + } + if (empty($messages)) { + return $this; + } + + $messagesAlready = array(); + $items = $this->getMessages(false, $group)->getItems(); + foreach ($items as $item) { + if ($item instanceof MessageInterface) { + $text = $item->getText(); + $messagesAlready[$text] = true; + } + } + + foreach ($messages as $message) { + if ($message instanceof MessageInterface) { + $text = $message->getText(); + } else { + continue; // Some unknown object, add it anyway + } + + // Check for duplication + if (isset($messagesAlready[$text])) { + continue; + } + $messagesAlready[$text] = true; + $this->addMessage($message, $group); + } + + return $this; + } + + /** + * Not Magento exception handling + * + * @param \Exception $exception + * @param string $alternativeText + * @param string $group + * @return $this + */ + public function addException(\Exception $exception, $alternativeText, $group = null) + { + $message = sprintf( + 'Exception message: %s%sTrace: %s', + $exception->getMessage(), + "\n", + $exception->getTraceAsString() + ); + + $this->logger->logFile($message, \Zend_Log::DEBUG, \Magento\Logger::LOGGER_EXCEPTION); + $this->addMessage($this->messageFactory->create(MessageInterface::TYPE_ERROR, $alternativeText), $group); + return $this; + } +} diff --git a/lib/Magento/Message/ManagerInterface.php b/lib/Magento/Message/ManagerInterface.php new file mode 100644 index 00000000000..037c4ce6f8b --- /dev/null +++ b/lib/Magento/Message/ManagerInterface.php @@ -0,0 +1,125 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Message; + +/** + * Message manager interface + */ +interface ManagerInterface +{ + /** + * Default message group + */ + const DEFAULT_GROUP = 'default'; + + /** + * Retrieve messages + * + * @param bool $clear + * @param string|null $group + * @return Collection + */ + public function getMessages($clear = false, $group = null); + + /** + * Retrieve default message group + * + * @return string + */ + public function getDefaultGroup(); + + /** + * Adding new message to message collection + * + * @param MessageInterface $message + * @param string|null $group + * @return ManagerInterface + */ + public function addMessage(MessageInterface $message, $group = null); + + /** + * Adding messages array to message collection + * + * @param array $messages + * @param string|null $group + * @return ManagerInterface + */ + public function addMessages(array $messages, $group = null); + + /** + * Adding new error message + * + * @param string $message + * @param string|null $group + * @return ManagerInterface + */ + public function addError($message, $group = null); + + /** + * Adding new warning message + * + * @param string $message + * @param string|null $group + * @return ManagerInterface + */ + public function addWarning($message, $group = null); + + /** + * Adding new notice message + * + * @param string $message + * @param string|null $group + * @return ManagerInterface + */ + public function addNotice($message, $group = null); + + /** + * Adding new success message + * + * @param string $message + * @param string|null $group + * @return ManagerInterface + */ + public function addSuccess($message, $group = null); + + /** + * Adds messages array to message collection, but doesn't add duplicates to it + * + * @param array|MessageInterface $messages + * @param string|null $group + * @return ManagerInterface + */ + public function addUniqueMessages($messages, $group = null); + + /** + * Not Magento exception handling + * + * @param \Exception $exception + * @param string $alternativeText + * @param string|null $group + * @return ManagerInterface + */ + public function addException(\Exception $exception, $alternativeText, $group = null); +} diff --git a/lib/Magento/Message/MessageInterface.php b/lib/Magento/Message/MessageInterface.php new file mode 100644 index 00000000000..bb1fe5cfe91 --- /dev/null +++ b/lib/Magento/Message/MessageInterface.php @@ -0,0 +1,110 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Message; + +/** + * Interface for message + */ +interface MessageInterface +{ + /** + * Error type + */ + const TYPE_ERROR = 'error'; + + /** + * Warning type + */ + const TYPE_WARNING = 'warning'; + + /** + * Notice type + */ + const TYPE_NOTICE = 'notice'; + + /** + * Success type + */ + const TYPE_SUCCESS = 'success'; + + /** + * Getter message type + * + * @return string + */ + public function getType(); + + /** + * Getter for text of message + * + * @return string + */ + public function getText(); + + /** + * Setter message text + * + * @param string $text + * @return $this + */ + public function setText($text); + + /** + * Setter message identifier + * + * @param string $identifier + * @return $this + */ + public function setIdentifier($identifier); + + /** + * Getter message identifier + * + * @return string + */ + public function getIdentifier(); + + /** + * Setter for flag. Whether message is sticky + * + * @param bool $isSticky + * @return $this + */ + public function setIsSticky($isSticky); + + /** + * Getter for flag. Whether message is sticky + * + * @return bool + */ + public function getIsSticky(); + + /** + * Retrieve message as a string + * + * @return string + */ + public function toString(); +} diff --git a/lib/Magento/Message/Notice.php b/lib/Magento/Message/Notice.php index 003b9a19aa2..88e79444737 100644 --- a/lib/Magento/Message/Notice.php +++ b/lib/Magento/Message/Notice.php @@ -30,7 +30,12 @@ namespace Magento\Message; class Notice extends AbstractMessage { /** - * @var string + * Getter message type + * + * @return string */ - protected $type = Factory::NOTICE; + public function getType() + { + return MessageInterface::TYPE_NOTICE; + } } diff --git a/app/code/Magento/Adminhtml/Exception.php b/lib/Magento/Message/Session.php similarity index 79% rename from app/code/Magento/Adminhtml/Exception.php rename to lib/Magento/Message/Session.php index 8c24a520be5..56d5a24de31 100644 --- a/app/code/Magento/Adminhtml/Exception.php +++ b/lib/Magento/Message/Session.php @@ -18,21 +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_Adminhtml * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Message; /** - * Magento adminhtml module exception - * - * @category Magento - * @package Magento_Adminhtml + * Message session model */ -namespace Magento\Adminhtml; - -class Exception extends \Magento\Core\Exception +class Session extends \Magento\Session\Generic { } diff --git a/lib/Magento/Message/Success.php b/lib/Magento/Message/Success.php index 036f64bab7c..52a075ff19e 100644 --- a/lib/Magento/Message/Success.php +++ b/lib/Magento/Message/Success.php @@ -30,7 +30,12 @@ namespace Magento\Message; class Success extends AbstractMessage { /** - * @var string + * Getter message type + * + * @return string */ - protected $type = Factory::SUCCESS; + public function getType() + { + return MessageInterface::TYPE_SUCCESS; + } } diff --git a/lib/Magento/Message/Warning.php b/lib/Magento/Message/Warning.php index fd0a874a08d..f6359bc2b68 100644 --- a/lib/Magento/Message/Warning.php +++ b/lib/Magento/Message/Warning.php @@ -30,7 +30,12 @@ namespace Magento\Message; class Warning extends AbstractMessage { /** - * @var string + * Getter message type + * + * @return string */ - protected $type = Factory::WARNING; + public function getType() + { + return MessageInterface::TYPE_WARNING; + } } diff --git a/lib/Magento/Module/Declaration/FileIterator.php b/lib/Magento/Module/Declaration/FileIterator.php new file mode 100644 index 00000000000..30197c33f4e --- /dev/null +++ b/lib/Magento/Module/Declaration/FileIterator.php @@ -0,0 +1,36 @@ +<?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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Module\Declaration; + +class FileIterator extends \Magento\Config\FileIterator +{ + + public function __construct( + \Magento\Filesystem $filesystem, + array $paths + ) { + parent::__construct($filesystem->getDirectoryRead(\Magento\Filesystem::APP), $paths); + } + +} diff --git a/lib/Magento/Module/Declaration/FileIteratorFactory.php b/lib/Magento/Module/Declaration/FileIteratorFactory.php new file mode 100644 index 00000000000..6bf97761c9c --- /dev/null +++ b/lib/Magento/Module/Declaration/FileIteratorFactory.php @@ -0,0 +1,34 @@ +<?php +/** + * Hierarchy config file resolver + * + * 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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Module\Declaration; + +class FileIteratorFactory +{ + public function create($filesystem, $paths) + { + return new \Magento\Module\Declaration\FileIterator($filesystem, $paths); + } +} diff --git a/lib/Magento/Module/Declaration/FileResolver.php b/lib/Magento/Module/Declaration/FileResolver.php index 33514c2ff17..f3342b586d2 100644 --- a/lib/Magento/Module/Declaration/FileResolver.php +++ b/lib/Magento/Module/Declaration/FileResolver.php @@ -28,16 +28,45 @@ namespace Magento\Module\Declaration; class FileResolver implements \Magento\Config\FileResolverInterface { /** - * @var \Magento\App\Dir + * Modules directory with read access + * + * @var \Magento\Filesystem\Directory\ReadInterface */ - protected $_applicationDirs; + protected $directoryReadModule; /** - * @param \Magento\App\Dir $applicationDirs + * Config directory with read access + * + * @var \Magento\Filesystem\Directory\ReadInterface */ - public function __construct(\Magento\App\Dir $applicationDirs) - { - $this->_applicationDirs = $applicationDirs; + protected $directoryReadConfig; + + /** + * Root directory with read access + * + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $directoryReadRoot; + + /** + * File iterator factory + * + * @var FileIteratorFactory + */ + protected $iteratorFactory; + + /** + * @param \Magento\Filesystem $filesystem + * @param \Magento\Config\FileIteratorFactory $iteratorFactory + */ + public function __construct( + \Magento\Filesystem $filesystem, + \Magento\Config\FileIteratorFactory $iteratorFactory + ) { + $this->iteratorFactory = $iteratorFactory; + $this->directoryReadModules = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + $this->directoryReadConfig = $filesystem->getDirectoryRead(\Magento\Filesystem::CONFIG); + $this->directoryReadRoot = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); } /** @@ -46,12 +75,15 @@ class FileResolver implements \Magento\Config\FileResolverInterface */ public function get($filename, $scope) { - $appCodeDir = $this->_applicationDirs->getDir(\Magento\App\Dir::MODULES); - $moduleFilePattern = $appCodeDir . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR - . 'etc' . DIRECTORY_SEPARATOR . 'module.xml'; - $moduleFileList = glob($moduleFilePattern); + $appCodeDir = $this->directoryReadRoot->getRelativePath( + $this->directoryReadModules->getAbsolutePath() + ); + $configDir = $this->directoryReadRoot->getRelativePath( + $this->directoryReadConfig->getAbsolutePath() + ); + $moduleFileList = $this->directoryReadRoot->search('#.*?/module.xml$#', $appCodeDir); - $mageScopePath = $appCodeDir . DIRECTORY_SEPARATOR . 'Magento' . DIRECTORY_SEPARATOR; + $mageScopePath = $appCodeDir . '/Magento/'; $output = array( 'base' => array(), 'mage' => array(), @@ -61,12 +93,11 @@ class FileResolver implements \Magento\Config\FileResolverInterface $scope = strpos($file, $mageScopePath) === 0 ? 'mage' : 'custom'; $output[$scope][] = $file; } + $output['base'] = $this->directoryReadRoot->search('#/module.xml$#', $configDir); - $appConfigDir = $this->_applicationDirs->getDir(\Magento\App\Dir::CONFIG); - $globalEnablerPattern = $appConfigDir . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . 'module.xml'; - $output['base'] = glob($globalEnablerPattern); - // Put global enablers at the end of the file list - return array_merge($output['mage'], $output['custom'], $output['base']); + return $this->iteratorFactory->create( + $this->directoryReadRoot, + array_merge($output['mage'], $output['custom'], $output['base']) + ); } - } diff --git a/lib/Magento/Module/Dir.php b/lib/Magento/Module/Dir.php index 336892f5b95..ac851d936e9 100644 --- a/lib/Magento/Module/Dir.php +++ b/lib/Magento/Module/Dir.php @@ -25,14 +25,16 @@ */ namespace Magento\Module; +use Magento\Filesystem; + class Dir { /** - * Directory registry + * Modules root directory * - * @var \Magento\App\Dir + * @var \Magento\Filesystem\Directory\ReadInterface */ - protected $_applicationDirs; + protected $_modulesDirectory; /** * @var \Magento\Stdlib\String @@ -40,12 +42,12 @@ class Dir protected $_string; /** - * @param \Magento\App\Dir $applicationDirs + * @param \Magento\Filesystem $filesystem * @param \Magento\Stdlib\String $string */ - public function __construct(\Magento\App\Dir $applicationDirs, \Magento\Stdlib\String $string) + public function __construct(Filesystem $filesystem, \Magento\Stdlib\String $string) { - $this->_applicationDirs = $applicationDirs; + $this->_modulesDirectory = $filesystem->getDirectoryRead(Filesystem::MODULES); $this->_string = $string; } @@ -59,15 +61,16 @@ class Dir */ public function getDir($moduleName, $type = '') { - $result = $this->_applicationDirs->getDir(\Magento\App\Dir::MODULES) - . DIRECTORY_SEPARATOR - . $this->_string->upperCaseWords($moduleName, '_', DIRECTORY_SEPARATOR); + $path = $this->_string->upperCaseWords($moduleName, '_', '/'); if ($type) { if (!in_array($type, array('etc', 'sql', 'data', 'i18n', 'view'))) { throw new \InvalidArgumentException("Directory type '$type' is not recognized."); } - $result .= DIRECTORY_SEPARATOR . $type; + $path .= '/' . $type; } + + $result = $this->_modulesDirectory->getAbsolutePath($path); + return $result; } } diff --git a/lib/Magento/Module/Dir/Reader.php b/lib/Magento/Module/Dir/Reader.php index 2744a76f88f..209d9617859 100644 --- a/lib/Magento/Module/Dir/Reader.php +++ b/lib/Magento/Module/Dir/Reader.php @@ -25,6 +25,9 @@ */ namespace Magento\Module\Dir; +use Magento\Filesystem\Directory\Read; +use Magento\Filesystem; + class Reader { /** @@ -32,50 +35,63 @@ class Reader * * @var array */ - protected $_customModuleDirs = array(); + protected $customModuleDirs = array(); /** * Directory registry * * @var \Magento\Module\Dir */ - protected $_moduleDirs; + protected $moduleDirs; /** * Modules configuration provider * * @var \Magento\Module\ModuleListInterface */ - protected $_modulesList; + protected $modulesList; + + /** + * @var Read + */ + protected $modulesDirectory; + protected $fileIteratorFactory; /** * @param \Magento\Module\Dir $moduleDirs * @param \Magento\Module\ModuleListInterface $moduleList + * @param Filesystem $filesystem + * @param \Magento\Config\FileIteratorFactory $fileIterator */ public function __construct( - \Magento\Module\Dir $moduleDirs, - \Magento\Module\ModuleListInterface $moduleList + \Magento\Module\Dir $moduleDirs, + \Magento\Module\ModuleListInterface $moduleList, + \Magento\Filesystem $filesystem, + \Magento\Config\FileIteratorFactory $fileIteratorFactory ) { - $this->_moduleDirs = $moduleDirs; - $this->_modulesList = $moduleList; + $this->moduleDirs = $moduleDirs; + $this->modulesList = $moduleList; + $this->fileIteratorFactory = $fileIteratorFactory; + $this->modulesDirectory = $filesystem->getDirectoryRead(Filesystem::MODULES); } /** * Go through all modules and find configuration files of active modules * * @param $filename - * @return array + * @return \Magento\Config\FileIterator */ public function getConfigurationFiles($filename) { $result = array(); - foreach (array_keys($this->_modulesList->getModules()) as $moduleName) { - $file = $this->getModuleDir('etc', $moduleName) . DIRECTORY_SEPARATOR . $filename; - if (file_exists($file)) { - $result[] = $file; + foreach (array_keys($this->modulesList->getModules()) as $moduleName) { + $file = $this->getModuleDir('etc', $moduleName) . '/' . $filename; + $path = $this->modulesDirectory->getRelativePath($file); + if ($this->modulesDirectory->isExist($path)) { + $result[] = $path; } } - return $result; + return $this->fileIteratorFactory->create($this->modulesDirectory, $result); } /** @@ -87,10 +103,10 @@ class Reader */ public function getModuleDir($type, $moduleName) { - if (isset($this->_customModuleDirs[$moduleName][$type])) { - return $this->_customModuleDirs[$moduleName][$type]; + if (isset($this->customModuleDirs[$moduleName][$type])) { + return $this->customModuleDirs[$moduleName][$type]; } - return $this->_moduleDirs->getDir($moduleName, $type); + return $this->moduleDirs->getDir($moduleName, $type); } /** @@ -102,6 +118,6 @@ class Reader */ public function setModuleDir($moduleName, $type, $path) { - $this->_customModuleDirs[$moduleName][$type] = $path; + $this->customModuleDirs[$moduleName][$type] = $path; } } diff --git a/lib/Magento/Module/ResourceResolver.php b/lib/Magento/Module/ResourceResolver.php index 22d656c815b..5b08b40dca3 100644 --- a/lib/Magento/Module/ResourceResolver.php +++ b/lib/Magento/Module/ResourceResolver.php @@ -59,13 +59,13 @@ class ResourceResolver implements \Magento\Module\ResourceResolverInterface // Process sub-directories within modules sql directory $moduleSqlDir = $this->_moduleReader->getModuleDir('sql', $moduleName); $sqlResources = array(); - foreach (glob($moduleSqlDir . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR) as $resourceDir) { + foreach (glob($moduleSqlDir . '/*', GLOB_ONLYDIR) as $resourceDir) { $sqlResources[] = basename($resourceDir); } $moduleDataDir = $this->_moduleReader->getModuleDir('data', $moduleName); // Process sub-directories within modules data directory $dataResources = array(); - foreach (glob($moduleDataDir . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR) as $resourceDir) { + foreach (glob($moduleDataDir . '/*', GLOB_ONLYDIR) as $resourceDir) { $dataResources[] = basename($resourceDir); } $this->_moduleResources[$moduleName] = array_unique(array_merge( diff --git a/lib/Magento/Object/Copy/Config/SchemaLocator.php b/lib/Magento/Object/Copy/Config/SchemaLocator.php index 2eb60fc7b83..e48eea1b788 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\App\Dir $dirs + * @param \Magento\Filesystem $filesystem * @param string $schema * @param string $perFileSchema */ - public function __construct(\Magento\App\Dir $dirs, $schema, $perFileSchema) + public function __construct(\Magento\Filesystem $filesystem, $schema, $perFileSchema) { - $this->_schema = $dirs->getDir() . DS . $schema; - $this->_perFileSchemaschema = $dirs->getDir() . DS . $perFileSchema; + $this->_schema = $filesystem->getPath(\Magento\Filesystem::ROOT) . '/' . $schema; + $this->_perFileSchemaschema = $filesystem->getPath(\Magento\Filesystem::ROOT) . '/' . $perFileSchema; } /** diff --git a/lib/Magento/ObjectManager/Config/SchemaLocator.php b/lib/Magento/ObjectManager/Config/SchemaLocator.php index 2917a2f3dd4..6d29c38e301 100644 --- a/lib/Magento/ObjectManager/Config/SchemaLocator.php +++ b/lib/Magento/ObjectManager/Config/SchemaLocator.php @@ -34,7 +34,7 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface */ public function getSchema() { - return realpath(__DIR__ . '/../etc/') . DIRECTORY_SEPARATOR . 'config.xsd'; + return realpath(__DIR__ . '/../etc/') . '/config.xsd'; } /** diff --git a/lib/Magento/ObjectManager/DefinitionFactory.php b/lib/Magento/ObjectManager/DefinitionFactory.php index c38113d8706..8f989910291 100644 --- a/lib/Magento/ObjectManager/DefinitionFactory.php +++ b/lib/Magento/ObjectManager/DefinitionFactory.php @@ -52,6 +52,13 @@ class DefinitionFactory */ protected $_definitionFormat; + /** + * Filesystem Driver + * + * @var \Magento\Filesystem\DriverInterface + */ + protected $_filesystemDriver; + /** * List of defintion models * @@ -63,12 +70,18 @@ class DefinitionFactory ); /** - * @param $definitionDir - * @param $generationDir - * @param $definitionFormat + * @param \Magento\Filesystem\DriverInterface $filesystemDriver + * @param string $definitionDir + * @param string $generationDir + * @param string $definitionFormat */ - public function __construct($definitionDir, $generationDir, $definitionFormat) - { + public function __construct( + \Magento\Filesystem\DriverInterface $filesystemDriver, + $definitionDir, + $generationDir, + $definitionFormat + ) { + $this->_filesystemDriver = $filesystemDriver; $this->_definitionDir = $definitionDir; $this->_generationDir = $generationDir; $this->_definitionFormat = $definitionFormat; @@ -81,9 +94,9 @@ class DefinitionFactory public function createClassDefinition($definitions) { if (!$definitions) { - $path = $this->_definitionDir . DIRECTORY_SEPARATOR . 'definitions.php'; - if (is_readable($path)) { - $definitions = file_get_contents($path); + $path = $this->_definitionDir . '/definitions.php'; + if ($this->_filesystemDriver->isReadable($path)) { + $definitions = $this->_filesystemDriver->fileGetContents($path); } } if ($definitions) { @@ -94,7 +107,11 @@ class DefinitionFactory $result = new $definitionModel($definitions); } else { $autoloader = new \Magento\Autoload\IncludePath(); - $generatorIo = new \Magento\Code\Generator\Io(new \Magento\Io\File(), $autoloader, $this->_generationDir); + $generatorIo = new \Magento\Code\Generator\Io( + $this->_filesystemDriver, + $autoloader, + $this->_generationDir + ); $generator = new \Magento\Code\Generator(null, $autoloader, $generatorIo); $autoloader = new \Magento\Code\Generator\Autoloader($generator); spl_autoload_register(array($autoloader, 'load')); @@ -111,9 +128,11 @@ class DefinitionFactory */ public function createPluginDefinition() { - $path = $this->_definitionDir . DIRECTORY_SEPARATOR . 'plugins.php'; - if (is_readable($path)) { - return new \Magento\Interception\Definition\Compiled($this->_unpack(file_get_contents($path))); + $path = $this->_definitionDir . '/plugins.php'; + if ($this->_filesystemDriver->isReadable($path)) { + return new \Magento\Interception\Definition\Compiled( + $this->_unpack($this->_filesystemDriver->fileGetContents($path)) + ); } else { return new \Magento\Interception\Definition\Runtime(); } @@ -124,9 +143,11 @@ class DefinitionFactory */ public function createRelations() { - $path = $this->_definitionDir . DIRECTORY_SEPARATOR . 'relations.php'; - if (is_readable($path)) { - return new \Magento\ObjectManager\Relations\Compiled($this->_unpack(file_get_contents($path))); + $path = $this->_definitionDir . '/' . 'relations.php'; + if ($this->_filesystemDriver->isReadable($path)) { + return new \Magento\ObjectManager\Relations\Compiled( + $this->_unpack($this->_filesystemDriver->fileGetContents($path)) + ); } else { return new \Magento\ObjectManager\Relations\Runtime(); } diff --git a/lib/Magento/Pear.php b/lib/Magento/Pear.php index c576f34a659..d15f51ba131 100644 --- a/lib/Magento/Pear.php +++ b/lib/Magento/Pear.php @@ -36,18 +36,13 @@ namespace Magento; // Looks like PEAR is being developed without E_NOTICE (1.7.0RC1) error_reporting(E_ALL & ~E_NOTICE); -// just a shortcut -if (!defined('DS')) { - define('DS', DIRECTORY_SEPARATOR); -} - // add PEAR lib in include_path if needed $_includePath = get_include_path(); -$_pearDir = dirname(dirname(__DIR__)) . DS . 'downloader' . DS . 'pearlib'; +$_pearDir = dirname(dirname(__DIR__)) . '/downloader/pearlib'; if (!getenv('PHP_PEAR_INSTALL_DIR')) { putenv('PHP_PEAR_INSTALL_DIR=' . $_pearDir); } -$_pearPhpDir = $_pearDir . DS . 'php'; +$_pearPhpDir = $_pearDir . '/php'; if (strpos($_includePath, $_pearPhpDir) === false) { if (substr($_includePath, 0, 2) === '.' . PATH_SEPARATOR) { $_includePath = '.' . PATH_SEPARATOR . $_pearPhpDir . PATH_SEPARATOR . substr($_includePath, 2); @@ -109,7 +104,7 @@ class Pear public function getPearDir() { - return $this->getBaseDir().DS.'downloader'.DS.'pearlib'; + return $this->getBaseDir() . '/downloader/pearlib'; } public function getConfig() @@ -117,20 +112,20 @@ class Pear if (!$this->_config) { $pear_dir = $this->getPearDir(); - $config = PEAR_Config::singleton($pear_dir.DS.'pear.ini', '-'); + $config = PEAR_Config::singleton($pear_dir . '/pear.ini', '-'); $config->set('auto_discover', 1); $config->set('cache_ttl', 60); #$config->set('preferred_state', 'beta'); $config->set('bin_dir', $pear_dir); - $config->set('php_dir', $pear_dir.DS.'php'); - $config->set('download_dir', $pear_dir.DS.'download'); - $config->set('temp_dir', $pear_dir.DS.'temp'); - $config->set('data_dir', $pear_dir.DS.'data'); - $config->set('cache_dir', $pear_dir.DS.'cache'); - $config->set('test_dir', $pear_dir.DS.'tests'); - $config->set('doc_dir', $pear_dir.DS.'docs'); + $config->set('php_dir', $pear_dir . '/php'); + $config->set('download_dir', $pear_dir . '/download'); + $config->set('temp_dir', $pear_dir . '/temp'); + $config->set('data_dir', $pear_dir . '/data'); + $config->set('cache_dir', $pear_dir . '/cache'); + $config->set('test_dir', $pear_dir . '/tests'); + $config->set('doc_dir', $pear_dir . '/docs'); $mageDir = $config->get('mage_dir'); @@ -145,11 +140,11 @@ class Pear $reg = $this->getRegistry(); $config->setRegistry($reg); - PEAR_DependencyDB::singleton($config, $pear_dir.DS.'php'.DS.'.depdb'); + PEAR_DependencyDB::singleton($config, $pear_dir . '/php/.depdb'); PEAR_Frontend::setFrontendObject($this->getFrontend()); - PEAR_Command::registerCommands(false, $pear_dir.DS.'php'.DS.'PEAR'.DS.'Command'.DS); + PEAR_Command::registerCommands(false, $pear_dir . '/php/PEAR/Command/'); $this->_config = $config; } @@ -164,7 +159,7 @@ class Pear public function getRegistry($redirectOnChange=true) { if (!$this->_registry) { - $this->_registry = new \Magento\Pear\Registry($this->getPearDir().DS.'php'); + $this->_registry = new \Magento\Pear\Registry($this->getPearDir() . '/php'); $changed = false; foreach ($this->getMagentoChannels() as $channel) { @@ -175,7 +170,7 @@ class Pear } if ($changed) { - $this->_registry = new \Magento\Pear\Registry($this->getPearDir().DS.'php'); + $this->_registry = new \Magento\Pear\Registry($this->getPearDir() . '/php'); } // if ($changed && self::$reloadOnRegistryUpdate && empty($_GET['pear_registry'])) { // echo "TEST:"; @@ -209,7 +204,7 @@ class Pear public function run($command, $options=array(), $params=array()) { @set_time_limit(0); - @ini_set('memory_limit', '256M'); + @ini_set('memory_limit', '2048M'); if (empty($this->_cmdCache[$command])) { $cmd = PEAR_Command::factory($command, $this->getConfig()); diff --git a/lib/Magento/Pear/Package.php b/lib/Magento/Pear/Package.php index 49cd8cbfdf9..d2741b7512b 100644 --- a/lib/Magento/Pear/Package.php +++ b/lib/Magento/Pear/Package.php @@ -207,7 +207,7 @@ class Package public function defineData() { - $this->set('options/outputdirectory', $this->getPear()->getPearDir().DS.'output'); + $this->set('options/outputdirectory', $this->getPear()->getPearDir() . '/output'); $this->set('options/filelistgenerator', 'php'); $this->set('options/simpleoutput', true); diff --git a/lib/Magento/Pear/Registry.php b/lib/Magento/Pear/Registry.php index 29c75e31c1c..6d6891663ed 100644 --- a/lib/Magento/Pear/Registry.php +++ b/lib/Magento/Pear/Registry.php @@ -48,7 +48,7 @@ class Registry //extends PEAR_Registry } else { $file = '.pearrc'; } - $this->_config = &new PEAR_Config($this->statedir . DIRECTORY_SEPARATOR . + $this->_config = &new PEAR_Config($this->statedir . '/' . $file, '-'); // NO SYSTEM INI FILE $this->_config->setRegistry($this); $this->_config->set('php_dir', $this->install_dir); @@ -57,9 +57,9 @@ class Registry //extends PEAR_Registry if (PEAR::isError($this->_dependencyDB)) { // attempt to recover by removing the dep db if (file_exists($this->_config->get('php_dir', null, 'pear.php.net') . - DIRECTORY_SEPARATOR . '.depdb')) { + '/' . '.depdb')) { @unlink($this->_config->get('php_dir', null, 'pear.php.net') . - DIRECTORY_SEPARATOR . '.depdb'); + '/' . '.depdb'); } $this->_dependencyDB = &PEAR_DependencyDB::singleton($this->_config); if (PEAR::isError($this->_dependencyDB)) { diff --git a/lib/Magento/Session/Config/ConfigInterface.php b/lib/Magento/Session/Config/ConfigInterface.php index e3b892274f7..250c1d1335a 100644 --- a/lib/Magento/Session/Config/ConfigInterface.php +++ b/lib/Magento/Session/Config/ConfigInterface.php @@ -28,6 +28,172 @@ namespace Magento\Session\Config; -interface ConfigInterface extends \Zend\Session\Config\ConfigInterface +interface ConfigInterface { + /** + * Set array of options + * + * @param array $options + * @return $this + */ + public function setOptions($options); + + /** + * Get all options set + * + * @return array + */ + public function getOptions(); + + /** + * Set an individual option + * + * @param string $option + * @param mixed $value + * @return $this + */ + public function setOption($option, $value); + + /** + * Get an individual option + * + * @param string $option + * @return mixed + */ + public function getOption($option); + + /** + * Check to see if an internal option has been set for the key provided. + * + * @param string $option + * @return bool + */ + public function hasOption($option); + + /** + * Convert config to array + * + * @return array + */ + public function toArray(); + + /** + * Set session.name + * + * @param string $name + * @return $this + */ + public function setName($name); + + /** + * Get session.name + * + * @return string + */ + public function getName(); + + /** + * Set session.save_path + * + * @param string $savePath + * @return $this + */ + public function setSavePath($savePath); + + /** + * Set session.save_path + * + * @return string + */ + public function getSavePath(); + + /** + * Set session.cookie_lifetime + * + * @param int $cookieLifetime + * @return $this + */ + public function setCookieLifetime($cookieLifetime); + + /** + * Get session.cookie_lifetime + * + * @return int + */ + public function getCookieLifetime(); + + /** + * Set session.cookie_path + * + * @param string $cookiePath + * @return $this + */ + public function setCookiePath($cookiePath); + + /** + * Get session.cookie_path + * + * @return string + */ + public function getCookiePath(); + + /** + * Set session.cookie_domain + * + * @param string $cookieDomain + * @return $this + */ + public function setCookieDomain($cookieDomain); + + /** + * Get session.cookie_domain + * + * @return string + */ + public function getCookieDomain(); + + /** + * Set session.cookie_secure + * + * @param bool $cookieSecure + * @return $this + */ + public function setCookieSecure($cookieSecure); + + /** + * Get session.cookie_secure + * + * @return bool + */ + public function getCookieSecure(); + + /** + * Set session.cookie_httponly + * + * @param bool $cookieHttpOnly + * @return $this + */ + public function setCookieHttpOnly($cookieHttpOnly); + + /** + * Get session.cookie_httponly + * + * @return bool + */ + public function getCookieHttpOnly(); + + /** + * Set session.use_cookies + * + * @param bool $useCookies + * @return $this + */ + public function setUseCookies($useCookies); + + /** + * Get session.use_cookies + * + * @return bool + */ + public function getUseCookies(); } diff --git a/app/code/Magento/Adminhtml/Block/Widget/Form.php b/lib/Magento/Session/Exception.php similarity index 62% rename from app/code/Magento/Adminhtml/Block/Widget/Form.php rename to lib/Magento/Session/Exception.php index a0a508e3292..cff6d3a50df 100644 --- a/app/code/Magento/Adminhtml/Block/Widget/Form.php +++ b/lib/Magento/Session/Exception.php @@ -18,21 +18,17 @@ * 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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @category Magento + * @package \Magento\Stdlib + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Session; + /** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend + * Session exception */ -namespace Magento\Adminhtml\Block\Widget; - -class Form extends \Magento\Backend\Block\Widget\Form +class Exception extends \Exception { - } diff --git a/app/code/Magento/Core/Model/Session/Generic.php b/lib/Magento/Session/Generic.php similarity index 61% rename from app/code/Magento/Core/Model/Session/Generic.php rename to lib/Magento/Session/Generic.php index 60d367e361f..700ba164e8b 100644 --- a/app/code/Magento/Core/Model/Session/Generic.php +++ b/lib/Magento/Session/Generic.php @@ -21,27 +21,29 @@ * @copyright Copyright (c) 2013 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\Session; +namespace Magento\Session; -class Generic extends \Magento\Core\Model\Session\AbstractSession +class Generic extends SessionManager { /** - * @param \Magento\Core\Model\Session\Context $context - * @param \Magento\Session\SidResolverInterface $sidResolver + * @param \Magento\App\RequestInterface $request + * @param SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param string $sessionNamespace - * @param mixed $sessionName - * @param array $data + * @param SaveHandlerInterface $saveHandler + * @param ValidatorInterface $validator + * @param StorageInterface $storage + * @param null $sessionName */ public function __construct( - \Magento\Core\Model\Session\Context $context, - \Magento\Session\SidResolverInterface $sidResolver, + \Magento\App\RequestInterface $request, + SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, - $sessionNamespace, - $sessionName = null, - array $data = array() + SaveHandlerInterface $saveHandler, + ValidatorInterface $validator, + StorageInterface $storage, + $sessionName = null ) { - parent::__construct($context, $sidResolver, $sessionConfig, $data); - $this->start($sessionNamespace, $sessionName); + parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage); + $this->start($sessionName); } } diff --git a/lib/Magento/Session/SaveHandler.php b/lib/Magento/Session/SaveHandler.php new file mode 100644 index 00000000000..4906d6d2907 --- /dev/null +++ b/lib/Magento/Session/SaveHandler.php @@ -0,0 +1,119 @@ +<?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\Stdlib + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Session; + +/** + * Magento session save handler + */ +class SaveHandler implements SaveHandlerInterface +{ + /** + * @var \SessionHandler + */ + protected $saveHandlerAdapter; + + /** + * @param SaveHandlerFactory $saveHandlerFactory + * @param string $saveMethod + * @param string $default + */ + public function __construct(SaveHandlerFactory $saveHandlerFactory, $saveMethod, $default = self::DEFAULT_HANDLER) + { + try { + $adapter = $saveHandlerFactory->create($saveMethod); + } catch (SaveHandlerException $e) { + $adapter = $saveHandlerFactory->create($default); + } + $this->saveHandlerAdapter = $adapter; + } + + /** + * Open Session - retrieve resources + * + * @param string $savePath + * @param string $name + * @return bool + */ + public function open($savePath, $name) + { + return $this->saveHandlerAdapter->open($savePath, $name); + } + + /** + * Close Session - free resources + */ + public function close() + { + return $this->saveHandlerAdapter->close(); + } + + /** + * Read session data + * + * @param string $sessionId + * @return string + */ + public function read($sessionId) + { + return $this->saveHandlerAdapter->read($sessionId); + } + + /** + * Write Session - commit data to resource + * + * @param string $sessionId + * @param mixed $data + * @return bool + */ + public function write($sessionId, $data) + { + return $this->saveHandlerAdapter->write($sessionId, $data); + } + + /** + * Destroy Session - remove data from resource for given session id + * + * @param string $sessionId + * @return bool + */ + public function destroy($sessionId) + { + return $this->saveHandlerAdapter->destroy($sessionId); + } + + /** + * Garbage Collection - remove old session data older + * than $maxLifetime (in seconds) + * + * @param int $maxLifetime + * @return bool + */ + public function gc($maxLifetime) + { + return $this->saveHandlerAdapter->gc($maxLifetime); + } +} diff --git a/app/code/Magento/Core/Model/Resource/Session.php b/lib/Magento/Session/SaveHandler/DbTable.php similarity index 71% rename from app/code/Magento/Core/Model/Resource/Session.php rename to lib/Magento/Session/SaveHandler/DbTable.php index 184ae7b992c..61ceb5fadc4 100644 --- a/app/code/Magento/Core/Model/Resource/Session.php +++ b/lib/Magento/Session/SaveHandler/DbTable.php @@ -18,31 +18,17 @@ * 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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Session\SaveHandler; /** - * Session save handler - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Data base session save handler */ -namespace Magento\Core\Model\Resource; - -class Session implements \Zend_Session_SaveHandler_Interface +class DbTable extends \SessionHandler { - /** - * Session lifetime - * - * @var integer - */ - protected $_lifeTime; - /** * Session data table name * @@ -57,79 +43,39 @@ class Session implements \Zend_Session_SaveHandler_Interface */ protected $_write; - /** - * @var \Magento\App\Dir - */ - protected $_dir; - /** * Constructor * * @param \Magento\App\Resource $resource - * @param \Magento\App\Dir $dir */ - public function __construct(\Magento\App\Resource $resource, \Magento\App\Dir $dir) + public function __construct(\Magento\App\Resource $resource) { $this->_sessionTable = $resource->getTableName('core_session'); $this->_write = $resource->getConnection('core_write'); - $this->_dir = $dir; - } - - /** - * Destructor - */ - public function __destruct() - { - session_write_close(); + $this->checkConnection(); } /** * Check DB connection - * - * @return bool */ - public function hasConnection() + protected function checkConnection() { if (!$this->_write) { - return false; + throw new \Magento\Session\SaveHandlerException('Write DB connection is not available'); } if (!$this->_write->isTableExists($this->_sessionTable)) { - return false; + throw new \Magento\Session\SaveHandlerException('DB storage table does not exist'); } - - return true; - } - - /** - * Setup save handler - * - * @return \Magento\Core\Model\Resource\Session - */ - public function setSaveHandler() - { - if ($this->hasConnection()) { - session_set_save_handler( - array($this, 'open'), - array($this, 'close'), - array($this, 'read'), - array($this, 'write'), - array($this, 'destroy'), - array($this, 'gc') - ); - } else { - session_save_path($this->_dir->getDir('session')); - } - return $this; } /** * Open session * * @param string $savePath ignored - * @param string $sessName ignored + * @param string $sessionName ignored * @return boolean */ - public function open($savePath, $sessName) + public function open($savePath, $sessionName) { return true; } @@ -202,12 +148,12 @@ class Session implements \Zend_Session_SaveHandler_Interface /** * Destroy session * - * @param string $sessId + * @param string $sessionId * @return boolean */ - public function destroy($sessId) + public function destroy($sessionId) { - $where = array('session_id = ?' => $sessId); + $where = array('session_id = ?' => $sessionId); $this->_write->delete($this->_sessionTable, $where); return true; } diff --git a/app/code/Magento/Adminhtml/Block/Widget/Tabs.php b/lib/Magento/Session/SaveHandler/Native.php similarity index 74% rename from app/code/Magento/Adminhtml/Block/Widget/Tabs.php rename to lib/Magento/Session/SaveHandler/Native.php index edabe7b230d..69df7a34f71 100644 --- a/app/code/Magento/Adminhtml/Block/Widget/Tabs.php +++ b/lib/Magento/Session/SaveHandler/Native.php @@ -18,21 +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_Adminhtml * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Session\SaveHandler; + /** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend + * Php native session save handler */ -namespace Magento\Adminhtml\Block\Widget; - -class Tabs extends \Magento\Backend\Block\Widget\Tabs +class Native extends \SessionHandler { - } diff --git a/lib/Magento/Session/SaveHandlerException.php b/lib/Magento/Session/SaveHandlerException.php new file mode 100644 index 00000000000..600cad60a47 --- /dev/null +++ b/lib/Magento/Session/SaveHandlerException.php @@ -0,0 +1,34 @@ +<?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\Stdlib + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Session; + +/** + * Save handler exception + */ +class SaveHandlerException extends \Exception +{ +} diff --git a/lib/Magento/Session/SaveHandlerFactory.php b/lib/Magento/Session/SaveHandlerFactory.php new file mode 100644 index 00000000000..52150dbcf08 --- /dev/null +++ b/lib/Magento/Session/SaveHandlerFactory.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. + * + * @category Magento + * @package \Magento\Stdlib + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Session; + +/** + * Magento session save handler factory + */ +class SaveHandlerFactory +{ + /** + * Php native session handler + */ + const PHP_NATIVE_HANDLER = 'Magento\Session\SaveHandler\Native'; + + /** + * @var \Magento\ObjectManager + */ + protected $objectManager; + + /** + * @var array + */ + protected $handlers = array(); + + /** + * @param \Magento\ObjectManager $objectManger + * @param array $handlers + */ + public function __construct(\Magento\ObjectManager $objectManger, array $handlers = array()) + { + $this->objectManager = $objectManger; + if (!empty($handlers)) { + $this->handlers = array_merge($handlers, $this->handlers); + } + } + + /** + * Create session save handler + * + * @param string $saveMethod + * @param array $params + * @return \SessionHandler + * @throws \LogicException + */ + public function create($saveMethod, $params = array()) + { + $sessionHandler = self::PHP_NATIVE_HANDLER; + if (isset($this->handlers[$saveMethod])) { + $sessionHandler = $this->handlers[$saveMethod]; + } + + $model = $this->objectManager->create($sessionHandler, $params); + if (!$model instanceof \SessionHandler) { + throw new \LogicException($sessionHandler . ' doesn\'t implement \SessionHandler'); + } + + return $model; + } +} diff --git a/app/code/Magento/Adminhtml/Block/Widget.php b/lib/Magento/Session/SaveHandlerInterface.php similarity index 76% rename from app/code/Magento/Adminhtml/Block/Widget.php rename to lib/Magento/Session/SaveHandlerInterface.php index ae0e5c7fa9f..63e2d22414d 100644 --- a/app/code/Magento/Adminhtml/Block/Widget.php +++ b/lib/Magento/Session/SaveHandlerInterface.php @@ -1,5 +1,7 @@ <?php /** + * Session config interface + * * Magento * * NOTICE OF LICENSE @@ -19,20 +21,17 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package \Magento\Sesstion * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend - */ -namespace Magento\Adminhtml\Block; +namespace Magento\Session; -class Widget extends \Magento\Backend\Block\Widget +interface SaveHandlerInterface extends \Zend_Session_SaveHandler_Interface { - + /** + * Default session save handler + */ + const DEFAULT_HANDLER = 'files'; } diff --git a/lib/Magento/Session/SessionManager.php b/lib/Magento/Session/SessionManager.php new file mode 100644 index 00000000000..c37b699d021 --- /dev/null +++ b/lib/Magento/Session/SessionManager.php @@ -0,0 +1,484 @@ +<?php +/** + * Magento session manager + * + * 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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Session; + +/** + * Session Manager + */ +class SessionManager implements SessionManagerInterface +{ + /** + * Default options when a call destroy() + * + * - send_expire_cookie: whether or not to send a cookie expiring the current session cookie + * - clear_storage: whether or not to empty the storage object of any stored values + * + * @var array + */ + protected $defaultDestroyOptions = array( + 'send_expire_cookie' => true, + 'clear_storage' => true, + ); + + /** + * URL host cache + * + * @var array + */ + protected static $urlHostCache = array(); + + /** + * @var \Magento\Session\ValidatorInterface + */ + protected $validator; + + /** + * @var \Magento\App\RequestInterface + */ + protected $request; + + /** + * @var \Magento\Session\SidResolverInterface + */ + protected $sidResolver; + + /** + * @var \Magento\Session\Config\ConfigInterface + */ + protected $sessionConfig; + + /** + * @var \Magento\Session\SaveHandlerInterface + */ + protected $saveHandler; + + /** + * @var \Magento\Session\StorageInterface + */ + protected $storage; + + /** + * @param \Magento\App\RequestInterface $request + * @param SidResolverInterface $sidResolver + * @param Config\ConfigInterface $sessionConfig + * @param SaveHandlerInterface $saveHandler + * @param ValidatorInterface $validator + * @param StorageInterface $storage + */ + public function __construct( + \Magento\App\RequestInterface $request, + SidResolverInterface $sidResolver, + Config\ConfigInterface $sessionConfig, + SaveHandlerInterface $saveHandler, + ValidatorInterface $validator, + StorageInterface $storage + ) { + $this->request = $request; + $this->sidResolver = $sidResolver; + $this->sessionConfig = $sessionConfig; + $this->saveHandler = $saveHandler; + $this->validator = $validator; + $this->storage = $storage; + } + + /** + * This method needs to support sessions with APC enabled + */ + public function writeClose() + { + session_write_close(); + } + + /** + * Storage accessor method + * + * @param string $method + * @param array $args + * @return mixed + * @throws \InvalidArgumentException + */ + public function __call($method, $args) + { + if (!in_array(substr($method, 0, 3), array('get', 'set', 'uns', 'has'))) { + throw new \InvalidArgumentException( + sprintf('Invalid method %s::%s(%s)', get_class($this), $method, print_r($args, 1)) + ); + } + $return = call_user_func_array(array($this->storage, $method), $args); + return $return === $this->storage ? $this : $return; + } + + /** + * Configure session handler and start session + * + * @param string $sessionName + * @return \Magento\Session\SessionManager + */ + public function start($sessionName = null) + { + if (!$this->isSessionExists()) { + \Magento\Profiler::start('session_start'); + if (!empty($sessionName)) { + $this->setName($sessionName); + } + $this->registerSaveHandler(); + + // potential custom logic for session id (ex. switching between hosts) + $this->setSessionId($this->sidResolver->getSid($this)); + session_start(); + $this->validator->validate($this); + + register_shutdown_function(array($this, 'writeClose')); + + $this->_addHost(); + \Magento\Profiler::stop('session_start'); + } + $this->storage->init(isset($_SESSION) ? $_SESSION : array()); + return $this; + } + + /** + * Register save handler + * + * @return bool + */ + protected function registerSaveHandler() + { + return session_set_save_handler( + array($this->saveHandler, 'open'), + array($this->saveHandler, 'close'), + array($this->saveHandler, 'read'), + array($this->saveHandler, 'write'), + array($this->saveHandler, 'destroy'), + array($this->saveHandler, 'gc') + ); + } + + /** + * Does a session exist + * + * @return bool + */ + public function isSessionExists() + { + if (session_status() === PHP_SESSION_NONE && !headers_sent()) { + return false; + } + return true; + } + + /** + * Additional get data with clear mode + * + * @param string $key + * @param bool $clear + * @return mixed + */ + public function getData($key = '', $clear = false) + { + $data = $this->storage->getData($key); + if ($clear && $data) { + $this->storage->unsetData($key); + } + return $data; + } + + /** + * Retrieve session Id + * + * @return string + */ + public function getSessionId() + { + return session_id(); + } + + /** + * Retrieve session name + * + * @return string + */ + public function getName() + { + return session_name(); + } + + /** + * Set session name + * + * @param string $name + * @return \Magento\Session\SessionManager + */ + public function setName($name) + { + session_name($name); + return $this; + } + + /** + * Destroy/end a session + * + * @param array $options + */ + public function destroy(array $options = null) + { + if (null === $options) { + $options = $this->defaultDestroyOptions; + } else { + $options = array_merge($this->defaultDestroyOptions, $options); + } + + if ($options['clear_storage']) { + $this->clearStorage(); + } + + if (session_status() !== PHP_SESSION_ACTIVE) { + return; + } + + session_destroy(); + if ($options['send_expire_cookie']) { + $this->expireSessionCookie(); + } + } + + /** + * Unset all session data + * + * @return $this + */ + public function clearStorage() + { + $this->storage->unsetData(); + return $this; + } + + /** + * Retrieve Cookie domain + * + * @return string + */ + public function getCookieDomain() + { + return $this->sessionConfig->getCookieDomain(); + } + + /** + * Retrieve cookie path + * + * @return string + */ + public function getCookiePath() + { + return $this->sessionConfig->getCookiePath(); + } + + /** + * Retrieve cookie lifetime + * + * @return int + */ + public function getCookieLifetime() + { + return $this->sessionConfig->getCookieLifetime(); + } + + /** + * Specify session identifier + * + * @param string|null $sessionId + * @return \Magento\Session\SessionManager + */ + public function setSessionId($sessionId) + { + $this->_addHost(); + if (!is_null($sessionId) && preg_match('#^[0-9a-zA-Z,-]+$#', $sessionId)) { + session_id($sessionId); + } + return $this; + } + + /** + * If session cookie is not applicable due to host or path mismatch - add session id to query + * + * @param string $urlHost can be host or url + * @return string {session_id_key}={session_id_encrypted} + */ + public function getSessionIdForHost($urlHost) + { + $httpHost = $this->request->getHttpHost(); + if (!$httpHost) { + return ''; + } + + $urlHostArr = explode('/', $urlHost, 4); + if (!empty($urlHostArr[2])) { + $urlHost = $urlHostArr[2]; + } + $urlPath = empty($urlHostArr[3]) ? '' : $urlHostArr[3]; + + if (!isset(self::$urlHostCache[$urlHost])) { + $urlHostArr = explode(':', $urlHost); + $urlHost = $urlHostArr[0]; + $sessionId = $httpHost !== $urlHost && !$this->isValidForHost($urlHost) ? $this->getSessionId() : ''; + self::$urlHostCache[$urlHost] = $sessionId; + } + + return $this->isValidForPath($urlPath) ? self::$urlHostCache[$urlHost] : $this->getSessionId(); + } + + /** + * Check if session is valid for given hostname + * + * @param string $host + * @return bool + */ + public function isValidForHost($host) + { + $hostArr = explode(':', $host); + $hosts = $this->_getHosts(); + return (!empty($hosts[$hostArr[0]])); + } + + /** + * Check if session is valid for given path + * + * @param string $path + * @return bool + */ + public function isValidForPath($path) + { + $cookiePath = trim($this->getCookiePath(), '/') . '/'; + if ($cookiePath == '/') { + return true; + } + + $urlPath = trim($path, '/') . '/'; + return strpos($urlPath, $cookiePath) === 0; + } + + /** + * Register request host name as used with session + * + * @return \Magento\Session\SessionManager + */ + protected function _addHost() + { + $host = $this->request->getHttpHost(); + if (!$host) { + return $this; + } + + $hosts = $this->_getHosts(); + $hosts[$host] = true; + $_SESSION[self::HOST_KEY] = $hosts; + return $this; + } + + /** + * Get all host names where session was used + * + * @return array + */ + protected function _getHosts() + { + return isset($_SESSION[self::HOST_KEY]) ? $_SESSION[self::HOST_KEY] : array(); + } + + /** + * Clean all host names that were registered with session + * + * @return \Magento\Session\SessionManager + */ + protected function _cleanHosts() + { + unset($_SESSION[self::HOST_KEY]); + return $this; + } + + /** + * Renew session id and update session cookie + * + * @param bool $deleteOldSession + * @return \Magento\Session\SessionManager + */ + public function regenerateId($deleteOldSession = true) + { + if (headers_sent()) { + return $this; + } + session_regenerate_id($deleteOldSession); + + if ($this->sessionConfig->getUseCookies()) { + $this->clearSubDomainSessionCookie(); + } + return $this; + } + + /** + * Expire the session cookie for sub domains + */ + protected function clearSubDomainSessionCookie() + { + foreach (array_keys($this->_getHosts()) as $host) { + // Delete cookies with the same name for parent domains + if (strpos($this->sessionConfig->getCookieDomain(), $host) > 0) { + setcookie( + $this->getName(), + '', + 0, + $this->sessionConfig->getCookiePath(), + $host, + $this->sessionConfig->getCookieSecure(), + $this->sessionConfig->getCookieHttpOnly() + ); + } + } + } + + /** + * Expire the session cookie + * + * Sends a session cookie with no value, and with an expiry in the past. + */ + public function expireSessionCookie() + { + if (!$this->sessionConfig->getUseCookies()) { + return; + } + + setcookie( + $this->getName(), + '', + 0, + $this->sessionConfig->getCookiePath(), + $this->sessionConfig->getCookieDomain(), + $this->sessionConfig->getCookieSecure(), + $this->sessionConfig->getCookieHttpOnly() + ); + $this->clearSubDomainSessionCookie(); + } +} diff --git a/lib/Magento/Session/SessionManagerInterface.php b/lib/Magento/Session/SessionManagerInterface.php new file mode 100644 index 00000000000..eb392296d88 --- /dev/null +++ b/lib/Magento/Session/SessionManagerInterface.php @@ -0,0 +1,161 @@ +<?php +/** + * Magento session manager interface + * + * 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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Session; + +/** + * Session Manager Interface + */ +interface SessionManagerInterface +{ + /** + * Session key for list of hosts + */ + const HOST_KEY = '_session_hosts'; + + /** + * Start session + * + * @param string $sessionName + * @return SessionManagerInterface + */ + public function start($sessionName = null); + + /** + * Session write close + */ + public function writeClose(); + + /** + * Does a session exist + * + * @return bool + */ + public function isSessionExists(); + + /** + * Retrieve session Id + * + * @return string + */ + public function getSessionId(); + + /** + * Retrieve session name + * + * @return string + */ + public function getName(); + + /** + * Set session name + * + * @param string $name + * @return SessionManagerInterface + */ + public function setName($name); + + /** + * Destroy/end a session + * + * @param array $options + */ + public function destroy(array $options = null); + + /** + * Unset session data + * + * @return $this + */ + public function clearStorage(); + + /** + * Retrieve Cookie domain + * + * @return string + */ + public function getCookieDomain(); + + /** + * Retrieve cookie path + * + * @return string + */ + public function getCookiePath(); + + /** + * Retrieve cookie lifetime + * + * @return int + */ + public function getCookieLifetime(); + + /** + * Specify session identifier + * + * @param string|null $sessionId + * @return SessionManagerInterface + */ + public function setSessionId($sessionId); + + /** + * Renew session id and update session cookie + * + * @param bool $deleteOldSession + * @return SessionManagerInterface + */ + public function regenerateId($deleteOldSession = true); + + /** + * Expire the session cookie + * + * Sends a session cookie with no value, and with an expiry in the past. + */ + public function expireSessionCookie(); + + /** + * If session cookie is not applicable due to host or path mismatch - add session id to query + * + * @param string $urlHost + * @return string + */ + public function getSessionIdForHost($urlHost); + + /** + * Check if session is valid for given hostname + * + * @param string $host + * @return bool + */ + public function isValidForHost($host); + + /** + * Check if session is valid for given path + * + * @param string $path + * @return bool + */ + public function isValidForPath($path); +} diff --git a/lib/Magento/Session/SidResolverInterface.php b/lib/Magento/Session/SidResolverInterface.php index 7fc6d9601a2..7f4c4e6764e 100644 --- a/lib/Magento/Session/SidResolverInterface.php +++ b/lib/Magento/Session/SidResolverInterface.php @@ -36,16 +36,16 @@ interface SidResolverInterface const SESSION_ID_QUERY_PARAM = 'SID'; /** - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session * @return string */ - public function getSid(\Magento\Core\Model\Session\AbstractSession $session); + public function getSid(\Magento\Session\SessionManagerInterface $session); /** * Get session id query param * - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session * @return string */ - public function getSessionIdQueryParam(\Magento\Core\Model\Session\AbstractSession $session); + public function getSessionIdQueryParam(\Magento\Session\SessionManagerInterface $session); } diff --git a/lib/Magento/Session/Storage.php b/lib/Magento/Session/Storage.php new file mode 100644 index 00000000000..342c34ba097 --- /dev/null +++ b/lib/Magento/Session/Storage.php @@ -0,0 +1,85 @@ +<?php +/** + * Default session storage + * + * 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\Sesstion + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Session; + +class Storage extends \Magento\Object implements StorageInterface +{ + /** + * Namespace of storage + * + * @var string + */ + protected $namespace; + + /** + * @param string $namespace + * @param array $data + */ + public function __construct($namespace = 'default', array $data = array()) + { + $this->namespace = $namespace; + parent::__construct($data); + } + + /** + * {@inheritdoc} + */ + public function init(array $data) + { + $namespace = $this->getNamespace(); + if (isset($data[$namespace])) { + $this->setData($data[$namespace]); + } + $_SESSION[$namespace] = &$this->_data; + } + + /** + * {@inheritdoc} + */ + public function getNamespace() + { + return $this->namespace; + } + + /** + * Additional get data with clear mode + * + * @param string $key + * @param bool $clear + * @return mixed + */ + public function getData($key = '', $clear = false) + { + $data = parent::getData($key); + if ($clear && isset($this->_data[$key])) { + unset($this->_data[$key]); + } + return $data; + } +} diff --git a/app/code/Magento/Adminhtml/Model/Session.php b/lib/Magento/Session/StorageInterface.php similarity index 71% rename from app/code/Magento/Adminhtml/Model/Session.php rename to lib/Magento/Session/StorageInterface.php index 9efdbd415cc..da5552e18c5 100644 --- a/app/code/Magento/Adminhtml/Model/Session.php +++ b/lib/Magento/Session/StorageInterface.php @@ -1,5 +1,7 @@ <?php /** + * Session storage interface + * * Magento * * NOTICE OF LICENSE @@ -19,22 +21,27 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package \Magento\Sesstion * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Session; -/** - * Auth session model - * - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module \Magento\Backend - */ -namespace Magento\Adminhtml\Model; - -class Session extends \Magento\Backend\Model\Session +interface StorageInterface { + /** + * Initialize storage data + * + * @param array $data + * @return $this + */ + public function init(array $data); + + /** + * Get current storage namespace + * + * @return string + */ + public function getNamespace(); } diff --git a/app/code/Magento/Adminhtml/Block/Widget/Accordion/Item.php b/lib/Magento/Session/ValidatorInterface.php similarity index 71% rename from app/code/Magento/Adminhtml/Block/Widget/Accordion/Item.php rename to lib/Magento/Session/ValidatorInterface.php index 0827a25caf0..9fc2bb3d353 100644 --- a/app/code/Magento/Adminhtml/Block/Widget/Accordion/Item.php +++ b/lib/Magento/Session/ValidatorInterface.php @@ -1,5 +1,7 @@ <?php /** + * Session validator interface + * * Magento * * NOTICE OF LICENSE @@ -19,20 +21,23 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package \Magento\Sesstion * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Session; + /** - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - * @deprecated Moved to module Magento_Backend + * Session validator interface */ -namespace Magento\Adminhtml\Block\Widget\Accordion; - -class Item extends \Magento\Backend\Block\Widget\Accordion\Item +interface ValidatorInterface { - + /** + * Validate session + * + * @param \Magento\Session\SessionManagerInterface $session + * @throws \Magento\Session\Exception + */ + public function validate(\Magento\Session\SessionManagerInterface $session); } diff --git a/lib/Magento/Simplexml/Config/Cache/File.php b/lib/Magento/Simplexml/Config/Cache/File.php index f48ae2e5f38..4912d0828ab 100644 --- a/lib/Magento/Simplexml/Config/Cache/File.php +++ b/lib/Magento/Simplexml/Config/Cache/File.php @@ -47,7 +47,7 @@ class File extends \Magento\Simplexml\Config\Cache\AbstractCache { $this->setData('key', $key); - $file = $this->getDir().DS.$this->getKey(); + $file = $this->getDir() . '/' . $this->getKey(); $this->setFileName($file.'.xml'); $this->setStatFileName($file.'.stat'); diff --git a/lib/Magento/System/Dirs.php b/lib/Magento/System/Dirs.php index b4e54cafe7c..25e529ee69b 100644 --- a/lib/Magento/System/Dirs.php +++ b/lib/Magento/System/Dirs.php @@ -68,7 +68,7 @@ class Dirs continue; } // Unlink files and add directories to stack - $child = $entry . DIRECTORY_SEPARATOR . $child; + $child = $entry . '/' . $child; if (is_dir($child) && !is_link($child)) { $stack[] = $child; } else { diff --git a/lib/Magento/Validator/Config.php b/lib/Magento/Validator/Config.php index e28a32a2d45..4a9a0fff31b 100644 --- a/lib/Magento/Validator/Config.php +++ b/lib/Magento/Validator/Config.php @@ -49,7 +49,7 @@ class Config extends \Magento\Config\AbstractXml * @param \Magento\Validator\UniversalFactory $builderFactory */ public function __construct( - array $configFiles, + $configFiles, \Magento\Validator\UniversalFactory $builderFactory ) { parent::__construct($configFiles); diff --git a/lib/Magento/View/Asset/MergeService.php b/lib/Magento/View/Asset/MergeService.php index db1fa6a1b33..8549eaf870c 100644 --- a/lib/Magento/View/Asset/MergeService.php +++ b/lib/Magento/View/Asset/MergeService.php @@ -44,11 +44,6 @@ class MergeService */ protected $filesystem; - /** - * @var \Magento\App\Dir - */ - protected $dirs; - /** * @var \Magento\App\State */ @@ -58,20 +53,17 @@ class MergeService * @param \Magento\ObjectManager $objectManager * @param ConfigInterface $config * @param \Magento\Filesystem $filesystem, - * @param \Magento\App\Dir $dirs * @param \Magento\App\State $state */ public function __construct( \Magento\ObjectManager $objectManager, ConfigInterface $config, \Magento\Filesystem $filesystem, - \Magento\App\Dir $dirs, \Magento\App\State $state ) { $this->objectManager = $objectManager; $this->config = $config; $this->filesystem = $filesystem; - $this->dirs = $dirs; $this->state = $state; } @@ -114,7 +106,6 @@ class MergeService */ public function cleanMergedJsCss() { - $mergedDir = $this->dirs->getDir(\Magento\App\Dir::PUB_VIEW_CACHE) . '/' . Merged::PUBLIC_MERGE_DIR; - $this->filesystem->delete($mergedDir); + $this->filesystem->getDirectoryWrite(\Magento\Filesystem::PUB_VIEW_CACHE)->delete(Merged::PUBLIC_MERGE_DIR); } } diff --git a/lib/Magento/View/Asset/MergeStrategy/Checksum.php b/lib/Magento/View/Asset/MergeStrategy/Checksum.php index 8e2c6fe764b..0b67fcffd6c 100644 --- a/lib/Magento/View/Asset/MergeStrategy/Checksum.php +++ b/lib/Magento/View/Asset/MergeStrategy/Checksum.php @@ -61,14 +61,15 @@ class Checksum implements \Magento\View\Asset\MergeStrategyInterface // Check whether we have already merged these files $filesMTimeData = ''; + $directory = $this->filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); foreach ($publicFiles as $file) { - $filesMTimeData .= $this->filesystem->getMTime($file); + $filesMTimeData .= $directory->stat($file)['mtime']; } - if (!($this->filesystem->has($destinationFile) && $this->filesystem->has($mergedMTimeFile) - && (strcmp($filesMTimeData, $this->filesystem->read($mergedMTimeFile)) == 0)) + if (!($directory->isExist($destinationFile) && $directory->isExist($mergedMTimeFile) + && (strcmp($filesMTimeData, $directory->readFile($mergedMTimeFile)) == 0)) ) { $this->strategy->mergeFiles($publicFiles, $destinationFile, $contentType); - $this->filesystem->write($mergedMTimeFile, $filesMTimeData); + $directory->writeFile($mergedMTimeFile, $filesMTimeData); } } } diff --git a/lib/Magento/View/Asset/MergeStrategy/Direct.php b/lib/Magento/View/Asset/MergeStrategy/Direct.php index cafa4ecadda..40c304c2ad4 100644 --- a/lib/Magento/View/Asset/MergeStrategy/Direct.php +++ b/lib/Magento/View/Asset/MergeStrategy/Direct.php @@ -30,14 +30,9 @@ namespace Magento\View\Asset\MergeStrategy; class Direct implements \Magento\View\Asset\MergeStrategyInterface { /** - * @var \Magento\Filesystem + * @var \Magento\Filesystem\Directory\Write */ - protected $filesystem; - - /** - * @var \Magento\App\Dir - */ - protected $dirs; + private $_directory; /** * @var \Magento\View\Url\CssResolver @@ -46,17 +41,14 @@ class Direct implements \Magento\View\Asset\MergeStrategyInterface /** * @param \Magento\Filesystem $filesystem - * @param \Magento\App\Dir $dirs * @param \Magento\View\Url\CssResolver $cssUrlResolver */ public function __construct( \Magento\Filesystem $filesystem, - \Magento\App\Dir $dirs, \Magento\View\Url\CssResolver $cssUrlResolver ) { - $this->filesystem = $filesystem; - $this->dirs = $dirs; - $this->cssUrlResolver = $cssUrlResolver; + $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::PUB); + $this->_cssUrlResolver = $cssUrlResolver; } /** @@ -65,9 +57,7 @@ class Direct implements \Magento\View\Asset\MergeStrategyInterface public function mergeFiles(array $publicFiles, $destinationFile, $contentType) { $mergedContent = $this->composeMergedContent($publicFiles, $destinationFile, $contentType); - - $this->filesystem->setIsAllowCreateDirectories(true); - $this->filesystem->write($destinationFile, $mergedContent); + $this->_directory->writeFile($this->_directory->getRelativePath($destinationFile), $mergedContent); } /** @@ -82,15 +72,15 @@ class Direct implements \Magento\View\Asset\MergeStrategyInterface protected function composeMergedContent(array $publicFiles, $targetFile, $contentType) { $result = array(); - $isCss = $contentType == \Magento\View\Publisher::CONTENT_TYPE_CSS; + $isCss = ($contentType == \Magento\View\Publisher::CONTENT_TYPE_CSS) ? true : false; foreach ($publicFiles as $file) { - if (!$this->filesystem->has($file)) { + if (!$this->_directory->isExist($this->_directory->getRelativePath($file))) { throw new \Magento\Exception("Unable to locate file '{$file}' for merging."); } - $content = $this->filesystem->read($file); + $content = $this->_directory->readFile($this->_directory->getRelativePath($file)); if ($isCss) { - $content = $this->cssUrlResolver->replaceCssRelativeUrls($content, $file, $targetFile); + $content = $this->_cssUrlResolver->replaceCssRelativeUrls($content, $file, $targetFile); } $result[] = $content; } diff --git a/lib/Magento/View/Asset/MergeStrategy/FileExists.php b/lib/Magento/View/Asset/MergeStrategy/FileExists.php index 588543f102a..a75307ed04c 100644 --- a/lib/Magento/View/Asset/MergeStrategy/FileExists.php +++ b/lib/Magento/View/Asset/MergeStrategy/FileExists.php @@ -56,7 +56,7 @@ class FileExists implements \Magento\View\Asset\MergeStrategyInterface */ public function mergeFiles(array $publicFiles, $destinationFile, $contentType) { - if (!$this->filesystem->has($destinationFile)) { + if (!$this->filesystem->getDirectoryRead(\Magento\Filesystem::ROOT)->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 fc048b84ac6..07440ccc176 100644 --- a/lib/Magento/View/Asset/Merged.php +++ b/lib/Magento/View/Asset/Merged.php @@ -59,11 +59,6 @@ class Merged implements \Iterator */ protected $contentType; - /** - * @var \Magento\App\Dir - */ - protected $dirs; - /** * Whether initialization has been performed or not * @@ -74,7 +69,6 @@ class Merged implements \Iterator /** * @param \Magento\ObjectManager $objectManager * @param \Magento\Logger $logger - * @param \Magento\App\Dir $dirs * @param MergeStrategyInterface $mergeStrategy * @param array $assets * @throws \InvalidArgumentException @@ -82,13 +76,11 @@ class Merged implements \Iterator public function __construct( \Magento\ObjectManager $objectManager, \Magento\Logger $logger, - \Magento\App\Dir $dirs, MergeStrategyInterface $mergeStrategy, array $assets ) { $this->objectManager = $objectManager; $this->logger = $logger; - $this->dirs = $dirs; $this->mergeStrategy = $mergeStrategy; if (!$assets) { @@ -170,18 +162,20 @@ class Merged implements \Iterator */ protected function getMergedFilePath(array $publicFiles) { - $jsDir = \Magento\Filesystem::fixSeparator($this->dirs->getDir(\Magento\App\Dir::PUB_LIB)); - $publicDir = \Magento\Filesystem::fixSeparator($this->dirs->getDir(\Magento\App\Dir::STATIC_VIEW)); + /** @var \Magento\Filesystem $filesystem */ + $filesystem = $this->objectManager->get('Magento\Filesystem'); + $jsDir = $filesystem->getPath(\Magento\Filesystem::PUB_LIB); + $publicDir = $filesystem->getPath(\Magento\Filesystem::STATIC_VIEW); + $prefixRemovals = array($jsDir, $publicDir); $relFileNames = array(); foreach ($publicFiles as $file) { - $file = \Magento\Filesystem::fixSeparator($file); - $relFileNames[] = str_replace($prefixRemovals, '', $file); + $relFileNames[] = ltrim(str_replace($prefixRemovals, '', $file), '/'); } - $mergedDir = $this->dirs->getDir(\Magento\App\Dir::PUB_VIEW_CACHE) . '/' - . self::PUBLIC_MERGE_DIR; + $mergedDir = $filesystem->getDirectoryRead(\Magento\Filesystem::PUB_VIEW_CACHE) + ->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 f932571ec58..2cb1ca82d8c 100644 --- a/lib/Magento/View/Asset/MinifyService.php +++ b/lib/Magento/View/Asset/MinifyService.php @@ -50,31 +50,33 @@ class MinifyService protected $minifiers = array(); /** - * @var \Magento\App\Dir + * @var \Magento\App\State */ - protected $dirs; + protected $appState; /** - * @var \Magento\App\State + * Filesystem instance + * + * @var \Magento\Filesystem */ - protected $appState; + protected $_filesystem; /** * @param ConfigInterface $config * @param \Magento\ObjectManager $objectManager - * @param \Magento\App\Dir $dirs * @param \Magento\App\State $appState + * @param \Magento\Filesystem $filesystem */ public function __construct( ConfigInterface $config, \Magento\ObjectManager $objectManager, - \Magento\App\Dir $dirs, - \Magento\App\State $appState + \Magento\App\State $appState, + \Magento\Filesystem $filesystem ) { $this->config = $config; $this->objectManager = $objectManager; - $this->dirs = $dirs; $this->appState = $appState; + $this->_filesystem = $filesystem; } /** @@ -123,11 +125,14 @@ class MinifyService $strategy = $this->objectManager ->create('Magento\Code\Minifier\Strategy\Generate', $strategyParams); } + $baseDir = $this->_filesystem + ->getDirectoryRead(\Magento\Filesystem::PUB_VIEW_CACHE) + ->getAbsolutePath('minify'); $this->minifiers[$contentType] = $this->objectManager->create('Magento\Code\Minifier', array( 'strategy' => $strategy, - 'baseDir' => $this->dirs->getDir(\Magento\App\Dir::PUB_VIEW_CACHE) . '/minify', + 'directoryName' => $baseDir ) ); } diff --git a/lib/Magento/View/Config.php b/lib/Magento/View/Config.php index 4a7d47d5f18..9e742374259 100644 --- a/lib/Magento/View/Config.php +++ b/lib/Magento/View/Config.php @@ -27,6 +27,10 @@ namespace Magento\View; /** * Handles theme view.xml files */ +namespace Magento\View; + +use Magento\Filesystem\Directory\ReadInterface; + class Config implements \Magento\View\ConfigInterface { /** @@ -34,56 +38,64 @@ class Config implements \Magento\View\ConfigInterface * * @var array */ - protected $_viewConfigs = array(); + protected $viewConfigs = array(); /** * Module configuration reader * * @var \Magento\Module\Dir\Reader */ - protected $_moduleReader; + protected $moduleReader; /** - * @var \Magento\Filesystem + * @var ReadInterface */ - protected $_filesystem; + protected $rootDirectory; /** * @var \Magento\View\Service */ - protected $_viewService; + protected $viewService; /** * View file system model * * @var \Magento\View\FileSystem */ - protected $_viewFileSystem; + protected $viewFileSystem; /** * @var string */ protected $filename; + /** + * @var \Magento\Config\FileIteratorFactory + */ + protected $fileIteratorFactory; + /** * @param \Magento\Module\Dir\Reader $moduleReader * @param \Magento\Filesystem $filesystem * @param Service $viewService * @param FileSystem $viewFileSystem - * @param string $filename + * @param \Magento\Config\FileIteratorFactory $fileIteratorFactory + * @param $filename */ public function __construct( \Magento\Module\Dir\Reader $moduleReader, \Magento\Filesystem $filesystem, \Magento\View\Service $viewService, \Magento\View\FileSystem $viewFileSystem, + \Magento\Config\FileIteratorFactory $fileIteratorFactory, $filename = self::CONFIG_FILE_NAME ) { - $this->_moduleReader = $moduleReader; - $this->_filesystem = $filesystem; - $this->_viewService = $viewService; - $this->_viewFileSystem = $viewFileSystem; + $this->moduleReader = $moduleReader; + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->viewService = $viewService; + $this->viewFileSystem = $viewFileSystem; $this->filename = $filename; + $this->fileIteratorFactory = $fileIteratorFactory; } /** @@ -94,27 +106,33 @@ class Config implements \Magento\View\ConfigInterface */ public function getViewConfig(array $params = array()) { - $this->_viewService->updateDesignParams($params); + $this->viewService->updateDesignParams($params); /** @var $currentTheme \Magento\View\Design\ThemeInterface */ $currentTheme = $params['themeModel']; $key = $currentTheme->getId(); - if (isset($this->_viewConfigs[$key])) { - return $this->_viewConfigs[$key]; + if (isset($this->viewConfigs[$key])) { + return $this->viewConfigs[$key]; } - $configFiles = $this->_moduleReader->getConfigurationFiles($this->filename); + $configFiles = $this->moduleReader->getConfigurationFiles($this->filename)->toArray(); + $themeConfigFile = $currentTheme->getCustomization()->getCustomViewConfigPath(); - if (empty($themeConfigFile) || !$this->_filesystem->has($themeConfigFile)) { - $themeConfigFile = $this->_viewFileSystem->getFilename( + if (empty($themeConfigFile) || + !$this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile)) + ) { + $themeConfigFile = $this->viewFileSystem->getFilename( $this->filename, $params ); } - if ($themeConfigFile && $this->_filesystem->has($themeConfigFile)) { - $configFiles[] = $themeConfigFile; + if ($themeConfigFile && + $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile)) + ) { + $configFiles[$this->rootDirectory->getRelativePath($themeConfigFile)] = + $this->rootDirectory->readFile($this->rootDirectory->getRelativePath($themeConfigFile)); } $config = new \Magento\Config\View($configFiles); - $this->_viewConfigs[$key] = $config; + $this->viewConfigs[$key] = $config; return $config; } } diff --git a/lib/Magento/View/Context.php b/lib/Magento/View/Context.php index f9c923cc77f..82b2d197c2a 100644 --- a/lib/Magento/View/Context.php +++ b/lib/Magento/View/Context.php @@ -29,14 +29,13 @@ use Magento\App\FrontControllerInterface; use Magento\TranslateInterface; use Magento\Core\Model\Store\Config as StoreConfig; -use Magento\App\Helper\HelperFactory as FactoryHelper; use Magento\View\Url as ViewUrl; use Magento\View\ConfigInterface as ViewConfig; use Magento\Logger; use Magento\Core\Model\App; use Magento\App\State as AppState; -use Magento\Core\Model\Session\AbstractSession; +use Magento\Session\SessionManager; use Magento\App\CacheInterface as Cache; use Magento\App\Cache\StateInterface as CacheState; use Magento\UrlInterface; @@ -84,7 +83,7 @@ class Context protected $design; /** - * @var \Magento\Core\Model\Session + * @var \Magento\Session\SessionManagerInterface */ protected $session; @@ -98,11 +97,6 @@ class Context */ protected $frontController; - /** - * @var \Magento\App\Helper\HelperFactory - */ - protected $helperFactory; - /** * @var \Magento\View\Url */ @@ -147,10 +141,9 @@ class Context * @param TranslateInterface $translator * @param Cache $cache * @param DesignInterface $design - * @param AbstractSession $session + * @param SessionManager $session * @param StoreConfig $storeConfig * @param FrontControllerInterface $frontController - * @param FactoryHelper $helperFactory * @param ViewUrl $viewUrl * @param ViewConfig $viewConfig * @param CacheState $cacheState @@ -169,10 +162,9 @@ class Context TranslateInterface $translator, Cache $cache, DesignInterface $design, - AbstractSession $session, + SessionManager $session, StoreConfig $storeConfig, FrontControllerInterface $frontController, - FactoryHelper $helperFactory, ViewUrl $viewUrl, ViewConfig $viewConfig, CacheState $cacheState, @@ -189,7 +181,6 @@ class Context $this->session = $session; $this->storeConfig = $storeConfig; $this->frontController = $frontController; - $this->helperFactory = $helperFactory; $this->viewUrl = $viewUrl; $this->viewConfig = $viewConfig; $this->cacheState = $cacheState; @@ -230,14 +221,6 @@ class Context return $this->frontController; } - /** - * @return \Magento\App\Helper\HelperFactory - */ - public function getHelperFactory() - { - return $this->helperFactory; - } - /** * @return \Magento\View\LayoutInterface */ @@ -255,7 +238,7 @@ class Context } /** - * @return \Magento\Core\Model\Session|\Magento\Core\Model\Session\AbstractSession + * @return \Magento\Session\SessionManagerInterface */ public function getSession() { diff --git a/lib/Magento/View/DeployedFilesManager.php b/lib/Magento/View/DeployedFilesManager.php index 1af08c909ac..e0a2a7f1f54 100644 --- a/lib/Magento/View/DeployedFilesManager.php +++ b/lib/Magento/View/DeployedFilesManager.php @@ -68,8 +68,8 @@ class DeployedFilesManager implements \Magento\View\PublicFilesManagerInterface */ public static function buildDeployedFilePath($area, $themePath, $file, $module = null) { - return $area . DIRECTORY_SEPARATOR . $themePath . DIRECTORY_SEPARATOR - . ($module ? $module . DIRECTORY_SEPARATOR : '') . $file; + return $area . '/' . $themePath . '/' + . ($module ? $module . '/' : '') . $file; } /** @@ -91,7 +91,7 @@ class DeployedFilesManager implements \Magento\View\PublicFilesManagerInterface $subPath = self::buildDeployedFilePath( $params['area'], $themePath, $filePath, $params['module'] ); - $deployedFilePath = $this->_viewService->getPublicDir() . DIRECTORY_SEPARATOR . $subPath; + $deployedFilePath = $this->_viewService->getPublicDir() . '/' . $subPath; return $deployedFilePath; } diff --git a/lib/Magento/View/Design/Fallback/Factory.php b/lib/Magento/View/Design/Fallback/Factory.php index cfc6eccfbc2..b25b3c86ccd 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\App\Dir; +use Magento\Filesystem; use Magento\View\Design\Fallback\Rule\Composite; use Magento\View\Design\Fallback\Rule\ModularSwitch; use Magento\View\Design\Fallback\Rule\RuleInterface; @@ -39,16 +39,18 @@ use Magento\View\Design\Fallback\Rule\Theme; class Factory { /** - * @var Dir + * @var Filesystem */ - protected $dirs; + protected $filesystem; /** - * @param Dir $dirs + * Constructor + * + * @param Filesystem $filesystem */ - public function __construct(Dir $dirs) + public function __construct(Filesystem $filesystem) { - $this->dirs = $dirs; + $this->filesystem = $filesystem; } /** @@ -58,7 +60,7 @@ class Factory */ public function createLocaleFileRule() { - $themesDir = $this->dirs->getDir(Dir::THEMES); + $themesDir = $this->filesystem->getPath(Filesystem::THEMES); return new Theme( new Simple("$themesDir/<area>/<theme_path>/i18n/<locale>") ); @@ -71,8 +73,8 @@ class Factory */ public function createFileRule() { - $themesDir = $this->dirs->getDir(Dir::THEMES); - $modulesDir = $this->dirs->getDir(Dir::MODULES); + $themesDir = $this->filesystem->getPath(Filesystem::THEMES); + $modulesDir = $this->filesystem->getPath(Filesystem::MODULES); return new ModularSwitch( new Theme( new Simple( @@ -101,9 +103,9 @@ class Factory */ public function createViewFileRule() { - $themesDir = $this->dirs->getDir(Dir::THEMES); - $modulesDir = $this->dirs->getDir(Dir::MODULES); - $pubLibDir = $this->dirs->getDir(Dir::PUB_LIB); + $themesDir = $this->filesystem->getPath(Filesystem::THEMES); + $modulesDir = $this->filesystem->getPath(Filesystem::MODULES); + $pubLibDir = $this->filesystem->getPath(Filesystem::PUB_LIB); 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 54d746fc047..1a08e720659 100644 --- a/lib/Magento/View/Design/FileResolution/Strategy/Fallback.php +++ b/lib/Magento/View/Design/FileResolution/Strategy/Fallback.php @@ -28,6 +28,7 @@ use Magento\Filesystem; use Magento\View\Design\Fallback\Factory; use Magento\View\Design\Fallback\Rule\RuleInterface; use Magento\View\Design\ThemeInterface; +use Magento\Filesystem\Directory\Read; /** * Class Fallback @@ -56,13 +57,20 @@ class Fallback implements FileInterface, LocaleInterface, ViewInterface */ protected $ruleViewFile; + /** + * Root directory with read access + * + * @var Read + */ + protected $rootDirectory; + /** * @param Filesystem $filesystem * @param Factory $fallbackFactory */ public function __construct(Filesystem $filesystem, Factory $fallbackFactory) { - $this->_filesystem = $filesystem; + $this->rootDirectory = $filesystem->getDirectoryRead(Filesystem::ROOT); $this->fallbackFactory = $fallbackFactory; } @@ -171,8 +179,8 @@ class Fallback implements FileInterface, LocaleInterface, ViewInterface { $path = ''; foreach ($fallbackRule->getPatternDirs($params) as $dir) { - $path = str_replace('/', DIRECTORY_SEPARATOR, "{$dir}/{$file}"); - if ($this->_filesystem->has($path)) { + $path = "{$dir}/{$file}"; + if ($this->rootDirectory->isExist($this->rootDirectory->getRelativePath($path))) { return $path; } } diff --git a/lib/Magento/View/Design/FileResolution/Strategy/Fallback/CachingProxy.php b/lib/Magento/View/Design/FileResolution/Strategy/Fallback/CachingProxy.php index 912ac905687..8b5c5790500 100644 --- a/lib/Magento/View/Design/FileResolution/Strategy/Fallback/CachingProxy.php +++ b/lib/Magento/View/Design/FileResolution/Strategy/Fallback/CachingProxy.php @@ -31,6 +31,7 @@ use Magento\View\Design\FileResolution\Strategy\LocaleInterface; use Magento\View\Design\FileResolution\Strategy\View\NotifiableInterface; use Magento\View\Design\FileResolution\Strategy\ViewInterface; use Magento\View\Design\ThemeInterface; +use Magento\Filesystem\Directory\Write; /** * Caching Proxy @@ -47,11 +48,6 @@ class CachingProxy implements FileInterface, LocaleInterface, ViewInterface, Not */ protected $fallback; - /** - * @var Filesystem - */ - protected $filesystem; - /** * Path to maps directory * @@ -73,6 +69,11 @@ class CachingProxy implements FileInterface, LocaleInterface, ViewInterface, Not */ protected $canSaveMap; + /** + * @var Write + */ + protected $varDirectory; + /** * Cached fallback map sections * @@ -92,16 +93,17 @@ class CachingProxy implements FileInterface, LocaleInterface, ViewInterface, Not Fallback $fallback, Filesystem $filesystem, $mapDir, - $baseDir, + $baseDir, // magento root $canSaveMap = true ) { $this->fallback = $fallback; - $this->filesystem = $filesystem; - if (!$filesystem->isDirectory($baseDir)) { + $this->varDirectory = $filesystem->getDirectoryWrite(Filesystem::VAR_DIR); + $rootDirectory = $filesystem->getDirectoryRead(Filesystem::ROOT); + if (!$rootDirectory->isDirectory($rootDirectory->getRelativePath($baseDir))) { throw new \InvalidArgumentException("Wrong base directory specified: '{$baseDir}'"); } $this->baseDir = $baseDir; - $this->mapDir = $mapDir; + $this->mapDir = $this->varDirectory->getRelativePath($mapDir); $this->canSaveMap = $canSaveMap; } @@ -113,15 +115,15 @@ class CachingProxy implements FileInterface, LocaleInterface, ViewInterface, Not if (!$this->canSaveMap) { return; } - if (!$this->filesystem->isDirectory($this->mapDir)) { - $this->filesystem->createDirectory($this->mapDir, 0777); + if (!$this->varDirectory->isDirectory($this->mapDir)) { + $this->varDirectory->create($this->mapDir); } foreach ($this->sections as $sectionFile => $section) { if (!$section['is_changed']) { continue; } - $filePath = $this->mapDir . DIRECTORY_SEPARATOR . $sectionFile; - $this->filesystem->write($filePath, serialize($section['data'])); + $filePath = $this->mapDir . '/' . $sectionFile; + $this->varDirectory->writeFile($filePath, serialize($section['data'])); } } @@ -201,7 +203,7 @@ class CachingProxy implements FileInterface, LocaleInterface, ViewInterface, Not if (isset($this->sections[$sectionKey]['data'][$fileKey])) { $value = $this->sections[$sectionKey]['data'][$fileKey]; if ('' !== (string)$value) { - $value = $this->baseDir . DIRECTORY_SEPARATOR . $value; + $value = $this->baseDir . '/' . $value; } return $value; } @@ -222,13 +224,12 @@ class CachingProxy implements FileInterface, LocaleInterface, ViewInterface, Not */ protected function setToMap($fileType, $area, ThemeInterface $theme, $locale, $module, $file, $filePath) { - $pattern = $this->baseDir . DIRECTORY_SEPARATOR; - if (0 !== strpos($filePath, $pattern)) { + if (0 !== strpos($filePath, $this->baseDir)) { throw new \Magento\Exception( - "Attempt to store fallback path '{$filePath}', which is not within '{$pattern}'" + "Attempt to store fallback path '{$filePath}', which is not within '{$this->baseDir}'" ); } - $value = substr($filePath, strlen($pattern)); + $value = ltrim(substr($filePath, strlen($this->baseDir)), '/\\'); $sectionKey = $this->loadSection($area, $theme, $locale); $fileKey = "$fileType|$file|$module"; @@ -262,13 +263,13 @@ class CachingProxy implements FileInterface, LocaleInterface, ViewInterface, Not { $sectionFile = $this->getSectionFile($area, $themeModel, $locale); if (!isset($this->sections[$sectionFile])) { - $filePath = $this->mapDir . DIRECTORY_SEPARATOR . $sectionFile; + $filePath = $this->mapDir . '/' . $sectionFile; $this->sections[$sectionFile] = array( 'data' => array(), 'is_changed' => false, ); - if ($this->filesystem->isFile($filePath)) { - $this->sections[$sectionFile]['data'] = unserialize($this->filesystem->read($filePath)); + if ($this->varDirectory->isFile($filePath)) { + $this->sections[$sectionFile]['data'] = unserialize($this->varDirectory->readFile($filePath)); } } return $sectionFile; diff --git a/lib/Magento/View/Design/FileResolution/StrategyPool.php b/lib/Magento/View/Design/FileResolution/StrategyPool.php index 7b6930e41cc..c7c6f1a9b16 100644 --- a/lib/Magento/View/Design/FileResolution/StrategyPool.php +++ b/lib/Magento/View/Design/FileResolution/StrategyPool.php @@ -26,7 +26,6 @@ namespace Magento\View\Design\FileResolution; use Magento\Exception; use Magento\App\State; -use Magento\App\Dir; use Magento\Filesystem; use Magento\ObjectManager; @@ -57,11 +56,6 @@ class StrategyPool */ protected $filesystem; - /** - * @var Dir - */ - protected $dirs; - /** * Pool of strategy objects * @@ -95,19 +89,16 @@ class StrategyPool /** * @param ObjectManager $objectManager * @param State $appState - * @param Dir $dirs * @param Filesystem $filesystem */ public function __construct( ObjectManager $objectManager, State $appState, - Dir $dirs, Filesystem $filesystem ) { $this->objectManager = $objectManager; $this->appState = $appState; $this->filesystem = $filesystem; - $this->dirs = $dirs; } /** @@ -192,11 +183,10 @@ class StrategyPool { switch ($className) { case 'Magento\View\Design\FileResolution\Strategy\Fallback\CachingProxy': - $mapDir = $this->dirs->getDir(Dir::VAR_DIR) . DIRECTORY_SEPARATOR - . self::FALLBACK_MAP_DIR; + $mapDir = $this->filesystem->getPath(Filesystem::VAR_DIR) . '/' . self::FALLBACK_MAP_DIR; $arguments = array( - 'mapDir' => str_replace('/', DIRECTORY_SEPARATOR, $mapDir), - 'baseDir' => $this->dirs->getDir(Dir::ROOT), + 'mapDir' => $mapDir, + 'baseDir' => $this->filesystem->getPath(Filesystem::ROOT), ); break; default: diff --git a/lib/Magento/View/Design/Theme/Customization/AbstractFile.php b/lib/Magento/View/Design/Theme/Customization/AbstractFile.php index a49ecb60ee0..e9b670e9403 100644 --- a/lib/Magento/View/Design/Theme/Customization/AbstractFile.php +++ b/lib/Magento/View/Design/Theme/Customization/AbstractFile.php @@ -82,7 +82,7 @@ abstract class AbstractFile public function getFullPath(\Magento\View\Design\Theme\FileInterface $file) { $customizationPath = $this->_customizationPath->getCustomizationPath($file->getTheme()); - return $customizationPath . DIRECTORY_SEPARATOR . $file->getData('file_path'); + return $customizationPath . '/' . $file->getData('file_path'); } /** @@ -181,9 +181,9 @@ abstract class AbstractFile */ protected function _saveFileContent($filePath, $content) { - $this->_filesystem->delete($filePath); + $this->getDirectoryWrite()->delete($filePath); if (!empty($content)) { - $this->_filesystem->setIsAllowCreateDirectories(true)->write($filePath, $content); + $this->getDirectoryWrite()->writeFile($this->getDirectoryWrite()->getRelativePath($filePath), $content); } } @@ -194,8 +194,19 @@ abstract class AbstractFile */ protected function _deleteFileContent($filePath) { - if ($this->_filesystem->has($filePath)) { - $this->_filesystem->delete($filePath); + $filePath = $this->getDirectoryWrite()->getRelativePath($filePath); + if ($this->getDirectoryWrite()->touch($filePath)) { + $this->getDirectoryWrite()->delete($filePath); } } + + /** + * Returns filesystem directory instance for write operations + * + * @return \Magento\Filesystem\Directory\WriteInterface + */ + protected function getDirectoryWrite() + { + return $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + } } diff --git a/lib/Magento/View/Design/Theme/Customization/Path.php b/lib/Magento/View/Design/Theme/Customization/Path.php index 14988b37b1c..47e308aaebd 100644 --- a/lib/Magento/View/Design/Theme/Customization/Path.php +++ b/lib/Magento/View/Design/Theme/Customization/Path.php @@ -38,23 +38,39 @@ class Path const DIR_NAME = 'theme_customization'; /** - * @var \Magento\App\Dir + * @var string */ - protected $_dir; + protected $filename; /** - * @var string + * @var \Magento\Filesystem */ - protected $filename; + protected $filesystem; + + /** + * @var \Magento\Filesystem\Directory\Read + */ + protected $mediaDirectoryRead; /** - * @param \Magento\App\Dir $dir + * @var \Magento\Filesystem\Directory\Read + */ + protected $themeDirectoryRead; + + /** + * Constructor + * + * @param \Magento\Filesystem $filesystem * @param $filename */ - public function __construct(\Magento\App\Dir $dir, $filename = \Magento\View\ConfigInterface::CONFIG_FILE_NAME) - { - $this->_dir = $dir; - $this->filename = $filename; + public function __construct( + \Magento\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); } /** @@ -67,9 +83,7 @@ class Path { $path = null; if ($theme->getId()) { - $path = $this->_dir->getDir(\Magento\App\Dir::MEDIA) - . DIRECTORY_SEPARATOR . self::DIR_NAME - . DIRECTORY_SEPARATOR . $theme->getId(); + $path = $this->mediaDirectoryRead->getAbsolutePath(self::DIR_NAME . '/' . $theme->getId()); } return $path; } @@ -84,8 +98,7 @@ class Path { $path = null; if ($theme->getFullPath()) { - $physicalThemesDir = $this->_dir->getDir(\Magento\App\Dir::THEMES); - $path = \Magento\Filesystem::fixSeparator($physicalThemesDir . DIRECTORY_SEPARATOR . $theme->getFullPath()); + $path = $this->themeDirectoryRead->getAbsolutePath($theme->getFullPath()); } return $path; } @@ -100,7 +113,9 @@ class Path { $path = null; if ($theme->getId()) { - $path = $this->getCustomizationPath($theme) . DIRECTORY_SEPARATOR . $this->filename; + $path = $this->mediaDirectoryRead + ->getAbsolutePath(self::DIR_NAME . '/' . $theme->getId() . '/' . $this->filename); + } return $path; } diff --git a/lib/Magento/View/Design/Theme/Image.php b/lib/Magento/View/Design/Theme/Image.php index 0b9726c4057..477eadbe515 100644 --- a/lib/Magento/View/Design/Theme/Image.php +++ b/lib/Magento/View/Design/Theme/Image.php @@ -24,6 +24,8 @@ namespace Magento\View\Design\Theme; +use Magento\Filesystem\Directory\WriteInterface; + /** * Theme Image model class */ @@ -39,11 +41,6 @@ class Image */ const PREVIEW_IMAGE_HEIGHT = 800; - /** - * @var \Magento\Filesystem - */ - protected $_filesystem; - /** * @var \Magento\Image\Factory */ @@ -70,6 +67,13 @@ class Image protected $_theme; /** + * @var WriteInterface + */ + protected $_mediaDirectory; + + /** + * Initialize dependencies + * * @param \Magento\Filesystem $filesystem * @param \Magento\Image\Factory $imageFactory * @param Image\Uploader $uploader @@ -85,7 +89,7 @@ class Image \Magento\Logger $logger, \Magento\View\Design\ThemeInterface $theme = null ) { - $this->_filesystem = $filesystem; + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); $this->_imageFactory = $imageFactory; $this->_uploader = $uploader; $this->_themeImagePath = $themeImagePath; @@ -124,17 +128,19 @@ class Image public function createPreviewImageCopy($previewImagePath) { $previewDir = $this->_themeImagePath->getImagePreviewDirectory(); - $destinationFilePath = $previewDir . DIRECTORY_SEPARATOR . $previewImagePath; - if (empty($previewImagePath) && !$this->_filesystem->has($destinationFilePath)) { + $destinationFilePath = $previewDir . '/' . $previewImagePath; + $destinationFileRelative = $this->_mediaDirectory->getRelativePath($destinationFilePath); + if (empty($previewImagePath) && !$this->_mediaDirectory->isExist($destinationFileRelative)) { return false; } $isCopied = false; try { $destinationFileName = \Magento\File\Uploader::getNewFileName($destinationFilePath); - $isCopied = $this->_filesystem->copy( - $destinationFilePath, - $previewDir . DIRECTORY_SEPARATOR . $destinationFileName + $targetRelative = $this->_mediaDirectory->getRelativePath($previewDir . '/' . $destinationFileName); + $isCopied = $this->_mediaDirectory->copyFile( + $destinationFileRelative, + $targetRelative ); $this->_theme->setPreviewImage($destinationFileName); } catch (\Exception $e) { @@ -153,9 +159,9 @@ class Image $previewImage = $this->_theme->getPreviewImage(); $this->_theme->setPreviewImage(null); if ($previewImage) { - return $this->_filesystem->delete( - $this->_themeImagePath->getImagePreviewDirectory() . DIRECTORY_SEPARATOR . $previewImage - ); + return $this->_mediaDirectory->delete($this->_mediaDirectory->getRelativePath( + $this->_themeImagePath->getImagePreviewDirectory() . '/' . $previewImage + )); } return false; } @@ -175,7 +181,7 @@ class Image $this->removePreviewImage(); } $this->createPreviewImage($tmpFilePath); - $this->_filesystem->delete($tmpFilePath); + $this->_mediaDirectory->delete($tmpFilePath); } return $this; } diff --git a/lib/Magento/View/Design/Theme/Image/Uploader.php b/lib/Magento/View/Design/Theme/Image/Uploader.php index 6d239f8446a..9edd5dcce44 100644 --- a/lib/Magento/View/Design/Theme/Image/Uploader.php +++ b/lib/Magento/View/Design/Theme/Image/Uploader.php @@ -94,6 +94,6 @@ class Uploader if (!$upload->save($destinationPath)) { throw new \Magento\Exception(__('Image can not be saved.')); } - return $destinationPath . DIRECTORY_SEPARATOR . $upload->getUploadedFileName(); + return $destinationPath . '/' . $upload->getUploadedFileName(); } } diff --git a/lib/Magento/View/Element/AbstractBlock.php b/lib/Magento/View/Element/AbstractBlock.php index c46a29d800b..fdf9038e9ab 100644 --- a/lib/Magento/View/Element/AbstractBlock.php +++ b/lib/Magento/View/Element/AbstractBlock.php @@ -48,7 +48,7 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface protected $_design; /** - * @var \Magento\Core\Model\Session + * @var \Magento\Session\SessionManagerInterface */ protected $_session; @@ -103,11 +103,6 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface */ protected $_frontController; - /** - * @var \Magento\App\Helper\HelperFactory - */ - protected $_helperFactory; - /** * @var \Magento\View\Url */ @@ -167,7 +162,6 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface $this->_sidResolver = $context->getSidResolver(); $this->_storeConfig = $context->getStoreConfig(); $this->_frontController = $context->getFrontController(); - $this->_helperFactory = $context->getHelperFactory(); $this->_viewUrl = $context->getViewUrl(); $this->_viewConfig = $context->getViewConfig(); $this->_cacheState = $context->getCacheState(); @@ -175,7 +169,7 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface $this->_app = $context->getApp(); $this->_escaper = $context->getEscaper(); $this->filterManager = $context->getFilterManager(); - $this->_locale = $context->getLocale(); + $this->_locale = $context->getLocale(); parent::__construct($data); $this->_construct(); } @@ -713,17 +707,6 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface return $this->getUrl($route, $params); } - /** - * Return helper object - * - * @param string $name - * @return \Magento\App\Helper\AbstractHelper - */ - public function helper($name) - { - return $this->_helperFactory->get($name); - } - /** * Retrieve formatting date * diff --git a/lib/Magento/View/Element/Context.php b/lib/Magento/View/Element/Context.php index 2329eacdf69..73cfbac1646 100644 --- a/lib/Magento/View/Element/Context.php +++ b/lib/Magento/View/Element/Context.php @@ -71,7 +71,7 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_design; /** - * @var \Magento\Core\Model\Session + * @var \Magento\Session\SessionManagerInterface */ protected $_session; @@ -90,11 +90,6 @@ class Context implements \Magento\ObjectManager\ContextInterface */ protected $_frontController; - /** - * @var \Magento\App\Helper\HelperFactory - */ - protected $_helperFactory; - /** * @var \Magento\View\Url */ @@ -145,11 +140,10 @@ class Context implements \Magento\ObjectManager\ContextInterface * @param \Magento\TranslateInterface $translator * @param \Magento\App\CacheInterface $cache * @param \Magento\View\DesignInterface $design - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\App\FrontController $frontController - * @param \Magento\App\Helper\HelperFactory $helperFactory * @param \Magento\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\App\Cache\StateInterface $cacheState @@ -171,11 +165,10 @@ class Context implements \Magento\ObjectManager\ContextInterface \Magento\TranslateInterface $translator, \Magento\App\CacheInterface $cache, \Magento\View\DesignInterface $design, - \Magento\Core\Model\Session\AbstractSession $session, + \Magento\Session\SessionManagerInterface $session, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Core\Model\Store\Config $storeConfig, \Magento\App\FrontController $frontController, - \Magento\App\Helper\HelperFactory $helperFactory, \Magento\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\App\Cache\StateInterface $cacheState, @@ -197,7 +190,6 @@ class Context implements \Magento\ObjectManager\ContextInterface $this->_sidResolver = $sidResolver; $this->_storeConfig = $storeConfig; $this->_frontController = $frontController; - $this->_helperFactory = $helperFactory; $this->_viewUrl = $viewUrl; $this->_viewConfig = $viewConfig; $this->_cacheState = $cacheState; @@ -240,14 +232,6 @@ class Context implements \Magento\ObjectManager\ContextInterface return $this->_frontController; } - /** - * @return \Magento\App\Helper\HelperFactory - */ - public function getHelperFactory() - { - return $this->_helperFactory; - } - /** * @return \Magento\View\LayoutInterface */ @@ -265,7 +249,7 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Core\Model\Session|\Magento\Core\Model\Session\AbstractSession + * @return \Magento\Session\SessionManagerInterface */ public function getSession() { diff --git a/lib/Magento/View/Element/Messages.php b/lib/Magento/View/Element/Messages.php index 24661dfcf39..779a5e05936 100644 --- a/lib/Magento/View/Element/Messages.php +++ b/lib/Magento/View/Element/Messages.php @@ -57,13 +57,6 @@ class Messages extends Template */ protected $contentWrapTagName = 'span'; - /** - * Flag which require message text escape - * - * @var bool - */ - protected $escapeMessageFlag = false; - /** * Storage for used types of message storages * @@ -77,10 +70,10 @@ class Messages extends Template * @var array */ protected $messageTypes = array( - \Magento\Message\Factory::ERROR, - \Magento\Message\Factory::WARNING, - \Magento\Message\Factory::NOTICE, - \Magento\Message\Factory::SUCCESS + \Magento\Message\MessageInterface::TYPE_ERROR, + \Magento\Message\MessageInterface::TYPE_WARNING, + \Magento\Message\MessageInterface::TYPE_NOTICE, + \Magento\Message\MessageInterface::TYPE_SUCCESS ); /** @@ -97,20 +90,28 @@ class Messages extends Template */ protected $collectionFactory; + /** + * @var \Magento\Message\ManagerInterface + */ + protected $messageManager; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Message\Factory $messageFactory * @param \Magento\Message\CollectionFactory $collectionFactory + * @param \Magento\Message\ManagerInterface $messageManager * @param array $data */ public function __construct( Template\Context $context, \Magento\Message\Factory $messageFactory, \Magento\Message\CollectionFactory $collectionFactory, + \Magento\Message\ManagerInterface $messageManager, array $data = array() ) { $this->messageFactory = $messageFactory; $this->collectionFactory = $collectionFactory; + $this->messageManager = $messageManager; parent::__construct($context, $data); } @@ -121,24 +122,12 @@ class Messages extends Template */ protected function _prepareLayout() { - $this->addStorageType(get_class($this->_session)); - $this->addMessages($this->_session->getMessages(true)); + $this->addStorageType($this->messageManager->getDefaultGroup()); + $this->addMessages($this->messageManager->getMessages(true)); parent::_prepareLayout(); return $this; } - /** - * Set message escape flag - * - * @param bool $flag - * @return \Magento\View\Element\Messages - */ - public function setEscapeMessageFlag($flag) - { - $this->escapeMessageFlag = $flag; - return $this; - } - /** * Set messages collection * @@ -160,7 +149,7 @@ class Messages extends Template public function addMessages(\Magento\Message\Collection $messages) { foreach ($messages->getItems() as $message) { - $this->getMessageCollection()->add($message); + $this->getMessageCollection()->addMessage($message); } return $this; } @@ -186,7 +175,7 @@ class Messages extends Template */ public function addMessage(\Magento\Message\AbstractMessage $message) { - $this->getMessageCollection()->add($message); + $this->getMessageCollection()->addMessage($message); return $this; } @@ -198,7 +187,7 @@ class Messages extends Template */ public function addError($message) { - $this->addMessage($this->messageFactory->error($message)); + $this->addMessage($this->messageFactory->create(\Magento\Message\MessageInterface::TYPE_ERROR, $message)); return $this; } @@ -210,7 +199,7 @@ class Messages extends Template */ public function addWarning($message) { - $this->addMessage($this->messageFactory->warning($message)); + $this->addMessage($this->messageFactory->create(\Magento\Message\MessageInterface::TYPE_WARNING, $message)); return $this; } @@ -222,7 +211,7 @@ class Messages extends Template */ public function addNotice($message) { - $this->addMessage($this->messageFactory->notice($message)); + $this->addMessage($this->messageFactory->create(\Magento\Message\MessageInterface::TYPE_NOTICE, $message)); return $this; } @@ -234,7 +223,7 @@ class Messages extends Template */ public function addSuccess($message) { - $this->addMessage($this->messageFactory->success($message)); + $this->addMessage($this->messageFactory->create(\Magento\Message\MessageInterface::TYPE_SUCCESS, $message)); return $this; } @@ -244,9 +233,9 @@ class Messages extends Template * @param string $type * @return array */ - public function getMessages($type=null) + public function getMessagesByType($type) { - return $this->getMessageCollection()->getItems($type); + return $this->getMessageCollection()->getItemsByType($type); } /** @@ -297,7 +286,7 @@ class Messages extends Template { $html = ''; foreach ($this->getMessageTypes() as $type) { - if ($messages = $this->getMessages($type)) { + if ($messages = $this->getMessagesByType($type)) { if (!$html) { $html .= '<' . $this->firstLevelTagName . ' class="messages">'; } @@ -307,7 +296,7 @@ class Messages extends Template foreach ($messages as $message) { $html.= '<' . $this->secondLevelTagName . '>'; $html.= '<' . $this->contentWrapTagName . $this->getUiId('message', $type) . '>'; - $html.= ($this->escapeMessageFlag) ? $this->escapeHtml($message->getText()) : $message->getText(); + $html.= $message->getText(); $html.= '</' . $this->contentWrapTagName . '>'; $html.= '</' . $this->secondLevelTagName . '>'; } @@ -377,14 +366,4 @@ class Messages extends Template { $this->usedStorageTypes[] = $type; } - - /** - * Whether or not to escape the message. - * - * @return boolean - */ - public function shouldEscapeMessage() - { - return $this->escapeMessageFlag; - } } diff --git a/lib/Magento/View/Element/Template.php b/lib/Magento/View/Element/Template.php index 1ec8e8a908f..aba6328483d 100644 --- a/lib/Magento/View/Element/Template.php +++ b/lib/Magento/View/Element/Template.php @@ -24,6 +24,8 @@ namespace Magento\View\Element; +use Magento\Filesystem; + /** * Base html block * @SuppressWarnings(PHPMD.NumberOfChildren) @@ -60,12 +62,9 @@ class Template extends AbstractBlock protected $_allowSymlinks; /** - * @var \Magento\App\Dir - */ - protected $_dirs; - - /** - * @var \Magento\Filesystem + * Filesystem instance + * + * @var Filesystem */ protected $_filesystem; @@ -97,16 +96,27 @@ class Template extends AbstractBlock protected $_appState; /** - * @param \Magento\View\Element\Template\Context $context - * @param array $data + * Root directory instance * - * @todo Remove injection of the core helper from this class and its descendants, because it's no longer used + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $directory; + + /** + * Media directory instance + * + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $mediaDirectory; + + /** + * @param Template\Context $context + * @param array $data */ public function __construct( Template\Context $context, array $data = array() ) { - $this->_dirs = $context->getDirs(); $this->_filesystem = $context->getFilesystem(); $this->_viewFileSystem = $context->getViewFileSystem(); $this->templateEnginePool = $context->getEnginePool(); @@ -126,7 +136,7 @@ class Template extends AbstractBlock * In case template was passed through constructor * we assign it to block's property _template * Mainly for those cases when block created - * not via \Magento\View\LayoutInterface::addBlock() + * not via \Magento\View\Model\LayoutInterface::addBlock() */ if ($this->hasData('template')) { $this->setTemplate($this->getData('template')); @@ -208,13 +218,12 @@ class Template extends AbstractBlock */ public function fetchView($fileName) { - $viewShortPath = str_replace($this->_dirs->getDir(\Magento\App\Dir::ROOT), '', $fileName); - \Magento\Profiler::start('TEMPLATE:' . $fileName, array('group' => 'TEMPLATE', 'file_name' => $viewShortPath)); + $relativeFilePath = $this->getRootDirectory()->getRelativePath($fileName); + \Magento\Profiler::start( + 'TEMPLATE:' . $fileName, array('group' => 'TEMPLATE', 'file_name' => $relativeFilePath) + ); - if (($this->_filesystem->isPathInDirectory($fileName, $this->_dirs->getDir(\Magento\App\Dir::APP)) - || $this->_filesystem->isPathInDirectory($fileName, $this->_dirs->getDir(\Magento\App\Dir::THEMES)) - || $this->isAllowSymlinks()) && $this->_filesystem->isFile($fileName) - ) { + if ($this->isTemplateFileValid($fileName)) { $extension = pathinfo($fileName, PATHINFO_EXTENSION); $templateEngine = $this->templateEnginePool->get($extension); $html = $templateEngine->render($this, $fileName, $this->_viewVars); @@ -281,15 +290,78 @@ class Template extends AbstractBlock } /** - * Get is allowed symlinks flag + * Get is allowed symliks flag * * @return bool */ protected function isAllowSymlinks() { - if (is_null($this->_allowSymlinks)) { + if (null === $this->_allowSymlinks) { $this->_allowSymlinks = $this->_storeConfig->getConfigFlag(self::XML_PATH_TEMPLATE_ALLOW_SYMLINK); } return $this->_allowSymlinks; } + + /** + * Instantiates filesystem directory + * + * @return \Magento\Filesystem\Directory\ReadInterface + */ + protected function getRootDirectory() + { + if (null === $this->directory) { + $this->directory = $this->_filesystem->getDirectoryRead(Filesystem::ROOT); + } + + return $this->directory; + } + + /** + * Get media directory + * + * @return \Magento\Filesystem\Directory\Read + */ + protected function getMediaDirectory() + { + if (!$this->mediaDirectory) { + $this->mediaDirectory = $this->_filesystem->getDirectoryRead(Filesystem::MEDIA); + } + return $this->mediaDirectory; + } + + /** + * Checks whether the provided file can be rendered. + * + * Available directories which are allowed to be rendered + * (the template file should be located under these directories): + * - app + * - design + * + * @param string $fileName + * @return bool + */ + protected function isTemplateFileValid($fileName) + { + $fileName = str_replace('\\', '/', $fileName); + + $themesDir = str_replace('\\', '/', $this->_filesystem->getPath(Filesystem::THEMES)); + $appDir = str_replace('\\', '/', $this->_filesystem->getPath(Filesystem::APP)); + return ( + $this->isPathInDirectory($fileName, $appDir) + || $this->isPathInDirectory($fileName, $themesDir) + || $this->isAllowSymlinks() + ) && $this->getRootDirectory()->isFile($this->getRootDirectory()->getRelativePath($fileName)); + } + + /** + * Checks whether path related to the directory + * + * @param string $path + * @param string $directory + * @return bool + */ + protected function isPathInDirectory($path, $directory) + { + return 0 === strpos($path, $directory); + } } diff --git a/lib/Magento/View/Element/Template/Context.php b/lib/Magento/View/Element/Template/Context.php index 67948ce26e1..e07c01ce04f 100644 --- a/lib/Magento/View/Element/Template/Context.php +++ b/lib/Magento/View/Element/Template/Context.php @@ -17,13 +17,6 @@ namespace Magento\View\Element\Template; */ class Context extends \Magento\View\Element\Context { - /** - * Dirs instance - * - * @var \Magento\App\Dir - */ - protected $_dirs; - /** * Logger instance * @@ -66,11 +59,10 @@ class Context extends \Magento\View\Element\Context * @param \Magento\TranslateInterface $translator * @param \Magento\App\CacheInterface $cache * @param \Magento\View\DesignInterface $design - * @param \Magento\Core\Model\Session $session + * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\App\FrontController $frontController - * @param \Magento\App\Helper\HelperFactory $helperFactory * @param \Magento\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\App\Cache\StateInterface $cacheState @@ -79,7 +71,6 @@ class Context extends \Magento\View\Element\Context * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\App\Dir $dirs * @param \Magento\Filesystem $filesystem * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEnginePool $enginePool @@ -97,11 +88,10 @@ class Context extends \Magento\View\Element\Context \Magento\TranslateInterface $translator, \Magento\App\CacheInterface $cache, \Magento\View\DesignInterface $design, - \Magento\Core\Model\Session $session, + \Magento\Session\SessionManagerInterface $session, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Core\Model\Store\Config $storeConfig, \Magento\App\FrontController $frontController, - \Magento\App\Helper\HelperFactory $helperFactory, \Magento\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\App\Cache\StateInterface $cacheState, @@ -110,7 +100,6 @@ class Context extends \Magento\View\Element\Context \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Core\Model\LocaleInterface $locale, - \Magento\App\Dir $dirs, \Magento\Filesystem $filesystem, \Magento\View\FileSystem $viewFileSystem, \Magento\View\TemplateEnginePool $enginePool, @@ -130,7 +119,6 @@ class Context extends \Magento\View\Element\Context $sidResolver, $storeConfig, $frontController, - $helperFactory, $viewUrl, $viewConfig, $cacheState, @@ -144,23 +132,12 @@ class Context extends \Magento\View\Element\Context $this->_storeManager = $storeManager; $this->_appState = $appState; - $this->_dirs = $dirs; $this->_logger = $logger; $this->_filesystem = $filesystem; $this->_viewFileSystem = $viewFileSystem; $this->enginePool = $enginePool; } - /** - * Get dirs instance - * - * @return \Magento\App\Dir - */ - public function getDirs() - { - return $this->_dirs; - } - /** * Get filesystem instance * diff --git a/lib/Magento/View/Layout/File/Source/Base.php b/lib/Magento/View/Layout/File/Source/Base.php index 0a6c7b10b90..ed9c7c6c1c1 100644 --- a/lib/Magento/View/Layout/File/Source/Base.php +++ b/lib/Magento/View/Layout/File/Source/Base.php @@ -26,8 +26,8 @@ namespace Magento\View\Layout\File\Source; use Magento\View\Layout\File\SourceInterface; use Magento\View\Design\ThemeInterface; -use Magento\App\Dir; use Magento\Filesystem; +use Magento\Filesystem\Directory\ReadInterface; use Magento\View\Layout\File\Factory; /** @@ -36,32 +36,24 @@ use Magento\View\Layout\File\Factory; class Base implements SourceInterface { /** - * @var Filesystem + * @var Factory */ - private $filesystem; + private $fileFactory; /** - * @var Dir + * @var ReadInterface */ - private $dirs; - - /** - * @var Factory - */ - private $fileFactory; + protected $modulesDirectory; /** * @param Filesystem $filesystem - * @param Dir $dirs * @param Factory $fileFactory */ public function __construct( Filesystem $filesystem, - Dir $dirs, Factory $fileFactory ) { - $this->filesystem = $filesystem; - $this->dirs = $dirs; + $this->modulesDirectory = $filesystem->getDirectoryRead(Filesystem::MODULES); $this->fileFactory = $fileFactory; } @@ -76,11 +68,15 @@ class Base implements SourceInterface { $namespace = $module = '*'; $area = $theme->getArea(); - $files = $this->filesystem->searchKeys( - $this->dirs->getDir(Dir::MODULES), - "{$namespace}/{$module}/view/{$area}/layout/{$filePath}.xml" + $patternForSearch = str_replace( + array('/', '\*'), + array('\/', '[\S]+'), + preg_quote("~{$namespace}/{$module}/view/{$area}/layout/{$filePath}.xml~") ); - + $files = $this->modulesDirectory->search($patternForSearch); + foreach ($files as $key => $file) { + $files[$key] = $this->modulesDirectory->getAbsolutePath($file); + } $pattern = "#(?<namespace>[^/]+)/(?<module>[^/]+)/view/" . preg_quote($area) . "/layout/" diff --git a/lib/Magento/View/Layout/File/Source/Override/Base.php b/lib/Magento/View/Layout/File/Source/Override/Base.php index a93abcf0514..dc1a22ea967 100644 --- a/lib/Magento/View/Layout/File/Source/Override/Base.php +++ b/lib/Magento/View/Layout/File/Source/Override/Base.php @@ -26,8 +26,8 @@ namespace Magento\View\Layout\File\Source\Override; use Magento\View\Layout\File\SourceInterface; use Magento\View\Design\ThemeInterface; -use Magento\App\Dir; use Magento\Filesystem; +use Magento\Filesystem\Directory\ReadInterface; use Magento\View\Layout\File\Factory; /** @@ -36,32 +36,24 @@ use Magento\View\Layout\File\Factory; class Base implements SourceInterface { /** - * @var Filesystem + * @var Factory */ - private $filesystem; + private $fileFactory; /** - * @var Dir + * @var ReadInterface */ - private $dirs; - - /** - * @var Factory - */ - private $fileFactory; + protected $themesDirectory; /** * @param Filesystem $filesystem - * @param Dir $dirs * @param Factory $fileFactory */ public function __construct( Filesystem $filesystem, - Dir $dirs, Factory $fileFactory ) { - $this->filesystem = $filesystem; - $this->dirs = $dirs; + $this->themesDirectory = $filesystem->getDirectoryRead(Filesystem::THEMES); $this->fileFactory = $fileFactory; } @@ -76,11 +68,16 @@ class Base implements SourceInterface { $namespace = $module = '*'; $themePath = $theme->getFullPath(); - $files = $this->filesystem->searchKeys( - $this->dirs->getDir(Dir::THEMES), - "{$themePath}/{$namespace}_{$module}/layout/override/base/{$filePath}.xml" + $patternForSearch = str_replace( + array('/', '\*'), + array('\/', '[\S]+'), + preg_quote("~{$themePath}/{$namespace}_{$module}/layout/override/base/{$filePath}.xml~") ); - + $files = $this->themesDirectory + ->search($patternForSearch); + foreach ($files as $key => $file) { + $files[$key] = $this->themesDirectory->getAbsolutePath($file); + } $result = array(); $pattern = "#/(?<moduleName>[^/]+)/layout/override/base/" . preg_quote(rtrim($filePath, '*')) diff --git a/lib/Magento/View/Layout/File/Source/Override/Theme.php b/lib/Magento/View/Layout/File/Source/Override/Theme.php index a949fe8acff..57dd6c02002 100644 --- a/lib/Magento/View/Layout/File/Source/Override/Theme.php +++ b/lib/Magento/View/Layout/File/Source/Override/Theme.php @@ -26,7 +26,6 @@ namespace Magento\View\Layout\File\Source\Override; use Magento\View\Layout\File\SourceInterface; use Magento\View\Design\ThemeInterface; -use Magento\App\Dir; use Magento\Filesystem; use Magento\View\Layout\File\Factory; use Magento\Exception; @@ -41,11 +40,6 @@ class Theme implements SourceInterface */ private $filesystem; - /** - * @var Dir - */ - private $dirs; - /** * @var Factory */ @@ -53,16 +47,13 @@ class Theme implements SourceInterface /** * @param Filesystem $filesystem - * @param Dir $dirs * @param Factory $fileFactory */ public function __construct( Filesystem $filesystem, - Dir $dirs, Factory $fileFactory ) { $this->filesystem = $filesystem; - $this->dirs = $dirs; $this->fileFactory = $fileFactory; } @@ -78,11 +69,14 @@ class Theme implements SourceInterface { $namespace = $module = '*'; $themePath = $theme->getFullPath(); - $files = $this->filesystem->searchKeys( - $this->dirs->getDir(Dir::THEMES), - "{$themePath}/{$namespace}_{$module}/layout/override/theme/*/{$filePath}.xml" + $patternForSearch = str_replace( + array('/', '\*'), + array('\/', '[\S]+'), + preg_quote("~{$themePath}/{$namespace}_{$module}/layout/override/theme/*/{$filePath}.xml~") ); + $files = $this->filesystem->getDirectoryRead(Filesystem::THEMES)->search($patternForSearch); + if (empty($files)) { return array(); } diff --git a/lib/Magento/View/Layout/File/Source/Theme.php b/lib/Magento/View/Layout/File/Source/Theme.php index 1abcaec4f6d..2190eef60bc 100644 --- a/lib/Magento/View/Layout/File/Source/Theme.php +++ b/lib/Magento/View/Layout/File/Source/Theme.php @@ -26,8 +26,8 @@ namespace Magento\View\Layout\File\Source; use Magento\View\Layout\File\SourceInterface; use Magento\View\Design\ThemeInterface; -use Magento\App\Dir; use Magento\Filesystem; +use Magento\Filesystem\Directory\ReadInterface; use Magento\View\Layout\File\Factory; /** @@ -36,32 +36,24 @@ use Magento\View\Layout\File\Factory; class Theme implements SourceInterface { /** - * @var Filesystem - */ - private $filesystem; - - /** - * @var Dir + * @var Factory */ - private $dirs; + private $fileFactory; /** - * @var Factory + * @var ReadInterface */ - private $fileFactory; + protected $themesDirectory; /** * @param Filesystem $filesystem - * @param Dir $dirs * @param Factory $fileFactory */ public function __construct( Filesystem $filesystem, - Dir $dirs, Factory $fileFactory ) { - $this->filesystem = $filesystem; - $this->dirs = $dirs; + $this->themesDirectory = $filesystem->getDirectoryRead(Filesystem::THEMES); $this->fileFactory = $fileFactory; } @@ -76,10 +68,15 @@ class Theme implements SourceInterface { $namespace = $module = '*'; $themePath = $theme->getFullPath(); - $files = $this->filesystem->searchKeys( - $this->dirs->getDir(Dir::THEMES), - "{$themePath}/{$namespace}_{$module}/layout/{$filePath}.xml" + $patternForSearch = str_replace( + array('/', '\*'), + array('\/', '[\S]+'), + preg_quote("~{$themePath}/{$namespace}_{$module}/layout/{$filePath}.xml~") ); + $files = $this->themesDirectory->search($patternForSearch); + foreach ($files as $key => $file) { + $files[$key] = $this->themesDirectory->getAbsolutePath($file); + } $result = array(); $pattern = "#" . preg_quote($themePath) . "/(?<moduleName>[^/]+)/layout/" . preg_quote(rtrim($filePath, '*')) diff --git a/lib/Magento/View/Publisher.php b/lib/Magento/View/Publisher.php index 0fa4026af4b..f19884542be 100644 --- a/lib/Magento/View/Publisher.php +++ b/lib/Magento/View/Publisher.php @@ -24,9 +24,8 @@ namespace Magento\View; -/** - * Handles file publication - */ +use Magento\Filesystem\Directory\WriteInterface; + class Publisher implements \Magento\View\PublicFilesManagerInterface { /**#@+ @@ -87,14 +86,14 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface protected $_allowDuplication; /** - * @var \Magento\App\Dir + * @var \Magento\Module\Dir\Reader */ - protected $_dir; + protected $_modulesReader; /** - * @var \Magento\Module\Dir\Reader + * @var WriteInterface */ - protected $_modulesReader; + protected $rootDirectory; /** * @param \Magento\Logger $logger @@ -102,7 +101,6 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface * @param \Magento\View\Url\CssResolver $cssUrlResolver * @param Service $viewService * @param FileSystem $viewFileSystem - * @param \Magento\App\Dir $dir * @param \Magento\Module\Dir\Reader $modulesReader * @param $allowDuplication */ @@ -112,15 +110,14 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface \Magento\View\Url\CssResolver $cssUrlResolver, \Magento\View\Service $viewService, \Magento\View\FileSystem $viewFileSystem, - \Magento\App\Dir $dir, \Magento\Module\Dir\Reader $modulesReader, $allowDuplication ) { $this->_filesystem = $filesystem; + $this->rootDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); $this->_cssUrlResolver = $cssUrlResolver; $this->_viewService = $viewService; $this->_viewFileSystem = $viewFileSystem; - $this->_dir = $dir; $this->_modulesReader = $modulesReader; $this->_logger = $logger; $this->_allowDuplication = $allowDuplication; @@ -129,8 +126,6 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface /** * Get published file path * - * {@inheritdoc} - * * @param string $filePath * @param array $params * @return string @@ -173,7 +168,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface $sourcePath = $this->_viewFileSystem->getViewFile($filePath, $params); - if (!$this->_filesystem->has($sourcePath)) { + if (!$this->rootDirectory->isExist($this->rootDirectory->getRelativePath($sourcePath))) { throw new \Magento\Exception("Unable to locate theme file '{$sourcePath}'."); } if (!$this->_needToProcessFile($sourcePath)) { @@ -201,21 +196,21 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface $cssContent = $this->_getPublicCssContent($sourcePath, $targetPath, $filePath, $params); } - $fileMTime = $this->_filesystem->getMTime($sourcePath); - if (!$this->_filesystem->has($targetPath) || $fileMTime != $this->_filesystem->getMTime($targetPath)) { - $publicDir = dirname($targetPath); - if (!$this->_filesystem->isDirectory($publicDir)) { - $this->_filesystem->createDirectory($publicDir, 0777); - } + $targetDirectory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::STATIC_VIEW); + $sourcePathRelative = $this->rootDirectory->getRelativePath($sourcePath); + $targetPathRelative = $targetDirectory->getRelativePath($targetPath); + $fileMTime = $this->rootDirectory->stat($sourcePathRelative)['mtime']; + if (!$targetDirectory->isExist($targetPathRelative) + || $fileMTime != $targetDirectory->stat($targetPathRelative)['mtime']) { if (isset($cssContent)) { - $this->_filesystem->write($targetPath, $cssContent); - $this->_filesystem->touch($targetPath, $fileMTime); - } elseif ($this->_filesystem->isFile($sourcePath)) { - $this->_filesystem->copy($sourcePath, $targetPath); - $this->_filesystem->touch($targetPath, $fileMTime); - } elseif (!$this->_filesystem->isDirectory($targetPath)) { - $this->_filesystem->createDirectory($targetPath, 0777); + $targetDirectory->writeFile($targetPathRelative, $cssContent); + $targetDirectory->touch($targetPathRelative, $fileMTime); + } elseif ($this->rootDirectory->isFile($sourcePathRelative)) { + $this->rootDirectory->copyFile($sourcePathRelative, $targetPathRelative, $targetDirectory); + $targetDirectory->touch($targetPathRelative, $fileMTime); + } elseif (!$targetDirectory->isDirectory($targetPathRelative)) { + $targetDirectory->create($targetPathRelative); } } @@ -255,7 +250,8 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface */ protected function _needToProcessFile($filePath) { - $jsPath = $this->_dir->getDir(\Magento\App\Dir::PUB_LIB) . DS; + $jsPath = $this->_filesystem->getPath(\Magento\Filesystem::PUB_LIB) . '/'; + $filePath = str_replace('\\', '/', $filePath); if (strncmp($filePath, $jsPath, strlen($jsPath)) === 0) { return false; } @@ -269,7 +265,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface return false; } - $themePath = $this->_viewService->getPublicDir() . DS; + $themePath = $this->_filesystem->getPath(\Magento\Filesystem::STATIC_VIEW) . '/'; if (strncmp($filePath, $themePath, strlen($themePath)) !== 0) { return true; } @@ -302,15 +298,15 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface /** @var $theme \Magento\View\Design\ThemeInterface */ $theme = $params['themeModel']; if ($theme->getThemePath()) { - $designPath = str_replace('/', DS, $theme->getThemePath()); + $designPath = $theme->getThemePath(); } elseif ($theme->getId()) { $designPath = self::PUBLIC_THEME_DIR . $theme->getId(); } else { $designPath = self::PUBLIC_VIEW_DIR; } - $publicFile = $params['area'] . DS . $designPath . DS . $params['locale'] . - ($params['module'] ? DS . $params['module'] : '') . DS . $file; + $publicFile = $params['area'] . '/' . $designPath . '/' . $params['locale'] . + ($params['module'] ? '/' . $params['module'] : '') . '/' . $file; return $publicFile; } @@ -324,16 +320,16 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface */ protected function _buildPublicViewSufficientFilename($filename, array $params) { - $designDir = $this->_dir->getDir(\Magento\App\Dir::THEMES) . DS; + $designDir = $this->_filesystem->getPath(\Magento\Filesystem::THEMES) . '/'; if (0 === strpos($filename, $designDir)) { // theme file $publicFile = substr($filename, strlen($designDir)); } else { // modular file $module = $params['module']; - $moduleDir = $this->_modulesReader->getModuleDir('theme', $module) . DS; + $moduleDir = $this->_modulesReader->getModuleDir('theme', $module) . '/'; $publicFile = substr($filename, strlen($moduleDir)); - $publicFile = self::PUBLIC_MODULE_DIR . DS . $module . DS . $publicFile; + $publicFile = self::PUBLIC_MODULE_DIR . '/' . $module . '/' . $publicFile; } return $publicFile; } @@ -349,7 +345,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface */ protected function _getPublicCssContent($sourcePath, $publicPath, $fileName, $params) { - $content = $this->_filesystem->read($sourcePath); + $content = $this->rootDirectory->readFile($this->rootDirectory->getRelativePath($sourcePath)); $callback = function ($fileId, $originalPath) use ($fileName, $params) { $relatedPathPublic = $this->_publishRelatedViewFile( @@ -373,7 +369,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface */ protected function _buildPublicViewFilename($file) { - return $this->_viewService->getPublicDir() . DS . $file; + return $this->_viewService->getPublicDir() . '/' . $file; } /** @@ -391,18 +387,18 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface $filePath = $this->_viewService->extractScope($fileId, $params); } else { /* Check if module file overridden on theme level based on _module property and file path */ - if ($params['module'] && strpos($parentFilePath, $this->_dir->getDir(\Magento\App\Dir::THEMES)) === 0) { + $themesPath = $this->_filesystem->getPath(\Magento\Filesystem::THEMES); + if ($params['module'] && strpos($parentFilePath, $themesPath) === 0) { /* Add module directory to relative URL */ $filePath = dirname($params['module'] . '/' . $parentFileName) . '/' . $fileId; - $filePath = $this->_filesystem->normalizePath($filePath, true); if (strpos($filePath, $params['module']) === 0) { $filePath = ltrim(str_replace($params['module'], '', $filePath), '/'); } else { $params['module'] = false; } } else { - $filePath = $this->_filesystem->normalizePath(dirname($parentFileName) . '/' . $fileId, true); + $filePath = dirname($parentFileName) . '/' . $fileId; } } diff --git a/lib/Magento/View/Service.php b/lib/Magento/View/Service.php index b3c14929bf4..b569fe9bdc9 100644 --- a/lib/Magento/View/Service.php +++ b/lib/Magento/View/Service.php @@ -50,25 +50,25 @@ class Service protected $themeFactory; /** - * @var \Magento\App\Dir + * @var string */ - protected $_dir; + protected $_pubDirectory; /** * @param \Magento\App\State $appState * @param \Magento\View\DesignInterface $design * @param \Magento\View\Design\Theme\FlyweightFactory $themeFactory - * @param \Magento\App\Dir $dir + * @param \Magento\Filesystem $filesystem */ public function __construct( \Magento\App\State $appState, \Magento\View\DesignInterface $design, \Magento\View\Design\Theme\FlyweightFactory $themeFactory, - \Magento\App\Dir $dir + \Magento\Filesystem $filesystem ) { $this->_appState = $appState; $this->_design = $design; - $this->_dir = $dir; + $this->_pubDirectory = $filesystem->getPath(\Magento\Filesystem::STATIC_VIEW); $this->themeFactory = $themeFactory; } @@ -128,7 +128,7 @@ class Service */ public function getPublicDir() { - return $this->_dir->getDir(\Magento\App\Dir::STATIC_VIEW); + return $this->_pubDirectory; } /** diff --git a/lib/Magento/View/TemplateEngine/Php.php b/lib/Magento/View/TemplateEngine/Php.php index ce367b1807e..804ca0d313e 100644 --- a/lib/Magento/View/TemplateEngine/Php.php +++ b/lib/Magento/View/TemplateEngine/Php.php @@ -37,6 +37,19 @@ class Php implements TemplateEngineInterface */ protected $_currentBlock; + /** + * @var + */ + protected $_helperFactory; + + /** + * @param \Magento\ObjectManager $helperFactory + */ + public function __construct(\Magento\ObjectManager $helperFactory) + { + $this->_helperFactory = $helperFactory; + } + /** * Render output * @@ -109,4 +122,23 @@ class Php implements TemplateEngineInterface { return $this->_currentBlock->$name; } + + /** + * Get helper singleton + * + * @param string $className + * @return \Magento\App\Helper\AbstractHelper + * @throws \LogicException + */ + public function helper($className) + { + $helper = $this->_helperFactory->get($className); + if (false === ($helper instanceof \Magento\App\Helper\AbstractHelper)) { + throw new \LogicException( + $className . ' doesn\'t extends Magento\App\Helper\AbstractHelper' + ); + } + + return $helper; + } } diff --git a/lib/Magento/View/Url.php b/lib/Magento/View/Url.php index be268bc5f85..8eb2fd1edc1 100644 --- a/lib/Magento/View/Url.php +++ b/lib/Magento/View/Url.php @@ -39,11 +39,6 @@ class Url */ protected $_filesystem; - /** - * @var \Magento\App\Dir - */ - protected $_dirs; - /** * @var \Magento\View\Service */ @@ -78,7 +73,6 @@ class Url /** * @param \Magento\Filesystem $filesystem - * @param \Magento\App\Dir $dirs * @param \Magento\UrlInterface $urlBuilder * @param Url\ConfigInterface $config * @param Service $viewService @@ -88,7 +82,6 @@ class Url */ public function __construct( \Magento\Filesystem $filesystem, - \Magento\App\Dir $dirs, \Magento\UrlInterface $urlBuilder, \Magento\View\Url\ConfigInterface $config, \Magento\View\Service $viewService, @@ -97,7 +90,6 @@ class Url array $fileUrlMap = array() ) { $this->_filesystem = $filesystem; - $this->_dirs = $dirs; $this->_urlBuilder = $urlBuilder; $this->_config = $config; $this->_viewService = $viewService; @@ -155,10 +147,10 @@ class Url public function getPublicFileUrl($publicFilePath, $isSecure = null) { foreach ($this->_fileUrlMap as $urlMap) { - $dir = $this->_dirs->getDir($urlMap['value']); + $dir = $this->_filesystem->getPath($urlMap['value']); + $publicFilePath = str_replace('\\', '/', $publicFilePath); if (strpos($publicFilePath, $dir) === 0) { $relativePath = ltrim(substr($publicFilePath, strlen($dir)), '\\/'); - $relativePath = str_replace(DIRECTORY_SEPARATOR, '/', $relativePath); $url = $this->_urlBuilder->getBaseUrl( array( '_type' => $urlMap['key'], @@ -167,12 +159,14 @@ class Url ) . $relativePath; if ($this->_isStaticFilesSigned() && $this->_viewService->isViewFileOperationAllowed()) { - $fileMTime = $this->_filesystem->getMTime($publicFilePath); + $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $fileMTime = $directory->stat($directory->getRelativePath($publicFilePath))['mtime']; $url .= '?' . $fileMTime; } return $url; } } + throw new \Magento\Exception( "Cannot build URL for the file '$publicFilePath' because it does not reside in a public directory." ); diff --git a/lib/Magento/View/Url/CssResolver.php b/lib/Magento/View/Url/CssResolver.php index c0f02ba4e00..8729b563d74 100644 --- a/lib/Magento/View/Url/CssResolver.php +++ b/lib/Magento/View/Url/CssResolver.php @@ -38,23 +38,15 @@ class CssResolver /** * @var \Magento\Filesystem */ - protected $_filesystem; - - /** - * @var \Magento\App\Dir - */ - protected $_dirs; + protected $filesystem; /** * @param \Magento\Filesystem $filesystem - * @param \Magento\App\Dir $dirs */ public function __construct( - \Magento\Filesystem $filesystem, - \Magento\App\Dir $dirs + \Magento\Filesystem $filesystem ) { - $this->_filesystem = $filesystem; - $this->_dirs = $dirs; + $this->filesystem = $filesystem; } /** @@ -70,22 +62,48 @@ class CssResolver */ public function replaceCssRelativeUrls($cssContent, $originalPath, $newPath, $cbRelUrlToPublicPath = null) { - $newPath = $this->_filesystem->normalizePath($newPath); $relativeUrls = $this->_extractCssRelativeUrls($cssContent); foreach ($relativeUrls as $urlNotation => $originalRelativeUrl) { if ($cbRelUrlToPublicPath) { $filePath = call_user_func($cbRelUrlToPublicPath, $originalRelativeUrl, $originalPath); } else { - $filePath = $this->_filesystem->normalizePath(dirname($originalPath) . '/' . $originalRelativeUrl); + $filePath = dirname($originalPath) . '/' . $originalRelativeUrl; } - $filePath = $this->_filesystem->normalizePath($filePath); - $relativePath = $this->_getFileRelativePath($newPath, $filePath); + $filePath = $this->_normalizePath(str_replace('\\', '/', $filePath)); + $relativePath = $this->_getFileRelativePath( + $this->_normalizePath(str_replace('\\', '/', $newPath)), $filePath + ); $urlNotationNew = str_replace($originalRelativeUrl, $relativePath, $urlNotation); $cssContent = str_replace($urlNotation, $urlNotationNew, $cssContent); } return $cssContent; } + /** + * Remove unmeaning path chunks from path + * + * @param string $path + * @return string + */ + protected function _normalizePath($path) + { + $parts = explode('/', $path); + $result = array(); + + foreach ($parts as $part) { + if ('..' === $part) { + if (!count($result) || ($result[count($result) - 1] == '..')) { + $result[] = $part; + } else { + array_pop($result); + } + } else if ('.' !== $part) { + $result[] = $part; + } + } + return implode('/', $result); + } + /** * Extract non-absolute URLs from a CSS content * @@ -121,8 +139,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->_dirs->getDir(\Magento\App\Dir::ROOT); - $topDir = $this->_filesystem->normalizePath($topDir); + $topDir = $this->filesystem->getPath(\Magento\Filesystem::ROOT); if (strpos($file, $topDir) !== 0 || strpos($referencedFile, $topDir) !== 0) { throw new \Magento\Exception('Offset can be calculated for internal resources only.'); } diff --git a/lib/Zend/Session/Config/ConfigInterface.php b/lib/Zend/Session/Config/ConfigInterface.php deleted file mode 100644 index 48908e6c8d9..00000000000 --- a/lib/Zend/Session/Config/ConfigInterface.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/** - * Zend Framework (http://framework.zend.com/) - * - * @link http://github.com/zendframework/zf2 for the canonical source repository - * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ - -namespace Zend\Session\Config; - -/** - * Standard session configuration - */ -interface ConfigInterface -{ - public function setOptions($options); - public function getOptions(); - - public function setOption($option, $value); - public function getOption($option); - public function hasOption($option); - - public function toArray(); - - public function setName($name); - public function getName(); - - public function setSavePath($savePath); - public function getSavePath(); - - public function setCookieLifetime($cookieLifetime); - public function getCookieLifetime(); - - public function setCookiePath($cookiePath); - public function getCookiePath(); - - public function setCookieDomain($cookieDomain); - public function getCookieDomain(); - - public function setCookieSecure($cookieSecure); - public function getCookieSecure(); - - public function setCookieHttpOnly($cookieHttpOnly); - public function getCookieHttpOnly(); - - public function setUseCookies($useCookies); - public function getUseCookies(); - - public function setRememberMeSeconds($rememberMeSeconds); - public function getRememberMeSeconds(); -} diff --git a/pub/.htaccess b/pub/.htaccess index b00b2127289..7aa0c2a5537 100644 --- a/pub/.htaccess +++ b/pub/.htaccess @@ -32,7 +32,7 @@ ## adjust memory limit # php_value memory_limit 64M - php_value memory_limit 256M + php_value memory_limit 2048M php_value max_execution_time 18000 ############################################ diff --git a/pub/get.php b/pub/get.php index 79fb37af363..53202634df0 100644 --- a/pub/get.php +++ b/pub/get.php @@ -48,7 +48,7 @@ if (file_exists($configCacheFile) && is_readable($configCacheFile)) { //checking update time if (filemtime($configCacheFile) + $config['update_time'] > time()) { - $mediaDirectory = trim(str_replace(__DIR__, '', $config['media_directory']), DS); + $mediaDirectory = trim(str_replace(__DIR__, '', $config['media_directory']), '/'); $allowedResources = array_merge($allowedResources, $config['allowed_resources']); } } diff --git a/pub/index.php b/pub/index.php index 0e136bc5e00..55e1ec40617 100644 --- a/pub/index.php +++ b/pub/index.php @@ -26,7 +26,7 @@ require __DIR__ . '/../app/bootstrap.php'; \Magento\Profiler::start('magento'); $params = $_SERVER; -$params[\Magento\App\Dir::PARAM_APP_URIS][\Magento\App\Dir::PUB] = ''; +$params[\Magento\Filesystem::PARAM_APP_DIRS][\Magento\Filesystem::PUB] = array('uri' => ''); $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); $result = $entryPoint->run('Magento\App\Http'); \Magento\Profiler::stop('magento'); -- GitLab