From 1e3c16649f64f82b19bc5b5077a9343483fd2ab4 Mon Sep 17 00:00:00 2001 From: mage2-team <mage2-team@magento.com> Date: Fri, 28 Mar 2014 10:24:34 -0700 Subject: [PATCH] 2.0.0.0-dev71 * Fixed bugs: * Fixed an issue with displaying product on the frontend when the product flat indexer is enabled * Fixed an issue with applying catalog price rules on the category level * Fixed an issue where the essential cookies like CUSTOMER, CART, and so on were not created in Google Chrome * Fixed an issue with placing orders by customers assigned to a VAT group * Fixed an issue with incorrect error message during registration, and inability for a shopper to ask for resending a confirmation email * Fixed an issue where the Catalog module resource Setup Upgrade logic was broken * Modularity improvements: * Moved abstract Core models and related logic to the Magento/Model library * Moved the abstract DB logic and Core resource helpers to the Magento/DB library * Eliminated the Core\Model\App class * Moved the Magento Flag functionality to the library * Resolved dependency of the Catalog and related modules on the Review module * Moved indexers related logic from the Core module to the Indexer module * Moved the Inline translation and user intended translate functionality from the Core module to a separate Translation module * Framework Improvements: * Covered Magento library components with unit tests: * Magento\Config * Magento\Convert * Magento\Controller * Magento\Data\Collection\Db * Magento\Mview * Magento\Url and Magento/Url.php * Covered Magento application components with unit tests: * Magento\Checkout\Model\Config * Magento\Checkout\Model\Observer * Magento\Checkout\Model\Type * Magento\Sales\Model\Config * Renamed LauncherInterface to AppInterface * Improvements in code coverage calculation: * Updated the whitelist filter with library code for integration tests code coverage calculation * GitHub requests: * [#512] (https://github.com/magento/magento2/issues/512) -- Theme Thumbnails not showing * [#520] (https://github.com/magento/magento2/pull/502) -- Corrected Search Engine Optimization i18n * [#519] (https://github.com/magento/magento2/issues/519) -- New Theme Activation * Customer Service usage: * Refactored the Log module to use Customer Service * Refactored the RSS module to use Customer Service * Refactored the Review module to use Customer Service * Refactored the Catalog module to use Customer service layer * Refactored the Downloadable module to use Customer service layer --- CHANGELOG.md | 44 ++ .../Controller/Adminhtml/Notification.php | 8 +- .../Magento/AdminNotification/Model/Feed.php | 6 +- .../Magento/AdminNotification/Model/Inbox.php | 6 +- .../Model/NotificationService.php | 4 +- .../Model/Resource/Grid/Collection.php | 2 +- .../Model/Resource/Inbox.php | 2 +- .../Model/Resource/Inbox/Collection.php | 2 +- .../Resource/Inbox/Collection/Critical.php | 2 +- .../Model/Resource/System/Message.php | 2 +- .../Resource/System/Message/Collection.php | 6 +- .../Message/Collection/Synchronized.php | 2 +- .../AdminNotification/Model/Survey.php | 10 +- .../Model/System/Message.php | 3 +- .../Authorizenet/Directpost/Payment.php | 2 +- .../Adminhtml/Authorizenet/Payment.php | 2 +- .../Controller/Authorizenet/Payment.php | 2 +- .../Controller/Directpost/Payment.php | 2 +- .../Authorizenet/Model/Authorizenet.php | 60 +- .../Authorizenet/Model/Authorizenet/Debug.php | 2 +- .../Magento/Authorizenet/Model/Directpost.php | 56 +- .../Model/Resource/Authorizenet/Debug.php | 2 +- .../Authorizenet/Debug/Collection.php | 2 +- .../Backend/App/Router/NoRouteHandler.php | 15 +- .../Block/Cache/Grid/Column/Statuses.php | 2 +- app/code/Magento/Backend/Block/Context.php | 8 +- .../Block/Dashboard/AbstractDashboard.php | 2 +- .../Backend/Block/Template/Context.php | 10 +- .../Magento/Backend/Block/Widget/Grid.php | 4 +- .../Grid/Column/Filter/AbstractFilter.php | 6 +- .../Widget/Grid/Column/Filter/Country.php | 4 +- .../Block/Widget/Grid/Column/Filter/Date.php | 4 +- .../Block/Widget/Grid/Column/Filter/Price.php | 4 +- .../Block/Widget/Grid/Column/Filter/Store.php | 4 +- .../Block/Widget/Grid/Column/Filter/Theme.php | 4 +- .../Backend/Block/Widget/Grid/Export.php | 4 +- .../Block/Widget/Grid/Massaction/Item.php | 4 +- .../Backend/Controller/Adminhtml/Ajax.php | 32 +- .../Backend/Controller/Adminhtml/Cache.php | 2 +- .../Controller/Adminhtml/System/Account.php | 2 +- .../Adminhtml/System/Config/Save.php | 2 +- .../Controller/Adminhtml/System/Store.php | 12 +- .../Controller/Adminhtml/Urlrewrite.php | 2 +- .../Helper/Dashboard/AbstractDashboard.php | 2 +- app/code/Magento/Backend/Model/Auth.php | 2 +- .../Magento/Backend/Model/Auth/Exception.php | 2 +- app/code/Magento/Backend/Model/Config.php | 18 +- .../Model/Config/Backend/Admin/Custom.php | 4 +- .../Model/Config/Backend/Admin/Custompath.php | 2 +- .../Model/Config/Backend/Admin/Observer.php | 16 +- .../Model/Config/Backend/Admin/Robots.php | 4 +- .../Model/Config/Backend/Admin/Usecustom.php | 8 +- .../Config/Backend/Admin/Usesecretkey.php | 4 +- .../Backend/Model/Config/Backend/Baseurl.php | 28 +- .../Backend/Currency/AbstractCurrency.php | 4 +- .../Model/Config/Backend/Currency/Allow.php | 8 +- .../Model/Config/Backend/Currency/Base.php | 4 +- .../Model/Config/Backend/Currency/Cron.php | 4 +- .../Backend/Currency/DefaultCurrency.php | 6 +- .../Model/Config/Backend/Email/Address.php | 2 +- .../Model/Config/Backend/Email/Sender.php | 6 +- .../Model/Config/Backend/Encrypted.php | 4 +- .../Backend/Model/Config/Backend/File.php | 16 +- .../Model/Config/Backend/Image/Adapter.php | 8 +- .../Model/Config/Backend/Image/Favicon.php | 2 +- .../Model/Config/Backend/Image/Logo.php | 2 +- .../Backend/Model/Config/Backend/Locale.php | 8 +- .../Model/Config/Backend/Locale/Timezone.php | 2 +- .../Backend/Model/Config/Backend/Log/Cron.php | 8 +- .../Backend/Model/Config/Backend/Secure.php | 4 +- .../Config/Backend/Storage/Media/Database.php | 4 +- .../Model/Config/Backend/Translate.php | 4 +- .../Model/Config/Structure/Element/Group.php | 6 +- .../Config/Structure/Element/Group/Proxy.php | 2 +- .../Magento/Backend/Model/Locale/Manager.php | 2 +- .../Magento/Backend/Model/Locale/Resolver.php | 8 +- app/code/Magento/Backend/Model/Observer.php | 24 +- app/code/Magento/Backend/Model/Translate.php | 43 -- app/code/Magento/Backend/Model/Url.php | 4 +- app/code/Magento/Backend/etc/adminhtml/di.xml | 11 +- .../Magento/Backend/etc/adminhtml/events.xml | 3 - .../Magento/Backend/etc/adminhtml/system.xml | 2 +- .../Backend/view/adminhtml/page/footer.phtml | 2 +- app/code/Magento/Backup/Model/Backup.php | 12 +- .../Backup/Model/Config/Backend/Cron.php | 8 +- .../Magento/Backup/Model/Resource/Helper.php | 8 +- app/code/Magento/Backup/etc/di.xml | 5 + .../Catalog/Product/View/Type/Bundle.php | 36 +- app/code/Magento/Bundle/Model/Option.php | 2 +- app/code/Magento/Bundle/Model/Price/Index.php | 6 +- .../Magento/Bundle/Model/Product/Type.php | 8 +- .../Magento/Bundle/Model/Resource/Bundle.php | 2 +- .../Magento/Bundle/Model/Resource/Option.php | 10 +- .../Model/Resource/Option/Collection.php | 2 +- .../Bundle/Model/Resource/Price/Index.php | 2 +- .../Bundle/Model/Resource/Selection.php | 2 +- .../Sales/Order/Pdf/Items/Creditmemo.php | 4 +- .../Model/Sales/Order/Pdf/Items/Invoice.php | 4 +- .../Model/Sales/Order/Pdf/Items/Shipment.php | 4 +- app/code/Magento/Bundle/Model/Selection.php | 2 +- app/code/Magento/Bundle/etc/module.xml | 1 - .../Magento/Captcha/Model/Resource/Log.php | 2 +- .../Catalog/Block/Adminhtml/Category/Tree.php | 16 +- .../Product/Edit/Tab/Attributes/Search.php | 14 +- .../Product/Edit/Tab/Price/Group.php | 12 +- .../Edit/Tab/Price/Group/AbstractGroup.php | 35 +- .../Adminhtml/Product/Edit/Tab/Price/Tier.php | 15 +- .../Block/Adminhtml/Product/Edit/Tabs.php | 20 +- .../Catalog/Block/Product/AbstractProduct.php | 82 +-- .../Block/Product/Compare/ListCompare.php | 44 +- .../Magento/Catalog/Block/Product/Context.php | 282 +++++++++ .../Catalog/Block/Product/ListProduct.php | 36 +- .../Catalog/Block/Product/NewProduct.php | 36 +- .../Block/Product/ProductList/Promotion.php | 36 +- .../Block/Product/ProductList/Random.php | 36 +- .../Block/Product/ProductList/Related.php | 36 +- .../Block/Product/ProductList/Toolbar.php | 4 +- .../Block/Product/ProductList/Upsell.php | 36 +- .../ReviewRenderer/DefaultProvider.php | 45 +- .../Block/Product/ReviewRendererInterface.php | 29 +- .../Magento/Catalog/Block/Product/Send.php | 60 +- .../Magento/Catalog/Block/Product/View.php | 36 +- .../Block/Product/View/AbstractView.php | 36 +- .../Block/Product/Widget/Html/Pager.php | 2 +- .../Catalog/Controller/Adminhtml/Category.php | 10 +- .../Catalog/Controller/Adminhtml/Product.php | 31 +- .../Adminhtml/Product/Action/Attribute.php | 4 +- .../Adminhtml/Product/Attribute.php | 2 +- .../Controller/Adminhtml/Product/Set.php | 4 +- .../Catalog/Controller/Adminhtml/Search.php | 4 +- .../Magento/Catalog/Controller/Category.php | 2 +- .../Catalog/Controller/Product/Compare.php | 16 +- app/code/Magento/Catalog/Helper/Product.php | 2 +- .../Catalog/Helper/Product/Composite.php | 76 +-- .../Catalog/Helper/Product/Flat/Indexer.php | 4 +- .../Magento/Catalog/Helper/Product/Price.php | 10 +- .../Magento/Catalog/Helper/Product/View.php | 6 +- .../Magento/Catalog/Model/AbstractModel.php | 6 +- .../Attribute/LockValidatorComposite.php | 6 +- .../Attribute/LockValidatorInterface.php | 6 +- app/code/Magento/Catalog/Model/Category.php | 25 +- .../Category/Attribute/Backend/Sortby.php | 8 +- app/code/Magento/Catalog/Model/Config.php | 6 +- .../Catalog/Model/Config/Backend/Category.php | 4 +- .../Model/Config/CatalogClone/Media/Image.php | 4 +- app/code/Magento/Catalog/Model/Design.php | 6 +- .../Catalog/Model/Entity/Attribute.php | 10 +- app/code/Magento/Catalog/Model/Factory.php | 8 +- .../Category/Flat/Plugin/StoreGroup.php | 14 +- .../Category/Flat/Plugin/StoreView.php | 4 +- .../Category/Flat/System/Config/Mode.php | 4 +- .../Category/Product/Plugin/StoreGroup.php | 12 +- .../Category/Product/Plugin/StoreView.php | 4 +- .../Indexer/Product/Flat/Action/Full.php | 2 +- .../Model/Indexer/Product/Flat/Action/Row.php | 4 +- .../Indexer/Product/Flat/Action/Rows.php | 4 +- .../Indexer/Product/Flat/FlatTableBuilder.php | 4 +- .../Indexer/Product/Flat/Plugin/Store.php | 4 +- .../Product/Flat/Plugin/StoreGroup.php | 4 +- .../Model/Indexer/Product/Flat/Processor.php | 8 +- .../Product/Flat/System/Config/Mode.php | 4 +- .../Product/Price/Plugin/CatalogRule.php | 110 ++++ .../Product/Price/Plugin/CustomerGroup.php | 18 +- .../Model/Indexer/Product/Price/Processor.php | 9 +- .../Price/System/Config/PriceScope.php | 4 +- .../Magento/Catalog/Model/Indexer/Url.php | 4 +- app/code/Magento/Catalog/Model/Layer.php | 6 +- .../Model/Layer/Filter/AbstractFilter.php | 4 +- .../Catalog/Model/Layer/Filter/Factory.php | 4 +- .../Catalog/Model/Layer/Filter/Item.php | 4 +- .../Magento/Catalog/Model/Layer/State.php | 4 +- app/code/Magento/Catalog/Model/Product.php | 3 +- .../Magento/Catalog/Model/Product/Action.php | 6 +- .../Backend/Groupprice/AbstractGroupprice.php | 23 +- .../Model/Product/Attribute/Backend/Media.php | 2 +- .../Model/Product/Attribute/Backend/Price.php | 4 +- .../Model/Product/Attribute/Backend/Sku.php | 4 +- .../Model/Product/Attribute/Backend/Stock.php | 4 +- .../Product/Attribute/Backend/Weight.php | 4 +- .../Catalog/Model/Product/Attribute/Group.php | 4 +- .../Catalog/Model/Product/Compare/Item.php | 22 +- .../Model/Product/Compare/ListCompare.php | 4 +- .../Magento/Catalog/Model/Product/Image.php | 6 +- .../Catalog/Model/Product/Indexer/Eav.php | 4 +- .../Magento/Catalog/Model/Product/Link.php | 6 +- .../Magento/Catalog/Model/Product/Option.php | 10 +- .../Model/Product/Option/Type/Date.php | 10 +- .../Model/Product/Option/Type/DefaultType.php | 2 +- .../Model/Product/Option/Type/Factory.php | 4 +- .../Model/Product/Option/Type/File.php | 2 +- .../Model/Product/Option/Type/Select.php | 2 +- .../Model/Product/Option/Type/Text.php | 2 +- .../Catalog/Model/Product/Option/Value.php | 6 +- .../Model/Product/Type/AbstractType.php | 14 +- .../Catalog/Model/Product/Type/Pool.php | 4 +- .../Catalog/Model/Product/Type/Price.php | 2 +- .../Model/Product/Type/Price/Factory.php | 4 +- .../Magento/Catalog/Model/Product/Url.php | 4 +- .../Magento/Catalog/Model/Product/Website.php | 10 +- .../Catalog/Model/Resource/Attribute.php | 22 +- .../Category/Attribute/Collection.php | 4 +- .../Resource/Category/Flat/Collection.php | 6 +- .../Magento/Catalog/Model/Resource/Config.php | 2 +- .../Catalog/Model/Resource/Eav/Attribute.php | 16 +- .../Model/Resource/Layer/Filter/Attribute.php | 2 +- .../Model/Resource/Layer/Filter/Decimal.php | 2 +- .../Model/Resource/Layer/Filter/Price.php | 2 +- .../Backend/Groupprice/AbstractGroupprice.php | 2 +- .../Product/Attribute/Backend/Media.php | 2 +- .../Resource/Product/Attribute/Collection.php | 4 +- .../Model/Resource/Product/Collection.php | 8 +- .../Model/Resource/Product/Compare/Item.php | 2 +- .../Catalog/Model/Resource/Product/Flat.php | 2 +- .../Model/Resource/Product/Indexer/Eav.php | 4 +- .../Catalog/Model/Resource/Product/Link.php | 2 +- .../Resource/Product/Link/Collection.php | 2 +- .../Catalog/Model/Resource/Product/Option.php | 16 +- .../Resource/Product/Option/Collection.php | 6 +- .../Model/Resource/Product/Option/Value.php | 16 +- .../Product/Option/Value/Collection.php | 2 +- .../Model/Resource/Product/Relation.php | 2 +- .../Model/Resource/Product/Website.php | 2 +- .../Magento/Catalog/Model/Resource/Url.php | 6 +- .../Backend/Catalog/Url/Rewrite/Suffix.php | 4 +- .../Catalog/Model/Template/Filter/Factory.php | 4 +- app/code/Magento/Catalog/Model/Url.php | 6 +- app/code/Magento/Catalog/etc/di.xml | 19 +- app/code/Magento/Catalog/etc/module.xml | 2 - app/code/Magento/Catalog/i18n/de_DE.csv | 10 - app/code/Magento/Catalog/i18n/en_US.csv | 10 - app/code/Magento/Catalog/i18n/es_ES.csv | 10 - app/code/Magento/Catalog/i18n/fr_FR.csv | 10 - app/code/Magento/Catalog/i18n/nl_NL.csv | 10 - app/code/Magento/Catalog/i18n/pt_BR.csv | 10 - app/code/Magento/Catalog/i18n/zh_CN.csv | 10 - ...tall-1.6.0.0.php => install-1.6.0.0.0.php} | 0 ....1.php => upgrade-1.6.0.0.0-1.6.0.0.1.php} | 0 ....php => upgrade-1.6.0.0.18-1.6.0.0.23.php} | 0 ....php => upgrade-1.6.0.0.24-1.6.0.0.25.php} | 0 ....php => upgrade-1.6.0.0.25-1.6.0.0.26.php} | 0 .../frontend/product/view/attribute.phtml | 1 - .../view/frontend/product/view/form.phtml | 1 - .../Model/Config/Backend/Managestock.php | 4 +- .../CatalogInventory/Model/Indexer/Stock.php | 4 +- .../Model/Quote/Item/QuantityValidator.php | 4 +- .../QuantityValidator/Initializer/Option.php | 4 +- .../Initializer/StockItem.php | 2 +- .../Model/Resource/Indexer/Stock.php | 4 +- .../Resource/Indexer/Stock/DefaultStock.php | 4 +- .../Resource/Indexer/Stock/StockInterface.php | 2 +- .../CatalogInventory/Model/Resource/Stock.php | 2 +- .../Model/Resource/Stock/Item.php | 2 +- .../Model/Resource/Stock/Item/Collection.php | 10 +- .../Model/Resource/Stock/Status.php | 2 +- .../Magento/CatalogInventory/Model/Stock.php | 14 +- .../CatalogInventory/Model/Stock/Item.php | 8 +- .../CatalogInventory/Model/Stock/Status.php | 6 +- .../System/Config/Backend/Minsaleqty.php | 4 +- .../System/Config/Backend/Qtyincrements.php | 2 +- .../Controller/Adminhtml/Promo/Catalog.php | 2 +- app/code/Magento/CatalogRule/Model/Flag.php | 2 +- .../Model/Resource/Grid/Collection.php | 2 +- .../CatalogRule/Model/Resource/Rule.php | 4 +- .../Model/Resource/Rule/Product/Price.php | 2 +- .../Rule/Product/Price/Collection.php | 2 +- app/code/Magento/CatalogRule/Model/Rule.php | 14 +- .../Magento/CatalogRule/Model/Rule/Job.php | 2 +- .../CatalogRule/Model/Rule/Product/Price.php | 2 +- .../CatalogSearch/Block/Advanced/Result.php | 2 +- .../CatalogSearch/Controller/Advanced.php | 4 +- .../Magento/CatalogSearch/Model/Advanced.php | 4 +- .../Model/Config/Backend/Search/Type.php | 2 +- .../Magento/CatalogSearch/Model/Fulltext.php | 4 +- .../CatalogSearch/Model/Indexer/Fulltext.php | 2 +- .../Magento/CatalogSearch/Model/Query.php | 4 +- .../CatalogSearch/Model/Resource/Advanced.php | 2 +- .../Model/Resource/Advanced/Collection.php | 2 +- .../Model/Resource/EngineInterface.php | 2 +- .../CatalogSearch/Model/Resource/Fulltext.php | 2 +- .../Model/Resource/Fulltext/Engine.php | 2 +- .../Model/Resource/Indexer/Fulltext.php | 2 +- .../CatalogSearch/Model/Resource/Query.php | 18 +- .../Model/Resource/Query/Collection.php | 6 +- .../Controller/Adminhtml/Centinel/Index.php | 2 +- app/code/Magento/Centinel/Model/Service.php | 8 +- app/code/Magento/Checkout/Block/Cart.php | 4 +- .../Magento/Checkout/Block/Cart/Crosssell.php | 22 +- .../Controller/Adminhtml/Agreement.php | 4 +- app/code/Magento/Checkout/Controller/Cart.php | 18 +- .../Magento/Checkout/Controller/Onepage.php | 6 +- app/code/Magento/Checkout/Helper/Data.php | 16 +- app/code/Magento/Checkout/Model/Agreement.php | 2 +- app/code/Magento/Checkout/Model/Cart.php | 24 +- app/code/Magento/Checkout/Model/Observer.php | 4 +- .../Checkout/Model/Resource/Agreement.php | 16 +- .../Model/Resource/Agreement/Collection.php | 2 +- .../Magento/Checkout/Model/Resource/Cart.php | 2 +- .../Checkout/Model/Type/AbstractType.php | 7 +- .../Magento/Checkout/Model/Type/Onepage.php | 6 +- app/code/Magento/Checkout/etc/module.xml | 1 - .../Magento/Cms/Controller/Adminhtml/Page.php | 2 +- .../Magento/Cms/Helper/Wysiwyg/Images.php | 4 +- app/code/Magento/Cms/Model/Block.php | 8 +- app/code/Magento/Cms/Model/Page.php | 2 +- .../Magento/Cms/Model/Page/Urlrewrite.php | 2 +- app/code/Magento/Cms/Model/Resource/Block.php | 30 +- .../Cms/Model/Resource/Block/Collection.php | 2 +- app/code/Magento/Cms/Model/Resource/Page.php | 42 +- .../Cms/Model/Resource/Page/Collection.php | 6 +- .../Cms/Model/Resource/Page/Service.php | 2 +- .../Cms/Model/Resource/Page/Urlrewrite.php | 2 +- .../Cms/Model/Wysiwyg/Images/Storage.php | 22 +- .../Block/Product/View/Type/Configurable.php | 42 +- .../Model/Attribute/LockValidator.php | 8 +- .../Model/Product/Type/Configurable.php | 4 +- .../Product/Type/Configurable/Attribute.php | 2 +- .../Resource/Product/Type/Configurable.php | 2 +- .../Product/Type/Configurable/Attribute.php | 2 +- .../Configurable/Attribute/Collection.php | 2 +- .../ConfigurableProduct/etc/module.xml | 2 - .../Controller/Adminhtml/Extension/Custom.php | 6 +- app/code/Magento/Connect/Model/Extension.php | 4 +- .../Magento/Contacts/Controller/Index.php | 18 +- app/code/Magento/Core/App/Media.php | 4 +- app/code/Magento/Core/Controller/Ajax.php | 43 -- app/code/Magento/Core/Helper/Data.php | 6 +- app/code/Magento/Core/Helper/File/Media.php | 6 +- app/code/Magento/Core/Helper/File/Storage.php | 2 +- app/code/Magento/Core/Helper/Js.php | 42 +- app/code/Magento/Core/Helper/Url/Rewrite.php | 10 +- app/code/Magento/Core/Model/App.php | 479 --------------- app/code/Magento/Core/Model/App/Area.php | 21 +- app/code/Magento/Core/Model/App/Emulation.php | 51 +- app/code/Magento/Core/Model/Config/Value.php | 6 +- app/code/Magento/Core/Model/Design.php | 3 +- .../Core/Model/Design/Backend/Exceptions.php | 12 +- .../Core/Model/Design/Backend/Theme.php | 4 +- app/code/Magento/Core/Model/Factory.php | 6 +- app/code/Magento/Core/Model/File/Storage.php | 6 +- .../Core/Model/File/Storage/Database.php | 10 +- .../Storage/Database/AbstractDatabase.php | 27 +- .../Model/File/Storage/Directory/Database.php | 14 +- .../Magento/Core/Model/File/Storage/File.php | 6 +- .../Magento/Core/Model/File/Storage/Flag.php | 2 +- app/code/Magento/Core/Model/Layout.php | 8 +- app/code/Magento/Core/Model/Layout/Link.php | 2 +- app/code/Magento/Core/Model/Layout/Update.php | 8 +- app/code/Magento/Core/Model/Observer.php | 2 +- .../Magento/Core/Model/Resource/Cache.php | 2 +- .../Magento/Core/Model/Resource/Config.php | 2 +- .../Core/Model/Resource/Config/Data.php | 10 +- .../Model/Resource/Config/Data/Collection.php | 2 +- .../Config/Value/Collection/Scoped.php | 2 +- .../Magento/Core/Model/Resource/Design.php | 12 +- .../Core/Model/Resource/Design/Collection.php | 6 +- .../Resource/File/Storage/AbstractStorage.php | 2 +- .../Model/Resource/File/Storage/Database.php | 6 +- .../Core/Model/Resource/File/Storage/File.php | 8 +- .../Magento/Core/Model/Resource/Helper.php | 324 ---------- .../Core/Model/Resource/HelperPool.php | 78 --- .../Core/Model/Resource/Layout/Link.php | 2 +- .../Model/Resource/Layout/Link/Collection.php | 6 +- .../Core/Model/Resource/Layout/Update.php | 6 +- .../Resource/Layout/Update/Collection.php | 6 +- .../Magento/Core/Model/Resource/Resource.php | 2 +- .../Magento/Core/Model/Resource/Setup.php | 25 +- .../Magento/Core/Model/Resource/Store.php | 16 +- .../Core/Model/Resource/Store/Collection.php | 2 +- .../Core/Model/Resource/Store/Group.php | 10 +- .../Model/Resource/Store/Group/Collection.php | 2 +- .../Magento/Core/Model/Resource/Theme.php | 2 +- .../Core/Model/Resource/Theme/Collection.php | 2 +- .../Resource/Theme/Customization/Update.php | 2 +- .../Model/Resource/Theme/Data/Collection.php} | 19 +- .../Core/Model/Resource/Theme/File.php | 2 +- .../Model/Resource/Theme/File/Collection.php | 2 +- .../Core/Model/Resource/Url/Rewrite.php | 2 +- .../Model/Resource/Url/Rewrite/Collection.php | 6 +- .../Magento/Core/Model/Resource/Variable.php | 8 +- .../Model/Resource/Variable/Collection.php | 2 +- .../Magento/Core/Model/Resource/Website.php | 18 +- .../Model/Resource/Website/Collection.php | 2 +- app/code/Magento/Core/Model/Store.php | 15 +- .../Magento/Core/Model/Store/Exception.php | 3 +- app/code/Magento/Core/Model/Store/Group.php | 7 +- .../Core/Model/Store/ListInterface.php | 4 +- .../Magento/Core/Model/Store/Storage/Db.php | 2 +- .../Model/Store/Storage/DefaultStorage.php | 4 +- app/code/Magento/Core/Model/StoreManager.php | 16 +- app/code/Magento/Core/Model/Template.php | 2 +- app/code/Magento/Core/Model/Theme.php | 5 +- .../Model/Theme/Data/Collection.php} | 13 +- app/code/Magento/Core/Model/Theme/File.php | 6 +- .../Magento/Core/Model/Theme/Observer.php | 2 +- .../Magento/Core/Model/Theme/Registration.php | 14 +- app/code/Magento/Core/Model/Url/Rewrite.php | 21 +- .../Magento/Core/Model/Validator/Factory.php | 19 +- app/code/Magento/Core/Model/Variable.php | 2 +- app/code/Magento/Core/Model/Website.php | 33 +- app/code/Magento/Core/etc/cache.xml | 4 - app/code/Magento/Core/etc/config.xml | 7 - app/code/Magento/Core/etc/di.xml | 47 +- .../core_setup/upgrade-1.6.0.15-1.6.0.16.php | 84 --- .../Core/view/frontend/js/require-cookie.js | 10 +- .../Cron/Plugin/ApplicationInitializer.php | 17 +- app/code/Magento/Cron/Exception.php | 2 +- .../Model/Config/Backend/Product/Alert.php | 4 +- .../Cron/Model/Config/Backend/Sitemap.php | 4 +- app/code/Magento/Cron/Model/Observer.php | 18 +- .../Magento/Cron/Model/Resource/Schedule.php | 2 +- .../Model/Resource/Schedule/Collection.php | 2 +- app/code/Magento/Cron/Model/Schedule.php | 6 +- .../Controller/Adminhtml/System/Currency.php | 4 +- .../Block/Account/Dashboard/Sidebar.php | 2 +- .../Block/Adminhtml/Grid/Filter/Country.php | 4 +- .../Adminhtml/Cart/Product/Composite/Cart.php | 8 +- .../Customer/Controller/Adminhtml/Index.php | 6 +- .../Wishlist/Product/Composite/Wishlist.php | 2 +- app/code/Magento/Customer/Exception.php | 2 +- app/code/Magento/Customer/Helper/Data.php | 2 +- app/code/Magento/Customer/Model/Address.php | 4 +- .../Model/Address/AbstractAddress.php | 6 +- .../Model/Config/Backend/Address/Street.php | 6 +- .../Model/Config/Backend/Show/Customer.php | 6 +- .../Magento/Customer/Model/Config/Share.php | 8 +- app/code/Magento/Customer/Model/Converter.php | 11 + app/code/Magento/Customer/Model/Customer.php | 19 +- .../Customer/Attribute/Backend/Password.php | 2 +- app/code/Magento/Customer/Model/Group.php | 18 +- .../Model/Metadata/Form/AbstractData.php | 6 +- app/code/Magento/Customer/Model/Observer.php | 23 - .../Customer/Model/Resource/Customer.php | 6 +- .../Magento/Customer/Model/Resource/Group.php | 14 +- .../Model/Resource/Group/Collection.php | 2 +- .../Service/V1/CustomerAccountService.php | 81 ++- app/code/Magento/Customer/etc/di.xml | 7 + .../Form/Element/BackgroundUploader.php | 8 +- .../Adminhtml/Editor/Form/Element/Column.php | 8 +- .../Element/Composite/AbstractComposite.php | 6 +- .../Editor/Tools/QuickStyles/AbstractTab.php | 4 +- .../Adminhtml/System/Design/Editor.php | 2 +- .../Adminhtml/System/Design/Editor/Tools.php | 2 +- app/code/Magento/DesignEditor/Helper/Data.php | 74 +-- .../Editor/Tools/Controls/Configuration.php | 4 +- .../QuickStyles/Form/Renderer/Factory.php | 4 +- .../Tools/QuickStyles/ImageUploader.php | 2 +- .../Magento/DesignEditor/Model/Observer.php | 15 - app/code/Magento/DesignEditor/Model/State.php | 16 +- .../DesignEditor/Model/Theme/Change.php | 2 +- .../DesignEditor/Model/Theme/Context.php | 2 +- .../Model/Theme/Resource/Change.php | 6 +- .../Translate/{InlineVde.php => Inline.php} | 139 +++-- .../Model/Translate/Inline/Provider.php | 78 +++ app/code/Magento/DesignEditor/etc/di.xml | 11 + .../Magento/DesignEditor/etc/vde/events.xml | 3 - app/code/Magento/Dhl/Model/Carrier.php | 38 +- app/code/Magento/Directory/Exception.php | 2 +- app/code/Magento/Directory/Model/Country.php | 6 +- .../Directory/Model/Country/Format.php | 2 +- app/code/Magento/Directory/Model/Currency.php | 6 +- .../Model/Currency/DefaultLocator.php | 23 +- app/code/Magento/Directory/Model/Observer.php | 23 +- app/code/Magento/Directory/Model/Region.php | 2 +- .../Directory/Model/Resource/Country.php | 6 +- .../Model/Resource/Country/Collection.php | 6 +- .../Model/Resource/Country/Format.php | 2 +- .../Resource/Country/Format/Collection.php | 2 +- .../Directory/Model/Resource/Currency.php | 6 +- .../Directory/Model/Resource/Region.php | 8 +- .../Model/Resource/Region/Collection.php | 6 +- .../Block/Catalog/Product/Links.php | 60 +- .../Adminhtml/Downloadable/Product/Edit.php | 2 +- .../Downloadable/Controller/Download.php | 2 +- .../Magento/Downloadable/Helper/Download.php | 2 +- app/code/Magento/Downloadable/Helper/File.php | 4 +- app/code/Magento/Downloadable/Model/Link.php | 6 +- .../Downloadable/Model/Link/Purchased.php | 2 +- .../Model/Link/Purchased/Item.php | 2 +- .../Downloadable/Model/Product/Type.php | 4 +- .../Downloadable/Model/Resource/Link.php | 17 +- .../Model/Resource/Link/Collection.php | 2 +- .../Model/Resource/Link/Purchased.php | 2 +- .../Resource/Link/Purchased/Collection.php | 2 +- .../Model/Resource/Link/Purchased/Item.php | 2 +- .../Link/Purchased/Item/Collection.php | 2 +- .../Downloadable/Model/Resource/Sample.php | 2 +- .../Model/Resource/Sample/Collection.php | 2 +- .../Sales/Order/Pdf/Items/AbstractItems.php | 4 +- .../Sales/Order/Pdf/Items/Creditmemo.php | 4 +- .../Model/Sales/Order/Pdf/Items/Invoice.php | 4 +- .../Magento/Downloadable/Model/Sample.php | 6 +- app/code/Magento/Eav/Exception.php | 2 +- app/code/Magento/Eav/Helper/Data.php | 4 +- .../Eav/Model/Attribute/Data/AbstractData.php | 10 +- .../Eav/Model/AttributeDataFactory.php | 4 +- app/code/Magento/Eav/Model/Config.php | 26 +- .../Eav/Model/Entity/AbstractEntity.php | 6 +- .../Magento/Eav/Model/Entity/Attribute.php | 4 +- .../Entity/Attribute/AbstractAttribute.php | 11 +- .../Eav/Model/Entity/Attribute/Group.php | 2 +- .../Eav/Model/Entity/Attribute/Option.php | 2 +- .../Eav/Model/Entity/Attribute/Set.php | 8 +- .../Entity/Collection/AbstractCollection.php | 6 +- app/code/Magento/Eav/Model/Entity/Setup.php | 4 +- app/code/Magento/Eav/Model/Entity/Store.php | 2 +- app/code/Magento/Eav/Model/Entity/Type.php | 8 +- app/code/Magento/Eav/Model/Form.php | 22 +- app/code/Magento/Eav/Model/Form/Element.php | 8 +- app/code/Magento/Eav/Model/Form/Fieldset.php | 10 +- app/code/Magento/Eav/Model/Form/Type.php | 6 +- .../Magento/Eav/Model/Resource/Attribute.php | 2 +- .../Model/Resource/Attribute/Collection.php | 4 +- .../Magento/Eav/Model/Resource/Config.php | 2 +- .../Eav/Model/Resource/Entity/Attribute.php | 19 +- .../Resource/Entity/Attribute/Collection.php | 4 +- .../Entity/Attribute/Grid/Collection.php | 6 +- .../Model/Resource/Entity/Attribute/Group.php | 16 +- .../Entity/Attribute/Group/Collection.php | 2 +- .../Resource/Entity/Attribute/Option.php | 2 +- .../Entity/Attribute/Option/Collection.php | 6 +- .../Model/Resource/Entity/Attribute/Set.php | 6 +- .../Entity/Attribute/Set/Collection.php | 2 +- .../Eav/Model/Resource/Entity/Store.php | 4 +- .../Eav/Model/Resource/Entity/Type.php | 4 +- .../Model/Resource/Entity/Type/Collection.php | 2 +- .../Eav/Model/Resource/Form/Attribute.php | 2 +- .../Resource/Form/Attribute/Collection.php | 12 +- .../Eav/Model/Resource/Form/Element.php | 2 +- .../Resource/Form/Element/Collection.php | 2 +- .../Eav/Model/Resource/Form/Fieldset.php | 4 +- .../Resource/Form/Fieldset/Collection.php | 6 +- .../Magento/Eav/Model/Resource/Form/Type.php | 6 +- .../Model/Resource/Form/Type/Collection.php | 2 +- .../Magento/Eav/Model/Resource/Helper.php | 2 +- .../Eav/Model/Validator/Attribute/Backend.php | 8 +- .../Eav/Model/Validator/Attribute/Data.php | 7 +- .../Controller/Adminhtml/Email/Template.php | 2 +- .../Magento/Email/Model/Resource/Template.php | 4 +- .../Model/Resource/Template/Collection.php | 2 +- app/code/Magento/Email/Model/Template.php | 2 +- .../Magento/GiftMessage/Model/Message.php | 2 +- .../GiftMessage/Model/Resource/Message.php | 2 +- .../Model/Resource/Message/Collection.php | 2 +- .../Magento/GiftMessage/Model/TypeFactory.php | 4 +- .../Config/Backend/AbstractConversion.php | 4 +- .../Magento/GoogleOptimizer/Helper/Code.php | 6 +- .../Magento/GoogleOptimizer/Model/Code.php | 2 +- .../GoogleOptimizer/Model/Resource/Code.php | 2 +- .../Adminhtml/Googleshopping/Items.php | 4 +- .../GoogleShopping/Model/Attribute.php | 2 +- .../Model/Attribute/DefaultAttribute.php | 2 +- .../GoogleShopping/Model/Attribute/Tax.php | 2 +- .../Magento/GoogleShopping/Model/Flag.php | 2 +- .../Magento/GoogleShopping/Model/Item.php | 8 +- .../GoogleShopping/Model/MassOperations.php | 2 +- .../Model/Resource/Attribute.php | 2 +- .../Model/Resource/Attribute/Collection.php | 2 +- .../GoogleShopping/Model/Resource/Item.php | 2 +- .../Model/Resource/Item/Collection.php | 12 +- .../GoogleShopping/Model/Resource/Type.php | 2 +- .../Model/Resource/Type/Collection.php | 2 +- .../Magento/GoogleShopping/Model/Service.php | 6 +- .../Magento/GoogleShopping/Model/Type.php | 2 +- app/code/Magento/GoogleShopping/etc/di.xml | 2 +- .../Product/Composite/Fieldset/Grouped.php | 54 +- .../Magento/GroupedProduct/etc/module.xml | 1 - .../Block/Adminhtml/Form/After.php | 2 +- .../Controller/Adminhtml/Export.php | 2 +- .../Magento/ImportExport/Model/Export.php | 36 +- .../Model/Export/AbstractEntity.php | 6 +- .../Model/Export/Adapter/AbstractAdapter.php | 8 +- .../ImportExport/Model/Export/Adapter/Csv.php | 2 +- .../Model/Export/Entity/AbstractEav.php | 4 +- .../Model/Export/Entity/AbstractEntity.php | 4 +- .../Model/Export/Entity/Product.php | 8 +- .../Magento/ImportExport/Model/Import.php | 28 +- .../Model/Import/AbstractEntity.php | 12 +- .../ImportExport/Model/Import/Adapter.php | 8 +- .../Model/Import/Entity/AbstractEntity.php | 16 +- .../Model/Import/Entity/Product.php | 12 +- .../Model/Import/Entity/Product/Option.php | 4 +- .../Entity/Product/Type/AbstractType.php | 4 +- .../ImportExport/Model/Import/Uploader.php | 4 +- .../ImportExport/Model/Resource/Helper.php | 4 +- .../Model/Resource/Import/Data.php | 6 +- app/code/Magento/Index/App/Indexer.php | 4 +- app/code/Magento/Index/App/Shell.php | 4 +- .../Index/Controller/Adminhtml/Process.php | 8 +- app/code/Magento/Index/Model/Event.php | 6 +- .../Index/Model/Indexer/AbstractIndexer.php | 2 +- app/code/Magento/Index/Model/Process.php | 18 +- .../Index/Model/Resource/AbstractResource.php | 2 +- .../Magento/Index/Model/Resource/Event.php | 4 +- .../Index/Model/Resource/Event/Collection.php | 2 +- .../Magento/Index/Model/Resource/Process.php | 2 +- .../Model/Resource/Process/Collection.php | 2 +- app/code/Magento/Index/Model/Shell.php | 4 +- app/code/Magento/Indexer/App/Indexer.php | 2 +- app/code/Magento/Indexer/App/Shell.php | 2 +- .../Indexer/Controller/Adminhtml/Indexer.php | 4 +- .../Magento/Indexer/Model/Indexer/State.php | 2 +- .../Model/Mview/View/State.php | 12 +- .../Indexer/Model/Resource/Indexer/State.php | 2 +- .../Resource/Indexer/State/Collection.php | 2 +- .../Model/Resource/Mview/View/State.php | 4 +- .../Resource/Mview/View/State/Collection.php | 6 +- app/code/Magento/Indexer/Model/Shell.php | 4 +- app/code/Magento/Indexer/etc/di.xml | 7 + app/code/Magento/Indexer/etc/module.xml | 4 - .../sql/indexer_setup/install-1.0.0.0.php | 56 ++ .../Install/App/Action/Plugin/Design.php | 14 +- app/code/Magento/Install/App/Console.php | 2 +- .../Magento/Install/Controller/Wizard.php | 2 +- app/code/Magento/Install/Model/Installer.php | 19 +- .../Install/Model/Installer/Config.php | 4 +- .../Install/Model/Installer/Console.php | 2 +- .../Magento/Install/Model/Installer/Db.php | 20 +- .../Install/Model/Installer/Db/AbstractDb.php | 6 +- .../Magento/Install/view/install/config.phtml | 2 +- .../Magento/Install/view/install/page.phtml | 2 +- .../Controller/Adminhtml/Integration.php | 6 +- app/code/Magento/Integration/Exception.php | 2 +- .../Magento/Integration/Model/Integration.php | 6 +- .../Integration/Model/Oauth/Consumer.php | 14 +- .../Magento/Integration/Model/Oauth/Nonce.php | 6 +- .../Magento/Integration/Model/Oauth/Token.php | 6 +- .../Model/Resource/Integration.php | 2 +- .../Model/Resource/Integration/Collection.php | 2 +- .../Model/Resource/Oauth/Consumer.php | 10 +- .../Resource/Oauth/Consumer/Collection.php | 2 +- .../Model/Resource/Oauth/Nonce.php | 2 +- .../Model/Resource/Oauth/Nonce/Collection.php | 2 +- .../Model/Resource/Oauth/Token.php | 8 +- .../Model/Resource/Oauth/Token/Collection.php | 2 +- .../Magento/Integration/Service/OauthV1.php | 8 +- .../Integration/Service/OauthV1Interface.php | 8 +- app/code/Magento/Log/App/Shell.php | 4 +- app/code/Magento/Log/Model/Aggregation.php | 6 +- app/code/Magento/Log/Model/Cron.php | 29 +- app/code/Magento/Log/Model/Customer.php | 18 +- app/code/Magento/Log/Model/Log.php | 6 +- .../Log/Model/Resource/Aggregation.php | 2 +- .../Magento/Log/Model/Resource/Customer.php | 2 +- .../Magento/Log/Model/Resource/Helper.php | 2 +- app/code/Magento/Log/Model/Resource/Log.php | 2 +- app/code/Magento/Log/Model/Resource/Shell.php | 17 +- .../Magento/Log/Model/Resource/Visitor.php | 20 +- .../Log/Model/Resource/Visitor/Collection.php | 4 +- .../Log/Model/Resource/Visitor/Online.php | 2 +- .../Resource/Visitor/Online/Collection.php | 48 +- .../Visitor/Online/Grid/Collection.php | 10 +- app/code/Magento/Log/Model/Visitor.php | 38 +- app/code/Magento/Log/Model/Visitor/Online.php | 6 +- app/code/Magento/Log/etc/module.xml | 1 + .../Multishipping/Controller/Checkout.php | 6 +- .../Model/Checkout/Type/Multishipping.php | 24 +- .../Subscriber/Grid/Filter/Website.php | 4 +- .../Newsletter/Controller/Adminhtml/Queue.php | 6 +- .../Controller/Adminhtml/Template.php | 4 +- .../Newsletter/Controller/Subscriber.php | 12 +- app/code/Magento/Newsletter/Model/Problem.php | 6 +- .../Model/Resource/Grid/Collection.php | 2 +- .../Newsletter/Model/Resource/Problem.php | 2 +- .../Model/Resource/Problem/Collection.php | 6 +- .../Newsletter/Model/Resource/Queue.php | 10 +- .../Model/Resource/Queue/Collection.php | 6 +- .../Newsletter/Model/Resource/Subscriber.php | 6 +- .../Model/Resource/Subscriber/Collection.php | 6 +- .../Newsletter/Model/Resource/Template.php | 10 +- .../Model/Resource/Template/Collection.php | 2 +- .../Magento/Newsletter/Model/Subscriber.php | 50 +- .../Magento/Newsletter/Model/Template.php | 4 +- .../Model/Config/Backend/Tablerate.php | 6 +- .../Model/Resource/Carrier/Tablerate.php | 14 +- .../Resource/Carrier/Tablerate/Collection.php | 2 +- app/code/Magento/Ogone/Controller/Api.php | 6 +- .../Model/System/Config/Backend/Ttl.php | 6 +- .../Model/System/Config/Backend/Varnish.php | 6 +- .../PayPalRecurringPayment/Model/Api/Nvp.php | 10 +- .../PayPalRecurringPayment/Model/Express.php | 4 +- .../PayPalRecurringPayment/Model/Ipn.php | 4 +- .../PayPalRecurringPayment/etc/module.xml | 1 - app/code/Magento/Payment/Block/Form.php | 4 +- app/code/Magento/Payment/Block/Info.php | 4 +- .../Model/Checks/SpecificationFactory.php | 2 +- app/code/Magento/Payment/Model/Info.php | 14 +- .../Magento/Payment/Model/Info/Exception.php | 2 +- .../Payment/Model/Method/AbstractMethod.php | 40 +- app/code/Magento/Payment/Model/Method/Cc.php | 4 +- .../Magento/Payment/Model/Method/Factory.php | 4 +- app/code/Magento/Paypal/Block/Iframe.php | 4 +- .../Paypal/Block/Payflow/Advanced/Iframe.php | 20 + .../Adminhtml/Billing/Agreement.php | 4 +- .../Controller/Adminhtml/Paypal/Reports.php | 6 +- .../Paypal/Controller/Billing/Agreement.php | 6 +- .../Controller/Express/AbstractExpress.php | 32 +- app/code/Magento/Paypal/Exception.php | 2 +- app/code/Magento/Paypal/Model/Api/Nvp.php | 12 +- .../Magento/Paypal/Model/Api/PayflowNvp.php | 4 +- .../Model/Billing/AbstractAgreement.php | 12 +- .../Paypal/Model/Billing/Agreement.php | 8 +- app/code/Magento/Paypal/Model/Cert.php | 10 +- app/code/Magento/Paypal/Model/Direct.php | 2 +- app/code/Magento/Paypal/Model/Express.php | 4 +- .../Magento/Paypal/Model/Express/Checkout.php | 8 +- app/code/Magento/Paypal/Model/Hostedpro.php | 4 +- app/code/Magento/Paypal/Model/Ipn.php | 8 +- .../Magento/Paypal/Model/Method/Agreement.php | 4 +- app/code/Magento/Paypal/Model/Payflow/Pro.php | 4 +- app/code/Magento/Paypal/Model/Payflowlink.php | 22 +- app/code/Magento/Paypal/Model/Payflowpro.php | 4 +- .../Paypal/Model/Payment/Transaction.php | 20 +- app/code/Magento/Paypal/Model/Pro.php | 8 +- .../Paypal/Model/Report/Settlement.php | 12 +- .../Paypal/Model/Report/Settlement/Row.php | 2 +- .../Model/Resource/Billing/Agreement.php | 2 +- .../Resource/Billing/Agreement/Collection.php | 6 +- .../Magento/Paypal/Model/Resource/Cert.php | 8 +- .../Model/Resource/Payment/Transaction.php | 8 +- .../Payment/Transaction/Collection.php | 2 +- .../Model/Resource/Report/Settlement.php | 6 +- .../Model/Resource/Report/Settlement/Row.php | 2 +- .../Report/Settlement/Row/Collection.php | 2 +- .../Model/System/Config/Backend/Cert.php | 8 +- .../Model/System/Config/Backend/Cron.php | 4 +- .../System/Config/Backend/MerchantCountry.php | 4 +- .../paypal_payflowadvanced_cancelpayment.xml | 2 +- .../layout/paypal_payflowadvanced_form.xml | 2 +- .../paypal_payflowadvanced_returnurl.xml | 2 +- .../Persistent/Model/Persistent/Config.php | 8 +- .../Persistent/Model/Resource/Session.php | 2 +- app/code/Magento/Persistent/Model/Session.php | 6 +- app/code/Magento/ProductAlert/Helper/Data.php | 4 +- app/code/Magento/ProductAlert/Model/Email.php | 6 +- .../Magento/ProductAlert/Model/Observer.php | 22 +- app/code/Magento/ProductAlert/Model/Price.php | 6 +- .../Model/Resource/AbstractResource.php | 14 +- .../ProductAlert/Model/Resource/Price.php | 4 +- .../Model/Resource/Price/Collection.php | 2 +- .../ProductAlert/Model/Resource/Stock.php | 4 +- .../Model/Resource/Stock/Collection.php | 2 +- app/code/Magento/ProductAlert/Model/Stock.php | 6 +- app/code/Magento/Rating/Model/Rating.php | 6 +- .../Magento/Rating/Model/Rating/Entity.php | 2 +- .../Magento/Rating/Model/Rating/Option.php | 2 +- .../Rating/Model/Rating/Option/Vote.php | 2 +- .../Magento/Rating/Model/Resource/Rating.php | 14 +- .../Model/Resource/Rating/Collection.php | 6 +- .../Rating/Model/Resource/Rating/Entity.php | 2 +- .../Model/Resource/Rating/Grid/Collection.php | 4 +- .../Rating/Model/Resource/Rating/Option.php | 2 +- .../Resource/Rating/Option/Collection.php | 2 +- .../Model/Resource/Rating/Option/Vote.php | 2 +- .../Rating/Option/Vote/Collection.php | 6 +- .../Block/Adminhtml/Payment/View/Items.php | 2 +- .../Controller/Adminhtml/RecurringPayment.php | 4 +- .../Controller/RecurringPayment.php | 15 +- .../Model/ManagerInterface.php | 2 +- .../Observer/CheckoutManagerObserver.php | 4 +- .../RecurringPayment/Model/Payment.php | 8 +- .../Model/RecurringPayment.php | 22 +- .../Model/Resource/Order/CollectionFilter.php | 2 +- .../Model/Resource/Payment/Collection.php | 2 +- .../Grid/Column/Renderer/Customer.php | 2 +- .../Grid/Column/Renderer/Product.php | 2 +- .../Reports/Block/Product/AbstractProduct.php | 38 +- .../Adminhtml/Report/Statistics.php | 4 +- app/code/Magento/Reports/Model/Event.php | 6 +- app/code/Magento/Reports/Model/Event/Type.php | 2 +- app/code/Magento/Reports/Model/Flag.php | 2 +- .../Reports/Model/Grouped/Collection.php | 4 +- .../Model/Product/Index/AbstractIndex.php | 6 +- .../Reports/Model/Product/Index/Compared.php | 8 +- .../Reports/Model/Product/Index/Viewed.php | 4 +- .../Magento/Reports/Model/Resource/Event.php | 2 +- .../Model/Resource/Event/Collection.php | 2 +- .../Reports/Model/Resource/Event/Type.php | 2 +- .../Model/Resource/Event/Type/Collection.php | 2 +- .../Magento/Reports/Model/Resource/Helper.php | 2 +- .../Model/Resource/HelperInterface.php | 2 +- .../Model/Resource/Order/Collection.php | 10 +- .../Resource/Product/Index/AbstractIndex.php | 23 +- .../Resource/Product/Lowstock/Collection.php | 2 +- .../Model/Resource/Quote/Collection.php | 4 +- .../Model/Resource/Report/AbstractReport.php | 2 +- .../Model/Resource/Report/Collection.php | 2 +- .../Report/Collection/AbstractCollection.php | 2 +- .../Resource/Report/Collection/Factory.php | 2 +- .../Model/Resource/Report/Product/Viewed.php | 17 +- .../Report/Product/Viewed/Collection.php | 2 +- .../Resource/Review/Customer/Collection.php | 4 +- .../Model/Resource/Wishlist/Collection.php | 6 +- app/code/Magento/Reports/etc/di.xml | 5 + app/code/Magento/Reports/etc/module.xml | 2 - .../reports_report_review_customer_grid.xml | 2 +- .../reports_report_review_product_grid.xml | 2 +- .../Magento/Review/Block/Adminhtml/Add.php | 6 +- .../Review/Block/Adminhtml/Add/Form.php | 2 +- .../Magento/Review/Block/Adminhtml/Edit.php | 6 +- .../Review/Block/Adminhtml/Edit/Form.php | 27 +- .../Magento/Review/Block/Adminhtml/Grid.php | 6 +- .../Magento/Review/Block/Adminhtml/Main.php | 14 +- .../Block/Adminhtml/Product/Edit/Tab.php} | 26 +- .../Adminhtml/Product/Edit/Tab/Reviews.php | 18 +- .../Review/Block/Adminhtml/Product/Grid.php | 4 +- .../Magento/Review/Block/Customer/View.php | 36 +- app/code/Magento/Review/Block/Form.php | 2 +- .../ReviewRenderer.php} | 44 +- .../Magento/Review/Block/Product/View.php | 36 +- app/code/Magento/Review/Block/View.php | 36 +- .../Controller/Adminhtml/Product.php} | 40 +- .../Controller/Adminhtml/Product/Reviews.php} | 38 +- .../Magento/Review/Controller/Product.php | 2 +- .../Magento/Review/Helper/Action/Pager.php | 2 +- .../Magento/Review/Model/Resource/Review.php | 4 +- .../Model/Resource/Review/Collection.php | 6 +- .../Review/Model/Resource/Review/Status.php | 2 +- .../Resource/Review/Status/Collection.php | 2 +- .../Review/Model/Resource/Review/Summary.php | 4 +- app/code/Magento/Review/Model/Review.php | 9 +- .../Magento/Review/Model/Review/Status.php | 6 +- .../Magento/Review/Model/Review/Summary.php | 2 +- .../Magento/Review/etc/adminhtml/menu.xml | 2 +- .../etc/adminhtml/routes.xml} | 10 +- app/code/Magento/Review/etc/di.xml | 35 ++ app/code/Magento/Review/etc/module.xml | 2 - app/code/Magento/Review/i18n/de_DE.csv | 10 + app/code/Magento/Review/i18n/en_US.csv | 10 + app/code/Magento/Review/i18n/es_ES.csv | 10 + app/code/Magento/Review/i18n/fr_FR.csv | 10 + app/code/Magento/Review/i18n/nl_NL.csv | 10 + app/code/Magento/Review/i18n/pt_BR.csv | 10 + app/code/Magento/Review/i18n/zh_CN.csv | 10 + .../adminhtml/layout/catalog_product_new.xml | 43 ++ .../adminhtml/layout/review_product_edit.xml} | 2 +- .../adminhtml/layout/review_product_new.xml} | 0 .../layout/review_product_reviews_grid.xml} | 2 +- .../Magento/Rss/Block/Catalog/NewCatalog.php | 6 +- .../Magento/Rss/Block/Catalog/NotifyStock.php | 6 +- app/code/Magento/Rss/Block/Catalog/Review.php | 8 +- .../Magento/Rss/Block/Catalog/Special.php | 6 +- app/code/Magento/Rss/Block/Order/NewOrder.php | 6 +- app/code/Magento/Rss/Block/Wishlist.php | 89 +-- app/code/Magento/Rss/Controller/Index.php | 85 +-- app/code/Magento/Rss/Helper/WishlistRss.php | 158 +++++ .../Rss/Model/System/Config/Backend/Links.php | 4 +- app/code/Magento/Rss/etc/di.xml | 37 ++ app/code/Magento/Rss/etc/module.xml | 3 - app/code/Magento/Rule/Block/Editable.php | 21 +- app/code/Magento/Rule/Model/AbstractModel.php | 8 +- .../Rule/Model/Resource/AbstractResource.php | 10 +- .../Rule/Collection/AbstractCollection.php | 6 +- app/code/Magento/Rule/Model/Rule.php | 4 +- .../Block/Adminhtml/Items/AbstractItems.php | 4 +- .../Block/Adminhtml/Order/AbstractOrder.php | 4 +- .../Block/Adminhtml/Order/Comments/View.php | 4 +- .../Sales/Block/Adminhtml/Order/Payment.php | 4 +- .../Sales/Block/Adminhtml/Order/Totalbar.php | 4 +- .../Sales/Block/Adminhtml/Order/View/Info.php | 2 +- .../Block/Adminhtml/Order/View/Items.php | 4 +- .../Sales/Block/Adminhtml/Order/View/Tabs.php | 4 +- .../Magento/Sales/Block/Order/Comments.php | 4 +- .../Sales/Controller/AbstractController.php | 2 +- .../Sales/Controller/Adminhtml/Order.php | 25 +- .../Controller/Adminhtml/Order/Create.php | 8 +- .../Controller/Adminhtml/Order/Creditmemo.php | 18 +- .../Sales/Controller/Adminhtml/Order/Edit.php | 2 +- .../Controller/Adminhtml/Order/Invoice.php | 6 +- .../Controller/Adminhtml/Order/Status.php | 6 +- .../Adminhtml/Order/View/Giftmessage.php | 2 +- .../Controller/Adminhtml/Transactions.php | 2 +- app/code/Magento/Sales/Helper/Admin.php | 4 +- .../Magento/Sales/Model/AbstractModel.php | 6 +- .../Magento/Sales/Model/AdminOrder/Create.php | 48 +- .../Magento/Sales/Model/Config/Ordered.php | 49 +- .../Model/Config/Source/Order/Status.php | 19 +- .../Sales/Model/ConverterInterface.php | 8 +- app/code/Magento/Sales/Model/Order.php | 25 +- .../Magento/Sales/Model/Order/Address.php | 4 +- .../Magento/Sales/Model/Order/Creditmemo.php | 9 +- .../Sales/Model/Order/Creditmemo/Comment.php | 4 +- .../Sales/Model/Order/Creditmemo/Item.php | 10 +- .../Model/Order/Creditmemo/Total/Shipping.php | 4 +- .../Magento/Sales/Model/Order/Invoice.php | 11 +- .../Sales/Model/Order/Invoice/Comment.php | 4 +- .../Sales/Model/Order/Invoice/Item.php | 10 +- app/code/Magento/Sales/Model/Order/Item.php | 6 +- .../Magento/Sales/Model/Order/Payment.php | 12 +- .../Sales/Model/Order/Payment/Transaction.php | 44 +- .../Sales/Model/Order/Pdf/AbstractPdf.php | 32 +- .../Sales/Model/Order/Pdf/Creditmemo.php | 4 +- .../Magento/Sales/Model/Order/Pdf/Invoice.php | 6 +- .../Model/Order/Pdf/Items/AbstractItems.php | 34 +- .../Items/Creditmemo/DefaultCreditmemo.php | 4 +- .../Pdf/Items/Invoice/DefaultInvoice.php | 4 +- .../Pdf/Items/Shipment/DefaultShipment.php | 4 +- .../Sales/Model/Order/Pdf/Shipment.php | 6 +- .../Sales/Model/Order/Pdf/Total/Factory.php | 4 +- .../Magento/Sales/Model/Order/Shipment.php | 17 +- .../Sales/Model/Order/Shipment/Comment.php | 4 +- .../Sales/Model/Order/Shipment/Item.php | 10 +- .../Sales/Model/Order/Shipment/Track.php | 4 +- app/code/Magento/Sales/Model/Order/Status.php | 6 +- .../Sales/Model/Order/Status/History.php | 4 +- app/code/Magento/Sales/Model/Order/Tax.php | 2 +- .../Sales/Model/Order/Total/Config/Base.php | 4 +- .../Sales/Model/Payment/Method/Converter.php | 12 +- app/code/Magento/Sales/Model/Quote.php | 22 +- .../Magento/Sales/Model/Quote/Address.php | 4 +- .../Address/AbstractCarrierInterface.php | 2 +- .../Sales/Model/Quote/Address/Rate.php | 2 +- .../Quote/Address/Total/AbstractTotal.php | 4 +- .../Model/Quote/Address/Total/Collector.php | 6 +- app/code/Magento/Sales/Model/Quote/Item.php | 12 +- .../Sales/Model/Quote/Item/AbstractItem.php | 10 +- .../Magento/Sales/Model/Quote/Item/Option.php | 2 +- .../Magento/Sales/Model/Quote/Payment.php | 10 +- .../Sales/Model/Resource/AbstractResource.php | 18 +- .../Collection/AbstractCollection.php | 6 +- .../Magento/Sales/Model/Resource/Helper.php | 2 +- .../Model/Resource/Order/AbstractOrder.php | 26 +- .../Sales/Model/Resource/Order/Address.php | 6 +- .../Sales/Model/Resource/Order/Collection.php | 10 +- .../Comment/Collection/AbstractCollection.php | 4 +- .../Resource/Order/Payment/Collection.php | 4 +- .../Resource/Order/Payment/Transaction.php | 6 +- .../Sales/Model/Resource/Order/Status.php | 14 +- .../Resource/Order/Status/Collection.php | 2 +- .../Sales/Model/Resource/Order/Tax.php | 2 +- .../Model/Resource/Order/Tax/Collection.php | 2 +- .../Magento/Sales/Model/Resource/Quote.php | 2 +- .../Resource/Quote/Address/Collection.php | 2 +- .../Quote/Address/Item/Collection.php | 2 +- .../Quote/Address/Rate/Collection.php | 6 +- .../Sales/Model/Resource/Quote/Collection.php | 2 +- .../Model/Resource/Quote/Item/Collection.php | 6 +- .../Model/Resource/Quote/Item/Option.php | 2 +- .../Resource/Quote/Item/Option/Collection.php | 2 +- .../Resource/Quote/Payment/Collection.php | 6 +- .../Magento/Sales/Model/Resource/Report.php | 2 +- .../Magento/Sales/Model/Service/Quote.php | 20 +- app/code/Magento/Sales/etc/di.xml | 10 + .../Controller/Adminhtml/Promo/Quote.php | 8 +- app/code/Magento/SalesRule/Model/Coupon.php | 2 +- .../SalesRule/Model/Coupon/Massgenerator.php | 10 +- .../SalesRule/Model/Resource/Coupon.php | 4 +- .../Model/Resource/Coupon/Collection.php | 2 +- .../SalesRule/Model/Resource/Coupon/Usage.php | 4 +- .../Magento/SalesRule/Model/Resource/Rule.php | 2 +- .../Model/Resource/Rule/Collection.php | 4 +- .../Model/Resource/Rule/Customer.php | 2 +- .../Resource/Rule/Customer/Collection.php | 2 +- app/code/Magento/SalesRule/Model/Rule.php | 10 +- .../Magento/SalesRule/Model/Rule/Customer.php | 2 +- .../Magento/SalesRule/Model/Validator.php | 10 +- .../Magento/Sendfriend/Controller/Product.php | 2 +- .../Sendfriend/Model/Resource/Sendfriend.php | 2 +- .../Model/Resource/Sendfriend/Collection.php | 2 +- .../Magento/Sendfriend/Model/Sendfriend.php | 44 +- app/code/Magento/Service/Exception.php | 2 +- app/code/Magento/Service/etc/module.xml | 9 +- .../Controller/Adminhtml/Order/Shipment.php | 30 +- .../Model/Carrier/AbstractCarrier.php | 2 +- .../Model/Carrier/AbstractCarrierOnline.php | 2 +- .../Shipping/Model/Order/Pdf/Packaging.php | 6 +- .../Magento/Shipping/Model/Order/Track.php | 4 +- .../Shipping/Model/Shipping/Labels.php | 6 +- .../Sitemap/Controller/Adminhtml/Sitemap.php | 2 +- app/code/Magento/Sitemap/Model/Observer.php | 21 +- .../Model/Resource/Catalog/Category.php | 2 +- .../Model/Resource/Catalog/Product.php | 2 +- .../Sitemap/Model/Resource/Cms/Page.php | 2 +- .../Sitemap/Model/Resource/Sitemap.php | 2 +- .../Model/Resource/Sitemap/Collection.php | 2 +- app/code/Magento/Sitemap/Model/Sitemap.php | 24 +- .../Magento/Tax/Controller/Adminhtml/Rate.php | 10 +- .../Magento/Tax/Controller/Adminhtml/Rule.php | 4 +- .../Magento/Tax/Controller/Adminhtml/Tax.php | 12 +- app/code/Magento/Tax/Exception.php | 2 +- app/code/Magento/Tax/Model/Calculation.php | 2 +- .../Magento/Tax/Model/Calculation/Rate.php | 22 +- .../Tax/Model/Calculation/Rate/Title.php | 2 +- .../Magento/Tax/Model/Calculation/Rule.php | 6 +- app/code/Magento/Tax/Model/ClassModel.php | 14 +- .../Tax/Model/Config/Price/IncludePrice.php | 31 +- .../Tax/Model/Rate/CsvImportHandler.php | 12 +- .../Tax/Model/Resource/Calculation.php | 2 +- .../Model/Resource/Calculation/Collection.php | 2 +- .../Tax/Model/Resource/Calculation/Rate.php | 2 +- .../Resource/Calculation/Rate/Collection.php | 14 +- .../Model/Resource/Calculation/Rate/Title.php | 2 +- .../Calculation/Rate/Title/Collection.php | 2 +- .../Tax/Model/Resource/Calculation/Rule.php | 2 +- .../Resource/Calculation/Rule/Collection.php | 6 +- .../Tax/Model/Resource/Sales/Order/Tax.php | 2 +- .../Resource/Sales/Order/Tax/Collection.php | 2 +- .../Model/Resource/Sales/Order/Tax/Item.php | 2 +- .../Sales/Order/Tax/Item/Collection.php | 2 +- .../Magento/Tax/Model/Resource/TaxClass.php | 2 +- .../Model/Resource/TaxClass/Collection.php | 2 +- .../Magento/Tax/Model/Sales/Order/Tax.php | 2 +- .../Tax/Model/Sales/Order/Tax/Item.php | 2 +- .../Tax/Model/TaxClass/AbstractType.php | 2 +- .../Magento/Tax/Model/TaxClass/Factory.php | 4 +- .../Tax/Model/TaxClass/Type/Customer.php | 2 +- .../Tax/Model/TaxClass/Type/Product.php | 2 +- .../Tax/Model/TaxClass/Type/TypeInterface.php | 4 +- .../Adminhtml/System/Design/Theme.php | 19 +- .../Adminhtml/System/Design/Wysiwyg/Files.php | 2 +- .../Magento/Theme/Model/Uploader/Service.php | 8 +- .../Magento/Theme/Model/Wysiwyg/Storage.php | 18 +- .../Theme/view/frontend/html/bugreport.phtml | 2 +- .../Theme/view/frontend/html/footer.phtml | 2 +- .../Controller/Ajax.php} | 56 +- .../Model}/Inline/Config.php | 19 +- .../Model}/Inline/Parser.php | 35 +- .../Model/Resource}/String.php | 65 +- .../Model/Resource/Translate.php | 47 +- .../Model}/String.php | 22 +- .../data-upgrade-1.0.0.0-1.0.0.1.php | 27 +- .../Magento/Translation/etc/adminhtml/di.xml | 47 ++ .../Translation/etc/adminhtml/routes.xml | 32 + app/code/Magento/Translation/etc/cache.xml | 31 + app/code/Magento/Translation/etc/config.xml | 38 ++ app/code/Magento/Translation/etc/di.xml | 66 ++ .../Translation/etc/frontend/routes.xml | 32 + app/code/Magento/Translation/etc/module.xml | 36 ++ .../sql/translation_setup/install-1.0.0.0.php | 110 ++++ .../view/adminhtml/translate_inline.phtml | 0 .../view/frontend/translate_inline.phtml | 0 .../User/Controller/Adminhtml/Auth.php | 10 +- .../User/Controller/Adminhtml/User.php | 2 +- .../User/Controller/Adminhtml/User/Role.php | 2 +- .../Model/Resource/Permissions/Collection.php | 2 +- app/code/Magento/User/Model/Resource/Role.php | 14 +- .../User/Model/Resource/Role/Collection.php | 2 +- .../Model/Resource/Role/User/Collection.php | 2 +- .../Magento/User/Model/Resource/Rules.php | 6 +- .../User/Model/Resource/Rules/Collection.php | 2 +- app/code/Magento/User/Model/Resource/User.php | 46 +- .../User/Model/Resource/User/Collection.php | 2 +- .../Model/Resource/User/Locked/Collection.php | 2 +- app/code/Magento/User/Model/Role.php | 2 +- app/code/Magento/User/Model/Rules.php | 2 +- app/code/Magento/User/Model/User.php | 16 +- .../Webapi/Controller/ErrorProcessor.php | 63 +- app/code/Magento/Webapi/Controller/Rest.php | 28 +- .../Rest/Request/Deserializer/Json.php | 22 +- .../Rest/Request/Deserializer/Xml.php | 16 +- .../Webapi/Controller/Rest/Response.php | 14 +- app/code/Magento/Webapi/Controller/Soap.php | 33 +- app/code/Magento/Webapi/Model/Soap/Fault.php | 26 +- .../Magento/Webapi/etc/webapi_rest/di.xml | 1 + .../Magento/Webapi/etc/webapi_soap/di.xml | 1 + .../Weee/Model/Attribute/Backend/Weee/Tax.php | 2 +- app/code/Magento/Weee/Model/Observer.php | 10 +- .../Resource/Attribute/Backend/Weee/Tax.php | 2 +- app/code/Magento/Weee/Model/Resource/Tax.php | 2 +- app/code/Magento/Weee/Model/Tax.php | 2 +- .../Widget/Block/Adminhtml/Widget/Options.php | 4 +- .../Widget/Controller/Adminhtml/Widget.php | 2 +- .../Magento/Widget/Model/Resource/Widget.php | 2 +- .../Widget/Model/Resource/Widget/Instance.php | 4 +- .../Resource/Widget/Instance/Collection.php | 2 +- .../Magento/Widget/Model/Widget/Instance.php | 6 +- .../Magento/Wishlist/Block/AbstractBlock.php | 36 +- .../Wishlist/Block/Customer/Sidebar.php | 8 +- .../Wishlist/Block/Customer/Wishlist.php | 36 +- .../Block/Customer/Wishlist/Item/Options.php | 36 +- .../Magento/Wishlist/Block/Share/Wishlist.php | 36 +- .../Controller/AbstractController.php | 2 +- .../Magento/Wishlist/Controller/Index.php | 43 +- .../Magento/Wishlist/Controller/Shared.php | 2 +- app/code/Magento/Wishlist/Helper/Data.php | 2 +- app/code/Magento/Wishlist/Model/Item.php | 28 +- .../Magento/Wishlist/Model/Item/Option.php | 2 +- app/code/Magento/Wishlist/Model/Observer.php | 10 +- .../Magento/Wishlist/Model/Resource/Item.php | 2 +- .../Model/Resource/Item/Collection.php | 2 +- .../Wishlist/Model/Resource/Item/Option.php | 2 +- .../Model/Resource/Item/Option/Collection.php | 2 +- .../Wishlist/Model/Resource/Wishlist.php | 4 +- .../Model/Resource/Wishlist/Collection.php | 2 +- app/code/Magento/Wishlist/Model/Wishlist.php | 20 +- .../adminhtml/magento_backend/css/admin.css | 60 +- app/etc/di.xml | 32 +- app/etc/local.xml.template | 2 +- dev/shell/indexer.php | 6 +- dev/shell/log.php | 7 +- dev/shell/newindexer.php | 6 +- .../framework/Magento/TestFramework/App.php | 40 -- .../Magento/TestFramework/Application.php | 19 +- .../TestFramework/Db/ConnectionAdapter.php | 2 +- .../Magento/TestFramework/Entity.php | 8 +- .../TestFramework/Helper/Bootstrap.php | 10 + .../TestCase/AbstractController.php | 4 +- .../testsuite/Magento/Test/EntityTest.php | 4 +- dev/tests/integration/phpunit.xml.dist | 12 +- .../Backend/Block/System/Config/FormTest.php | 24 +- .../Block/Widget/Grid/MassactionTest.php | 18 +- .../Backend/Block/_files/backend_theme.php | 17 +- .../Backend/Controller/Adminhtml/AuthTest.php | 4 +- .../Magento/Backend/Model/AuthTest.php | 12 +- .../Model/Config/Backend/BaseurlTest.php | 2 +- .../Config/Backend/Image/AdapterTest.php | 2 +- .../Magento/Backend/Model/MenuTest.php | 19 +- .../Magento/Backend/Model/ObserverTest.php | 8 +- .../Tab/Bundle/Option/Search/GridTest.php | 7 +- .../Magento/Captcha/_files/dummy_user.php | 7 +- .../Magento/Catalog/Block/Product/NewTest.php | 2 +- .../Product/ProductList/CrosssellTest.php | 12 +- .../Block/Product/ProductList/RelatedTest.php | 12 +- .../Catalog/Block/Product/SendTest.php | 72 +++ .../Adminhtml/Product/AttributeTest.php | 16 +- .../Adminhtml/Product/ReviewTest.php | 2 +- .../Controller/Product/CompareTest.php | 75 +++ .../Catalog/Helper/Product/CompositeTest.php | 93 +++ .../Catalog/Helper/Product/PriceTest.php | 65 ++ .../Catalog/Helper/Product/ViewTest.php | 4 +- .../Catalog/Model/CategoryTreeTest.php | 4 +- .../Indexer/Product/Flat/Action/RowTest.php | 11 +- .../Catalog/Model/Layer/CategoryTest.php | 4 +- .../Catalog/Model/Layer/Filter/ItemTest.php | 2 +- .../Attribute/Backend/TierpriceTest.php | 4 +- .../Model/Product/Compare/ListCompareTest.php | 88 +++ .../Model/Product/Type/AbstractTest.php | 2 +- .../Magento/Catalog/Model/ProductTest.php | 20 +- .../Model/Resource/Product/CollectionTest.php | 19 + .../Model/Resource/_files/product_simple.php | 67 ++ .../Magento/Catalog/Model/UrlTest.php | 2 +- .../Magento/Catalog/_files/product_simple.php | 249 ++++---- .../Checkout/Block/Cart/Item/RendererTest.php | 14 +- .../Magento/Cms/Controller/RouterTest.php | 2 +- .../Cms/Model/Wysiwyg/Images/StorageTest.php | 10 +- .../testsuite/Magento/Core/Helper/JsTest.php | 7 +- .../Magento/Core/Helper/Url/RewriteTest.php | 4 +- .../Magento/Core/Model/App/AreaTest.php | 7 +- .../Magento/Core/Model/App/EmulationTest.php | 15 +- .../testsuite/Magento/Core/Model/AppTest.php | 155 ----- .../Magento/Core/Model/Config/DataTest.php | 7 +- .../Model/Design/Backend/ExceptionsTest.php | 2 +- .../Magento/Core/Model/DesignTest.php | 16 +- .../Magento/Core/Model/LayoutTest.php | 4 +- .../Magento/Core/Model/ObserverTest.php | 4 +- .../Core/Model/Resource/HelperTest.php | 4 +- .../Model/Resource/Store/CollectionTest.php | 12 +- .../Core/Model/Resource/TransactionTest.php | 7 +- .../Magento/Core/Model/StoreTest.php | 5 +- .../Core/Model/Theme/RegistrationTest.php | 29 +- .../Magento/Core/Model/View/DesignTest.php | 14 +- .../images/preview_image.jpg | Bin 0 -> 11420 bytes .../frontend/magento_default_iphone/theme.xml | 2 +- .../Core/Model/_files/design/themes.php | 21 +- .../Magento/Core/_files/layout_update.php | 9 +- .../Magento/Core/_files/media_for_change.php | 9 +- .../Magento/Cron/Model/ObserverTest.php | 14 +- .../Service/V1/CustomerAccountServiceTest.php | 2 +- .../Magento/Customer/_files/quote.php | 7 +- .../Data/Argument/Interpreter/StringTest.php | 4 +- .../{InlineVdeTest.php => InlineTest.php} | 8 +- .../Model/_files/design/themes.php | 12 +- .../Block/Catalog/Product/LinksTest.php | 176 ++++++ .../Attribute/Edit/Main/AbstractTest.php | 17 +- .../Email/Model/Template/FilterTest.php | 12 +- .../Magento/Email/Model/TemplateTest.php | 28 +- .../Magento/Email/Model/_files/themes.php | 16 +- .../GiftMessage/Block/Message/InlineTest.php | 12 +- .../Model/_files/flag_expired.php | 7 +- .../Block/Adminhtml/Export/FilterTest.php | 17 +- .../Model/Export/EntityAbstractTest.php | 2 +- .../Magento/ImportExport/Model/ExportTest.php | 2 +- .../Import/Entity/CustomerCompositeTest.php | 16 +- .../Entity/Eav/Customer/AddressTest.php | 9 +- .../Import/Entity/Eav/CustomerImportTest.php | 7 +- .../Magento/ImportExport/Model/ImportTest.php | 6 +- .../Model/Resource/Import/DataTest.php | 2 +- .../testsuite/Magento/Less/_files/themes.php | 2 + .../Visitor/Online/CollectionTest.php | 66 ++ .../Magento/Log/_files/visitor_online.php | 32 +- .../Model/Resource/Db/AbstractTest.php | 12 +- .../Resource/Db/Collection/AbstractTest.php | 27 +- .../Model/Resource/Db/ProfilerTest.php | 14 +- .../Model/Resource/Entity/TableTest.php | 10 +- .../Model/Resource/IteratorTest.php | 20 +- .../Magento/{Core => }/Model/ResourceTest.php | 13 +- .../Block/Checkout/OverviewTest.php | 22 +- .../Magento/Newsletter/Model/QueueTest.php | 10 +- .../Outbound/Authentication/FactoryTest.php | 60 -- .../Outbound/Formatter/FactoryTest.php | 56 -- .../Magento/Outbound/Formatter/JsonTest.php | 74 --- .../Outbound/Formatter/JsonTest/Data.php | 47 -- .../Model/System/Config/Backend/TtlTest.php | 2 +- .../Paypal/_files/quote_payment_express.php | 18 +- .../Paypal/_files/quote_payment_payflow.php | 10 +- .../Paypal/_files/quote_payment_standard.php | 10 +- .../ProductAlert/Block/Email/StockTest.php | 11 +- .../testsuite/Magento/PubSub/EventTest.php | 53 -- .../Reports/_files/viewed_products.php | 9 +- .../Review/Block/Adminhtml/Edit/FormTest.php | 54 ++ .../Review/Block/Adminhtml/MainTest.php | 53 ++ .../Magento/Review/Block/FormTest.php | 52 ++ .../Magento/Review/_files/customer_review.php | 59 ++ .../Magento/Rss/Block/WishlistTest.php | 108 ++++ .../Magento/Rss/Controller/CatalogTest.php | 27 +- .../Magento/Rss/Helper/WishlistRssTest.php | 129 ++++ .../Order/Create/Form/AbstractTest.php | 7 +- .../Report/Filter/Form/CouponTest.php | 15 +- .../Sales/Block/Order/CommentsTest.php | 2 +- .../Controller/Adminhtml/Order/CreateTest.php | 24 + .../Sales/Model/AdminOrder/CreateTest.php | 2 +- .../Sales/Model/Order/CreditmemoTest.php | 10 +- .../Magento/Sales/Model/Order/InvoiceTest.php | 10 +- .../Magento/Sales/Model/Order/OrderTest.php | 10 +- .../Magento/Sales/_files/invoice.php | 5 +- .../_files/invoice_fixture_store_order.php | 5 +- .../Sales/_files/invoice_payflowpro.php | 5 +- .../Magento/Sales/_files/order_info.php | 18 +- .../Sales/_files/order_paid_with_saved_cc.php | 5 +- .../testsuite/Magento/Sales/_files/quote.php | 2 +- .../Block/Adminhtml/Rate/ImportExportTest.php | 14 +- .../testsuite/Magento/Tax/Model/ClassTest.php | 8 +- .../Tax/Model/Rate/CsvImportHandlerTest.php | 2 +- .../Calculation/Rule/CollectionTest.php | 2 +- .../Tax/Model/TaxClass/Type/CustomerTest.php | 2 +- .../Modular/BlockInstantiationTest.php | 16 +- .../Integrity/Modular/LayoutFilesTest.php | 2 +- .../Integrity/Modular/TemplateFilesTest.php | 9 +- .../Test/Integrity/Modular/ViewFilesTest.php | 21 +- .../Magento/Translate/InlineTest.php | 10 +- .../_files/_inline_page_expected.html | 2 +- .../testsuite/Magento/TranslateTest.php | 66 +- .../Controller/AjaxTest.php | 14 +- .../Model}/InlineParserTest.php | 15 +- .../Model}/StringTest.php | 12 +- .../_files/db_translate.php | 4 +- .../_files/db_translate_admin_store.php | 11 +- .../integration/testsuite/Magento/UrlTest.php | 5 +- .../testsuite/Magento/User/Model/UserTest.php | 16 +- .../Magento/User/_files/dummy_user.php | 15 +- .../View/Design/Theme/ValidatorTest.php | 2 +- .../Magento/View/PublicationTest.php | 12 +- .../Magento/View/_files/design/themes.php | 17 +- .../Magento/Widget/Model/WidgetTest.php | 7 +- .../Magento/Widget/_files/themes.php | 9 +- .../Magento/Wishlist/Block/AbstractTest.php | 31 +- .../Magento/Wishlist/_files/wishlist.php | 2 +- .../wishlist_with_product_qty_increments.php | 2 +- .../Magento/TestFramework/Application.php | 9 - dev/tests/performance/testsuite/home_page.jmx | 9 +- .../Integrity/Library/_files/blacklist.txt | 1 - .../Integrity/_files/classes/blacklist.txt | 6 +- .../_files/dependency_test/tables_ce.php | 1 + .../Test/Legacy/_files/obsolete_classes.php | 65 +- .../Test/Legacy/_files/obsolete_constants.php | 11 +- .../Test/Legacy/_files/obsolete_methods.php | 85 +-- .../Legacy/_files/obsolete_properties.php | 35 +- .../Test/Php/_files/blacklist/common.txt | 3 - .../Php/_files/phpcs/blacklist/common.txt | 8 +- .../Magento/Test/Block/Adminhtml.php | 56 +- .../TestFramework/Helper/ObjectManager.php | 4 +- .../Helper/ObjectManagerTest.php | 6 +- .../Model/NotificationServiceTest.php | 2 +- .../testsuite/Magento/App/AreaListTest.php | 26 +- .../Magento/App/EntryPoint/EntryPointTest.php | 4 +- .../Router/NoRouteHandlerTest.php | 27 +- .../Magento/Backend/Block/Widget/GridTest.php | 14 +- .../Magento/Backend/Model/AuthTest.php | 31 +- .../Model/Config/Backend/BaseurlTest.php | 15 +- .../Model/Config/Backend/EncryptedTest.php | 2 +- .../Model/Config/Backend/SecureTest.php | 12 +- .../Config/Structure/Element/GroupTest.php | 2 +- .../Magento/Backend/Model/ConfigTest.php | 11 +- .../Translate/Inline/ConfigFactoryTest.php | 44 -- .../Magento/Backend/Model/TranslateTest.php | 82 --- .../Indexer/Product/Flat/Action/RowTest.php | 2 +- .../Indexer/Product/Flat/Action/RowsTest.php | 2 +- .../Indexer/Product/Flat/ProcessorTest.php | 22 +- .../Product/Price/Plugin/CatalogRuleTest.php | 131 ++++ .../Price/Plugin/CustomerGroupTest.php | 10 +- .../Model/Layer/Filter/FactoryTest.php | 2 +- .../Model/Product/Option/Type/FactoryTest.php | 2 +- .../Magento/Catalog/Model/ProductTest.php | 17 +- .../Model/Resource/Eav/AttributeTest.php | 30 +- .../Product/Option/CollectionTest.php | 135 +++++ .../Model/Resource/Product/Option/Stub.php | 2 +- .../Resource/Product/Option/ValueStub.php | 4 +- .../Model/Template/Filter/FactoryTest.php | 2 +- .../Model/Adminhtml/Stock/ItemTest.php | 2 +- .../Initializer/OptionTest.php | 2 +- .../Magento/Checkout/Helper/DataTest.php | 8 +- .../Model/Config/Source/Cart/SummaryTest.php} | 38 +- .../Magento/Checkout/Model/ObserverTest.php | 95 +++ .../Checkout/Model/Type/AbstractTypeTest.php | 156 +++++ .../Cms/Model/Wysiwyg/Images/StorageTest.php | 4 +- .../Magento/Config/Converter/Dom/FlatTest.php | 33 +- .../Magento/Config/Converter/DomTest.php | 50 ++ .../unit/testsuite/Magento/Config/DomTest.php | 13 + .../Magento/Config/Reader/FilesystemTest.php | 16 + .../testsuite/Magento/Config/ScopeTest.php | 54 +- .../testsuite/Magento/Config/ThemeTest.php | 46 ++ .../_files/area/default_default/theme.xml | 5 +- .../Config/_files/area/default_test/theme.xml | 5 +- .../Config/_files/area/test_default/theme.xml | 5 +- .../_files/converter/dom/attributes.php | 70 +++ .../_files/converter/dom/attributes.xml | 37 ++ .../Config/_files/converter/dom/cdata.php} | 30 +- .../Config/_files/converter/dom/cdata.xml} | 12 +- .../converter/dom/flat/source_notuniq.xml | 41 ++ .../converter/dom/flat/source_wrongarray.xml | 43 ++ .../Controller/Router/Route/FactoryTest.php | 104 ++++ .../Magento/Convert/ConvertArrayTest.php | 17 +- .../testsuite/Magento/Convert/ExcelTest.php | 16 +- .../testsuite/Magento/Convert/ObjectTest.php | 145 +++++ .../testsuite/Magento/Convert/XmlTest.php | 22 +- .../Magento/Convert/_files/output.txt | 2 +- .../Magento/Core/Model/DesignLoaderTest.php | 34 +- .../File/Storage/Directory/DatabaseTest.php | 30 +- .../Magento/Core/Model/LayoutTest.php | 2 +- .../Core/Model/Resource/Db/AbstractTest.php | 6 +- .../Resource/Layout/AbstractTestCase.php | 4 +- .../Magento/Core/Model/StoreManagerTest.php | 2 +- .../Plugin/ApplicationInitializerTest.php | 11 +- .../Magento/Cron/Model/ObserverTest.php | 136 ++--- .../Controller/Adminhtml/IndexTest.php | 4 +- .../Model/Layout/DepersonalizePluginTest.php | 2 +- .../Model/Metadata/Form/AbstractDataTest.php | 2 +- .../Service/V1/CustomerAccountServiceTest.php | 156 ++++- .../Magento/Data/Collection/DbTest.php | 338 +++++++++-- .../Magento/DesignEditor/Helper/DataTest.php | 9 - .../Magento/DesignEditor/Model/StateTest.php | 36 +- .../DesignEditor/Model/Theme/ContextTest.php | 8 +- .../Model/Translate/Inline/ProviderTest.php | 84 +++ .../Model/Url/NavigationModeTest.php | 1 - .../Magento/Dhl/Model/CarrierTest.php | 2 +- .../Model/Currency/DefaultLocatorTest.php | 27 +- .../Model/Resource/Country/CollectionTest.php | 3 +- .../Downloadable/Helper/DownloadTest.php | 6 +- .../testsuite/Magento/Eav/Helper/DataTest.php | 79 +++ .../Magento/Eav/Model/Entity/TypeTest.php | 2 +- .../Attribute/Option/CollectionTest.php | 9 +- .../Model/Resource/Entity/AttributeTest.php | 18 +- .../Model/Validator/Attribute/DataTest.php | 2 +- .../testsuite/Magento/Event/ManagerStub.php | 4 +- .../Composite/Fieldset/GroupedTest.php | 18 + .../Model/Export/Entity/AbstractEavTest.php | 4 +- .../Entity/Eav/Customer/AddressTest.php | 4 +- .../Model/Export/Entity/Eav/CustomerTest.php | 4 +- .../Model/Import/Entity/AbstractTest.php | 6 +- .../Import/Entity/CustomerCompositeTest.php | 9 +- .../Model/Import/Entity/EavAbstractTest.php | 2 +- .../Model/Import/EntityAbstractTest.php | 8 +- .../Magento/Index/Model/ProcessTest.php | 2 +- .../Install/Model/Installer/Db/Mysql4Test.php | 6 +- .../Controller/Adminhtml/IntegrationTest.php | 11 +- .../{Core => }/Model/AbstractModelTest.php | 39 +- .../ActionValidator/RemoveActionTest.php | 77 +++ .../Magento/Mview/Config/Data/ProxyTest.php | 130 ++++ .../Translate/Inline => Mview}/ConfigTest.php | 57 +- .../Magento/Mview/View/ChangelogTest.php | 120 +++- .../Magento/Mview/View/CollectionTest.php | 43 +- .../Mview/View/SubscriptionFactoryTest.php | 55 ++ .../Magento/Mview/View/SubscriptionTest.php | 293 +++++++++ .../unit/testsuite/Magento/Mview/ViewTest.php | 409 ++++++++++++- .../Magento/Mview/_files/mview_config.php | 9 +- .../Mapper/_files/mapped_simple_di_config.php | 2 +- .../Config/Mapper/_files/simple_di_config.xml | 2 +- .../Outbound/Authentication/FactoryTest.php | 111 ---- .../Outbound/Authentication/HmacTest.php | 115 ---- .../Outbound/Formatter/FactoryTest.php | 107 ---- .../Magento/Outbound/Formatter/JsonTest.php | 79 --- .../Outbound/Formatter/JsonTest/Data.php | 47 -- .../Magento/Outbound/Message/FactoryTest.php | 237 -------- .../Magento/Outbound/MessageTest.php | 47 -- .../Outbound/Transport/Http/ResponseTest.php | 72 --- .../Magento/Outbound/Transport/HttpTest.php | 124 ---- .../Payment/Model/Method/FactoryTest.php | 2 +- .../Magento/Paypal/Block/Express/FormTest.php | 4 +- .../Paypal/Block/Payflow/Link/IframeTest.php | 66 ++ .../Paypal/Block/PayflowExpress/FormTest.php | 8 +- .../Magento/Paypal/Model/ObserverTest.php | 4 +- .../Magento/Persistent/Model/SessionTest.php | 41 +- .../Magento/Phrase/Renderer/CompositeTest.php | 35 +- .../Magento/Phrase/Renderer/InlineTest.php | 91 +++ .../Phrase/Renderer/PlaceholderTest.php | 2 +- .../Magento/Phrase/Renderer/TranslateTest.php | 36 +- .../unit/testsuite/Magento/PhraseTest.php | 15 +- .../Magento/PubSub/Event/FactoryTest.php | 37 -- .../Magento/PubSub/Event/QueueWriterTest.php | 38 -- .../testsuite/Magento/PubSub/EventTest.php | 53 -- .../PubSub/Message/DispatcherAsyncTest.php | 95 --- .../Review/Block/Adminhtml/MainTest.php | 74 +++ .../Review/Summary/CollectionTest.php | 146 +++++ .../Adminhtml/Order/CreditmemoTest.php | 2 +- .../Model/Config/Source/Order/StatusTest.php | 63 ++ .../Sales/Model/Order/Pdf/AbstractTest.php | 26 +- .../Sales/Model/Order/Pdf/InvoiceTest.php | 4 +- .../Model/Order/Pdf/Total/FactoryTest.php | 2 +- .../Model/Order/Total/Config/BaseTest.php | 156 +++++ .../Magento/Sitemap/Model/SitemapTest.php | 8 +- .../Tax/Model/TaxClass/FactoryTest.php | 2 +- .../Tax/Model/TaxClass/Type/CustomerTest.php | 2 +- .../Tax/Model/TaxClass/Type/ProductTest.php | 2 +- .../Tools/Di/Code/Scanner/XmlScannerTest.php | 2 +- .../app/code/Magento/SomeModule/etc/di.xml | 2 +- .../Adminhtml/System/Design/ThemeTest.php | 144 +++-- .../Theme/Model/Uploader/ServiceTest.php | 4 +- .../Theme/Model/Wysiwyg/StorageTest.php | 10 +- .../Translate/Inline/ConfigFactoryTest.php | 44 -- .../Magento/Translate/Inline/ProxyTest.php | 153 +++++ .../Magento/Translate/Inline/StateTest.php | 74 +++ .../Magento/Translate/InlineTest.php | 320 ++++++++++ .../Translation/Model/Inline/ConfigTest.php | 95 +++ .../Magento/Url/QueryParamsResolverTest.php | 84 +++ .../Url/RouteParamsResolverFactoryTest.php | 55 ++ .../testsuite/Magento/Url/ValidatorTest.php | 58 ++ dev/tests/unit/testsuite/Magento/UrlTest.php | 573 ++++++++++++++++-- .../Webapi/Controller/ErrorProcessorTest.php | 18 +- .../Rest/Request/Deserializer/JsonTest.php | 34 +- .../Rest/Request/Deserializer/XmlTest.php | 20 +- .../Webapi/Controller/Rest/ResponseTest.php | 15 +- .../Magento/Webapi/Controller/RestTest.php | 21 +- .../Magento/Webapi/Controller/SoapTest.php | 87 ++- .../Magento/Webapi/Model/Soap/FaultTest.php | 31 +- .../Magento/Webapi/Model/Soap/ServerTest.php | 3 - .../Wishlist/Block/Customer/SidebarTest.php | 34 +- .../app/Magento/Downloader/Controller.php | 1 - .../Magento/App/AreaInterface.php | 16 +- lib/Magento/App/AreaList.php | 37 +- lib/Magento/App/Cache/Frontend/Factory.php | 4 + lib/Magento/App/Cache/State.php | 7 +- lib/Magento/App/Cron.php | 2 +- lib/Magento/App/Helper/AbstractHelper.php | 8 +- lib/Magento/App/Helper/Context.php | 16 +- lib/Magento/App/Http.php | 2 +- lib/Magento/AppInterface.php | 157 +---- .../Convert/Container/AbstractContainer.php | 190 ------ lib/Magento/Convert/ConvertException.php | 112 ---- lib/Magento/Convert/Mapper/Column.php | 67 -- .../Convert/Mapper/MapperInterface.php | 43 -- lib/Magento/DB/Adapter/Pdo/Mysql.php | 8 +- lib/Magento/DB/ExpressionConverter.php | 104 ++++ lib/Magento/DB/Helper.php | 335 +++++++--- .../Magento/DB}/Helper/AbstractHelper.php | 15 +- .../Magento/DB}/Transaction.php | 15 +- lib/Magento/Data/Collection/Db.php | 29 +- lib/Magento/Filesystem/Driver/Http.php | 2 +- .../Core/Model => lib/Magento}/Flag.php | 32 +- .../Flag.php => lib/Magento/Flag/Resource.php | 12 +- .../InlineFactory.php => FlagFactory.php} | 37 +- lib/Magento/Json/Encoder.php | 5 +- lib/Magento/Locale/Lists.php | 8 - lib/Magento/Locale/Resolver.php | 16 +- .../Magento}/Model/AbstractModel.php | 69 +-- .../Model/ActionValidator/RemoveAction.php | 84 +++ .../ActionValidator/RemoveAction/Allowed.php | 42 ++ lib/Magento/Model/Context.php | 18 +- .../Core => lib/Magento/Model}/Exception.php | 11 +- .../Model/Resource/AbstractResource.php | 14 +- .../Magento}/Model/Resource/Db/AbstractDb.php | 78 ++- .../Db/Collection/AbstractCollection.php | 24 +- .../Magento}/Model/Resource/Db/Profiler.php | 8 +- .../Model/Resource/Entity/AbstractEntity.php | 4 +- .../Magento}/Model/Resource/Entity/Table.php | 6 +- .../Magento}/Model/Resource/Iterator.php | 14 +- .../Model/Resource/Type/AbstractType.php | 6 +- .../Magento}/Model/Resource/Type/Db.php | 8 +- .../Model/Resource/Type/Db/Pdo/Mysql.php | 4 +- .../Module/Declaration/Reader/Filesystem.php | 4 + lib/Magento/Mview/View/Subscription.php | 5 +- .../Outbound/Authentication/Factory.php | 75 --- lib/Magento/Outbound/Authentication/Hmac.php | 94 --- .../Outbound/AuthenticationInterface.php | 41 -- lib/Magento/Outbound/EndpointInterface.php | 78 --- lib/Magento/Outbound/Formatter/Factory.php | 75 --- lib/Magento/Outbound/Formatter/Json.php | 62 -- lib/Magento/Outbound/FormatterInterface.php | 49 -- lib/Magento/Outbound/Message.php | 108 ---- lib/Magento/Outbound/Message/Factory.php | 109 ---- .../Outbound/Message/FactoryInterface.php | 44 -- lib/Magento/Outbound/Transport/Http.php | 99 --- .../Outbound/Transport/Http/Response.php | 111 ---- lib/Magento/Outbound/TransportInterface.php | 39 -- lib/Magento/Outbound/UserInterface.php | 46 -- lib/Magento/Phrase.php | 2 +- lib/Magento/Phrase/Renderer/Composite.php | 13 +- lib/Magento/Phrase/Renderer/Inline.php | 78 +++ lib/Magento/Phrase/Renderer/Placeholder.php | 11 +- lib/Magento/Phrase/Renderer/Translate.php | 31 +- lib/Magento/Phrase/RendererInterface.php | 8 +- lib/Magento/PubSub/Event.php | 124 ---- lib/Magento/PubSub/Event/Factory.php | 43 -- lib/Magento/PubSub/Event/FactoryInterface.php | 40 -- lib/Magento/PubSub/Event/QueueHandler.php | 95 --- .../PubSub/Event/QueueReaderInterface.php | 38 -- .../PubSub/Event/QueueWriterInterface.php | 39 -- lib/Magento/PubSub/EventInterface.php | 89 --- lib/Magento/PubSub/Job/FactoryInterface.php | 40 -- lib/Magento/PubSub/Job/QueueHandler.php | 94 --- .../PubSub/Job/QueueReaderInterface.php | 38 -- .../PubSub/Job/QueueWriterInterface.php | 39 -- lib/Magento/PubSub/JobInterface.php | 99 --- .../PubSub/Message/DispatcherAsync.php | 63 -- .../Message/DispatcherAsyncInterface.php | 40 -- .../Subscription/CollectionInterface.php | 39 -- lib/Magento/PubSub/SubscriptionInterface.php | 87 --- lib/Magento/Translate.php | 351 ++--------- lib/Magento/Translate/Factory.php | 72 --- lib/Magento/Translate/Inline.php | 181 +++--- .../Translate/Inline/ConfigInterface.php | 4 +- .../Translate/Inline/ParserFactory.php | 13 +- .../Translate/Inline/ParserInterface.php | 4 +- .../{ConfigFactory.php => Provider.php} | 21 +- .../Inline/ProviderInterface.php} | 17 +- lib/Magento/Translate/Inline/Proxy.php | 160 +++++ lib/Magento/Translate/Inline/State.php | 102 ++++ .../Translate/Inline/StateInterface.php | 71 +++ lib/Magento/Translate/InlineInterface.php | 9 +- .../Translate/Locale/Resolver/Plugin.php | 3 +- lib/Magento/TranslateInterface.php | 44 +- lib/Magento/Url.php | 187 ++---- lib/Magento/Url/QueryParamsResolver.php | 14 +- .../Url/QueryParamsResolverInterface.php | 9 +- lib/Magento/Url/Validator.php | 2 - lib/Magento/UrlInterface.php | 11 +- lib/Magento/View/Context.php | 39 +- lib/Magento/View/Design/ThemeInterface.php | 2 - lib/Magento/View/DesignLoader.php | 16 +- lib/Magento/View/Element/AbstractBlock.php | 18 +- lib/Magento/View/Element/Context.php | 23 +- lib/Magento/View/Element/Template/Context.php | 10 +- pub/cron.php | 4 +- pub/get.php | 7 +- 1532 files changed, 14644 insertions(+), 13611 deletions(-) delete mode 100644 app/code/Magento/Backend/Model/Translate.php create mode 100644 app/code/Magento/Catalog/Block/Product/Context.php rename lib/Magento/Outbound/MessageInterface.php => app/code/Magento/Catalog/Block/Product/ReviewRenderer/DefaultProvider.php (61%) rename lib/Magento/PubSub/Event/QueueWriter.php => app/code/Magento/Catalog/Block/Product/ReviewRendererInterface.php (64%) mode change 100644 => 100755 app/code/Magento/Catalog/Helper/Product/Composite.php create mode 100644 app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.php mode change 100644 => 100755 app/code/Magento/Catalog/Model/Product/Type/Price.php rename app/code/Magento/Catalog/sql/catalog_setup/{install-1.6.0.0.php => install-1.6.0.0.0.php} (100%) rename app/code/Magento/Catalog/sql/catalog_setup/{upgrade-1.6.0.0-1.6.0.0.1.php => upgrade-1.6.0.0.0-1.6.0.0.1.php} (100%) rename app/code/Magento/Catalog/sql/catalog_setup/{upgrade-1.6.0.18-1.6.0.0.23.php => upgrade-1.6.0.0.18-1.6.0.0.23.php} (100%) rename app/code/Magento/Catalog/sql/catalog_setup/{upgrade-1.6.0.24-1.6.0.0.25.php => upgrade-1.6.0.0.24-1.6.0.0.25.php} (100%) rename app/code/Magento/Catalog/sql/catalog_setup/{upgrade-1.6.0.25-1.6.0.0.26.php => upgrade-1.6.0.0.25-1.6.0.0.26.php} (100%) delete mode 100644 app/code/Magento/Core/Controller/Ajax.php delete mode 100644 app/code/Magento/Core/Model/App.php delete mode 100644 app/code/Magento/Core/Model/Resource/Helper.php delete mode 100644 app/code/Magento/Core/Model/Resource/HelperPool.php rename app/code/Magento/{Backend/Model/Resource/Translate.php => Core/Model/Resource/Theme/Data/Collection.php} (70%) rename app/code/Magento/{Backup/Model/Resource/HelperFactory.php => Core/Model/Theme/Data/Collection.php} (76%) delete mode 100644 app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.15-1.6.0.16.php rename app/code/Magento/DesignEditor/Model/Translate/{InlineVde.php => Inline.php} (68%) create mode 100644 app/code/Magento/DesignEditor/Model/Translate/Inline/Provider.php rename app/code/Magento/{Core => Indexer}/Model/Mview/View/State.php (89%) rename app/code/Magento/{Core => Indexer}/Model/Resource/Mview/View/State.php (91%) rename app/code/Magento/{Core => Indexer}/Model/Resource/Mview/View/State/Collection.php (80%) rename app/code/Magento/{Backend/Model/Translate/Inline/ConfigFactory.php => Review/Block/Adminhtml/Product/Edit/Tab.php} (63%) rename app/code/Magento/{Catalog => Review}/Block/Adminhtml/Product/Edit/Tab/Reviews.php (74%) rename app/code/Magento/Review/Block/{Helper.php => Product/ReviewRenderer.php} (79%) rename app/code/Magento/{Catalog/Controller/Adminhtml/Product/Review.php => Review/Controller/Adminhtml/Product.php} (93%) rename app/code/Magento/{Core/Model/Resource/HelperFactory.php => Review/Controller/Adminhtml/Product/Reviews.php} (51%) rename app/code/Magento/{Customer/etc/frontend/events.xml => Review/etc/adminhtml/routes.xml} (78%) create mode 100644 app/code/Magento/Review/etc/di.xml create mode 100644 app/code/Magento/Review/view/adminhtml/layout/catalog_product_new.xml rename app/code/Magento/{Catalog/view/adminhtml/layout/catalog_product_review_edit.xml => Review/view/adminhtml/layout/review_product_edit.xml} (95%) rename app/code/Magento/{Catalog/view/adminhtml/layout/catalog_product_review_new.xml => Review/view/adminhtml/layout/review_product_new.xml} (100%) rename app/code/Magento/{Catalog/view/adminhtml/layout/catalog_product_reviews.xml => Review/view/adminhtml/layout/review_product_reviews_grid.xml} (91%) create mode 100644 app/code/Magento/Rss/Helper/WishlistRss.php create mode 100644 app/code/Magento/Rss/etc/di.xml rename app/code/Magento/{Core/Helper/Translate.php => Translation/Controller/Ajax.php} (52%) rename app/code/Magento/{Core/Model/Translate => Translation/Model}/Inline/Config.php (76%) rename app/code/Magento/{Core/Model/Translate => Translation/Model}/Inline/Parser.php (94%) rename app/code/Magento/{Core/Model/Resource/Translate => Translation/Model/Resource}/String.php (83%) rename app/code/Magento/{Core => Translation}/Model/Resource/Translate.php (79%) rename app/code/Magento/{Core/Model/Translate => Translation/Model}/String.php (68%) rename dev/tests/integration/testsuite/Magento/PubSub/Event/QueueWriterTest.php => app/code/Magento/Translation/data/translation_setup/data-upgrade-1.0.0.0-1.0.0.1.php (68%) create mode 100644 app/code/Magento/Translation/etc/adminhtml/di.xml create mode 100644 app/code/Magento/Translation/etc/adminhtml/routes.xml create mode 100644 app/code/Magento/Translation/etc/cache.xml create mode 100644 app/code/Magento/Translation/etc/config.xml create mode 100644 app/code/Magento/Translation/etc/di.xml create mode 100644 app/code/Magento/Translation/etc/frontend/routes.xml create mode 100644 app/code/Magento/Translation/etc/module.xml create mode 100644 app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php rename app/code/Magento/{Core => Translation}/view/adminhtml/translate_inline.phtml (100%) rename app/code/Magento/{Core => Translation}/view/frontend/translate_inline.phtml (100%) delete mode 100644 dev/tests/integration/framework/Magento/TestFramework/App.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/SendTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompositeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/PriceTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Compare/ListCompareTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/_files/product_simple.php delete mode 100644 dev/tests/integration/testsuite/Magento/Core/Model/AppTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/images/preview_image.jpg rename dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/{InlineVdeTest.php => InlineTest.php} (96%) create mode 100644 dev/tests/integration/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Log/Model/Resource/Visitor/Online/CollectionTest.php rename app/code/Magento/Backend/Model/Resource/Translate/String.php => dev/tests/integration/testsuite/Magento/Log/_files/visitor_online.php (65%) rename dev/tests/integration/testsuite/Magento/{Core => }/Model/Resource/Db/AbstractTest.php (88%) rename dev/tests/integration/testsuite/Magento/{Core => }/Model/Resource/Db/Collection/AbstractTest.php (78%) rename dev/tests/integration/testsuite/Magento/{Core => }/Model/Resource/Db/ProfilerTest.php (91%) rename dev/tests/integration/testsuite/Magento/{Core => }/Model/Resource/Entity/TableTest.php (88%) rename dev/tests/integration/testsuite/Magento/{Core => }/Model/Resource/IteratorTest.php (74%) rename dev/tests/integration/testsuite/Magento/{Core => }/Model/ResourceTest.php (86%) delete mode 100644 dev/tests/integration/testsuite/Magento/Outbound/Authentication/FactoryTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Outbound/Formatter/FactoryTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php delete mode 100644 dev/tests/integration/testsuite/Magento/PubSub/EventTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/FormTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/MainTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Review/Block/FormTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Review/_files/customer_review.php create mode 100644 dev/tests/integration/testsuite/Magento/Rss/Block/WishlistTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Rss/Helper/WishlistRssTest.php rename dev/tests/integration/testsuite/Magento/{Core => Translation}/Controller/AjaxTest.php (79%) rename dev/tests/integration/testsuite/Magento/{Core/Model/Translate => Translation/Model}/InlineParserTest.php (91%) rename dev/tests/integration/testsuite/Magento/{Core/Model/Translate => Translation/Model}/StringTest.php (81%) rename dev/tests/integration/testsuite/Magento/{Core => Translation}/_files/db_translate.php (89%) rename dev/tests/integration/testsuite/Magento/{Core => Translation}/_files/db_translate_admin_store.php (84%) rename dev/tests/unit/testsuite/Magento/Backend/{Model => App}/Router/NoRouteHandlerTest.php (83%) delete mode 100644 dev/tests/unit/testsuite/Magento/Backend/Model/Translate/Inline/ConfigFactoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Backend/Model/TranslateTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/CollectionTest.php rename dev/tests/{integration/testsuite/Magento/Url/QueryParamsResolverTest.php => unit/testsuite/Magento/Checkout/Model/Config/Source/Cart/SummaryTest.php} (56%) create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Model/ObserverTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Checkout/Model/Type/AbstractTypeTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Config/Converter/DomTest.php rename app/code/Magento/Backend/Model/Translate/Inline.php => dev/tests/unit/testsuite/Magento/Config/ScopeTest.php (50%) create mode 100644 dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.php create mode 100644 dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.xml rename dev/tests/{integration/testsuite/Magento/PubSub/Event/FactoryTest.php => unit/testsuite/Magento/Config/_files/converter/dom/cdata.php} (70%) rename dev/tests/{integration/testsuite/Magento/PubSub/_files/config.xml => unit/testsuite/Magento/Config/_files/converter/dom/cdata.xml} (82%) create mode 100644 dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_notuniq.xml create mode 100644 dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_wrongarray.xml create mode 100644 dev/tests/unit/testsuite/Magento/Controller/Router/Route/FactoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Convert/ObjectTest.php create mode 100644 dev/tests/unit/testsuite/Magento/DesignEditor/Model/Translate/Inline/ProviderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php rename dev/tests/unit/testsuite/Magento/{Core => }/Model/AbstractModelTest.php (75%) create mode 100644 dev/tests/unit/testsuite/Magento/Model/ActionValidator/RemoveActionTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Mview/Config/Data/ProxyTest.php rename dev/tests/unit/testsuite/Magento/{Core/Model/Translate/Inline => Mview}/ConfigTest.php (50%) create mode 100644 dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionFactoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Outbound/Authentication/FactoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Outbound/Authentication/HmacTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php delete mode 100644 dev/tests/unit/testsuite/Magento/Outbound/Message/FactoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Outbound/MessageTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Outbound/Transport/Http/ResponseTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Outbound/Transport/HttpTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Paypal/Block/Payflow/Link/IframeTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Phrase/Renderer/InlineTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/PubSub/Event/FactoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/PubSub/Event/QueueWriterTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/PubSub/EventTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/PubSub/Message/DispatcherAsyncTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Review/Block/Adminhtml/MainTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Review/Model/Resource/Review/Summary/CollectionTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Config/Source/Order/StatusTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Order/Total/Config/BaseTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Translate/Inline/ConfigFactoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Translate/Inline/ProxyTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Translate/Inline/StateTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Translate/InlineTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Translation/Model/Inline/ConfigTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Url/QueryParamsResolverTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Url/RouteParamsResolverFactoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Url/ValidatorTest.php rename app/code/Magento/Reports/Model/Resource/HelperFactory.php => lib/Magento/App/AreaInterface.php (77%) delete mode 100644 lib/Magento/Convert/Container/AbstractContainer.php delete mode 100644 lib/Magento/Convert/ConvertException.php delete mode 100644 lib/Magento/Convert/Mapper/Column.php delete mode 100644 lib/Magento/Convert/Mapper/MapperInterface.php create mode 100644 lib/Magento/DB/ExpressionConverter.php rename {app/code/Magento/Core/Model/Resource => lib/Magento/DB}/Helper/AbstractHelper.php (96%) rename {app/code/Magento/Core/Model/Resource => lib/Magento/DB}/Transaction.php (92%) rename {app/code/Magento/Core/Model => lib/Magento}/Flag.php (74%) rename app/code/Magento/Core/Model/Resource/Flag.php => lib/Magento/Flag/Resource.php (79%) rename lib/Magento/{Translate/InlineFactory.php => FlagFactory.php} (66%) rename {app/code/Magento/Core => lib/Magento}/Model/AbstractModel.php (91%) create mode 100644 lib/Magento/Model/ActionValidator/RemoveAction.php create mode 100644 lib/Magento/Model/ActionValidator/RemoveAction/Allowed.php rename {app/code/Magento/Core => lib/Magento/Model}/Exception.php (92%) rename {app/code/Magento/Core => lib/Magento}/Model/Resource/AbstractResource.php (94%) rename {app/code/Magento/Core => lib/Magento}/Model/Resource/Db/AbstractDb.php (87%) rename {app/code/Magento/Core => lib/Magento}/Model/Resource/Db/Collection/AbstractCollection.php (95%) rename {app/code/Magento/Core => lib/Magento}/Model/Resource/Db/Profiler.php (93%) rename {app/code/Magento/Core => lib/Magento}/Model/Resource/Entity/AbstractEntity.php (94%) rename {app/code/Magento/Core => lib/Magento}/Model/Resource/Entity/Table.php (86%) rename {app/code/Magento/Core => lib/Magento}/Model/Resource/Iterator.php (86%) rename {app/code/Magento/Core => lib/Magento}/Model/Resource/Type/AbstractType.php (89%) rename {app/code/Magento/Core => lib/Magento}/Model/Resource/Type/Db.php (80%) rename {app/code/Magento/Core => lib/Magento}/Model/Resource/Type/Db/Pdo/Mysql.php (95%) delete mode 100644 lib/Magento/Outbound/Authentication/Factory.php delete mode 100644 lib/Magento/Outbound/Authentication/Hmac.php delete mode 100644 lib/Magento/Outbound/AuthenticationInterface.php delete mode 100644 lib/Magento/Outbound/EndpointInterface.php delete mode 100644 lib/Magento/Outbound/Formatter/Factory.php delete mode 100644 lib/Magento/Outbound/Formatter/Json.php delete mode 100644 lib/Magento/Outbound/FormatterInterface.php delete mode 100644 lib/Magento/Outbound/Message.php delete mode 100644 lib/Magento/Outbound/Message/Factory.php delete mode 100644 lib/Magento/Outbound/Message/FactoryInterface.php delete mode 100644 lib/Magento/Outbound/Transport/Http.php delete mode 100644 lib/Magento/Outbound/Transport/Http/Response.php delete mode 100644 lib/Magento/Outbound/TransportInterface.php delete mode 100644 lib/Magento/Outbound/UserInterface.php create mode 100644 lib/Magento/Phrase/Renderer/Inline.php delete mode 100644 lib/Magento/PubSub/Event.php delete mode 100644 lib/Magento/PubSub/Event/Factory.php delete mode 100644 lib/Magento/PubSub/Event/FactoryInterface.php delete mode 100644 lib/Magento/PubSub/Event/QueueHandler.php delete mode 100644 lib/Magento/PubSub/Event/QueueReaderInterface.php delete mode 100644 lib/Magento/PubSub/Event/QueueWriterInterface.php delete mode 100644 lib/Magento/PubSub/EventInterface.php delete mode 100644 lib/Magento/PubSub/Job/FactoryInterface.php delete mode 100644 lib/Magento/PubSub/Job/QueueHandler.php delete mode 100644 lib/Magento/PubSub/Job/QueueReaderInterface.php delete mode 100644 lib/Magento/PubSub/Job/QueueWriterInterface.php delete mode 100644 lib/Magento/PubSub/JobInterface.php delete mode 100644 lib/Magento/PubSub/Message/DispatcherAsync.php delete mode 100644 lib/Magento/PubSub/Message/DispatcherAsyncInterface.php delete mode 100644 lib/Magento/PubSub/Subscription/CollectionInterface.php delete mode 100644 lib/Magento/PubSub/SubscriptionInterface.php delete mode 100644 lib/Magento/Translate/Factory.php rename lib/Magento/Translate/Inline/{ConfigFactory.php => Provider.php} (68%) rename lib/Magento/{LauncherInterface.php => Translate/Inline/ProviderInterface.php} (67%) create mode 100644 lib/Magento/Translate/Inline/Proxy.php create mode 100644 lib/Magento/Translate/Inline/State.php create mode 100644 lib/Magento/Translate/Inline/StateInterface.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ee21afdd78..1926afa0767 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,47 @@ +2.0.0.0-dev71 +============= +* Fixed bugs: + * Fixed an issue with displaying product on the frontend when the product flat indexer is enabled + * Fixed an issue with applying catalog price rules on the category level + * Fixed an issue where the essential cookies like CUSTOMER, CART, and so on were not created in Google Chrome + * Fixed an issue with placing orders by customers assigned to a VAT group + * Fixed an issue with incorrect error message during registration, and inability for a shopper to ask for resending a confirmation email + * Fixed an issue where the Catalog module resource Setup Upgrade logic was broken +* Modularity improvements: + * Moved abstract Core models and related logic to the Magento/Model library + * Moved the abstract DB logic and Core resource helpers to the Magento/DB library + * Eliminated the Core\Model\App class + * Moved the Magento Flag functionality to the library + * Resolved dependency of the Catalog and related modules on the Review module + * Moved indexers related logic from the Core module to the Indexer module + * Moved the Inline translation and user intended translate functionality from the Core module to a separate Translation module +* Framework Improvements: + * Covered Magento library components with unit tests: + * Magento\Config + * Magento\Convert + * Magento\Controller + * Magento\Data\Collection\Db + * Magento\Mview + * Magento\Url and Magento/Url.php + * Covered Magento application components with unit tests: + * Magento\Checkout\Model\Config + * Magento\Checkout\Model\Observer + * Magento\Checkout\Model\Type + * Magento\Sales\Model\Config + * Renamed LauncherInterface to AppInterface +* Improvements in code coverage calculation: + * Updated the whitelist filter with library code for integration tests code coverage calculation +* GitHub requests: + * [#512] (https://github.com/magento/magento2/issues/512) -- Theme Thumbnails not showing + * [#520] (https://github.com/magento/magento2/pull/502) -- Corrected Search Engine Optimization i18n + * [#519] (https://github.com/magento/magento2/issues/519) -- New Theme Activation +* Customer Service usage: + * Refactored the Log module to use Customer Service + * Refactored the RSS module to use Customer Service + * Refactored the Review module to use Customer Service + * Refactored the Catalog module to use Customer service layer + * Refactored the Downloadable module to use Customer service layer + 2.0.0.0-dev70 ============= * Fixed bugs: diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php index c12578f51af..86c78a3650a 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php @@ -60,7 +60,7 @@ class Notification extends \Magento\Backend\App\AbstractAction $notificationId ); $this->messageManager->addSuccess(__('The message has been marked as Read.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -121,7 +121,7 @@ class Notification extends \Magento\Backend\App\AbstractAction $this->messageManager->addSuccess( __('A total of %1 record(s) have been marked as Read.', count($ids)) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -149,7 +149,7 @@ class Notification extends \Magento\Backend\App\AbstractAction try { $model->setIsRemove(1)->save(); $this->messageManager->addSuccess(__('The message has been removed.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __("We couldn't remove the messages because of an error.")); @@ -178,7 +178,7 @@ class Notification extends \Magento\Backend\App\AbstractAction } } $this->messageManager->addSuccess(__('Total of %1 record(s) have been removed.', count($ids))); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __("We couldn't remove the messages because of an error.")); diff --git a/app/code/Magento/AdminNotification/Model/Feed.php b/app/code/Magento/AdminNotification/Model/Feed.php index 3b144e83175..1715651a556 100644 --- a/app/code/Magento/AdminNotification/Model/Feed.php +++ b/app/code/Magento/AdminNotification/Model/Feed.php @@ -32,7 +32,7 @@ namespace Magento\AdminNotification\Model; * @package Magento_AdminNotification * @author Magento Core Team <core@magentocommerce.com> */ -class Feed extends \Magento\Core\Model\AbstractModel +class Feed extends \Magento\Model\AbstractModel { const XML_USE_HTTPS_PATH = 'system/adminnotification/use_https'; @@ -64,7 +64,7 @@ class Feed extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Backend\App\ConfigInterface $backendConfig * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -73,7 +73,7 @@ class Feed extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Backend\App\ConfigInterface $backendConfig, \Magento\AdminNotification\Model\InboxFactory $inboxFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/AdminNotification/Model/Inbox.php b/app/code/Magento/AdminNotification/Model/Inbox.php index 34e31eb3525..cc5c4adb9e9 100644 --- a/app/code/Magento/AdminNotification/Model/Inbox.php +++ b/app/code/Magento/AdminNotification/Model/Inbox.php @@ -49,7 +49,7 @@ namespace Magento\AdminNotification\Model; * @package Magento_AdminNotification * @author Magento Core Team <core@magentocommerce.com> */ -class Inbox extends \Magento\Core\Model\AbstractModel +class Inbox extends \Magento\Model\AbstractModel { const SEVERITY_CRITICAL = 1; @@ -133,13 +133,13 @@ class Inbox extends \Magento\Core\Model\AbstractModel * @param string|string[] $description * @param string $url * @param bool $isInternal - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function add($severity, $title, $description, $url = '', $isInternal = true) { if (!$this->getSeverities($severity)) { - throw new \Magento\Core\Exception(__('Wrong message type')); + throw new \Magento\Model\Exception(__('Wrong message type')); } if (is_array($description)) { $description = '<ul><li>' . implode('</li><li>', $description) . '</li></ul>'; diff --git a/app/code/Magento/AdminNotification/Model/NotificationService.php b/app/code/Magento/AdminNotification/Model/NotificationService.php index 52682a63c26..7efd5f064a2 100644 --- a/app/code/Magento/AdminNotification/Model/NotificationService.php +++ b/app/code/Magento/AdminNotification/Model/NotificationService.php @@ -52,14 +52,14 @@ class NotificationService * * @param int $notificationId * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function markAsRead($notificationId) { $notification = $this->_notificationFactory->create(); $notification->load($notificationId); if (!$notification->getId()) { - throw new \Magento\Core\Exception('Wrong notification ID specified.'); + throw new \Magento\Model\Exception('Wrong notification ID specified.'); } $notification->setIsRead(1); $notification->save(); diff --git a/app/code/Magento/AdminNotification/Model/Resource/Grid/Collection.php b/app/code/Magento/AdminNotification/Model/Resource/Grid/Collection.php index 13e63de1d03..98b0cb708cc 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/Grid/Collection.php +++ b/app/code/Magento/AdminNotification/Model/Resource/Grid/Collection.php @@ -38,7 +38,7 @@ class Collection extends \Magento\AdminNotification\Model\Resource\Inbox\Collect /** * Add remove filter * - * @return \Magento\AdminNotification\Model\Resource\Grid\Collection|\Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\AdminNotification\Model\Resource\Grid\Collection|\Magento\Model\Resource\Db\Collection\AbstractCollection */ protected function _initSelect() { diff --git a/app/code/Magento/AdminNotification/Model/Resource/Inbox.php b/app/code/Magento/AdminNotification/Model/Resource/Inbox.php index c2a08fa4a21..d11427c33e7 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/Inbox.php +++ b/app/code/Magento/AdminNotification/Model/Resource/Inbox.php @@ -32,7 +32,7 @@ namespace Magento\AdminNotification\Model\Resource; * @package Magento_AdminNotification * @author Magento Core Team <core@magentocommerce.com> */ -class Inbox extends \Magento\Core\Model\Resource\Db\AbstractDb +class Inbox extends \Magento\Model\Resource\Db\AbstractDb { /** * AdminNotification Resource initialization diff --git a/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection.php b/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection.php index 65d7f585990..93d42191690 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection.php +++ b/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection.php @@ -32,7 +32,7 @@ namespace Magento\AdminNotification\Model\Resource\Inbox; * @package Magento_AdminNotification * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource collection initialization diff --git a/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection/Critical.php b/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection/Critical.php index 0c2d6abde7a..2599f958784 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection/Critical.php +++ b/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection/Critical.php @@ -25,7 +25,7 @@ */ namespace Magento\AdminNotification\Model\Resource\Inbox\Collection; -class Critical extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Critical extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource collection initialization diff --git a/app/code/Magento/AdminNotification/Model/Resource/System/Message.php b/app/code/Magento/AdminNotification/Model/Resource/System/Message.php index 24a35da93fb..eb1305f857e 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/System/Message.php +++ b/app/code/Magento/AdminNotification/Model/Resource/System/Message.php @@ -23,7 +23,7 @@ */ namespace Magento\AdminNotification\Model\Resource\System; -class Message extends \Magento\Core\Model\Resource\Db\AbstractDb +class Message extends \Magento\Model\Resource\Db\AbstractDb { /** * Flag that notifies whether Primary key of table is auto-incremeted diff --git a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php index 90d863c767d..1bf58e16f75 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php +++ b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php @@ -23,7 +23,7 @@ */ namespace Magento\AdminNotification\Model\Resource\System\Message; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * System message list @@ -46,7 +46,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\AdminNotification\Model\System\MessageList $messageList * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -55,7 +55,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\AdminNotification\Model\System\MessageList $messageList, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_messageList = $messageList; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection/Synchronized.php b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection/Synchronized.php index 6b5f82526e4..1e909f50993 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection/Synchronized.php +++ b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection/Synchronized.php @@ -35,7 +35,7 @@ class Synchronized extends \Magento\AdminNotification\Model\Resource\System\Mess /** * Store new messages in database and remove outdated messages * - * @return $this|\Magento\Core\Model\Resource\Db\AbstractDb + * @return $this|\Magento\Model\Resource\Db\AbstractDb */ public function _afterLoad() { diff --git a/app/code/Magento/AdminNotification/Model/Survey.php b/app/code/Magento/AdminNotification/Model/Survey.php index ea16a0cb2bb..f2c12c5b43f 100644 --- a/app/code/Magento/AdminNotification/Model/Survey.php +++ b/app/code/Magento/AdminNotification/Model/Survey.php @@ -44,12 +44,12 @@ class Survey protected $_flagCode = 'admin_notification_survey'; /** - * @var \Magento\Core\Model\Flag + * @var \Magento\Flag */ protected $_flagModel = null; /** - * @var \Magento\Core\Model\FlagFactory + * @var \Magento\FlagFactory */ protected $_flagFactory; @@ -59,10 +59,10 @@ class Survey protected $_request; /** - * @param \Magento\Core\Model\FlagFactory $flagFactory + * @param \Magento\FlagFactory $flagFactory * @param \Magento\App\RequestInterface $request */ - public function __construct(\Magento\Core\Model\FlagFactory $flagFactory, \Magento\App\RequestInterface $request) + public function __construct(\Magento\FlagFactory $flagFactory, \Magento\App\RequestInterface $request) { $this->_request = $request; $this->_flagFactory = $flagFactory; @@ -100,7 +100,7 @@ class Survey /** * Return core flag model * - * @return \Magento\Core\Model\Flag + * @return \Magento\Flag */ protected function _getFlagModel() { diff --git a/app/code/Magento/AdminNotification/Model/System/Message.php b/app/code/Magento/AdminNotification/Model/System/Message.php index 2fc941aebcd..d606ae60dfe 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message.php +++ b/app/code/Magento/AdminNotification/Model/System/Message.php @@ -23,8 +23,7 @@ */ namespace Magento\AdminNotification\Model\System; -class Message extends \Magento\Core\Model\AbstractModel implements - \Magento\AdminNotification\Model\System\MessageInterface +class Message extends \Magento\Model\AbstractModel implements \Magento\AdminNotification\Model\System\MessageInterface { /** * @return void 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 f55c5a59663..f4488a33c6f 100644 --- a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php @@ -150,7 +150,7 @@ class Payment extends \Magento\Sales\Controller\Adminhtml\Order\Create $result['success'] = 1; $isError = false; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $message = $e->getMessage(); if (!empty($message)) { $this->messageManager->addError($message); diff --git a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Payment.php b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Payment.php index 6a8183053ff..a20c0951ae0 100644 --- a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Payment.php @@ -77,7 +77,7 @@ class Payment extends \Magento\Backend\App\Action )->getPaymentMethodsHtml( $this->_view ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); $result['error_message'] = $e->getMessage(); } catch (\Exception $e) { diff --git a/app/code/Magento/Authorizenet/Controller/Authorizenet/Payment.php b/app/code/Magento/Authorizenet/Controller/Authorizenet/Payment.php index a9d5945137b..c367ba997df 100644 --- a/app/code/Magento/Authorizenet/Controller/Authorizenet/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Authorizenet/Payment.php @@ -67,7 +67,7 @@ class Payment extends \Magento\App\Action\Action )->getPaymentMethodsHtml( $this->_view ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); $result['error_message'] = $e->getMessage(); } catch (\Exception $e) { diff --git a/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php b/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php index ca5c2c6212f..485331289dc 100644 --- a/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php @@ -114,7 +114,7 @@ class Payment extends \Magento\App\Action\Action } $paymentMethod->process($data); $result['success'] = 1; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); $result['success'] = 0; $result['error_msg'] = $e->getMessage(); diff --git a/app/code/Magento/Authorizenet/Model/Authorizenet.php b/app/code/Magento/Authorizenet/Model/Authorizenet.php index 8f26a9ebbc0..04ac998df3a 100644 --- a/app/code/Magento/Authorizenet/Model/Authorizenet.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet.php @@ -497,12 +497,12 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Payment\Model\Info $payment * @param float $amount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function authorize(\Magento\Object $payment, $amount) { if ($amount <= 0) { - throw new \Magento\Core\Exception(__('This is an invalid amount for authorization.')); + throw new \Magento\Model\Exception(__('This is an invalid amount for authorization.')); } $this->_initCardsStorage($payment); @@ -524,12 +524,12 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Payment\Model\Info $payment * @param float $amount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function capture(\Magento\Object $payment, $amount) { if ($amount <= 0) { - throw new \Magento\Core\Exception(__('This is an invalid amount for capture.')); + throw new \Magento\Model\Exception(__('This is an invalid amount for capture.')); } $this->_initCardsStorage($payment); if ($this->_isPreauthorizeCapture($payment)) { @@ -594,7 +594,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Payment\Model\Info $payment * @param float $requestedAmount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function refund(\Magento\Object $payment, $requestedAmount) { @@ -604,7 +604,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $cardsStorage->getCapturedAmount() - $cardsStorage->getRefundedAmount() ) < $requestedAmount ) { - throw new \Magento\Core\Exception(__('This is an invalid amount for refund.')); + throw new \Magento\Model\Exception(__('This is an invalid amount for refund.')); } $messages = array(); @@ -650,12 +650,12 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * * @param \Magento\Payment\Model\Info $payment * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function cancelPartialAuthorization(\Magento\Payment\Model\Info $payment) { if (!$payment->getAdditionalInformation($this->_splitTenderIdKey)) { - throw new \Magento\Core\Exception(__('This is an invalid split tenderId ID.')); + throw new \Magento\Model\Exception(__('This is an invalid split tenderId ID.')); } $request = $this->_getRequest(); @@ -672,7 +672,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $this->setPartialAuthorizationLastActionState(self::PARTIAL_AUTH_ALL_CANCELED); return; default: - throw new \Magento\Core\Exception(__('Something went wrong while canceling the payment.')); + throw new \Magento\Model\Exception(__('Something went wrong while canceling the payment.')); } } @@ -683,7 +683,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param float $amount * @param string $requestType * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _place($payment, $amount, $requestType) { @@ -762,12 +762,12 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc return $this; } } - throw new \Magento\Core\Exception($defaultExceptionMessage); + throw new \Magento\Model\Exception($defaultExceptionMessage); case self::RESPONSE_CODE_DECLINED: case self::RESPONSE_CODE_ERROR: - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); default: - throw new \Magento\Core\Exception($defaultExceptionMessage); + throw new \Magento\Model\Exception($defaultExceptionMessage); } return $this; } @@ -780,7 +780,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param string $requestType * @return $this * @throws \Magento\Payment\Model\Info\Exception - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _partialAuthorization($payment, $amount, $requestType) { @@ -811,7 +811,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $amount = $amount - $this->getCardsStorage()->getProcessedAmount(); if ($amount <= 0) { - throw new \Magento\Core\Exception(__('This is an invalid amount for partial authorization.')); + throw new \Magento\Model\Exception(__('This is an invalid amount for partial authorization.')); } $payment->setAmount($amount); $request = $this->_buildRequest($payment); @@ -879,7 +879,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Payment\Model\Info $payment * @param float $requestedAmount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _preauthorizeCapture($payment, $requestedAmount) { @@ -889,7 +889,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $cardsStorage->getProcessedAmount() - $cardsStorage->getCapturedAmount() ) < $requestedAmount ) { - throw new \Magento\Core\Exception(__('This is an invalid amount for capture.')); + throw new \Magento\Model\Exception(__('This is an invalid amount for capture.')); } $messages = array(); @@ -933,7 +933,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param float $amount * @param \Magento\Object $card * @return \Magento\Sales\Model\Order\Payment\Transaction - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _preauthorizeCaptureCardTransaction($payment, $amount, $card) { @@ -988,7 +988,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $amount, $exceptionMessage ); - throw new \Magento\Core\Exception($exceptionMessage); + throw new \Magento\Model\Exception($exceptionMessage); } /** @@ -997,7 +997,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Payment\Model\Info $payment * @param \Magento\Object $card * @return \Magento\Sales\Model\Order\Payment\Transaction - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _voidCardTransaction($payment, $card) { @@ -1080,7 +1080,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc false, $exceptionMessage ); - throw new \Magento\Core\Exception($exceptionMessage); + throw new \Magento\Model\Exception($exceptionMessage); } /** @@ -1102,7 +1102,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param float $amount * @param \Magento\Object $card * @return \Magento\Sales\Model\Order\Payment\Transaction - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _refundCardTransaction($payment, $amount, $card) { @@ -1173,7 +1173,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $amount, $exceptionMessage ); - throw new \Magento\Core\Exception($exceptionMessage); + throw new \Magento\Model\Exception($exceptionMessage); } /** @@ -1515,7 +1515,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * * @param \Magento\Authorizenet\Model\Authorizenet\Request $request * @return \Magento\Authorizenet\Model\Authorizenet\Result - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _postRequest(\Magento\Object $request) { @@ -1549,7 +1549,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $debugData['result'] = $result->getData(); $this->_debug($debugData); - throw new \Magento\Core\Exception($this->_wrapGatewayError($e->getMessage())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($e->getMessage())); } $responseBody = $response->getBody(); @@ -1601,7 +1601,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $r[54] ); } else { - throw new \Magento\Core\Exception(__('Something went wrong in the payment gateway.')); + throw new \Magento\Model\Exception(__('Something went wrong in the payment gateway.')); } $debugData['result'] = $result->getData(); @@ -1768,7 +1768,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param string $messages * @param bool $isSuccessfulTransactions * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processFailureMultitransactionAction($payment, $messages, $isSuccessfulTransactions) { @@ -1792,7 +1792,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc } $copyOrder->save(); } - throw new \Magento\Core\Exception($this->_authorizenetData->convertMessagesToMessage($messages)); + throw new \Magento\Model\Exception($this->_authorizenetData->convertMessagesToMessage($messages)); } /** @@ -1817,7 +1817,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * * @param string $transactionId * @return \Magento\Object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @link http://www.authorize.net/support/ReportingGuide_XML.pdf * @link http://developer.authorize.net/api/transaction_details/ */ @@ -1852,7 +1852,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $responseXmlDocument = new \Magento\Simplexml\Element($responseBody); libxml_use_internal_errors(false); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('Payment updating error.')); + throw new \Magento\Model\Exception(__('Payment updating error.')); } $response = new \Magento\Object(); diff --git a/app/code/Magento/Authorizenet/Model/Authorizenet/Debug.php b/app/code/Magento/Authorizenet/Model/Authorizenet/Debug.php index 641942d492c..965176635c0 100644 --- a/app/code/Magento/Authorizenet/Model/Authorizenet/Debug.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet/Debug.php @@ -43,7 +43,7 @@ namespace Magento\Authorizenet\Model\Authorizenet; * * @author Magento Core Team <core@magentocommerce.com> */ -class Debug extends \Magento\Core\Model\AbstractModel +class Debug extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Authorizenet/Model/Directpost.php b/app/code/Magento/Authorizenet/Model/Directpost.php index b30ed1edd00..fb2ced68a25 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost.php +++ b/app/code/Magento/Authorizenet/Model/Directpost.php @@ -188,12 +188,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * @param \Magento\Object $payment * @param float $amount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function capture(\Magento\Object $payment, $amount) { if ($amount <= 0) { - throw new \Magento\Core\Exception(__('Invalid amount for capture.')); + throw new \Magento\Model\Exception(__('Invalid amount for capture.')); } $payment->setAmount($amount); @@ -224,12 +224,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet ); return $this; } - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); case self::RESPONSE_CODE_DECLINED: case self::RESPONSE_CODE_ERROR: - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); default: - throw new \Magento\Core\Exception(__('Payment capturing error.')); + throw new \Magento\Model\Exception(__('Payment capturing error.')); } } @@ -259,12 +259,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * * @param \Magento\Object $payment * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function void(\Magento\Object $payment) { if (!$payment->getParentTransactionId()) { - throw new \Magento\Core\Exception(__('Invalid transaction ID.')); + throw new \Magento\Model\Exception(__('Invalid transaction ID.')); } $payment->setAnetTransType(self::REQUEST_TYPE_VOID); @@ -289,12 +289,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet ); return $this; } - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); case self::RESPONSE_CODE_DECLINED: case self::RESPONSE_CODE_ERROR: - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); default: - throw new \Magento\Core\Exception(__('Payment voiding error.')); + throw new \Magento\Model\Exception(__('Payment voiding error.')); } } @@ -349,16 +349,16 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * @param \Magento\Object $payment * @param float $amount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _refund(\Magento\Object $payment, $amount) { if ($amount <= 0) { - throw new \Magento\Core\Exception(__('Invalid amount for refund.')); + throw new \Magento\Model\Exception(__('Invalid amount for refund.')); } if (!$payment->getParentTransactionId()) { - throw new \Magento\Core\Exception(__('Invalid transaction ID.')); + throw new \Magento\Model\Exception(__('Invalid transaction ID.')); } $payment->setAnetTransType(self::REQUEST_TYPE_CREDIT); @@ -385,12 +385,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet ); return $this; } - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); case self::RESPONSE_CODE_DECLINED: case self::RESPONSE_CODE_ERROR: - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); default: - throw new \Magento\Core\Exception(__('Payment refunding error.')); + throw new \Magento\Model\Exception(__('Payment refunding error.')); } } @@ -495,7 +495,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * Validate response data. Needed in controllers. * * @return bool true in case of validation success. - * @throws \Magento\Core\Exception In case of validation error + * @throws \Magento\Model\Exception In case of validation error */ public function validateResponse() { @@ -510,7 +510,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet $this->getConfigData('login') ) ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The transaction was declined because the response hash validation failed.') ); } @@ -522,7 +522,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * * @param array $responseData data from Authorize.net from $_POST * @return void - * @throws \Magento\Core\Exception In case of validation error or order creation error + * @throws \Magento\Model\Exception In case of validation error or order creation error */ public function process(array $responseData) { @@ -546,7 +546,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet //check payment method $payment = $order->getPayment(); if (!$payment || $payment->getMethod() != $this->getCode()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('This payment didn\'t work out because we can\'t find this order.') ); } @@ -561,7 +561,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet } if ($isError) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( $responseText && !$response->isApproved() ? $responseText : __( 'This payment didn\'t work out because we can\'t find this order.' ) @@ -602,7 +602,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * Check response code came from Authorize.net. * * @return true in case of Approved response - * @throws \Magento\Core\Exception In case of Declined or Error response from Authorize.net + * @throws \Magento\Model\Exception In case of Declined or Error response from Authorize.net */ public function checkResponseCode() { @@ -611,11 +611,11 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet return true; case self::RESPONSE_CODE_DECLINED: case self::RESPONSE_CODE_ERROR: - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( $this->_wrapGatewayError($this->getResponse()->getXResponseReasonText()) ); default: - throw new \Magento\Core\Exception(__('There was a payment authorization error.')); + throw new \Magento\Model\Exception(__('There was a payment authorization error.')); } } @@ -623,12 +623,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * Check transaction id came from Authorize.net * * @return true in case of right transaction id - * @throws \Magento\Core\Exception In case of bad transaction id. + * @throws \Magento\Model\Exception In case of bad transaction id. */ public function checkTransId() { if (!$this->getResponse()->getXTransId()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('This payment was not authorized because the transaction ID field is empty.') ); } @@ -652,7 +652,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * * @param \Magento\Sales\Model\Order $order * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Exception */ protected function _authOrder(\Magento\Sales\Model\Order $order) @@ -697,7 +697,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet 'Something went wrong: the paid amount doesn\'t match the order amount. Please correct this and try again.' ); $this->_declineOrder($order, $message, true); - throw new \Magento\Core\Exception($message); + throw new \Magento\Model\Exception($message); } //capture order using AIM if needed diff --git a/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug.php b/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug.php index 645462d2ec8..7dffdead4a0 100644 --- a/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug.php +++ b/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug.php @@ -30,7 +30,7 @@ namespace Magento\Authorizenet\Model\Resource\Authorizenet; * * @author Magento Core Team <core@magentocommerce.com> */ -class Debug extends \Magento\Core\Model\Resource\Db\AbstractDb +class Debug extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug/Collection.php b/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug/Collection.php index b3d2e42d383..4949b62de72 100644 --- a/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug/Collection.php +++ b/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug/Collection.php @@ -30,7 +30,7 @@ namespace Magento\Authorizenet\Model\Resource\Authorizenet\Debug; * * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Backend/App/Router/NoRouteHandler.php b/app/code/Magento/Backend/App/Router/NoRouteHandler.php index 7766ee870bd..026c5095de1 100644 --- a/app/code/Magento/Backend/App/Router/NoRouteHandler.php +++ b/app/code/Magento/Backend/App/Router/NoRouteHandler.php @@ -32,12 +32,21 @@ class NoRouteHandler implements \Magento\App\Router\NoRouteHandlerInterface */ protected $_helper; + /** + * @var \Magento\App\Route\ConfigInterface + */ + protected $_routeConfig; + /** * @param \Magento\Backend\Helper\Data $helper + * @param \Magento\App\Route\ConfigInterface $routeConfig */ - public function __construct(\Magento\Backend\Helper\Data $helper) - { + public function __construct( + \Magento\Backend\Helper\Data $helper, + \Magento\App\Route\ConfigInterface $routeConfig + ) { $this->_helper = $helper; + $this->_routeConfig = $routeConfig; } /** @@ -53,7 +62,7 @@ class NoRouteHandler implements \Magento\App\Router\NoRouteHandlerInterface if ($areaFrontName == $this->_helper->getAreaFrontName()) { - $moduleName = 'admin'; + $moduleName = $this->_routeConfig->getRouteFrontName('adminhtml'); $controllerName = 'noroute'; $actionName = 'index'; 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 407bf6d49b0..9d30968ee92 100644 --- a/app/code/Magento/Backend/Block/Cache/Grid/Column/Statuses.php +++ b/app/code/Magento/Backend/Block/Cache/Grid/Column/Statuses.php @@ -60,7 +60,7 @@ class Statuses extends \Magento\Backend\Block\Widget\Grid\Column * Decorate status column values * * @param string $value - * @param \Magento\Core\Model\AbstractModel $row + * @param \Magento\Model\AbstractModel $row * @param \Magento\Backend\Block\Widget\Grid\Column $column * @param bool $isExport * @return string diff --git a/app/code/Magento/Backend/Block/Context.php b/app/code/Magento/Backend/Block/Context.php index 12b81953233..235f2f10913 100644 --- a/app/code/Magento/Backend/Block/Context.php +++ b/app/code/Magento/Backend/Block/Context.php @@ -56,7 +56,7 @@ class Context extends \Magento\View\Element\Context * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\AuthorizationInterface $authorization - * @param array $data + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -78,8 +78,8 @@ class Context extends \Magento\View\Element\Context \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\AuthorizationInterface $authorization, - array $data = array() + \Magento\Translate\Inline\StateInterface $inlineTranslation, + \Magento\AuthorizationInterface $authorization ) { $this->_authorization = $authorization; parent::__construct( @@ -100,7 +100,7 @@ class Context extends \Magento\View\Element\Context $escaper, $filterManager, $localeDate, - $data + $inlineTranslation ); } diff --git a/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php b/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php index 07e3bfb6b88..6acb8b651f4 100644 --- a/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php +++ b/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php @@ -25,7 +25,7 @@ */ namespace Magento\Backend\Block\Dashboard; -use Magento\Core\Model\Resource\Db\Collection\AbstractCollection; +use Magento\Model\Resource\Db\Collection\AbstractCollection; /** * Adminhtml dashboard tab abstract diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php index 824c74526e6..7939d9d275b 100644 --- a/app/code/Magento/Backend/Block/Template/Context.php +++ b/app/code/Magento/Backend/Block/Template/Context.php @@ -72,6 +72,7 @@ class Context extends \Magento\View\Element\Template\Context * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEnginePool $enginePool @@ -82,7 +83,6 @@ class Context extends \Magento\View\Element\Template\Context * @param \Magento\Math\Random $mathRandom * @param \Magento\Data\Form\FormKey $formKey * @param \Magento\Code\NameBuilder $nameBuilder - * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -104,6 +104,7 @@ class Context extends \Magento\View\Element\Template\Context \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\App\Filesystem $filesystem, \Magento\View\FileSystem $viewFileSystem, \Magento\View\TemplateEnginePool $enginePool, @@ -113,8 +114,7 @@ class Context extends \Magento\View\Element\Template\Context \Magento\Backend\Model\Session $backendSession, \Magento\Math\Random $mathRandom, \Magento\Data\Form\FormKey $formKey, - \Magento\Code\NameBuilder $nameBuilder, - array $data = array() + \Magento\Code\NameBuilder $nameBuilder ) { $this->_authorization = $authorization; $this->_backendSession = $backendSession; @@ -139,12 +139,12 @@ class Context extends \Magento\View\Element\Template\Context $escaper, $filterManager, $localeDate, + $inlineTranslation, $filesystem, $viewFileSystem, $enginePool, $appState, - $storeManager, - $data + $storeManager ); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid.php b/app/code/Magento/Backend/Block/Widget/Grid.php index c2cf8bce35e..d23b146915d 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid.php +++ b/app/code/Magento/Backend/Block/Widget/Grid.php @@ -245,13 +245,13 @@ class Grid extends \Magento\Backend\Block\Widget /** * Retrieve export block * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\View\Element\AbstractBlock|bool */ public function getExportBlock() { if (!$this->getChildBlock('grid.export')) { - throw new \Magento\Core\Exception('Export block for grid ' . $this->getNameInLayout() . ' is not defined'); + throw new \Magento\Model\Exception('Export block for grid ' . $this->getNameInLayout() . ' is not defined'); } return $this->getChildBlock('grid.export'); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/AbstractFilter.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/AbstractFilter.php index b2fa1353ce7..b2d8658a06f 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/AbstractFilter.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/AbstractFilter.php @@ -40,18 +40,18 @@ class AbstractFilter extends \Magento\Backend\Block\AbstractBlock implements protected $_column; /** - * @var \Magento\Core\Model\Resource\Helper + * @var \Magento\DB\Helper */ protected $_resourceHelper; /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, array $data = array() ) { $this->_resourceHelper = $resourceHelper; diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Country.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Country.php index a93ac0132f5..2739e7a7ba6 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Country.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Country.php @@ -37,13 +37,13 @@ class Country extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $directoriesFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Directory\Model\Resource\Country\CollectionFactory $directoriesFactory, array $data = array() ) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php index 3acc79c32e0..b11bf3d2496 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php @@ -42,14 +42,14 @@ class Date extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilt /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Math\Random $mathRandom * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Math\Random $mathRandom, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php index d4ec0f7e044..0c7f01f5340 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php @@ -53,14 +53,14 @@ class Price extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFil /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Directory\Model\Currency $currencyModel * @param \Magento\Directory\Model\Currency\DefaultLocator $currencyLocator * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Directory\Model\Currency $currencyModel, \Magento\Directory\Model\Currency\DefaultLocator $currencyLocator, array $data = array() diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php index ba211f85992..522d1ae89bf 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php @@ -39,13 +39,13 @@ class Store extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFil /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Core\Model\System\Store $systemStore * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Core\Model\System\Store $systemStore, array $data = array() ) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Theme.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Theme.php index da8e2741018..63c14b3c391 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Theme.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Theme.php @@ -38,13 +38,13 @@ class Theme extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFil /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\View\Design\Theme\LabelFactory $labelFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\View\Design\Theme\LabelFactory $labelFactory, array $data = array() ) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Export.php b/app/code/Magento/Backend/Block/Widget/Grid/Export.php index b2dd9e60ff5..ce384d8e0a1 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Export.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Export.php @@ -84,7 +84,7 @@ class Export extends \Magento\Backend\Block\Widget implements \Magento\Backend\B /** * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _construct() { @@ -92,7 +92,7 @@ class Export extends \Magento\Backend\Block\Widget implements \Magento\Backend\B if ($this->hasData('exportTypes')) { foreach ($this->getData('exportTypes') as $type) { if (!isset($type['urlPath']) || !isset($type['label'])) { - throw new \Magento\Core\Exception('Invalid export type supplied for grid export block'); + throw new \Magento\Model\Exception('Invalid export type supplied for grid export block'); } $this->addExportType($type['urlPath'], $type['label']); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Item.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Item.php index 94ff274c9ee..9797907e323 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Item.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Item.php @@ -66,7 +66,7 @@ class Item extends \Magento\Backend\Block\Widget * * @param string|\Magento\View\Element\AbstractBlock $block * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setAdditionalActionBlock($block) { @@ -75,7 +75,7 @@ class Item extends \Magento\Backend\Block\Widget } elseif (is_array($block)) { $block = $this->_createFromConfig($block); } elseif (!$block instanceof \Magento\View\Element\AbstractBlock) { - throw new \Magento\Core\Exception('Unknown block type'); + throw new \Magento\Model\Exception('Unknown block type'); } $this->setChild('additional_action', $block); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Ajax.php b/app/code/Magento/Backend/Controller/Adminhtml/Ajax.php index f2fce8f1bca..f11ef4f885f 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Ajax.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Ajax.php @@ -27,6 +27,24 @@ use Magento\Backend\App\Action; class Ajax extends Action { + /** + * @var \Magento\Translate\Inline\ParserInterface + */ + protected $inlineParser; + + /** + * @param Action\Context $context + * @param \Magento\Translate\Inline\ParserInterface $inlineParser + */ + public function __construct( + Action\Context $context, + \Magento\Translate\Inline\ParserInterface $inlineParser + ) { + parent::__construct($context); + + $this->inlineParser = $inlineParser; + } + /** * Ajax action for inline translation * @@ -34,12 +52,16 @@ class Ajax extends Action */ public function translateAction() { - $translationParams = (array)$this->getRequest()->getPost('translate'); - $area = $this->getRequest()->getPost('area'); - /** @var \Magento\Core\Helper\Translate $translationHelper */ - $translationHelper = $this->_objectManager->get('Magento\Core\Helper\Translate'); - $response = $translationHelper->apply($translationParams, $area); + $translate = (array)$this->getRequest()->getPost('translate'); + + try { + $this->inlineParser->processAjaxPost($translate); + $response = "{success:true}"; + } catch (\Exception $e) { + $response = "{error:true,message:'" . $e->getMessage() . "'}"; + } $this->getResponse()->setBody($response); + $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); } } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache.php index beab3d046dc..9711e112625 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache.php @@ -26,7 +26,7 @@ namespace Magento\Backend\Controller\Adminhtml; use Magento\Backend\App\Action; -use Magento\Core\Exception; +use Magento\Model\Exception; class Cache extends Action { diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php index 7f58c26335f..b243b504d74 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php @@ -95,7 +95,7 @@ class Account extends Action $user->save(); $user->sendPasswordResetNotificationEmail(); $this->messageManager->addSuccess(__('The account has been saved.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addMessages($e->getMessages()); } catch (\Exception $e) { $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 e7f01cc54d4..01747e05a59 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php @@ -103,7 +103,7 @@ class Save extends AbstractConfig $configModel->save(); $this->messageManager->addSuccess(__('You saved the configuration.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $messages = explode("\n", $e->getMessage()); foreach ($messages as $message) { $this->messageManager->addError($message); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php index a63deb55c5d..ae50f92d714 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php @@ -291,7 +291,7 @@ class Store extends Action } $this->_redirect('adminhtml/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_getSession()->setPostData($postData); } catch (\Exception $e) { @@ -454,7 +454,7 @@ class Store extends Action $this->messageManager->addSuccess(__('The website has been deleted.')); $this->_redirect('adminhtml/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Unable to delete website. Please, try again later.')); @@ -486,8 +486,8 @@ class Store extends Action $model->delete(); $this->messageManager->addSuccess(__('The store has been deleted.')); $this->_redirect('adminhtml/*/'); - return; - } catch (\Magento\Core\Exception $e) { + return ; + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Unable to delete store. Please, try again later.')); @@ -525,7 +525,7 @@ class Store extends Action $this->messageManager->addSuccess(__('The store view has been deleted.')); $this->_redirect('adminhtml/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Unable to delete store view. Please, try again later.')); @@ -571,7 +571,7 @@ class Store extends Action $backupDb->createBackup($backup); $this->messageManager->addSuccess(__('The database was backed up.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect($failPath, $arguments); return; diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php b/app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php index 6299fa82477..3b9cf64c05b 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php @@ -28,7 +28,7 @@ namespace Magento\Backend\Controller\Adminhtml; use Magento\Backend\App\Action; use Magento\Catalog\Model\Category; use Magento\Catalog\Model\Product; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Core\Model\Url\Rewrite; /** diff --git a/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php b/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php index df6c4d3abf4..09d40d40bed 100644 --- a/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php +++ b/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php @@ -26,7 +26,7 @@ namespace Magento\Backend\Helper\Dashboard; use Magento\Core\Helper\Data as HelperData; -use Magento\Core\Model\Resource\Db\Collection\AbstractCollection; +use Magento\Model\Resource\Db\Collection\AbstractCollection; /** * Adminhtml abstract dashboard helper. diff --git a/app/code/Magento/Backend/Model/Auth.php b/app/code/Magento/Backend/Model/Auth.php index a4bc8ce2be4..7816b3f9a94 100644 --- a/app/code/Magento/Backend/Model/Auth.php +++ b/app/code/Magento/Backend/Model/Auth.php @@ -185,7 +185,7 @@ class Auth array('user_name' => $username, 'exception' => $e) ); throw $e; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_eventManager->dispatch( 'backend_auth_user_login_failed', array('user_name' => $username, 'exception' => $e) diff --git a/app/code/Magento/Backend/Model/Auth/Exception.php b/app/code/Magento/Backend/Model/Auth/Exception.php index 82c208d0daa..3d854fb1ca6 100644 --- a/app/code/Magento/Backend/Model/Auth/Exception.php +++ b/app/code/Magento/Backend/Model/Auth/Exception.php @@ -32,6 +32,6 @@ namespace Magento\Backend\Model\Auth; * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Backend/Model/Config.php b/app/code/Magento/Backend/Model/Config.php index 2b73bb3a4ce..c9f44d9dccb 100644 --- a/app/code/Magento/Backend/Model/Config.php +++ b/app/code/Magento/Backend/Model/Config.php @@ -73,7 +73,7 @@ class Config extends \Magento\Object /** * TransactionFactory * - * @var \Magento\Core\Model\Resource\TransactionFactory + * @var \Magento\DB\TransactionFactory */ protected $_transactionFactory; @@ -100,7 +100,7 @@ class Config extends \Magento\Object * @param \Magento\App\ConfigInterface $config * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Backend\Model\Config\Structure $configStructure - * @param \Magento\Core\Model\Resource\TransactionFactory $transactionFactory + * @param \Magento\DB\TransactionFactory $transactionFactory * @param \Magento\Backend\Model\Config\Loader $configLoader * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -110,7 +110,7 @@ class Config extends \Magento\Object \Magento\App\ConfigInterface $config, \Magento\Event\ManagerInterface $eventManager, \Magento\Backend\Model\Config\Structure $configStructure, - \Magento\Core\Model\Resource\TransactionFactory $transactionFactory, + \Magento\DB\TransactionFactory $transactionFactory, \Magento\Backend\Model\Config\Loader $configLoader, \Magento\Core\Model\Config\ValueFactory $configValueFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -147,9 +147,9 @@ class Config extends \Magento\Object $oldConfig = $this->_getConfig(true); $deleteTransaction = $this->_transactionFactory->create(); - /* @var $deleteTransaction \Magento\Core\Model\Resource\Transaction */ + /* @var $deleteTransaction \Magento\DB\Transaction */ $saveTransaction = $this->_transactionFactory->create(); - /* @var $saveTransaction \Magento\Core\Model\Resource\Transaction */ + /* @var $saveTransaction \Magento\DB\Transaction */ // Extends for old config data $extraOldGroups = array(); @@ -199,8 +199,8 @@ class Config extends \Magento\Object * @param string $sectionPath * @param array &$extraOldGroups * @param array &$oldConfig - * @param \Magento\Core\Model\Resource\Transaction $saveTransaction - * @param \Magento\Core\Model\Resource\Transaction $deleteTransaction + * @param \Magento\DB\Transaction $saveTransaction + * @param \Magento\DB\Transaction $deleteTransaction * @return void */ protected function _processGroup( @@ -210,8 +210,8 @@ class Config extends \Magento\Object $sectionPath, array &$extraOldGroups, array &$oldConfig, - \Magento\Core\Model\Resource\Transaction $saveTransaction, - \Magento\Core\Model\Resource\Transaction $deleteTransaction + \Magento\DB\Transaction $saveTransaction, + \Magento\DB\Transaction $deleteTransaction ) { $groupPath = $sectionPath . '/' . $groupId; $website = $this->getWebsite(); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php index 2111d0acdf7..6f227aed02e 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php @@ -61,7 +61,7 @@ class Custom extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\App\Config\Storage\WriterInterface $configWriter - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -71,7 +71,7 @@ class Custom extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\App\Config\Storage\WriterInterface $configWriter, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php index 987ec37faa7..6e3a3e2e446 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php @@ -43,7 +43,7 @@ class Custompath extends \Magento\Core\Model\Config\Value protected function _beforeSave() { if ($this->getOldValue() != $this->getValue()) { - $this->_coreRegistry->register('custom_admin_path_redirect', true, true); + $this->_registry->register('custom_admin_path_redirect', true, true); } return $this; } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php index 51210e433cb..39bdd3248e5 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php @@ -47,9 +47,9 @@ class Observer protected $_authSession; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\ResponseInterface */ - protected $_app; + protected $_response; /** * @var \Magento\Core\Model\StoreManagerInterface @@ -60,20 +60,20 @@ class Observer * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Registry $coreRegistry * @param \Magento\Backend\Model\Auth\Session $authSession - * @param \Magento\Core\Model\App $app + * @param \Magento\App\ResponseInterface $response * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Backend\Helper\Data $backendData, \Magento\Registry $coreRegistry, \Magento\Backend\Model\Auth\Session $authSession, - \Magento\Core\Model\App $app, + \Magento\App\ResponseInterface $response, \Magento\Core\Model\StoreManagerInterface $storeManager ) { $this->_backendData = $backendData; $this->_coreRegistry = $coreRegistry; $this->_authSession = $authSession; - $this->_app = $app; + $this->_response = $response; $this->_storeManager = $storeManager; } @@ -93,9 +93,9 @@ class Observer $route = $this->_backendData->getAreaFrontName(); - $this->_app->getResponse()->setRedirect( - $this->_storeManager->getStore()->getBaseUrl() . $route - )->sendResponse(); + $this->_response + ->setRedirect($this->_storeManager->getStore()->getBaseUrl() . $route) + ->sendResponse(); exit(0); } } 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 7d2e550dc3e..04bf0c0e0ca 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php @@ -47,7 +47,7 @@ class Robots extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -57,7 +57,7 @@ class Robots extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php index d9649fd4ebb..15dca031687 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php @@ -45,7 +45,7 @@ class Usecustom extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\App\Config\Storage\WriterInterface $configWriter - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class Usecustom extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\App\Config\Storage\WriterInterface $configWriter, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -67,7 +67,7 @@ class Usecustom extends \Magento\Core\Model\Config\Value * Validate custom url * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -75,7 +75,7 @@ class Usecustom extends \Magento\Core\Model\Config\Value if ($value == 1) { $customUrl = $this->getData('groups/url/fields/custom/value'); if (empty($customUrl)) { - throw new \Magento\Core\Exception(__('Please specify the admin custom URL.')); + throw new \Magento\Model\Exception(__('Please specify the admin custom URL.')); } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php index a067e696abd..5c4274c14d6 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php @@ -42,7 +42,7 @@ class Usesecretkey extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Backend\Model\UrlInterface $backendUrl - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -52,7 +52,7 @@ class Usesecretkey extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Backend\Model\UrlInterface $backendUrl, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php b/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php index 8ef93b70896..972557ece80 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php @@ -36,7 +36,7 @@ class Baseurl extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\View\Asset\MergeService $mergeService - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -46,7 +46,7 @@ class Baseurl extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\View\Asset\MergeService $mergeService, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -58,7 +58,7 @@ class Baseurl extends \Magento\Core\Model\Config\Value * Validate a base URL field value * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -67,11 +67,11 @@ class Baseurl extends \Magento\Core\Model\Config\Value if (!$this->_validateUnsecure($value) && !$this->_validateSecure($value)) { $this->_validateFullyQualifiedUrl($value); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $field = $this->getFieldConfig(); $label = $field && is_array($field) ? $field['label'] : 'value'; $msg = __('Invalid %1. %2', $label, $e->getMessage()); - $error = new \Magento\Core\Exception($msg, 0, $e); + $error = new \Magento\Model\Exception($msg, 0, $e); throw $error; } } @@ -138,12 +138,12 @@ class Baseurl extends \Magento\Core\Model\Config\Value * @param array $values * @param string $value * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ private function _assertValuesOrUrl(array $values, $value) { if (!in_array($value, $values) && !$this->_isFullyQualifiedUrl($value)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Value must be a URL or one of placeholders: %1', implode(',', $values)) ); } @@ -155,14 +155,14 @@ class Baseurl extends \Magento\Core\Model\Config\Value * @param array $values * @param string $value * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ private function _assertStartsWithValuesOrUrl(array $values, $value) { $quoted = array_map('preg_quote', $values, array_fill(0, count($values), '/')); if (!preg_match('/^(' . implode('|', $quoted) . ')(.+\/)?$/', $value) && !$this->_isFullyQualifiedUrl($value) ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Specify a URL or path that starts with placeholder(s): %1, and ends with "/".', implode(', ', $values) @@ -177,7 +177,7 @@ class Baseurl extends \Magento\Core\Model\Config\Value * @param array $values * @param string $value * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ private function _assertStartsWithValuesOrUrlOrEmpty(array $values, $value) { @@ -186,9 +186,9 @@ class Baseurl extends \Magento\Core\Model\Config\Value } try { $this->_assertStartsWithValuesOrUrl($values, $value); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $msg = __('%1 An empty value is allowed as well.', $e->getMessage()); - $error = new \Magento\Core\Exception($msg, 0, $e); + $error = new \Magento\Model\Exception($msg, 0, $e); throw $error; } } @@ -198,12 +198,12 @@ class Baseurl extends \Magento\Core\Model\Config\Value * * @param string $value * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ private function _validateFullyQualifiedUrl($value) { if (!$this->_isFullyQualifiedUrl($value)) { - throw new \Magento\Core\Exception(__('Specify a fully qualified URL.')); + throw new \Magento\Model\Exception(__('Specify a fully qualified URL.')); } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php index 4031c6c4ac8..059904ef3c3 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php @@ -53,7 +53,7 @@ abstract class AbstractCurrency extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -63,7 +63,7 @@ abstract class AbstractCurrency extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php index ee85bbe1446..2154477dad9 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php @@ -44,7 +44,7 @@ class Allow extends AbstractCurrency * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Locale\CurrencyInterface $localeCurrency - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class Allow extends AbstractCurrency \Magento\App\ConfigInterface $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Locale\CurrencyInterface $localeCurrency, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -77,7 +77,7 @@ class Allow extends AbstractCurrency * Check allowed currencies is available in installed currencies * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _afterSave() { @@ -99,7 +99,7 @@ class Allow extends AbstractCurrency } if ($exceptions) { - throw new \Magento\Core\Exception(join("\n", $exceptions)); + throw new \Magento\Model\Exception(join("\n", $exceptions)); } return $this; diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Base.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Base.php index 06d08f84dd6..8776f5eeb83 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Base.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Base.php @@ -36,12 +36,12 @@ class Base extends AbstractCurrency * Check base currency is available in installed currencies * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _afterSave() { if (!in_array($this->getValue(), $this->_getInstalledCurrencies())) { - throw new \Magento\Core\Exception(__('Sorry, we haven\'t installed the base currency you selected.')); + throw new \Magento\Model\Exception(__('Sorry, we haven\'t installed the base currency you selected.')); } return $this; } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php index aebb63e6e4c..d564eef8ae7 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php @@ -44,7 +44,7 @@ class Cron extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -54,7 +54,7 @@ class Cron extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/DefaultCurrency.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/DefaultCurrency.php index 1822c25933f..95dd5c3304b 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/DefaultCurrency.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/DefaultCurrency.php @@ -37,18 +37,18 @@ class DefaultCurrency extends AbstractCurrency * Check default currency is available in allowed currencies * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _afterSave() { if (!in_array($this->getValue(), $this->_getInstalledCurrencies())) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Sorry, we haven\'t installed the default display currency you selected.') ); } if (!in_array($this->getValue(), $this->_getAllowedCurrencies())) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Sorry, the default display currency you selected in not available in allowed currencies.') ); } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php b/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php index 40de02605ac..eb67af0d76a 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php @@ -29,7 +29,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Email; -use Magento\Core\Exception; +use Magento\Model\Exception; class Address extends \Magento\Core\Model\Config\Value { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php b/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php index a9643614b9c..4fa9d9e57aa 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php @@ -35,19 +35,19 @@ class Sender extends \Magento\Core\Model\Config\Value * Check sender name validity * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { $value = $this->getValue(); if (!preg_match("/^[\S ]+$/", $value)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The sender name "%1" is not valid. Please use only visible characters and spaces.', $value) ); } if (strlen($value) > 255) { - throw new \Magento\Core\Exception(__('Maximum sender name length is 255. Please correct your settings.')); + throw new \Magento\Model\Exception(__('Maximum sender name length is 255. Please correct your settings.')); } return $this; } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php index f1a927c37d5..d418f55fb65 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php @@ -40,7 +40,7 @@ class Encrypted extends \Magento\Core\Model\Config\Value implements \Magento\App * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Encryption\EncryptorInterface $encryptor - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -50,7 +50,7 @@ class Encrypted extends \Magento\Core\Model\Config\Value implements \Magento\App \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Encryption\EncryptorInterface $encryptor, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/File.php b/app/code/Magento/Backend/Model/Config/Backend/File.php index 343960f2386..b89281cc29b 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/File.php +++ b/app/code/Magento/Backend/Model/Config/Backend/File.php @@ -67,7 +67,7 @@ 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\App\Filesystem $filesystem - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -79,7 +79,7 @@ class File extends \Magento\Core\Model\Config\Value \Magento\Core\Model\File\UploaderFactory $uploaderFactory, \Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface $requestData, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -94,7 +94,7 @@ class File extends \Magento\Core\Model\Config\Value * Save uploaded file before saving config value * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -117,7 +117,7 @@ class File extends \Magento\Core\Model\Config\Value $uploader->addValidateCallback('size', $this, 'validateMaxSize'); $result = $uploader->save($uploadDir); } catch (\Exception $e) { - throw new \Magento\Core\Exception($e->getMessage()); + throw new \Magento\Model\Exception($e->getMessage()); } $filename = $result['file']; @@ -143,7 +143,7 @@ class File extends \Magento\Core\Model\Config\Value * * @param string $filePath Path to temporary uploaded file * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validateMaxSize($filePath) { @@ -152,7 +152,7 @@ class File extends \Magento\Core\Model\Config\Value $directory->getRelativePath($filePath) )['size'] > $this->_maxFileSize * 1024 ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The file you\'re uploading exceeds the server size limit of %1 kilobytes.', $this->_maxFileSize) ); } @@ -174,7 +174,7 @@ class File extends \Magento\Core\Model\Config\Value * Return path to directory for upload file * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getUploadDir() { @@ -182,7 +182,7 @@ class File extends \Magento\Core\Model\Config\Value /* @var $fieldConfig \Magento\Simplexml\Element */ if (!array_key_exists('upload_dir', $fieldConfig)) { - throw new \Magento\Core\Exception(__('The base directory to upload file is not specified.')); + throw new \Magento\Model\Exception(__('The base directory to upload file is not specified.')); } if (is_array($fieldConfig['upload_dir'])) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php b/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php index a9fc8488f21..fbbbf9c28da 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php @@ -47,7 +47,7 @@ class Adapter extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Image\AdapterFactory $imageFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -57,7 +57,7 @@ class Adapter extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Image\AdapterFactory $imageFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -68,7 +68,7 @@ class Adapter extends \Magento\Core\Model\Config\Value /** * Checks if chosen image adapter available * - * @throws \Magento\Core\Exception If some of adapter dependencies was not loaded + * @throws \Magento\Model\Exception If some of adapter dependencies was not loaded * @return \Magento\Backend\Model\Config\Backend\File */ protected function _beforeSave() @@ -77,7 +77,7 @@ class Adapter extends \Magento\Core\Model\Config\Value $this->_imageFactory->create($this->getValue()); } catch (\Exception $e) { $message = __('The specified image adapter cannot be used because of: ' . $e->getMessage()); - throw new \Magento\Core\Exception($message); + throw new \Magento\Model\Exception($message); } return $this; 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 7ba10cef12b..647a96dda7d 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Image/Favicon.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Image/Favicon.php @@ -41,7 +41,7 @@ class Favicon extends \Magento\Backend\Model\Config\Backend\Image * Return path to directory for upload file * * @return string - * @throw \Magento\Core\Exception + * @throw \Magento\Model\Exception */ protected function _getUploadDir() { 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 537981da703..7622de5e097 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Image/Logo.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Image/Logo.php @@ -41,7 +41,7 @@ class Logo extends \Magento\Backend\Model\Config\Backend\Image * Return path to directory for upload file * * @return string - * @throw \Magento\Core\Exception + * @throw \Magento\Model\Exception */ protected function _getUploadDir() { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Locale.php b/app/code/Magento/Backend/Model/Config/Backend/Locale.php index 9b51050c250..14d3714fa52 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Locale.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Locale.php @@ -60,7 +60,7 @@ class Locale extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\Website\Factory $websiteFactory * @param \Magento\Core\Model\StoreFactory $storeFactory * @param \Magento\Locale\CurrencyInterface $localeCurrency - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data * @@ -75,7 +75,7 @@ class Locale extends \Magento\Core\Model\Config\Value \Magento\Core\Model\Website\Factory $websiteFactory, \Magento\Core\Model\StoreFactory $storeFactory, \Magento\Locale\CurrencyInterface $localeCurrency, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -88,7 +88,7 @@ class Locale extends \Magento\Core\Model\Config\Value /** * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _afterSave() { @@ -137,7 +137,7 @@ class Locale extends \Magento\Core\Model\Config\Value } } if ($exceptions) { - throw new \Magento\Core\Exception(join("\n", $exceptions)); + throw new \Magento\Model\Exception(join("\n", $exceptions)); } return $this; diff --git a/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php b/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php index d597f97925d..144a11eee41 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php @@ -29,7 +29,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Locale; -use Magento\Core\Exception; +use Magento\Model\Exception; class Timezone extends \Magento\Core\Model\Config\Value { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php b/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php index d2852cb7eac..a4a0a725b3b 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php @@ -51,7 +51,7 @@ class Cron extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string $runModelPath * @param array $data @@ -62,7 +62,7 @@ class Cron extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $runModelPath = '', array $data = array() @@ -76,7 +76,7 @@ class Cron extends \Magento\Core\Model\Config\Value * Cron settings after save * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _afterSave() { @@ -111,7 +111,7 @@ class Cron extends \Magento\Core\Model\Config\Value $configValue->load(self::CRON_MODEL_PATH, 'path'); $configValue->setValue($this->_runModelPath)->setPath(self::CRON_MODEL_PATH)->save(); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('We can\'t save the Cron expression.')); + throw new \Magento\Model\Exception(__('We can\'t save the Cron expression.')); } } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Secure.php b/app/code/Magento/Backend/Model/Config/Backend/Secure.php index 381035a2b3b..91742ff6a4b 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Secure.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Secure.php @@ -36,7 +36,7 @@ class Secure extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\View\Asset\MergeService $mergeService - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -46,7 +46,7 @@ class Secure extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\View\Asset\MergeService $mergeService, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php b/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php index ff7fdadb17b..b4dbe01c9b2 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php @@ -40,7 +40,7 @@ class Database extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Helper\File\Storage $coreFileStorage - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -50,7 +50,7 @@ class Database extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Helper\File\Storage $coreFileStorage, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Translate.php b/app/code/Magento/Backend/Model/Config/Backend/Translate.php index 9eb8cb2a180..46fa8c0a74e 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Translate.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Translate.php @@ -59,7 +59,7 @@ class Translate extends \Magento\Core\Model\Config\Value * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\App\Cache\TypeListInterface $cacheTypeList - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -70,7 +70,7 @@ class Translate extends \Magento\Core\Model\Config\Value \Magento\App\ConfigInterface $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\App\Cache\TypeListInterface $cacheTypeList, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Structure/Element/Group.php b/app/code/Magento/Backend/Model/Config/Structure/Element/Group.php index 98b1a95cc07..f6832e85d87 100644 --- a/app/code/Magento/Backend/Model/Config/Structure/Element/Group.php +++ b/app/code/Magento/Backend/Model/Config/Structure/Element/Group.php @@ -70,13 +70,13 @@ class Group extends AbstractComposite /** * Retrieve clone model * - * @return \Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return \Magento\Model\AbstractModel + * @throws \Magento\Model\Exception */ public function getCloneModel() { if (!isset($this->_data['clone_model']) || !$this->_data['clone_model']) { - throw new \Magento\Core\Exception('Config form fieldset clone model required to be able to clone fields'); + throw new \Magento\Model\Exception('Config form fieldset clone model required to be able to clone fields'); } return $this->_cloneModelFactory->create($this->_data['clone_model']); } diff --git a/app/code/Magento/Backend/Model/Config/Structure/Element/Group/Proxy.php b/app/code/Magento/Backend/Model/Config/Structure/Element/Group/Proxy.php index 80d75266460..51d5d9af5ea 100644 --- a/app/code/Magento/Backend/Model/Config/Structure/Element/Group/Proxy.php +++ b/app/code/Magento/Backend/Model/Config/Structure/Element/Group/Proxy.php @@ -187,7 +187,7 @@ class Proxy extends \Magento\Backend\Model\Config\Structure\Element\Group /** * Retrieve clone model * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ public function getCloneModel() { diff --git a/app/code/Magento/Backend/Model/Locale/Manager.php b/app/code/Magento/Backend/Model/Locale/Manager.php index fe9d0ecc995..7483b085a0e 100644 --- a/app/code/Magento/Backend/Model/Locale/Manager.php +++ b/app/code/Magento/Backend/Model/Locale/Manager.php @@ -78,7 +78,7 @@ class Manager $this->_authSession->getUser()->setInterfaceLocale($localeCode); - $this->_translator->setLocale($localeCode)->init(null, true); + $this->_translator->setLocale($localeCode)->loadData(null, true); return $this; } diff --git a/app/code/Magento/Backend/Model/Locale/Resolver.php b/app/code/Magento/Backend/Model/Locale/Resolver.php index 958b7d16a3f..31f6a1a19de 100644 --- a/app/code/Magento/Backend/Model/Locale/Resolver.php +++ b/app/code/Magento/Backend/Model/Locale/Resolver.php @@ -52,7 +52,7 @@ class Resolver extends \Magento\Locale\Resolver /** * @param \Magento\Locale\ScopeConfigInterface $scopeConfig - * @param \Magento\AppInterface $app + * @param \Magento\App\CacheInterface $cache * @param \Magento\LocaleFactory $localeFactory * @param string $defaultLocalePath * @param \Magento\ObjectManager $objectManager @@ -60,11 +60,11 @@ class Resolver extends \Magento\Locale\Resolver * @param Manager $localeManager * @param \Magento\App\RequestInterface $request * @param \Magento\Locale\Validator $localeValidator - * @param string|null $locale + * @param null $locale */ public function __construct( \Magento\Locale\ScopeConfigInterface $scopeConfig, - \Magento\AppInterface $app, + \Magento\App\CacheInterface $cache, \Magento\LocaleFactory $localeFactory, $defaultLocalePath, \Magento\ObjectManager $objectManager, @@ -78,7 +78,7 @@ class Resolver extends \Magento\Locale\Resolver $this->_localeManager = $localeManager; $this->_request = $request; $this->_localeValidator = $localeValidator; - parent::__construct($scopeConfig, $app, $localeFactory, $defaultLocalePath, $locale); + parent::__construct($scopeConfig, $cache, $localeFactory, $defaultLocalePath, $locale); } /** diff --git a/app/code/Magento/Backend/Model/Observer.php b/app/code/Magento/Backend/Model/Observer.php index 65c34dcf355..652bdf5e2b8 100644 --- a/app/code/Magento/Backend/Model/Observer.php +++ b/app/code/Magento/Backend/Model/Observer.php @@ -36,9 +36,9 @@ class Observer protected $_backendSession; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\CacheInterface */ - protected $_app; + protected $cache; /** * @var \Magento\App\RequestInterface @@ -46,17 +46,17 @@ class Observer protected $_request; /** - * @param \Magento\Backend\Model\Session $backendSession - * @param \Magento\Core\Model\App $app + * @param Session $backendSession + * @param \Magento\App\CacheInterface $cache * @param \Magento\App\RequestInterface $request */ public function __construct( \Magento\Backend\Model\Session $backendSession, - \Magento\Core\Model\App $app, + \Magento\App\CacheInterface $cache, \Magento\App\RequestInterface $request ) { $this->_backendSession = $backendSession; - $this->_app = $app; + $this->cache = $cache; $this->_request = $request; } @@ -88,16 +88,6 @@ class Observer return $this; } - /** - * Backend will always use base class for translation. - * - * @return $this - */ - public function initializeTranslation() - { - return $this; - } - /** * Set url class name for store 'admin' * @@ -115,7 +105,7 @@ class Observer break; } } - $this->_app->removeCache( + $this->cache->remove( \Magento\AdminNotification\Model\System\Message\Security::VERIFICATION_RESULT_CACHE_KEY ); return $this; diff --git a/app/code/Magento/Backend/Model/Translate.php b/app/code/Magento/Backend/Model/Translate.php deleted file mode 100644 index 54ab6a1e87c..00000000000 --- a/app/code/Magento/Backend/Model/Translate.php +++ /dev/null @@ -1,43 +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 - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Backend\Model; - -class Translate extends \Magento\Translate implements \Magento\TranslateInterface -{ - /** - * {@inheritdoc} - */ - public function init($area = null, $initParams = null, $forceReload = false) - { - parent::init($area, $initParams, $forceReload); - $scope = null; - if ($this->getConfig(self::CONFIG_KEY_AREA) == \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { - $scope = 'admin'; - } - $this->_translateInline = $this->getInlineObject($initParams)->isAllowed($scope); - return $this; - } -} diff --git a/app/code/Magento/Backend/Model/Url.php b/app/code/Magento/Backend/Model/Url.php index a1709086643..26fa44a8f6f 100644 --- a/app/code/Magento/Backend/Model/Url.php +++ b/app/code/Magento/Backend/Model/Url.php @@ -219,8 +219,8 @@ class Url extends \Magento\Url implements \Magento\Backend\Model\UrlInterface return $result; } $routeName = $this->_getRouteName('*'); - $controllerName = $this->_getControllerName($this->_getDefaultControllerName()); - $actionName = $this->_getActionName($this->_getDefaultActionName()); + $controllerName = $this->_getControllerName(self::DEFAULT_CONTROLLER_NAME); + $actionName = $this->_getActionName(self::DEFAULT_ACTION_NAME); if ($cacheSecretKey) { $secret = array(self::SECRET_KEY_PARAM_NAME => "\${$routeName}/{$controllerName}/{$actionName}\$"); } else { diff --git a/app/code/Magento/Backend/etc/adminhtml/di.xml b/app/code/Magento/Backend/etc/adminhtml/di.xml index 5020afe02ea..97a4d138a58 100644 --- a/app/code/Magento/Backend/etc/adminhtml/di.xml +++ b/app/code/Magento/Backend/etc/adminhtml/di.xml @@ -33,18 +33,9 @@ <preference for="Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface" type="Magento\Backend\Model\Config\Backend\File\RequestData" /> <preference for="Magento\App\DefaultPathInterface" type="Magento\Backend\App\DefaultPath" /> <preference for="Magento\Backend\App\ConfigInterface" type="Magento\Backend\App\Config" /> - <preference for="Magento\Translate\Inline\ConfigFactory" type="Magento\Backend\Model\Translate\Inline\ConfigFactory" /> - <preference for="Magento\Translate\InlineInterface" type="Magento\Backend\Model\Translate\Inline" /> - <preference for="Magento\Core\Model\Resource\Translate\String" type="Magento\Backend\Model\Resource\Translate\String" /> - <preference for="Magento\Core\Model\Resource\Translate" type="Magento\Backend\Model\Resource\Translate" /> <preference for="Magento\App\Response\Http\FileFactory" type="Magento\Backend\App\Response\Http\FileFactory" /> <preference for="Magento\App\View" type="Magento\Backend\Model\View" /> - <type name="Magento\Backend\Model\Translate\Inline"> - <arguments> - <argument name="url" xsi:type="object">Magento\Backend\Model\UrlInterface</argument> - <argument name="templateFileName" xsi:type="string">Magento_Core::translate_inline.phtml</argument> - </arguments> - </type> + <preference for="Magento\Model\ActionValidator\RemoveAction" type="Magento\Model\ActionValidator\RemoveAction\Allowed" /> <type name="Magento\Backend\App\Action\Context"> <arguments> <argument name="helper" xsi:type="object">Magento\Backend\Helper\Data</argument> diff --git a/app/code/Magento/Backend/etc/adminhtml/events.xml b/app/code/Magento/Backend/etc/adminhtml/events.xml index a1cd9739d70..40b0a29b74b 100644 --- a/app/code/Magento/Backend/etc/adminhtml/events.xml +++ b/app/code/Magento/Backend/etc/adminhtml/events.xml @@ -24,9 +24,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/Event/etc/events.xsd"> - <event name="translate_initialization_before"> - <observer name="initialize_translation" instance="Magento\Backend\Model\Observer" method="initializeTranslation" /> - </event> <event name="admin_system_config_changed_section_admin"> <observer name="bind_locale" instance="Magento\Backend\Model\Config\Backend\Admin\Observer" method="afterCustomUrlChanged" /> </event> diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index ff850688e90..504cd165213 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -509,7 +509,7 @@ </field> </group> <group id="seo" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1"> - <label>Search Engines Optimization</label> + <label>Search Engine Optimization</label> <field id="use_rewrites" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Use Web Server Rewrites</label> <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> diff --git a/app/code/Magento/Backend/view/adminhtml/page/footer.phtml b/app/code/Magento/Backend/view/adminhtml/page/footer.phtml index d5348c5e73c..463dfe44548 100644 --- a/app/code/Magento/Backend/view/adminhtml/page/footer.phtml +++ b/app/code/Magento/Backend/view/adminhtml/page/footer.phtml @@ -25,4 +25,4 @@ */ ?> <?php echo $this->getChildHtml('copyright');?> / -<?php echo __('Magento ver. %1', \Magento\Core\Model\App::VERSION) ?> +<?php echo __('Magento ver. %1', \Magento\AppInterface::VERSION) ?> diff --git a/app/code/Magento/Backup/Model/Backup.php b/app/code/Magento/Backup/Model/Backup.php index a0361266539..73fe2544884 100644 --- a/app/code/Magento/Backup/Model/Backup.php +++ b/app/code/Magento/Backup/Model/Backup.php @@ -241,12 +241,12 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa * * @param string &$content * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setFile(&$content) { if (!$this->hasData('time') || !$this->hasData('type') || !$this->hasData('path')) { - throw new \Magento\Core\Exception(__('Please correct the order of creation for a new backup.')); + throw new \Magento\Model\Exception(__('Please correct the order of creation for a new backup.')); } $this->varDirectory->writeFile($this->_getFilePath(), $content); @@ -257,12 +257,12 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa * Return content of backup file * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function &getFile() { if (!$this->exists()) { - throw new \Magento\Core\Exception(__("The backup file does not exist.")); + throw new \Magento\Model\Exception(__("The backup file does not exist.")); } return $this->varDirectory->read($this->_getFilePath()); @@ -272,12 +272,12 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa * Delete backup file * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function deleteFile() { if (!$this->exists()) { - throw new \Magento\Core\Exception(__("The backup file does not exist.")); + throw new \Magento\Model\Exception(__("The backup file does not exist.")); } $this->varDirectory->delete($this->_getFilePath()); diff --git a/app/code/Magento/Backup/Model/Config/Backend/Cron.php b/app/code/Magento/Backup/Model/Config/Backend/Cron.php index 5d5470c055b..091966d59b3 100644 --- a/app/code/Magento/Backup/Model/Config/Backend/Cron.php +++ b/app/code/Magento/Backup/Model/Config/Backend/Cron.php @@ -56,7 +56,7 @@ class Cron extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string $runModelPath * @param array $data @@ -67,7 +67,7 @@ class Cron extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $runModelPath = '', array $data = array() @@ -81,7 +81,7 @@ class Cron extends \Magento\Core\Model\Config\Value * Cron settings after save * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _afterSave() { @@ -124,7 +124,7 @@ class Cron extends \Magento\Core\Model\Config\Value self::CRON_MODEL_PATH )->save(); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('We can\'t save the Cron expression.')); + throw new \Magento\Model\Exception(__('We can\'t save the Cron expression.')); } } } diff --git a/app/code/Magento/Backup/Model/Resource/Helper.php b/app/code/Magento/Backup/Model/Resource/Helper.php index 1d1f6eaec52..515962267f0 100644 --- a/app/code/Magento/Backup/Model/Resource/Helper.php +++ b/app/code/Magento/Backup/Model/Resource/Helper.php @@ -25,7 +25,7 @@ */ namespace Magento\Backup\Model\Resource; -class Helper extends \Magento\Core\Model\Resource\Helper +class Helper extends \Magento\DB\Helper { /** * Tables foreign key data array @@ -44,13 +44,13 @@ class Helper extends \Magento\Core\Model\Resource\Helper /** * @param \Magento\App\Resource $resource - * @param \Magento\Stdlib\DateTime\DateTime $coreDate * @param string $modulePrefix + * @param \Magento\Stdlib\DateTime\DateTime $coreDate */ public function __construct( \Magento\App\Resource $resource, - \Magento\Stdlib\DateTime\DateTime $coreDate, - $modulePrefix + $modulePrefix, + \Magento\Stdlib\DateTime\DateTime $coreDate ) { parent::__construct($resource, $modulePrefix); $this->_coreDate = $coreDate; diff --git a/app/code/Magento/Backup/etc/di.xml b/app/code/Magento/Backup/etc/di.xml index e89935b6b1c..39b3fae54cc 100644 --- a/app/code/Magento/Backup/etc/di.xml +++ b/app/code/Magento/Backup/etc/di.xml @@ -30,4 +30,9 @@ <argument name="backupDbInstanceName" xsi:type="string">Magento\Backup\Model\Db</argument> </arguments> </type> + <type name="Magento\Backup\Model\Resource\Helper"> + <arguments> + <argument name="modulePrefix" xsi:type="string">backup</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php index 681e12accce..38700b9497b 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,17 +74,7 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView protected $_localeFormat; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param \Magento\Catalog\Helper\Product $catalogProduct * @param \Magento\Bundle\Model\Product\PriceFactory $productPrice @@ -93,21 +83,9 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView * @param \Magento\Locale\FormatInterface $localeFormat * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Catalog\Helper\Product $catalogProduct, \Magento\Bundle\Model\Product\PriceFactory $productPrice, @@ -124,16 +102,6 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView $this->_localeFormat = $localeFormat; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $arrayUtils, $data, $priceBlockTypes diff --git a/app/code/Magento/Bundle/Model/Option.php b/app/code/Magento/Bundle/Model/Option.php index 026c53e7d36..5464b305366 100644 --- a/app/code/Magento/Bundle/Model/Option.php +++ b/app/code/Magento/Bundle/Model/Option.php @@ -43,7 +43,7 @@ namespace Magento\Bundle\Model; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\AbstractModel +class Option extends \Magento\Model\AbstractModel { /** * Default selection object diff --git a/app/code/Magento/Bundle/Model/Price/Index.php b/app/code/Magento/Bundle/Model/Price/Index.php index 2ecd422d0bd..7020138f472 100644 --- a/app/code/Magento/Bundle/Model/Price/Index.php +++ b/app/code/Magento/Bundle/Model/Price/Index.php @@ -43,7 +43,7 @@ namespace Magento\Bundle\Model\Price; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Index extends \Magento\Core\Model\AbstractModel +class Index extends \Magento\Model\AbstractModel { /** * @var \Magento\Customer\Model\Session @@ -60,7 +60,7 @@ class Index extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -69,7 +69,7 @@ class Index extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Session $customerSession, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index 074b7564993..fe2da754230 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -1062,7 +1062,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType * * @param \Magento\Catalog\Model\Product $product * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function checkProductBuyState($product) { @@ -1076,7 +1076,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType $bundleOption = $buyRequest->getBundleOption(); if (empty($bundleOption)) { - throw new \Magento\Core\Exception($this->getSpecifyOptionMessage()); + throw new \Magento\Model\Exception($this->getSpecifyOptionMessage()); } $skipSaleableCheck = $this->_catalogProduct->getSkipSaleableCheck(); @@ -1084,7 +1084,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType /* @var $selection \Magento\Bundle\Model\Selection */ $selection = $productSelections->getItemById($selectionId); if (!$selection || !$selection->isSalable() && !$skipSaleableCheck) { - throw new \Magento\Core\Exception(__('The required options you selected are not available.')); + throw new \Magento\Model\Exception(__('The required options you selected are not available.')); } } @@ -1092,7 +1092,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType $optionsCollection = $this->getOptionsCollection($product); foreach ($optionsCollection->getItems() as $option) { if ($option->getRequired() && empty($bundleOption[$option->getId()])) { - throw new \Magento\Core\Exception(__('Please select all required options.')); + throw new \Magento\Model\Exception(__('Please select all required options.')); } } diff --git a/app/code/Magento/Bundle/Model/Resource/Bundle.php b/app/code/Magento/Bundle/Model/Resource/Bundle.php index 7c2b4576fd5..63ee5c19978 100644 --- a/app/code/Magento/Bundle/Model/Resource/Bundle.php +++ b/app/code/Magento/Bundle/Model/Resource/Bundle.php @@ -32,7 +32,7 @@ namespace Magento\Bundle\Model\Resource; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Bundle extends \Magento\Core\Model\Resource\Db\AbstractDb +class Bundle extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Catalog\Model\Resource\Product\Relation diff --git a/app/code/Magento/Bundle/Model/Resource/Option.php b/app/code/Magento/Bundle/Model/Resource/Option.php index f6f8bb574ee..3792f0201bf 100644 --- a/app/code/Magento/Bundle/Model/Resource/Option.php +++ b/app/code/Magento/Bundle/Model/Resource/Option.php @@ -32,7 +32,7 @@ namespace Magento\Bundle\Model\Resource; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\Resource\Db\AbstractDb +class Option extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define resource @@ -47,10 +47,10 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb /** * After save process * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { parent::_afterSave($object); @@ -83,10 +83,10 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb /** * After delete process * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $object) + protected function _afterDelete(\Magento\Model\AbstractModel $object) { parent::_afterDelete($object); diff --git a/app/code/Magento/Bundle/Model/Resource/Option/Collection.php b/app/code/Magento/Bundle/Model/Resource/Option/Collection.php index d20c94aed58..899f4041136 100644 --- a/app/code/Magento/Bundle/Model/Resource/Option/Collection.php +++ b/app/code/Magento/Bundle/Model/Resource/Option/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Bundle\Model\Resource\Option; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * All item ids cache diff --git a/app/code/Magento/Bundle/Model/Resource/Price/Index.php b/app/code/Magento/Bundle/Model/Resource/Price/Index.php index 04029a978ca..52f0c99b317 100644 --- a/app/code/Magento/Bundle/Model/Resource/Price/Index.php +++ b/app/code/Magento/Bundle/Model/Resource/Price/Index.php @@ -34,7 +34,7 @@ use Magento\Core\Model\Website; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Index extends \Magento\Core\Model\Resource\Db\AbstractDb +class Index extends \Magento\Model\Resource\Db\AbstractDb { /** * EAV attributes cache diff --git a/app/code/Magento/Bundle/Model/Resource/Selection.php b/app/code/Magento/Bundle/Model/Resource/Selection.php index 66059fdfaf5..255fd649a15 100644 --- a/app/code/Magento/Bundle/Model/Resource/Selection.php +++ b/app/code/Magento/Bundle/Model/Resource/Selection.php @@ -32,7 +32,7 @@ namespace Magento\Bundle\Model\Resource; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Selection extends \Magento\Core\Model\Resource\Db\AbstractDb +class Selection extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table and id field 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 a42c33d027f..63c0394f724 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 @@ -44,7 +44,7 @@ class Creditmemo extends AbstractItems * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class Creditmemo extends AbstractItems \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { 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 61ddb577cd6..b90de45336f 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 @@ -42,7 +42,7 @@ class Invoice extends AbstractItems * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\String $coreString - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -53,7 +53,7 @@ class Invoice extends AbstractItems \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\String $coreString, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { 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 0c149eb00fa..cf251864bd0 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 @@ -42,7 +42,7 @@ class Shipment extends AbstractItems * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -53,7 +53,7 @@ class Shipment extends AbstractItems \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Bundle/Model/Selection.php b/app/code/Magento/Bundle/Model/Selection.php index 7239def712f..8bd37643bbe 100644 --- a/app/code/Magento/Bundle/Model/Selection.php +++ b/app/code/Magento/Bundle/Model/Selection.php @@ -53,7 +53,7 @@ namespace Magento\Bundle\Model; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Selection extends \Magento\Core\Model\AbstractModel +class Selection extends \Magento\Model\AbstractModel { /** * Catalog data diff --git a/app/code/Magento/Bundle/etc/module.xml b/app/code/Magento/Bundle/etc/module.xml index fe55593090b..6970d552804 100644 --- a/app/code/Magento/Bundle/etc/module.xml +++ b/app/code/Magento/Bundle/etc/module.xml @@ -42,7 +42,6 @@ <module name="Magento_Weee"/> <module name="Magento_GiftMessage"/> <module name="Magento_Theme"/> - <module name="Magento_Wishlist"/> </depends> </module> </config> diff --git a/app/code/Magento/Captcha/Model/Resource/Log.php b/app/code/Magento/Captcha/Model/Resource/Log.php index e43ca63d136..b291cf70ec4 100644 --- a/app/code/Magento/Captcha/Model/Resource/Log.php +++ b/app/code/Magento/Captcha/Model/Resource/Log.php @@ -30,7 +30,7 @@ namespace Magento\Captcha\Model\Resource; * * @author Magento Core Team <core@magentocommerce.com> */ -class Log extends \Magento\Core\Model\Resource\Db\AbstractDb +class Log extends \Magento\Model\Resource\Db\AbstractDb { /** * Type Remote Address diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php index f3fdc8cafb6..23604b12a1c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php @@ -60,9 +60,9 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory protected $_backendSession; /** - * @var \Magento\Core\Model\Resource\HelperPool + * @var \Magento\DB\Helper */ - protected $_helperPool; + protected $_resourceHelper; /** * @var \Magento\Json\EncoderInterface @@ -71,10 +71,10 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\Resource\Category\Tree $categoryTree * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\HelperPool $helperPool + * @param \Magento\Json\EncoderInterface $jsonEncoder + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Backend\Model\Auth\Session $backendSession * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param array $data @@ -84,13 +84,13 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory \Magento\Catalog\Model\Resource\Category\Tree $categoryTree, \Magento\Registry $registry, \Magento\Json\EncoderInterface $jsonEncoder, - \Magento\Core\Model\Resource\HelperPool $helperPool, + \Magento\DB\Helper $resourceHelper, \Magento\Backend\Model\Auth\Session $backendSession, \Magento\Catalog\Model\CategoryFactory $categoryFactory, array $data = array() ) { $this->_jsonEncoder = $jsonEncoder; - $this->_helperPool = $helperPool; + $this->_resourceHelper = $resourceHelper; $this->_backendSession = $backendSession; $this->_categoryFactory = $categoryFactory; parent::__construct($context, $categoryTree, $registry, $data); @@ -201,9 +201,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory $collection = $this->_categoryFactory->create()->getCollection(); $matchingNamesCollection = clone $collection; - $escapedNamePart = $this->_helperPool->get( - 'Magento_Core' - )->addLikeEscape( + $escapedNamePart = $this->_resourceHelper->addLikeEscape( $namePart, array('position' => 'any') ); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php index 808f8d838b6..8da558b3c95 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php @@ -48,25 +48,25 @@ class Search extends \Magento\Backend\Block\Widget protected $_collectionFactory; /** - * @var \Magento\Core\Model\Resource\HelperPool + * @var \Magento\DB\Helper */ - protected $_helperPool; + protected $_resourceHelper; /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Model\Resource\HelperPool $helperPool + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory * @param \Magento\Registry $registry * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Core\Model\Resource\HelperPool $helperPool, + \Magento\DB\Helper $resourceHelper, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory, \Magento\Registry $registry, array $data = array() ) { - $this->_helperPool = $helperPool; + $this->_resourceHelper = $resourceHelper; $this->_collectionFactory = $collectionFactory; $this->_coreRegistry = $registry; parent::__construct($context, $data); @@ -107,9 +107,7 @@ class Search extends \Magento\Backend\Block\Widget */ public function getSuggestedAttributes($labelPart, $templateId = null) { - $escapedLabelPart = $this->_helperPool->get( - 'Magento_Core' - )->addLikeEscape( + $escapedLabelPart = $this->_resourceHelper->addLikeEscape( $labelPart, array('position' => 'any') ); 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 c006116ed81..649be1e5394 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 @@ -18,23 +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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price; +use Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group\AbstractGroup; /** * Adminhtml group price item renderer - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price; - -class Group extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group\AbstractGroup +class Group extends AbstractGroup { /** * @var string 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 c14dce706c3..905da4d583e 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 @@ -18,23 +18,19 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Adminhtml * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group; + +use Magento\Backend\Block\Widget; +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; +use Magento\Data\Form\Element\Renderer\RendererInterface; /** * Adminhtml group price item abstract renderer - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group; - -abstract class AbstractGroup extends \Magento\Backend\Block\Widget implements - \Magento\Data\Form\Element\Renderer\RendererInterface +abstract class AbstractGroup extends Widget implements RendererInterface { /** * Form element instance @@ -77,13 +73,13 @@ abstract class AbstractGroup extends \Magento\Backend\Block\Widget implements protected $_directoryHelper; /** - * @var \Magento\Customer\Model\GroupFactory + * @var CustomerGroupServiceInterface */ - protected $_groupFactory; + protected $_groupService; /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Customer\Model\GroupFactory $groupFactory + * @param CustomerGroupServiceInterface $groupService * @param \Magento\Directory\Helper\Data $directoryHelper * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Registry $registry @@ -91,13 +87,13 @@ abstract class AbstractGroup extends \Magento\Backend\Block\Widget implements */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Customer\Model\GroupFactory $groupFactory, + CustomerGroupServiceInterface $groupService, \Magento\Directory\Helper\Data $directoryHelper, \Magento\Catalog\Helper\Data $catalogData, \Magento\Registry $registry, array $data = array() ) { - $this->_groupFactory = $groupFactory; + $this->_groupService = $groupService; $this->_directoryHelper = $directoryHelper; $this->_catalogData = $catalogData; $this->_coreRegistry = $registry; @@ -194,12 +190,11 @@ abstract class AbstractGroup extends \Magento\Backend\Block\Widget implements if (!$this->_catalogData->isModuleEnabled('Magento_Customer')) { return array(); } - $collection = $this->_groupFactory->create()->getCollection(); + $groups = $this->_groupService->getGroups(); $this->_customerGroups = $this->_getInitialCustomerGroups(); - foreach ($collection as $item) { - /** @var $item \Magento\Customer\Model\Group */ - $this->_customerGroups[$item->getId()] = $item->getCustomerGroupCode(); + foreach ($groups as $group) { + $this->_customerGroups[$group->getId()] = $group->getCode(); } } @@ -288,7 +283,7 @@ abstract class AbstractGroup extends \Magento\Backend\Block\Widget implements */ public function getDefaultCustomerGroup() { - return \Magento\Customer\Model\Group::CUST_GROUP_ALL; + return CustomerGroupServiceInterface::CUST_GROUP_ALL; } /** 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 9187dfbb806..e5d093d295f 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 @@ -18,22 +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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price; + +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; /** * Adminhtml tier price item renderer - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price; - -class Tier extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group\AbstractGroup +class Tier extends Group\AbstractGroup { /** * @var string @@ -47,7 +42,7 @@ class Tier extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group */ protected function _getInitialCustomerGroups() { - return array(\Magento\Customer\Model\Group::CUST_GROUP_ALL => __('ALL GROUPS')); + return array(CustomerGroupServiceInterface::CUST_GROUP_ALL => __('ALL GROUPS')); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php index 2e4b6b05592..d8f0791bdc5 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php @@ -82,15 +82,15 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs protected $_translateInline; /** - * @param \Magento\Module\Manager $moduleManager * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Backend\Model\Auth\Session $authSession + * @param \Magento\Module\Manager $moduleManager * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $collectionFactory * @param \Magento\Catalog\Helper\Catalog $helperCatalog * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Registry $registry - * @param \Magento\Translate\InlineInterface $translateInline, + * @param \Magento\Translate\InlineInterface $translateInline * @param array $data */ public function __construct( @@ -264,22 +264,6 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs $this->getChildBlock('product-alerts')->setGroupCode(self::ADVANCED_TAB_GROUP_CODE); } - if ($this->getRequest()->getParam('id')) { - if ($this->_catalogData->isModuleEnabled('Magento_Review')) { - if ($this->_authorization->isAllowed('Magento_Review::reviews_all')) { - $this->addTab( - 'product-reviews', - array( - 'label' => __('Product Reviews'), - 'url' => $this->getUrl('catalog/*/reviews', array('_current' => true)), - 'class' => 'ajax', - 'group_code' => self::ADVANCED_TAB_GROUP_CODE - ) - ); - } - } - } - if (isset($advancedGroups['autosettings'])) { $this->addTab('autosettings', $advancedGroups['autosettings']); unset($advancedGroups['autosettings']); diff --git a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php index 5c21cc68120..f264d24d826 100644 --- a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php @@ -35,7 +35,6 @@ namespace Magento\Catalog\Block\Product; use Magento\View\Element\BlockInterface; -use Magento\View\Element\Template\Helper; abstract class AbstractProduct extends \Magento\View\Element\Template { @@ -73,11 +72,6 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ protected $_useLinkForAsLowAs = true; - /** - * @var Helper - */ - protected $_reviewsHelperBlock; - /** * Default product amount per row * @@ -158,48 +152,32 @@ abstract class AbstractProduct extends \Magento\View\Element\Template protected $_imageHelper; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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 + * @var ReviewRendererInterface + */ + protected $reviewRenderer; + + /** + * @param Context $context * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, array $data = array(), array $priceBlockTypes = 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; - $this->_catalogData = $catalogData; - $this->_mathRandom = $mathRandom; + $this->_imageHelper = $context->getImageHelper(); + $this->_layoutHelper = $context->getLayoutHelper(); + $this->_compareProduct = $context->getCompareProduct(); + $this->_wishlistHelper = $context->getWishlistHelper(); + $this->_cartHelper = $context->getCartHelper(); + $this->_catalogConfig = $context->getCatalogConfig(); + $this->_coreRegistry = $context->getRegistry(); + $this->_taxData = $context->getTaxData(); + $this->_catalogData = $context->getCatalogHelper(); + $this->_mathRandom = $context->getMathRandom(); $this->_priceBlockTypes = $priceBlockTypes; + $this->reviewRenderer = $context->getReviewRenderer(); parent::__construct($context, $data); } @@ -400,29 +378,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template $templateType = false, $displayIfNoReviews = false ) { - if ($this->_initReviewsHelperBlock()) { - return $this->_reviewsHelperBlock->getSummaryHtml($product, $templateType, $displayIfNoReviews); - } - - return ''; - } - - /** - * Create reviews summary helper block once - * - * @return boolean - */ - protected function _initReviewsHelperBlock() - { - if (!$this->_reviewsHelperBlock) { - if (!$this->_catalogData->isModuleEnabled('Magento_Review')) { - return false; - } else { - $this->_reviewsHelperBlock = $this->getLayout()->createBlock('Magento\Review\Block\Helper'); - } - } - - return true; + return $this->reviewRenderer->getReviewsSummaryHtml($product, $templateType, $displayIfNoReviews); } /** diff --git a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php index 35d7d736e70..2889268e017 100644 --- a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php +++ b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php @@ -105,51 +105,24 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare */ protected $_coreData; - /** - * @var \Magento\Wishlist\Helper\Data - */ - protected $_wishlistHelper; - /** * @var \Magento\Customer\Service\V1\CustomerCurrentService */ protected $currentCustomer; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory - * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility + * @param Product\Visibility $catalogProductVisibility * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\App\Http\Context $httpContext * @param \Magento\Customer\Service\V1\CustomerCurrentService $currentCustomer * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Core\Helper\Data $coreData, \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, @@ -159,7 +132,6 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare array $data = array(), array $priceBlockTypes = array() ) { - $this->_wishlistHelper = $wishlistHelper; $this->_coreData = $coreData; $this->_itemCollectionFactory = $itemCollectionFactory; $this->_catalogProductVisibility = $catalogProductVisibility; @@ -168,16 +140,6 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare $this->currentCustomer = $currentCustomer; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Block/Product/Context.php b/app/code/Magento/Catalog/Block/Product/Context.php new file mode 100644 index 00000000000..48a9aab0454 --- /dev/null +++ b/app/code/Magento/Catalog/Block/Product/Context.php @@ -0,0 +1,282 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Block\Product; + +class Context extends \Magento\View\Element\Template\Context +{ + /** + * @var \Magento\Catalog\Helper\Image + */ + protected $imageHelper; + + /** + * @var \Magento\Theme\Helper\Layout + */ + protected $layoutHelper; + + /** + * @var \Magento\Catalog\Helper\Product\Compare + */ + protected $compareProduct; + + /** + * @var \Magento\Wishlist\Helper\Data + */ + protected $wishlistHelper; + + /** + * @var \Magento\Checkout\Helper\Cart + */ + protected $cartHelper; + + /** + * @var \Magento\Catalog\Model\Config + */ + protected $catalogConfig; + + /** + * @var \Magento\Registry + */ + protected $registry; + + /** + * @var \Magento\Tax\Helper\Data + */ + protected $taxData; + + /** + * @var \Magento\Catalog\Helper\Data + */ + protected $catalogHelper; + + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + + /** + * @var ReviewRendererInterface + */ + protected $reviewRenderer; + + /** + * @param \Magento\App\RequestInterface $request + * @param \Magento\View\LayoutInterface $layout + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\UrlInterface $urlBuilder + * @param \Magento\TranslateInterface $translator + * @param \Magento\App\CacheInterface $cache + * @param \Magento\View\DesignInterface $design + * @param \Magento\Session\SessionManagerInterface $session + * @param \Magento\Session\SidResolverInterface $sidResolver + * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\View\Url $viewUrl + * @param \Magento\View\ConfigInterface $viewConfig + * @param \Magento\App\Cache\StateInterface $cacheState + * @param \Magento\Logger $logger + * @param \Magento\Escaper $escaper + * @param \Magento\Filter\FilterManager $filterManager + * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\App\Filesystem $filesystem + * @param \Magento\View\FileSystem $viewFileSystem + * @param \Magento\View\TemplateEnginePool $enginePool + * @param \Magento\App\State $appState + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Catalog\Model\Config $catalogConfig + * @param \Magento\Registry $registry + * @param \Magento\Tax\Helper\Data $taxHelper + * @param \Magento\Catalog\Helper\Data $catalogHelper + * @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 ReviewRendererInterface $reviewRenderer + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ + public function __construct( + \Magento\App\RequestInterface $request, + \Magento\View\LayoutInterface $layout, + \Magento\Event\ManagerInterface $eventManager, + \Magento\UrlInterface $urlBuilder, + \Magento\TranslateInterface $translator, + \Magento\App\CacheInterface $cache, + \Magento\View\DesignInterface $design, + \Magento\Session\SessionManagerInterface $session, + \Magento\Session\SidResolverInterface $sidResolver, + \Magento\Core\Model\Store\Config $storeConfig, + \Magento\View\Url $viewUrl, + \Magento\View\ConfigInterface $viewConfig, + \Magento\App\Cache\StateInterface $cacheState, + \Magento\Logger $logger, + \Magento\Escaper $escaper, + \Magento\Filter\FilterManager $filterManager, + \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, + \Magento\App\Filesystem $filesystem, + \Magento\View\FileSystem $viewFileSystem, + \Magento\View\TemplateEnginePool $enginePool, + \Magento\App\State $appState, + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Catalog\Model\Config $catalogConfig, + \Magento\Registry $registry, + \Magento\Tax\Helper\Data $taxHelper, + \Magento\Catalog\Helper\Data $catalogHelper, + \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, + ReviewRendererInterface $reviewRenderer + ) { + $this->imageHelper = $imageHelper; + $this->layoutHelper = $layoutHelper; + $this->compareProduct = $compareProduct; + $this->wishlistHelper = $wishlistHelper; + $this->cartHelper = $cartHelper; + $this->catalogConfig = $catalogConfig; + $this->registry = $registry; + $this->taxData = $taxHelper; + $this->catalogHelper = $catalogHelper; + $this->mathRandom = $mathRandom; + $this->reviewRenderer = $reviewRenderer; + parent::__construct( + $request, + $layout, + $eventManager, + $urlBuilder, + $translator, + $cache, + $design, + $session, + $sidResolver, + $storeConfig, + $viewUrl, + $viewConfig, + $cacheState, + $logger, + $escaper, + $filterManager, + $localeDate, + $inlineTranslation, + $filesystem, + $viewFileSystem, + $enginePool, + $appState, + $storeManager + ); + } + + /** + * @return \Magento\Checkout\Helper\Cart + */ + public function getCartHelper() + { + return $this->cartHelper; + } + + /** + * @return \Magento\Catalog\Model\Config + */ + public function getCatalogConfig() + { + return $this->catalogConfig; + } + + /** + * @return \Magento\Catalog\Helper\Data + */ + public function getCatalogHelper() + { + return $this->catalogHelper; + } + + /** + * @return \Magento\Catalog\Helper\Product\Compare + */ + public function getCompareProduct() + { + return $this->compareProduct; + } + + /** + * @return \Magento\Catalog\Helper\Image + */ + public function getImageHelper() + { + return $this->imageHelper; + } + + /** + * @return \Magento\Theme\Helper\Layout + */ + public function getLayoutHelper() + { + return $this->layoutHelper; + } + + /** + * @return \Magento\Math\Random + */ + public function getMathRandom() + { + return $this->mathRandom; + } + + /** + * @return \Magento\Registry + */ + public function getRegistry() + { + return $this->registry; + } + + /** + * @return \Magento\Tax\Helper\Data + */ + public function getTaxData() + { + return $this->taxData; + } + + /** + * @return \Magento\Wishlist\Helper\Data + */ + public function getWishlistHelper() + { + return $this->wishlistHelper; + } + + /** + * @return \Magento\Catalog\Block\Product\ReviewRendererInterface + */ + public function getReviewRenderer() + { + return $this->reviewRenderer; + } +} diff --git a/app/code/Magento/Catalog/Block/Product/ListProduct.php b/app/code/Magento/Catalog/Block/Product/ListProduct.php index e37687c57d6..4788cf3208c 100644 --- a/app/code/Magento/Catalog/Block/Product/ListProduct.php +++ b/app/code/Magento/Catalog/Block/Product/ListProduct.php @@ -69,36 +69,14 @@ class ListProduct extends \Magento\Catalog\Block\Product\AbstractProduct impleme protected $_categoryFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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 Context $context * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Layer $catalogLayer * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Layer $catalogLayer, array $data = array(), @@ -108,16 +86,6 @@ class ListProduct extends \Magento\Catalog\Block\Product\AbstractProduct impleme $this->_catalogLayer = $catalogLayer; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Block/Product/NewProduct.php b/app/code/Magento/Catalog/Block/Product/NewProduct.php index c7d7b20b352..af43ca2166f 100644 --- a/app/code/Magento/Catalog/Block/Product/NewProduct.php +++ b/app/code/Magento/Catalog/Block/Product/NewProduct.php @@ -65,37 +65,15 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct implemen protected $_productCollectionFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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 Context $context * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\App\Http\Context $httpContext * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\App\Http\Context $httpContext, @@ -107,16 +85,6 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct implemen $this->httpContext = $httpContext; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php index 4ace7da1f43..7a1691fae5e 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php @@ -45,38 +45,16 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct protected $_layerFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Layer\Category $catalogLayer * @param \Magento\Catalog\Model\LayerFactory $layerFactory * @param CollectionFactory $productCollectionFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Layer\Category $catalogLayer, \Magento\Catalog\Model\LayerFactory $layerFactory, @@ -88,16 +66,6 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct $this->_productCollectionFactory = $productCollectionFactory; parent::__construct( $context, - $catalogConfig, - $registry, - $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 da2706510d1..bd6263e11fa 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php @@ -47,38 +47,16 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct protected $_layerFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Layer\Category $catalogLayer * @param \Magento\Catalog\Model\LayerFactory $layerFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Layer\Category $catalogLayer, \Magento\Catalog\Model\LayerFactory $layerFactory, @@ -90,16 +68,6 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct $this->_productCollectionFactory = $productCollectionFactory; parent::__construct( $context, - $catalogConfig, - $registry, - $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 fdefb815815..76554dbd6e1 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php @@ -69,37 +69,15 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements protected $_checkoutCart; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\Checkout\Model\Resource\Cart $checkoutCart * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Checkout\Model\Resource\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, @@ -111,16 +89,6 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements $this->_checkoutSession = $checkoutSession; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php index 29215103a88..c0f8ba2117f 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php @@ -40,7 +40,7 @@ class Toolbar extends \Magento\View\Element\Template /** * Products collection * - * @var \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @var \Magento\Model\Resource\Db\Collection\AbstractCollection */ protected $_collection = null; @@ -231,7 +231,7 @@ class Toolbar extends \Magento\View\Element\Template /** * Return products collection instance * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getCollection() { diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index 44fe821c32e..03551722b76 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -84,37 +84,15 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements \ protected $_checkoutCart; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\Checkout\Model\Resource\Cart $checkoutCart * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Checkout\Model\Resource\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, @@ -126,16 +104,6 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements \ $this->_checkoutSession = $checkoutSession; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/lib/Magento/Outbound/MessageInterface.php b/app/code/Magento/Catalog/Block/Product/ReviewRenderer/DefaultProvider.php similarity index 61% rename from lib/Magento/Outbound/MessageInterface.php rename to app/code/Magento/Catalog/Block/Product/ReviewRenderer/DefaultProvider.php index 0e31fdf1385..e115ec10aa4 100644 --- a/lib/Magento/Outbound/MessageInterface.php +++ b/app/code/Magento/Catalog/Block/Product/ReviewRenderer/DefaultProvider.php @@ -1,6 +1,6 @@ <?php /** - * Interface for Messages that can be sent in PubSub + * Default implementation of product review service provider * * Magento * @@ -20,41 +20,28 @@ * 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_Outbound * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Outbound; +namespace Magento\Catalog\Block\Product\ReviewRenderer; -interface MessageInterface +use Magento\Catalog\Block\Product\ReviewRendererInterface; + +class DefaultProvider implements ReviewRendererInterface { /** - * return endpoint url + * Get product review summary html * + * @param \Magento\Catalog\Model\Product $product + * @param string $templateType + * @param bool $displayIfNoReviews * @return string */ - public function getEndpointUrl(); - - /** - * return formatted headers - * - * @return array - */ - public function getHeaders(); - - /** - * Get the message body - * - * @return string|null - */ - public function getBody(); - - /** - * Get timeout in seconds - * - * return timeout - * @return int - */ - public function getTimeout(); + public function getReviewsSummaryHtml( + \Magento\Catalog\Model\Product $product, + $templateType = self::DEFAULT_REVIEW, + $displayIfNoReviews = false + ) { + return ''; + } } diff --git a/lib/Magento/PubSub/Event/QueueWriter.php b/app/code/Magento/Catalog/Block/Product/ReviewRendererInterface.php similarity index 64% rename from lib/Magento/PubSub/Event/QueueWriter.php rename to app/code/Magento/Catalog/Block/Product/ReviewRendererInterface.php index fa02abf1773..723a60f1c98 100644 --- a/lib/Magento/PubSub/Event/QueueWriter.php +++ b/app/code/Magento/Catalog/Block/Product/ReviewRendererInterface.php @@ -1,7 +1,5 @@ <?php /** - * Stub queue writer to avoid DI issues. - * * Magento * * NOTICE OF LICENSE @@ -20,23 +18,28 @@ * 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_PubSub * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\PubSub\Event; -class QueueWriter implements \Magento\PubSub\Event\QueueWriterInterface +namespace Magento\Catalog\Block\Product; + +interface ReviewRendererInterface { + const SHORT_REVIEW = 'short'; + const DEFAULT_REVIEW = 'default'; + /** - * Stub that doesn't do anything + * Get product review summary html * - * @param \Magento\PubSub\EventInterface $event - * @return null + * @param \Magento\Catalog\Model\Product $product + * @param string $templateType + * @param bool $displayIfNoReviews + * @return string */ - public function offer(\Magento\PubSub\EventInterface $event) - { - return null; - } + public function getReviewsSummaryHtml( + \Magento\Catalog\Model\Product $product, + $templateType = self::DEFAULT_REVIEW, + $displayIfNoReviews = false + ); } diff --git a/app/code/Magento/Catalog/Block/Product/Send.php b/app/code/Magento/Catalog/Block/Product/Send.php index dbbe05a2570..6c7858e98aa 100644 --- a/app/code/Magento/Catalog/Block/Product/Send.php +++ b/app/code/Magento/Catalog/Block/Product/Send.php @@ -18,22 +18,14 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Catalog * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +namespace Magento\Catalog\Block\Product; /** * Product send to friend block - * - * @category Magento - * @package Magento_Catalog - * @module Catalog */ -namespace Magento\Catalog\Block\Product; - class Send extends \Magento\Catalog\Block\Product\AbstractProduct { /** @@ -44,52 +36,30 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct protected $_customerSession; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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 + * Customer view helper + * + * @var \Magento\Customer\Helper\View + */ + protected $_customerView; + + /** + * @param Context $context * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Customer\Helper\View $customerView * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Customer\Model\Session $customerSession, + \Magento\Customer\Helper\View $customerView, array $data = array(), array $priceBlockTypes = array() ) { $this->_customerSession = $customerSession; + $this->_customerView = $customerView; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); @@ -103,7 +73,7 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct */ public function getUserName() { - return $this->_customerSession->getCustomer()->getName(); + return $this->_customerView->getCustomerName($this->_customerSession->getCustomerDataObject()); } /** @@ -111,7 +81,7 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct */ public function getEmail() { - return (string)$this->_customerSession->getCustomer()->getEmail(); + return (string)$this->_customerSession->getCustomerDataObject()->getEmail(); } /** diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index de7367847e8..32c3b020d4f 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -84,17 +84,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct implements \Ma protected $_localeFormat; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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 Context $context * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\ProductFactory $productFactory @@ -105,21 +95,9 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct implements \Ma * @param \Magento\Locale\FormatInterface $localeFormat * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Model\ProductFactory $productFactory, @@ -141,16 +119,6 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct implements \Ma $this->_localeFormat = $localeFormat; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php index b3995daf0ce..255fb744a3b 100644 --- a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php +++ b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php @@ -41,35 +41,13 @@ abstract class AbstractView extends \Magento\Catalog\Block\Product\AbstractProdu protected $arrayUtils; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Stdlib\ArrayUtils $arrayUtils, array $data = array(), array $priceBlockTypes = array() @@ -77,16 +55,6 @@ abstract class AbstractView extends \Magento\Catalog\Block\Product\AbstractProdu $this->arrayUtils = $arrayUtils; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Block/Product/Widget/Html/Pager.php b/app/code/Magento/Catalog/Block/Product/Widget/Html/Pager.php index 05ca3bfade6..b906be5da90 100644 --- a/app/code/Magento/Catalog/Block/Product/Widget/Html/Pager.php +++ b/app/code/Magento/Catalog/Block/Product/Widget/Html/Pager.php @@ -120,7 +120,7 @@ class Pager extends \Magento\Theme\Block\Html\Pager /** * Connect collection to paging * - * @param \Magento\Core\Model\Resource\Db\Collection\AbstractCollection $collection + * @param \Magento\Model\Resource\Db\Collection\AbstractCollection $collection * @return \Magento\Catalog\Block\Product\Widget\Html\Pager */ public function setCollection($collection) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php index 596e48694c6..ca30e9cfa4f 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php @@ -377,16 +377,16 @@ class Category extends \Magento\Backend\App\Action foreach ($validate as $code => $error) { if ($error === true) { $attribute = $category->getResource()->getAttribute($code)->getFrontend()->getLabel(); - throw new \Magento\Core\Exception(__('Attribute "%1" is required.', $attribute)); + throw new \Magento\Model\Exception(__('Attribute "%1" is required.', $attribute)); } else { - throw new \Magento\Core\Exception($error); + throw new \Magento\Model\Exception($error); } } } $category->unsetData('use_post_data_config'); if (isset($data['general']['entity_id'])) { - throw new \Magento\Core\Exception(__('Unable to save the category')); + throw new \Magento\Model\Exception(__('Unable to save the category')); } $category->save(); @@ -468,7 +468,7 @@ class Category extends \Magento\Backend\App\Action try { $category->move($parentNodeId, $prevNodeId); $this->getResponse()->setBody('SUCCESS'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->getResponse()->setBody($e->getMessage()); } catch (\Exception $e) { $this->getResponse()->setBody(__('There was a category move error %1', $e)); @@ -493,7 +493,7 @@ class Category extends \Magento\Backend\App\Action $category->delete(); $this->messageManager->addSuccess(__('You deleted the category.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $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 6b378f5f52a..438fd69ae97 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php @@ -477,24 +477,7 @@ class Product extends \Magento\Backend\App\Action $this->_view->renderLayout(); } - /** - * Get product reviews grid - * - * @return void - */ - public function reviewsAction() - { - $product = $this->productBuilder->build($this->getRequest()); - $this->_view->loadLayout(); - $this->_view->getLayout()->getBlock( - 'admin.product.reviews' - )->setProductId( - $product->getId() - )->setUseAjax( - true - ); - $this->_view->renderLayout(); - } + /** * Validate product @@ -556,7 +539,7 @@ class Product extends \Magento\Backend\App\Action $response->setError(true); $response->setAttribute($e->getAttributeCode()); $response->setMessage($e->getMessage()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response->setError(true); $response->setMessage($e->getMessage()); } catch (\Exception $e) { @@ -588,7 +571,7 @@ class Product extends \Magento\Backend\App\Action try { if (isset($data['product'][$product->getIdFieldName()])) { - throw new \Magento\Core\Exception(__('Unable to save product')); + throw new \Magento\Model\Exception(__('Unable to save product')); } $originalSku = $product->getSku(); @@ -634,7 +617,7 @@ class Product extends \Magento\Backend\App\Action $newProduct = $this->productCopier->copy($product); $this->messageManager->addSuccess(__('You duplicated the product.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_session->setProductData($data); $redirectBack = true; @@ -755,7 +738,7 @@ class Product extends \Magento\Backend\App\Action $this->_productPriceIndexerProcessor->reindexList($productIds); } catch (\Magento\Core\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addException($e, __('Something went wrong while updating the product(s) status.')); @@ -770,13 +753,13 @@ class Product extends \Magento\Backend\App\Action * @param array $productIds * @param int $status * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function _validateMassStatus(array $productIds, $status) { if ($status == \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) { if (!$this->_objectManager->create('Magento\Catalog\Model\Product')->isProductsHasSku($productIds)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please make sure to define SKU values for all processed products.') ); } 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 146561748d8..60f61e5bb5a 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php @@ -232,7 +232,7 @@ class Attribute extends Action ) { $this->_productPriceIndexerProcessor->reindexList($this->_helper->getProductIds()); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -308,7 +308,7 @@ class Attribute extends Action $response->setError(true); $response->setAttribute($e->getAttributeCode()); $response->setMessage($e->getMessage()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response->setError(true); $response->setMessage($e->getMessage()); } catch (\Exception $e) { diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php index 6d40308cccd..8b02b69107e 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php @@ -292,7 +292,7 @@ class Attribute extends \Magento\Backend\App\Action $attributeSet->save(); $attributeSet->initFromSkeleton($this->getRequest()->getParam('set'))->save(); $isNewAttributeSet = true; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong saving the attribute.')); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php index 3c2cfc4f782..53e8c0cd8a6 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php @@ -147,7 +147,7 @@ class Set extends \Magento\Backend\App\Action $model->load($attributeSetId); } if (!$model->getId()) { - throw new \Magento\Core\Exception(__('This attribute set no longer exists.')); + throw new \Magento\Model\Exception(__('This attribute set no longer exists.')); } $data = $this->_objectManager->get( 'Magento\Core\Helper\Data' @@ -168,7 +168,7 @@ class Set extends \Magento\Backend\App\Action } $model->save(); $this->messageManager->addSuccess(__('You saved the attribute set.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $hasError = true; } catch (\Exception $e) { diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Search.php b/app/code/Magento/Catalog/Controller/Adminhtml/Search.php index 4b7c85657e2..56e1e3eddcd 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Search.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Search.php @@ -143,7 +143,7 @@ class Search extends \Magento\Backend\App\Action $model->setStoreId($storeId); $model->loadByQueryText($queryText); if ($model->getId() && $model->getId() != $queryId) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('You already have an identical search term query.') ); } elseif (!$model->getId() && $queryId) { @@ -156,7 +156,7 @@ class Search extends \Magento\Backend\App\Action $model->addData($data); $model->setIsProcessed(0); $model->save(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $hasError = true; } catch (\Exception $e) { diff --git a/app/code/Magento/Catalog/Controller/Category.php b/app/code/Magento/Catalog/Controller/Category.php index cbaf5da3a74..0a2b3b6aac7 100644 --- a/app/code/Magento/Catalog/Controller/Category.php +++ b/app/code/Magento/Catalog/Controller/Category.php @@ -120,7 +120,7 @@ class Category extends \Magento\App\Action\Action 'catalog_controller_category_init_after', array('category' => $category, 'controller_action' => $this) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); return false; } diff --git a/app/code/Magento/Catalog/Controller/Product/Compare.php b/app/code/Magento/Catalog/Controller/Product/Compare.php index 47d53b2ec51..f05238fcac2 100644 --- a/app/code/Magento/Catalog/Controller/Product/Compare.php +++ b/app/code/Magento/Catalog/Controller/Product/Compare.php @@ -90,13 +90,6 @@ class Compare extends \Magento\App\Action\Action */ protected $_compareItemFactory; - /** - * Customer factory - * - * @var \Magento\Customer\Model\CustomerFactory - */ - protected $_customerFactory; - /** * @var \Magento\Core\Model\StoreManagerInterface */ @@ -109,7 +102,6 @@ class Compare extends \Magento\App\Action\Action /** * @param \Magento\App\Action\Context $context - * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Catalog\Model\Product\Compare\ItemFactory $compareItemFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory @@ -122,7 +114,6 @@ class Compare extends \Magento\App\Action\Action */ public function __construct( \Magento\App\Action\Context $context, - \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Catalog\Model\Product\Compare\ItemFactory $compareItemFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory, @@ -134,7 +125,6 @@ class Compare extends \Magento\App\Action\Action FormKeyValidator $formKeyValidator ) { $this->_storeManager = $storeManager; - $this->_customerFactory = $customerFactory; $this->_compareItemFactory = $compareItemFactory; $this->_productFactory = $productFactory; $this->_itemCollectionFactory = $itemCollectionFactory; @@ -222,9 +212,9 @@ class Compare extends \Magento\App\Action\Action /** @var $item \Magento\Catalog\Model\Product\Compare\Item */ $item = $this->_compareItemFactory->create(); if ($this->_customerSession->isLoggedIn()) { - $item->addCustomerData($this->_customerSession->getCustomer()); + $item->setCustomerId($this->_customerSession->getCustomerId()); } elseif ($this->_customerId) { - $item->addCustomerData($this->_customerFactory->create()->load($this->_customerId)); + $item->setCustomerId($this->_customerId); } else { $item->addVisitorId($this->_logVisitor->getId()); } @@ -274,7 +264,7 @@ class Compare extends \Magento\App\Action\Action $items->clear(); $this->messageManager->addSuccess(__('You cleared the comparison list.')); $this->_objectManager->get('Magento\Catalog\Helper\Product\Compare')->calculate(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong clearing the comparison list.')); diff --git a/app/code/Magento/Catalog/Helper/Product.php b/app/code/Magento/Catalog/Helper/Product.php index e019261b369..af5b79588de 100644 --- a/app/code/Magento/Catalog/Helper/Product.php +++ b/app/code/Magento/Catalog/Helper/Product.php @@ -494,7 +494,7 @@ class Product extends \Magento\Core\Helper\Url 'catalog_controller_product_init_after', array('product' => $product, 'controller_action' => $controller) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_logger->logException($e); return false; } diff --git a/app/code/Magento/Catalog/Helper/Product/Composite.php b/app/code/Magento/Catalog/Helper/Product/Composite.php old mode 100644 new mode 100755 index 42ba79f3401..72558aa362f --- a/app/code/Magento/Catalog/Helper/Product/Composite.php +++ b/app/code/Magento/Catalog/Helper/Product/Composite.php @@ -25,7 +25,14 @@ */ namespace Magento\Catalog\Helper\Product; +use Magento\App\Helper\Context; +use Magento\App\ViewInterface; +use Magento\Catalog\Helper\Product; +use Magento\Catalog\Model\ProductFactory; +use Magento\Core\Model\StoreManagerInterface; use Magento\Customer\Controller\RegistryConstants; +use Magento\Customer\Model\Converter; +use Magento\Registry; /** * Adminhtml catalog product composite helper @@ -39,61 +46,61 @@ class Composite extends \Magento\App\Helper\AbstractHelper /** * Core registry * - * @var \Magento\Registry + * @var Registry */ protected $_coreRegistry = null; /** * Catalog product * - * @var \Magento\Catalog\Helper\Product + * @var Product */ protected $_catalogProduct = null; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $_storeManager; /** - * @var \Magento\Catalog\Model\ProductFactory + * @var ProductFactory */ protected $_productFactory; /** - * @var \Magento\Customer\Model\CustomerFactory + * @var ViewInterface */ - protected $_customerFactory; + protected $_view; /** - * @var \Magento\App\ViewInterface + * @var Converter */ - protected $_view; + protected $_converter; /** - * @param \Magento\App\Helper\Context $context - * @param \Magento\Customer\Model\CustomerFactory $customerFactory - * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Catalog\Helper\Product $catalogProduct - * @param \Magento\Registry $coreRegistry - * @param \Magento\App\ViewInterface $view + * @param Context $context + * @param ProductFactory $productFactory + * @param StoreManagerInterface $storeManager + * @param Product $catalogProduct + * @param Registry $coreRegistry + * @param ViewInterface $view + * @param Converter $converter */ public function __construct( - \Magento\App\Helper\Context $context, - \Magento\Customer\Model\CustomerFactory $customerFactory, - \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Catalog\Helper\Product $catalogProduct, - \Magento\Registry $coreRegistry, - \Magento\App\ViewInterface $view + Context $context, + ProductFactory $productFactory, + StoreManagerInterface $storeManager, + Product $catalogProduct, + Registry $coreRegistry, + ViewInterface $view, + Converter $converter ) { - $this->_customerFactory = $customerFactory; $this->_productFactory = $productFactory; $this->_storeManager = $storeManager; $this->_coreRegistry = $coreRegistry; $this->_catalogProduct = $catalogProduct; $this->_view = $view; + $this->_converter = $converter; parent::__construct($context); } @@ -157,8 +164,8 @@ class Composite extends \Magento\App\Helper\AbstractHelper /** * Prepares and render result of composite product configuration request * - * $configureResult holds either: - * - 'ok' = true, and 'product_id', 'buy_request', 'current_store_id', 'current_customer' or 'current_customer_id' + * The $configureResult variable holds either: + * - 'ok' = true, and 'product_id', 'buy_request', 'current_store_id', 'current_customer_id' * - 'error' = true, and 'message' to show * * @param \Magento\Object $configureResult @@ -168,7 +175,7 @@ class Composite extends \Magento\App\Helper\AbstractHelper { try { if (!$configureResult->getOk()) { - throw new \Magento\Core\Exception($configureResult->getMessage()); + throw new \Magento\Model\Exception($configureResult->getMessage()); } $currentStoreId = (int)$configureResult->getCurrentStoreId(); @@ -182,22 +189,17 @@ class Composite extends \Magento\App\Helper\AbstractHelper $configureResult->getProductId() ); if (!$product->getId()) { - throw new \Magento\Core\Exception(__('The product is not loaded.')); + throw new \Magento\Model\Exception(__('The product is not loaded.')); } $this->_coreRegistry->register('current_product', $product); $this->_coreRegistry->register('product', $product); // Register customer we're working with - $currentCustomer = $configureResult->getCurrentCustomer(); - if (!$currentCustomer) { - $currentCustomerId = (int)$configureResult->getCurrentCustomerId(); - if ($currentCustomerId) { - $currentCustomer = $this->_customerFactory->create()->load($currentCustomerId); - } - } - if ($currentCustomer) { - $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER, $currentCustomer); - } + $customerId = (int)$configureResult->getCurrentCustomerId(); + // TODO: Remove the customer model from the registry once all readers are refactored + $customerModel = $this->_converter->loadCustomerModel($customerId); + $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER, $customerModel); + $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customerId); // Prepare buy request values $buyRequest = $configureResult->getBuyRequest(); diff --git a/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php b/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php index bf515a58c3c..a159314fb13 100644 --- a/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php +++ b/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php @@ -485,7 +485,7 @@ class Indexer extends \Magento\App\Helper\AbstractHelper * Retrieve loaded attribute by code * * @param string $attributeCode - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Eav\Model\Entity\Attribute */ public function getAttribute($attributeCode) @@ -495,7 +495,7 @@ class Indexer extends \Magento\App\Helper\AbstractHelper $attribute = $this->_attributeFactory->create(); $attribute->loadByCode($this->getEntityTypeId(), $attributeCode); if (!$attribute->getId()) { - throw new \Magento\Core\Exception(__('Invalid attribute %1', $attributeCode)); + throw new \Magento\Model\Exception(__('Invalid attribute %1', $attributeCode)); } $entity = $this->_eavConfig->getEntityType($this->getEntityType())->getEntity(); $attribute->setEntity($entity); diff --git a/app/code/Magento/Catalog/Helper/Product/Price.php b/app/code/Magento/Catalog/Helper/Product/Price.php index bddc90fcde2..b47880ae5cc 100644 --- a/app/code/Magento/Catalog/Helper/Product/Price.php +++ b/app/code/Magento/Catalog/Helper/Product/Price.php @@ -24,7 +24,7 @@ namespace Magento\Catalog\Helper\Product; use Magento\Catalog\Model\Product; -use Magento\Customer\Model\Customer; +use Magento\Customer\Service\V1\Data\Customer; /** * Collection of tax module calls @@ -99,13 +99,13 @@ class Price extends \Magento\App\Helper\AbstractHelper } /** - * Get customer object + * Get customer data object * - * @return bool|Customer + * @return Customer CustomerDataObject */ public function getCustomer() { - return $this->taxCalculation->getCustomer(); + return $this->taxCalculation->getCustomerData(); } /** @@ -116,7 +116,7 @@ class Price extends \Magento\App\Helper\AbstractHelper */ public function setCustomer(Customer $customer) { - $this->taxCalculation->setCustomer($customer); + $this->taxCalculation->setCustomerData($customer); return $this; } diff --git a/app/code/Magento/Catalog/Helper/Product/View.php b/app/code/Magento/Catalog/Helper/Product/View.php index 3b0b916c7ff..bf67df6afe0 100644 --- a/app/code/Magento/Catalog/Helper/Product/View.php +++ b/app/code/Magento/Catalog/Helper/Product/View.php @@ -220,7 +220,7 @@ class View extends \Magento\App\Helper\AbstractHelper * @param null|\Magento\Object $params * * @return \Magento\Catalog\Helper\Product\View - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function prepareAndRender($productId, $controller, $params = null) { @@ -233,7 +233,7 @@ class View extends \Magento\App\Helper\AbstractHelper // Standard algorithm to prepare and render product view page $product = $productHelper->initProduct($productId, $controller, $params); if (!$product) { - throw new \Magento\Core\Exception(__('Product is not loaded'), $this->ERR_NO_PRODUCT_LOADED); + throw new \Magento\Model\Exception(__('Product is not loaded'), $this->ERR_NO_PRODUCT_LOADED); } $buyRequest = $params->getBuyRequest(); @@ -259,7 +259,7 @@ class View extends \Magento\App\Helper\AbstractHelper if ($controller instanceof \Magento\Catalog\Controller\Product\View\ViewInterface) { $this->_view->getLayout()->initMessages($this->messageGroups); } else { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Bad controller interface for showing product'), $this->ERR_BAD_CONTROLLER_INTERFACE ); diff --git a/app/code/Magento/Catalog/Model/AbstractModel.php b/app/code/Magento/Catalog/Model/AbstractModel.php index 1e1859dcef4..86ed8240b33 100644 --- a/app/code/Magento/Catalog/Model/AbstractModel.php +++ b/app/code/Magento/Catalog/Model/AbstractModel.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractModel extends \Magento\Core\Model\AbstractModel +abstract class AbstractModel extends \Magento\Model\AbstractModel { /** * Attribute default values @@ -83,7 +83,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -91,7 +91,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Attribute/LockValidatorComposite.php b/app/code/Magento/Catalog/Model/Attribute/LockValidatorComposite.php index 12bf7ad0898..9f86bc6c911 100644 --- a/app/code/Magento/Catalog/Model/Attribute/LockValidatorComposite.php +++ b/app/code/Magento/Catalog/Model/Attribute/LockValidatorComposite.php @@ -50,13 +50,13 @@ class LockValidatorComposite implements LockValidatorInterface /** * Check attribute lock state * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param null $attributeSet - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * * @return void */ - public function validate(\Magento\Core\Model\AbstractModel $object, $attributeSet = null) + public function validate(\Magento\Model\AbstractModel $object, $attributeSet = null) { foreach ($this->validators as $validator) { $validator->validate($object, $attributeSet); diff --git a/app/code/Magento/Catalog/Model/Attribute/LockValidatorInterface.php b/app/code/Magento/Catalog/Model/Attribute/LockValidatorInterface.php index 8ad8ed9511e..9982894594a 100644 --- a/app/code/Magento/Catalog/Model/Attribute/LockValidatorInterface.php +++ b/app/code/Magento/Catalog/Model/Attribute/LockValidatorInterface.php @@ -30,11 +30,11 @@ interface LockValidatorInterface /** * Check attribute lock state * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param null $attributeSet - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * * @return void */ - public function validate(\Magento\Core\Model\AbstractModel $object, $attributeSet = null); + public function validate(\Magento\Model\AbstractModel $object, $attributeSet = null); } diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index f1eac57c2e3..098d00de300 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -205,7 +205,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ * @param Indexer\Category\Flat\State $flatState * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer * @param \Magento\Indexer\Model\IndexerInterface $productIndexer - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -226,7 +226,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ Indexer\Category\Flat\State $flatState, \Magento\Indexer\Model\IndexerInterface $flatIndexer, \Magento\Indexer\Model\IndexerInterface $productIndexer, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -337,7 +337,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ * @param int $parentId new parent category id * @param null|int $afterCategoryId category id after which we have put current category * @return $this - * @throws \Magento\Core\Exception|\Exception + * @throws \Magento\Model\Exception|\Exception */ public function move($parentId, $afterCategoryId) { @@ -348,7 +348,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ $parent = $this->_categoryFactory->create()->setStoreId($this->getStoreId())->load($parentId); if (!$parent->getId()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Sorry, but we can\'t move the category because we can\'t find the new parent category you selected.' ) @@ -356,11 +356,11 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ } if (!$this->getId()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Sorry, but we can\'t move the category because we can\'t find the new category you selected.') ); } elseif ($parent->getId() == $this->getId()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'We can\'t perform this category move operation because the parent category matches the child category.' ) @@ -862,14 +862,13 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ /** * Before delete process * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); if ($this->getResource()->isForbiddenToDelete($this->getId())) { - throw new \Magento\Core\Exception("Can't delete root category."); + throw new \Magento\Model\Exception("Can't delete root category."); } return parent::_beforeDelete(); } @@ -891,12 +890,12 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ if ($this->_useFlatResource) { $anchors = $this->_getResource()->getAnchorsAbove($path, $this->getStoreId()); } else { - if (!$this->_coreRegistry->registry('_category_is_anchor_attribute')) { + if (!$this->_registry->registry('_category_is_anchor_attribute')) { $model = $this->_getAttribute('is_anchor'); - $this->_coreRegistry->register('_category_is_anchor_attribute', $model); + $this->_registry->register('_category_is_anchor_attribute', $model); } - $isAnchorAttribute = $this->_coreRegistry->registry('_category_is_anchor_attribute'); + $isAnchorAttribute = $this->_registry->registry('_category_is_anchor_attribute'); if ($isAnchorAttribute) { $anchors = $this->getResource()->findWhereAttributeIs($path, $isAnchorAttribute, 1); } @@ -1079,7 +1078,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ /** * Init indexing process after category delete * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterDeleteCommit() { diff --git a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php index 02b111fe5de..741fd0705f6 100644 --- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php @@ -58,7 +58,7 @@ class Sortby extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * * @param \Magento\Object $object * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate($object) { @@ -86,7 +86,7 @@ class Sortby extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend if ($this->getAttribute()->getIsUnique()) { if (!$this->getAttribute()->getEntity()->checkAttributeUniqueValue($this->getAttribute(), $object)) { $label = $this->getAttribute()->getFrontend()->getLabel(); - throw new \Magento\Core\Exception(__('The value of attribute "%1" must be unique.', $label)); + throw new \Magento\Model\Exception(__('The value of attribute "%1" must be unique.', $label)); } } @@ -104,13 +104,13 @@ class Sortby extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend "catalog/frontend/default_sort_by" ); if (!in_array($data, $available)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Default Product Listing Sort by does not exist in Available Product Listing Sort By.') ); } } else { if (!in_array('available_sort_by', $postDataConfig)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Default Product Listing Sort by does not exist in Available Product Listing Sort By.') ); } diff --git a/app/code/Magento/Catalog/Model/Config.php b/app/code/Magento/Catalog/Model/Config.php index 9616618b4fb..98aabb68c51 100644 --- a/app/code/Magento/Catalog/Model/Config.php +++ b/app/code/Magento/Catalog/Model/Config.php @@ -133,7 +133,7 @@ class Config extends \Magento\Eav\Model\Config /** * Constructor * - * @param \Magento\Core\Model\App $app + * @param \Magento\App\CacheInterface $cache * @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory * @param \Magento\App\Cache\StateInterface $cacheState * @param \Magento\Validator\UniversalFactory $universalFactory @@ -148,7 +148,7 @@ class Config extends \Magento\Eav\Model\Config * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\App $app, + \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory, \Magento\App\Cache\StateInterface $cacheState, \Magento\Validator\UniversalFactory $universalFactory, @@ -168,7 +168,7 @@ class Config extends \Magento\Eav\Model\Config $this->_storeManager = $storeManager; $this->_eavConfig = $eavConfig; - parent::__construct($app, $entityTypeFactory, $cacheState, $universalFactory); + parent::__construct($cache, $entityTypeFactory, $cacheState, $universalFactory); } /** diff --git a/app/code/Magento/Catalog/Model/Config/Backend/Category.php b/app/code/Magento/Catalog/Model/Config/Backend/Category.php index aa28ab77c4c..05b69eb3469 100644 --- a/app/code/Magento/Catalog/Model/Config/Backend/Category.php +++ b/app/code/Magento/Catalog/Model/Config/Backend/Category.php @@ -49,7 +49,7 @@ class Category extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Catalog\Model\Category $catalogCategory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -59,7 +59,7 @@ class Category extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Catalog\Model\Category $catalogCategory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php b/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php index da7b4f442f2..9e15babe76e 100644 --- a/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php +++ b/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php @@ -53,7 +53,7 @@ class Image extends \Magento\Core\Model\Config\Value * @param \Magento\App\ConfigInterface $config * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -64,7 +64,7 @@ class Image extends \Magento\Core\Model\Config\Value \Magento\App\ConfigInterface $config, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Design.php b/app/code/Magento/Catalog/Model/Design.php index db6c7949d16..2300884ce92 100644 --- a/app/code/Magento/Catalog/Model/Design.php +++ b/app/code/Magento/Catalog/Model/Design.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Design extends \Magento\Core\Model\AbstractModel +class Design extends \Magento\Model\AbstractModel { const APPLY_FOR_PRODUCT = 1; @@ -55,7 +55,7 @@ class Design extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\View\DesignInterface $design - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -64,7 +64,7 @@ class Design extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\View\DesignInterface $design, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Entity/Attribute.php b/app/code/Magento/Catalog/Model/Entity/Attribute.php index 1e9d1554dc8..8f02f527396 100644 --- a/app/code/Magento/Catalog/Model/Entity/Attribute.php +++ b/app/code/Magento/Catalog/Model/Entity/Attribute.php @@ -103,7 +103,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute * @param \Magento\Catalog\Model\ProductFactory $catalogProductFactory * @param \Magento\Locale\ResolverInterface $localeResolver * @param LockValidatorInterface $lockValidator - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -120,7 +120,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute \Magento\Catalog\Model\ProductFactory $catalogProductFactory, \Magento\Locale\ResolverInterface $localeResolver, LockValidatorInterface $lockValidator, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -146,14 +146,14 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute /** * Processing object before save data * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel * @throws \Magento\Eav\Exception */ protected function _beforeSave() { try { $this->attrLockValidator->validate($this); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { throw new \Magento\Eav\Exception($exception->getMessage()); } @@ -164,7 +164,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute /** * Processing object after save data * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterSave() { diff --git a/app/code/Magento/Catalog/Model/Factory.php b/app/code/Magento/Catalog/Model/Factory.php index 38c2b594722..8e5b3c349b9 100644 --- a/app/code/Magento/Catalog/Model/Factory.php +++ b/app/code/Magento/Catalog/Model/Factory.php @@ -51,15 +51,15 @@ class Factory * * @param string $className * @param array $data - * @return \Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return \Magento\Model\AbstractModel + * @throws \Magento\Model\Exception */ public function create($className, array $data = array()) { $model = $this->_objectManager->create($className, $data); - if (!$model instanceof \Magento\Core\Model\AbstractModel) { - throw new \Magento\Core\Exception($className . ' doesn\'t extends \Magento\Core\Model\AbstractModel'); + if (!$model instanceof \Magento\Model\AbstractModel) { + throw new \Magento\Model\Exception($className . ' doesn\'t extends \Magento\Model\AbstractModel'); } return $model; } diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroup.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroup.php index d181b17427e..56171308591 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroup.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroup.php @@ -63,26 +63,26 @@ class StoreGroup /** * Validate changes for invalidating indexer * - * @param \Magento\Core\Model\AbstractModel $group + * @param \Magento\Model\AbstractModel $group * @return bool */ - protected function validate(\Magento\Core\Model\AbstractModel $group) + protected function validate(\Magento\Model\AbstractModel $group) { return $group->dataHasChangedFor('root_category_id') && !$group->isObjectNew(); } /** - * @param \Magento\Core\Model\Resource\Db\AbstractDb $subject + * @param \Magento\Model\Resource\Db\AbstractDb $subject * @param callable $proceed - * @param \Magento\Core\Model\AbstractModel $group + * @param \Magento\Model\AbstractModel $group * - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @return \Magento\Model\Resource\Db\AbstractDb * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundSave( - \Magento\Core\Model\Resource\Db\AbstractDb $subject, + \Magento\Model\Resource\Db\AbstractDb $subject, \Closure $proceed, - \Magento\Core\Model\AbstractModel $group + \Magento\Model\AbstractModel $group ) { $needInvalidating = $this->validate($group); $objectResource = $proceed($group); diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreView.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreView.php index 991cb873b4f..0e204c22fa3 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreView.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreView.php @@ -28,10 +28,10 @@ class StoreView extends StoreGroup /** * Validate changes for invalidating indexer * - * @param \Magento\Core\Model\AbstractModel $store + * @param \Magento\Model\AbstractModel $store * @return bool */ - protected function validate(\Magento\Core\Model\AbstractModel $store) + protected function validate(\Magento\Model\AbstractModel $store) { return $store->isObjectNew() || $store->dataHasChangedFor('group_id'); } diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php index f8276ace121..ff94adbd78d 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php @@ -45,7 +45,7 @@ class Mode extends \Magento\Core\Model\Config\Value * @param \Magento\App\ConfigInterface $config * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer * @param \Magento\Indexer\Model\Indexer\State $indexerState - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -56,7 +56,7 @@ class Mode extends \Magento\Core\Model\Config\Value \Magento\App\ConfigInterface $config, \Magento\Indexer\Model\IndexerInterface $flatIndexer, \Magento\Indexer\Model\Indexer\State $indexerState, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroup.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroup.php index a5011fafa7c..d87e26c2ec1 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroup.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroup.php @@ -52,15 +52,15 @@ class StoreGroup } /** - * @param \Magento\Core\Model\Resource\Db\AbstractDb $subject + * @param \Magento\Model\Resource\Db\AbstractDb $subject * @param callable $proceed - * @param \Magento\Core\Model\AbstractModel $group + * @param \Magento\Model\AbstractModel $group * @return mixed */ public function aroundSave( - \Magento\Core\Model\Resource\Db\AbstractDb $subject, + \Magento\Model\Resource\Db\AbstractDb $subject, \Closure $proceed, - \Magento\Core\Model\AbstractModel $group + \Magento\Model\AbstractModel $group ) { $needInvalidating = $this->validate($group); $objectResource = $proceed($group); @@ -74,10 +74,10 @@ class StoreGroup /** * Validate changes for invalidating indexer * - * @param \Magento\Core\Model\AbstractModel $group + * @param \Magento\Model\AbstractModel $group * @return bool */ - protected function validate(\Magento\Core\Model\AbstractModel $group) + protected function validate(\Magento\Model\AbstractModel $group) { return ($group->dataHasChangedFor( 'website_id' diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreView.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreView.php index 2e681093fc6..e92ef304ea7 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreView.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreView.php @@ -28,10 +28,10 @@ class StoreView extends StoreGroup /** * Validate changes for invalidating indexer * - * @param \Magento\Core\Model\AbstractModel $store + * @param \Magento\Model\AbstractModel $store * @return bool */ - protected function validate(\Magento\Core\Model\AbstractModel $store) + protected function validate(\Magento\Model\AbstractModel $store) { return $store->isObjectNew() || $store->dataHasChangedFor('group_id'); } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Full.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Full.php index 2ebe0aa2acd..41fbaf755d9 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Full.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Full.php @@ -48,7 +48,7 @@ class Full extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction $this->_reindex($store->getId()); } } catch (\Exception $e) { - throw new \Magento\Core\Exception($e->getMessage(), $e->getCode(), $e); + throw new \Magento\Model\Exception($e->getMessage(), $e->getCode(), $e); } return $this; } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php index 48cd61eba63..8fa36ac3dbf 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php @@ -36,12 +36,12 @@ class Row extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction * * @param int|null $id * @return \Magento\Catalog\Model\Indexer\Product\Flat\Action\Row - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function execute($id = null) { if (!isset($id) || empty($id)) { - throw new \Magento\Core\Exception(__('Could not rebuild index for undefined product')); + throw new \Magento\Model\Exception(__('Could not rebuild index for undefined product')); } $ids = array($id); foreach ($this->_storeManager->getStores() as $store) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php index e93dfcb5620..04b903bb404 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php @@ -38,12 +38,12 @@ class Rows extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction * @param array $ids * * @return \Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function execute($ids) { if (empty($ids)) { - throw new \Magento\Core\Exception(__('Bad value was supplied.')); + throw new \Magento\Model\Exception(__('Bad value was supplied.')); } foreach ($this->_storeManager->getStores() as $store) { $idsBatches = array_chunk($ids, \Magento\Catalog\Helper\Product\Flat\Indexer::BATCH_SIZE); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php index a85036ee81a..6e130235651 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php @@ -114,7 +114,7 @@ class FlatTableBuilder * * @param int|string $storeId * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _createTemporaryFlatTable($storeId) { @@ -126,7 +126,7 @@ class FlatTableBuilder \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction::XML_NODE_MAX_INDEX_COUNT ); if ($maxIndex && count($indexesNeed) > $maxIndex) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( "The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes." . "Currently there are %1\$d of them." . diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php index cd238faf195..44f440b88e8 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php @@ -46,12 +46,12 @@ class Store * Before save handler * * @param \Magento\Core\Model\Resource\Store $subject - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeSave(\Magento\Core\Model\Resource\Store $subject, \Magento\Core\Model\AbstractModel $object) + public function beforeSave(\Magento\Core\Model\Resource\Store $subject, \Magento\Model\AbstractModel $object) { if (!$object->getId() || $object->dataHasChangedFor('group_id')) { $this->_productFlatIndexerProcessor->markIndexerAsInvalid(); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php index 35dd2d4f2d3..af276b43d15 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php @@ -46,14 +46,14 @@ class StoreGroup * Before save handler * * @param \Magento\Core\Model\Resource\Store\Group $subject - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeSave( \Magento\Core\Model\Resource\Store\Group $subject, - \Magento\Core\Model\AbstractModel $object + \Magento\Model\AbstractModel $object ) { if (!$object->getId() || $object->dataHasChangedFor('root_category_id')) { $this->_productFlatIndexerProcessor->markIndexerAsInvalid(); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php index a7d2967e3ac..6cf3b614708 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php @@ -33,7 +33,7 @@ class Processor const INDEXER_ID = 'catalog_product_flat'; /** - * @var \Magento\Indexer\Model\Indexer + * @var \Magento\Indexer\Model\IndexerInterface */ protected $_indexer; @@ -43,14 +43,14 @@ class Processor protected $_state; /** - * @param \Magento\Indexer\Model\Indexer $indexer + * @param \Magento\Indexer\Model\IndexerFactory $indexerFactory * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $state */ public function __construct( - \Magento\Indexer\Model\Indexer $indexer, + \Magento\Indexer\Model\IndexerFactory $indexerFactory, \Magento\Catalog\Model\Indexer\Product\Flat\State $state ) { - $this->_indexer = $indexer; + $this->_indexer = $indexerFactory->create(); $this->_state = $state; } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php index d2dfcd325a3..1b14af3e689 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php @@ -45,7 +45,7 @@ class Mode extends \Magento\Core\Model\Config\Value * @param \Magento\App\ConfigInterface $config * @param \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor * @param \Magento\Indexer\Model\Indexer\State $indexerState - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -56,7 +56,7 @@ class Mode extends \Magento\Core\Model\Config\Value \Magento\App\ConfigInterface $config, \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor, \Magento\Indexer\Model\Indexer\State $indexerState, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.php new file mode 100644 index 00000000000..24ca0a08bcc --- /dev/null +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Model\Indexer\Product\Price\Plugin; + +class CatalogRule +{ + /** + * @var \Magento\Catalog\Model\Indexer\Product\Price\Processor + */ + protected $_processor; + + /** + * @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor + */ + public function __construct( + \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor + ) { + $this->_processor = $processor; + } + + /** + * Invalidate price indexer + * + * @param \Magento\CatalogRule\Model\Rule $subject + * + * @return void + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterApplyAll(\Magento\CatalogRule\Model\Rule $subject) + { + $this->_processor->markIndexerAsInvalid(); + } + + /** + * Reindex price for affected product + * + * @param \Magento\CatalogRule\Model\Rule $subject + * @param callable $proceed + * @param int|\Magento\Catalog\Model\Product $product + * @param null|array $websiteIds + * + * @return void + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundApplyToProduct( + \Magento\CatalogRule\Model\Rule $subject, + \Closure $proceed, + $product, + $websiteIds = null + ) { + $proceed($product, $websiteIds); + $this->_reindexProduct($product); + } + + /** + * Reindex price for affected product + * + * @param \Magento\CatalogRule\Model\Rule $subject + * @param callable $proceed + * @param int|\Magento\Catalog\Model\Product $product + * + * @return void + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundApplyAllRulesToProduct( + \Magento\CatalogRule\Model\Rule $subject, + \Closure $proceed, + $product + ) { + $proceed($product); + $this->_reindexProduct($product); + } + + /** + * Reindex product price + * + * @param int|\Magento\Catalog\Model\Product $product + * + * @return void + */ + protected function _reindexProduct($product) + { + $productId = is_numeric($product) ? $product : $product->getId(); + $this->_processor->reindexRow($productId); + } +} diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php index 311b4d3e8bf..cac8406b519 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php @@ -23,29 +23,31 @@ */ namespace Magento\Catalog\Model\Indexer\Product\Price\Plugin; +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; + class CustomerGroup extends AbstractPlugin { /** - * @param \Magento\Customer\Model\Resource\Group $subject - * @param \Magento\Customer\Model\Resource\Group $result - * @return \Magento\Customer\Model\Resource\Group + * @param CustomerGroupServiceInterface $subject + * @param string $result + * @return string * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterDelete(\Magento\Customer\Model\Resource\Group $subject, $result) + public function afterSaveGroup(CustomerGroupServiceInterface $subject, $result) { $this->invalidateIndexer(); return $result; } /** - * @param \Magento\Customer\Model\Resource\Group $subject - * @param \Magento\Customer\Model\Resource\Group $result - * @return \Magento\Customer\Model\Resource\Group + * @param CustomerGroupServiceInterface $subject + * @param string $result + * @return string * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterSave(\Magento\Customer\Model\Resource\Group $subject, $result) + public function afterDeleteGroup(CustomerGroupServiceInterface $subject, $result) { $this->invalidateIndexer(); return $result; diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Processor.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Processor.php index cd9dcddfe9c..5b62c15e001 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Processor.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Processor.php @@ -38,11 +38,12 @@ class Processor protected $_indexer; /** - * @param \Magento\Indexer\Model\IndexerInterface $indexer + * @param \Magento\Indexer\Model\IndexerFactory $indexerFactory */ - public function __construct(\Magento\Indexer\Model\IndexerInterface $indexer) - { - $this->_indexer = $indexer; + public function __construct( + \Magento\Indexer\Model\IndexerFactory $indexerFactory + ) { + $this->_indexer = $indexerFactory->create(); } /** diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php index d05003eb843..e9c45da9628 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php @@ -39,7 +39,7 @@ class PriceScope extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Indexer\Model\IndexerInterface $indexer - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -49,7 +49,7 @@ class PriceScope extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Indexer\Model\IndexerInterface $indexer, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Url.php b/app/code/Magento/Catalog/Model/Indexer/Url.php index baa7ccdfeff..251c76ba611 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Url.php +++ b/app/code/Magento/Catalog/Model/Indexer/Url.php @@ -87,7 +87,7 @@ class Url extends \Magento\Index\Model\Indexer\AbstractIndexer * @param \Magento\Registry $registry * @param \Magento\Catalog\Model\Resource\UrlFactory $catalogResourceUrlFactory * @param \Magento\Catalog\Model\Url $catalogUrl - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -96,7 +96,7 @@ class Url extends \Magento\Index\Model\Indexer\AbstractIndexer \Magento\Registry $registry, \Magento\Catalog\Model\Resource\UrlFactory $catalogResourceUrlFactory, \Magento\Catalog\Model\Url $catalogUrl, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Layer.php b/app/code/Magento/Catalog/Model/Layer.php index ce9ba6cfccc..69b1f01098d 100644 --- a/app/code/Magento/Catalog/Model/Layer.php +++ b/app/code/Magento/Catalog/Model/Layer.php @@ -226,7 +226,7 @@ class Layer extends \Magento\Object * * @param mixed $category * @return \Magento\Catalog\Model\Layer - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setCurrentCategory($category) { @@ -234,12 +234,12 @@ class Layer extends \Magento\Object $category = $this->_categoryFactory->create()->load($category); } if (!$category instanceof \Magento\Catalog\Model\Category) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The category must be an instance of \Magento\Catalog\Model\Category.') ); } if (!$category->getId()) { - throw new \Magento\Core\Exception(__('Please correct the category.')); + throw new \Magento\Model\Exception(__('Please correct the category.')); } if ($category->getId() != $this->getCurrentCategory()->getId()) { diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php b/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php index 30097a7c89f..66424e85424 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php @@ -276,13 +276,13 @@ abstract class AbstractFilter extends \Magento\Object * Get attribute model associated with filter * * @return \Magento\Catalog\Model\Resource\Eav\Attribute - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getAttributeModel() { $attribute = $this->getData('attribute_model'); if (is_null($attribute)) { - throw new \Magento\Core\Exception(__('The attribute model is not defined.')); + throw new \Magento\Model\Exception(__('The attribute model is not defined.')); } return $attribute; } diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Factory.php b/app/code/Magento/Catalog/Model/Layer/Filter/Factory.php index 90935eb20b9..6e1fe21ee86 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Factory.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Factory.php @@ -52,14 +52,14 @@ class Factory * @param string $className * @param array $data * @return \Magento\Catalog\Model\Layer\Filter\Attribute - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($className, array $data = array()) { $filter = $this->_objectManager->create($className, $data); if (!$filter instanceof \Magento\Catalog\Model\Layer\Filter\AbstractFilter) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( $className . ' doesn\'t extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter' ); } diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Item.php b/app/code/Magento/Catalog/Model/Layer/Filter/Item.php index 423a359cbb5..35cdacd0842 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Item.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Item.php @@ -70,13 +70,13 @@ class Item extends \Magento\Object * Get filter instance * * @return \Magento\Catalog\Model\Layer\Filter\AbstractFilter - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getFilter() { $filter = $this->getData('filter'); if (!is_object($filter)) { - throw new \Magento\Core\Exception(__('The filter must be an object. Please set correct filter.')); + throw new \Magento\Model\Exception(__('The filter must be an object. Please set correct filter.')); } return $filter; } diff --git a/app/code/Magento/Catalog/Model/Layer/State.php b/app/code/Magento/Catalog/Model/Layer/State.php index 446b5e06e56..0e519dd5b4a 100644 --- a/app/code/Magento/Catalog/Model/Layer/State.php +++ b/app/code/Magento/Catalog/Model/Layer/State.php @@ -53,12 +53,12 @@ class State extends \Magento\Object * * @param array $filters * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setFilters($filters) { if (!is_array($filters)) { - throw new \Magento\Core\Exception(__('The filters must be an array.')); + throw new \Magento\Model\Exception(__('The filters must be an array.')); } $this->setData('filters', $filters); return $this; diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 6ecea966a81..abafa246bb6 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -522,7 +522,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements \Magento\O */ public function getCategoryId() { - $category = $this->_coreRegistry->registry('current_category'); + $category = $this->_registry->registry('current_category'); if ($category) { return $category->getId(); } @@ -773,7 +773,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements \Magento\O */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); $this->cleanCache(); $this->_indexIndexer->logEvent($this, self::ENTITY, \Magento\Index\Model\Event::TYPE_DELETE); return parent::_beforeDelete(); diff --git a/app/code/Magento/Catalog/Model/Product/Action.php b/app/code/Magento/Catalog/Model/Product/Action.php index a62bbfc9720..785b93ececc 100644 --- a/app/code/Magento/Catalog/Model/Product/Action.php +++ b/app/code/Magento/Catalog/Model/Product/Action.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Product; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Action extends \Magento\Core\Model\AbstractModel +class Action extends \Magento\Model\AbstractModel { /** * Index indexer @@ -59,7 +59,7 @@ class Action extends \Magento\Core\Model\AbstractModel * @param \Magento\Catalog\Model\Product\WebsiteFactory $productWebsiteFactory * @param \Magento\Index\Model\Indexer $indexIndexer * @param \Magento\Indexer\Model\IndexerInterface $categoryIndexer - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -69,7 +69,7 @@ class Action extends \Magento\Core\Model\AbstractModel \Magento\Catalog\Model\Product\WebsiteFactory $productWebsiteFactory, \Magento\Index\Model\Indexer $indexIndexer, \Magento\Indexer\Model\IndexerInterface $categoryIndexer, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php index 554c86de984..d2fdecefd4b 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php @@ -18,23 +18,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_Catalog * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Model\Product\Attribute\Backend\Groupprice; +use Magento\Catalog\Model\Product\Attribute\Backend\Price; +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; /** * Catalog product abstract group price backend attribute model - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Model\Product\Attribute\Backend\Groupprice; - -abstract class AbstractGroupprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Price +abstract class AbstractGroupprice extends Price { /** * Website currency codes and rates @@ -147,7 +142,7 @@ abstract class AbstractGroupprice extends \Magento\Catalog\Model\Product\Attribu * Validate group price data * * @param \Magento\Catalog\Model\Product $object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validate($object) @@ -172,7 +167,7 @@ abstract class AbstractGroupprice extends \Magento\Catalog\Model\Product\Attribu ) ); if (isset($duplicates[$compare])) { - throw new \Magento\Core\Exception($this->_getDuplicateErrorMessage()); + throw new \Magento\Model\Exception($this->_getDuplicateErrorMessage()); } $duplicates[$compare] = true; } @@ -213,7 +208,7 @@ abstract class AbstractGroupprice extends \Magento\Catalog\Model\Product\Attribu $websiteCurrency = $rates[$priceRow['website_id']]['code']; if ($baseCurrency == $websiteCurrency && isset($duplicates[$globalCompare])) { - throw new \Magento\Core\Exception($this->_getDuplicateErrorMessage()); + throw new \Magento\Model\Exception($this->_getDuplicateErrorMessage()); } } @@ -271,7 +266,7 @@ abstract class AbstractGroupprice extends \Magento\Catalog\Model\Product\Attribu foreach ($data as $k => $v) { $data[$k]['website_price'] = $v['price']; if ($v['all_groups']) { - $data[$k]['cust_group'] = \Magento\Customer\Model\Group::CUST_GROUP_ALL; + $data[$k]['cust_group'] = CustomerGroupServiceInterface::CUST_GROUP_ALL; } } @@ -356,7 +351,7 @@ abstract class AbstractGroupprice extends \Magento\Catalog\Model\Product\Attribu array_merge(array($data['website_id'], $data['cust_group']), $this->_getAdditionalUniqueFields($data)) ); - $useForAllGroups = $data['cust_group'] == \Magento\Customer\Model\Group::CUST_GROUP_ALL; + $useForAllGroups = $data['cust_group'] == CustomerGroupServiceInterface::CUST_GROUP_ALL; $customerGroupId = !$useForAllGroups ? $data['cust_group'] : 0; $new[$key] = array_merge( 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 ff97bab8b93..f12421e52d6 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Model\Product\Attribute\Backend; -use Magento\Core\Exception; +use Magento\Model\Exception; class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend { diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php index 33cd75399db..eebc0c6fa7e 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php @@ -164,7 +164,7 @@ class Price extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * Validate * * @param \Magento\Catalog\Model\Product $object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validate($object) @@ -175,7 +175,7 @@ class Price extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend } if (!preg_match('/^\d*(\.|,)?\d{0,4}$/i', $value) || $value < 0) { - throw new \Magento\Core\Exception(__('Please enter a number 0 or greater in this field.')); + throw new \Magento\Model\Exception(__('Please enter a number 0 or greater in this field.')); } return true; diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php index 14c290269df..96092d09930 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php @@ -65,7 +65,7 @@ class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * Validate SKU * * @param Product $object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validate($object) @@ -77,7 +77,7 @@ class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend } if ($this->string->strlen($object->getSku()) > self::SKU_MAX_LENGTH) { - throw new \Magento\Core\Exception(__('SKU length should be %1 characters maximum.', self::SKU_MAX_LENGTH)); + throw new \Magento\Model\Exception(__('SKU length should be %1 characters maximum.', self::SKU_MAX_LENGTH)); } return true; } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php index bbef2afae0c..4c17cc120ac 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php @@ -99,7 +99,7 @@ class Stock extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * Validate * * @param Product $object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validate($object) @@ -107,7 +107,7 @@ class Stock extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $attrCode = $this->getAttribute()->getAttributeCode(); $value = $object->getData($attrCode); if (!empty($value['qty']) && !preg_match('/^-?\d*(\.|,)?\d{0,4}$/i', $value['qty'])) { - throw new \Magento\Core\Exception(__('Please enter a valid number in this field.')); + throw new \Magento\Model\Exception(__('Please enter a valid number in this field.')); } return true; } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Weight.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Weight.php index c5c6855d2b0..3759b25d60a 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Weight.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Weight.php @@ -40,7 +40,7 @@ class Weight extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * Validate * * @param \Magento\Catalog\Model\Product $object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validate($object) @@ -48,7 +48,7 @@ class Weight extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $attrCode = $this->getAttribute()->getAttributeCode(); $value = $object->getData($attrCode); if (!empty($value) && !\Zend_Validate::is($value, 'Between', array('min' => 0, 'max' => 99999999.9999))) { - throw new \Magento\Core\Exception(__('Please enter a number 0 or greater in this field.')); + throw new \Magento\Model\Exception(__('Please enter a number 0 or greater in this field.')); } return true; } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Group.php b/app/code/Magento/Catalog/Model/Product/Attribute/Group.php index f42959eb940..7d2b3721067 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Group.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Group.php @@ -39,7 +39,7 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Group * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -47,7 +47,7 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Group \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Compare/Item.php b/app/code/Magento/Catalog/Model/Product/Compare/Item.php index 26f2482e0b7..9a82598ac7f 100644 --- a/app/code/Magento/Catalog/Model/Product/Compare/Item.php +++ b/app/code/Magento/Catalog/Model/Product/Compare/Item.php @@ -37,12 +37,8 @@ use Magento\Catalog\Model\Product; * @method \Magento\Catalog\Model\Product\Compare\Item setProductId(int $value) * @method int getStoreId() * @method \Magento\Catalog\Model\Product\Compare\Item setStoreId(int $value) - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Item extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { /** * Model cache tag @@ -100,7 +96,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements \Magento\Object\ * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Helper\Product\Compare $catalogProductCompare - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -111,7 +107,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements \Magento\Object\ \Magento\Log\Model\Visitor $logVisitor, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Helper\Product\Compare $catalogProductCompare, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -157,18 +153,6 @@ class Item extends \Magento\Core\Model\AbstractModel implements \Magento\Object\ return $this; } - /** - * Add customer data from customer object - * - * @param \Magento\Customer\Model\Customer $customer - * @return $this - */ - public function addCustomerData(\Magento\Customer\Model\Customer $customer) - { - $this->setCustomerId($customer->getId()); - return $this; - } - /** * Set visitor * diff --git a/app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php b/app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php index 2fd77cdb824..c5cd7bdb070 100644 --- a/app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php +++ b/app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php @@ -172,7 +172,7 @@ class ListCompare extends \Magento\Object { $item->addVisitorId($this->_logVisitor->getId()); if ($this->_customerSession->isLoggedIn()) { - $item->addCustomerData($this->_customerSession->getCustomer()); + $item->setCustomerId($this->_customerSession->getCustomerId()); } return $this; @@ -187,6 +187,6 @@ class ListCompare extends \Magento\Object */ public function hasItems($customerId, $visitorId) { - return $this->_catalogProductCompareItem->getCount($customerId, $visitorId); + return (bool)$this->_catalogProductCompareItem->getCount($customerId, $visitorId); } } diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 4bb7bd51385..806803108d4 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -36,7 +36,7 @@ namespace Magento\Catalog\Model\Product; use Magento\Core\Model\Store; use Magento\Image as MagentoImage; -class Image extends \Magento\Core\Model\AbstractModel +class Image extends \Magento\Model\AbstractModel { /** * @var int @@ -192,7 +192,7 @@ class Image extends \Magento\Core\Model\AbstractModel * @param \Magento\View\Url $viewUrl * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -207,7 +207,7 @@ class Image extends \Magento\Core\Model\AbstractModel \Magento\View\Url $viewUrl, \Magento\View\FileSystem $viewFileSystem, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Indexer/Eav.php b/app/code/Magento/Catalog/Model/Product/Indexer/Eav.php index 5528e708290..8a6c47270bb 100644 --- a/app/code/Magento/Catalog/Model/Product/Indexer/Eav.php +++ b/app/code/Magento/Catalog/Model/Product/Indexer/Eav.php @@ -67,7 +67,7 @@ class Eav extends \Magento\Index\Model\Indexer\AbstractIndexer * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -75,7 +75,7 @@ class Eav extends \Magento\Index\Model\Indexer\AbstractIndexer \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Link.php b/app/code/Magento/Catalog/Model/Product/Link.php index d65f0c7be08..41a1d3d46c6 100644 --- a/app/code/Magento/Catalog/Model/Product/Link.php +++ b/app/code/Magento/Catalog/Model/Product/Link.php @@ -44,7 +44,7 @@ use Magento\Catalog\Model\Resource\Product\Link\Product\Collection as ProductCol * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Link extends \Magento\Core\Model\AbstractModel +class Link extends \Magento\Model\AbstractModel { const LINK_TYPE_RELATED = 1; @@ -76,7 +76,7 @@ class Link extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Catalog\Model\Resource\Product\Link\CollectionFactory $linkCollectionFactory * @param \Magento\Catalog\Model\Resource\Product\Link\Product\CollectionFactory $productCollectionFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -85,7 +85,7 @@ class Link extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Catalog\Model\Resource\Product\Link\CollectionFactory $linkCollectionFactory, \Magento\Catalog\Model\Resource\Product\Link\Product\CollectionFactory $productCollectionFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Option.php b/app/code/Magento/Catalog/Model/Product/Option.php index 45eaf6499a0..ae31863b036 100644 --- a/app/code/Magento/Catalog/Model/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Product/Option.php @@ -27,8 +27,8 @@ namespace Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Resource\Product\Option\Value\Collection; -use Magento\Core\Exception; -use Magento\Core\Model\AbstractModel; +use Magento\Model\Exception; +use Magento\Model\AbstractModel; /** * Catalog product option model @@ -127,7 +127,7 @@ class Option extends AbstractModel * @param Option\Value $productOptionValue * @param \Magento\Catalog\Model\Product\Option\Type\Factory $optionFactory * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -137,7 +137,7 @@ class Option extends AbstractModel Option\Value $productOptionValue, \Magento\Catalog\Model\Product\Option\Type\Factory $optionFactory, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -150,7 +150,7 @@ class Option extends AbstractModel /** * Get resource instance * - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @return \Magento\Model\Resource\Db\AbstractDb */ protected function _getResource() { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php index f133ebd4dc2..8adc72f5133 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php @@ -65,7 +65,7 @@ class Date extends \Magento\Catalog\Model\Product\Option\Type\DefaultType * * @param array $values All product option values, i.e. array (option_id => mixed, option_id => mixed...) * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validateUserValue($values) { @@ -120,11 +120,11 @@ class Date extends \Magento\Catalog\Model\Product\Option\Type\DefaultType } elseif (!$isValid && $option->getIsRequire() && !$this->getSkipCheckRequiredOption()) { $this->setIsValid(false); if (!$dateValid) { - throw new \Magento\Core\Exception(__('Please specify date required option(s).')); + throw new \Magento\Model\Exception(__('Please specify date required option(s).')); } elseif (!$timeValid) { - throw new \Magento\Core\Exception(__('Please specify time required option(s).')); + throw new \Magento\Model\Exception(__('Please specify time required option(s).')); } else { - throw new \Magento\Core\Exception(__('Please specify the product\'s required option(s).')); + throw new \Magento\Model\Exception(__('Please specify the product\'s required option(s).')); } } else { $this->setUserValue(null); @@ -138,7 +138,7 @@ class Date extends \Magento\Catalog\Model\Product\Option\Type\DefaultType * Prepare option value for cart * * @return string|null Prepared option value - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function prepareForCart() { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php index 4976f5f79b9..15e47000266 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php @@ -25,7 +25,7 @@ */ namespace Magento\Catalog\Model\Product\Option\Type; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Catalog product option default type diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Factory.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Factory.php index f04f10a391f..d8bf51a94bc 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Factory.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Factory.php @@ -52,14 +52,14 @@ class Factory * @param string $className * @param array $data * @return \Magento\Catalog\Model\Product\Option\Type\DefaultType - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($className, array $data = array()) { $option = $this->_objectManager->create($className, $data); if (!$option instanceof \Magento\Catalog\Model\Product\Option\Type\DefaultType) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( $className . ' doesn\'t extends \Magento\Catalog\Model\Product\Option\Type\DefaultType' ); } 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 e54d6a2ea22..e327c3609be 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -25,7 +25,7 @@ */ namespace Magento\Catalog\Model\Product\Option\Type; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Catalog product option file type diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php index 9ffbbbca394..e239ae4acc1 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php @@ -25,7 +25,7 @@ */ namespace Magento\Catalog\Model\Product\Option\Type; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Catalog product option select type diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php index f8e14be6e55..2ef030b0f46 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php @@ -25,7 +25,7 @@ */ namespace Magento\Catalog\Model\Product\Option\Type; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Catalog product option text type diff --git a/app/code/Magento/Catalog/Model/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Product/Option/Value.php index ce11e11dd21..3a1992c8c58 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Value.php @@ -42,7 +42,7 @@ use Magento\Catalog\Model\Product\Option; * * @SuppressWarnings(PHPMD.LongVariable) */ -class Value extends \Magento\Core\Model\AbstractModel +class Value extends \Magento\Model\AbstractModel { /** * @var array @@ -70,7 +70,7 @@ class Value extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $valueCollectionFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -78,7 +78,7 @@ class Value extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $valueCollectionFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index d0063929fe9..1e19df3bfa6 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -381,7 +381,7 @@ abstract class AbstractType // try to add custom options try { $options = $this->_prepareOptions($buyRequest, $product, $processMode); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { return $e->getMessage(); } @@ -488,7 +488,7 @@ abstract class AbstractType * Process File Queue * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function processFileQueue() { @@ -511,7 +511,7 @@ abstract class AbstractType $rootDir = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $rootDir->create($rootDir->getRelativePath($path)); } catch (\Magento\Filesystem\FilesystemException $e) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __("We can't create writeable directory \"%1\".", $path) ); } @@ -525,7 +525,7 @@ abstract class AbstractType if (isset($queueOptions['option'])) { $queueOptions['option']->setIsValid(false); } - throw new \Magento\Core\Exception(__("The file upload failed.")); + throw new \Magento\Model\Exception(__("The file upload failed.")); } $this->_fileStorageDb->saveFile($dst); break; @@ -620,7 +620,7 @@ abstract class AbstractType * * @param \Magento\Catalog\Model\Product $product * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function checkProductBuyState($product) { @@ -630,7 +630,7 @@ abstract class AbstractType $customOption = $product->getCustomOption(self::OPTION_PREFIX . $option->getId()); if (!$customOption || strlen($customOption->getValue()) == 0) { $product->setSkipCheckRequiredOption(true); - throw new \Magento\Core\Exception(__('The product has required options.')); + throw new \Magento\Model\Exception(__('The product has required options.')); } } } @@ -1045,7 +1045,7 @@ abstract class AbstractType if (is_string($result)) { $errors[] = $result; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $errors[] = $e->getMessages(); } catch (\Exception $e) { $this->_logger->logException($e); diff --git a/app/code/Magento/Catalog/Model/Product/Type/Pool.php b/app/code/Magento/Catalog/Model/Product/Type/Pool.php index 2b5a6af2f5a..6b844d3c8d0 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Pool.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Pool.php @@ -52,14 +52,14 @@ class Pool * @param string $className * @param array $data * @return \Magento\Catalog\Model\Product\Type\AbstractType - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function get($className, array $data = array()) { $product = $this->_objectManager->get($className, $data); if (!$product instanceof \Magento\Catalog\Model\Product\Type\AbstractType) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( $className . ' doesn\'t extends \Magento\Catalog\Model\Product\Type\AbstractType' ); } diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php old mode 100644 new mode 100755 index b4908c97ac6..5965d59c7b4 --- a/app/code/Magento/Catalog/Model/Product/Type/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price.php @@ -250,7 +250,7 @@ class Price */ public function getTierPrice($qty, $product) { - $allGroups = \Magento\Customer\Model\Group::CUST_GROUP_ALL; + $allGroups = \Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL; $prices = $product->getData('tier_price'); if (is_null($prices)) { diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price/Factory.php b/app/code/Magento/Catalog/Model/Product/Type/Price/Factory.php index 34176032195..7bc114f121f 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Price/Factory.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price/Factory.php @@ -52,14 +52,14 @@ class Factory * @param string $className * @param array $data * @return \Magento\Catalog\Model\Product\Type\Price - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($className, array $data = array()) { $price = $this->_objectManager->create($className, $data); if (!$price instanceof \Magento\Catalog\Model\Product\Type\Price) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( $className . ' doesn\'t extends \Magento\Catalog\Model\Product\Type\Price' ); } diff --git a/app/code/Magento/Catalog/Model/Product/Url.php b/app/code/Magento/Catalog/Model/Product/Url.php index 02181f016d2..90f2a85d9f2 100644 --- a/app/code/Magento/Catalog/Model/Product/Url.php +++ b/app/code/Magento/Catalog/Model/Product/Url.php @@ -191,7 +191,7 @@ class Url extends \Magento\Object * @param \Magento\Catalog\Model\Category $category * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getUrlPath($product, $category = null) { @@ -201,7 +201,7 @@ class Url extends \Magento\Object /** @todo get default category */ return $path; } elseif (!$category instanceof \Magento\Catalog\Model\Category) { - throw new \Magento\Core\Exception('Invalid category object supplied'); + throw new \Magento\Model\Exception('Invalid category object supplied'); } return $this->_catalogCategory->getCategoryUrlPath($category->getUrlPath()) . '/' . $path; diff --git a/app/code/Magento/Catalog/Model/Product/Website.php b/app/code/Magento/Catalog/Model/Product/Website.php index 36777346b57..152fa844000 100644 --- a/app/code/Magento/Catalog/Model/Product/Website.php +++ b/app/code/Magento/Catalog/Model/Product/Website.php @@ -39,7 +39,7 @@ */ namespace Magento\Catalog\Model\Product; -class Website extends \Magento\Core\Model\AbstractModel +class Website extends \Magento\Model\AbstractModel { /** * Initialize resource model @@ -67,14 +67,14 @@ class Website extends \Magento\Core\Model\AbstractModel * @param array $websiteIds * @param array $productIds * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function removeProducts($websiteIds, $productIds) { try { $this->_getResource()->removeProducts($websiteIds, $productIds); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('Something went wrong removing products from the websites.')); + throw new \Magento\Model\Exception(__('Something went wrong removing products from the websites.')); } return $this; } @@ -85,14 +85,14 @@ class Website extends \Magento\Core\Model\AbstractModel * @param array $websiteIds * @param array $productIds * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addProducts($websiteIds, $productIds) { try { $this->_getResource()->addProducts($websiteIds, $productIds); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('Something went wrong adding products to websites.')); + throw new \Magento\Model\Exception(__('Something went wrong adding products to websites.')); } return $this; } diff --git a/app/code/Magento/Catalog/Model/Resource/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Attribute.php index 5ef305ec8e3..173d6d46c2e 100644 --- a/app/code/Magento/Catalog/Model/Resource/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Attribute.php @@ -70,10 +70,10 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { $applyTo = $object->getApplyTo(); if (is_array($applyTo)) { @@ -85,10 +85,10 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $this->_clearUselessAttributeValues($object); return parent::_afterSave($object); @@ -97,10 +97,10 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute /** * Clear useless attribute values * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _clearUselessAttributeValues(\Magento\Core\Model\AbstractModel $object) + protected function _clearUselessAttributeValues(\Magento\Model\AbstractModel $object) { $origData = $object->getOrigData(); @@ -125,11 +125,11 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute /** * Delete entity * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - public function deleteEntity(\Magento\Core\Model\AbstractModel $object) + public function deleteEntity(\Magento\Model\AbstractModel $object) { if (!$object->getEntityAttributeId()) { return $this; @@ -151,8 +151,8 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute try { $this->attrLockValidator->validate($attribute, $result['attribute_set_id']); - } catch (\Magento\Core\Exception $exception) { - throw new \Magento\Core\Exception( + } catch (\Magento\Model\Exception $exception) { + throw new \Magento\Model\Exception( __("Attribute '%1' is locked. ", $attribute->getAttributeCode()) . $exception->getMessage() ); } diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php index a841b9613be..7c76bcde49a 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php @@ -48,7 +48,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Collection * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -57,7 +57,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Collection \Magento\Event\ManagerInterface $eventManager, \Magento\Eav\Model\EntityFactory $eavEntityFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_eavEntityFactory = $eavEntityFactory; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php index 47ae821e0b5..01fffa83ae8 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Category\Flat; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Event prefix @@ -69,7 +69,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -78,7 +78,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Catalog/Model/Resource/Config.php b/app/code/Magento/Catalog/Model/Resource/Config.php index f53bd5d870b..d8ebeaf670b 100644 --- a/app/code/Magento/Catalog/Model/Resource/Config.php +++ b/app/code/Magento/Catalog/Model/Resource/Config.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Config extends \Magento\Core\Model\Resource\Db\AbstractDb +class Config extends \Magento\Model\Resource\Db\AbstractDb { /** * catalog_product entity type id diff --git a/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php index bfcad10cf5f..69d86627aed 100644 --- a/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php @@ -142,7 +142,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute * @param \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productFlatIndexerHelper * @param LockValidatorInterface $lockValidator - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -162,7 +162,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor, \Magento\Catalog\Helper\Product\Flat\Indexer $productFlatIndexerHelper, LockValidatorInterface $lockValidator, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -199,8 +199,8 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute /** * Processing object before save data * - * @return \Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return \Magento\Model\AbstractModel + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -212,8 +212,8 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute if ($this->_data['is_global'] != $this->_origData['is_global']) { try { $this->attrLockValidator->validate($this); - } catch (\Magento\Core\Exception $exception) { - throw new \Magento\Core\Exception(__('Do not change the scope. ' . $exception->getMessage())); + } catch (\Magento\Model\Exception $exception) { + throw new \Magento\Model\Exception(__('Do not change the scope. ' . $exception->getMessage())); } } } @@ -233,7 +233,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute /** * Processing object after save data * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterSave() { @@ -273,7 +273,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute * Register indexing event before delete catalog eav attribute * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeDelete() { diff --git a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Attribute.php index 5c3b5c04ebd..ccff61097ef 100644 --- a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Attribute.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Layer\Filter; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb +class Attribute extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table name diff --git a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Decimal.php b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Decimal.php index e8d635c8914..f35a2fa8d4e 100644 --- a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Decimal.php +++ b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Decimal.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Layer\Filter; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Decimal extends \Magento\Core\Model\Resource\Db\AbstractDb +class Decimal extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table name diff --git a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php index 481031a9ce9..5e8196ca776 100644 --- a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php +++ b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Layer\Filter; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Price extends \Magento\Core\Model\Resource\Db\AbstractDb +class Price extends \Magento\Model\Resource\Db\AbstractDb { /** * Minimal possible price diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php index 15fd3bb9d9d..68373ad56ad 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php @@ -34,7 +34,7 @@ */ namespace Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice; -abstract class AbstractGroupprice extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractGroupprice extends \Magento\Model\Resource\Db\AbstractDb { /** * Load Tier Prices for product diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php index 8575bffecbb..c4f0ea1f3ef 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product\Attribute\Backend; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Media extends \Magento\Core\Model\Resource\Db\AbstractDb +class Media extends \Magento\Model\Resource\Db\AbstractDb { const GALLERY_TABLE = 'catalog_product_entity_media_gallery'; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php index d82f3b79011..80b616fe095 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php @@ -48,7 +48,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Collection * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -57,7 +57,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Collection \Magento\Event\ManagerInterface $eventManager, \Magento\Eav\Model\EntityFactory $eavEntityFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_eavEntityFactory = $eavEntityFactory; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php index eaae6b81edb..aa09cb3ea87 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php @@ -27,6 +27,7 @@ namespace Magento\Catalog\Model\Resource\Product; use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus; use Magento\Core\Model\Store; +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; /** * Product collection @@ -513,7 +514,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl */ public function setEntity($entity) { - if ($this->isEnabledFlat() && $entity instanceof \Magento\Core\Model\Resource\Db\AbstractDb) { + if ($this->isEnabledFlat() && $entity instanceof \Magento\Model\Resource\Db\AbstractDb) { $this->_entity = $entity; return $this; } @@ -2075,10 +2076,11 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl foreach ($adapter->fetchAll($select) as $row) { $tierPrices[$row['product_id']][] = array( 'website_id' => $row['website_id'], - 'cust_group' => $row['all_groups'] ? \Magento\Customer\Model\Group::CUST_GROUP_ALL : $row['cust_group'], + 'cust_group' => $row['all_groups'] ? CustomerGroupServiceInterface::CUST_GROUP_ALL : $row['cust_group'], 'price_qty' => $row['price_qty'], 'price' => $row['price'], - 'website_price' => $row['price'] + 'website_price' => $row['price'], + ); } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item.php b/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item.php index 87d8ea23979..5fc1b3d9d9a 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product\Compare; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\Resource\Db\AbstractDb +class Item extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Flat.php b/app/code/Magento/Catalog/Model/Resource/Product/Flat.php index 5c7bc4f389c..c6ec3435ecf 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Flat.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Flat.php @@ -34,7 +34,7 @@ use Magento\Core\Model\Store; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Flat extends \Magento\Core\Model\Resource\Db\AbstractDb +class Flat extends \Magento\Model\Resource\Db\AbstractDb { /** * Store scope Id diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php index 5d2a6d39bf9..9ce0342ff06 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php @@ -104,13 +104,13 @@ class Eav extends AbstractIndexer * * @param string $type * @return \Magento\Catalog\Model\Resource\Product\Indexer\Eav\AbstractEav - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getIndexer($type) { $indexers = $this->getIndexers(); if (!isset($indexers[$type])) { - throw new \Magento\Core\Exception(__('We found an unknown EAV indexer type "%1".', $type)); + throw new \Magento\Model\Exception(__('We found an unknown EAV indexer type "%1".', $type)); } return $indexers[$type]; } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Link.php b/app/code/Magento/Catalog/Model/Resource/Product/Link.php index 917ea73a121..ef919978887 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Link.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Link.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Link extends \Magento\Core\Model\Resource\Db\AbstractDb +class Link extends \Magento\Model\Resource\Db\AbstractDb { /** * Product Link Attributes Table diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Link/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Link/Collection.php index 8dd97a7f373..9b8997e84bc 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Link/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Link/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product\Link; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Product object diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option.php b/app/code/Magento/Catalog/Model/Resource/Product/Option.php index 63226107ff4..a43c43a9df6 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\Resource\Db\AbstractDb +class Option extends \Magento\Model\Resource\Db\AbstractDb { /** * Store manager @@ -88,10 +88,10 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save options store data * - * @param \Magento\Core\Model\AbstractModel $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $this->_saveValuePrices($object); $this->_saveValueTitles($object); @@ -102,10 +102,10 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save value prices * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _saveValuePrices(\Magento\Core\Model\AbstractModel $object) + protected function _saveValuePrices(\Magento\Model\AbstractModel $object) { $priceTable = $this->getTable('catalog_product_option_price'); $readAdapter = $this->_getReadAdapter(); @@ -247,10 +247,10 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save titles * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return void */ - protected function _saveValueTitles(\Magento\Core\Model\AbstractModel $object) + protected function _saveValueTitles(\Magento\Model\AbstractModel $object) { $readAdapter = $this->_getReadAdapter(); $writeAdapter = $this->_getWriteAdapter(); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php index 10cd58a012f..8662843eed8 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php @@ -30,7 +30,7 @@ namespace Magento\Catalog\Model\Resource\Product\Option; * * @SuppressWarnings(PHPMD.LongVariable) */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store manager @@ -54,7 +54,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $optionValueCollectionFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -64,7 +64,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $optionValueCollectionFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_optionValueCollectionFactory = $optionValueCollectionFactory; $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php index bf3c0d2ef68..fbb6d6b259d 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product\Option; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Value extends \Magento\Core\Model\Resource\Db\AbstractDb +class Value extends \Magento\Model\Resource\Db\AbstractDb { /** * Store manager @@ -89,10 +89,10 @@ class Value extends \Magento\Core\Model\Resource\Db\AbstractDb * Proceed operations after object is saved * Save options store data * - * @param \Magento\Core\Model\AbstractModel $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $this->_saveValuePrices($object); $this->_saveValueTitles($object); @@ -103,10 +103,10 @@ class Value extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save option value price data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return void */ - protected function _saveValuePrices(\Magento\Core\Model\AbstractModel $object) + protected function _saveValuePrices(\Magento\Model\AbstractModel $object) { $priceTable = $this->getTable('catalog_product_option_type_price'); @@ -215,10 +215,10 @@ class Value extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save option value title data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return void */ - protected function _saveValueTitles(\Magento\Core\Model\AbstractModel $object) + protected function _saveValueTitles(\Magento\Model\AbstractModel $object) { $titleTable = $this->getTable('catalog_product_option_type_title'); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value/Collection.php index 2d959f27ef2..a540942437e 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product\Option\Value; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Relation.php b/app/code/Magento/Catalog/Model/Resource/Product/Relation.php index c0ba908d237..cb3e915dec7 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Relation.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Relation.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Relation extends \Magento\Core\Model\Resource\Db\AbstractDb +class Relation extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize resource model and define main table diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Website.php b/app/code/Magento/Catalog/Model/Resource/Product/Website.php index e8783e99666..e126fb05668 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Website.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Website.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Model\Resource\Product; /** * Catalog Product Website Resource Model */ -class Website extends \Magento\Core\Model\Resource\Db\AbstractDb +class Website extends \Magento\Model\Resource\Db\AbstractDb { /** * Store manager diff --git a/app/code/Magento/Catalog/Model/Resource/Url.php b/app/code/Magento/Catalog/Model/Resource/Url.php index b967fb03530..71b468b41de 100644 --- a/app/code/Magento/Catalog/Model/Resource/Url.php +++ b/app/code/Magento/Catalog/Model/Resource/Url.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Url extends \Magento\Core\Model\Resource\Db\AbstractDb +class Url extends \Magento\Model\Resource\Db\AbstractDb { /** * Stores configuration array @@ -358,7 +358,7 @@ class Url extends \Magento\Core\Model\Resource\Db\AbstractDb * @param array $rewriteData * @param int|\Magento\Object $rewrite * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function saveRewrite($rewriteData, $rewrite) { @@ -367,7 +367,7 @@ class Url extends \Magento\Core\Model\Resource\Db\AbstractDb $adapter->insertOnDuplicate($this->getMainTable(), $rewriteData); } catch (\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('Something went wrong saving the URL rewite.')); + throw new \Magento\Model\Exception(__('Something went wrong saving the URL rewite.')); } if ($rewrite && $rewrite->getId()) { diff --git a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php index f5427e9c804..79337d55bed 100644 --- a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php +++ b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php @@ -44,7 +44,7 @@ class Suffix extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Helper\Url\Rewrite $coreUrlRewrite - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -54,7 +54,7 @@ class Suffix extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Helper\Url\Rewrite $coreUrlRewrite, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Template/Filter/Factory.php b/app/code/Magento/Catalog/Model/Template/Filter/Factory.php index 4c01c84adae..f77945d0179 100644 --- a/app/code/Magento/Catalog/Model/Template/Filter/Factory.php +++ b/app/code/Magento/Catalog/Model/Template/Filter/Factory.php @@ -52,14 +52,14 @@ class Factory * @param string $className * @param array $data * @return \Magento\Filter\Template - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($className, array $data = array()) { $filter = $this->_objectManager->create($className, $data); if (!$filter instanceof \Magento\Filter\Template) { - throw new \Magento\Core\Exception($className . ' doesn\'t extends \Magento\Filter\Template'); + throw new \Magento\Model\Exception($className . ' doesn\'t extends \Magento\Filter\Template'); } return $filter; } diff --git a/app/code/Magento/Catalog/Model/Url.php b/app/code/Magento/Catalog/Model/Url.php index b85c3e2831b..c489a597cd1 100644 --- a/app/code/Magento/Catalog/Model/Url.php +++ b/app/code/Magento/Catalog/Model/Url.php @@ -902,12 +902,12 @@ class Url * @param \Magento\Object $category * @param string $parentPath * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function generatePath($type = 'target', $product = null, $category = null, $parentPath = null) { if (!$product && !$category) { - throw new \Magento\Core\Exception(__('Please specify either a category or a product, or both.')); + throw new \Magento\Model\Exception(__('Please specify either a category or a product, or both.')); } // generate id_path @@ -949,7 +949,7 @@ class Url // for product & category if (!$category) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('A category object is required for determining the product request path.') ); } diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 4038c71c1b2..f0574227d63 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -29,6 +29,7 @@ <preference for="Magento\Catalog\Model\Product\PriceModifierInterface" type="Magento\Catalog\Model\Product\PriceModifier\Composite" /> <preference for="Magento\Catalog\Model\Attribute\LockValidatorInterface" type="Magento\Catalog\Model\Attribute\LockValidatorComposite" /> <preference for="Magento\Catalog\Model\Entity\Product\Attribute\Group\AttributeMapperInterface" type="Magento\Catalog\Model\Entity\Product\Attribute\Group\AttributeMapper" /> + <preference for="Magento\Catalog\Block\Product\ReviewRendererInterface" type="Magento\Catalog\Block\Product\ReviewRenderer\DefaultProvider" /> <type name="Magento\Log\Model\Resource\Log"> <plugin name="catalogLog" type="Magento\Catalog\Model\Plugin\Log" /> </type> @@ -168,7 +169,7 @@ <plugin name="catalogProductFlatIndexerStoreGroup" type="Magento\Catalog\Model\Indexer\Product\Flat\Plugin\StoreGroup" /> <plugin name="categoryStoreGroupAroundSave" type="Magento\Catalog\Model\Indexer\Category\Product\Plugin\StoreGroup"/> </type> - <type name="Magento\Customer\Model\Resource\Group"> + <type name="Magento\Customer\Service\V1\CustomerGroupServiceInterface"> <plugin name="invalidatePriceIndexerOnCustomerGroup" type="Magento\Catalog\Model\Indexer\Product\Price\Plugin\CustomerGroup"/> </type> <type name="Magento\Catalog\Model\Indexer\Product\Price\Plugin\AbstractPlugin"> @@ -202,15 +203,13 @@ <argument name="indexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument> </arguments> </type> - <type name="Magento\Catalog\Model\Indexer\Product\Flat\Processor"> - <arguments> - <argument name="indexer" xsi:type="object" shared="true">Magento\Indexer\Model\Indexer</argument> - </arguments> - </type> <type name="Magento\ImportExport\Model\Import"> <plugin name="catalogProductFlatIndexerImport" type="\Magento\Catalog\Model\Indexer\Product\Flat\Plugin\Import" /> <plugin name="invalidatePriceIndexerOnImport" type="\Magento\Catalog\Model\Indexer\Product\Price\Plugin\Import" /> </type> + <type name="Magento\CatalogRule\Model\Rule"> + <plugin name="reindexPriceOnRuleApply" type="\Magento\Catalog\Model\Indexer\Product\Price\Plugin\CatalogRule" /> + </type> <type name="Magento\Catalog\Helper\Product\Flat\Indexer"> <arguments> <argument name="flatAttributeGroups" xsi:type="array"> @@ -312,4 +311,12 @@ <plugin name="page-cache-indexer-reindex-product-flat" type="Magento\Catalog\Model\Indexer\Product\AffectCache" sortOrder="10"/> </type> + <type name="Magento\Model\ActionValidator\RemoveAction"> + <arguments> + <argument name="protectedModels" xsi:type="array"> + <item name="catalogCategory" xsi:type="string">Magento\Catalog\Model\Category</item> + <item name="catalogProduct" xsi:type="string">Magento\Catalog\Model\Product</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml index b7a373541de..7fd7dcedb6b 100644 --- a/app/code/Magento/Catalog/etc/module.xml +++ b/app/code/Magento/Catalog/etc/module.xml @@ -45,7 +45,6 @@ <module name="Magento_Backend"/> <module name="Magento_Widget"/> <module name="Magento_Wishlist"/> - <module name="Magento_Review"/> <module name="Magento_Tax"/> <module name="Magento_Bundle"/> <module name="Magento_ImportExport"/> @@ -56,7 +55,6 @@ <module name="Magento_CatalogSearch"/> <module name="Magento_Weee"/> <module name="Magento_ProductAlert"/> - <module name="Magento_Rating"/> </depends> </module> </config> diff --git a/app/code/Magento/Catalog/i18n/de_DE.csv b/app/code/Magento/Catalog/i18n/de_DE.csv index ef810ff0aa7..1ab046da2d9 100644 --- a/app/code/Magento/Catalog/i18n/de_DE.csv +++ b/app/code/Magento/Catalog/i18n/de_DE.csv @@ -58,7 +58,6 @@ "Amount","Summe" "An error occurred while adding products to websites.","Ein Fehler ist aufgetreten, während Produkte zu Webseiten hinzugefügt wurden." "An error occurred while clearing comparison list.","Beim Löschen der Vergleichsliste ist ein Fehler aufgetreten." -"An error occurred while deleting this review.","Beim Löschen dieser Rezension ist ein Fehler aufgetreten." "An error occurred while removing products from websites.","Ein Fehler ist aufgetreten, während Produkte von Webseiten entfernt wurden." "An error occurred while saving the URL rewrite","Ein Fehler ist beim Speichern der URL-Umschreibung aufgetreten." "An error occurred while saving the attribute set.","Beim Speichern des Eigenschaftensatzes ist ein Fehler aufgetreten." @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","Beim Speichern des Produktes ist ein Fehler aufgetreten." "An error occurred while saving the search query.","Beim Speichern der Suchanfrage ist ein Fehler aufgetreten." "An error occurred while saving this group.","Beim Speichern dieser Gruppe ist ein Fehler aufgetreten." -"An error occurred while saving this review.","Beim Speichern der Rezension ist ein Fehler aufgetreten." "An error occurred while trying to delete the category.","Beim Versuch die Kategorie zu löschen ist ein Fehler aufgetreten." "An error occurred while updating the product(s) attributes.","Beim Aktualisieren der Eigenschaften der/des Produkte(s) ist ein Fehler aufgetreten." "An error occurred while updating the product(s) status.","Bei der Aktualisierung des Status der/des Produkte(s) ist ein Fehler aufgetreten." @@ -211,7 +209,6 @@ "Custom Options","Kundenoptionen" "Custom options","Benutzerdefinierte Optionen" "Customer Group","Kundengruppe" -"Customers Reviews","Berichte der Kunden" "Customers Tagged Product","Produkt vom Kunden markiert" "Data Type for Saving in Database","Datentyp für das Speichern in Datenbank" "Date & Time Custom Options","Benutzerdefinierten Optionen bezüglich Datum und Uhrzeit" @@ -442,7 +439,6 @@ "Page Title Separator","Trennzeichen im Seitentitel" "Parent Category","Überkategorie" "Pending","Ausstehend" -"Pending Reviews RSS","Ausstehende Kundenmeinungen RSS" "Percentage","Prozentsatz" "Please add rows to option.","Bitte Zeilen zur Option hinzufügen." "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","ACHTUNG: Bei einem Klick auf die Zeile werden die Paketdaten geladen und überschreiben alle ungespeicherten Formulardaten." @@ -499,7 +495,6 @@ "Product Listing Sort by","Verfügbare Produktauflistung sortiert nach" "Product","Produktbezeichnung" "Product Prices","Produktpreise" -"Product Reviews","Produktreviews" "Product Tags","Produkttags" "Product Tier Price API","Produktstaffelpreis API" "Product Type","Produkttyp" @@ -515,7 +510,6 @@ "Products","Produkte" "Products Comparison List","Produkt Vergleichsliste" "Products Information","Produktinformationen" -"Products Reviews","Artikelbewertungen" "Products Sitemap","Sitemap Produkte" "Products only","Nur Produkte" "Products per Page on Grid Allowed Values","Produkte pro Seite (erlaubte Werte für Gitter)" @@ -579,7 +573,6 @@ "Retrieve product types","Produkttypen abrufen" "Retrieve products data","Produktdaten abfragen" "Retrieve products list by filters","Produktliste gemäß Filter abrufen" -"Reviews","Bewertungen" "Roll Over for preview","Darüber scrollen für eine Vorschau" "Root","Root" "SKU","Artikelposition" @@ -678,9 +671,6 @@ "The product has been duplicated.","Das Produkt wurde dupliziert." "The product has been saved.","Das Produkt wurde gespeichert." "The product has required options","Das Produkt hat Pflichtangaben" -"The review has been deleted","Diese Bewertung wurde gelöscht" -"The review has been saved.","Diese Bewertung wrude gespeichert." -"The review was removed by another user or does not exist.","Diese Bewertung wurde von einem anderen Benutzer entfernt oder existiert nicht." "The search was deleted.","Diese Suche wurde gelöscht." "The text is too long","Der Text ist zu lang" "There are no %s available.","Es sind keine %s verfügbar." diff --git a/app/code/Magento/Catalog/i18n/en_US.csv b/app/code/Magento/Catalog/i18n/en_US.csv index a558c4df832..73557c01ae2 100644 --- a/app/code/Magento/Catalog/i18n/en_US.csv +++ b/app/code/Magento/Catalog/i18n/en_US.csv @@ -58,7 +58,6 @@ "Amount","Amount" "An error occurred while adding products to websites.","An error occurred while adding products to websites." "An error occurred while clearing comparison list.","An error occurred while clearing comparison list." -"An error occurred while deleting this review.","An error occurred while deleting this review." "An error occurred while removing products from websites.","An error occurred while removing products from websites." "An error occurred while saving the URL rewrite","An error occurred while saving the URL rewrite" "An error occurred while saving the attribute set.","An error occurred while saving the attribute set." @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","An error occurred while saving the product. " "An error occurred while saving the search query.","An error occurred while saving the search query." "An error occurred while saving this group.","An error occurred while saving this group." -"An error occurred while saving this review.","An error occurred while saving this review." "An error occurred while trying to delete the category.","An error occurred while trying to delete the category." "An error occurred while updating the product(s) attributes.","An error occurred while updating the product(s) attributes." "An error occurred while updating the product(s) status.","An error occurred while updating the product(s) status." @@ -212,7 +210,6 @@ "Custom Options","Custom Options" "Custom options","Custom options" "Customer Group","Customer Group" -"Customers Reviews","Customers Reviews" "Customers Tagged Product","Customers Tagged Product" "Data Type for Saving in Database","Data Type for Saving in Database" "Date & Time Custom Options","Date & Time Custom Options" @@ -443,7 +440,6 @@ "Page Title Separator","Page Title Separator" "Parent Category","Parent Category" "Pending","Pending" -"Pending Reviews RSS","Pending Reviews RSS" "Percentage","Percentage" "Please add rows to option.","Please add rows to option." "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost." @@ -501,7 +497,6 @@ "Product Listing Sort by","Product Listing Sort by" "Product","Product" "Product Prices","Product Prices" -"Product Reviews","Product Reviews" "Product Tags","Product Tags" "Product Tier Price API","Product Tier Price API" "Product Type","Product Type" @@ -517,7 +512,6 @@ "Products","Products" "Products Comparison List","Products Comparison List" "Products Information","Products Information" -"Products Reviews","Products Reviews" "Products Sitemap","Products Sitemap" "Products only","Products only" "Products per Page on Grid Allowed Values","Products per Page on Grid Allowed Values" @@ -581,7 +575,6 @@ "Retrieve product types","Retrieve product types" "Retrieve products data","Retrieve products data" "Retrieve products list by filters","Retrieve products list by filters" -"Reviews","Reviews" "Roll Over for preview","Roll Over for preview" "Root","Root" "SKU","SKU" @@ -680,9 +673,6 @@ "The product has been duplicated.","The product has been duplicated." "The product has been saved.","The product has been saved." "The product has required options","The product has required options" -"The review has been deleted","The review has been deleted" -"The review has been saved.","The review has been saved." -"The review was removed by another user or does not exist.","The review was removed by another user or does not exist." "The search was deleted.","The search was deleted." "The text is too long","The text is too long" "There are no %s available.","There are no %s available." diff --git a/app/code/Magento/Catalog/i18n/es_ES.csv b/app/code/Magento/Catalog/i18n/es_ES.csv index 426fe135712..9ea8012442d 100644 --- a/app/code/Magento/Catalog/i18n/es_ES.csv +++ b/app/code/Magento/Catalog/i18n/es_ES.csv @@ -58,7 +58,6 @@ "Amount","Importe" "An error occurred while adding products to websites.","Se produjo un error mientras se agregaban productos a los sitios web." "An error occurred while clearing comparison list.","Se produjo un error mientras se borraba la lista de comparación." -"An error occurred while deleting this review.","Se produjo un error al eliminar esta revisión." "An error occurred while removing products from websites.","Se produjo un error mientras se eliminaban productos de sitios web." "An error occurred while saving the URL rewrite","Se produjo un error al guardar la URL reescrita" "An error occurred while saving the attribute set.","Se produjo un error mientras se guardaba el conjunto de atributos." @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","Se produjo un error mientras se guardaba el producto." "An error occurred while saving the search query.","Se produjo un error mientras se guardaba el enunciado de búsqueda." "An error occurred while saving this group.","Se produjo un error mientras se guardaba este grupo." -"An error occurred while saving this review.","Se produjo un error al guardar esta revisión." "An error occurred while trying to delete the category.","Se produjo un error mientras se intentaba eliminar la categorÃa." "An error occurred while updating the product(s) attributes.","Se produjo un error al actualizar los atributos del producto o productos." "An error occurred while updating the product(s) status.","Se produjo un error al actualizar el estado del producto o productos." @@ -211,7 +209,6 @@ "Custom Options","Opciones Personalizadas" "Custom options","Opciones de personalización" "Customer Group","Grupo de Clientes" -"Customers Reviews","Revisiones Personalizadas" "Customers Tagged Product","Producto Etiquetado de Clientes" "Data Type for Saving in Database","Tipo de Datos a Guardar en la Base de Datos" "Date & Time Custom Options","Opciones Personalizadas de Fecha y Hora" @@ -442,7 +439,6 @@ "Page Title Separator","Separador de tÃtulo de página" "Parent Category","CategorÃa principal" "Pending","Pendiente" -"Pending Reviews RSS","RSS de reseñas pendientes" "Percentage","Porcentaje" "Please add rows to option.","Por favor, añadir filas a la opción." "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","Tenga en cuenta que al hacer clic en la fila se cargarán los datos de paquete del archivo seleccionado, y se perderán todos los datos del formulario que no se hayan guardado." @@ -499,7 +495,6 @@ "Product Listing Sort by","Listado de Productos Ordenar Por" "Product","Nombre de Producto" "Product Prices","Precios de Producto" -"Product Reviews","Opiniones de Producto" "Product Tags","Etiqueta de Producto" "Product Tier Price API","API de Precio de Nivel de Producto" "Product Type","Tipo de Producto" @@ -515,7 +510,6 @@ "Products","Productos" "Products Comparison List","Lista de Comparación de Productos" "Products Information","Información de Productos" -"Products Reviews","Opiniones de Productos" "Products Sitemap","Mapa del sitio de productos" "Products only","Sólo productos" "Products per Page on Grid Allowed Values","Productos por Página en Valores Permitidos por la CuadrÃcula" @@ -579,7 +573,6 @@ "Retrieve product types","Recuperar tipos de producto" "Retrieve products data","Recuperar datos de productos" "Retrieve products list by filters","Recuperar lista de productos por medio de filtros" -"Reviews","Reseñas" "Roll Over for preview","Desplegar para visualización previa" "Root","RaÃz" "SKU","SKU (Número de Referencia)" @@ -678,9 +671,6 @@ "The product has been duplicated.","Se duplicó el producto." "The product has been saved.","Se ha guardado el producto." "The product has required options","El producto tiene opciones obligatorias" -"The review has been deleted","Se eliminó la reseña" -"The review has been saved.","Se guardó la reseña." -"The review was removed by another user or does not exist.","La reseña no existe o fue eliminada por otro usuario." "The search was deleted.","Se eliminó la búsqueda." "The text is too long","El texto es demasiado largo." "There are no %s available.","No hay %s disponibles." diff --git a/app/code/Magento/Catalog/i18n/fr_FR.csv b/app/code/Magento/Catalog/i18n/fr_FR.csv index 88d596b28e6..b1eee5ea791 100644 --- a/app/code/Magento/Catalog/i18n/fr_FR.csv +++ b/app/code/Magento/Catalog/i18n/fr_FR.csv @@ -58,7 +58,6 @@ "Amount","Montant" "An error occurred while adding products to websites.","Une erreur est survenue pendant l'ajout de produits sur les sites Internet." "An error occurred while clearing comparison list.","Une erreur est survenue pendant la suppression de la list de comparaison." -"An error occurred while deleting this review.","Une erreur est survenue en effaçant ce commentaire" "An error occurred while removing products from websites.","Une erreur est survenue pendant le retrait de produits des sites Internet." "An error occurred while saving the URL rewrite","Une erreur est survenue lors de l'enregistrement de la réécriture de l'URL" "An error occurred while saving the attribute set.","Une erreur est survenue pendant la sauvegarde de la série d'attributs." @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","Une erreur est survenue pendant la sauvegarde du produit." "An error occurred while saving the search query.","Une erreur est survenue pendant la sauvegarde de la demande de recherche." "An error occurred while saving this group.","Une erreur est survenue pendant la sauvegarde de ce groupe." -"An error occurred while saving this review.","Une erreur est survenue en enregistrant ce commentaire" "An error occurred while trying to delete the category.","Une erreur est survenue en essayant de supprimer cette catégorie." "An error occurred while updating the product(s) attributes.","Une erreur est survenue pendant la mise à jour des attributs du/des produit(s)." "An error occurred while updating the product(s) status.","Une erreur est survenue pendant la mise à jour du statut du/des produit(s)." @@ -211,7 +209,6 @@ "Custom Options","Personnaliser les options" "Custom options","Options personnalisées" "Customer Group","Groupe du client" -"Customers Reviews","Avis des clients" "Customers Tagged Product","Les acheteurs ont étiqueté le produit" "Data Type for Saving in Database","Type de données pour enregistrement dans la base de données" "Date & Time Custom Options","Options de date et d'heure personnalisées" @@ -442,7 +439,6 @@ "Page Title Separator","Séparateur titre de la page" "Parent Category","Catégorie parent" "Pending","En cours" -"Pending Reviews RSS","RSS des avis en attente" "Percentage","Pourcentage" "Please add rows to option.","Veuillez ajouter des lignes à l'option." "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","Veuillez faire attention : une fois que vous cliquez sur la ligne, les données du paquet sélectionné se chargeront et toutes les données non-enregistrées seront perdues." @@ -499,7 +495,6 @@ "Product Listing Sort by","Liste des Produits triés par" "Product","Nom du produit" "Product Prices","Prix des Produits" -"Product Reviews","Avis sur le produit" "Product Tags","Étiquettes des produits" "Product Tier Price API","Produit Niveau de Prix API" "Product Type","Type de Produit" @@ -515,7 +510,6 @@ "Products","Produits" "Products Comparison List","Liste de comparaison des produits" "Products Information","Information des produits" -"Products Reviews","Avis sur les produits" "Products Sitemap","Plan du site produits" "Products only","Produits seulement" "Products per Page on Grid Allowed Values","Produits par page sur les valeurs autorisées des lignes" @@ -579,7 +573,6 @@ "Retrieve product types","Extraire les types de produit" "Retrieve products data","Récupérer les données produits" "Retrieve products list by filters","Extraire la liste des produits par filtrage" -"Reviews","Commentaires" "Roll Over for preview","Passez votre souris par-dessus pour la prévisualisation" "Root","Racine" "SKU","UGS" @@ -678,9 +671,6 @@ "The product has been duplicated.","Le produit a été dupliqué." "The product has been saved.","Le produit a été sauvegardé." "The product has required options","Le produit a des options obligatoires." -"The review has been deleted","Le rapport a été supprimé" -"The review has been saved.","Le rapport a été enregistré." -"The review was removed by another user or does not exist.","Le rapport a été supprimé par un autre utilisateur ou n'existe pas." "The search was deleted.","La recherche a été supprimée." "The text is too long","Le texte est trop long" "There are no %s available.","Il n'y a pas de %s disponible." diff --git a/app/code/Magento/Catalog/i18n/nl_NL.csv b/app/code/Magento/Catalog/i18n/nl_NL.csv index 8cd20429f81..3bba923d85b 100644 --- a/app/code/Magento/Catalog/i18n/nl_NL.csv +++ b/app/code/Magento/Catalog/i18n/nl_NL.csv @@ -58,7 +58,6 @@ "Amount","Aantal" "An error occurred while adding products to websites.","Er is een fout opgetreden tijdens het toevoegen van producten aan websites." "An error occurred while clearing comparison list.","Er is een fout opgetreden tijdens het opschonen vergelijkingslijst." -"An error occurred while deleting this review.","Er is een fout opgetreden bij het verwijderen van deze recentie." "An error occurred while removing products from websites.","Er is een fout opgetreden tijdens het verwijderen van producten van websites." "An error occurred while saving the URL rewrite","Er is een fout opgetreden tijdens het opslaan van de URL rewrite" "An error occurred while saving the attribute set.","Er is een fout opgetreden tijdens het opslaan van de attribuut set." @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","Er is een fout opgetreden tijdens het opslaan van het product." "An error occurred while saving the search query.","Er is een fout opgetreden tijdens het opslaan van de zoek query." "An error occurred while saving this group.","Er is een fout opgetreden tijdens het opslaan van deze groep." -"An error occurred while saving this review.","Er is een fout opgetreden bij het opslaan van deze recensie." "An error occurred while trying to delete the category.","Er is een fout opgetreden tijdens het proberen de categorie te verwijderen." "An error occurred while updating the product(s) attributes.","Er is een fout opgetreden tijdens het updaten van de product attributen." "An error occurred while updating the product(s) status.","Er is een fout opgetreden tijdens het updaten van de product status." @@ -211,7 +209,6 @@ "Custom Options","Custom Opties" "Custom options","Aangepaste opties" "Customer Group","Klantgroep" -"Customers Reviews","Klantenrecensies" "Customers Tagged Product","Door Klanten Getagd Product" "Data Type for Saving in Database","Data type om in Database op te slaan" "Date & Time Custom Options","Datum & Tijd Custom Opties" @@ -442,7 +439,6 @@ "Page Title Separator","Pagina Titel Afscheider" "Parent Category","Parent Categorie" "Pending","In afwachting" -"Pending Reviews RSS","In Afwachting van Reviews RSS" "Percentage","Percentage" "Please add rows to option.","Voeg rijen toe aan optie." "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","Wees voorzichtig aangezien er een pakket data formulier geladen wordt zodra u op de rij klikt en alle niet opgeslagen data zal verloren gaan." @@ -499,7 +495,6 @@ "Product Listing Sort by","Sorteer Product Lijst op" "Product","Productnaam" "Product Prices","Productprijzen" -"Product Reviews","Productbeoordelingen" "Product Tags","Productlabels" "Product Tier Price API","Product niveau prijs API" "Product Type","Product Type" @@ -515,7 +510,6 @@ "Products","Producten" "Products Comparison List","Productvergelijkingslijst" "Products Information","Producteninformatie" -"Products Reviews","Productrecensies" "Products Sitemap","Producten sitemap" "Products only","Producten alleen" "Products per Page on Grid Allowed Values","Producten per pagina op raamwerk toegestane waardes" @@ -579,7 +573,6 @@ "Retrieve product types","Ophalen producttypes" "Retrieve products data","Haal product data op" "Retrieve products list by filters","Ophalen productlijst op filters" -"Reviews","Reviews" "Roll Over for preview","Beweeg uw muis erover heen voor een voorvertoning" "Root","Root" "SKU","SKU" @@ -678,9 +671,6 @@ "The product has been duplicated.","Het product is verdubbeld." "The product has been saved.","Het product is opgeslagen." "The product has required options","Het product heeft verplichte opties" -"The review has been deleted","De beoordeling is verwijderd" -"The review has been saved.","De beoordeling is opgeslagen." -"The review was removed by another user or does not exist.","De beoordeling werd verwijderd door een andere gebruiker of bestaat niet." "The search was deleted.","De zoekactie werd verwijderd." "The text is too long","De tekst is te lang" "There are no %s available.","Er zijn geen %s beschikbaar." diff --git a/app/code/Magento/Catalog/i18n/pt_BR.csv b/app/code/Magento/Catalog/i18n/pt_BR.csv index aacea184851..ff867c22e0a 100644 --- a/app/code/Magento/Catalog/i18n/pt_BR.csv +++ b/app/code/Magento/Catalog/i18n/pt_BR.csv @@ -58,7 +58,6 @@ "Amount","Valor" "An error occurred while adding products to websites.","Ocorreu um erro durante a adição de produtos aos websites." "An error occurred while clearing comparison list.","Ocorreu um erro durante a limpeza da lista de comparação." -"An error occurred while deleting this review.","Ocorreu um erro ao excluir essa resenha." "An error occurred while removing products from websites.","Ocorreu um erro durante a retirada de produtos dos sites." "An error occurred while saving the URL rewrite","Ocorreu um erro ao salvar o URL reescrito" "An error occurred while saving the attribute set.","Ocorreu um erro ao salvar o conjunto de atributos." @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","Ocorreu um erro ao salvar o produto." "An error occurred while saving the search query.","Ocorreu um erro ao salvar a consulta de pesquisa." "An error occurred while saving this group.","Ocorreu um erro ao salvar este grupo." -"An error occurred while saving this review.","Ocorreu um erro ao salvar a resenha." "An error occurred while trying to delete the category.","Ocorreu um erro ao tentar eliminar a categoria." "An error occurred while updating the product(s) attributes.","Ocorreu um erro durante a atualização do(s) atributo(s) do(s) produto(s)." "An error occurred while updating the product(s) status.","Ocorreu um erro durante a atualização do status do(s) produto(s)." @@ -211,7 +209,6 @@ "Custom Options","Personalizar Opções" "Custom options","Opções personalizadas" "Customer Group","Grupo de Clientes" -"Customers Reviews","Análises dos clientes" "Customers Tagged Product","Produtos marcados pelos clientes" "Data Type for Saving in Database","Tipo de dado para salvar na base de dados" "Date & Time Custom Options","Opções personalizadas de data e hora" @@ -442,7 +439,6 @@ "Page Title Separator","Separador de TÃtulo de Página" "Parent Category","Categoria Pai" "Pending","Pendente" -"Pending Reviews RSS","Comentários RSS Pendentes" "Percentage","Percentagem" "Please add rows to option.","Por favor adicione linhas à opção." "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","Por favor tome cuidado pois quando você clica na linha ela vai carregar os dados do formulário do pacote, o arquivo selecionado, e todos os dados não guardados do formulário serão perdidos." @@ -499,7 +495,6 @@ "Product Listing Sort by","LIstagem de Produto Ordenada por" "Product","Nome do produto" "Product Prices","Preços de Produto" -"Product Reviews","Comentários sobre Produto" "Product Tags","Etiquetas de Produto" "Product Tier Price API","API para NÃveis de Preço do Produto" "Product Type","Tipo de Produto" @@ -515,7 +510,6 @@ "Products","Produtos" "Products Comparison List","Lista de Comparação de Produtos" "Products Information","Informações de Produtos" -"Products Reviews","Comentários sobre Produtos" "Products Sitemap","Sitemap de Produtos" "Products only","Somente produtos" "Products per Page on Grid Allowed Values","Produtos por Página nos Valores Permitidos na Grade" @@ -579,7 +573,6 @@ "Retrieve product types","Recuperar tipos de produto" "Retrieve products data","Recuperar dados de produtos" "Retrieve products list by filters","Recuperar lista de produtos com filtros" -"Reviews","Resenhas" "Roll Over for preview","Passe o mouse para visualizar" "Root","Raiz" "SKU","Unidade de Manutenção de Estoque" @@ -678,9 +671,6 @@ "The product has been duplicated.","O produto foi duplicado." "The product has been saved.","O produto foi salvo." "The product has required options","O produto requer opções" -"The review has been deleted","A análise foi apagada" -"The review has been saved.","A análise foi salva." -"The review was removed by another user or does not exist.","A análise foi removida por outro usuário ou não existe." "The search was deleted.","A pesquisa foi apagada." "The text is too long","O texto é muito longo" "There are no %s available.","Não há %s disponÃveis." diff --git a/app/code/Magento/Catalog/i18n/zh_CN.csv b/app/code/Magento/Catalog/i18n/zh_CN.csv index 8669e613a9c..79ac27d8357 100644 --- a/app/code/Magento/Catalog/i18n/zh_CN.csv +++ b/app/code/Magento/Catalog/i18n/zh_CN.csv @@ -58,7 +58,6 @@ "Amount","æ•°é‡" "An error occurred while adding products to websites.","æ·»åŠ äº§å“到网站时å‘生错误。" "An error occurred while clearing comparison list.","清除对照表时å‘生错误。" -"An error occurred while deleting this review.","åˆ é™¤è¯¥è¯„è®ºæ—¶å‡ºé”™ã€‚" "An error occurred while removing products from websites.","ä»Žç½‘ç«™ç§»é™¤äº§å“æ—¶å‘生错误。" "An error occurred while saving the URL rewrite","ä¿å˜é‡å†™çš„URLæ—¶å‘生错误。" "An error occurred while saving the attribute set.","ä¿å˜å±žæ€§é›†æ—¶å‘生错误。" @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","ä¿å˜äº§å“æ—¶å‘生错误。" "An error occurred while saving the search query.","ä¿å˜æœç´¢æŸ¥è¯¢æ—¶å‘生错误。" "An error occurred while saving this group.","ä¿å˜è¿™ä¸ªåˆ†ç»„æ—¶å‘生错误。" -"An error occurred while saving this review.","ä¿å˜è¯¥è¯„论时出错。" "An error occurred while trying to delete the category.","åˆ é™¤è¯¥ç±»åˆ«æ—¶å‘生错误。" "An error occurred while updating the product(s) attributes.","更新产å“属性时å‘生错误。" "An error occurred while updating the product(s) status.","更新产å“çŠ¶æ€æ—¶å‘生错误。" @@ -211,7 +209,6 @@ "Custom Options","自定义选项" "Custom options","自定义选项" "Customer Group","客户组" -"Customers Reviews","客户评测" "Customers Tagged Product","å®¢æˆ·æ ‡è®°çš„äº§å“" "Data Type for Saving in Database","è¦ä¿å˜åœ¨æ•°æ®åº“ä¸çš„æ•°æ®ç±»åž‹" "Date & Time Custom Options","日期和时间自定义选项" @@ -442,7 +439,6 @@ "Page Title Separator","页颿 ‡é¢˜åˆ†éš”器" "Parent Category","父分类" "Pending","挂起" -"Pending Reviews RSS","挂起评测RSS" "Percentage","百分率" "Please add rows to option.","è¯·æ·»åŠ é€‰é¡¹è¡Œã€‚" "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","请å°å¿ƒï¼Œä¸€æ—¦æ‚¨ç‚¹å‡»è¿™ä¸€è¡Œï¼Œå°±ä¼šä»Žæ‰€é€‰æ–‡ä»¶ä¸åŠ è½½åŒ…è£¹æ•°æ®ï¼Œæ‰€æœ‰æœªä¿å˜çš„æ•°æ®éƒ½å°†ä¸¢å¤±ã€‚" @@ -499,7 +495,6 @@ "Product Listing Sort by","产å“列表排列顺åº" "Product","产å“å" "Product Prices","产å“ä»·æ ¼" -"Product Reviews","产å“评测" "Product Tags","äº§å“æ ‡ç¾" "Product Tier Price API","产å“å±‚çº§ä»·æ ¼ API" "Product Type","产å“类型" @@ -515,7 +510,6 @@ "Products","产å“" "Products Comparison List","äº§å“æ¯”较列表" "Products Information","产å“ä¿¡æ¯" -"Products Reviews","产å“评论" "Products Sitemap","产å“网站地图" "Products only","仅产å“" "Products per Page on Grid Allowed Values","ç½‘æ ¼å…许的数值ä¸çš„æ¯é¡µäº§å“æ•°é‡" @@ -579,7 +573,6 @@ "Retrieve product types","获å–产å“类型" "Retrieve products data","获å–äº§å“æ•°æ®" "Retrieve products list by filters","按照ç›é€‰å™¨èŽ·å–产å“列表" -"Reviews","评测" "Roll Over for preview","翻转预览" "Root","æ ¹" "SKU","SKU" @@ -678,9 +671,6 @@ "The product has been duplicated.","产å“å·²å¤åˆ¶ã€‚" "The product has been saved.","产å“å·²ä¿å˜ã€‚" "The product has required options","产å“包å«å¿…需的选项" -"The review has been deleted","è¯„è®ºå·²è¢«åˆ é™¤" -"The review has been saved.","评论已ä¿å˜ã€‚" -"The review was removed by another user or does not exist.","评论已被å¦ä¸€ç”¨æˆ·åˆ 除,或评论ä¸å˜åœ¨ã€‚" "The search was deleted.","æœç´¢è¢«åˆ 除。" "The text is too long","文本过长" "There are no %s available.","没有å¯ç”¨çš„ %s。" diff --git a/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.php b/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php similarity index 100% rename from app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.php rename to app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0-1.6.0.0.1.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.0-1.6.0.0.1.php similarity index 100% rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0-1.6.0.0.1.php rename to app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.0-1.6.0.0.1.php diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.18-1.6.0.0.23.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.18-1.6.0.0.23.php similarity index 100% rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.18-1.6.0.0.23.php rename to app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.18-1.6.0.0.23.php diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.24-1.6.0.0.25.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.24-1.6.0.0.25.php similarity index 100% rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.24-1.6.0.0.25.php rename to app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.24-1.6.0.0.25.php diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.25-1.6.0.0.26.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.25-1.6.0.0.26.php similarity index 100% rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.25-1.6.0.0.26.php rename to app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.25-1.6.0.0.26.php diff --git a/app/code/Magento/Catalog/view/frontend/product/view/attribute.phtml b/app/code/Magento/Catalog/view/frontend/product/view/attribute.phtml index b4b7691ee78..b37162783c0 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/attribute.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/attribute.phtml @@ -27,7 +27,6 @@ * Product view template * * @see \Magento\Catalog\Block\Product\View - * @see \Magento\Review\Block\Product\View */ ?> <?php diff --git a/app/code/Magento/Catalog/view/frontend/product/view/form.phtml b/app/code/Magento/Catalog/view/frontend/product/view/form.phtml index 26c39b6e9de..8dd0b4574ee 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/form.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/form.phtml @@ -26,7 +26,6 @@ * Product view template * * @var $this \Magento\Catalog\Block\Product\View - * @var $this \Magento\Review\Block\Product\View */ ?> <?php $_helper = $this->helper('Magento\Catalog\Helper\Output'); ?> diff --git a/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php b/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php index 97aa77bebf7..53192e05846 100644 --- a/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php +++ b/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php @@ -47,7 +47,7 @@ class Managestock extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\CatalogInventory\Model\Stock\Status $stockStatus - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -57,7 +57,7 @@ class Managestock extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\CatalogInventory\Model\Stock\Status $stockStatus, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php index e1891d1d8a8..41f5052a591 100644 --- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php @@ -93,7 +93,7 @@ class Stock extends \Magento\Index\Model\Indexer\AbstractIndexer * @param \Magento\Registry $registry * @param \Magento\Index\Model\Indexer $indexer * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -102,7 +102,7 @@ class Stock extends \Magento\Index\Model\Indexer\AbstractIndexer \Magento\Registry $registry, \Magento\Index\Model\Indexer $indexer, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php index f40f57674a0..a1b696fe6d4 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php @@ -55,7 +55,7 @@ class QuantityValidator * @param \Magento\Event\Observer $observer * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate(\Magento\Event\Observer $observer) { @@ -160,7 +160,7 @@ class QuantityValidator } else { /* @var $stockItem \Magento\CatalogInventory\Model\Stock\Item */ if (!$stockItem instanceof \Magento\CatalogInventory\Model\Stock\Item) { - throw new \Magento\Core\Exception(__('The stock item for Product in option is not valid.')); + throw new \Magento\Model\Exception(__('The stock item for Product in option is not valid.')); } $result = $this->stockItemInitializer->initialize($stockItem, $quoteItem, $qty); diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php index 47059831aa2..d4985a48010 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php @@ -49,7 +49,7 @@ class Option * * @return \Magento\Object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function initialize( \Magento\Sales\Model\Quote\Item\Option $option, @@ -64,7 +64,7 @@ class Option $stockItem = $option->getProduct()->getStockItem(); if (!$stockItem instanceof \Magento\CatalogInventory\Model\Stock\Item) { - throw new \Magento\Core\Exception(__('The stock item for Product in option is not valid.')); + throw new \Magento\Model\Exception(__('The stock item for Product in option is not valid.')); } /** diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php index add18bf0a7d..c16f1075e8d 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php @@ -57,7 +57,7 @@ class StockItem * @param int $qty * * @return \Magento\Object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function initialize( \Magento\CatalogInventory\Model\Stock\Item $stockItem, diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock.php b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock.php index 628fc65d092..d99e97b17d2 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock.php @@ -329,13 +329,13 @@ class Stock extends \Magento\Catalog\Model\Resource\Product\Indexer\AbstractInde * * @param string $productTypeId * @return \Magento\CatalogInventory\Model\Resource\Indexer\Stock\StockInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getIndexer($productTypeId) { $types = $this->_getTypeIndexers(); if (!isset($types[$productTypeId])) { - throw new \Magento\Core\Exception(__('Unsupported product type "%1".', $productTypeId)); + throw new \Magento\Model\Exception(__('Unsupported product type "%1".', $productTypeId)); } return $types[$productTypeId]; } diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php index b46486e7c10..fbbf8f751b4 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php @@ -131,12 +131,12 @@ class DefaultStock extends \Magento\Catalog\Model\Resource\Product\Indexer\Abstr * Retrieve active Product Type Id * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getTypeId() { if (is_null($this->_typeId)) { - throw new \Magento\Core\Exception(__('Undefined product type')); + throw new \Magento\Model\Exception(__('Undefined product type')); } return $this->_typeId; } diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/StockInterface.php b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/StockInterface.php index 29f51181e5a..cf1c1c3ab4c 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/StockInterface.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/StockInterface.php @@ -61,7 +61,7 @@ interface StockInterface * Retrieve Product Type Id for indexer * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getTypeId(); } diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock.php index 0ada75484fc..a5d61e1468e 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock.php @@ -28,7 +28,7 @@ */ namespace Magento\CatalogInventory\Model\Resource; -class Stock extends \Magento\Core\Model\Resource\Db\AbstractDb +class Stock extends \Magento\Model\Resource\Db\AbstractDb { /** * Is initialized configuration flag diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php index 4313364738e..d973619cae6 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php @@ -34,7 +34,7 @@ */ namespace Magento\CatalogInventory\Model\Resource\Stock; -class Item extends \Magento\Core\Model\Resource\Db\AbstractDb +class Item extends \Magento\Model\Resource\Db\AbstractDb { /** * Core store config diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php index 81999aa72d1..a72939cb30b 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php @@ -29,7 +29,7 @@ namespace Magento\CatalogInventory\Model\Resource\Stock\Item; use Magento\CatalogInventory\Model\Stock; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var \Magento\Core\Model\StoreManagerInterface @@ -43,7 +43,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -52,7 +52,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); @@ -157,13 +157,13 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param string $comparisonMethod * @param float $qty * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addQtyFilter($comparisonMethod, $qty) { $methods = array('<' => 'lt', '>' => 'gt', '=' => 'eq', '<=' => 'lteq', '>=' => 'gteq', '<>' => 'neq'); if (!isset($methods[$comparisonMethod])) { - throw new \Magento\Core\Exception(__('%1 is not a correct comparison method.', $comparisonMethod)); + throw new \Magento\Model\Exception(__('%1 is not a correct comparison method.', $comparisonMethod)); } return $this->addFieldToFilter('main_table.qty', array($methods[$comparisonMethod] => $qty)); diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php index a879f7a26f5..9b97b0064b4 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php @@ -26,7 +26,7 @@ namespace Magento\CatalogInventory\Model\Resource\Stock; /** * CatalogInventory Stock Status per website Resource Model */ -class Status extends \Magento\Core\Model\Resource\Db\AbstractDb +class Status extends \Magento\Model\Resource\Db\AbstractDb { /** * Store model manager diff --git a/app/code/Magento/CatalogInventory/Model/Stock.php b/app/code/Magento/CatalogInventory/Model/Stock.php index ac38f0b9afb..828dd89dc64 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Stock.php @@ -35,7 +35,7 @@ use Magento\CatalogInventory\Model\Stock\Item; * @method string getStockName() * @method \Magento\CatalogInventory\Model\Stock setStockName(string $value) */ -class Stock extends \Magento\Core\Model\AbstractModel +class Stock extends \Magento\Model\AbstractModel { const BACKORDERS_NO = 0; @@ -82,7 +82,7 @@ class Stock extends \Magento\Core\Model\AbstractModel * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -93,7 +93,7 @@ class Stock extends \Magento\Core\Model\AbstractModel \Magento\CatalogInventory\Helper\Data $catalogInventoryData, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -187,7 +187,7 @@ class Stock extends \Magento\Core\Model\AbstractModel * * @param array $items * @return Item[] - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function registerProductsSale($items) { @@ -201,7 +201,7 @@ class Stock extends \Magento\Core\Model\AbstractModel $item->setData($itemInfo); if (!$item->checkQty($qtys[$item->getProductId()])) { $this->_getResource()->commit(); - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Not all of your products are available in the requested quantity.') ); } @@ -231,7 +231,7 @@ class Stock extends \Magento\Core\Model\AbstractModel * * @param \Magento\Object $item * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function registerItemSale(\Magento\Object $item) { @@ -249,7 +249,7 @@ class Stock extends \Magento\Core\Model\AbstractModel } } } else { - throw new \Magento\Core\Exception(__('We cannot specify a product identifier for the order item.')); + throw new \Magento\Model\Exception(__('We cannot specify a product identifier for the order item.')); } return $this; } diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Stock/Item.php index 07d4fe770af..39fdaec88c1 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/Item.php @@ -70,7 +70,7 @@ use Magento\Catalog\Model\Product; * @package Magento_CatalogInventory * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { const XML_PATH_GLOBAL = 'cataloginventory/options/'; @@ -216,7 +216,7 @@ class Item extends \Magento\Core\Model\AbstractModel * @param \Magento\Locale\FormatInterface $localeFormat * @param \Magento\Math\Division $mathDivision * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -233,7 +233,7 @@ class Item extends \Magento\Core\Model\AbstractModel \Magento\Locale\FormatInterface $localeFormat, \Magento\Math\Division $mathDivision, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -558,7 +558,7 @@ class Item extends \Magento\Core\Model\AbstractModel * Check quantity * * @param int|float $qty - * @exception \Magento\Core\Exception + * @exception \Magento\Model\Exception * @return bool */ public function checkQty($qty) diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Stock/Status.php index 311d7ed4319..a888e599be1 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/Status.php @@ -43,7 +43,7 @@ use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus; * @method int getStockStatus() * @method \Magento\CatalogInventory\Model\Stock\Status setStockStatus(int $value) */ -class Status extends \Magento\Core\Model\AbstractModel +class Status extends \Magento\Model\AbstractModel { /**#@+ * Stock Status values @@ -102,7 +102,7 @@ class Status extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param ItemFactory $stockItemFactory * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -114,7 +114,7 @@ class Status extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\StoreManagerInterface $storeManager, ItemFactory $stockItemFactory, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php index 0980e26b536..b9b50f88974 100644 --- a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php +++ b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php @@ -45,7 +45,7 @@ class Minsaleqty extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\CatalogInventory\Helper\Minsaleqty $catalogInventoryMinsaleqty - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class Minsaleqty extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\CatalogInventory\Helper\Minsaleqty $catalogInventoryMinsaleqty, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php index 2bc7a3aa08f..8610c625b05 100644 --- a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php +++ b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php @@ -30,7 +30,7 @@ */ namespace Magento\CatalogInventory\Model\System\Config\Backend; -use Magento\Core\Exception; +use Magento\Model\Exception; class Qtyincrements extends \Magento\Core\Model\Config\Value { diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php index 37169520557..806b4b43e68 100644 --- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php +++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php @@ -36,7 +36,7 @@ namespace Magento\CatalogRule\Controller\Adminhtml\Promo; use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; use Magento\CatalogRule\Model\Rule\Job; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Stdlib\DateTime\Filter\Date; use Magento\Registry; use Magento\Rule\Model\Condition\AbstractCondition; diff --git a/app/code/Magento/CatalogRule/Model/Flag.php b/app/code/Magento/CatalogRule/Model/Flag.php index 4c59433fd00..dcb4fa20d3d 100644 --- a/app/code/Magento/CatalogRule/Model/Flag.php +++ b/app/code/Magento/CatalogRule/Model/Flag.php @@ -33,7 +33,7 @@ */ namespace Magento\CatalogRule\Model; -class Flag extends \Magento\Core\Model\Flag +class Flag extends \Magento\Flag { /** * Flag code diff --git a/app/code/Magento/CatalogRule/Model/Resource/Grid/Collection.php b/app/code/Magento/CatalogRule/Model/Resource/Grid/Collection.php index 9ffeb7c748a..5f49e71c4e0 100644 --- a/app/code/Magento/CatalogRule/Model/Resource/Grid/Collection.php +++ b/app/code/Magento/CatalogRule/Model/Resource/Grid/Collection.php @@ -23,7 +23,7 @@ */ namespace Magento\CatalogRule\Model\Resource\Grid; -use Magento\Core\Model\Resource\Db\Collection\AbstractCollection; +use Magento\Model\Resource\Db\Collection\AbstractCollection; class Collection extends \Magento\CatalogRule\Model\Resource\Rule\Collection { diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule.php b/app/code/Magento/CatalogRule/Model/Resource/Rule.php index e7a4ef798ea..8cc6be2f141 100644 --- a/app/code/Magento/CatalogRule/Model/Resource/Rule.php +++ b/app/code/Magento/CatalogRule/Model/Resource/Rule.php @@ -36,8 +36,8 @@ namespace Magento\CatalogRule\Model\Resource; use Magento\Catalog\Model\Product; use Magento\CatalogRule\Model\Rule as ModelRule; -use Magento\Core\Model\AbstractModel; -use Magento\Core\Model\Resource\Db\AbstractDb; +use Magento\Model\AbstractModel; +use Magento\Model\Resource\Db\AbstractDb; class Rule extends \Magento\Rule\Model\Resource\AbstractResource { diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php b/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php index aaeb6318831..9119f7f307d 100644 --- a/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php +++ b/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php @@ -34,7 +34,7 @@ */ namespace Magento\CatalogRule\Model\Resource\Rule\Product; -class Price extends \Magento\Core\Model\Resource\Db\AbstractDb +class Price extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php b/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php index 69ff5cff971..c94f7c52ccd 100644 --- a/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php +++ b/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php @@ -25,7 +25,7 @@ */ namespace Magento\CatalogRule\Model\Resource\Rule\Product\Price; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @return void diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php index 656f0b35e29..fc82c7cd4bb 100644 --- a/app/code/Magento/CatalogRule/Model/Rule.php +++ b/app/code/Magento/CatalogRule/Model/Rule.php @@ -122,7 +122,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel protected $_relatedCacheTypes; /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_resourceIterator; @@ -176,13 +176,13 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param \Magento\CatalogRule\Model\Rule\Condition\CombineFactory $combineFactory * @param \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollectionFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Model\Resource\Iterator $resourceIterator * @param \Magento\Index\Model\Indexer $indexer * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\CatalogRule\Helper\Data $catalogRuleData * @param \Magento\App\Cache\TypeListInterface $cacheTypesList * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $relatedCacheTypes * @param array $data @@ -197,13 +197,13 @@ class Rule extends \Magento\Rule\Model\AbstractModel \Magento\CatalogRule\Model\Rule\Condition\CombineFactory $combineFactory, \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollectionFactory, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Model\Resource\Iterator $resourceIterator, \Magento\Index\Model\Indexer $indexer, \Magento\Customer\Model\Session $customerSession, \Magento\CatalogRule\Helper\Data $catalogRuleData, \Magento\App\Cache\TypeListInterface $cacheTypesList, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $relatedCacheTypes = array(), array $data = array() @@ -372,10 +372,6 @@ class Rule extends \Magento\Rule\Model\AbstractModel $this->getResourceCollection()->walk(array($this->_getResource(), 'updateRuleProductData')); $this->_getResource()->applyAllRulesForDateRange(); $this->_invalidateCache(); - $indexProcess = $this->_indexer->getProcessByCode('catalog_product_price'); - if ($indexProcess) { - $indexProcess->reindexAll(); - } } /** diff --git a/app/code/Magento/CatalogRule/Model/Rule/Job.php b/app/code/Magento/CatalogRule/Model/Rule/Job.php index 9be011bce2e..6666a64c1ee 100644 --- a/app/code/Magento/CatalogRule/Model/Rule/Job.php +++ b/app/code/Magento/CatalogRule/Model/Rule/Job.php @@ -71,7 +71,7 @@ class Job extends \Magento\Object try { $this->_eventManager->dispatch('catalogrule_apply_all'); $this->setSuccess(__('The rules have been applied.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->setError($e->getMessage()); } return $this; diff --git a/app/code/Magento/CatalogRule/Model/Rule/Product/Price.php b/app/code/Magento/CatalogRule/Model/Rule/Product/Price.php index 5e0681f2177..b979b74eeac 100644 --- a/app/code/Magento/CatalogRule/Model/Rule/Product/Price.php +++ b/app/code/Magento/CatalogRule/Model/Rule/Product/Price.php @@ -53,7 +53,7 @@ namespace Magento\CatalogRule\Model\Rule\Product; use Magento\DB\Select; -class Price extends \Magento\Core\Model\AbstractModel +class Price extends \Magento\Model\AbstractModel { /** * Initialize resource model diff --git a/app/code/Magento/CatalogSearch/Block/Advanced/Result.php b/app/code/Magento/CatalogSearch/Block/Advanced/Result.php index b1af77e895d..235b613f2e9 100644 --- a/app/code/Magento/CatalogSearch/Block/Advanced/Result.php +++ b/app/code/Magento/CatalogSearch/Block/Advanced/Result.php @@ -179,7 +179,7 @@ class Result extends Template */ public function getFormUrl() { - return $this->_urlFactory->create()->setQueryParams( + return $this->_urlFactory->create()->addQueryParams( $this->getRequest()->getQuery() )->getUrl( '*/*/', diff --git a/app/code/Magento/CatalogSearch/Controller/Advanced.php b/app/code/Magento/CatalogSearch/Controller/Advanced.php index a4420c2c405..fa73fa59901 100644 --- a/app/code/Magento/CatalogSearch/Controller/Advanced.php +++ b/app/code/Magento/CatalogSearch/Controller/Advanced.php @@ -99,9 +99,9 @@ class Advanced extends \Magento\App\Action\Action $this->_view->loadLayout(); try { $this->_catalogSearchAdvanced->addFilters($this->getRequest()->getQuery()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); - $defaultUrl = $this->_urlFactory->create()->setQueryParams( + $defaultUrl = $this->_urlFactory->create()->addQueryParams( $this->getRequest()->getQuery() )->getUrl( '*/*/' diff --git a/app/code/Magento/CatalogSearch/Model/Advanced.php b/app/code/Magento/CatalogSearch/Model/Advanced.php index 309215655dd..89f1f2b8bf2 100644 --- a/app/code/Magento/CatalogSearch/Model/Advanced.php +++ b/app/code/Magento/CatalogSearch/Model/Advanced.php @@ -62,8 +62,8 @@ use Magento\CatalogSearch\Model\Advanced as ModelAdvanced; use Magento\CatalogSearch\Model\Resource\Advanced\Collection; use Magento\CatalogSearch\Model\Resource\EngineInterface; use Magento\CatalogSearch\Model\Resource\EngineProvider; -use Magento\Core\Exception; -use Magento\Core\Model\AbstractModel; +use Magento\Model\Exception; +use Magento\Model\AbstractModel; use Magento\Model\Context; use Magento\Registry; use Magento\Core\Model\StoreManagerInterface; diff --git a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php index 14a58625709..c0b14722381 100644 --- a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php +++ b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php @@ -39,7 +39,7 @@ use Magento\CatalogSearch\Model\Fulltext; use Magento\Core\Model\Config\Value; use Magento\Model\Context; use Magento\Registry; -use Magento\Core\Model\Resource\AbstractResource; +use Magento\Model\Resource\AbstractResource; use Magento\Core\Model\StoreManagerInterface; use Magento\Data\Collection\Db; diff --git a/app/code/Magento/CatalogSearch/Model/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Fulltext.php index c811e995545..cde05175758 100644 --- a/app/code/Magento/CatalogSearch/Model/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Fulltext.php @@ -27,10 +27,10 @@ namespace Magento\CatalogSearch\Model; use Magento\CatalogSearch\Helper\Data; use Magento\CatalogSearch\Model\Query; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Model\Context; use Magento\Registry; -use Magento\Core\Model\Resource\AbstractResource; +use Magento\Model\Resource\AbstractResource; use Magento\Core\Model\Store\Config; use Magento\Data\Collection\Db; diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php index 5da980fc378..aa7fee2cd35 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php @@ -40,7 +40,7 @@ use Magento\CatalogSearch\Model\Fulltext as ModelFulltext; use Magento\CatalogSearch\Model\Resource\Indexer\Fulltext as IndexerFulltext; use Magento\Model\Context; use Magento\Registry; -use Magento\Core\Model\Resource\AbstractResource; +use Magento\Model\Resource\AbstractResource; use Magento\Core\Model\Store; use Magento\Core\Model\Store\Group; use Magento\Core\Model\StoreManagerInterface; diff --git a/app/code/Magento/CatalogSearch/Model/Query.php b/app/code/Magento/CatalogSearch/Model/Query.php index cd1459a86c3..8388de6b683 100644 --- a/app/code/Magento/CatalogSearch/Model/Query.php +++ b/app/code/Magento/CatalogSearch/Model/Query.php @@ -29,10 +29,10 @@ use Magento\CatalogSearch\Model\Resource\Query\Collection as QueryCollection; use Magento\CatalogSearch\Model\Resource\Query\CollectionFactory as QueryCollectionFactory; use Magento\CatalogSearch\Model\Resource\Search\Collection; use Magento\CatalogSearch\Model\Resource\Search\CollectionFactory; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Model\Context; use Magento\Registry; -use Magento\Core\Model\Resource\AbstractResource; +use Magento\Model\Resource\AbstractResource; use Magento\Core\Model\Store\Config; use Magento\Core\Model\StoreManagerInterface; use Magento\Data\Collection\Db; diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php b/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php index d8a06173eae..0c39976602b 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php @@ -32,7 +32,7 @@ namespace Magento\CatalogSearch\Model\Resource; * @package Magento_CatalogSearch * @author Magento Core Team <core@magentocommerce.com> */ -class Advanced extends \Magento\Core\Model\Resource\Db\AbstractDb +class Advanced extends \Magento\Model\Resource\Db\AbstractDb { /** * Core event manager proxy diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php index a9de3d49759..2889ca3019d 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php @@ -25,7 +25,7 @@ */ namespace Magento\CatalogSearch\Model\Resource\Advanced; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Collection Advanced diff --git a/app/code/Magento/CatalogSearch/Model/Resource/EngineInterface.php b/app/code/Magento/CatalogSearch/Model/Resource/EngineInterface.php index db6fcf788a7..9f02627e83c 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/EngineInterface.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/EngineInterface.php @@ -88,7 +88,7 @@ interface EngineInterface /** * Return resource model for the full text search * - * @return \Magento\Core\Model\Resource\AbstractResource + * @return \Magento\Model\Resource\AbstractResource */ public function getResource(); diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php index 1df4c1a054e..6133ee36f18 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php @@ -28,7 +28,7 @@ namespace Magento\CatalogSearch\Model\Resource; /** * CatalogSearch Fulltext Index resource model */ -class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb +class Fulltext extends \Magento\Model\Resource\Db\AbstractDb { /** * Searchable attributes cache diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php index 58355a682dc..9b74c9b54f7 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php @@ -32,7 +32,7 @@ namespace Magento\CatalogSearch\Model\Resource\Fulltext; * @package Magento_CatalogSearch * @author Magento Core Team <core@magentocommerce.com> */ -class Engine extends \Magento\Core\Model\Resource\Db\AbstractDb implements +class Engine extends \Magento\Model\Resource\Db\AbstractDb implements \Magento\CatalogSearch\Model\Resource\EngineInterface { /** diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Indexer/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Resource/Indexer/Fulltext.php index c13d46af85d..f172d07f093 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Indexer/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Indexer/Fulltext.php @@ -32,7 +32,7 @@ namespace Magento\CatalogSearch\Model\Resource\Indexer; * @package Magento_CatalogSearch * @author Magento Core Team <core@magentocommerce.com> */ -class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb +class Fulltext extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define catalog product table as main table diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Query.php b/app/code/Magento/CatalogSearch/Model/Resource/Query.php index ea84d7fa399..e046ff13a9e 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Query.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Query.php @@ -25,7 +25,7 @@ */ namespace Magento\CatalogSearch\Model\Resource; -use Magento\Core\Model\Resource\Db\AbstractDb; +use Magento\Model\Resource\Db\AbstractDb; /** * Catalog search query resource model @@ -76,11 +76,11 @@ class Query extends AbstractDb /** * Custom load model by search query string * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $value * @return $this */ - public function loadByQuery(\Magento\Core\Model\AbstractModel $object, $value) + public function loadByQuery(\Magento\Model\AbstractModel $object, $value) { $select = $this->_getReadAdapter()->select()->from( $this->getMainTable() @@ -107,11 +107,11 @@ class Query extends AbstractDb /** * Custom load model only by query text (skip synonym for) * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $value * @return $this */ - public function loadByQueryText(\Magento\Core\Model\AbstractModel $object, $value) + public function loadByQueryText(\Magento\Model\AbstractModel $object, $value) { $select = $this->_getReadAdapter()->select()->from( $this->getMainTable() @@ -135,12 +135,12 @@ class Query extends AbstractDb /** * Loading string as a value or regular numeric * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param int|string $value * @param null|string $field * @return $this|AbstractDb */ - public function load(\Magento\Core\Model\AbstractModel $object, $value, $field = null) + public function load(\Magento\Model\AbstractModel $object, $value, $field = null) { if (is_numeric($value)) { return parent::load($object, $value); @@ -151,10 +151,10 @@ class Query extends AbstractDb } /** - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function _beforeSave(\Magento\Core\Model\AbstractModel $object) + public function _beforeSave(\Magento\Model\AbstractModel $object) { $object->setUpdatedAt($this->dateTime->formatDate($this->_date->gmtTimestamp())); return $this; diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php index 494a2418ec1..c3999747761 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php @@ -34,7 +34,7 @@ use Magento\Core\Model\Store; * @package Magento_CatalogSearch * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store for filter @@ -65,7 +65,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\CatalogSearch\Model\Resource\Helper $resourceHelper * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -75,7 +75,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\CatalogSearch\Model\Resource\Helper $resourceHelper, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_resourceHelper = $resourceHelper; diff --git a/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php b/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php index 286804d6187..fa0fd97dc21 100644 --- a/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php +++ b/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php @@ -69,7 +69,7 @@ class Index extends \Magento\Backend\App\Action $validator->reset(); $this->_getPayment()->importData($paymentData); $result['authenticationUrl'] = $validator->getAuthenticationStartUrl(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result['message'] = $e->getMessage(); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); diff --git a/app/code/Magento/Centinel/Model/Service.php b/app/code/Magento/Centinel/Model/Service.php index d1186067b1a..797de3087f2 100644 --- a/app/code/Magento/Centinel/Model/Service.php +++ b/app/code/Magento/Centinel/Model/Service.php @@ -327,7 +327,7 @@ class Service extends \Magento\Object * * @param \Magento\Object $data * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate($data) { @@ -350,12 +350,12 @@ class Service extends \Magento\Object // check whether is authenticated before placing order if ($this->getIsPlaceOrder()) { if ($validationState->getChecksum() != $newChecksum) { - throw new \Magento\Core\Exception(__('Payment information error. Please start over.')); + throw new \Magento\Model\Exception(__('Payment information error. Please start over.')); } if ($validationState->isAuthenticateSuccessful()) { return; } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please verify the card with the issuer bank before placing the order.') ); } else { @@ -366,7 +366,7 @@ class Service extends \Magento\Object if ($validationState->isLookupSuccessful()) { return; } - throw new \Magento\Core\Exception(__('This card has failed validation and cannot be used.')); + throw new \Magento\Model\Exception(__('This card has failed validation and cannot be used.')); } } diff --git a/app/code/Magento/Checkout/Block/Cart.php b/app/code/Magento/Checkout/Block/Cart.php index 50013cc3dd4..0dd06776791 100644 --- a/app/code/Magento/Checkout/Block/Cart.php +++ b/app/code/Magento/Checkout/Block/Cart.php @@ -205,13 +205,13 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart * * @param string $name Block name in layout * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getMethodHtml($name) { $block = $this->getLayout()->getBlock($name); if (!$block) { - throw new \Magento\Core\Exception(__('Invalid method: %1', $name)); + throw new \Magento\Model\Exception(__('Invalid method: %1', $name)); } return $block->toHtml(); } diff --git a/app/code/Magento/Checkout/Block/Cart/Crosssell.php b/app/code/Magento/Checkout/Block/Cart/Crosssell.php index 6d2a97eb42d..69a01ffb7a3 100644 --- a/app/code/Magento/Checkout/Block/Cart/Crosssell.php +++ b/app/code/Magento/Checkout/Block/Cart/Crosssell.php @@ -89,17 +89,7 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\CatalogInventory\Model\Stock $stock, @@ -115,16 +105,6 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct $this->_itemRelationsList = $itemRelationsList; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php b/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php index 070b28fa39f..d361b1e3ed4 100644 --- a/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php +++ b/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php @@ -124,7 +124,7 @@ class Agreement extends \Magento\Backend\App\Action $this->_redirect('checkout/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong while saving this condition.')); @@ -153,7 +153,7 @@ class Agreement extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('The condition has been deleted.')); $this->_redirect('checkout/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong while deleting this condition.')); diff --git a/app/code/Magento/Checkout/Controller/Cart.php b/app/code/Magento/Checkout/Controller/Cart.php index 21f802d963f..546398ee7ae 100644 --- a/app/code/Magento/Checkout/Controller/Cart.php +++ b/app/code/Magento/Checkout/Controller/Cart.php @@ -250,7 +250,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro } $this->_goBack(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($this->_checkoutSession->getUseNotice(true)) { $this->messageManager->addNotice( $this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage()) @@ -294,7 +294,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro foreach ($itemsCollection as $item) { try { $this->cart->addOrderItem($item, 1); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($this->_checkoutSession->getUseNotice(true)) { $this->messageManager->addNotice($e->getMessage()); } else { @@ -376,15 +376,15 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro $quoteItem = $this->cart->getQuote()->getItemById($id); if (!$quoteItem) { - throw new \Magento\Core\Exception(__("We can't find the quote item.")); + throw new \Magento\Model\Exception(__("We can't find the quote item.")); } $item = $this->cart->updateItem($id, new \Magento\Object($params)); if (is_string($item)) { - throw new \Magento\Core\Exception($item); + throw new \Magento\Model\Exception($item); } if ($item->getHasError()) { - throw new \Magento\Core\Exception($item->getMessage()); + throw new \Magento\Model\Exception($item->getMessage()); } $related = $this->getRequest()->getParam('related_product'); @@ -410,7 +410,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro } $this->_goBack(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($this->_checkoutSession->getUseNotice(true)) { $this->messageManager->addNotice($e->getMessage()); } else { @@ -489,7 +489,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro $this->cart->updateItems($cartData)->save(); } $this->_checkoutSession->setCartWasUpdated(true); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError( $this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage()) ); @@ -509,7 +509,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro try { $this->cart->truncate()->save(); $this->_checkoutSession->setCartWasUpdated(true); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { $this->messageManager->addError($exception->getMessage()); } catch (\Exception $exception) { $this->messageManager->addException($exception, __('We cannot update the shopping cart.')); @@ -631,7 +631,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro } else { $this->messageManager->addSuccess(__('The coupon code was canceled.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We cannot apply the coupon code.')); diff --git a/app/code/Magento/Checkout/Controller/Onepage.php b/app/code/Magento/Checkout/Controller/Onepage.php index cac26a84ecd..b6e8ad545e7 100755 --- a/app/code/Magento/Checkout/Controller/Onepage.php +++ b/app/code/Magento/Checkout/Controller/Onepage.php @@ -69,7 +69,7 @@ class Onepage extends Action * @param CustomerAccountService $customerAccountService * @param CustomerMetadataService $customerMetadataService * @param \Magento\Registry $coreRegistry - * @param \Magento\Translate\InlineInterface $translateInline, + * @param \Magento\Translate\InlineInterface $translateInline * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator */ public function __construct( @@ -505,7 +505,7 @@ class Onepage extends Action $result['fields'] = $e->getFields(); } $result['error'] = $e->getMessage(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result['error'] = $e->getMessage(); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); @@ -617,7 +617,7 @@ class Onepage extends Action } $result['goto_section'] = 'payment'; $result['update_section'] = array('name' => 'payment-method', 'html' => $this->_getPaymentMethodsHtml()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); $this->_objectManager->get( 'Magento\Checkout\Helper\Data' diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php index 62a66ed9880..8f8cf1fdd3c 100644 --- a/app/code/Magento/Checkout/Helper/Data.php +++ b/app/code/Magento/Checkout/Helper/Data.php @@ -77,11 +77,9 @@ class Data extends \Magento\App\Helper\AbstractHelper protected $_transportBuilder; /** - * Translator model - * - * @var \Magento\TranslateInterface + * @var \Magento\Translate\Inline\StateInterface */ - protected $_translator; + protected $inlineTranslation; /** * @param \Magento\App\Helper\Context $context @@ -91,7 +89,7 @@ class Data extends \Magento\App\Helper\AbstractHelper * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollectionFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\TranslateInterface $translator + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\App\Helper\Context $context, @@ -101,7 +99,7 @@ class Data extends \Magento\App\Helper\AbstractHelper \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollectionFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\TranslateInterface $translator + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_coreStoreConfig = $coreStoreConfig; $this->_storeManager = $storeManager; @@ -109,7 +107,7 @@ class Data extends \Magento\App\Helper\AbstractHelper $this->_localeDate = $localeDate; $this->_agreementCollectionFactory = $agreementCollectionFactory; $this->_transportBuilder = $transportBuilder; - $this->_translator = $translator; + $this->inlineTranslation = $inlineTranslation; parent::__construct($context); } @@ -246,7 +244,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function sendPaymentFailedEmail($checkout, $message, $checkoutType = 'onepage') { - $this->_translator->setTranslateInline(false); + $this->inlineTranslation->suspend(); $template = $this->_coreStoreConfig->getConfig('checkout/payment_failed/template', $checkout->getStoreId()); @@ -334,7 +332,7 @@ class Data extends \Magento\App\Helper\AbstractHelper $transport->sendMessage(); } - $this->_translator->setTranslateInline(true); + $this->inlineTranslation->resume(); return $this; } diff --git a/app/code/Magento/Checkout/Model/Agreement.php b/app/code/Magento/Checkout/Model/Agreement.php index 06c7cb32729..5f436f67389 100644 --- a/app/code/Magento/Checkout/Model/Agreement.php +++ b/app/code/Magento/Checkout/Model/Agreement.php @@ -45,7 +45,7 @@ namespace Magento\Checkout\Model; * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -class Agreement extends \Magento\Core\Model\AbstractModel +class Agreement extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Checkout/Model/Cart.php b/app/code/Magento/Checkout/Model/Cart.php index 0d83b463636..174ca475a0b 100644 --- a/app/code/Magento/Checkout/Model/Cart.php +++ b/app/code/Magento/Checkout/Model/Cart.php @@ -272,7 +272,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI * * @param Product|int|string $productInfo * @return Product - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getProduct($productInfo) { @@ -294,7 +294,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI $product->getWebsiteIds() ) ) { - throw new \Magento\Core\Exception(__('We can\'t find the product.')); + throw new \Magento\Model\Exception(__('We can\'t find the product.')); } return $product; } @@ -328,7 +328,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI * @param int|Product $productInfo * @param \Magento\Object|int|array $requestInfo * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addProduct($productInfo, $requestInfo = null) { @@ -351,7 +351,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI if ($productId) { try { $result = $this->getQuote()->addProduct($product, $request); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_checkoutSession->setUseNotice(false); $result = $e->getMessage(); } @@ -367,10 +367,10 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI if ($this->_checkoutSession->getUseNotice() === null) { $this->_checkoutSession->setUseNotice(true); } - throw new \Magento\Core\Exception($result); + throw new \Magento\Model\Exception($result); } } else { - throw new \Magento\Core\Exception(__('The product does not exist.')); + throw new \Magento\Model\Exception(__('The product does not exist.')); } $this->_eventManager->dispatch( @@ -469,7 +469,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI * * @param array $data * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function updateItems($data) { @@ -494,7 +494,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI $itemInQuote = $this->getQuote()->getItemById($item->getId()); if (!$itemInQuote && $item->getHasError()) { - throw new \Magento\Core\Exception($item->getMessage()); + throw new \Magento\Model\Exception($item->getMessage()); } if (isset($itemInfo['before_suggest_qty']) && $itemInfo['before_suggest_qty'] != $qty) { @@ -644,7 +644,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI * @param int|array|\Magento\Object $requestInfo * @param null|array|\Magento\Object $updatingParams * @return \Magento\Sales\Model\Quote\Item|string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * * @see \Magento\Sales\Model\Quote::updateItem() */ @@ -653,7 +653,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI try { $item = $this->getQuote()->getItemById($itemId); if (!$item) { - throw new \Magento\Core\Exception(__('This quote item does not exist.')); + throw new \Magento\Model\Exception(__('This quote item does not exist.')); } $productId = $item->getProduct()->getId(); $product = $this->_getProduct($productId); @@ -672,7 +672,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI } $result = $this->getQuote()->updateItem($itemId, $request, $updatingParams); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_checkoutSession->setUseNotice(false); $result = $e->getMessage(); } @@ -684,7 +684,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI if ($this->_checkoutSession->getUseNotice() === null) { $this->_checkoutSession->setUseNotice(true); } - throw new \Magento\Core\Exception($result); + throw new \Magento\Model\Exception($result); } $this->_eventManager->dispatch( diff --git a/app/code/Magento/Checkout/Model/Observer.php b/app/code/Magento/Checkout/Model/Observer.php index b76a51080a5..5e4f8164625 100644 --- a/app/code/Magento/Checkout/Model/Observer.php +++ b/app/code/Magento/Checkout/Model/Observer.php @@ -70,7 +70,7 @@ class Observer { try { $this->_checkoutSession->loadCustomerQuote(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Load customer quote error')); @@ -78,7 +78,7 @@ class Observer } /** - * @param Observer $observer + * @param \Magento\Event\Observer $observer * @return void */ public function salesQuoteSaveAfter($observer) diff --git a/app/code/Magento/Checkout/Model/Resource/Agreement.php b/app/code/Magento/Checkout/Model/Resource/Agreement.php index 1a00d59e00c..b81de86d77b 100644 --- a/app/code/Magento/Checkout/Model/Resource/Agreement.php +++ b/app/code/Magento/Checkout/Model/Resource/Agreement.php @@ -32,7 +32,7 @@ namespace Magento\Checkout\Model\Resource; * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb +class Agreement extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Filter\FilterManager @@ -62,10 +62,10 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Method to run before save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { // format height $height = $object->getContentHeight(); @@ -83,10 +83,10 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Method to run after save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $condition = array('agreement_id = ?' => $object->getId()); $this->_getWriteAdapter()->delete($this->getTable('checkout_agreement_store'), $condition); @@ -104,10 +104,10 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Method to run after load * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { $select = $this->_getReadAdapter()->select()->from( $this->getTable('checkout_agreement_store'), @@ -128,7 +128,7 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Magento\DB\Select */ protected function _getLoadSelect($field, $value, $object) diff --git a/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php b/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php index e30acc0cc6c..506fa2d9d0d 100644 --- a/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php +++ b/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Checkout\Model\Resource\Agreement; * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var array diff --git a/app/code/Magento/Checkout/Model/Resource/Cart.php b/app/code/Magento/Checkout/Model/Resource/Cart.php index 5a998769a7f..03bac206c72 100644 --- a/app/code/Magento/Checkout/Model/Resource/Cart.php +++ b/app/code/Magento/Checkout/Model/Resource/Cart.php @@ -32,7 +32,7 @@ namespace Magento\Checkout\Model\Resource; * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -class Cart extends \Magento\Core\Model\Resource\Db\AbstractDb +class Cart extends \Magento\Model\Resource\Db\AbstractDb { /** * Model initialization diff --git a/app/code/Magento/Checkout/Model/Type/AbstractType.php b/app/code/Magento/Checkout/Model/Type/AbstractType.php index 14d23715b74..beb19d77487 100644 --- a/app/code/Magento/Checkout/Model/Type/AbstractType.php +++ b/app/code/Magento/Checkout/Model/Type/AbstractType.php @@ -86,12 +86,7 @@ abstract class AbstractType extends \Magento\Object */ public function getCheckoutSession() { - $checkout = $this->getData('checkout_session'); - if (is_null($checkout)) { - $checkout = $this->_checkoutSession; - $this->setData('checkout_session', $checkout); - } - return $checkout; + return $this->_checkoutSession; } /** diff --git a/app/code/Magento/Checkout/Model/Type/Onepage.php b/app/code/Magento/Checkout/Model/Type/Onepage.php index 84009196234..d96ff08318b 100644 --- a/app/code/Magento/Checkout/Model/Type/Onepage.php +++ b/app/code/Magento/Checkout/Model/Type/Onepage.php @@ -720,18 +720,18 @@ class Onepage * Validate quote state to be integrated with one page checkout process * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function validate() { $quote = $this->getQuote(); if ($quote->isMultipleShippingAddresses()) { - throw new \Magento\Core\Exception(__('There are more than one shipping address.')); + throw new \Magento\Model\Exception(__('There are more than one shipping address.')); } if ($quote->getCheckoutMethod() == self::METHOD_GUEST && !$this->_helper->isAllowedGuestCheckout($quote)) { - throw new \Magento\Core\Exception(__('Sorry, guest checkout is not enabled.')); + throw new \Magento\Model\Exception(__('Sorry, guest checkout is not enabled.')); } } diff --git a/app/code/Magento/Checkout/etc/module.xml b/app/code/Magento/Checkout/etc/module.xml index 9e017c01242..7d8b94585ac 100644 --- a/app/code/Magento/Checkout/etc/module.xml +++ b/app/code/Magento/Checkout/etc/module.xml @@ -43,7 +43,6 @@ <module name="Magento_Wishlist"/> <module name="Magento_Weee"/> <module name="Magento_Backend"/> - <module name="Magento_Theme"/> <module name="Magento_Service"/> <module name="Magento_PageCache"/> </depends> diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Page.php b/app/code/Magento/Cms/Controller/Adminhtml/Page.php index 6c3942777af..1558c20dfa3 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Page.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Page.php @@ -198,7 +198,7 @@ class Page extends \Magento\Backend\App\Action // go to grid $this->_redirect('*/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong while saving the page.')); diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php index 1670d97f317..2277e05a14d 100644 --- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php @@ -216,7 +216,7 @@ class Images extends \Magento\App\Helper\AbstractHelper * Try to create target directory if it doesn't exist * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getCurrentPath() { @@ -236,7 +236,7 @@ class Images extends \Magento\App\Helper\AbstractHelper } } catch (\Magento\Filesystem\FilesystemException $e) { $message = __('The directory %1 is not writable by server.', $currentPath); - throw new \Magento\Core\Exception($message); + throw new \Magento\Model\Exception($message); } $this->_currentPath = $currentPath; } diff --git a/app/code/Magento/Cms/Model/Block.php b/app/code/Magento/Cms/Model/Block.php index 481941f2541..e85e19ef652 100644 --- a/app/code/Magento/Cms/Model/Block.php +++ b/app/code/Magento/Cms/Model/Block.php @@ -43,7 +43,7 @@ namespace Magento\Cms\Model; * @method int getIsActive() * @method \Magento\Cms\Model\Block setIsActive(int $value) */ -class Block extends \Magento\Core\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Block extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { /** * CMS block cache tag @@ -73,8 +73,8 @@ class Block extends \Magento\Core\Model\AbstractModel implements \Magento\Object /** * Prevent blocks recursion * - * @return \Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return \Magento\Model\AbstractModel + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -82,7 +82,7 @@ class Block extends \Magento\Core\Model\AbstractModel implements \Magento\Object if (false == strstr($this->getContent(), $needle)) { return parent::_beforeSave(); } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Make sure that static block content does not reference the block itself.') ); } diff --git a/app/code/Magento/Cms/Model/Page.php b/app/code/Magento/Cms/Model/Page.php index 7105114e992..a0d812747ab 100644 --- a/app/code/Magento/Cms/Model/Page.php +++ b/app/code/Magento/Cms/Model/Page.php @@ -65,7 +65,7 @@ namespace Magento\Cms\Model; * @method string getCustomThemeTo() * @method \Magento\Cms\Model\Page setCustomThemeTo(string $value) */ -class Page extends \Magento\Core\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Page extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { /** * No route page id diff --git a/app/code/Magento/Cms/Model/Page/Urlrewrite.php b/app/code/Magento/Cms/Model/Page/Urlrewrite.php index 926156b483c..d1975756b02 100644 --- a/app/code/Magento/Cms/Model/Page/Urlrewrite.php +++ b/app/code/Magento/Cms/Model/Page/Urlrewrite.php @@ -34,7 +34,7 @@ namespace Magento\Cms\Model\Page; * @method \Magento\Cms\Model\Page\Urlrewrite setCmsPageId() setCmsPageId(int) * @method \Magento\Cms\Model\Page\Urlrewrite setUrlRewriteId() setUrlRewriteId(int) */ -class Urlrewrite extends \Magento\Core\Model\AbstractModel +class Urlrewrite extends \Magento\Model\AbstractModel { /** * Initialize resource model diff --git a/app/code/Magento/Cms/Model/Resource/Block.php b/app/code/Magento/Cms/Model/Resource/Block.php index 02609aac090..6e09e906d48 100644 --- a/app/code/Magento/Cms/Model/Resource/Block.php +++ b/app/code/Magento/Cms/Model/Resource/Block.php @@ -28,7 +28,7 @@ namespace Magento\Cms\Model\Resource; /** * CMS block model */ -class Block extends \Magento\Core\Model\Resource\Db\AbstractDb +class Block extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime\DateTime @@ -72,10 +72,10 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Process block data before deleting * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Magento\Cms\Model\Resource\Page */ - protected function _beforeDelete(\Magento\Core\Model\AbstractModel $object) + protected function _beforeDelete(\Magento\Model\AbstractModel $object) { $condition = array('block_id = ?' => (int)$object->getId()); @@ -87,14 +87,14 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform operations before object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if (!$this->getIsUniqueBlockToStores($object)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('A block identifier with the same properties already exists in the selected store.') ); } @@ -109,10 +109,10 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform operations after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $oldStores = $this->lookupStoreIds($object->getId()); $newStores = (array)$object->getStores(); @@ -143,12 +143,12 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Load an object using 'identifier' field if there's no field specified and value is not numeric * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param mixed $value * @param string $field * @return $this */ - public function load(\Magento\Core\Model\AbstractModel $object, $value, $field = null) + public function load(\Magento\Model\AbstractModel $object, $value, $field = null) { if (!is_numeric($value) && is_null($field)) { $field = 'identifier'; @@ -160,10 +160,10 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform operations after object load * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { if ($object->getId()) { $stores = $this->lookupStoreIds($object->getId()); @@ -212,10 +212,10 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check for unique of identifier of block to selected store(s). * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return bool */ - public function getIsUniqueBlockToStores(\Magento\Core\Model\AbstractModel $object) + public function getIsUniqueBlockToStores(\Magento\Model\AbstractModel $object) { if ($this->_storeManager->hasSingleStore()) { $stores = array(\Magento\Core\Model\Store::DEFAULT_STORE_ID); diff --git a/app/code/Magento/Cms/Model/Resource/Block/Collection.php b/app/code/Magento/Cms/Model/Resource/Block/Collection.php index d8a707580a9..6c58d666182 100644 --- a/app/code/Magento/Cms/Model/Resource/Block/Collection.php +++ b/app/code/Magento/Cms/Model/Resource/Block/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Cms\Model\Resource\Block; /** * CMS block model */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define resource model diff --git a/app/code/Magento/Cms/Model/Resource/Page.php b/app/code/Magento/Cms/Model/Resource/Page.php index 8b9b4b4e266..ee8cc0a11a9 100644 --- a/app/code/Magento/Cms/Model/Resource/Page.php +++ b/app/code/Magento/Cms/Model/Resource/Page.php @@ -28,7 +28,7 @@ namespace Magento\Cms\Model\Resource; /** * Cms page mysql resource */ -class Page extends \Magento\Core\Model\Resource\Db\AbstractDb +class Page extends \Magento\Model\Resource\Db\AbstractDb { /** * Store model @@ -95,10 +95,10 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Process page data before deleting * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeDelete(\Magento\Core\Model\AbstractModel $object) + protected function _beforeDelete(\Magento\Model\AbstractModel $object) { $condition = array('page_id = ?' => (int)$object->getId()); @@ -110,11 +110,11 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Process page data before saving * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { /* * For two attributes which represent timestamp data in DB @@ -132,15 +132,15 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb } if (!$this->getIsUniquePageToStores($object)) { - throw new \Magento\Core\Exception(__('A page URL key for specified store already exists.')); + throw new \Magento\Model\Exception(__('A page URL key for specified store already exists.')); } if (!$this->isValidPageIdentifier($object)) { - throw new \Magento\Core\Exception(__('The page URL key contains capital letters or disallowed symbols.')); + throw new \Magento\Model\Exception(__('The page URL key contains capital letters or disallowed symbols.')); } if ($this->isNumericPageIdentifier($object)) { - throw new \Magento\Core\Exception(__('The page URL key cannot be made of only numbers.')); + throw new \Magento\Model\Exception(__('The page URL key cannot be made of only numbers.')); } // modify create / update dates @@ -156,10 +156,10 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Assign page to store views * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $oldStores = $this->lookupStoreIds($object->getId()); $newStores = (array)$object->getStores(); @@ -192,12 +192,12 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Load an object using 'identifier' field if there's no field specified and value is not numeric * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param mixed $value * @param string $field * @return $this */ - public function load(\Magento\Core\Model\AbstractModel $object, $value, $field = null) + public function load(\Magento\Model\AbstractModel $object, $value, $field = null) { if (!is_numeric($value) && is_null($field)) { $field = 'identifier'; @@ -209,10 +209,10 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform operations after object load * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { if ($object->getId()) { $stores = $this->lookupStoreIds($object->getId()); @@ -291,10 +291,10 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check for unique of identifier of page to selected store(s). * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return bool */ - public function getIsUniquePageToStores(\Magento\Core\Model\AbstractModel $object) + public function getIsUniquePageToStores(\Magento\Model\AbstractModel $object) { if ($this->_storeManager->hasSingleStore() || !$object->hasStores()) { $stores = array(\Magento\Core\Model\Store::DEFAULT_STORE_ID); @@ -318,10 +318,10 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check whether page identifier is numeric * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return bool */ - protected function isNumericPageIdentifier(\Magento\Core\Model\AbstractModel $object) + protected function isNumericPageIdentifier(\Magento\Model\AbstractModel $object) { return preg_match('/^[0-9]+$/', $object->getData('identifier')); } @@ -329,10 +329,10 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check whether page identifier is valid * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return bool */ - protected function isValidPageIdentifier(\Magento\Core\Model\AbstractModel $object) + protected function isValidPageIdentifier(\Magento\Model\AbstractModel $object) { return preg_match('/^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/', $object->getData('identifier')); } diff --git a/app/code/Magento/Cms/Model/Resource/Page/Collection.php b/app/code/Magento/Cms/Model/Resource/Page/Collection.php index 4bd37f0b4b1..82266142b42 100644 --- a/app/code/Magento/Cms/Model/Resource/Page/Collection.php +++ b/app/code/Magento/Cms/Model/Resource/Page/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Cms\Model\Resource\Page; /** * CMS page collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Load data for preview flag @@ -51,7 +51,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -60,7 +60,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Cms/Model/Resource/Page/Service.php b/app/code/Magento/Cms/Model/Resource/Page/Service.php index f086a414dc0..6abea9a00e3 100644 --- a/app/code/Magento/Cms/Model/Resource/Page/Service.php +++ b/app/code/Magento/Cms/Model/Resource/Page/Service.php @@ -28,7 +28,7 @@ namespace Magento\Cms\Model\Resource\Page; /** * Cms page service resource model */ -class Service extends \Magento\Core\Model\Resource\Db\AbstractDb +class Service extends \Magento\Model\Resource\Db\AbstractDb { /** * Init cms page service model diff --git a/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php b/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php index c9affbccfb6..f859a465cc6 100644 --- a/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php +++ b/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php @@ -28,7 +28,7 @@ namespace Magento\Cms\Model\Resource\Page; /** * Cms page url rewrite resource model */ -class Urlrewrite extends \Magento\Core\Model\Resource\Db\AbstractDb +class Urlrewrite extends \Magento\Model\Resource\Db\AbstractDb { /** * Init cms page urlrewrite model diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php index 6fbccb15893..8f5cad2c4fe 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php @@ -353,12 +353,12 @@ class Storage extends \Magento\Object * @param string $name New directory name * @param string $path Parent directory path * @return array New directory info - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function createDirectory($name, $path) { if (!preg_match(self::DIRECTORY_NAME_REGEXP, $name)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please correct the folder name. Use only letters, numbers, underscores and dashes.') ); } @@ -371,7 +371,7 @@ class Storage extends \Magento\Object $newPath = $path . '/' . $name; $relativeNewPath = $this->_directory->getRelativePath($newPath); if ($this->_directory->isDirectory($relativeNewPath)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We found a directory with the same name. Please try another folder name.') ); } @@ -391,7 +391,7 @@ class Storage extends \Magento\Object ); return $result; } catch (\Magento\Filesystem\FilesystemException $e) { - throw new \Magento\Core\Exception(__('We cannot create a new directory.')); + throw new \Magento\Model\Exception(__('We cannot create a new directory.')); } } @@ -400,7 +400,7 @@ class Storage extends \Magento\Object * * @param string $path Target dir * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function deleteDirectory($path) { @@ -412,7 +412,7 @@ class Storage extends \Magento\Object $path = $this->getThumbnailRoot() . $this->_getRelativePathToRoot($path); $this->_deleteByPath($path); } catch (\Magento\Filesystem\FilesystemException $e) { - throw new \Magento\Core\Exception(__('We cannot delete directory %1.', $path)); + throw new \Magento\Model\Exception(__('We cannot delete directory %1.', $path)); } } @@ -462,7 +462,7 @@ class Storage extends \Magento\Object * @param string $targetPath Target directory * @param string $type Type of storage, e.g. image, media etc. * @return array File info Array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function uploadFile($targetPath, $type = null) { @@ -477,7 +477,7 @@ class Storage extends \Magento\Object $result = $uploader->save($targetPath); if (!$result) { - throw new \Magento\Core\Exception(__('We cannot upload the file.')); + throw new \Magento\Model\Exception(__('We cannot upload the file.')); } // create thumbnail @@ -699,16 +699,16 @@ class Storage extends \Magento\Object * * @param string $path * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validatePath($path) { $root = $this->_sanitizePath($this->_cmsWysiwygImages->getStorageRoot()); if ($root == $path) { - throw new \Magento\Core\Exception(__('We cannot delete root directory %1.', $path)); + throw new \Magento\Model\Exception(__('We cannot delete root directory %1.', $path)); } if (strpos($path, $root) !== 0) { - throw new \Magento\Core\Exception(__('Directory %1 is not under storage root path.', $path)); + throw new \Magento\Model\Exception(__('Directory %1 is not under storage root path.', $path)); } } diff --git a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php index a378517648b..2d9df1edd29 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php @@ -27,6 +27,7 @@ namespace Magento\ConfigurableProduct\Block\Product\View\Type; use Magento\Catalog\Model\Product\PriceModifierInterface; use Magento\Customer\Controller\RegistryConstants; +use Magento\Customer\Service\V1\CustomerAccountServiceInterface as CustomerAccountService; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -60,14 +61,14 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView protected $_jsonEncoder; /** - * @var \Magento\Catalog\Helper\Image + * @var \Magento\Catalog\Helper\Product\Price */ - protected $_imageHelper; + protected $priceHelper; /** - * @var \Magento\Catalog\Helper\Product\Price + * @var CustomerAccountService */ - protected $priceHelper; + protected $_customerAccountService; /** * @var \Magento\Catalog\Model\Product\PriceModifierInterface @@ -91,48 +92,30 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView * @param \Magento\Catalog\Helper\Product $catalogProduct * @param \Magento\Catalog\Helper\Product\Price $priceHelper * @param \Magento\Catalog\Model\Product\PriceModifierInterface $priceModifier + * @param CustomerAccountService $customerAccountService * @param array $data * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Helper\Product $catalogProduct, \Magento\Catalog\Helper\Product\Price $priceHelper, + CustomerAccountService $customerAccountService, PriceModifierInterface $priceModifier, array $data = array(), array $priceBlockTypes = array() ) { - $this->_imageHelper = $imageHelper; $this->_catalogProduct = $catalogProduct; $this->_jsonEncoder = $jsonEncoder; $this->priceHelper = $priceHelper; $this->priceModifier = $priceModifier; + $this->_customerAccountService = $customerAccountService; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $arrayUtils, $data, $priceBlockTypes @@ -321,9 +304,12 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView } } - if (!$this->priceHelper->getCustomer() && $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER) + + if (is_null($this->priceHelper->getCustomer()->getId()) + && $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID) ) { - $this->priceHelper->setCustomer($this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER)); + $customerId = $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->priceHelper->setCustomer($this->_customerAccountService->getCustomer($customerId)); } $_request = $this->priceHelper->getRateRequest(false, false, false); diff --git a/app/code/Magento/ConfigurableProduct/Model/Attribute/LockValidator.php b/app/code/Magento/ConfigurableProduct/Model/Attribute/LockValidator.php index 6d6efe9979e..fcbac59d429 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Attribute/LockValidator.php +++ b/app/code/Magento/ConfigurableProduct/Model/Attribute/LockValidator.php @@ -43,13 +43,13 @@ class LockValidator implements LockValidatorInterface /** * Check attribute lock state * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param null $attributeSet - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * * @return void */ - public function validate(\Magento\Core\Model\AbstractModel $object, $attributeSet = null) + public function validate(\Magento\Model\AbstractModel $object, $attributeSet = null) { $adapter = $this->resource->getConnection('read'); $attrTable = $this->resource->getTableName('catalog_product_super_attribute'); @@ -77,7 +77,7 @@ class LockValidator implements LockValidatorInterface } if ($adapter->fetchOne($select, $bind)) { - throw new \Magento\Core\Exception(__('This attribute is used in configurable products.')); + throw new \Magento\Model\Exception(__('This attribute is used in configurable products.')); } } } diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php index 66079b7bd7a..c11a4659800 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php @@ -803,7 +803,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType * * @param \Magento\Catalog\Model\Product $product * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function checkProductBuyState($product) { @@ -820,7 +820,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType } } if (empty($attributes)) { - throw new \Magento\Core\Exception($this->getSpecifyOptionMessage()); + throw new \Magento\Model\Exception($this->getSpecifyOptionMessage()); } } return $this; diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php index c1cf918e76c..8eb6401706f 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php @@ -37,7 +37,7 @@ namespace Magento\ConfigurableProduct\Model\Product\Type\Configurable; * @method Attribute setProductAttribute(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $value) * @method \Magento\Eav\Model\Entity\Attribute\AbstractAttribute getProductAttribute() */ -class Attribute extends \Magento\Core\Model\AbstractModel +class Attribute extends \Magento\Model\AbstractModel { /** * Initialize resource model diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable.php index 8b86dfd8b5b..4eb75a09e5b 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable.php @@ -25,7 +25,7 @@ */ namespace Magento\ConfigurableProduct\Model\Resource\Product\Type; -class Configurable extends \Magento\Core\Model\Resource\Db\AbstractDb +class Configurable extends \Magento\Model\Resource\Db\AbstractDb { /** * Catalog product relation diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php index b72c0c90d08..26baad63213 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php @@ -25,7 +25,7 @@ */ namespace Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable; -class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb +class Attribute extends \Magento\Model\Resource\Db\AbstractDb { /** * Label table name cache diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php index 073a180ee5a..3d77f0eec6b 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php @@ -28,7 +28,7 @@ namespace Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\A /** * @SuppressWarnings(PHPMD.LongVariable) */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Configurable attributes label table name diff --git a/app/code/Magento/ConfigurableProduct/etc/module.xml b/app/code/Magento/ConfigurableProduct/etc/module.xml index ebf21c52ff7..15362773547 100644 --- a/app/code/Magento/ConfigurableProduct/etc/module.xml +++ b/app/code/Magento/ConfigurableProduct/etc/module.xml @@ -37,9 +37,7 @@ <module name="Magento_CatalogInventory" /> <module name="Magento_Sales" /> <module name="Magento_Core" /> - <module name="Magento_Tax" /> <module name="Magento_Checkout" /> - <module name="Magento_Wishlist" /> <module name="Magento_Theme" /> <module name="Magento_Backend" /> <module name="Magento_Eav" /> diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php b/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php index 22190e37065..108c7b7de6c 100644 --- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php +++ b/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php @@ -85,7 +85,7 @@ class Custom extends \Magento\Backend\App\Action try { $data = $this->_objectManager->get('Magento\Connect\Helper\Data')->loadLocalPackage($packageName); if (!$data) { - throw new \Magento\Core\Exception(__('Something went wrong loading the package data.')); + throw new \Magento\Model\Exception(__('Something went wrong loading the package data.')); } $data = array_merge($data, array('file_name' => $packageName)); $session->setCustomExtensionPackageFormData($data); @@ -132,7 +132,7 @@ class Custom extends \Magento\Backend\App\Action } else { $this->_forward('create'); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('adminhtml/*'); } catch (\Exception $e) { @@ -164,7 +164,7 @@ class Custom extends \Magento\Backend\App\Action } } $this->_redirect('adminhtml/*'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('adminhtml/*'); } catch (\Exception $e) { diff --git a/app/code/Magento/Connect/Model/Extension.php b/app/code/Magento/Connect/Model/Extension.php index aa63b0a6158..182f244818c 100644 --- a/app/code/Magento/Connect/Model/Extension.php +++ b/app/code/Magento/Connect/Model/Extension.php @@ -112,7 +112,7 @@ class Extension extends \Magento\Object * Set package object * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function generatePackageXml() { @@ -121,7 +121,7 @@ class Extension extends \Magento\Object $this->_setPackage()->_setRelease()->_setAuthors()->_setDependencies()->_setContents(); if (!$this->getPackage()->validate()) { $message = $this->getPackage()->getErrors(); - throw new \Magento\Core\Exception(__($message[0])); + throw new \Magento\Model\Exception(__($message[0])); } $this->setPackageXml($this->getPackage()->getPackageXml()); return $this; diff --git a/app/code/Magento/Contacts/Controller/Index.php b/app/code/Magento/Contacts/Controller/Index.php index 75a1b8a2755..3797bee1694 100644 --- a/app/code/Magento/Contacts/Controller/Index.php +++ b/app/code/Magento/Contacts/Controller/Index.php @@ -51,16 +51,24 @@ class Index extends \Magento\App\Action\Action */ protected $_transportBuilder; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\App\Action\Context $context * @param \Magento\Mail\Template\TransportBuilder $transportBuilder + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\App\Action\Context $context, - \Magento\Mail\Template\TransportBuilder $transportBuilder + \Magento\Mail\Template\TransportBuilder $transportBuilder, + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { parent::__construct($context); $this->_transportBuilder = $transportBuilder; + $this->inlineTranslation = $inlineTranslation; } /** @@ -110,9 +118,7 @@ class Index extends \Magento\App\Action\Action } $post = $this->getRequest()->getPost(); if ($post) { - $translate = $this->_objectManager->get('Magento\TranslateInterface'); - /* @var $translate \Magento\TranslateInterface */ - $translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); try { $postObject = new \Magento\Object(); $postObject->setData($post); @@ -160,7 +166,7 @@ class Index extends \Magento\App\Action\Action $transport->sendMessage(); - $translate->setTranslateInline(true); + $this->inlineTranslation->resume(); $this->messageManager->addSuccess( __('Thanks for contacting us with your comments and questions. We\'ll respond to you very soon.') @@ -169,7 +175,7 @@ class Index extends \Magento\App\Action\Action return; } catch (\Exception $e) { - $translate->setTranslateInline(true); + $this->inlineTranslation->resume(); $this->messageManager->addError( __('We can\'t process your request right now. Sorry, that\'s all we know.') ); diff --git a/app/code/Magento/Core/App/Media.php b/app/code/Magento/Core/App/Media.php index ed02ec0db15..0e6ee61c192 100644 --- a/app/code/Magento/Core/App/Media.php +++ b/app/code/Magento/Core/App/Media.php @@ -26,12 +26,12 @@ namespace Magento\Core\App; use Magento\App\State; -use Magento\LauncherInterface; +use Magento\AppInterface; use Magento\ObjectManager; use Magento\Core\Model\File\Storage\Request; use Magento\Core\Model\File\Storage\Response; -class Media implements LauncherInterface +class Media implements AppInterface { /** * @var \Magento\App\State diff --git a/app/code/Magento/Core/Controller/Ajax.php b/app/code/Magento/Core/Controller/Ajax.php deleted file mode 100644 index 655743862ac..00000000000 --- a/app/code/Magento/Core/Controller/Ajax.php +++ /dev/null @@ -1,43 +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_Core - */ -namespace Magento\Core\Controller; - -class Ajax extends \Magento\App\Action\Action -{ - /** - * Ajax action for inline translation - * - * @return void - */ - public function translateAction() - { - $translationParams = (array)$this->getRequest()->getPost('translate'); - $area = $this->getRequest()->getPost('area'); - /** @var \Magento\Core\Helper\Translate $translationHelper */ - $translationHelper = $this->_objectManager->get('Magento\Core\Helper\Translate'); - $response = $translationHelper->apply($translationParams, $area); - $this->getResponse()->setBody($response); - $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); - } -} diff --git a/app/code/Magento/Core/Helper/Data.php b/app/code/Magento/Core/Helper/Data.php index 271d3663afd..f057e775345 100644 --- a/app/code/Magento/Core/Helper/Data.php +++ b/app/code/Magento/Core/Helper/Data.php @@ -226,11 +226,7 @@ class Data extends \Magento\App\Helper\AbstractHelper public function jsonEncode($valueToEncode, $cycleCheck = false, $options = array()) { $json = \Zend_Json::encode($valueToEncode, $cycleCheck, $options); - $translateInline = $this->_inlineFactory->get(); - if ($translateInline->isAllowed()) { - $translateInline->processResponseBody($json, true); - } - + $this->translateInline->processResponseBody($json, true); return $json; } diff --git a/app/code/Magento/Core/Helper/File/Media.php b/app/code/Magento/Core/Helper/File/Media.php index c8508b598b3..ac82cbec211 100644 --- a/app/code/Magento/Core/Helper/File/Media.php +++ b/app/code/Magento/Core/Helper/File/Media.php @@ -69,7 +69,7 @@ class Media extends \Magento\App\Helper\AbstractHelper * @param string $mediaDirectory * @param string $path * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function collectFileInfo($mediaDirectory, $path) { @@ -79,10 +79,10 @@ class Media extends \Magento\App\Helper\AbstractHelper $dir = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); $relativePath = $dir->getRelativePath($fullPath); if (!$dir->isFile($relativePath)) { - throw new \Magento\Core\Exception(__('File %1 does not exist', $fullPath)); + throw new \Magento\Model\Exception(__('File %1 does not exist', $fullPath)); } if (!$dir->isReadable($relativePath)) { - throw new \Magento\Core\Exception(__('File %1 is not readable', $fullPath)); + throw new \Magento\Model\Exception(__('File %1 is not readable', $fullPath)); } $path = str_replace(array('/', '\\'), '/', $path); diff --git a/app/code/Magento/Core/Helper/File/Storage.php b/app/code/Magento/Core/Helper/File/Storage.php index 745f116609c..fa0fe188804 100644 --- a/app/code/Magento/Core/Helper/File/Storage.php +++ b/app/code/Magento/Core/Helper/File/Storage.php @@ -139,7 +139,7 @@ class Storage extends \Magento\App\Helper\AbstractHelper * * @param int|null $storage * @param array $params - * @return \Magento\Core\Model\AbstractModel|bool + * @return \Magento\Model\AbstractModel|bool */ public function getStorageModel($storage = null, $params = array()) { diff --git a/app/code/Magento/Core/Helper/Js.php b/app/code/Magento/Core/Helper/Js.php index 7e94efea9b0..d5d2c51e8b6 100644 --- a/app/code/Magento/Core/Helper/Js.php +++ b/app/code/Magento/Core/Helper/Js.php @@ -36,45 +36,25 @@ class Js extends \Magento\App\Helper\AbstractHelper * * @var array */ - protected $_translateData = null; + protected $_translateData = []; /** * @var \Magento\View\Url */ protected $_viewUrl; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\View\Url $viewUrl */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Helper\Data $coreData, \Magento\View\Url $viewUrl ) { - $this->_coreData = $coreData; parent::__construct($context); $this->_viewUrl = $viewUrl; } - /** - * Retrieve JSON of JS sentences translation - * - * @return string - */ - public function getTranslateJson() - { - return $this->_coreData->jsonEncode($this->getTranslateData()); - } - /** * Retrieve JS translator initialization javascript * @@ -82,7 +62,9 @@ class Js extends \Magento\App\Helper\AbstractHelper */ public function getTranslatorScript() { - $script = '(function($) {$.mage.translate.add(' . $this->getTranslateJson() . ')})(jQuery);'; + $script = '(function($) {$.mage.translate.add(' + . $this->encode($this->getTranslateData()) + . ')})(jQuery);'; return $this->getScript($script); } @@ -115,8 +97,7 @@ class Js extends \Magento\App\Helper\AbstractHelper */ public function getTranslateData() { - if ($this->_translateData === null) { - $this->_translateData = array(); + if (!$this->_translateData) { $this->_populateTranslateData(); } return $this->_translateData; @@ -470,4 +451,17 @@ class Js extends \Magento\App\Helper\AbstractHelper $this->_translateData[$key] = $translatedText; } } + + /** + * Encode the mixed $data into the JSON format. + * + * @param mixed $data + * @return string + */ + public function encode($data) + { + $json = \Zend_Json::encode($data); + $this->translateInline->processResponseBody($json, false); + return $json; + } } diff --git a/app/code/Magento/Core/Helper/Url/Rewrite.php b/app/code/Magento/Core/Helper/Url/Rewrite.php index 3b86260399c..d6f5b33c8de 100644 --- a/app/code/Magento/Core/Helper/Url/Rewrite.php +++ b/app/code/Magento/Core/Helper/Url/Rewrite.php @@ -90,7 +90,7 @@ class Rewrite extends \Magento\App\Helper\AbstractHelper * Either returns TRUE (success) or throws error (validation failed) * * @param string $requestPath - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validateRequestPath($requestPath) @@ -98,7 +98,7 @@ class Rewrite extends \Magento\App\Helper\AbstractHelper try { $this->_validateRequestPath($requestPath); } catch (\Exception $e) { - throw new \Magento\Core\Exception($e->getMessage()); + throw new \Magento\Model\Exception($e->getMessage()); } return true; } @@ -108,7 +108,7 @@ class Rewrite extends \Magento\App\Helper\AbstractHelper * Either returns TRUE (success) or throws error (validation failed) * * @param string $suffix - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validateSuffix($suffix) @@ -120,11 +120,11 @@ class Rewrite extends \Magento\App\Helper\AbstractHelper // Make message saying about suffix, not request path switch ($e->getCode()) { case self::VERR_MANYSLASHES: - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Two and more slashes together are not permitted in url rewrite suffix') ); case self::VERR_ANCHOR: - throw new \Magento\Core\Exception(__('Anchor symbol (#) is not supported in url rewrite suffix')); + throw new \Magento\Model\Exception(__('Anchor symbol (#) is not supported in url rewrite suffix')); } } return true; diff --git a/app/code/Magento/Core/Model/App.php b/app/code/Magento/Core/Model/App.php deleted file mode 100644 index b8c919830af..00000000000 --- a/app/code/Magento/Core/Model/App.php +++ /dev/null @@ -1,479 +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_Core - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model; - -/** - * Application model - * - * Application should have: areas, store, locale, translator, design package - */ -class App implements \Magento\AppInterface -{ - /**#@+ - * Product edition labels - */ - const EDITION_COMMUNITY = 'Community'; - - const EDITION_ENTERPRISE = 'Enterprise'; - - /**#@-*/ - - /** - * Current Magento edition. - * - * @var string - * @static - */ - protected $_currentEdition = self::EDITION_COMMUNITY; - - /** - * Magento version - */ - const VERSION = '2.0.0.0-dev70'; - - /** - * Application run code - */ - const PARAM_RUN_CODE = 'MAGE_RUN_CODE'; - - /** - * Application run type (store|website) - */ - const PARAM_RUN_TYPE = 'MAGE_RUN_TYPE'; - - /** - * Disallow cache - */ - const PARAM_BAN_CACHE = 'global_ban_use_cache'; - - /** - * Allowed modules - */ - const PARAM_ALLOWED_MODULES = 'allowed_modules'; - - /** - * Caching params, that applied for all cache frontends regardless of type - */ - const PARAM_CACHE_FORCED_OPTIONS = 'cache_options'; - - /** - * Application loaded areas array - * - * @var array - */ - protected $_areas = array(); - - /** - * Application configuration object - * - * @var \Magento\App\ConfigInterface - */ - protected $_config; - - /** - * Cache object - * - * @var \Magento\App\CacheInterface - */ - protected $_cache; - - /** - * Request object - * - * @var \Magento\App\RequestInterface - */ - protected $_request; - - /** - * Response object - * - * @var \Magento\App\ResponseInterface - */ - protected $_response; - - /** - * Object manager - * - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * Data base updater object - * - * @var \Magento\Module\UpdaterInterface - */ - protected $_dbUpdater; - - /** - * @var \Magento\App\State - */ - protected $_appState; - - /** - * @var \Magento\Event\ManagerInterface - */ - protected $_eventManager; - - /** - * @var \Magento\Config\Scope - */ - protected $_configScope; - - /** - * @param \Magento\App\ConfigInterface $config - * @param \Magento\App\CacheInterface $cache - * @param \Magento\ObjectManager $objectManager - * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\App\State $appState - * @param \Magento\Config\Scope $configScope - */ - public function __construct( - \Magento\App\ConfigInterface $config, - \Magento\App\CacheInterface $cache, - \Magento\ObjectManager $objectManager, - \Magento\Event\ManagerInterface $eventManager, - \Magento\App\State $appState, - \Magento\Config\Scope $configScope - ) { - $this->_config = $config; - $this->_cache = $cache; - $this->_objectManager = $objectManager; - $this->_appState = $appState; - $this->_eventManager = $eventManager; - $this->_configScope = $configScope; - } - - /** - * Throw an exception, if the application has not been installed yet - * - * @return void - * @throws \Magento\Exception - */ - public function requireInstalledInstance() - { - if (false == $this->_appState->isInstalled()) { - throw new \Magento\Exception('Application is not installed yet, please complete the installation first.'); - } - } - - /** - * Retrieve cookie object - * - * @return \Magento\Stdlib\Cookie - */ - public function getCookie() - { - return $this->_objectManager->get('Magento\Stdlib\Cookie'); - } - - /** - * Re-declare custom error handler - * - * @param string $handler - * @return $this - */ - public function setErrorHandler($handler) - { - set_error_handler($handler); - return $this; - } - - /** - * Loading part of area data - * - * @param string $area - * @param string $part - * @return $this - */ - public function loadAreaPart($area, $part) - { - $this->getArea($area)->load($part); - return $this; - } - - /** - * Retrieve application area - * - * @param string $code - * @return \Magento\Core\Model\App\Area - */ - public function getArea($code) - { - if (!isset($this->_areas[$code])) { - $this->_areas[$code] = $this->_objectManager->create( - 'Magento\Core\Model\App\Area', - array('areaCode' => $code) - ); - } - return $this->_areas[$code]; - } - - /** - * Get distro locale code - * - * @return string - */ - public function getDistroLocaleCode() - { - return self::DISTRO_LOCALE_CODE; - } - - /** - * Retrieve layout object - * - * @return \Magento\View\LayoutInterface - */ - public function getLayout() - { - return $this->_objectManager->get('Magento\View\LayoutInterface'); - } - - /** - * Retrieve application base currency code - * - * @return string - */ - public function getBaseCurrencyCode() - { - return $this->_config->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default'); - } - - /** - * Retrieve configuration object - * - * @return \Magento\App\ConfigInterface - */ - public function getConfig() - { - return $this->_config; - } - - /** - * Get core cache model - * - * @return \Magento\App\CacheInterface - */ - public function getCacheInstance() - { - return $this->_cache; - } - - /** - * Retrieve cache object - * - * @return \Magento\Cache\FrontendInterface - */ - public function getCache() - { - return $this->_cache->getFrontend(); - } - - /** - * Loading cache data - * - * @param string $cacheId - * @return string - */ - public function loadCache($cacheId) - { - return $this->_cache->load($cacheId); - } - - /** - * Saving cache data - * - * @param mixed $data - * @param string $cacheId - * @param array $tags - * @param bool $lifeTime - * @return $this - */ - public function saveCache($data, $cacheId, $tags = array(), $lifeTime = false) - { - $this->_cache->save($data, $cacheId, $tags, $lifeTime); - return $this; - } - - /** - * Remove cache - * - * @param string $cacheId - * @return $this - */ - public function removeCache($cacheId) - { - $this->_cache->remove($cacheId); - return $this; - } - - /** - * Cleaning cache - * - * @param array $tags - * @return $this - */ - public function cleanCache($tags = array()) - { - $this->_cache->clean($tags); - return $this; - } - - /** - * Deletes all session files - * - * @return $this - */ - public function cleanAllSessions() - { - if (session_module_name() == 'files') { - /** @var \Magento\App\Filesystem $filesystem */ - $filesystem = $this->_objectManager->create('Magento\App\Filesystem'); - $sessionDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::SESSION_DIR); - foreach ($sessionDirectory->read() as $path) { - $sessionDirectory->delete($path); - } - } - return $this; - } - - /** - * Retrieve request object - * - * @return \Magento\App\RequestInterface - */ - public function getRequest() - { - if (!$this->_request) { - $this->_request = $this->_objectManager->get('Magento\App\RequestInterface'); - } - return $this->_request; - } - - /** - * Request setter - * - * @param \Magento\App\RequestInterface $request - * @return $this - */ - public function setRequest(\Magento\App\RequestInterface $request) - { - $this->_request = $request; - return $this; - } - - /** - * Retrieve response object - * - * @return \Magento\App\ResponseInterface - */ - public function getResponse() - { - if (!$this->_response) { - $this->_response = $this->_objectManager->get('Magento\App\ResponseInterface'); - $this->_response->setHeader('Content-Type', 'text/html; charset=UTF-8'); - } - return $this->_response; - } - - /** - * Response setter - * - * @param \Magento\App\ResponseInterface $response - * @return $this - */ - public function setResponse(\Magento\App\ResponseInterface $response) - { - $this->_response = $response; - return $this; - } - - /** - * Check if developer mode is enabled - * - * @return bool - */ - public function isDeveloperMode() - { - return $this->_appState->getMode() == \Magento\App\State::MODE_DEVELOPER; - } - - /** - * Get current Magento edition - * - * @static - * @return string - */ - public function getEdition() - { - return $this->_currentEdition; - } - - /** - * Set edition - * - * @param string $edition - * @return void - */ - public function setEdition($edition) - { - $this->_currentEdition = $edition; - } - - /** - * Gets the current Magento version string - * @link http://www.magentocommerce.com/blog/new-community-edition-release-process/ - * - * @return string - */ - public function getVersion() - { - $info = $this->getVersionInfo(); - return trim( - "{$info['major']}.{$info['minor']}.{$info['revision']}" . ($info['patch'] != - '' ? ".{$info['patch']}" : "") . "-{$info['stability']}{$info['number']}", - '.-' - ); - } - - /** - * Gets the detailed Magento version information - * @link http://www.magentocommerce.com/blog/new-community-edition-release-process/ - * - * @return array - */ - public function getVersionInfo() - { - return array( - 'major' => '2', - 'minor' => '0', - 'revision' => '0', - 'patch' => '0', - 'stability' => 'dev', - 'number' => '70', - ); - } -} diff --git a/app/code/Magento/Core/Model/App/Area.php b/app/code/Magento/Core/Model/App/Area.php index 81924862868..7460dae9e79 100644 --- a/app/code/Magento/Core/Model/App/Area.php +++ b/app/code/Magento/Core/Model/App/Area.php @@ -31,19 +31,13 @@ */ namespace Magento\Core\Model\App; -class Area +class Area implements \Magento\App\AreaInterface { const AREA_GLOBAL = 'global'; const AREA_FRONTEND = 'frontend'; - - const AREA_ADMIN = 'admin'; - - const PART_CONFIG = 'config'; - - const PART_TRANSLATE = 'translate'; - - const PART_DESIGN = 'design'; + + const AREA_ADMIN = 'admin'; /** * Area parameter. @@ -277,15 +271,10 @@ class Area */ protected function _initTranslate() { - $dispatchResult = new \Magento\Object(array('inline_type' => null, 'params' => array('area' => $this->_code))); - $eventManager = $this->_objectManager->get('Magento\Event\ManagerInterface'); - $eventManager->dispatch( - 'translate_initialization_before', - array('translate_object' => $this->_translator, 'result' => $dispatchResult) - ); - $this->_translator->init(null, $dispatchResult, false); + $this->_translator->loadData(null, false); \Magento\Phrase::setRenderer($this->_objectManager->get('Magento\Phrase\RendererInterface')); + return $this; } diff --git a/app/code/Magento/Core/Model/App/Emulation.php b/app/code/Magento/Core/Model/App/Emulation.php index d8c1179adb6..68341b83b7c 100644 --- a/app/code/Magento/Core/Model/App/Emulation.php +++ b/app/code/Magento/Core/Model/App/Emulation.php @@ -46,14 +46,7 @@ class Emulation extends \Magento\Object protected $_translate; /** - * @var \Magento\Core\Helper\Translate - */ - protected $_helperTranslate; - - /** - * Core store config - * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\Core\Model\Store\ConfigInterface */ protected $_coreStoreConfig; @@ -68,18 +61,23 @@ class Emulation extends \Magento\Object protected $_design; /** - * @var \Magento\Translate\Inline\ConfigFactory + * @var \Magento\Translate\Inline\ConfigInterface + */ + protected $inlineConfig; + + /** + * @var \Magento\Translate\Inline\StateInterface */ - protected $_configFactory; + protected $inlineTranslation; /** * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\View\DesignInterface $viewDesign * @param \Magento\Core\Model\Design $design * @param \Magento\TranslateInterface $translate - * @param \Magento\Core\Helper\Translate $helperTranslate - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Translate\Inline\ConfigFactory $configFactory + * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\Translate\Inline\ConfigInterface $inlineConfig + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data */ @@ -88,9 +86,9 @@ class Emulation extends \Magento\Object \Magento\View\DesignInterface $viewDesign, \Magento\Core\Model\Design $design, \Magento\TranslateInterface $translate, - \Magento\Core\Helper\Translate $helperTranslate, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Translate\Inline\ConfigFactory $configFactory, + \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\Translate\Inline\ConfigInterface $inlineConfig, + \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() ) { @@ -100,9 +98,9 @@ class Emulation extends \Magento\Object $this->_viewDesign = $viewDesign; $this->_design = $design; $this->_translate = $translate; - $this->_helperTranslate = $helperTranslate; $this->_coreStoreConfig = $coreStoreConfig; - $this->_configFactory = $configFactory; + $this->inlineConfig = $inlineConfig; + $this->inlineTranslation = $inlineTranslation; } /** @@ -175,10 +173,11 @@ class Emulation extends \Magento\Object if (is_null($storeId)) { $newTranslateInline = false; } else { - $newTranslateInline = $this->_configFactory->get()->isActive($storeId); + $newTranslateInline = $this->inlineConfig->isActive($storeId); } - $translateInline = $this->_translate->getTranslateInline(); - $this->_translate->setTranslateInline($newTranslateInline); + + $translateInline = $this->inlineTranslation->isEnabled(); + $this->inlineTranslation->suspend($newTranslateInline); return $translateInline; } @@ -223,7 +222,9 @@ class Emulation extends \Magento\Object $initialLocaleCode = $this->_localeResolver->getLocaleCode(); $newLocaleCode = $this->_coreStoreConfig->getConfig($this->_localeResolver->getDefaultLocalePath(), $storeId); $this->_localeResolver->setLocaleCode($newLocaleCode); - $this->_translate->initLocale($newLocaleCode, $area); + $this->_translate->setLocale($newLocaleCode) + ->loadData($area, true); + return $initialLocaleCode; } @@ -235,7 +236,7 @@ class Emulation extends \Magento\Object */ protected function _restoreInitialInlineTranslation($initialTranslate) { - $this->_translate->setTranslateInline($initialTranslate); + $this->inlineTranslation->resume($initialTranslate); return $this; } @@ -263,7 +264,9 @@ class Emulation extends \Magento\Object $initialArea = \Magento\Core\Model\App\Area::AREA_ADMIN ) { $this->_localeResolver->setLocaleCode($initialLocaleCode); - $this->_translate->initLocale($initialLocaleCode); + $this->_translate->setLocale($initialLocaleCode) + ->loadData($initialArea, true); + return $this; } } diff --git a/app/code/Magento/Core/Model/Config/Value.php b/app/code/Magento/Core/Model/Config/Value.php index 0fb2f2d32bc..fd8a6dd9b38 100644 --- a/app/code/Magento/Core/Model/Config/Value.php +++ b/app/code/Magento/Core/Model/Config/Value.php @@ -41,7 +41,7 @@ namespace Magento\Core\Model\Config; * * @SuppressWarnings(PHPMD.NumberOfChildren) */ -class Value extends \Magento\Core\Model\AbstractModel implements \Magento\App\Config\ValueInterface +class Value extends \Magento\Model\AbstractModel implements \Magento\App\Config\ValueInterface { /** * Prefix of model events names @@ -74,7 +74,7 @@ class Value extends \Magento\Core\Model\AbstractModel implements \Magento\App\Co * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -83,7 +83,7 @@ class Value extends \Magento\Core\Model\AbstractModel implements \Magento\App\Co \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Core/Model/Design.php b/app/code/Magento/Core/Model/Design.php index 9582b5d9bd0..78db14650e9 100644 --- a/app/code/Magento/Core/Model/Design.php +++ b/app/code/Magento/Core/Model/Design.php @@ -25,7 +25,8 @@ */ namespace Magento\Core\Model; -use Magento\Core\Model\Resource\AbstractResource; +use Magento\Model\Resource\AbstractResource; +use Magento\Model\AbstractModel; /** * Design settings change model diff --git a/app/code/Magento/Core/Model/Design/Backend/Exceptions.php b/app/code/Magento/Core/Model/Design/Backend/Exceptions.php index a507aa349fa..b20dc5c4ae4 100644 --- a/app/code/Magento/Core/Model/Design/Backend/Exceptions.php +++ b/app/code/Magento/Core/Model/Design/Backend/Exceptions.php @@ -40,7 +40,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\View\DesignInterface $design - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -50,7 +50,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\View\DesignInterface $design, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -62,7 +62,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS * Validate value * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * if there is no field value, search value is empty or regular expression is not valid */ protected function _beforeSave() @@ -78,7 +78,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS // Validate that all values have come foreach (array('search', 'value') as $fieldName) { if (!isset($row[$fieldName])) { - throw new \Magento\Core\Exception(__("Exception does not contain field '{$fieldName}'")); + throw new \Magento\Model\Exception(__("Exception does not contain field '{$fieldName}'")); } } @@ -104,7 +104,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS * * @param string $search * @return string - * @throws \Magento\Core\Exception on invalid regular expression + * @throws \Magento\Model\Exception on invalid regular expression */ protected function _composeRegexp($search) { @@ -115,7 +115,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS // Find out - whether user wanted to enter regexp or normal string. if ($this->_isRegexp($search)) { - throw new \Magento\Core\Exception(__('Invalid regular expression: "%1".', $search)); + throw new \Magento\Model\Exception(__('Invalid regular expression: "%1".', $search)); } return '/' . preg_quote($search, '/') . '/i'; diff --git a/app/code/Magento/Core/Model/Design/Backend/Theme.php b/app/code/Magento/Core/Model/Design/Backend/Theme.php index 3b86a49758d..3f0521e866a 100644 --- a/app/code/Magento/Core/Model/Design/Backend/Theme.php +++ b/app/code/Magento/Core/Model/Design/Backend/Theme.php @@ -40,7 +40,7 @@ class Theme extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\View\DesignInterface $design - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -50,7 +50,7 @@ class Theme extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\View\DesignInterface $design, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Core/Model/Factory.php b/app/code/Magento/Core/Model/Factory.php index 7b03fdd94cf..8ea5ffa3408 100644 --- a/app/code/Magento/Core/Model/Factory.php +++ b/app/code/Magento/Core/Model/Factory.php @@ -49,13 +49,13 @@ class Factory * @param string $model * @param array $data * @throws \InvalidArgumentException - * @return AbstractModel + * @return \Magento\Model\AbstractModel */ public function create($model, array $data = array()) { $modelInstance = $this->_objectManager->create($model, $data); - if (false == $modelInstance instanceof \Magento\Core\Model\AbstractModel) { - throw new \InvalidArgumentException($model . ' is not instance of \Magento\Core\Model\AbstractModel'); + if (false == $modelInstance instanceof \Magento\Model\AbstractModel) { + throw new \InvalidArgumentException($model . ' is not instance of \Magento\Model\AbstractModel'); } return $modelInstance; } diff --git a/app/code/Magento/Core/Model/File/Storage.php b/app/code/Magento/Core/Model/File/Storage.php index f49eef4bdb2..0702e2fa593 100644 --- a/app/code/Magento/Core/Model/File/Storage.php +++ b/app/code/Magento/Core/Model/File/Storage.php @@ -26,7 +26,7 @@ namespace Magento\Core\Model\File; use Magento\App\Filesystem; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Class Storage @@ -113,7 +113,7 @@ class Storage extends AbstractModel * @param \Magento\Core\Model\File\Storage\FileFactory $fileFactory * @param \Magento\Core\Model\File\Storage\DatabaseFactory $databaseFactory * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -127,7 +127,7 @@ class Storage extends AbstractModel \Magento\Core\Model\File\Storage\FileFactory $fileFactory, \Magento\Core\Model\File\Storage\DatabaseFactory $databaseFactory, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Core/Model/File/Storage/Database.php b/app/code/Magento/Core/Model/File/Storage/Database.php index 6113bf50106..b97f8ba0b04 100644 --- a/app/code/Magento/Core/Model/File/Storage/Database.php +++ b/app/code/Magento/Core/Model/File/Storage/Database.php @@ -66,12 +66,12 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas * @param \Magento\Registry $registry * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Stdlib\DateTime\DateTime $dateModel - * @param \Magento\Core\Model\App $app + * @param \Magento\App\ConfigInterface $configuration * @param \Magento\Core\Helper\File\Media $mediaHelper * @param \Magento\Core\Model\Resource\File\Storage\Database $resource - * @param \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory + * @param Directory\DatabaseFactory $directoryFactory * @param \Magento\Data\Collection\Db $resourceCollection - * @param string|null $connectionName + * @param null $connectionName * @param array $data */ public function __construct( @@ -79,7 +79,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas \Magento\Registry $registry, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Stdlib\DateTime\DateTime $dateModel, - \Magento\Core\Model\App $app, + \Magento\App\ConfigInterface $configuration, \Magento\Core\Helper\File\Media $mediaHelper, \Magento\Core\Model\Resource\File\Storage\Database $resource, \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory, @@ -94,7 +94,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas $registry, $coreFileStorageDb, $dateModel, - $app, + $configuration, $resource, $resourceCollection, $connectionName, diff --git a/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php b/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php index 8bc9d4878ed..f96210a33d6 100644 --- a/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php +++ b/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\File\Storage\Database; /** * Class AbstractDatabase */ -abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel +abstract class AbstractDatabase extends \Magento\Model\AbstractModel { /** * Store media base directory path @@ -52,17 +52,17 @@ abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel protected $_date; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\ConfigInterface */ - protected $_app; + protected $_configuration; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Stdlib\DateTime\DateTime $dateModel - * @param \Magento\Core\Model\App $app - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\App\ConfigInterface $configuration + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string|null $connectionName * @param array $data @@ -72,14 +72,14 @@ abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Stdlib\DateTime\DateTime $dateModel, - \Magento\Core\Model\App $app, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\App\ConfigInterface $configuration, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $connectionName = null, array $data = array() ) { parent::__construct($context, $registry, $resource, $resourceCollection, $data); - $this->_app = $app; + $this->_configuration = $configuration; $this->_coreFileStorageDb = $coreFileStorageDb; $this->_date = $dateModel; if (!$connectionName) { @@ -95,10 +95,11 @@ abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel */ public function getConfigConnectionName() { - $connectionName = $this->_app->getConfig()->getValue( - \Magento\Core\Model\File\Storage::XML_PATH_STORAGE_MEDIA_DATABASE, - 'default' - ); + $connectionName = $this->_configuration + ->getValue( + \Magento\Core\Model\File\Storage::XML_PATH_STORAGE_MEDIA_DATABASE, + 'default' + ); if (empty($connectionName)) { $connectionName = 'default_setup'; } @@ -108,7 +109,7 @@ abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel /** * Get resource instance * - * @return \Magento\Core\Model\Resource\AbstractResource + * @return \Magento\Model\Resource\AbstractResource */ protected function _getResource() { diff --git a/app/code/Magento/Core/Model/File/Storage/Directory/Database.php b/app/code/Magento/Core/Model/File/Storage/Directory/Database.php index e146f1e772d..cae83fec58b 100644 --- a/app/code/Magento/Core/Model/File/Storage/Directory/Database.php +++ b/app/code/Magento/Core/Model/File/Storage/Directory/Database.php @@ -54,11 +54,11 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas * @param \Magento\Registry $registry * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Stdlib\DateTime\DateTime $dateModel - * @param \Magento\Core\Model\App $app - * @param \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory + * @param \Magento\App\ConfigInterface $configuration + * @param DatabaseFactory $directoryFactory * @param \Magento\Core\Model\Resource\File\Storage\Directory\Database $resource * @param \Magento\Data\Collection\Db $resourceCollection - * @param string|null $connectionName + * @param null $connectionName * @param array $data */ public function __construct( @@ -66,7 +66,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas \Magento\Registry $registry, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Stdlib\DateTime\DateTime $dateModel, - \Magento\Core\Model\App $app, + \Magento\App\ConfigInterface $configuration, \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory, \Magento\Core\Model\Resource\File\Storage\Directory\Database $resource, \Magento\Data\Collection\Db $resourceCollection = null, @@ -79,7 +79,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas $registry, $coreFileStorageDb, $dateModel, - $app, + $configuration, $resource, $resourceCollection, $connectionName, @@ -193,7 +193,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas * Import directories to storage * * @param array $dirs - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function importDirectories($dirs) @@ -219,7 +219,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas $directory->setUploadTime($dateSingleton->date()); $directory->save(); } else { - throw new \Magento\Core\Exception(__('Parent directory does not exist: %1', $dir['path'])); + throw new \Magento\Model\Exception(__('Parent directory does not exist: %1', $dir['path'])); } } catch (\Exception $e) { $this->_logger->logException($e); diff --git a/app/code/Magento/Core/Model/File/Storage/File.php b/app/code/Magento/Core/Model/File/Storage/File.php index b21cd0e876f..7ea324dffb6 100644 --- a/app/code/Magento/Core/Model/File/Storage/File.php +++ b/app/code/Magento/Core/Model/File/Storage/File.php @@ -287,7 +287,7 @@ class File * * @param array $file * @param bool $overwrite - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function saveFile($file, $overwrite = true) @@ -306,12 +306,12 @@ class File return $this->_fileUtility->saveFile($filename, $file['content'], $overwrite); } catch (\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Unable to save file "%1" at "%2"', $file['filename'], $file['directory']) ); } } else { - throw new \Magento\Core\Exception(__('Wrong file info format')); + throw new \Magento\Model\Exception(__('Wrong file info format')); } return false; diff --git a/app/code/Magento/Core/Model/File/Storage/Flag.php b/app/code/Magento/Core/Model/File/Storage/Flag.php index c37fd0923dc..acab6d1eefe 100644 --- a/app/code/Magento/Core/Model/File/Storage/Flag.php +++ b/app/code/Magento/Core/Model/File/Storage/Flag.php @@ -34,7 +34,7 @@ */ namespace Magento\Core\Model\File\Storage; -class Flag extends \Magento\Core\Model\Flag +class Flag extends \Magento\Flag { /** * There was no synchronization diff --git a/app/code/Magento/Core/Model/Layout.php b/app/code/Magento/Core/Model/Layout.php index f14ec78004c..23690fd2475 100644 --- a/app/code/Magento/Core/Model/Layout.php +++ b/app/code/Magento/Core/Model/Layout.php @@ -1400,7 +1400,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn * * @param string|\Magento\View\Element\AbstractBlock $block * @param array $attributes - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\View\Element\AbstractBlock */ protected function _getBlockInstance($block, array $attributes = array()) @@ -1413,7 +1413,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn } } if (!$block instanceof \Magento\View\Element\AbstractBlock) { - throw new \Magento\Core\Exception(__('Invalid block type: %1', $block)); + throw new \Magento\Model\Exception(__('Invalid block type: %1', $block)); } return $block; } @@ -1527,14 +1527,14 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn * Get block singleton * * @param string $type - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\App\Helper\AbstractHelper */ public function getBlockSingleton($type) { if (!isset($this->_helpers[$type])) { if (!$type) { - throw new \Magento\Core\Exception(__('Invalid block type: %1', $type)); + throw new \Magento\Model\Exception(__('Invalid block type: %1', $type)); } $helper = $this->_blockFactory->createBlock($type); diff --git a/app/code/Magento/Core/Model/Layout/Link.php b/app/code/Magento/Core/Model/Layout/Link.php index eb17e56d2fc..7fe511be50b 100644 --- a/app/code/Magento/Core/Model/Layout/Link.php +++ b/app/code/Magento/Core/Model/Layout/Link.php @@ -35,7 +35,7 @@ namespace Magento\Core\Model\Layout; * @method \Magento\Core\Model\Layout\Link setThemeId($id) * @method \Magento\Core\Model\Layout\Link setLayoutUpdateId($id) */ -class Link extends \Magento\Core\Model\AbstractModel +class Link extends \Magento\Model\AbstractModel { /** * Layout Update model initialization diff --git a/app/code/Magento/Core/Model/Layout/Update.php b/app/code/Magento/Core/Model/Layout/Update.php index 853270d2bed..fc12369c1f3 100644 --- a/app/code/Magento/Core/Model/Layout/Update.php +++ b/app/code/Magento/Core/Model/Layout/Update.php @@ -40,7 +40,7 @@ namespace Magento\Core\Model\Layout; * @method \Magento\Core\Model\Layout\Update setUpdatedAt() setUpdatedAt(string $updateDateTime) * @method \Magento\Core\Model\Resource\Layout\Update\Collection getCollection() */ -class Update extends \Magento\Core\Model\AbstractModel +class Update extends \Magento\Model\AbstractModel { /** * @var \Magento\Stdlib\DateTime @@ -51,7 +51,7 @@ class Update extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -59,7 +59,7 @@ class Update extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -80,7 +80,7 @@ class Update extends \Magento\Core\Model\AbstractModel /** * Set current updated date * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _beforeSave() { diff --git a/app/code/Magento/Core/Model/Observer.php b/app/code/Magento/Core/Model/Observer.php index 9beb850517f..71041357b06 100644 --- a/app/code/Magento/Core/Model/Observer.php +++ b/app/code/Magento/Core/Model/Observer.php @@ -121,7 +121,7 @@ class Observer $pathPattern = $observer->getEvent()->getPathPattern(); try { $this->_registration->register($pathPattern); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_logger->logException($e); } return $this; diff --git a/app/code/Magento/Core/Model/Resource/Cache.php b/app/code/Magento/Core/Model/Resource/Cache.php index 49410249f36..4ec67829de4 100644 --- a/app/code/Magento/Core/Model/Resource/Cache.php +++ b/app/code/Magento/Core/Model/Resource/Cache.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Cache extends \Magento\Core\Model\Resource\Db\AbstractDb implements \Magento\App\Cache\State\OptionsInterface +class Cache extends \Magento\Model\Resource\Db\AbstractDb implements \Magento\App\Cache\State\OptionsInterface { /** * Define main table diff --git a/app/code/Magento/Core/Model/Resource/Config.php b/app/code/Magento/Core/Model/Resource/Config.php index 8894fb300de..f82a708d0a3 100644 --- a/app/code/Magento/Core/Model/Resource/Config.php +++ b/app/code/Magento/Core/Model/Resource/Config.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Config extends \Magento\Core\Model\Resource\Db\AbstractDb +class Config extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/Core/Model/Resource/Config/Data.php b/app/code/Magento/Core/Model/Resource/Config/Data.php index 55eb310737b..9827293ed22 100644 --- a/app/code/Magento/Core/Model/Resource/Config/Data.php +++ b/app/code/Magento/Core/Model/Resource/Config/Data.php @@ -34,7 +34,7 @@ use Magento\Core\Model\Website; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Data extends \Magento\Core\Model\Resource\Db\AbstractDb +class Data extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table @@ -49,10 +49,10 @@ class Data extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Convert array to comma separated value * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if (!$object->getId()) { $this->_checkUnique($object); @@ -68,10 +68,10 @@ class Data extends \Magento\Core\Model\Resource\Db\AbstractDb * Validate unique configuration data before save * Set id to object if exists configuration instead of throw exception * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _checkUnique(\Magento\Core\Model\AbstractModel $object) + protected function _checkUnique(\Magento\Model\AbstractModel $object) { $select = $this->_getReadAdapter()->select()->from( $this->getMainTable(), diff --git a/app/code/Magento/Core/Model/Resource/Config/Data/Collection.php b/app/code/Magento/Core/Model/Resource/Config/Data/Collection.php index d31b34bd34a..9f89d809ab7 100644 --- a/app/code/Magento/Core/Model/Resource/Config/Data/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Config/Data/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Config\Data; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define resource model diff --git a/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php b/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php index b9f1e9ef731..c98899ec99f 100644 --- a/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php +++ b/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php @@ -25,7 +25,7 @@ */ namespace Magento\Core\Model\Resource\Config\Value\Collection; -class Scoped extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Scoped extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Scope to filter by diff --git a/app/code/Magento/Core/Model/Resource/Design.php b/app/code/Magento/Core/Model/Resource/Design.php index 4fac11c8434..d9743f6d3d1 100644 --- a/app/code/Magento/Core/Model/Resource/Design.php +++ b/app/code/Magento/Core/Model/Resource/Design.php @@ -34,7 +34,7 @@ use Magento\Stdlib\DateTime; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Design extends \Magento\Core\Model\Resource\Db\AbstractDb +class Design extends \Magento\Model\Resource\Db\AbstractDb { /** * @var DateTime @@ -64,11 +64,11 @@ class Design extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - public function _beforeSave(\Magento\Core\Model\AbstractModel $object) + public function _beforeSave(\Magento\Model\AbstractModel $object) { if ($date = $object->getDateFrom()) { $object->setDateFrom($this->dateTime->formatDate($date)); @@ -92,7 +92,7 @@ class Design extends \Magento\Core\Model\Resource\Db\AbstractDb $object->getDateTo() ) ) { - throw new \Magento\Core\Exception(__('Start date cannot be greater than end date.')); + throw new \Magento\Model\Exception(__('Start date cannot be greater than end date.')); } $check = $this->_checkIntersection( @@ -103,7 +103,7 @@ class Design extends \Magento\Core\Model\Resource\Db\AbstractDb ); if ($check) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Your design change for the specified store intersects with another one, please specify another date range.' ) diff --git a/app/code/Magento/Core/Model/Resource/Design/Collection.php b/app/code/Magento/Core/Model/Resource/Design/Collection.php index 4dd9e74e559..fd141975a4e 100644 --- a/app/code/Magento/Core/Model/Resource/Design/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Design/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Design; /** * Core Design resource collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var \Magento\Stdlib\DateTime @@ -42,7 +42,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Stdlib\DateTime $dateTime * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -51,7 +51,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Stdlib\DateTime $dateTime, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->dateTime = $dateTime; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Core/Model/Resource/File/Storage/AbstractStorage.php b/app/code/Magento/Core/Model/Resource/File/Storage/AbstractStorage.php index 43bad76577e..1540f4f048a 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/AbstractStorage.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/AbstractStorage.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\File\Storage; /** * Class AbstractStorage */ -abstract class AbstractStorage extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractStorage extends \Magento\Model\Resource\Db\AbstractDb { /** * File storage connection name diff --git a/app/code/Magento/Core/Model/Resource/File/Storage/Database.php b/app/code/Magento/Core/Model/Resource/File/Storage/Database.php index 3182c186cbc..0093393f185 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/Database.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/Database.php @@ -31,15 +31,15 @@ namespace Magento\Core\Model\Resource\File\Storage; class Database extends \Magento\Core\Model\Resource\File\Storage\AbstractStorage { /** - * @var \Magento\Core\Model\Resource\Helper + * @var \Magento\DB\Helper */ protected $_resourceHelper; /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper */ - public function __construct(\Magento\App\Resource $resource, \Magento\Core\Model\Resource\Helper $resourceHelper) + public function __construct(\Magento\App\Resource $resource, \Magento\DB\Helper $resourceHelper) { parent::__construct($resource); $this->_resourceHelper = $resourceHelper; 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 fa4b725937a..f6977780936 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/File.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/File.php @@ -103,7 +103,7 @@ class File * Save directory to storage * * @param array $dir - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function saveDir($dir) @@ -118,7 +118,7 @@ class File $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR)->create($path); } catch (\Exception $e) { $this->_logger->log($e->getMessage()); - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Unable to create directory: %1', \Magento\App\Filesystem::MEDIA_DIR . '/' . $path) ); } @@ -132,7 +132,7 @@ class File * @param string $filePath * @param string $content * @param bool $overwrite - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function saveFile($filePath, $content, $overwrite = false) @@ -145,7 +145,7 @@ class File } } catch (\Magento\Filesystem\FilesystemException $e) { $this->_logger->log($e->getMessage()); - throw new \Magento\Core\Exception(__('Unable to save file: %1', $filePath)); + throw new \Magento\Model\Exception(__('Unable to save file: %1', $filePath)); } return false; diff --git a/app/code/Magento/Core/Model/Resource/Helper.php b/app/code/Magento/Core/Model/Resource/Helper.php deleted file mode 100644 index 44d6886d7bd..00000000000 --- a/app/code/Magento/Core/Model/Resource/Helper.php +++ /dev/null @@ -1,324 +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_Core - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Resource helper class for MySql Magento DB Adapter - */ -namespace Magento\Core\Model\Resource; - -class Helper extends \Magento\Core\Model\Resource\Helper\AbstractHelper -{ - /** - * @param \Magento\App\Resource $resource - * @param string $modulePrefix - */ - public function __construct(\Magento\App\Resource $resource, $modulePrefix = 'core') - { - parent::__construct($resource, $modulePrefix); - } - - /** - * Returns array of quoted orders with direction - * - * @param \Magento\DB\Select $select - * @param bool $autoReset - * @return array - */ - protected function _prepareOrder(\Magento\DB\Select $select, $autoReset = false) - { - $selectOrders = $select->getPart(\Zend_Db_Select::ORDER); - if (!$selectOrders) { - return array(); - } - - $orders = array(); - foreach ($selectOrders as $term) { - if (is_array($term)) { - if (!is_numeric($term[0])) { - $orders[] = sprintf('%s %s', $this->_getReadAdapter()->quoteIdentifier($term[0], true), $term[1]); - } - } else { - if (!is_numeric($term)) { - $orders[] = $this->_getReadAdapter()->quoteIdentifier($term, true); - } - } - } - - if ($autoReset) { - $select->reset(\Zend_Db_Select::ORDER); - } - - return $orders; - } - - /** - * Truncate alias name from field. - * - * Result string depends from second optional argument $reverse - * which can be true if you need the first part of the field. - * Field can be with 'dot' delimiter. - * - * @param string $field - * @param bool $reverse OPTIONAL - * @return string - */ - protected function _truncateAliasName($field, $reverse = false) - { - $string = $field; - if (!is_numeric($field) && strpos($field, '.') !== false) { - $size = strpos($field, '.'); - if ($reverse) { - $string = substr($field, 0, $size); - } else { - $string = substr($field, $size + 1); - } - } - - return $string; - } - - /** - * Returns quoted group by fields - * - * @param \Magento\DB\Select $select - * @param bool $autoReset - * @return array - */ - protected function _prepareGroup(\Magento\DB\Select $select, $autoReset = false) - { - $selectGroups = $select->getPart(\Zend_Db_Select::GROUP); - if (!$selectGroups) { - return array(); - } - - $groups = array(); - foreach ($selectGroups as $term) { - $groups[] = $this->_getReadAdapter()->quoteIdentifier($term, true); - } - - if ($autoReset) { - $select->reset(\Zend_Db_Select::GROUP); - } - - return $groups; - } - - /** - * Prepare and returns having array - * - * @param \Magento\DB\Select $select - * @param bool $autoReset - * @return array - * @throws \Zend_Db_Exception - */ - protected function _prepareHaving(\Magento\DB\Select $select, $autoReset = false) - { - $selectHavings = $select->getPart(\Zend_Db_Select::HAVING); - if (!$selectHavings) { - return array(); - } - - $havings = array(); - $columns = $select->getPart(\Zend_Db_Select::COLUMNS); - foreach ($columns as $columnEntry) { - $correlationName = (string)$columnEntry[1]; - $column = $columnEntry[2]; - foreach ($selectHavings as $having) { - /** - * Looking for column expression in the having clause - */ - if (strpos($having, $correlationName) !== false) { - if (is_string($column)) { - /** - * Replace column expression to column alias in having clause - */ - $havings[] = str_replace($correlationName, $column, $having); - } else { - throw new \Zend_Db_Exception( - sprintf("Can't prepare expression without column alias: '%s'", $correlationName) - ); - } - } - } - } - - if ($autoReset) { - $select->reset(\Zend_Db_Select::HAVING); - } - - return $havings; - } - - /** - * - * @param string $query - * @param int $limitCount - * @param int $limitOffset - * @param array $columnList - * @return string - */ - protected function _assembleLimit($query, $limitCount, $limitOffset, $columnList = array()) - { - if ($limitCount !== null) { - $limitCount = intval($limitCount); - if ($limitCount <= 0) { - //throw new \Exception("LIMIT argument count={$limitCount} is not valid"); - } - - $limitOffset = intval($limitOffset); - if ($limitOffset < 0) { - //throw new \Exception("LIMIT argument offset={$limitOffset} is not valid"); - } - - if ($limitOffset + $limitCount != $limitOffset + 1) { - $columns = array(); - foreach ($columnList as $columnEntry) { - $columns[] = $columnEntry[2] ? $columnEntry[2] : $columnEntry[1]; - } - $query = sprintf('%s LIMIT %s, %s', $query, $limitCount, $limitOffset); - } - } - - return $query; - } - - /** - * Prepare select column list - * - * @param \Magento\DB\Select $select - * @param string|null $groupByCondition OPTIONAL - * @return mixed|array - * @throws \Zend_Db_Exception - */ - public function prepareColumnsList(\Magento\DB\Select $select, $groupByCondition = null) - { - if (!count($select->getPart(\Zend_Db_Select::FROM))) { - return $select->getPart(\Zend_Db_Select::COLUMNS); - } - - $columns = $select->getPart(\Zend_Db_Select::COLUMNS); - $tables = $select->getPart(\Zend_Db_Select::FROM); - $preparedColumns = array(); - - foreach ($columns as $columnEntry) { - list($correlationName, $column, $alias) = $columnEntry; - if ($column instanceof \Zend_Db_Expr) { - if ($alias !== null) { - if (preg_match('/(^|[^a-zA-Z_])^(SELECT)?(SUM|MIN|MAX|AVG|COUNT)\s*\(/i', $column)) { - $column = new \Zend_Db_Expr($column); - } - $preparedColumns[strtoupper($alias)] = array(null, $column, $alias); - } else { - throw new \Zend_Db_Exception("Can't prepare expression without alias"); - } - } else { - if ($column == \Zend_Db_Select::SQL_WILDCARD) { - if ($tables[$correlationName]['tableName'] instanceof \Zend_Db_Expr) { - throw new \Zend_Db_Exception( - "Can't prepare expression when tableName is instance of \Zend_Db_Expr" - ); - } - $tableColumns = $this->_getReadAdapter()->describeTable($tables[$correlationName]['tableName']); - foreach (array_keys($tableColumns) as $col) { - $preparedColumns[strtoupper($col)] = array($correlationName, $col, null); - } - } else { - $columnKey = is_null($alias) ? $column : $alias; - $preparedColumns[strtoupper($columnKey)] = array($correlationName, $column, $alias); - } - } - } - - return $preparedColumns; - } - - /** - * Add prepared column group_concat expression - * - * @param \Magento\DB\Select $select - * @param string $fieldAlias Field alias which will be added with column group_concat expression - * @param string $fields - * @param string $groupConcatDelimiter - * @param string $fieldsDelimiter - * @param string $additionalWhere - * @return \Magento\DB\Select - */ - public function addGroupConcatColumn( - $select, - $fieldAlias, - $fields, - $groupConcatDelimiter = ',', - $fieldsDelimiter = '', - $additionalWhere = '' - ) { - if (is_array($fields)) { - $fieldExpr = $this->_getReadAdapter()->getConcatSql($fields, $fieldsDelimiter); - } else { - $fieldExpr = $fields; - } - if ($additionalWhere) { - $fieldExpr = $this->_getReadAdapter()->getCheckSql($additionalWhere, $fieldExpr, "''"); - } - $separator = ''; - if ($groupConcatDelimiter) { - $separator = sprintf(" SEPARATOR '%s'", $groupConcatDelimiter); - } - $select->columns( - array($fieldAlias => new \Zend_Db_Expr(sprintf('GROUP_CONCAT(%s%s)', $fieldExpr, $separator))) - ); - return $select; - } - - /** - * Returns expression of days passed from $startDate to $endDate - * - * @param string|\Zend_Db_Expr $startDate - * @param string|\Zend_Db_Expr $endDate - * @return \Zend_Db_Expr - */ - public function getDateDiff($startDate, $endDate) - { - $dateDiff = '(TO_DAYS(' . $endDate . ') - TO_DAYS(' . $startDate . '))'; - return new \Zend_Db_Expr($dateDiff); - } - - /** - * Escapes and quotes LIKE value. - * Stating escape symbol in expression is not required, because we use standard MySQL escape symbol. - * For options and escaping see escapeLikeValue(). - * - * @param string $value - * @param array $options - * @return \Zend_Db_Expr - * - * @see escapeLikeValue() - */ - public function addLikeEscape($value, $options = array()) - { - $value = $this->escapeLikeValue($value, $options); - return new \Zend_Db_Expr($this->_getReadAdapter()->quote($value)); - } -} diff --git a/app/code/Magento/Core/Model/Resource/HelperPool.php b/app/code/Magento/Core/Model/Resource/HelperPool.php deleted file mode 100644 index 7c7ce864d3f..00000000000 --- a/app/code/Magento/Core/Model/Resource/HelperPool.php +++ /dev/null @@ -1,78 +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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Resource helper pool - */ -namespace Magento\Core\Model\Resource; - -class HelperPool -{ - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * @var array - */ - protected $_resourceHelpers = array(); - - /** - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Get resource helper singleton - * - * @param string $moduleName - * @throws \InvalidArgumentException - * @return \Magento\Core\Model\Resource\Helper\AbstractHelper - */ - public function get($moduleName) - { - $module = str_replace('_', \Magento\Autoload\IncludePath::NS_SEPARATOR, $moduleName); - $helperClassName = $module . '\Model\Resource\Helper'; - $connection = strtolower($moduleName); - if (substr($moduleName, 0, 8) == 'Magento_') { - $connection = substr($connection, 8); - } - - if (!isset($this->_resourceHelpers[$connection])) { - $helper = $this->_objectManager->create($helperClassName, array('modulePrefix' => $connection)); - if (false === $helper instanceof \Magento\Core\Model\Resource\Helper\AbstractHelper) { - throw new \InvalidArgumentException( - $helperClassName . ' doesn\'t extend \Magento\Core\Model\Resource\Helper\AbstractHelper' - ); - } - $this->_resourceHelpers[$connection] = $helper; - } - - return $this->_resourceHelpers[$connection]; - } -} diff --git a/app/code/Magento/Core/Model/Resource/Layout/Link.php b/app/code/Magento/Core/Model/Resource/Layout/Link.php index 1cb3b1b5a5e..8d681952635 100644 --- a/app/code/Magento/Core/Model/Resource/Layout/Link.php +++ b/app/code/Magento/Core/Model/Resource/Layout/Link.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Layout; /** * Layout Link resource model */ -class Link extends \Magento\Core\Model\Resource\Db\AbstractDb +class Link extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/Core/Model/Resource/Layout/Link/Collection.php b/app/code/Magento/Core/Model/Resource/Layout/Link/Collection.php index 1ad359d8960..a6c6b18ffab 100644 --- a/app/code/Magento/Core/Model/Resource/Layout/Link/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Layout/Link/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Layout\Link; /** * Layout update collection model */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var \Magento\Stdlib\DateTime @@ -42,7 +42,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Stdlib\DateTime $dateTime * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -51,7 +51,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Stdlib\DateTime $dateTime, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->dateTime = $dateTime; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Core/Model/Resource/Layout/Update.php b/app/code/Magento/Core/Model/Resource/Layout/Update.php index 993a5b39fa8..7fb8c32062f 100644 --- a/app/code/Magento/Core/Model/Resource/Layout/Update.php +++ b/app/code/Magento/Core/Model/Resource/Layout/Update.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Layout; /** * Layout update resource model */ -class Update extends \Magento\Core\Model\Resource\Db\AbstractDb +class Update extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Cache\FrontendInterface @@ -117,10 +117,10 @@ class Update extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Update a "layout update link" if relevant data is provided * - * @param \Magento\Core\Model\Layout\Update|\Magento\Core\Model\AbstractModel $object + * @param \Magento\Core\Model\Layout\Update|\Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $data = $object->getData(); if (isset($data['store_id']) && isset($data['theme_id'])) { diff --git a/app/code/Magento/Core/Model/Resource/Layout/Update/Collection.php b/app/code/Magento/Core/Model/Resource/Layout/Update/Collection.php index ab2271b4c46..a066dbe207e 100644 --- a/app/code/Magento/Core/Model/Resource/Layout/Update/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Layout/Update/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Layout\Update; /** * Layout update collection model */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Name prefix of events that are dispatched by model @@ -56,7 +56,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Stdlib\DateTime $dateTime * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -65,7 +65,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Stdlib\DateTime $dateTime, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->dateTime = $dateTime; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Core/Model/Resource/Resource.php b/app/code/Magento/Core/Model/Resource/Resource.php index 0c490b648f7..8ce9180fda1 100644 --- a/app/code/Magento/Core/Model/Resource/Resource.php +++ b/app/code/Magento/Core/Model/Resource/Resource.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Resource extends \Magento\Core\Model\Resource\Db\AbstractDb +class Resource extends \Magento\Model\Resource\Db\AbstractDb { /** * Database versions diff --git a/app/code/Magento/Core/Model/Resource/Setup.php b/app/code/Magento/Core/Model/Resource/Setup.php index 48b105b9c73..81e942c86d4 100644 --- a/app/code/Magento/Core/Model/Resource/Setup.php +++ b/app/code/Magento/Core/Model/Resource/Setup.php @@ -540,14 +540,17 @@ class Setup implements \Magento\Module\Updater\SetupInterface */ protected function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrFiles) { - $arrRes = array(); + $arrRes = []; switch ($actionType) { case self::TYPE_DB_INSTALL: case self::TYPE_DATA_INSTALL: uksort($arrFiles, 'version_compare'); foreach ($arrFiles as $version => $file) { if (version_compare($version, $toVersion) !== self::VERSION_COMPARE_GREATER) { - $arrRes[0] = array('toVersion' => $version, 'fileName' => $file); + $arrRes[0] = [ + 'toVersion' => $version, + 'fileName' => $file + ]; } } break; @@ -563,16 +566,16 @@ class Setup implements \Magento\Module\Updater\SetupInterface break; } $infoFrom = $versionInfo[0]; - $infoTo = $versionInfo[1]; - if (version_compare( - $infoFrom, - $fromVersion - ) !== self::VERSION_COMPARE_LOWER && version_compare( - $infoTo, - $toVersion - ) !== self::VERSION_COMPARE_GREATER + $infoTo = $versionInfo[1]; + if (version_compare($infoFrom, $fromVersion, '>=') + && version_compare($infoTo, $fromVersion, '>') + && version_compare($infoTo, $toVersion, '<=') + && version_compare($infoFrom, $toVersion, '<') ) { - $arrRes[] = array('toVersion' => $infoTo, 'fileName' => $file); + $arrRes[] = [ + 'toVersion' => $infoTo, + 'fileName' => $file + ]; } } break; diff --git a/app/code/Magento/Core/Model/Resource/Store.php b/app/code/Magento/Core/Model/Resource/Store.php index bc2b2b46810..4249f66164d 100644 --- a/app/code/Magento/Core/Model/Resource/Store.php +++ b/app/code/Magento/Core/Model/Resource/Store.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Store extends \Magento\Core\Model\Resource\Db\AbstractDb +class Store extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table and primary key @@ -76,10 +76,10 @@ class Store extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Update Store Group data after save store * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { parent::_afterSave($object); $this->_updateGroupDefaultStore($object->getGroupId(), $object->getId()); @@ -91,10 +91,10 @@ class Store extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Remove core configuration data after delete store * - * @param \Magento\Core\Model\AbstractModel $model + * @param \Magento\Model\AbstractModel $model * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $model) + protected function _afterDelete(\Magento\Model\AbstractModel $model) { $where = array( 'scope = ?' => \Magento\Core\Model\ScopeInterface::SCOPE_STORES, @@ -137,10 +137,10 @@ class Store extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Change store group for store * - * @param \Magento\Core\Model\AbstractModel $model + * @param \Magento\Model\AbstractModel $model * @return $this */ - protected function _changeGroup(\Magento\Core\Model\AbstractModel $model) + protected function _changeGroup(\Magento\Model\AbstractModel $model) { if ($model->getOriginalGroupId() && $model->getGroupId() != $model->getOriginalGroupId()) { $adapter = $this->_getReadAdapter(); @@ -166,7 +166,7 @@ class Store extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Magento\DB\Select */ protected function _getLoadSelect($field, $value, $object) diff --git a/app/code/Magento/Core/Model/Resource/Store/Collection.php b/app/code/Magento/Core/Model/Resource/Store/Collection.php index e4fcbfcf228..121e9d16b4e 100644 --- a/app/code/Magento/Core/Model/Resource/Store/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Store/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Store; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Name prefix of events that are dispatched by model diff --git a/app/code/Magento/Core/Model/Resource/Store/Group.php b/app/code/Magento/Core/Model/Resource/Store/Group.php index 91f7ecd1676..2cf865d2b84 100644 --- a/app/code/Magento/Core/Model/Resource/Store/Group.php +++ b/app/code/Magento/Core/Model/Resource/Store/Group.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Store; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Group extends \Magento\Core\Model\Resource\Db\AbstractDb +class Group extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table @@ -47,10 +47,10 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Update default store group for website * - * @param \Magento\Core\Model\AbstractModel $model + * @param \Magento\Model\AbstractModel $model * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $model) + protected function _afterSave(\Magento\Model\AbstractModel $model) { $this->_updateStoreWebsite($model->getId(), $model->getWebsiteId()); $this->_updateWebsiteDefaultGroup($model->getWebsiteId(), $model->getId()); @@ -87,10 +87,10 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Change store group website * - * @param \Magento\Core\Model\AbstractModel $model + * @param \Magento\Model\AbstractModel $model * @return $this */ - protected function _changeWebsite(\Magento\Core\Model\AbstractModel $model) + protected function _changeWebsite(\Magento\Model\AbstractModel $model) { if ($model->getOriginalWebsiteId() && $model->getWebsiteId() != $model->getOriginalWebsiteId()) { $select = $this->_getWriteAdapter()->select()->from( diff --git a/app/code/Magento/Core/Model/Resource/Store/Group/Collection.php b/app/code/Magento/Core/Model/Resource/Store/Group/Collection.php index d579c698c66..cda1e15bf3b 100644 --- a/app/code/Magento/Core/Model/Resource/Store/Group/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Store/Group/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Store\Group; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define resource model diff --git a/app/code/Magento/Core/Model/Resource/Theme.php b/app/code/Magento/Core/Model/Resource/Theme.php index 40e59163cde..4729e4311ed 100644 --- a/app/code/Magento/Core/Model/Resource/Theme.php +++ b/app/code/Magento/Core/Model/Resource/Theme.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource; /** * Theme resource model */ -class Theme extends \Magento\Core\Model\Resource\Db\AbstractDb +class Theme extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Core/Model/Resource/Theme/Collection.php b/app/code/Magento/Core/Model/Resource/Theme/Collection.php index 5e8312c2f7e..1fc3025bb41 100644 --- a/app/code/Magento/Core/Model/Resource/Theme/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Theme/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Theme; /** * Theme collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection implements +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection implements \Magento\View\Design\Theme\Label\ListInterface, \Magento\View\Design\Theme\ListInterface { diff --git a/app/code/Magento/Core/Model/Resource/Theme/Customization/Update.php b/app/code/Magento/Core/Model/Resource/Theme/Customization/Update.php index d65b1bfdf66..15d4b1c815c 100644 --- a/app/code/Magento/Core/Model/Resource/Theme/Customization/Update.php +++ b/app/code/Magento/Core/Model/Resource/Theme/Customization/Update.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Theme\Customization; /** * Theme customization link resource model */ -class Update extends \Magento\Core\Model\Resource\Db\AbstractDb +class Update extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Backend/Model/Resource/Translate.php b/app/code/Magento/Core/Model/Resource/Theme/Data/Collection.php similarity index 70% rename from app/code/Magento/Backend/Model/Resource/Translate.php rename to app/code/Magento/Core/Model/Resource/Theme/Data/Collection.php index 1defebb13da..312a3cb04a8 100644 --- a/app/code/Magento/Backend/Model/Resource/Translate.php +++ b/app/code/Magento/Core/Model/Resource/Theme/Data/Collection.php @@ -18,26 +18,23 @@ * 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 * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backend\Model\Resource; +namespace Magento\Core\Model\Resource\Theme\Data; /** - * Backend translate resource model + * Theme data collection */ -class Translate extends \Magento\Core\Model\Resource\Translate +class Collection extends \Magento\Core\Model\Resource\Theme\Collection implements + \Magento\View\Design\Theme\Label\ListInterface, + \Magento\View\Design\Theme\ListInterface { /** - * Get current store id - * Use always default scope for store id - * - * @return int + * @inheritdoc */ - protected function _getStoreId() + protected function _construct() { - return \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $this->_init('Magento\Core\Model\Theme\Data', 'Magento\Core\Model\Resource\Theme'); } } diff --git a/app/code/Magento/Core/Model/Resource/Theme/File.php b/app/code/Magento/Core/Model/Resource/Theme/File.php index 51c821861d2..c28aa571fc1 100644 --- a/app/code/Magento/Core/Model/Resource/Theme/File.php +++ b/app/code/Magento/Core/Model/Resource/Theme/File.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Theme; /** * Theme files resource model */ -class File extends \Magento\Core\Model\Resource\Db\AbstractDb +class File extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Core/Model/Resource/Theme/File/Collection.php b/app/code/Magento/Core/Model/Resource/Theme/File/Collection.php index da3c2d43a11..4b3130c65f6 100644 --- a/app/code/Magento/Core/Model/Resource/Theme/File/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Theme/File/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Theme\File; /** * Theme files collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection implements +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection implements \Magento\View\Design\Theme\File\CollectionInterface { /** diff --git a/app/code/Magento/Core/Model/Resource/Url/Rewrite.php b/app/code/Magento/Core/Model/Resource/Url/Rewrite.php index 5aeb8d2073e..11d17a1f2d5 100644 --- a/app/code/Magento/Core/Model/Resource/Url/Rewrite.php +++ b/app/code/Magento/Core/Model/Resource/Url/Rewrite.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Url; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Rewrite extends \Magento\Core\Model\Resource\Db\AbstractDb +class Rewrite extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/Core/Model/Resource/Url/Rewrite/Collection.php b/app/code/Magento/Core/Model/Resource/Url/Rewrite/Collection.php index c8e7ebb4e7e..dbce2f608f3 100644 --- a/app/code/Magento/Core/Model/Resource/Url/Rewrite/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Url/Rewrite/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Core\Model\Resource\Url\Rewrite; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store Manager Model @@ -50,7 +50,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -59,7 +59,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Core/Model/Resource/Variable.php b/app/code/Magento/Core/Model/Resource/Variable.php index 183f142c751..fc0b783e6b1 100644 --- a/app/code/Magento/Core/Model/Resource/Variable.php +++ b/app/code/Magento/Core/Model/Resource/Variable.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Variable extends \Magento\Core\Model\Resource\Db\AbstractDb +class Variable extends \Magento\Model\Resource\Db\AbstractDb { /** * Constructor @@ -84,10 +84,10 @@ class Variable extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { parent::_afterSave($object); if ($object->getUseDefaultValue()) { @@ -120,7 +120,7 @@ class Variable extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ protected function _getLoadSelect($field, $value, $object) diff --git a/app/code/Magento/Core/Model/Resource/Variable/Collection.php b/app/code/Magento/Core/Model/Resource/Variable/Collection.php index 122ce77ac3b..ae2e7b73e55 100644 --- a/app/code/Magento/Core/Model/Resource/Variable/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Variable/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Variable; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store Id diff --git a/app/code/Magento/Core/Model/Resource/Website.php b/app/code/Magento/Core/Model/Resource/Website.php index bd40cc8c9e9..1a7565e0355 100644 --- a/app/code/Magento/Core/Model/Resource/Website.php +++ b/app/code/Magento/Core/Model/Resource/Website.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Website extends \Magento\Core\Model\Resource\Db\AbstractDb +class Website extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table @@ -58,14 +58,14 @@ class Website extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Validate website code before object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $object->getCode())) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Website code may only contain letters (a-z), numbers (0-9) or underscore(_), the first character must be a letter' ) @@ -78,10 +78,10 @@ class Website extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { if ($object->getIsDefault()) { $this->_getWriteAdapter()->update($this->getMainTable(), array('is_default' => 0)); @@ -94,10 +94,10 @@ class Website extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Remove core configuration data after delete website * - * @param \Magento\Core\Model\AbstractModel $model + * @param \Magento\Model\AbstractModel $model * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $model) + protected function _afterDelete(\Magento\Model\AbstractModel $model) { $where = array( 'scope = ?' => \Magento\Core\Model\ScopeInterface::SCOPE_WEBSITES, diff --git a/app/code/Magento/Core/Model/Resource/Website/Collection.php b/app/code/Magento/Core/Model/Resource/Website/Collection.php index f4211a7e704..708a67d690d 100644 --- a/app/code/Magento/Core/Model/Resource/Website/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Website/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Website; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Map field to alias diff --git a/app/code/Magento/Core/Model/Store.php b/app/code/Magento/Core/Model/Store.php index 5f1c36bd5c2..628de84ddcd 100644 --- a/app/code/Magento/Core/Model/Store.php +++ b/app/code/Magento/Core/Model/Store.php @@ -26,6 +26,7 @@ namespace Magento\Core\Model; use Magento\Directory\Model\Currency\Filter; +use Magento\Model\AbstractModel; /** * Store model @@ -328,6 +329,11 @@ class Store extends AbstractModel implements */ protected $_httpContext; + /** + * @var \Magento\App\ConfigInterface + */ + protected $_appConfig; + /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry @@ -344,6 +350,7 @@ class Store extends AbstractModel implements * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Stdlib\Cookie $cookie * @param \Magento\App\Http\Context $httpContext + * @param \Magento\App\ConfigInterface $appConfig * @param \Magento\Data\Collection\Db $resourceCollection * @param bool $isCustomEntryPoint * @param array $data @@ -364,6 +371,7 @@ class Store extends AbstractModel implements \Magento\Session\SidResolverInterface $sidResolver, \Magento\Stdlib\Cookie $cookie, \Magento\App\Http\Context $httpContext, + \Magento\App\ConfigInterface $appConfig, \Magento\Data\Collection\Db $resourceCollection = null, $isCustomEntryPoint = false, array $data = array() @@ -381,6 +389,7 @@ class Store extends AbstractModel implements $this->_sidResolver = $sidResolver; $this->_cookie = $cookie; $this->_httpContext = $httpContext; + $this->_appConfig = $appConfig; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -826,7 +835,10 @@ class Store extends AbstractModel implements { $configValue = $this->getConfig(self::XML_PATH_PRICE_SCOPE); if ($configValue == self::PRICE_SCOPE_GLOBAL) { - return \Magento\App\ObjectManager::getInstance()->get('Magento\Core\Model\App')->getBaseCurrencyCode(); + return $this->_appConfig->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + 'default' + ); } else { return $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); } @@ -1248,7 +1260,6 @@ class Store extends AbstractModel implements */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); \Magento\App\ObjectManager::getInstance()->get( 'Magento\Index\Model\Indexer' )->logEvent( diff --git a/app/code/Magento/Core/Model/Store/Exception.php b/app/code/Magento/Core/Model/Store/Exception.php index a131b1ef246..232d1ab6352 100644 --- a/app/code/Magento/Core/Model/Store/Exception.php +++ b/app/code/Magento/Core/Model/Store/Exception.php @@ -34,6 +34,7 @@ */ namespace Magento\Core\Model\Store; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { + } diff --git a/app/code/Magento/Core/Model/Store/Group.php b/app/code/Magento/Core/Model/Store/Group.php index b15d7b7d13e..39925dc3312 100644 --- a/app/code/Magento/Core/Model/Store/Group.php +++ b/app/code/Magento/Core/Model/Store/Group.php @@ -40,7 +40,7 @@ namespace Magento\Core\Model\Store; use Magento\Core\Model\Website; -class Group extends \Magento\Core\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Group extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { const ENTITY = 'store_group'; @@ -122,7 +122,7 @@ class Group extends \Magento\Core\Model\AbstractModel implements \Magento\Object * @param \Magento\Core\Model\Resource\Config\Data $configDataResource * @param \Magento\Core\Model\Store $store * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -132,7 +132,7 @@ class Group extends \Magento\Core\Model\AbstractModel implements \Magento\Object \Magento\Core\Model\Resource\Config\Data $configDataResource, \Magento\Core\Model\Store $store, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -376,7 +376,6 @@ class Group extends \Magento\Core\Model\AbstractModel implements \Magento\Object */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); $this->_configDataResource->clearStoreData($this->getStoreIds()); return parent::_beforeDelete(); } diff --git a/app/code/Magento/Core/Model/Store/ListInterface.php b/app/code/Magento/Core/Model/Store/ListInterface.php index 27692aebffd..aa21e58c39d 100644 --- a/app/code/Magento/Core/Model/Store/ListInterface.php +++ b/app/code/Magento/Core/Model/Store/ListInterface.php @@ -63,7 +63,7 @@ interface ListInterface * * @param null|bool|int|string|\Magento\Core\Model\Website $websiteId * @return \Magento\Core\Model\Website - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getWebsite($websiteId = null); @@ -95,7 +95,7 @@ interface ListInterface * * @param null|\Magento\Core\Model\Store\Group|string $groupId * @return \Magento\Core\Model\Store\Group - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getGroup($groupId = null); diff --git a/app/code/Magento/Core/Model/Store/Storage/Db.php b/app/code/Magento/Core/Model/Store/Storage/Db.php index a9a84685763..fbca3a5bad7 100644 --- a/app/code/Magento/Core/Model/Store/Storage/Db.php +++ b/app/code/Magento/Core/Model/Store/Storage/Db.php @@ -25,7 +25,7 @@ */ namespace Magento\Core\Model\Store\Storage; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\App\State; use Magento\Core\Model\Store; use Magento\Core\Model\Store\StorageInterface; diff --git a/app/code/Magento/Core/Model/Store/Storage/DefaultStorage.php b/app/code/Magento/Core/Model/Store/Storage/DefaultStorage.php index ec7a190e349..0f42a180130 100644 --- a/app/code/Magento/Core/Model/Store/Storage/DefaultStorage.php +++ b/app/code/Magento/Core/Model/Store/Storage/DefaultStorage.php @@ -125,7 +125,7 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface * * @param null|bool|int|string|\Magento\Core\Model\Website $websiteId * @return \Magento\Core\Model\Website - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getWebsite($websiteId = null) { @@ -160,7 +160,7 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface * * @param null|\Magento\Core\Model\Store\Group|string $groupId * @return \Magento\Core\Model\Store\Group - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getGroup($groupId = null) { diff --git a/app/code/Magento/Core/Model/StoreManager.php b/app/code/Magento/Core/Model/StoreManager.php index 1f2c3d85eda..28a898e562f 100644 --- a/app/code/Magento/Core/Model/StoreManager.php +++ b/app/code/Magento/Core/Model/StoreManager.php @@ -25,6 +25,14 @@ namespace Magento\Core\Model; class StoreManager implements \Magento\Core\Model\StoreManagerInterface { + /** + * Application run code + */ + const PARAM_RUN_CODE = 'MAGE_RUN_CODE'; + /** + * Application run type (store|website) + */ + const PARAM_RUN_TYPE = 'MAGE_RUN_TYPE'; /** * Store storage factory model * @@ -120,7 +128,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface * Retrieve application store object without Store_Exception * * @param string|int|Store $storeId - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return Store */ public function getSafeStore($storeId = null) @@ -133,7 +141,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface return new \Magento\Object(); } - throw new \Magento\Core\Exception(__('Requested invalid store "%1"', $storeId)); + throw new \Magento\Model\Exception(__('Requested invalid store "%1"', $storeId)); } } @@ -219,7 +227,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface * * @param null|bool|int|string|Website $websiteId * @return Website - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getWebsite($websiteId = null) { @@ -263,7 +271,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface * * @param null|\Magento\Core\Model\Store\Group|string $groupId * @return \Magento\Core\Model\Store\Group - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getGroup($groupId = null) { diff --git a/app/code/Magento/Core/Model/Template.php b/app/code/Magento/Core/Model/Template.php index fbdf59a8491..d350ffc83bb 100644 --- a/app/code/Magento/Core/Model/Template.php +++ b/app/code/Magento/Core/Model/Template.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -abstract class Template extends \Magento\Core\Model\AbstractModel implements \Magento\App\TemplateTypesInterface +abstract class Template extends \Magento\Model\AbstractModel implements \Magento\App\TemplateTypesInterface { /** * Default design area for emulation diff --git a/app/code/Magento/Core/Model/Theme.php b/app/code/Magento/Core/Model/Theme.php index ebae55b422e..79d175b6b06 100644 --- a/app/code/Magento/Core/Model/Theme.php +++ b/app/code/Magento/Core/Model/Theme.php @@ -26,6 +26,7 @@ namespace Magento\Core\Model; use Magento\View\Design\ThemeInterface; +use Magento\Model\AbstractModel; /** * Theme model class @@ -343,13 +344,13 @@ class Theme extends AbstractModel implements ThemeInterface * Validate theme data * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validate() { if (!$this->_validator->validate($this)) { $messages = $this->_validator->getErrorMessages(); - throw new \Magento\Core\Exception(implode(PHP_EOL, reset($messages))); + throw new \Magento\Model\Exception(implode(PHP_EOL, reset($messages))); } return $this; } diff --git a/app/code/Magento/Backup/Model/Resource/HelperFactory.php b/app/code/Magento/Core/Model/Theme/Data/Collection.php similarity index 76% rename from app/code/Magento/Backup/Model/Resource/HelperFactory.php rename to app/code/Magento/Core/Model/Theme/Data/Collection.php index cdd97781a96..1cc81121ff3 100644 --- a/app/code/Magento/Backup/Model/Resource/HelperFactory.php +++ b/app/code/Magento/Core/Model/Theme/Data/Collection.php @@ -1,7 +1,5 @@ <?php /** - * Resource helper factory - * * Magento * * NOTICE OF LICENSE @@ -23,14 +21,17 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backup\Model\Resource; +namespace Magento\Core\Model\Theme\Data; -class HelperFactory extends \Magento\Core\Model\Resource\HelperFactory +/** + * Theme filesystem data collection + */ +class Collection extends \Magento\Core\Model\Theme\Collection implements \Magento\View\Design\Theme\ListInterface { /** - * Module Name + * Model of collection item * * @var string */ - protected $_moduleName = 'Magento_Backup'; + protected $_itemObjectClass = 'Magento\Core\Model\Theme\Data'; } diff --git a/app/code/Magento/Core/Model/Theme/File.php b/app/code/Magento/Core/Model/Theme/File.php index 53d699879f8..ef08a5c74d6 100644 --- a/app/code/Magento/Core/Model/Theme/File.php +++ b/app/code/Magento/Core/Model/Theme/File.php @@ -25,7 +25,7 @@ */ namespace Magento\Core\Model\Theme; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\View\Design\Theme\FileInterface; use Magento\View\Design\Theme\Customization\FileInterface as CustomizationFileInterface; @@ -73,7 +73,7 @@ class File extends AbstractModel implements FileInterface * @param \Magento\Registry $registry * @param \Magento\View\Design\Theme\FlyweightFactory $themeFactory * @param \Magento\View\Design\Theme\Customization\FileServiceFactory $fileServiceFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -82,7 +82,7 @@ class File extends AbstractModel implements FileInterface \Magento\Registry $registry, \Magento\View\Design\Theme\FlyweightFactory $themeFactory, \Magento\View\Design\Theme\Customization\FileServiceFactory $fileServiceFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Core/Model/Theme/Observer.php b/app/code/Magento/Core/Model/Theme/Observer.php index 85e6677bc27..d0897ddd14c 100644 --- a/app/code/Magento/Core/Model/Theme/Observer.php +++ b/app/code/Magento/Core/Model/Theme/Observer.php @@ -25,7 +25,7 @@ */ namespace Magento\Core\Model\Theme; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Event\Observer as EventObserver; /** diff --git a/app/code/Magento/Core/Model/Theme/Registration.php b/app/code/Magento/Core/Model/Theme/Registration.php index 79eadde87f0..1694638d5cc 100644 --- a/app/code/Magento/Core/Model/Theme/Registration.php +++ b/app/code/Magento/Core/Model/Theme/Registration.php @@ -26,7 +26,7 @@ namespace Magento\Core\Model\Theme; use Magento\App\Filesystem; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\View\Design\ThemeInterface; /** @@ -35,7 +35,7 @@ use Magento\View\Design\ThemeInterface; class Registration { /** - * @var \Magento\Core\Model\Resource\Theme\CollectionFactory + * @var \Magento\Core\Model\Resource\Theme\Data\CollectionFactory */ protected $_collectionFactory; @@ -74,13 +74,13 @@ class Registration /** * Initialize dependencies * - * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $collectionFactory - * @param Collection $filesystemCollection + * @param \Magento\Core\Model\Resource\Theme\Data\CollectionFactory $collectionFactory + * @param \Magento\Core\Model\Theme\Data\Collection $filesystemCollection * @param Filesystem $filesystem */ public function __construct( - \Magento\Core\Model\Resource\Theme\CollectionFactory $collectionFactory, - Collection $filesystemCollection, + \Magento\Core\Model\Resource\Theme\Data\CollectionFactory $collectionFactory, + \Magento\Core\Model\Theme\Data\Collection $filesystemCollection, Filesystem $filesystem ) { $this->_collectionFactory = $collectionFactory; @@ -161,7 +161,7 @@ class Registration if (!$theme->getPreviewImage() || !$themeDirectory) { return $this; } - $imagePath = $this->directoryRead->getAbsolutePath($themeDirectory . '/' . $theme->getPreviewImage()); + $imagePath = $themeDirectory . '/' . $theme->getPreviewImage(); if (0 === strpos($imagePath, $themeDirectory)) { $theme->getThemeImage()->createPreviewImage($imagePath); } diff --git a/app/code/Magento/Core/Model/Url/Rewrite.php b/app/code/Magento/Core/Model/Url/Rewrite.php index 64712657ff1..1dbf71fbce7 100644 --- a/app/code/Magento/Core/Model/Url/Rewrite.php +++ b/app/code/Magento/Core/Model/Url/Rewrite.php @@ -54,7 +54,7 @@ */ namespace Magento\Core\Model\Url; -class Rewrite extends \Magento\Core\Model\AbstractModel +class Rewrite extends \Magento\Model\AbstractModel { const TYPE_CATEGORY = 1; @@ -77,9 +77,9 @@ class Rewrite extends \Magento\Core\Model\AbstractModel protected $_coreStoreConfig; /** - * @var \Magento\Core\Model\App + * @var \Magento\Stdlib\Cookie */ - protected $_app; + protected $_cookie; /** * @var \Magento\Core\Model\StoreManagerInterface @@ -95,10 +95,10 @@ class Rewrite extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\App $app + * @param \Magento\Stdlib\Cookie $cookie * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\Http\Context $httpContext - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -106,15 +106,15 @@ class Rewrite extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\App $app, + \Magento\Stdlib\Cookie $cookie, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\Http\Context $httpContext, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_coreStoreConfig = $coreStoreConfig; - $this->_app = $app; + $this->_cookie = $cookie; $this->_storeManager = $storeManager; $this->_httpContext = $httpContext; parent::__construct($context, $registry, $resource, $resourceCollection, $data); @@ -323,7 +323,7 @@ class Rewrite extends \Magento\Core\Model\AbstractModel $currentStore = $this->_storeManager->getStore(); $this->setStoreId($currentStore->getId())->loadByIdPath($this->getIdPath()); - $this->_app->getCookie()->set(\Magento\Core\Model\Store::COOKIE_NAME, $currentStore->getCode(), true); + $this->_cookie->set(\Magento\Core\Model\Store::COOKIE_NAME, $currentStore->getCode(), true); $targetUrl = $request->getBaseUrl(). '/' . $this->getRequestPath(); $this->_sendRedirectHeaders($targetUrl, true); @@ -339,8 +339,7 @@ class Rewrite extends \Magento\Core\Model\AbstractModel $isPermanentRedirectOption = $this->hasOption('RP'); if ($external === 'http:/' || $external === 'https:') { $destinationStoreCode = $this->_storeManager->getStore($this->getStoreId())->getCode(); - $this->_app->getCookie()->set(\Magento\Core\Model\Store::COOKIE_NAME, $destinationStoreCode, true); - + $this->_cookie->set(\Magento\Core\Model\Store::COOKIE_NAME, $destinationStoreCode, true); $this->_sendRedirectHeaders($this->getTargetPath(), $isPermanentRedirectOption); } else { $targetUrl = $request->getBaseUrl() . '/' . $this->getTargetPath(); diff --git a/app/code/Magento/Core/Model/Validator/Factory.php b/app/code/Magento/Core/Model/Validator/Factory.php index d637298bb1d..37954bba671 100644 --- a/app/code/Magento/Core/Model/Validator/Factory.php +++ b/app/code/Magento/Core/Model/Validator/Factory.php @@ -32,11 +32,6 @@ class Factory */ protected $_objectManager; - /** - * @var \Magento\TranslateInterface - */ - protected $_translator; - /** * Validator config files * @@ -49,16 +44,12 @@ class Factory * * @param \Magento\ObjectManager $objectManager * @param \Magento\Module\Dir\Reader $moduleReader - * @param \Magento\TranslateInterface $translator */ public function __construct( \Magento\ObjectManager $objectManager, - \Magento\Module\Dir\Reader $moduleReader, - \Magento\TranslateInterface $translator + \Magento\Module\Dir\Reader $moduleReader ) { $this->_objectManager = $objectManager; - $this->_translator = $translator; - $this->_configFiles = $moduleReader->getConfigurationFiles('validation.xml'); $this->_initializeDefaultTranslator(); } @@ -70,12 +61,10 @@ class Factory */ protected function _initializeDefaultTranslator() { - $translateAdapter = $this->_translator; - $objectManager = $this->_objectManager; // Pass translations to \Magento\TranslateInterface from validators - $translatorCallback = function () use ($translateAdapter, $objectManager) { - /** @var \Magento\TranslateInterface $translateAdapter */ - return $translateAdapter->translate(func_get_args()); + $translatorCallback = function () { + $argc = func_get_args(); + return (string)new \Magento\Phrase(array_shift($argc), $argc); }; /** @var \Magento\Translate\Adapter $translator */ $translator = $this->_objectManager->create('Magento\Translate\Adapter'); diff --git a/app/code/Magento/Core/Model/Variable.php b/app/code/Magento/Core/Model/Variable.php index 79dd3e745de..643ee7d791c 100644 --- a/app/code/Magento/Core/Model/Variable.php +++ b/app/code/Magento/Core/Model/Variable.php @@ -39,7 +39,7 @@ namespace Magento\Core\Model; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Variable extends \Magento\Core\Model\AbstractModel +class Variable extends \Magento\Model\AbstractModel { const TYPE_TEXT = 'text'; diff --git a/app/code/Magento/Core/Model/Website.php b/app/code/Magento/Core/Model/Website.php index 9c250b09f89..051e7b9947d 100644 --- a/app/code/Magento/Core/Model/Website.php +++ b/app/code/Magento/Core/Model/Website.php @@ -45,7 +45,7 @@ namespace Magento\Core\Model; * @method int getIsDefault() * @method \Magento\Core\Model\Website setIsDefault(int $value) */ -class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Website extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { const ENTITY = 'core_website'; @@ -173,11 +173,6 @@ class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Obje */ protected $_storeManager; - /** - * @var App - */ - protected $_app; - /** * @var \Magento\Directory\Model\CurrencyFactory */ @@ -186,15 +181,14 @@ class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Obje /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\Config\Data $configDataResource + * @param Resource\Config\Data $configDataResource * @param \Magento\App\ConfigInterface $coreConfig - * @param \Magento\Core\Model\StoreFactory $storeFactory - * @param \Magento\Core\Model\Store\GroupFactory $storeGroupFactory - * @param \Magento\Core\Model\WebsiteFactory $websiteFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\App $app + * @param StoreFactory $storeFactory + * @param Store\GroupFactory $storeGroupFactory + * @param WebsiteFactory $websiteFactory + * @param StoreManagerInterface $storeManager * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -207,9 +201,8 @@ class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Obje \Magento\Core\Model\Store\GroupFactory $storeGroupFactory, \Magento\Core\Model\WebsiteFactory $websiteFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\App $app, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -220,7 +213,6 @@ class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Obje $this->_storeGroupFactory = $storeGroupFactory; $this->_websiteFactory = $websiteFactory; $this->_storeManager = $storeManager; - $this->_app = $app; $this->_currencyFactory = $currencyFactory; } @@ -525,7 +517,6 @@ class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Obje */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); $this->_configDataResource->clearWebsiteData($this); return parent::_beforeDelete(); } @@ -553,10 +544,14 @@ class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Obje \Magento\Core\Model\Store::XML_PATH_PRICE_SCOPE ) == \Magento\Core\Model\Store::PRICE_SCOPE_GLOBAL ) { - return $this->_app->getBaseCurrencyCode(); + $currencyCode = $this->_coreConfig + ->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default'); + } else { - return $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); + $currencyCode = $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); } + + return $currencyCode; } /** diff --git a/app/code/Magento/Core/etc/cache.xml b/app/code/Magento/Core/etc/cache.xml index 12ace8c612c..33231b882fb 100644 --- a/app/code/Magento/Core/etc/cache.xml +++ b/app/code/Magento/Core/etc/cache.xml @@ -36,10 +36,6 @@ <label>Blocks HTML output</label> <description>Page blocks HTML.</description> </type> - <type name="translate" translate="label,description" instance="Magento\App\Cache\Type\Translate"> - <label>Translations</label> - <description>Translation files.</description> - </type> <type name="collections" translate="label,description" instance="Magento\App\Cache\Type\Collection"> <label>Collections Data</label> <description>Collection data files.</description> diff --git a/app/code/Magento/Core/etc/config.xml b/app/code/Magento/Core/etc/config.xml index d824ed91c68..11793f11b49 100644 --- a/app/code/Magento/Core/etc/config.xml +++ b/app/code/Magento/Core/etc/config.xml @@ -40,13 +40,6 @@ <debug> <profiler>0</profiler> </debug> - <translate_inline> - <active>0</active> - <active_admin>0</active_admin> - <invalid_caches> - <block_html /> - </invalid_caches> - </translate_inline> <log> <active>0</active> <file>system.log</file> diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index 8364d687284..5bc0bd73fdc 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -25,6 +25,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> <preference for="Magento\Acl\CacheInterface" type="Magento\Acl\Cache" /> + <preference for="Magento\App\AreaInterface" type="Magento\Core\Model\App\Area" /> <preference for="Magento\Module\Updater\SetupInterface" type="Magento\Core\Model\Resource\Setup" /> <preference for="Magento\Module\ResourceResolverInterface" type="Magento\Module\ResourceResolver" /> <preference for="Magento\AuthorizationInterface" type="Magento\Authorization" /> @@ -36,12 +37,8 @@ <preference for="Magento\App\ReinitableConfigInterface" type="Magento\App\ReinitableConfig" /> <preference for="Magento\App\Config\Scope\ReaderPoolInterface" type="Magento\Core\Model\Config\Scope\ReaderPool" /> <preference for="Magento\App\Config\Storage\WriterInterface" type="Magento\Core\Model\Config\Storage\Db" /> - <preference for="Magento\PubSub\Event\QueueWriterInterface" type="Magento\PubSub\Event\QueueWriter" /> - <preference for="Magento\PubSub\Event\FactoryInterface" type="Magento\PubSub\Event\Factory" /> <preference for="Magento\View\Design\Theme\FileInterface" type="Magento\Core\Model\Theme\File" /> - <preference for="Magento\PubSub\Message\DispatcherAsyncInterface" type="Magento\PubSub\Message\DispatcherAsync" /> <preference for="Magento\Config\ConverterInterface" type="Magento\Config\Converter\Dom"/> - <preference for="Magento\Phrase\RendererInterface" type="Magento\Phrase\Renderer\Composite" /> <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" /> @@ -53,12 +50,8 @@ <preference for="Magento\View\Asset\ConfigInterface" type="Magento\Core\Model\Asset\Config" /> <preference for="Magento\View\Asset\MergeStrategyInterface" type="Magento\View\Asset\MergeStrategy\Direct" /> <preference for="Magento\App\ViewInterface" type="Magento\App\View" /> - <preference for="Magento\TranslateInterface" type="Magento\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\Translate\InlineInterface" type="Magento\Translate\Inline" /> - <preference for="Magento\Translate\Inline\ConfigInterface" type="Magento\Core\Model\Translate\Inline\Config" /> - <preference for="Magento\Translate\Inline\ParserInterface" type="Magento\Core\Model\Translate\Inline\Parser" /> <preference for="Magento\Session\ValidatorInterface" type="Magento\Core\Model\Session\Validator" /> <preference for="Magento\Session\StorageInterface" type="Magento\Session\Storage" /> <preference for="Magento\Url\RouteParamsResolverInterface" type="Magento\Core\Model\Url\RouteParamsResolver" /> @@ -68,13 +61,10 @@ <preference for="Magento\Mview\ConfigInterface" type="Magento\Mview\Config" /> <preference for="Magento\Mview\ViewInterface" type="Magento\Mview\View" /> <preference for="Magento\Mview\ProcessorInterface" type="Magento\Mview\Processor" /> - <preference for="Magento\Mview\View\StateInterface" type="Magento\Core\Model\Mview\View\State" /> - <preference for="Magento\Mview\View\State\CollectionInterface" type="Magento\Core\Model\Resource\Mview\View\State\Collection" /> <preference for="Magento\Mview\View\CollectionInterface" type="Magento\Mview\View\Collection" /> <preference for="Magento\Mview\View\SubscriptionInterface" type="Magento\Mview\View\Subscription" /> <preference for="Magento\Mview\View\ChangelogInterface" type="Magento\Mview\View\Changelog" /> <preference for="Magento\Css\PreProcessor\AdapterInterface" type="Magento\Css\PreProcessor\Adapter\Oyejorge" /> - <preference for="Magento\Translate\ResourceInterface" type="Magento\Core\Model\Resource\Translate" /> <preference for="Magento\BaseScopeResolverInterface" type="Magento\Core\Model\BaseScopeResolver" /> <preference for="Magento\LocaleInterface" type="Magento\Locale" /> <preference for="Magento\Locale\CurrencyInterface" type="Magento\Locale\Currency" /> @@ -85,13 +75,6 @@ <preference for="Magento\Stdlib\DateTime\DateInterface" type="Magento\Stdlib\DateTime\Date" /> <preference for="Magento\Locale\ScopeConfigInterface" type="Magento\Core\Model\Store\Config" /> <preference for="Magento\Less\PreProcessor\ErrorHandlerInterface" type="Magento\Less\PreProcessor\ErrorHandler" /> - <type name="Magento\Translate\Inline"> - <arguments> - <argument name="templateFileName" xsi:type="string">Magento_Core::translate_inline.phtml</argument> - <argument name="translatorRoute" xsi:type="string">core/ajax/translate</argument> - <argument name="layout" xsi:type="object">Magento\View\LayoutInterface\Proxy</argument> - </arguments> - </type> <type name="Magento\App\DefaultPath\DefaultPath"> <arguments> <argument name="parts" xsi:type="array"> @@ -242,23 +225,6 @@ <argument name="uploader" xsi:type="object">Magento\View\Design\Theme\Image\Uploader\Proxy</argument> </arguments> </type> - <type name="Magento\Phrase\Renderer\Composite"> - <arguments> - <argument name="renderers" xsi:type="array"> - <item name="translation" xsi:type="object">Magento\Phrase\Renderer\Translate</item> - </argument> - </arguments> - </type> - <type name="Magento\Phrase\Renderer\Translate"> - <arguments> - <argument name="translator" xsi:type="object">Magento\Translate</argument> - </arguments> - </type> - <type name="Magento\Core\Model\Translate\Inline\Parser"> - <arguments> - <argument name="inputFilter" xsi:type="object">Magento\Filter\Input\MaliciousCode</argument> - </arguments> - </type> <type name="Magento\App\Config\ScopePool"> <arguments> <argument name="cache" xsi:type="object">Magento\App\Cache\Type\Config</argument> @@ -379,7 +345,7 @@ <argument name="reader" xsi:type="object">Magento\Locale\Hierarchy\Config\Reader</argument> </arguments> </type> - <type name="Magento\Core\Model\Resource\Helper"> + <type name="Magento\DB\Helper"> <arguments> <argument name="modulePrefix" xsi:type="string">core</argument> </arguments> @@ -564,6 +530,15 @@ <argument name="defaultLocalePath" xsi:type="string">general/locale/code</argument> </arguments> </type> + <type name="Magento\Model\ActionValidator\RemoveAction"> + <arguments> + <argument name="protectedModels" xsi:type="array"> + <item name="store" xsi:type="string">Magento\Core\Model\Store</item> + <item name="website" xsi:type="string">Magento\Core\Model\Website</item> + <item name="storeGroup" xsi:type="string">Magento\Core\Model\Store\Group</item> + </argument> + </arguments> + </type> <type name="Magento\App\PageCache\Identifier"> <plugin name="core-app-area-design-exception-plugin" type="Magento\Core\Model\App\Area\CacheIdentifierPlugin" sortOrder="10"/> diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.15-1.6.0.16.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.15-1.6.0.16.php deleted file mode 100644 index 0de15057781..00000000000 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.15-1.6.0.16.php +++ /dev/null @@ -1,84 +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_Core - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/* @var $installer \Magento\Core\Model\Resource\Setup */ -$installer = $this; - -$installer->startSetup(); - -/** - * Create table 'mview_state' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('mview_state') -)->addColumn( - 'state_id', - \Magento\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'View State Id' -)->addColumn( - 'view_id', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 255, - array(), - 'View Id' -)->addColumn( - 'mode', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 16, - array('default' => \Magento\Mview\View\StateInterface::MODE_DISABLED), - 'View Mode' -)->addColumn( - 'status', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 16, - array('default' => \Magento\Mview\View\StateInterface::STATUS_IDLE), - 'View Status' -)->addColumn( - 'updated', - \Magento\DB\Ddl\Table::TYPE_DATETIME, - null, - array(), - 'View updated time' -)->addColumn( - 'version_id', - \Magento\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true), - 'View Version Id' -)->addIndex( - $installer->getIdxName('mview_state', array('view_id')), - array('view_id') -)->addIndex( - $installer->getIdxName('mview_state', array('mode')), - array('mode') -)->setComment( - 'View State' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Core/view/frontend/js/require-cookie.js b/app/code/Magento/Core/view/frontend/js/require-cookie.js index bc1fa19f288..3b50cae5410 100644 --- a/app/code/Magento/Core/view/frontend/js/require-cookie.js +++ b/app/code/Magento/Core/view/frontend/js/require-cookie.js @@ -56,13 +56,11 @@ * @private */ _checkCookie: function(event) { - $.cookie("test", 1); - if ($.cookie("test")) { - $.cookie("test", null); - } else { - event.preventDefault(); - window.location = this.options.noCookieUrl; + if (navigator.cookieEnabled) { + return; } + event.preventDefault(); + window.location = this.options.noCookieUrl; } }); })(jQuery); diff --git a/app/code/Magento/Cron/App/Cron/Plugin/ApplicationInitializer.php b/app/code/Magento/Cron/App/Cron/Plugin/ApplicationInitializer.php index 8b3e19d942a..5e4b8665cd1 100644 --- a/app/code/Magento/Cron/App/Cron/Plugin/ApplicationInitializer.php +++ b/app/code/Magento/Cron/App/Cron/Plugin/ApplicationInitializer.php @@ -25,14 +25,14 @@ */ namespace Magento\Cron\App\Cron\Plugin; -use Magento\AppInterface; +use \Magento\App\State; class ApplicationInitializer { /** - * @var \Magento\AppInterface + * @var State */ - protected $_application; + protected $_appState; /** * @var \Magento\Session\SidResolverInterface @@ -40,12 +40,12 @@ class ApplicationInitializer protected $_sidResolver; /** - * @param AppInterface $application + * @param State $appState * @param \Magento\Session\SidResolverInterface $sidResolver */ - public function __construct(AppInterface $application, \Magento\Session\SidResolverInterface $sidResolver) + public function __construct(State $appState, \Magento\Session\SidResolverInterface $sidResolver) { - $this->_application = $application; + $this->_appState = $appState; $this->_sidResolver = $sidResolver; } @@ -56,10 +56,13 @@ class ApplicationInitializer * * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @throws \Magento\Exception */ public function beforeLaunch(\Magento\App\Cron $subject) { $this->_sidResolver->setUseSessionInUrl(false); - $this->_application->requireInstalledInstance(); + if (false == $this->_appState->isInstalled()) { + throw new \Magento\Exception('Application is not installed yet, please complete the installation first.'); + } } } diff --git a/app/code/Magento/Cron/Exception.php b/app/code/Magento/Cron/Exception.php index c2a848f5037..3bc47b481b1 100644 --- a/app/code/Magento/Cron/Exception.php +++ b/app/code/Magento/Cron/Exception.php @@ -33,6 +33,6 @@ */ namespace Magento\Cron; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php b/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php index 204ec1d7fd6..316e7ffc891 100644 --- a/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php +++ b/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php @@ -61,7 +61,7 @@ class Alert extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string $runModelPath * @param array $data @@ -72,7 +72,7 @@ class Alert extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $runModelPath = '', array $data = array() diff --git a/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php b/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php index d8ed8bc0c55..ffed40eed62 100644 --- a/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php +++ b/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php @@ -61,7 +61,7 @@ class Sitemap extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string $runModelPath * @param array $data @@ -72,7 +72,7 @@ class Sitemap extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $runModelPath = '', array $data = array() diff --git a/app/code/Magento/Cron/Model/Observer.php b/app/code/Magento/Cron/Model/Observer.php index 53e75916dc0..e19a27fcafb 100644 --- a/app/code/Magento/Cron/Model/Observer.php +++ b/app/code/Magento/Cron/Model/Observer.php @@ -78,9 +78,9 @@ class Observer protected $_objectManager; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\CacheInterface */ - protected $_app; + protected $_cache; /** * @var \Magento\Core\Model\Store\Config @@ -105,7 +105,7 @@ class Observer /** * @param \Magento\ObjectManager $objectManager * @param ScheduleFactory $scheduleFactory - * @param \Magento\AppInterface $app + * @param \Magento\App\CacheInterface $cache * @param ConfigInterface $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\App\Console\Request $request @@ -114,7 +114,7 @@ class Observer public function __construct( \Magento\ObjectManager $objectManager, \Magento\Cron\Model\ScheduleFactory $scheduleFactory, - \Magento\AppInterface $app, + \Magento\App\CacheInterface $cache, \Magento\Cron\Model\ConfigInterface $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\App\Console\Request $request, @@ -122,7 +122,7 @@ class Observer ) { $this->_objectManager = $objectManager; $this->_scheduleFactory = $scheduleFactory; - $this->_app = $app; + $this->_cache = $cache; $this->_config = $config; $this->_coreStoreConfig = $coreStoreConfig; $this->_request = $request; @@ -264,7 +264,7 @@ class Observer /** * check if schedule generation is needed */ - $lastRun = (int)$this->_app->loadCache(self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT); + $lastRun = (int)$this->_cache->load(self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT); $rawSchedulePeriod = (int)$this->_coreStoreConfig->getConfig( 'system/cron/' . $groupId . '/' . self::XML_PATH_SCHEDULE_GENERATE_EVERY ); @@ -289,7 +289,7 @@ class Observer /** * save time schedules generation was ran with no expiration */ - $this->_app->saveCache(time(), self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT, array('crontab'), null); + $this->_cache->save(time(), self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT, array('crontab'), null); return $this; } @@ -354,7 +354,7 @@ class Observer protected function _cleanup($groupId) { // check if history cleanup is needed - $lastCleanup = (int)$this->_app->loadCache(self::CACHE_KEY_LAST_HISTORY_CLEANUP_AT); + $lastCleanup = (int)$this->_cache->load(self::CACHE_KEY_LAST_HISTORY_CLEANUP_AT); $historyCleanUp = (int)$this->_coreStoreConfig->getConfig( 'system/cron/' . $groupId . '/' . self::XML_PATH_HISTORY_CLEANUP_EVERY ); @@ -391,7 +391,7 @@ class Observer } // save time history cleanup was ran with no expiration - $this->_app->saveCache(time(), self::CACHE_KEY_LAST_HISTORY_CLEANUP_AT, array('crontab'), null); + $this->_cache->save(time(), self::CACHE_KEY_LAST_HISTORY_CLEANUP_AT, array('crontab'), null); return $this; } diff --git a/app/code/Magento/Cron/Model/Resource/Schedule.php b/app/code/Magento/Cron/Model/Resource/Schedule.php index 62a4b0bab39..671919a16dd 100644 --- a/app/code/Magento/Cron/Model/Resource/Schedule.php +++ b/app/code/Magento/Cron/Model/Resource/Schedule.php @@ -32,7 +32,7 @@ namespace Magento\Cron\Model\Resource; * @package Magento_Cron * @author Magento Core Team <core@magentocommerce.com> */ -class Schedule extends \Magento\Core\Model\Resource\Db\AbstractDb +class Schedule extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize resource diff --git a/app/code/Magento/Cron/Model/Resource/Schedule/Collection.php b/app/code/Magento/Cron/Model/Resource/Schedule/Collection.php index 5096e7540e5..361212c921d 100644 --- a/app/code/Magento/Cron/Model/Resource/Schedule/Collection.php +++ b/app/code/Magento/Cron/Model/Resource/Schedule/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Cron\Model\Resource\Schedule; * @package Magento_Cron * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource collection diff --git a/app/code/Magento/Cron/Model/Schedule.php b/app/code/Magento/Cron/Model/Schedule.php index 3276cb83686..bc1e280b771 100644 --- a/app/code/Magento/Cron/Model/Schedule.php +++ b/app/code/Magento/Cron/Model/Schedule.php @@ -52,7 +52,7 @@ namespace Magento\Cron\Model; use Magento\Cron\Exception; -class Schedule extends \Magento\Core\Model\AbstractModel +class Schedule extends \Magento\Model\AbstractModel { const STATUS_PENDING = 'pending'; @@ -73,7 +73,7 @@ class Schedule extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\DateTime $date - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -81,7 +81,7 @@ class Schedule extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Stdlib\DateTime\DateTime $date, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php index aa3d13cd6a4..ad6dc4c273d 100644 --- a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php +++ b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php @@ -87,7 +87,7 @@ class Currency extends \Magento\Backend\App\Action * Fetch rates action * * @return void - * @throws \Exception|\Magento\Core\Exception + * @throws \Exception|\Magento\Model\Exception */ public function fetchRatesAction() { @@ -107,7 +107,7 @@ class Currency extends \Magento\Backend\App\Action $service ); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('We can\'t initialize the import model.')); + throw new \Magento\Model\Exception(__('We can\'t initialize the import model.')); } $rates = $importModel->fetchRates(); $errors = $importModel->getMessages(); diff --git a/app/code/Magento/Customer/Block/Account/Dashboard/Sidebar.php b/app/code/Magento/Customer/Block/Account/Dashboard/Sidebar.php index f04ae5c22d9..31ab0413531 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard/Sidebar.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard/Sidebar.php @@ -136,7 +136,7 @@ class Sidebar extends \Magento\View\Element\Template public function getWishlist() { if (!$this->_wishlist) { - $this->_wishlist = $this->_createWishList()->loadByCustomer($this->_customerSession->getCustomer()); + $this->_wishlist = $this->_createWishList()->loadByCustomerId($this->_customerSession->getId()); $this->_wishlist->getItemCollection()->addAttributeToSelect( 'name' )->addAttributeToSelect( 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 7abfe300ead..f1a4c93bdfe 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php @@ -41,13 +41,13 @@ class Country extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\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\DB\Helper $resourceHelper, \Magento\Directory\Model\Resource\Country\CollectionFactory $collectionFactory, array $data = array() ) { 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 b3a0dad9f75..843982e380c 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 @@ -25,7 +25,7 @@ */ namespace Magento\Customer\Controller\Adminhtml\Cart\Product\Composite; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Catalog composite product configuration controller @@ -61,13 +61,13 @@ class Cart extends \Magento\Backend\App\Action * Loads customer, quote and quote item by request params * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initData() { $this->_customerId = (int)$this->getRequest()->getParam('customer_id'); if (!$this->_customerId) { - throw new \Magento\Core\Exception(__('No customer ID defined.')); + throw new \Magento\Model\Exception(__('No customer ID defined.')); } $quoteItemId = (int)$this->getRequest()->getParam('id'); @@ -113,7 +113,7 @@ class Cart extends \Magento\Backend\App\Action $configureResult->setProductId($quoteItem->getProductId()); $configureResult->setBuyRequest($quoteItem->getBuyRequest()); $configureResult->setCurrentStoreId($quoteItem->getStoreId()); - $configureResult->setCustomerId($this->_customerId); + $configureResult->setCurrentCustomerId($this->_customerId); } catch (\Exception $e) { $configureResult->setError(true); $configureResult->setMessage($e->getMessage()); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index.php b/app/code/Magento/Customer/Controller/Adminhtml/Index.php index dd3988132d1..9e1337b3c2c 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index.php @@ -447,7 +447,7 @@ class Index extends \Magento\Backend\App\Action $this->_addSessionErrorMessages($exception->getMessages()); $this->_getSession()->setCustomerData($originalRequestData); $returnToEdit = true; - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { $messages = $exception->getMessages(\Magento\Message\MessageInterface::TYPE_ERROR); if (!count($messages)) { $messages = $exception->getMessage(); @@ -499,7 +499,7 @@ class Index extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('Customer will receive an email with a link to reset password.')); } catch (NoSuchEntityException $exception) { return $this->_redirect('customer/index'); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { $messages = $exception->getMessages(\Magento\Message\MessageInterface::TYPE_ERROR); if (!count($messages)) { $messages = $exception->getMessage(); @@ -866,7 +866,7 @@ class Index extends \Magento\Backend\App\Action $customer = $this->_customerBuilder->populateWithArray($data)->create(); $errors = $this->_customerAccountService->validateCustomerData($customer); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { /* @var $error Error */ foreach ($exception->getMessages(\Magento\Message\MessageInterface::TYPE_ERROR) as $error) { $errors[] = $error->getText(); 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 2fbc9f05d51..b9cfe4b2084 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 @@ -26,7 +26,7 @@ namespace Magento\Customer\Controller\Adminhtml\Wishlist\Product\Composite; use Exception; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; /** * Catalog composite product configuration controller diff --git a/app/code/Magento/Customer/Exception.php b/app/code/Magento/Customer/Exception.php index 8b84e3a5f56..ed41bcbe793 100644 --- a/app/code/Magento/Customer/Exception.php +++ b/app/code/Magento/Customer/Exception.php @@ -25,6 +25,6 @@ */ namespace Magento\Customer; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Customer/Helper/Data.php b/app/code/Magento/Customer/Helper/Data.php index 69d2be5b478..a02b517057a 100644 --- a/app/code/Magento/Customer/Helper/Data.php +++ b/app/code/Magento/Customer/Helper/Data.php @@ -625,7 +625,7 @@ class Data extends \Magento\App\Helper\AbstractHelper ); if (!extension_loaded('soap')) { - $this->_logger->logException(new \Magento\Core\Exception(__('PHP SOAP extension is required.'))); + $this->_logger->logException(new \Magento\Model\Exception(__('PHP SOAP extension is required.'))); return $gatewayResponse; } diff --git a/app/code/Magento/Customer/Model/Address.php b/app/code/Magento/Customer/Model/Address.php index d7da6853e8b..35393abbabf 100644 --- a/app/code/Magento/Customer/Model/Address.php +++ b/app/code/Magento/Customer/Model/Address.php @@ -54,7 +54,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param CustomerFactory $customerFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -67,7 +67,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Directory\Model\CountryFactory $countryFactory, CustomerFactory $customerFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php index 7494dd43864..89b932e87bf 100644 --- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php +++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php @@ -39,7 +39,7 @@ namespace Magento\Customer\Model\Address; * @method string getPostcode() * @method bool getShouldIgnoreValidation() */ -class AbstractAddress extends \Magento\Core\Model\AbstractModel +class AbstractAddress extends \Magento\Model\AbstractModel { /** * Possible customer address types @@ -111,7 +111,7 @@ class AbstractAddress extends \Magento\Core\Model\AbstractModel * @param Config $addressConfig * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -123,7 +123,7 @@ class AbstractAddress extends \Magento\Core\Model\AbstractModel Config $addressConfig, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Directory\Model\CountryFactory $countryFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php b/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php index 61a2a5e8a9c..45ceee4f1c1 100644 --- a/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php +++ b/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php @@ -43,7 +43,7 @@ class Street extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -53,7 +53,7 @@ class Street extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -91,7 +91,7 @@ class Street extends \Magento\Core\Model\Config\Value /** * Processing object after delete data * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterDelete() { diff --git a/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php b/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php index 04e72ebb6f6..7c10a970c40 100644 --- a/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php +++ b/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php @@ -47,7 +47,7 @@ class Customer extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -57,7 +57,7 @@ class Customer extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -132,7 +132,7 @@ class Customer extends \Magento\Core\Model\Config\Value /** * Processing object after delete data * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterDelete() { diff --git a/app/code/Magento/Customer/Model/Config/Share.php b/app/code/Magento/Customer/Model/Config/Share.php index 97027cef124..8b87015f59d 100644 --- a/app/code/Magento/Customer/Model/Config/Share.php +++ b/app/code/Magento/Customer/Model/Config/Share.php @@ -69,7 +69,7 @@ class Share extends \Magento\Core\Model\Config\Value implements \Magento\Option\ * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Customer\Model\Resource\Customer $customerResource - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -80,7 +80,7 @@ class Share extends \Magento\Core\Model\Config\Value implements \Magento\Option\ \Magento\App\ConfigInterface $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Customer\Model\Resource\Customer $customerResource, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -123,7 +123,7 @@ class Share extends \Magento\Core\Model\Config\Value implements \Magento\Option\ * Check for email duplicates before saving customers sharing options * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function _beforeSave() { @@ -131,7 +131,7 @@ class Share extends \Magento\Core\Model\Config\Value implements \Magento\Option\ if ($value == self::SHARE_GLOBAL) { if ($this->_customerResource->findEmailDuplicates()) { //@codingStandardsIgnoreStart - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Cannot share customer accounts globally because some customer accounts with the same emails exist on multiple websites and cannot be merged.' ) diff --git a/app/code/Magento/Customer/Model/Converter.php b/app/code/Magento/Customer/Model/Converter.php index f767f012c43..cf1650eddec 100644 --- a/app/code/Magento/Customer/Model/Converter.php +++ b/app/code/Magento/Customer/Model/Converter.php @@ -90,6 +90,17 @@ class Converter } } + /** + * Retrieve customer model by his ID if possible, or return an empty model otherwise. + * + * @param int $customerId + * @return Customer + */ + public function loadCustomerModel($customerId) + { + return $this->_customerFactory->create()->load($customerId); + } + /** * Retrieve customer model by his email. * diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index 67280ec72f7..390288b6ab8 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -44,7 +44,7 @@ use Magento\Customer\Service\V1\Data\CustomerBuilder; * @method \Magento\Customer\Model\Customer setDefaultBilling($value) * @method \Magento\Customer\Model\Customer setDefaultShipping($value) */ -class Customer extends \Magento\Core\Model\AbstractModel +class Customer extends \Magento\Model\AbstractModel { /** * Configuration paths for email templates and identities @@ -292,19 +292,19 @@ class Customer extends \Magento\Core\Model\AbstractModel * @param string $login * @param string $password * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function authenticate($login, $password) { $this->loadByEmail($login); if ($this->getConfirmation() && $this->isConfirmationRequired()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('This account is not confirmed.'), self::EXCEPTION_EMAIL_NOT_CONFIRMED ); } if (!$this->validatePassword($password)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Invalid login or password.'), self::EXCEPTION_INVALID_EMAIL_OR_PASSWORD ); @@ -710,7 +710,7 @@ class Customer extends \Magento\Core\Model\AbstractModel * @param string $backUrl * @param string $storeId * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0') { @@ -725,7 +725,7 @@ class Customer extends \Magento\Core\Model\AbstractModel 'confirmation' => self::XML_PATH_CONFIRM_EMAIL_TEMPLATE ); if (!isset($types[$type])) { - throw new \Magento\Core\Exception(__('Wrong transactional account email type')); + throw new \Magento\Model\Exception(__('Wrong transactional account email type')); } if (!$storeId) { @@ -1072,7 +1072,6 @@ class Customer extends \Magento\Core\Model\AbstractModel protected function _beforeDelete() { //TODO : Revisit and figure handling permissions in MAGETWO-11084 Implementation: Service Context Provider - //$this->_protectFromNonAdmin(); return parent::_beforeDelete(); } @@ -1162,7 +1161,7 @@ class Customer extends \Magento\Core\Model\AbstractModel /* If an email was used to start the registration process and it is the same email as the one used to register, then this can skip confirmation. */ - $skipConfirmationIfEmail = $this->_coreRegistry->registry("skip_confirmation_if_email"); + $skipConfirmationIfEmail = $this->_registry->registry("skip_confirmation_if_email"); if (!$skipConfirmationIfEmail) { return false; } @@ -1235,12 +1234,12 @@ class Customer extends \Magento\Core\Model\AbstractModel * * @param string $passwordLinkToken * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function changeResetPasswordLinkToken($passwordLinkToken) { if (!is_string($passwordLinkToken) || empty($passwordLinkToken)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Invalid password reset token.'), self::EXCEPTION_INVALID_RESET_PASSWORD_LINK_TOKEN ); diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php index 0fd7f93accf..dd3ed177a30 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php @@ -25,7 +25,7 @@ */ namespace Magento\Customer\Model\Customer\Attribute\Backend; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Customer password attribute backend diff --git a/app/code/Magento/Customer/Model/Group.php b/app/code/Magento/Customer/Model/Group.php index 07ef668833e..dff1b59c1ef 100644 --- a/app/code/Magento/Customer/Model/Group.php +++ b/app/code/Magento/Customer/Model/Group.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Customer * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -33,12 +31,8 @@ namespace Magento\Customer\Model; * @method string getCustomerGroupCode() * @method \Magento\Customer\Model\Group setCustomerGroupCode(string $value) * @method \Magento\Customer\Model\Group setTaxClassId(int $value) - * - * @category Magento - * @package Magento_Customer - * @author Magento Core Team <core@magentocommerce.com> */ -class Group extends \Magento\Core\Model\AbstractModel +class Group extends \Magento\Model\AbstractModel { /** * Xml config path for create account default group @@ -91,7 +85,7 @@ class Group extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\Index\Model\Indexer $indexer - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -100,7 +94,7 @@ class Group extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Core\Model\Store\Config $storeConfig, \Magento\Index\Model\Indexer $indexer, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -139,7 +133,9 @@ class Group extends \Magento\Core\Model\AbstractModel } /** - * @param int|null $groupId + * Get the tax class id for the specified group or this group if the groupId is null + * + * @param int|null $groupId The id of the group whose tax class id is being sought * @return int */ public function getTaxClassId($groupId = null) @@ -155,6 +151,8 @@ class Group extends \Magento\Core\Model\AbstractModel } /** + * Determine if this group is used as the create account default group + * * @return bool */ public function usesAsDefault() diff --git a/app/code/Magento/Customer/Model/Metadata/Form/AbstractData.php b/app/code/Magento/Customer/Model/Metadata/Form/AbstractData.php index 85f3d3fc2bf..34b773df49e 100644 --- a/app/code/Magento/Customer/Model/Metadata/Form/AbstractData.php +++ b/app/code/Magento/Customer/Model/Metadata/Form/AbstractData.php @@ -124,12 +124,12 @@ abstract class AbstractData * Return Attribute instance * * @return \Magento\Customer\Service\V1\Data\Eav\AttributeMetadata - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getAttribute() { if (!$this->_attribute) { - throw new \Magento\Core\Exception(__('Attribute object is undefined')); + throw new \Magento\Model\Exception(__('Attribute object is undefined')); } return $this->_attribute; } @@ -506,7 +506,7 @@ abstract class AbstractData * * @param array|string|null $value * @return array|bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ abstract public function validateValue($value); diff --git a/app/code/Magento/Customer/Model/Observer.php b/app/code/Magento/Customer/Model/Observer.php index 98d07664f5e..ee00bb5fc3b 100644 --- a/app/code/Magento/Customer/Model/Observer.php +++ b/app/code/Magento/Customer/Model/Observer.php @@ -218,27 +218,4 @@ class Observer $this->_coreRegistry->register(self::VIV_PROCESSED_FLAG, false, true); } } - - /** - * Revert emulated customer group_id - * - * @param \Magento\Event\Observer $observer - * @return void - */ - public function quoteSubmitAfter($observer) - { - /** @var $customer Customer */ - $customer = $observer->getQuote()->getCustomer(); - - if (!$this->_customerAddress->isVatValidationEnabled($customer->getStore())) { - return; - } - - if (!$customer->getId()) { - return; - } - - $customer->setGroupId((int)$customer->getOrigData('group_id')); - $customer->save(); - } } diff --git a/app/code/Magento/Customer/Model/Resource/Customer.php b/app/code/Magento/Customer/Model/Resource/Customer.php index 0c7068515f2..d904f9b976b 100644 --- a/app/code/Magento/Customer/Model/Resource/Customer.php +++ b/app/code/Magento/Customer/Model/Resource/Customer.php @@ -109,7 +109,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity * @param \Magento\Object $customer * @return $this * @throws \Magento\Customer\Exception - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave(\Magento\Object $customer) { @@ -266,7 +266,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity * @param \Magento\Customer\Model\Customer $customer * @param string $email * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function loadByEmail(\Magento\Customer\Model\Customer $customer, $email) { @@ -281,7 +281,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity if ($customer->getSharingConfig()->isWebsiteScope()) { if (!$customer->hasData('website_id')) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Customer website ID must be specified when using the website scope') ); } diff --git a/app/code/Magento/Customer/Model/Resource/Group.php b/app/code/Magento/Customer/Model/Resource/Group.php index 7d21b16af77..61e6fe27b0c 100644 --- a/app/code/Magento/Customer/Model/Resource/Group.php +++ b/app/code/Magento/Customer/Model/Resource/Group.php @@ -32,7 +32,7 @@ namespace Magento\Customer\Model\Resource; * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -class Group extends \Magento\Core\Model\Resource\Db\AbstractDb +class Group extends \Magento\Model\Resource\Db\AbstractDb { /** * Customer data @@ -86,14 +86,14 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check if group uses as default * - * @param \Magento\Core\Model\AbstractModel $group + * @param \Magento\Model\AbstractModel $group * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeDelete(\Magento\Core\Model\AbstractModel $group) + protected function _beforeDelete(\Magento\Model\AbstractModel $group) { if ($group->usesAsDefault()) { - throw new \Magento\Core\Exception(__('The group "%1" cannot be deleted', $group->getCode())); + throw new \Magento\Model\Exception(__('The group "%1" cannot be deleted', $group->getCode())); } return parent::_beforeDelete($group); } @@ -101,10 +101,10 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Method set default group id to the customers collection * - * @param \Magento\Core\Model\AbstractModel $group + * @param \Magento\Model\AbstractModel $group * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $group) + protected function _afterDelete(\Magento\Model\AbstractModel $group) { $customerCollection = $this->_createCustomersCollection()->addAttributeToFilter( 'group_id', diff --git a/app/code/Magento/Customer/Model/Resource/Group/Collection.php b/app/code/Magento/Customer/Model/Resource/Group/Collection.php index 57dbc29bd6c..811859079be 100644 --- a/app/code/Magento/Customer/Model/Resource/Group/Collection.php +++ b/app/code/Magento/Customer/Model/Resource/Group/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Customer\Model\Resource\Group; * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php index 3046433d139..ff23fc03068 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php @@ -34,8 +34,10 @@ use Magento\Exception\InputException; use Magento\Exception\AuthenticationException; use Magento\Exception\NoSuchEntityException; use Magento\Exception\StateException; +use Magento\Mail\Exception as MailException; use Magento\Math\Random; use Magento\UrlInterface; +use Magento\Logger; /** * Handle various customer account actions @@ -100,6 +102,11 @@ class CustomerAccountService implements CustomerAccountServiceInterface */ private $_url; + /** + * @var Logger + */ + protected $_logger; + /** * Constructor * @@ -115,6 +122,7 @@ class CustomerAccountService implements CustomerAccountServiceInterface * @param CustomerAddressServiceInterface $customerAddressService * @param CustomerMetadataServiceInterface $customerMetadataService * @param UrlInterface $url + * @param Logger $logger * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -130,7 +138,8 @@ class CustomerAccountService implements CustomerAccountServiceInterface Data\SearchResultsBuilder $searchResultsBuilder, CustomerAddressServiceInterface $customerAddressService, CustomerMetadataServiceInterface $customerMetadataService, - UrlInterface $url + UrlInterface $url, + Logger $logger ) { $this->_customerFactory = $customerFactory; $this->_eventManager = $eventManager; @@ -144,6 +153,7 @@ class CustomerAccountService implements CustomerAccountServiceInterface $this->_customerAddressService = $customerAddressService; $this->_customerMetadataService = $customerMetadataService; $this->_url = $url; + $this->_logger = $logger; } /** @@ -157,11 +167,16 @@ class CustomerAccountService implements CustomerAccountServiceInterface throw (new NoSuchEntityException('email', $email))->addField('websiteId', $websiteId); } if ($customer->getConfirmation()) { - $customer->sendNewAccountEmail( - self::NEW_ACCOUNT_EMAIL_CONFIRMATION, - $redirectUrl, - $this->_storeManager->getStore()->getId() - ); + try { + $customer->sendNewAccountEmail( + self::NEW_ACCOUNT_EMAIL_CONFIRMATION, + $redirectUrl, + $this->_storeManager->getStore()->getId() + ); + } catch (MailException $e) { + // If we are not able to send a new account email, this should be ignored + $this->_logger->logException($e); + } } else { throw new StateException('No confirmation needed.', StateException::INVALID_STATE); } @@ -200,7 +215,7 @@ class CustomerAccountService implements CustomerAccountServiceInterface $customerModel->setWebsiteId($this->_storeManager->getStore()->getWebsiteId()); try { $customerModel->authenticate($username, $password); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { switch ($e->getCode()) { case CustomerModel::EXCEPTION_EMAIL_NOT_CONFIRMED: $code = AuthenticationException::EMAIL_NOT_CONFIRMED; @@ -248,15 +263,20 @@ class CustomerAccountService implements CustomerAccountServiceInterface ); $customer->setResetPasswordUrl($resetUrl); - switch ($template) { - case CustomerAccountServiceInterface::EMAIL_REMINDER: - $customer->sendPasswordReminderEmail(); - break; - case CustomerAccountServiceInterface::EMAIL_RESET: - $customer->sendPasswordResetConfirmationEmail(); - break; - default: - throw new InputException(__('Invalid email type.'), InputException::INVALID_FIELD_VALUE); + try { + switch ($template) { + case CustomerAccountServiceInterface::EMAIL_REMINDER: + $customer->sendPasswordReminderEmail(); + break; + case CustomerAccountServiceInterface::EMAIL_RESET: + $customer->sendPasswordResetConfirmationEmail(); + break; + default: + throw new InputException(__('Invalid email type.'), InputException::INVALID_FIELD_VALUE); + } + } catch (MailException $e) { + // If we are not able to send a reset password email, this should be ignored + $this->_logger->logException($e); } } @@ -331,18 +351,23 @@ class CustomerAccountService implements CustomerAccountServiceInterface $newLinkToken = $this->_mathRandom->getUniqueHash(); $customerModel->changeResetPasswordLinkToken($newLinkToken); - if ($customerModel->isConfirmationRequired()) { - $customerModel->sendNewAccountEmail( - self::NEW_ACCOUNT_EMAIL_CONFIRMATION, - $redirectUrl, - $customer->getStoreId() - ); - } else { - $customerModel->sendNewAccountEmail( - self::NEW_ACCOUNT_EMAIL_REGISTERED, - $redirectUrl, - $customer->getStoreId() - ); + try { + if ($customerModel->isConfirmationRequired()) { + $customerModel->sendNewAccountEmail( + self::NEW_ACCOUNT_EMAIL_CONFIRMATION, + $redirectUrl, + $customer->getStoreId() + ); + } else { + $customerModel->sendNewAccountEmail( + self::NEW_ACCOUNT_EMAIL_REGISTERED, + $redirectUrl, + $customer->getStoreId() + ); + } + } catch (MailException $e) { + // If we are not able to send a new account email, this should be ignored + $this->_logger->logException($e); } return $this->_converter->createCustomerFromModel($customerModel); } diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index 3f0e19c184d..06620c2e64f 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -89,4 +89,11 @@ <argument name="url" xsi:type="object">Magento\Url</argument> </arguments> </type> + <type name="Magento\Model\ActionValidator\RemoveAction"> + <arguments> + <argument name="protectedModels" xsi:type="array"> + <item name="customer" xsi:type="string">Magento\Customer\Model\Customer</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/BackgroundUploader.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/BackgroundUploader.php index 94c5fc6addc..17c9ffe23c4 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/BackgroundUploader.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/BackgroundUploader.php @@ -99,7 +99,7 @@ class BackgroundUploader extends \Magento\DesignEditor\Block\Adminhtml\Editor\Fo * Get component of 'checkbox' type (actually 'tile') * * @return \Magento\Data\Form\Element\Checkbox - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getCheckboxElement() { @@ -112,7 +112,7 @@ class BackgroundUploader extends \Magento\DesignEditor\Block\Adminhtml\Editor\Fo } } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Element "%1" is not found in "%2".', $checkboxId, $this->getData('name')) ); } @@ -121,7 +121,7 @@ class BackgroundUploader extends \Magento\DesignEditor\Block\Adminhtml\Editor\Fo * Get component of 'image-uploader' type * * @return \Magento\DesignEditor\Block\Adminhtml\Editor\Form\Element\ImageUploader - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getImageUploaderElement() { @@ -132,7 +132,7 @@ class BackgroundUploader extends \Magento\DesignEditor\Block\Adminhtml\Editor\Fo return $e; } } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Element "%1" is not found in "%2".', $imageUploaderId, $this->getData('name')) ); } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Column.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Column.php index f938aec0b0c..0aeaf326b9f 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Column.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Column.php @@ -100,12 +100,12 @@ class Column extends \Magento\Data\Form\Element\Fieldset implements /** * @return \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Renderer\Factory - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getRendererFactory() { if (!$this->_rendererFactory) { - throw new \Magento\Core\Exception('Renderer factory was not set'); + throw new \Magento\Model\Exception('Renderer factory was not set'); } return $this->_rendererFactory; } @@ -122,12 +122,12 @@ class Column extends \Magento\Data\Form\Element\Fieldset implements /** * @return \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Element\Factory - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getElementsFactory() { if (!$this->_elementsFactory) { - throw new \Magento\Core\Exception('Form elements factory was not set'); + throw new \Magento\Model\Exception('Form elements factory was not set'); } return $this->_elementsFactory; } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php index c5239097b1c..c8c83faf1dd 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php @@ -129,7 +129,7 @@ abstract class AbstractComposite extends \Magento\Data\Form\Element\Fieldset imp $layoutName = $element->getId() . '-renderer'; try { $renderer = $this->_rendererFactory->create($className, $layoutName); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $renderer = null; } if ($renderer) { @@ -145,14 +145,14 @@ abstract class AbstractComposite extends \Magento\Data\Form\Element\Fieldset imp * @param string $type * @param string|null $subtype * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getComponent($type, $subtype = null) { $components = $this->getComponents(); $componentId = $this->getComponentId($type); if (!isset($components[$componentId])) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Component of the type "%1" is not found between elements of "%2"', $type, $this->getData('name')) ); } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/QuickStyles/AbstractTab.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/QuickStyles/AbstractTab.php index 29d46acd263..034fa038f3a 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/QuickStyles/AbstractTab.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/QuickStyles/AbstractTab.php @@ -81,12 +81,12 @@ abstract class AbstractTab extends \Magento\Backend\Block\Widget\Form * Create a form element with necessary controls * * @return \Magento\DesignEditor\Block\Adminhtml\Editor\Tools\QuickStyles\Header - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _prepareForm() { if (!$this->_formId || !$this->_tab) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We found an invalid block of class "%1". Please define the required properties.', get_class($this)) ); } 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 40f0e44042c..10db01f3f2a 100644 --- a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php +++ b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php @@ -26,7 +26,7 @@ namespace Magento\DesignEditor\Controller\Adminhtml\System\Design; use Magento\Core\Model\Store; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; use Magento\View\Design\ThemeInterface; /** 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 a6b4ec62147..de1b8b348bd 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 @@ -25,7 +25,7 @@ */ namespace Magento\DesignEditor\Controller\Adminhtml\System\Design\Editor; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; /** * Backend controller for the design editor diff --git a/app/code/Magento/DesignEditor/Helper/Data.php b/app/code/Magento/DesignEditor/Helper/Data.php index 7c48ab4b000..6443819f427 100644 --- a/app/code/Magento/DesignEditor/Helper/Data.php +++ b/app/code/Magento/DesignEditor/Helper/Data.php @@ -33,6 +33,11 @@ use Magento\App\RequestInterface; */ class Data extends \Magento\App\Helper\AbstractHelper { + /** + * Parameter to indicate the translation mode (null, text, script, or alt). + */ + const TRANSLATION_MODE = "translation_mode"; + /** * XML path to VDE front name setting * @@ -47,16 +52,6 @@ class Data extends \Magento\App\Helper\AbstractHelper */ protected $_disabledCacheTypes; - /** - * Parameter to indicate the translation mode (null, text, script, or alt). - */ - const TRANSLATION_MODE = "translation_mode"; - - /** - * @var bool - */ - protected $_isVdeRequest = false; - /** * @var string */ @@ -94,41 +89,6 @@ class Data extends \Magento\App\Helper\AbstractHelper return $this->_disabledCacheTypes; } - /** - * This method returns an indicator of whether or not the current request is for vde - * - * @param RequestInterface $request - * @return bool - */ - public function isVdeRequest(RequestInterface $request = null) - { - if (null !== $request) { - $result = false; - $splitPath = explode('/', trim($request->getOriginalPathInfo(), '/')); - if (count($splitPath) >= 3) { - list($frontName, $currentMode, $themeId) = $splitPath; - $result = $frontName === $this->getFrontName() && in_array( - $currentMode, - $this->getAvailableModes() - ) && is_numeric( - $themeId - ); - } - $this->_isVdeRequest = $result; - } - return $this->_isVdeRequest; - } - - /** - * Get available modes for Design Editor - * - * @return string[] - */ - public function getAvailableModes() - { - return array(\Magento\DesignEditor\Model\State::MODE_NAVIGATION); - } - /** * Returns the translation mode the current request is in (null, text, script, or alt). * @@ -160,4 +120,28 @@ class Data extends \Magento\App\Helper\AbstractHelper { return $this->_translationMode !== null; } + + /** + * This method returns an indicator of whether or not the current request is for vde + * + * @param RequestInterface $request + * @return bool + */ + public function isVdeRequest(RequestInterface $request = null) + { + $result = false; + if (null !== $request) { + $splitPath = explode('/', trim($request->getOriginalPathInfo(), '/')); + if (count($splitPath) >= 3) { + list($frontName, $currentMode, $themeId) = $splitPath; + $result = $frontName === $this->_frontName && in_array( + $currentMode, + [\Magento\DesignEditor\Model\State::MODE_NAVIGATION] + ) && is_numeric( + $themeId + ); + } + } + return $result; + } } 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 b21ebe955ee..82cc86befef 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Configuration.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Configuration.php @@ -207,12 +207,12 @@ class Configuration * * @param string $controlName * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getControlData($controlName) { if (!isset($this->_controlList[$controlName])) { - throw new \Magento\Core\Exception("Unknown control: \"{$controlName}\""); + throw new \Magento\Model\Exception("Unknown control: \"{$controlName}\""); } return $this->_controlList[$controlName]; } diff --git a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Renderer/Factory.php b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Renderer/Factory.php index 48f5a097927..b0e2a24ba57 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Renderer/Factory.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Renderer/Factory.php @@ -83,12 +83,12 @@ class Factory * @param string $elementClassName * @param string $rendererName * @return RendererInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($elementClassName, $rendererName) { if (!isset($this->_rendererByElement[$elementClassName])) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( sprintf('No renderer registered for elements of class "%s"', $elementClassName) ); } 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 cc0eb211736..34d0068a7ab 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php @@ -136,7 +136,7 @@ class ImageUploader extends \Magento\Object if (!$uploader->save($this->getStoragePath())) { /** @todo add translator */ - throw new \Magento\Core\Exception('Cannot upload file.'); + throw new \Magento\Model\Exception('Cannot upload file.'); } $result['css_path'] = implode( '/', diff --git a/app/code/Magento/DesignEditor/Model/Observer.php b/app/code/Magento/DesignEditor/Model/Observer.php index c829aa42241..8bd15c17782 100644 --- a/app/code/Magento/DesignEditor/Model/Observer.php +++ b/app/code/Magento/DesignEditor/Model/Observer.php @@ -135,19 +135,4 @@ class Observer $change->save(); } } - - /** - * Determine if the vde specific translation class should be used. - * - * @param EventObserver $observer - * @return $this - */ - public function initializeTranslation(EventObserver $observer) - { - if ($this->_helper->isVdeRequest()) { - // Request is for vde. Override the translation class. - $observer->getResult()->setInlineType('Magento\DesignEditor\Model\Translate\InlineVde'); - } - return $this; - } } diff --git a/app/code/Magento/DesignEditor/Model/State.php b/app/code/Magento/DesignEditor/Model/State.php index 9d30e30183c..f7c6f503ae7 100644 --- a/app/code/Magento/DesignEditor/Model/State.php +++ b/app/code/Magento/DesignEditor/Model/State.php @@ -82,9 +82,9 @@ class State protected $_objectManager; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\ConfigInterface */ - protected $_application; + protected $_configuration; /** * Store list manager @@ -96,12 +96,12 @@ class State /** * @param \Magento\Backend\Model\Session $backendSession * @param AreaEmulator $areaEmulator - * @param \Magento\DesignEditor\Model\Url\Factory $urlModelFactory + * @param Url\Factory $urlModelFactory * @param \Magento\App\Cache\StateInterface $cacheState * @param \Magento\DesignEditor\Helper\Data $dataHelper * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\App $application - * @param \Magento\DesignEditor\Model\Theme\Context $themeContext + * @param \Magento\App\ConfigInterface $configuration + * @param Theme\Context $themeContext * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( @@ -111,7 +111,7 @@ class State \Magento\App\Cache\StateInterface $cacheState, \Magento\DesignEditor\Helper\Data $dataHelper, \Magento\ObjectManager $objectManager, - \Magento\Core\Model\App $application, + \Magento\App\ConfigInterface $configuration, \Magento\DesignEditor\Model\Theme\Context $themeContext, \Magento\Core\Model\StoreManagerInterface $storeManager ) { @@ -121,7 +121,7 @@ class State $this->_cacheState = $cacheState; $this->_dataHelper = $dataHelper; $this->_objectManager = $objectManager; - $this->_application = $application; + $this->_configuration = $configuration; $this->_themeContext = $themeContext; $this->_storeManager = $storeManager; } @@ -203,7 +203,7 @@ class State if ($this->_themeContext->getEditableTheme()) { $themeId = $this->_themeContext->getVisibleTheme()->getId(); $this->_storeManager->getStore()->setConfig(\Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId); - $this->_application->getConfig()->setValue(\Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId); + $this->_configuration->setValue(\Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId); } } diff --git a/app/code/Magento/DesignEditor/Model/Theme/Change.php b/app/code/Magento/DesignEditor/Model/Theme/Change.php index 030e5e6fda4..616cffd7d22 100644 --- a/app/code/Magento/DesignEditor/Model/Theme/Change.php +++ b/app/code/Magento/DesignEditor/Model/Theme/Change.php @@ -28,7 +28,7 @@ namespace Magento\DesignEditor\Model\Theme; /** * Design editor theme change */ -class Change extends \Magento\Core\Model\AbstractModel +class Change extends \Magento\Model\AbstractModel { /** * Theme model initialization diff --git a/app/code/Magento/DesignEditor/Model/Theme/Context.php b/app/code/Magento/DesignEditor/Model/Theme/Context.php index 8d8732671f1..2e41b1971aa 100644 --- a/app/code/Magento/DesignEditor/Model/Theme/Context.php +++ b/app/code/Magento/DesignEditor/Model/Theme/Context.php @@ -25,7 +25,7 @@ */ namespace Magento\DesignEditor\Model\Theme; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; /** * Design editor theme context diff --git a/app/code/Magento/DesignEditor/Model/Theme/Resource/Change.php b/app/code/Magento/DesignEditor/Model/Theme/Resource/Change.php index 06244e7dd1d..2b325ac2e33 100644 --- a/app/code/Magento/DesignEditor/Model/Theme/Resource/Change.php +++ b/app/code/Magento/DesignEditor/Model/Theme/Resource/Change.php @@ -28,7 +28,7 @@ namespace Magento\DesignEditor\Model\Theme\Resource; /** * Theme change resource model */ -class Change extends \Magento\Core\Model\Resource\Db\AbstractDb +class Change extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime @@ -59,10 +59,10 @@ class Change extends \Magento\Core\Model\Resource\Db\AbstractDb /** * {@inheritdoc} * - * @param \Magento\Core\Model\AbstractModel $change + * @param \Magento\Model\AbstractModel $change * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $change) + protected function _beforeSave(\Magento\Model\AbstractModel $change) { if (!$change->getChangeTime()) { $change->setChangeTime($this->dateTime->formatDate(true)); diff --git a/app/code/Magento/DesignEditor/Model/Translate/InlineVde.php b/app/code/Magento/DesignEditor/Model/Translate/Inline.php similarity index 68% rename from app/code/Magento/DesignEditor/Model/Translate/InlineVde.php rename to app/code/Magento/DesignEditor/Model/Translate/Inline.php index c1b4381e1f8..0ff98a882a0 100644 --- a/app/code/Magento/DesignEditor/Model/Translate/InlineVde.php +++ b/app/code/Magento/DesignEditor/Model/Translate/Inline.php @@ -28,37 +28,27 @@ namespace Magento\DesignEditor\Model\Translate; /** * Inline translation specific to Vde. */ -class InlineVde implements \Magento\Translate\InlineInterface +class Inline implements \Magento\Translate\InlineInterface { /** * data-translate-mode attribute name */ const TRANSLATE_MODE = 'data-translate-mode'; - /** - * text translate mode + /**#@+ + * Translate modes */ const MODE_TEXT = 'text'; - - /** - * img element name - */ - const ELEMENT_IMG = 'img'; - - /** - * alt translate mode - */ const MODE_ALT = 'alt'; - - /** - * script translate mode - */ const MODE_SCRIPT = 'script'; + /**#@-*/ - /** - * script element name + /**#@+ + * Html tags */ - const ELEMENT_SCRIPT = self::MODE_SCRIPT; + const TAG_IMG = 'img'; + const TAG_SCRIPT = 'script'; + /**#@-*/ /** * @var \Magento\DesignEditor\Helper\Data @@ -70,6 +60,11 @@ class InlineVde implements \Magento\Translate\InlineInterface */ protected $_parser; + /** + * @var \Magento\Translate\Inline\ParserFactory + */ + protected $parserFactory; + /** * @var \Magento\UrlInterface */ @@ -117,13 +112,15 @@ class InlineVde implements \Magento\Translate\InlineInterface ) { $this->_design = $design; $this->_scopeResolver = $scopeResolver; - $this->_parser = $parserFactory->create(array('translateInline' => $this)); + $this->parserFactory = $parserFactory; $this->_helper = $helper; $this->_url = $url; $this->_objectManager = $objectManager; } /** + * Check if Inline Translates is allowed + * * Translation within the vde will be enabled by the client when the 'Edit' button is enabled. * * @return bool @@ -133,6 +130,19 @@ class InlineVde implements \Magento\Translate\InlineInterface return $this->_helper->isAllowed(); } + /** + * Retrieve Inline Parser instance + * + * @return \Magento\Translate\Inline\ParserInterface + */ + public function getParser() + { + if (!$this->_parser) { + $this->_parser = $this->parserFactory->create(['translateInline' => $this]); + } + return $this->_parser; + } + /** * Replace VDE specific translation templates with HTML fragments * @@ -142,15 +152,24 @@ class InlineVde implements \Magento\Translate\InlineInterface */ public function processResponseBody(&$body, $isJson = false) { + if (!$this->isAllowed()) { + return $this; + } + + $this->getParser()->setIsJson($isJson); + if (is_array($body)) { foreach ($body as &$part) { $this->processResponseBody($part, $isJson); } } elseif (is_string($body)) { - $content = $this->_parser->processResponseBodyString($body, $this); - $this->_insertInlineScriptsHtml($content); - $body = $this->_parser->getContent(); + $this->getParser()->processResponseBodyString($body); + $this->addInlineScript(); + $body = $this->getParser()->getContent(); } + + $this->getParser()->setIsJson(false); + return $this; } @@ -167,41 +186,63 @@ class InlineVde implements \Magento\Translate\InlineInterface } /** - * Create block to render script and html with added inline translation content specific for vde. + * Add inline script code + * + * Insert script and html with + * added inline translation content specific for vde. * - * @param string $content * @return void */ - private function _insertInlineScriptsHtml($content) + protected function addInlineScript() { - if ($this->_isScriptInserted || stripos($content, '</body>') === false) { + $content = $this->getParser()->getContent(); + if (stripos($content, '</body>') === false) { return; } + if (!$this->_isScriptInserted) { + $this->getParser()->setContent(str_ireplace('</body>', $this->getInlineScript() . '</body>', $content)); + $this->_isScriptInserted = true; + } + } - $scope = $this->_scopeResolver->getScope(); - $ajaxUrl = $this->_url->getUrl( - 'core/ajax/translate', - array( - '_secure' => $scope->isCurrentlySecure(), - \Magento\DesignEditor\Helper\Data::TRANSLATION_MODE => $this->_helper->getTranslationMode() - ) - ); - + /** + * Retrieve inline script code + * + * Create block to render script and html with + * added inline translation content specific for vde. + * + * @return string + */ + protected function getInlineScript() + { /** @var $block \Magento\View\Element\Template */ $block = $this->_objectManager->create('Magento\View\Element\Template'); $block->setArea($this->_design->getArea()); - $block->setAjaxUrl($ajaxUrl); - + $block->setAjaxUrl($this->_getAjaxUrl()); $block->setFrameUrl($this->_getFrameUrl()); $block->setRefreshCanvas($this->isAllowed()); $block->setTemplate('Magento_DesignEditor::translate_inline.phtml'); $block->setTranslateMode($this->_helper->getTranslationMode()); - $this->_parser->setContent(str_ireplace('</body>', $block->toHtml() . '</body>', $content)); + return $block->toHtml(); + } - $this->_isScriptInserted = true; + /** + * Return URL for ajax requests + * + * @return string + */ + protected function _getAjaxUrl() + { + return $this->_url->getUrl( + 'translation/ajax/index', + [ + '_secure' => $this->_scopeResolver->getScope()->isCurrentlySecure(), + \Magento\DesignEditor\Helper\Data::TRANSLATION_MODE => $this->_helper->getTranslationMode() + ] + ); } /** @@ -224,17 +265,21 @@ class InlineVde implements \Magento\Translate\InlineInterface /** * Get inline vde translate mode * - * @param string $tagName + * @param string $tagName * @return string */ private function _getTranslateMode($tagName) { - $mode = self::MODE_TEXT; - if (self::ELEMENT_SCRIPT == $tagName) { - $mode = self::MODE_SCRIPT; - } elseif (self::ELEMENT_IMG == $tagName) { - $mode = self::MODE_ALT; + switch ($tagName) { + case self::TAG_SCRIPT: + $result = self::MODE_SCRIPT; + break; + case self::TAG_IMG: + $result = self::MODE_ALT; + break; + default: + $result = self::MODE_TEXT; } - return $mode; + return $result; } } diff --git a/app/code/Magento/DesignEditor/Model/Translate/Inline/Provider.php b/app/code/Magento/DesignEditor/Model/Translate/Inline/Provider.php new file mode 100644 index 00000000000..c1f91d58c96 --- /dev/null +++ b/app/code/Magento/DesignEditor/Model/Translate/Inline/Provider.php @@ -0,0 +1,78 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\DesignEditor\Model\Translate\Inline; + +class Provider extends \Magento\Translate\Inline\Provider +{ + /** + * @var \Magento\Translate\InlineInterface + */ + protected $vdeInlineTranslate; + + /** + * @var \Magento\Translate\InlineInterface + */ + protected $inlineTranslate; + + /** + * @var \Magento\App\RequestInterface + */ + protected $request; + + /** + * @var \Magento\DesignEditor\Helper\Data + */ + protected $helper; + + /** + * @param \Magento\Translate\InlineInterface $vdeInlineTranslate + * @param \Magento\Translate\InlineInterface $inlineTranslate + * @param \Magento\DesignEditor\Helper\Data $helper + * @param \Magento\App\RequestInterface $request + */ + public function __construct( + \Magento\Translate\InlineInterface $vdeInlineTranslate, + \Magento\Translate\InlineInterface $inlineTranslate, + \Magento\DesignEditor\Helper\Data $helper, + \Magento\App\RequestInterface $request + ) { + $this->vdeInlineTranslate = $vdeInlineTranslate; + $this->inlineTranslate = $inlineTranslate; + $this->request = $request; + $this->helper = $helper; + } + + /** + * Return instance of inline translate class + * + * @return \Magento\Translate\InlineInterface + */ + public function get() + { + return $this->helper->isVdeRequest($this->request) + ? $this->vdeInlineTranslate + : $this->inlineTranslate; + } +} diff --git a/app/code/Magento/DesignEditor/etc/di.xml b/app/code/Magento/DesignEditor/etc/di.xml index a236388a029..5814b1421a9 100644 --- a/app/code/Magento/DesignEditor/etc/di.xml +++ b/app/code/Magento/DesignEditor/etc/di.xml @@ -41,4 +41,15 @@ </argument> </arguments> </type> + <type name="Magento\DesignEditor\Model\Translate\Inline\Provider"> + <arguments> + <argument name="vdeInlineTranslate" xsi:type="object">Magento\DesignEditor\Model\Translate\Inline\Proxy</argument> + <argument name="inlineTranslate" xsi:type="object">\Magento\Translate\Inline\Proxy</argument> + </arguments> + </type> + <type name="Magento\Phrase\Renderer\Inline"> + <arguments> + <argument name="inlineProvider" xsi:type="object">Magento\DesignEditor\Model\Translate\Inline\Provider</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/DesignEditor/etc/vde/events.xml b/app/code/Magento/DesignEditor/etc/vde/events.xml index 66e41c5a703..b047255c2ce 100644 --- a/app/code/Magento/DesignEditor/etc/vde/events.xml +++ b/app/code/Magento/DesignEditor/etc/vde/events.xml @@ -27,7 +27,4 @@ <event name="controller_action_layout_generate_blocks_after"> <observer name="vde_editor" instance="Magento\DesignEditor\Model\Observer" method="clearJs" /> </event> - <event name="translate_initialization_before"> - <observer name="initialize_translation" instance="Magento\DesignEditor\Model\Observer" method="initializeTranslation" /> - </event> </config> diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php index 1e9246217d9..24643cd1709 100644 --- a/app/code/Magento/Dhl/Model/Carrier.php +++ b/app/code/Magento/Dhl/Model/Carrier.php @@ -515,7 +515,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * Get allowed shipping methods * * @return string[] - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getAllowedMethods() { @@ -535,7 +535,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $allowedMethods = explode(',', $this->getConfigData('nondoc_methods')); break; default: - throw new \Magento\Core\Exception(__('Wrong Content Type')); + throw new \Magento\Model\Exception(__('Wrong Content Type')); } } $methods = array(); @@ -913,7 +913,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Get shipping quotes * - * @return \Magento\Core\Model\AbstractModel|Result + * @return \Magento\Model\AbstractModel|Result */ protected function _getQuotes() { @@ -1047,7 +1047,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * * @param string $response * @return bool|\Magento\Object|Result|Error - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _parseResponse($response) { @@ -1080,7 +1080,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin break; } } - throw new \Magento\Core\Exception(__('Error #%1 : %2', trim($code), trim($data))); + throw new \Magento\Model\Exception(__('Error #%1 : %2', trim($code), trim($data))); } $code = isset($nodeCondition->ConditionCode) ? (string)$nodeCondition->ConditionCode : 0; @@ -1123,7 +1123,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin } } else if (!empty($this->_errors)) { if ($this->_isShippingLabelFlag) { - throw new \Magento\Core\Exception($responseError); + throw new \Magento\Model\Exception($responseError); } return $this->_showError(); } @@ -1215,14 +1215,14 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * Returns dimension unit (cm or inch) * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getDimensionUnit() { $countryId = $this->_rawRequest->getOrigCountryId(); $measureUnit = $this->getCountryParams($countryId)->getMeasureUnit(); if (empty($measureUnit)) { - throw new \Magento\Core\Exception(__("Cannot identify measure unit for %1", $countryId)); + throw new \Magento\Model\Exception(__("Cannot identify measure unit for %1", $countryId)); } return $measureUnit; } @@ -1231,14 +1231,14 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * Returns weight unit (kg or pound) * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getWeightUnit() { $countryId = $this->_rawRequest->getOrigCountryId(); $weightUnit = $this->getCountryParams($countryId)->getWeightUnit(); if (empty($weightUnit)) { - throw new \Magento\Core\Exception(__("Cannot identify weight unit for %1", $countryId)); + throw new \Magento\Model\Exception(__("Cannot identify weight unit for %1", $countryId)); } return $weightUnit; } @@ -1348,7 +1348,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * * @param \Magento\Object $request * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _mapRequestToShipment(\Magento\Object $request) { @@ -1363,7 +1363,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $minValue = $this->_getMinDimension($params['dimension_units']); if ($params['width'] < $minValue || $params['length'] < $minValue || $params['height'] < $minValue) { $message = __('Height, width and length should be equal or greater than %1', $minValue); - throw new \Magento\Core\Exception($message); + throw new \Magento\Model\Exception($message); } } @@ -1409,7 +1409,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * Do rate request and handle errors * * @return Result|\Magento\Object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _doRequest() { @@ -1420,7 +1420,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin )->getRegion(); if (!$originRegion) { - throw new \Magento\Core\Exception(__('Wrong Region')); + throw new \Magento\Model\Exception(__('Wrong Region')); } if ($originRegion == 'AM') { @@ -1902,13 +1902,13 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * * @param \Magento\Shipping\Model\Shipment\Request $request * @return array|\Magento\Object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function requestToShipment($request) { $packages = $request->getPackages(); if (!is_array($packages) || !$packages) { - throw new \Magento\Core\Exception(__('No packages for request')); + throw new \Magento\Model\Exception(__('No packages for request')); } $result = $this->_doShipmentRequest($request); @@ -1955,20 +1955,20 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * * @param \SimpleXMLElement $xml * @return \Magento\Object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _prepareShippingLabelContent(\SimpleXMLElement $xml) { $result = new \Magento\Object(); try { if (!isset($xml->AirwayBillNumber) || !isset($xml->LabelImage->OutputImage)) { - throw new \Magento\Core\Exception('Unable to retrieve shipping label'); + throw new \Magento\Model\Exception('Unable to retrieve shipping label'); } $result->setTrackingNumber((string)$xml->AirwayBillNumber); $labelContent = (string)$xml->LabelImage->OutputImage; $result->setShippingLabelContent(base64_decode($labelContent)); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__($e->getMessage())); + throw new \Magento\Model\Exception(__($e->getMessage())); } return $result; } diff --git a/app/code/Magento/Directory/Exception.php b/app/code/Magento/Directory/Exception.php index 3e2e94309ba..8bb1b304b1e 100644 --- a/app/code/Magento/Directory/Exception.php +++ b/app/code/Magento/Directory/Exception.php @@ -25,6 +25,6 @@ */ namespace Magento\Directory; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Directory/Model/Country.php b/app/code/Magento/Directory/Model/Country.php index dde57c633c3..0f1f6fbaa71 100644 --- a/app/code/Magento/Directory/Model/Country.php +++ b/app/code/Magento/Directory/Model/Country.php @@ -38,7 +38,7 @@ */ namespace Magento\Directory\Model; -class Country extends \Magento\Core\Model\AbstractModel +class Country extends \Magento\Model\AbstractModel { /** * @var array @@ -66,7 +66,7 @@ class Country extends \Magento\Core\Model\AbstractModel * @param \Magento\Locale\ListsInterface $localeLists * @param Country\FormatFactory $formatFactory * @param Resource\Region\CollectionFactory $regionCollectionFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -76,7 +76,7 @@ class Country extends \Magento\Core\Model\AbstractModel \Magento\Locale\ListsInterface $localeLists, \Magento\Directory\Model\Country\FormatFactory $formatFactory, \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Directory/Model/Country/Format.php b/app/code/Magento/Directory/Model/Country/Format.php index a9568368e26..6fe18d3d7ef 100644 --- a/app/code/Magento/Directory/Model/Country/Format.php +++ b/app/code/Magento/Directory/Model/Country/Format.php @@ -41,7 +41,7 @@ namespace Magento\Directory\Model\Country; * @package Magento_Directory * @author Magento Core Team <core@magentocommerce.com> */ -class Format extends \Magento\Core\Model\AbstractModel +class Format extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Directory/Model/Currency.php b/app/code/Magento/Directory/Model/Currency.php index ab7a40dbf70..11ef48b227b 100644 --- a/app/code/Magento/Directory/Model/Currency.php +++ b/app/code/Magento/Directory/Model/Currency.php @@ -36,7 +36,7 @@ namespace Magento\Directory\Model; use Magento\Directory\Exception; use Magento\Directory\Model\Currency\Filter; -class Currency extends \Magento\Core\Model\AbstractModel +class Currency extends \Magento\Model\AbstractModel { /** * CONFIG path constants @@ -92,7 +92,7 @@ class Currency extends \Magento\Core\Model\AbstractModel * @param \Magento\Directory\Helper\Data $directoryHelper * @param Currency\FilterFactory $currencyFilterFactory * @param \Magento\Locale\CurrencyInterface $localeCurrency - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -104,7 +104,7 @@ class Currency extends \Magento\Core\Model\AbstractModel \Magento\Directory\Helper\Data $directoryHelper, \Magento\Directory\Model\Currency\FilterFactory $currencyFilterFactory, \Magento\Locale\CurrencyInterface $localeCurrency, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Directory/Model/Currency/DefaultLocator.php b/app/code/Magento/Directory/Model/Currency/DefaultLocator.php index 56c770f1e28..2bdb02440fb 100644 --- a/app/code/Magento/Directory/Model/Currency/DefaultLocator.php +++ b/app/code/Magento/Directory/Model/Currency/DefaultLocator.php @@ -28,11 +28,11 @@ namespace Magento\Directory\Model\Currency; class DefaultLocator { /** - * Application object + * Config object * - * @var \Magento\Core\Model\App + * @var \Magento\App\ConfigInterface */ - protected $_app; + protected $_configuration; /** * Store manager @@ -42,14 +42,14 @@ class DefaultLocator protected $_storeManager; /** - * Constructor - * - * @param \Magento\Core\Model\App $app + * @param \Magento\App\ConfigInterface $configuration * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Core\Model\App $app, \Magento\Core\Model\StoreManagerInterface $storeManager) - { - $this->_app = $app; + public function __construct( + \Magento\App\ConfigInterface $configuration, + \Magento\Core\Model\StoreManagerInterface $storeManager + ) { + $this->_configuration = $configuration; $this->_storeManager = $storeManager; } @@ -71,7 +71,10 @@ class DefaultLocator $group = $request->getParam('group'); $currencyCode = $this->_storeManager->getGroup($group)->getWebsite()->getBaseCurrencyCode(); } else { - $currencyCode = $this->_app->getBaseCurrencyCode(); + $currencyCode = $this->_configuration->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + 'default' + ); } return $currencyCode; diff --git a/app/code/Magento/Directory/Model/Observer.php b/app/code/Magento/Directory/Model/Observer.php index a98f388014f..2218d73c623 100644 --- a/app/code/Magento/Directory/Model/Observer.php +++ b/app/code/Magento/Directory/Model/Observer.php @@ -57,11 +57,6 @@ class Observer */ protected $_coreStoreConfig; - /** - * @var \Magento\TranslateInterface - */ - protected $_translate; - /** * @var \Magento\Mail\Template\TransportBuilder */ @@ -77,28 +72,33 @@ class Observer */ protected $_currencyFactory; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\Directory\Model\Currency\Import\Factory $importFactory * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\TranslateInterface $translate * @param \Magento\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\Directory\Model\Currency\Import\Factory $importFactory, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\TranslateInterface $translate, \Magento\Mail\Template\TransportBuilder $transportBuilder, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Directory\Model\CurrencyFactory $currencyFactory + \Magento\Directory\Model\CurrencyFactory $currencyFactory, + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_importFactory = $importFactory; $this->_coreStoreConfig = $coreStoreConfig; - $this->_translate = $translate; $this->_transportBuilder = $transportBuilder; $this->_storeManager = $storeManager; $this->_currencyFactory = $currencyFactory; + $this->inlineTranslation = $inlineTranslation; } /** @@ -141,8 +141,7 @@ class Observer if (sizeof($importWarnings) == 0) { $this->_currencyFactory->create()->saveRates($rates); } else { - $translate = $this->_translate->getTranslateInline(); - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE) @@ -161,7 +160,7 @@ class Observer $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); - $this->_translate->setTranslateInline($translate); + $this->inlineTranslation->resume(); } } } diff --git a/app/code/Magento/Directory/Model/Region.php b/app/code/Magento/Directory/Model/Region.php index e02e1b0ea0c..ecd63e3090b 100644 --- a/app/code/Magento/Directory/Model/Region.php +++ b/app/code/Magento/Directory/Model/Region.php @@ -43,7 +43,7 @@ */ namespace Magento\Directory\Model; -class Region extends \Magento\Core\Model\AbstractModel +class Region extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Directory/Model/Resource/Country.php b/app/code/Magento/Directory/Model/Resource/Country.php index a7a1d94c49b..4f41606069d 100644 --- a/app/code/Magento/Directory/Model/Resource/Country.php +++ b/app/code/Magento/Directory/Model/Resource/Country.php @@ -28,7 +28,7 @@ namespace Magento\Directory\Model\Resource; /** * Directory Country Resource Model */ -class Country extends \Magento\Core\Model\Resource\Db\AbstractDb +class Country extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization @@ -46,7 +46,7 @@ class Country extends \Magento\Core\Model\Resource\Db\AbstractDb * @param \Magento\Directory\Model\Country $country * @param string $code * @return \Magento\Directory\Model\Resource\Country - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function loadByCode(\Magento\Directory\Model\Country $country, $code) { @@ -60,7 +60,7 @@ class Country extends \Magento\Core\Model\Resource\Db\AbstractDb break; default: - throw new \Magento\Core\Exception(__('Please correct the country code: %1.', $code)); + throw new \Magento\Model\Exception(__('Please correct the country code: %1.', $code)); } return $this->load($country, $code, $field); diff --git a/app/code/Magento/Directory/Model/Resource/Country/Collection.php b/app/code/Magento/Directory/Model/Resource/Country/Collection.php index cb0f3cca3c8..f096afc3f55 100644 --- a/app/code/Magento/Directory/Model/Resource/Country/Collection.php +++ b/app/code/Magento/Directory/Model/Resource/Country/Collection.php @@ -29,7 +29,7 @@ */ namespace Magento\Directory\Model\Resource\Country; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Locale model @@ -73,7 +73,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param \Magento\Locale\ResolverInterface $localeResolver * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -86,7 +86,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Locale\ResolverInterface $localeResolver, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_coreStoreConfig = $coreStoreConfig; diff --git a/app/code/Magento/Directory/Model/Resource/Country/Format.php b/app/code/Magento/Directory/Model/Resource/Country/Format.php index d093b93042e..4e07fadbe3f 100644 --- a/app/code/Magento/Directory/Model/Resource/Country/Format.php +++ b/app/code/Magento/Directory/Model/Resource/Country/Format.php @@ -32,7 +32,7 @@ namespace Magento\Directory\Model\Resource\Country; * @package Magento_Directory * @author Magento Core Team <core@magentocommerce.com> */ -class Format extends \Magento\Core\Model\Resource\Db\AbstractDb +class Format extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Directory/Model/Resource/Country/Format/Collection.php b/app/code/Magento/Directory/Model/Resource/Country/Format/Collection.php index d7a5d88b98c..cd466f263eb 100644 --- a/app/code/Magento/Directory/Model/Resource/Country/Format/Collection.php +++ b/app/code/Magento/Directory/Model/Resource/Country/Format/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Directory\Model\Resource\Country\Format; * @package Magento_Directory * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define main table diff --git a/app/code/Magento/Directory/Model/Resource/Currency.php b/app/code/Magento/Directory/Model/Resource/Currency.php index 098ef5fd3dc..4c8eb49d6b3 100644 --- a/app/code/Magento/Directory/Model/Resource/Currency.php +++ b/app/code/Magento/Directory/Model/Resource/Currency.php @@ -29,7 +29,7 @@ */ namespace Magento\Directory\Model\Resource; -class Currency extends \Magento\Core\Model\Resource\Db\AbstractDb +class Currency extends \Magento\Model\Resource\Db\AbstractDb { /** * Currency rate table @@ -151,7 +151,7 @@ class Currency extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param array $rates * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function saveRates($rates) { @@ -171,7 +171,7 @@ class Currency extends \Magento\Core\Model\Resource\Db\AbstractDb $adapter->insertOnDuplicate($this->_currencyRateTable, $data, array('rate')); } } else { - throw new \Magento\Core\Exception(__('Please correct the rates received')); + throw new \Magento\Model\Exception(__('Please correct the rates received')); } } diff --git a/app/code/Magento/Directory/Model/Resource/Region.php b/app/code/Magento/Directory/Model/Resource/Region.php index d8a6ffb53a8..22c131b6df0 100644 --- a/app/code/Magento/Directory/Model/Resource/Region.php +++ b/app/code/Magento/Directory/Model/Resource/Region.php @@ -29,7 +29,7 @@ */ namespace Magento\Directory\Model\Resource; -class Region extends \Magento\Core\Model\Resource\Db\AbstractDb +class Region extends \Magento\Model\Resource\Db\AbstractDb { /** * Table with localized region names @@ -69,7 +69,7 @@ class Region extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Magento\DB\Select */ protected function _getLoadSelect($field, $value, $object) @@ -78,7 +78,7 @@ class Region extends \Magento\Core\Model\Resource\Db\AbstractDb $adapter = $this->_getReadAdapter(); $locale = $this->_localeResolver->getLocaleCode(); - $systemLocale = \Magento\Core\Model\App::DISTRO_LOCALE_CODE; + $systemLocale = \Magento\AppInterface::DISTRO_LOCALE_CODE; $regionField = $adapter->quoteIdentifier($this->getMainTable() . '.' . $this->getIdFieldName()); @@ -107,7 +107,7 @@ class Region extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Load object by country id and code or default name * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param int $countryId * @param string $value * @param string $field diff --git a/app/code/Magento/Directory/Model/Resource/Region/Collection.php b/app/code/Magento/Directory/Model/Resource/Region/Collection.php index 34f0e55a8a9..4177bc8b085 100644 --- a/app/code/Magento/Directory/Model/Resource/Region/Collection.php +++ b/app/code/Magento/Directory/Model/Resource/Region/Collection.php @@ -29,7 +29,7 @@ */ namespace Magento\Directory\Model\Resource\Region; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Locale region name table name @@ -57,7 +57,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Locale\ResolverInterface $localeResolver * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -66,7 +66,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Locale\ResolverInterface $localeResolver, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_localeResolver = $localeResolver; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php index 2687716f6cc..704c036245d 100644 --- a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php +++ b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php @@ -26,20 +26,18 @@ namespace Magento\Downloadable\Block\Catalog\Product; use Magento\Downloadable\Model\Link; +use Magento\Customer\Controller\RegistryConstants; /** * Downloadable Product Links part block * - * @category Magento - * @package Magento_Downloadable - * @author Magento Core Team <core@magentocommerce.com> */ class Links extends \Magento\Catalog\Block\Product\AbstractProduct { /** * @var \Magento\Tax\Model\Calculation */ - protected $_calculationModel; + protected $calculationModel; /** * @var \Magento\Json\EncoderInterface @@ -52,58 +50,34 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct protected $coreData; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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 + * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface + */ + protected $accountService; + + /** + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Tax\Model\Calculation $calculationModel * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $accountService * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Tax\Model\Calculation $calculationModel, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Core\Helper\Data $coreData, + \Magento\Customer\Service\V1\CustomerAccountServiceInterface $accountService, array $data = array(), array $priceBlockTypes = array() ) { - $this->_calculationModel = $calculationModel; + $this->calculationModel = $calculationModel; $this->jsonEncoder = $jsonEncoder; $this->coreData = $coreData; + $this->accountService = $accountService; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); @@ -157,9 +131,11 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct return ''; } - $taxCalculation = $this->_calculationModel; - if (!$taxCalculation->getCustomer() && $this->_coreRegistry->registry('current_customer')) { - $taxCalculation->setCustomer($this->_coreRegistry->registry('current_customer')); + if (!$this->calculationModel->getCustomerData()->getId() + && $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID)) { + $customer = $this->accountService + ->getCustomer($this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID)); + $this->calculationModel->setCustomerData($customer); } $taxHelper = $this->_taxData; 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 500a46fb0cb..1aac56c5aa6 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit.php @@ -122,7 +122,7 @@ class Edit extends \Magento\Catalog\Controller\Adminhtml\Product } try { $this->_processDownload($resource, $resourceType); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError(__('Something went wrong while getting the requested content.')); } } diff --git a/app/code/Magento/Downloadable/Controller/Download.php b/app/code/Magento/Downloadable/Controller/Download.php index 816415cb071..2cf998fe9fd 100644 --- a/app/code/Magento/Downloadable/Controller/Download.php +++ b/app/code/Magento/Downloadable/Controller/Download.php @@ -25,7 +25,7 @@ namespace Magento\Downloadable\Controller; use Magento\App\ResponseInterface; use Magento\Downloadable\Helper\Download as DownloadHelper; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; use Magento\Downloadable\Model\Link\Purchased\Item as PurchasedLink; /** diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index 95860aa67ff..aef39f99912 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -24,7 +24,7 @@ namespace Magento\Downloadable\Helper; use Magento\App\Filesystem; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; /** * Downloadable Products Download Helper diff --git a/app/code/Magento/Downloadable/Helper/File.php b/app/code/Magento/Downloadable/Helper/File.php index f032af14933..b1f1a6cdc96 100644 --- a/app/code/Magento/Downloadable/Helper/File.php +++ b/app/code/Magento/Downloadable/Helper/File.php @@ -100,7 +100,7 @@ class File extends \Magento\App\Helper\AbstractHelper * @param string $basePath * @param string $file * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function moveFileFromTmp($baseTmpPath, $basePath, $file) { @@ -110,7 +110,7 @@ class File extends \Magento\App\Helper\AbstractHelper try { $fileName = $this->_moveFileFromTmp($baseTmpPath, $basePath, $file[0]['file']); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('Something went wrong while saving the file(s).')); + throw new \Magento\Model\Exception(__('Something went wrong while saving the file(s).')); } } return $fileName; diff --git a/app/code/Magento/Downloadable/Model/Link.php b/app/code/Magento/Downloadable/Model/Link.php index 60287337573..1c7b27236b1 100644 --- a/app/code/Magento/Downloadable/Model/Link.php +++ b/app/code/Magento/Downloadable/Model/Link.php @@ -55,7 +55,7 @@ use Magento\Downloadable\Model\Resource\Link as Resource; * * @author Magento Core Team <core@magentocommerce.com> */ -class Link extends \Magento\Core\Model\AbstractModel +class Link extends \Magento\Model\AbstractModel { const XML_PATH_LINKS_TITLE = 'catalog/downloadable/links_title'; @@ -74,14 +74,14 @@ class Link extends \Magento\Core\Model\AbstractModel /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Downloadable/Model/Link/Purchased.php b/app/code/Magento/Downloadable/Model/Link/Purchased.php index 45e981f4e8b..09fb4f69e1a 100644 --- a/app/code/Magento/Downloadable/Model/Link/Purchased.php +++ b/app/code/Magento/Downloadable/Model/Link/Purchased.php @@ -53,7 +53,7 @@ namespace Magento\Downloadable\Model\Link; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Purchased extends \Magento\Core\Model\AbstractModel +class Purchased extends \Magento\Model\AbstractModel { /** * Enter description here... diff --git a/app/code/Magento/Downloadable/Model/Link/Purchased/Item.php b/app/code/Magento/Downloadable/Model/Link/Purchased/Item.php index e1a989bd505..ca4d40f9ebd 100644 --- a/app/code/Magento/Downloadable/Model/Link/Purchased/Item.php +++ b/app/code/Magento/Downloadable/Model/Link/Purchased/Item.php @@ -65,7 +65,7 @@ use Magento\Downloadable\Model\Resource\Link\Purchased\Item as Resource; * * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { const XML_PATH_ORDER_ITEM_STATUS = 'catalog/downloadable/order_item_status'; diff --git a/app/code/Magento/Downloadable/Model/Product/Type.php b/app/code/Magento/Downloadable/Model/Product/Type.php index 789ff373c40..bb8e5216ed5 100644 --- a/app/code/Magento/Downloadable/Model/Product/Type.php +++ b/app/code/Magento/Downloadable/Model/Product/Type.php @@ -389,7 +389,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual * * @param \Magento\Catalog\Model\Product $product * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function checkProductBuyState($product) { @@ -403,7 +403,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual $buyRequest->setLinks($allLinksIds); $product->addCustomOption('info_buyRequest', serialize($buyRequest->getData())); } else { - throw new \Magento\Core\Exception(__('Please specify product link(s).')); + throw new \Magento\Model\Exception(__('Please specify product link(s).')); } } } diff --git a/app/code/Magento/Downloadable/Model/Resource/Link.php b/app/code/Magento/Downloadable/Model/Resource/Link.php index 35751abdee0..c68d1d544b7 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Link extends \Magento\Core\Model\Resource\Db\AbstractDb +class Link extends \Magento\Model\Resource\Db\AbstractDb { /** * Catalog data @@ -42,9 +42,9 @@ class Link extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_catalogData; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\ConfigInterface */ - protected $_app; + protected $_configuration; /** * @var \Magento\Directory\Model\CurrencyFactory @@ -59,19 +59,19 @@ class Link extends \Magento\Core\Model\Resource\Db\AbstractDb /** * @param \Magento\App\Resource $resource * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Core\Model\App $app + * @param \Magento\App\ConfigInterface $configuration * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Resource $resource, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Model\App $app, + \Magento\App\ConfigInterface $configuration, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Core\Model\StoreManagerInterface $storeManager ) { $this->_catalogData = $catalogData; - $this->_app = $app; + $this->_configuration = $configuration; $this->_currencyFactory = $currencyFactory; $this->_storeManager = $storeManager; parent::__construct($resource); @@ -152,7 +152,10 @@ class Link extends \Magento\Core\Model\Resource\Db\AbstractDb if ($linkObject->getWebsiteId() == 0 && $_isNew && !$this->_catalogData->isPriceGlobal()) { $websiteIds = $linkObject->getProductWebsiteIds(); foreach ($websiteIds as $websiteId) { - $baseCurrency = $this->_app->getBaseCurrencyCode(); + $baseCurrency = $this->_configuration->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + 'default' + ); $websiteCurrency = $this->_storeManager->getWebsite($websiteId)->getBaseCurrencyCode(); if ($websiteCurrency == $baseCurrency) { continue; diff --git a/app/code/Magento/Downloadable/Model/Resource/Link/Collection.php b/app/code/Magento/Downloadable/Model/Resource/Link/Collection.php index 6ad42bd161a..ff2672fd8a0 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link/Collection.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource\Link; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init resource model diff --git a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased.php b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased.php index f380e5fc096..6a9d20e9817 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource\Link; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Purchased extends \Magento\Core\Model\Resource\Db\AbstractDb +class Purchased extends \Magento\Model\Resource\Db\AbstractDb { /** * Magento class constructor diff --git a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Collection.php b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Collection.php index a62219e7437..30c91dfbd24 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Collection.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource\Link\Purchased; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init resource model diff --git a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item.php b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item.php index a1853f60e01..4827cdb789d 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource\Link\Purchased; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\Resource\Db\AbstractDb +class Item extends \Magento\Model\Resource\Db\AbstractDb { /** * Magento class constructor diff --git a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item/Collection.php b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item/Collection.php index 8ec08268fe5..b59ab4e7006 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item/Collection.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource\Link\Purchased\Item; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init resource model diff --git a/app/code/Magento/Downloadable/Model/Resource/Sample.php b/app/code/Magento/Downloadable/Model/Resource/Sample.php index 7e9812663f9..edb3a460506 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Sample.php +++ b/app/code/Magento/Downloadable/Model/Resource/Sample.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Sample extends \Magento\Core\Model\Resource\Db\AbstractDb +class Sample extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection diff --git a/app/code/Magento/Downloadable/Model/Resource/Sample/Collection.php b/app/code/Magento/Downloadable/Model/Resource/Sample/Collection.php index 1da9fee7499..8eec8c13f6c 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Sample/Collection.php +++ b/app/code/Magento/Downloadable/Model/Resource/Sample/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource\Sample; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init resource model 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 c0559e7b9b5..1f980c823f1 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 @@ -63,7 +63,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -76,7 +76,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { 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 10e2226f5f2..ac12183be24 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 @@ -45,7 +45,7 @@ class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstr * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -59,7 +59,7 @@ class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstr \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { 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 248e29b73ff..c8afa1865e3 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 @@ -45,7 +45,7 @@ class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstract * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -59,7 +59,7 @@ class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstract \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Downloadable/Model/Sample.php b/app/code/Magento/Downloadable/Model/Sample.php index 334729ccd5d..31227c51717 100644 --- a/app/code/Magento/Downloadable/Model/Sample.php +++ b/app/code/Magento/Downloadable/Model/Sample.php @@ -43,21 +43,21 @@ namespace Magento\Downloadable\Model; * * @author Magento Core Team <core@magentocommerce.com> */ -class Sample extends \Magento\Core\Model\AbstractModel +class Sample extends \Magento\Model\AbstractModel { const XML_PATH_SAMPLES_TITLE = 'catalog/downloadable/samples_title'; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Eav/Exception.php b/app/code/Magento/Eav/Exception.php index 0d5aeeac203..d74503dfa17 100644 --- a/app/code/Magento/Eav/Exception.php +++ b/app/code/Magento/Eav/Exception.php @@ -25,6 +25,6 @@ */ namespace Magento\Eav; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Eav/Helper/Data.php b/app/code/Magento/Eav/Helper/Data.php index a06ccabbf5c..b0ecc07fb72 100644 --- a/app/code/Magento/Eav/Helper/Data.php +++ b/app/code/Magento/Eav/Helper/Data.php @@ -158,6 +158,7 @@ class Data extends \Magento\App\Helper\AbstractHelper * 'entity_type_id' => $entityTypeId, * 'attribute_id' => $attributeId, * 'attribute_table' => $attributeTable + * 'backend_type' => $backendType * ]</pre> */ public function getAttributeMetadata($entityTypeCode, $attributeCode) @@ -166,7 +167,8 @@ class Data extends \Magento\App\Helper\AbstractHelper return array( 'entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getAttributeId(), - 'attribute_table' => $attribute->getBackend()->getTable() + 'attribute_table' => $attribute->getBackend()->getTable(), + 'backend_type' => $attribute->getBackendType() ); } } diff --git a/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php b/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php index 3658d046c28..922d02a50d2 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php @@ -26,7 +26,7 @@ namespace Magento\Eav\Model\Attribute\Data; use Magento\App\RequestInterface; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; /** * EAV Attribute Abstract Data Model @@ -47,7 +47,7 @@ abstract class AbstractData /** * Entity instance * - * @var \Magento\Core\Model\AbstractModel + * @var \Magento\Model\AbstractModel */ protected $_entity; @@ -171,10 +171,10 @@ abstract class AbstractData /** * Set entity instance * - * @param \Magento\Core\Model\AbstractModel $entity + * @param \Magento\Model\AbstractModel $entity * @return $this */ - public function setEntity(\Magento\Core\Model\AbstractModel $entity) + public function setEntity(\Magento\Model\AbstractModel $entity) { $this->_entity = $entity; return $this; @@ -183,7 +183,7 @@ abstract class AbstractData /** * Returns entity instance * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ public function getEntity() { diff --git a/app/code/Magento/Eav/Model/AttributeDataFactory.php b/app/code/Magento/Eav/Model/AttributeDataFactory.php index 8215b84734a..c215478c18f 100644 --- a/app/code/Magento/Eav/Model/AttributeDataFactory.php +++ b/app/code/Magento/Eav/Model/AttributeDataFactory.php @@ -80,10 +80,10 @@ class AttributeDataFactory * Set entity to data model (need for work) * * @param \Magento\Eav\Model\Attribute $attribute - * @param \Magento\Core\Model\AbstractModel $entity + * @param \Magento\Model\AbstractModel $entity * @return \Magento\Eav\Model\Attribute\Data\AbstractData */ - public function create(\Magento\Eav\Model\Attribute $attribute, \Magento\Core\Model\AbstractModel $entity) + public function create(\Magento\Eav\Model\Attribute $attribute, \Magento\Model\AbstractModel $entity) { /* @var $dataModel \Magento\Eav\Model\Attribute\Data\AbstractData */ $dataModelClass = $attribute->getDataModel(); diff --git a/app/code/Magento/Eav/Model/Config.php b/app/code/Magento/Eav/Model/Config.php index 5ed2a3bde42..03c172d0dd4 100644 --- a/app/code/Magento/Eav/Model/Config.php +++ b/app/code/Magento/Eav/Model/Config.php @@ -104,9 +104,9 @@ class Config protected $_collectionAttributes = array(); /** - * @var \Magento\Core\Model\App + * @var \Magento\App\CacheInterface */ - protected $_app; + protected $_cache; /** * @var \Magento\Eav\Model\Entity\TypeFactory @@ -119,18 +119,18 @@ class Config protected $_universalFactory; /** - * @param \Magento\Core\Model\App $app - * @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory + * @param \Magento\App\CacheInterface $cache + * @param Entity\TypeFactory $entityTypeFactory * @param \Magento\App\Cache\StateInterface $cacheState * @param \Magento\Validator\UniversalFactory $universalFactory */ public function __construct( - \Magento\Core\Model\App $app, + \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory, \Magento\App\Cache\StateInterface $cacheState, \Magento\Validator\UniversalFactory $universalFactory ) { - $this->_app = $app; + $this->_cache = $cache; $this->_entityTypeFactory = $entityTypeFactory; $this->_cacheState = $cacheState; $this->_universalFactory = $universalFactory; @@ -281,8 +281,7 @@ class Config /** * try load information about entity types from cache */ - if ($this->_isCacheEnabled() && ($cache = $this->_app->loadCache(self::ENTITIES_CACHE_ID))) { - + if ($this->_isCacheEnabled() && ($cache = $this->_cache->load(self::ENTITIES_CACHE_ID))) { $this->_entityData = unserialize($cache); foreach ($this->_entityData as $typeCode => $data) { $typeId = $data['entity_type_id']; @@ -313,10 +312,13 @@ class Config $this->_entityData = $types; if ($this->_isCacheEnabled()) { - $this->_app->saveCache( + $this->_cache->save( serialize($this->_entityData), self::ENTITIES_CACHE_ID, - array(\Magento\Eav\Model\Cache\Type::CACHE_TAG, \Magento\Eav\Model\Entity\Attribute::CACHE_TAG) + array( + \Magento\Eav\Model\Cache\Type::CACHE_TAG, + \Magento\Eav\Model\Entity\Attribute::CACHE_TAG + ) ); } \Magento\Profiler::stop('EAV: ' . __METHOD__); @@ -328,7 +330,7 @@ class Config * * @param int|string $code * @return Type - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getEntityType($code) { @@ -363,7 +365,7 @@ class Config } if (!$entityType->getId()) { - throw new \Magento\Core\Exception(__('Invalid entity_type specified: %1', $code)); + throw new \Magento\Model\Exception(__('Invalid entity_type specified: %1', $code)); } } $this->_addEntityTypeReference($entityType->getId(), $entityType->getEntityTypeCode()); diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index 38d97534e56..e4b613ece11 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -27,9 +27,9 @@ namespace Magento\Eav\Model\Entity; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; use Magento\Eav\Model\Entity\Type; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Core\Model\Config\Element; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend; use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend; use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; @@ -41,7 +41,7 @@ use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractEntity extends \Magento\Core\Model\Resource\AbstractResource implements EntityInterface +abstract class AbstractEntity extends \Magento\Model\Resource\AbstractResource implements EntityInterface { /** * Read connection diff --git a/app/code/Magento/Eav/Model/Entity/Attribute.php b/app/code/Magento/Eav/Model/Entity/Attribute.php index 5421b2ba08c..0e09cdf90e3 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute.php @@ -91,7 +91,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Catalog\Model\ProductFactory $catalogProductFactory * @param \Magento\Locale\ResolverInterface $localeResolver - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -107,7 +107,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Catalog\Model\ProductFactory $catalogProductFactory, \Magento\Locale\ResolverInterface $localeResolver, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php index ae235f70717..90f966215b6 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -32,8 +32,7 @@ namespace Magento\Eav\Model\Entity\Attribute; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractAttribute extends \Magento\Core\Model\AbstractModel implements - \Magento\Eav\Model\Entity\Attribute\AttributeInterface +abstract class AbstractAttribute extends \Magento\Model\AbstractModel implements AttributeInterface { const TYPE_STATIC = 'static'; @@ -127,7 +126,7 @@ abstract class AbstractAttribute extends \Magento\Core\Model\AbstractModel imple * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -140,7 +139,7 @@ abstract class AbstractAttribute extends \Magento\Core\Model\AbstractModel imple \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -439,7 +438,7 @@ abstract class AbstractAttribute extends \Magento\Core\Model\AbstractModel imple * Retrieve backend instance * * @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getBackend() { @@ -478,7 +477,7 @@ abstract class AbstractAttribute extends \Magento\Core\Model\AbstractModel imple * Retrieve source instance * * @return \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getSource() { diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Group.php b/app/code/Magento/Eav/Model/Entity/Attribute/Group.php index b3f4c159d50..af9844b2ba5 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Group.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Group.php @@ -45,7 +45,7 @@ namespace Magento\Eav\Model\Entity\Attribute; * @method string getTabGroupCode() * @method \Magento\Eav\Model\Entity\Attribute\Group setTabGroupCode(string $value) */ -class Group extends \Magento\Core\Model\AbstractModel +class Group extends \Magento\Model\AbstractModel { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Option.php b/app/code/Magento/Eav/Model/Entity/Attribute/Option.php index 4c08812c31c..5379372d8a1 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Option.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Option.php @@ -39,7 +39,7 @@ namespace Magento\Eav\Model\Entity\Attribute; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\AbstractModel +class Option extends \Magento\Model\AbstractModel { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php index 706e1237733..d848a31aa18 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php @@ -44,7 +44,7 @@ namespace Magento\Eav\Model\Entity\Attribute; use Magento\Eav\Model\Entity\Type; -class Set extends \Magento\Core\Model\AbstractModel +class Set extends \Magento\Model\AbstractModel { /** * Resource instance @@ -86,7 +86,7 @@ class Set extends \Magento\Core\Model\AbstractModel * @param \Magento\Eav\Model\Entity\Attribute\GroupFactory $attrGroupFactory * @param \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute $resourceAttribute - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -97,7 +97,7 @@ class Set extends \Magento\Core\Model\AbstractModel \Magento\Eav\Model\Entity\Attribute\GroupFactory $attrGroupFactory, \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory, \Magento\Eav\Model\Resource\Entity\Attribute $resourceAttribute, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -340,7 +340,7 @@ class Set extends \Magento\Core\Model\AbstractModel /** * Get resource instance * - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @return \Magento\Model\Resource\Db\AbstractDb */ protected function _getResource() { diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index 4f641f2f8be..478ca1212df 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -270,7 +270,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db /** * Get resource instance * - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @return \Magento\Model\Resource\Db\AbstractDb */ public function getResource() { @@ -336,7 +336,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db * @param null|string|array $condition * @param string $joinType * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * * @see self::_getConditionSql for $condition */ @@ -369,7 +369,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db if (!empty($conditionSql)) { $this->getSelect()->where($conditionSql, null, \Magento\DB\Select::TYPE_CONDITION); } else { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Invalid attribute identifier for filter (%1)', get_class($attribute)) ); } diff --git a/app/code/Magento/Eav/Model/Entity/Setup.php b/app/code/Magento/Eav/Model/Entity/Setup.php index f4f08ec51c7..7e9f0104456 100644 --- a/app/code/Magento/Eav/Model/Entity/Setup.php +++ b/app/code/Magento/Eav/Model/Entity/Setup.php @@ -796,7 +796,7 @@ class Setup extends \Magento\Core\Model\Resource\Setup * * @param array $option * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addAttributeOption($option) { @@ -830,7 +830,7 @@ class Setup extends \Magento\Core\Model\Resource\Setup // Default value if (!isset($values[0])) { - throw new \Magento\Core\Exception(__('Default option value is not defined')); + throw new \Magento\Model\Exception(__('Default option value is not defined')); } $condition = array('option_id =?' => $intOptionId); $this->_connection->delete($optionValueTable, $condition); diff --git a/app/code/Magento/Eav/Model/Entity/Store.php b/app/code/Magento/Eav/Model/Entity/Store.php index e45bc6b4e98..6dd21ec323c 100644 --- a/app/code/Magento/Eav/Model/Entity/Store.php +++ b/app/code/Magento/Eav/Model/Entity/Store.php @@ -41,7 +41,7 @@ namespace Magento\Eav\Model\Entity; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Store extends \Magento\Core\Model\AbstractModel +class Store extends \Magento\Model\AbstractModel { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Entity/Type.php b/app/code/Magento/Eav/Model/Entity/Type.php index 08e71bc4bd5..5551ebd7202 100644 --- a/app/code/Magento/Eav/Model/Entity/Type.php +++ b/app/code/Magento/Eav/Model/Entity/Type.php @@ -58,7 +58,7 @@ namespace Magento\Eav\Model\Entity; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\AbstractModel +class Type extends \Magento\Model\AbstractModel { /** * Collection of attributes @@ -108,7 +108,7 @@ class Type extends \Magento\Core\Model\AbstractModel * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $attSetFactory * @param \Magento\Eav\Model\Entity\StoreFactory $storeFactory * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -119,7 +119,7 @@ class Type extends \Magento\Core\Model\AbstractModel \Magento\Eav\Model\Entity\Attribute\SetFactory $attSetFactory, \Magento\Eav\Model\Entity\StoreFactory $storeFactory, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -388,7 +388,7 @@ class Type extends \Magento\Core\Model\AbstractModel /** * Retrieve resource entity object * - * @return \Magento\Core\Model\Resource\AbstractResource + * @return \Magento\Model\Resource\AbstractResource */ public function getEntity() { diff --git a/app/code/Magento/Eav/Model/Form.php b/app/code/Magento/Eav/Model/Form.php index fb2913fdffb..2ca49c90555 100644 --- a/app/code/Magento/Eav/Model/Form.php +++ b/app/code/Magento/Eav/Model/Form.php @@ -67,7 +67,7 @@ abstract class Form /** * Current entity instance * - * @var \Magento\Core\Model\AbstractModel + * @var \Magento\Model\AbstractModel */ protected $_entity; @@ -169,7 +169,7 @@ abstract class Form * @param RequestInterface $httpRequest * @param \Magento\Validator\ConfigFactory $validatorConfigFactory * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function __construct( \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -181,10 +181,10 @@ abstract class Form \Magento\Validator\ConfigFactory $validatorConfigFactory ) { if (empty($this->_moduleName)) { - throw new \Magento\Core\Exception(__('Current module pathname is undefined')); + throw new \Magento\Model\Exception(__('Current module pathname is undefined')); } if (empty($this->_entityTypeCode)) { - throw new \Magento\Core\Exception(__('Current module EAV entity is undefined')); + throw new \Magento\Model\Exception(__('Current module EAV entity is undefined')); } $this->_storeManager = $storeManager; $this->_eavConfig = $eavConfig; @@ -238,10 +238,10 @@ abstract class Form /** * Set entity instance * - * @param \Magento\Core\Model\AbstractModel $entity + * @param \Magento\Model\AbstractModel $entity * @return $this */ - public function setEntity(\Magento\Core\Model\AbstractModel $entity) + public function setEntity(\Magento\Model\AbstractModel $entity) { $this->_entity = $entity; if ($entity->getEntityTypeId()) { @@ -290,13 +290,13 @@ abstract class Form /** * Return current form code * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return string */ public function getFormCode() { if (empty($this->_formCode)) { - throw new \Magento\Core\Exception(__('Form code is not defined')); + throw new \Magento\Model\Exception(__('Form code is not defined')); } return $this->_formCode; } @@ -318,13 +318,13 @@ abstract class Form /** * Return current entity instance * - * @throws \Magento\Core\Exception - * @return \Magento\Core\Model\AbstractModel + * @throws \Magento\Model\Exception + * @return \Magento\Model\AbstractModel */ public function getEntity() { if (is_null($this->_entity)) { - throw new \Magento\Core\Exception(__('Entity instance is not defined')); + throw new \Magento\Model\Exception(__('Entity instance is not defined')); } return $this->_entity; } diff --git a/app/code/Magento/Eav/Model/Form/Element.php b/app/code/Magento/Eav/Model/Form/Element.php index ea60b5c88d6..cf86631afa1 100644 --- a/app/code/Magento/Eav/Model/Form/Element.php +++ b/app/code/Magento/Eav/Model/Form/Element.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Form; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Eav Form Element Model @@ -44,7 +44,7 @@ use Magento\Core\Exception; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Element extends \Magento\Core\Model\AbstractModel +class Element extends \Magento\Model\AbstractModel { /** * Prefix of model events names @@ -62,7 +62,7 @@ class Element extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -70,7 +70,7 @@ class Element extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Eav/Model/Form/Fieldset.php b/app/code/Magento/Eav/Model/Form/Fieldset.php index c2577394a6d..61175e140c3 100644 --- a/app/code/Magento/Eav/Model/Form/Fieldset.php +++ b/app/code/Magento/Eav/Model/Form/Fieldset.php @@ -40,7 +40,7 @@ namespace Magento\Eav\Model\Form; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Fieldset extends \Magento\Core\Model\AbstractModel +class Fieldset extends \Magento\Model\AbstractModel { /** * Prefix of model events names @@ -58,7 +58,7 @@ class Fieldset extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -66,7 +66,7 @@ class Fieldset extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -107,13 +107,13 @@ class Fieldset extends \Magento\Core\Model\AbstractModel /** * Validate data before save data * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ protected function _beforeSave() { if (!$this->getTypeId()) { - throw new \Magento\Core\Exception(__('Invalid form type.')); + throw new \Magento\Model\Exception(__('Invalid form type.')); } if (!$this->getStoreId() && $this->getLabel()) { $this->setStoreLabel($this->getStoreId(), $this->getLabel()); diff --git a/app/code/Magento/Eav/Model/Form/Type.php b/app/code/Magento/Eav/Model/Form/Type.php index 17e7efd5f99..a4837028e39 100644 --- a/app/code/Magento/Eav/Model/Form/Type.php +++ b/app/code/Magento/Eav/Model/Form/Type.php @@ -44,7 +44,7 @@ namespace Magento\Eav\Model\Form; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\AbstractModel +class Type extends \Magento\Model\AbstractModel { /** * Prefix of model events names @@ -68,7 +68,7 @@ class Type extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Eav\Model\Form\FieldsetFactory $fieldsetFactory * @param \Magento\Eav\Model\Form\ElementFactory $elementFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -77,7 +77,7 @@ class Type extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Eav\Model\Form\FieldsetFactory $fieldsetFactory, \Magento\Eav\Model\Form\ElementFactory $elementFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Eav/Model/Resource/Attribute.php b/app/code/Magento/Eav/Model/Resource/Attribute.php index 2ae9f4ce968..179fc3efc56 100644 --- a/app/code/Magento/Eav/Model/Resource/Attribute.php +++ b/app/code/Magento/Eav/Model/Resource/Attribute.php @@ -34,7 +34,7 @@ */ namespace Magento\Eav\Model\Resource; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\DB\Select; abstract class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute diff --git a/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php b/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php index ff1b6529974..a0c60e77ab5 100644 --- a/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php @@ -73,7 +73,7 @@ abstract class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\C * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -83,7 +83,7 @@ abstract class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\C \Magento\Eav\Model\Config $eavConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_eavConfig = $eavConfig; diff --git a/app/code/Magento/Eav/Model/Resource/Config.php b/app/code/Magento/Eav/Model/Resource/Config.php index 28f4d09b52a..d4b5fcb2786 100644 --- a/app/code/Magento/Eav/Model/Resource/Config.php +++ b/app/code/Magento/Eav/Model/Resource/Config.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Config extends \Magento\Core\Model\Resource\Db\AbstractDb +class Config extends \Magento\Model\Resource\Db\AbstractDb { /** * Array of entity types diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php index 35eb396c874..d78e459d12d 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Resource\Entity; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Eav\Model\Entity\Attribute as EntityAttribute; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; use Magento\DB\Select; @@ -37,7 +37,7 @@ use Magento\DB\Select; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb +class Attribute extends \Magento\Model\Resource\Db\AbstractDb { /** * Eav Entity attributes cache @@ -46,13 +46,6 @@ class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected static $_entityAttributes = array(); - /** - * Application instance - * - * @var \Magento\Core\Model\App - */ - protected $_application; - /** * @var \Magento\Core\Model\StoreManagerInterface */ @@ -201,14 +194,14 @@ class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param EntityAttribute|AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave(AbstractModel $object) { $frontendLabel = $object->getFrontendLabel(); if (is_array($frontendLabel)) { if (!isset($frontendLabel[0]) || is_null($frontendLabel[0]) || $frontendLabel[0] == '') { - throw new \Magento\Core\Exception(__('Frontend label is not defined')); + throw new \Magento\Model\Exception(__('Frontend label is not defined')); } $object->setFrontendLabel($frontendLabel[0])->setStoreLabels($frontendLabel); } @@ -389,12 +382,12 @@ class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param array $values * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _checkDefaultOptionValue($values) { if (!isset($values[0])) { - throw new \Magento\Core\Exception(__('Default option value is not defined')); + throw new \Magento\Model\Exception(__('Default option value is not defined')); } } diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Collection.php index 5ff036c4ae6..a93fc9ecad9 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Collection.php @@ -34,7 +34,7 @@ use Magento\Eav\Model\Entity\Type; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Add attribute set info flag @@ -379,7 +379,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * Ad information about attribute sets to collection result data * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ protected function _afterLoadData() { diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php index 76fd59d47a9..5821638bcf1 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Resource\Entity\Attribute\Grid; -use Magento\Core\Model\Resource\Db\Collection\AbstractCollection; +use Magento\Model\Resource\Db\Collection\AbstractCollection; /** * Eav Resource Attribute Set Collection @@ -48,7 +48,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Set\Collec * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Registry $registryManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -57,7 +57,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Set\Collec \Magento\Event\ManagerInterface $eventManager, \Magento\Registry $registryManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_registryManager = $registryManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group.php index 8fcdc767d8d..8533ed7ed95 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Attribute; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Group extends \Magento\Core\Model\Resource\Db\AbstractDb +class Group extends \Magento\Model\Resource\Db\AbstractDb { /** * Constants for attribute group codes @@ -78,10 +78,10 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if (!$object->getSortOrder()) { $object->setSortOrder($this->_getMaxSortOrder($object) + 1); @@ -92,10 +92,10 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { if ($object->getAttributes()) { foreach ($object->getAttributes() as $attribute) { @@ -110,7 +110,7 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Retrieve max sort order * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return int */ protected function _getMaxSortOrder($object) diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group/Collection.php index 259dcb412f4..1eeeb3050d4 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Attribute\Group; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init resource model for collection diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option.php index d9716b56032..22777268d1b 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Attribute; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\Resource\Db\AbstractDb +class Option extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php index 5f1b719a759..415d49834bf 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Attribute\Option; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Option value table @@ -59,7 +59,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\App\Resource $coreResource * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -69,7 +69,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\App\Resource $coreResource, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_coreResource = $coreResource; diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set.php index f9033d9b997..f7c9d7608a6 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Attribute; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Set extends \Magento\Core\Model\Resource\Db\AbstractDb +class Set extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Eav\Model\Resource\Entity\Attribute\GroupFactory @@ -64,10 +64,10 @@ class Set extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { if ($object->getGroups()) { /* @var $group \Magento\Eav\Model\Entity\Attribute\Group */ diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set/Collection.php index 8a47097f54a..28156238fb6 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Attribute\Set; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Store.php b/app/code/Magento/Eav/Model/Resource/Entity/Store.php index 614b9aff8d9..02ed7d1ebff 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Store.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Store.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Resource\Entity; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Object; /** @@ -35,7 +35,7 @@ use Magento\Object; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Store extends \Magento\Core\Model\Resource\Db\AbstractDb +class Store extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Type.php b/app/code/Magento/Eav/Model/Resource/Entity/Type.php index 8c2ecec698a..543023a4ac4 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Type.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Type.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\Resource\Db\AbstractDb +class Type extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization @@ -47,7 +47,7 @@ class Type extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Load Entity Type by Code * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $code * @return $this */ diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Type/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Type/Collection.php index 5aa5a39dad0..90251c81727 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Type/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Type/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Type; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Resource/Form/Attribute.php b/app/code/Magento/Eav/Model/Resource/Form/Attribute.php index 86040f18073..bef72498c9a 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Attribute.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Attribute.php @@ -34,7 +34,7 @@ */ namespace Magento\Eav\Model\Resource\Form; -abstract class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class Attribute extends \Magento\Model\Resource\Db\AbstractDb { /** * Return form attribute IDs by form code diff --git a/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php b/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php index 22d4b7660df..c877b8cdea0 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Form\Attribute; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Current module pathname @@ -80,7 +80,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -90,7 +90,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Eav\Model\Config $eavConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_eavConfig = $eavConfig; @@ -101,15 +101,15 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * Resource initialization * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _construct() { if (empty($this->_moduleName)) { - throw new \Magento\Core\Exception(__('Current module pathname is undefined')); + throw new \Magento\Model\Exception(__('Current module pathname is undefined')); } if (empty($this->_entityTypeCode)) { - throw new \Magento\Core\Exception(__('Current module EAV entity is undefined')); + throw new \Magento\Model\Exception(__('Current module EAV entity is undefined')); } } diff --git a/app/code/Magento/Eav/Model/Resource/Form/Element.php b/app/code/Magento/Eav/Model/Resource/Form/Element.php index 2a60ee19e92..5eeac8a51a7 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Element.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Element.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Form; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Element extends \Magento\Core\Model\Resource\Db\AbstractDb +class Element extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table diff --git a/app/code/Magento/Eav/Model/Resource/Form/Element/Collection.php b/app/code/Magento/Eav/Model/Resource/Form/Element/Collection.php index 139b94794ac..18d39e56eec 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Element/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Element/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Form\Element; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize collection model diff --git a/app/code/Magento/Eav/Model/Resource/Form/Fieldset.php b/app/code/Magento/Eav/Model/Resource/Form/Fieldset.php index fe63e9e71d1..51b78898af2 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Fieldset.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Fieldset.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Resource\Form; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Eav\Model\Form\Fieldset as FormFieldset; use Magento\DB\Select; @@ -36,7 +36,7 @@ use Magento\DB\Select; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Fieldset extends \Magento\Core\Model\Resource\Db\AbstractDb +class Fieldset extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table diff --git a/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php b/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php index a9944840ea7..192e3ebd30f 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php @@ -36,7 +36,7 @@ namespace Magento\Eav\Model\Resource\Form\Fieldset; use Magento\Eav\Model\Form\Type; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store scope ID @@ -57,7 +57,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -66,7 +66,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Eav/Model/Resource/Form/Type.php b/app/code/Magento/Eav/Model/Resource/Form/Type.php index 9bf216d7714..c7003f41c1a 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Type.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Type.php @@ -26,7 +26,7 @@ namespace Magento\Eav\Model\Resource\Form; use Magento\Eav\Model\Form\Type as FormType; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Eav Form Type Resource Model @@ -35,7 +35,7 @@ use Magento\Core\Model\AbstractModel; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\Resource\Db\AbstractDb +class Type extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table @@ -93,7 +93,7 @@ class Type extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save entity types after save form type * - * @see \Magento\Core\Model\Resource\Db\AbstractDb#_afterSave($object) + * @see \Magento\Model\Resource\Db\AbstractDb#_afterSave($object) * * @param FormType|AbstractModel $object * @return $this diff --git a/app/code/Magento/Eav/Model/Resource/Form/Type/Collection.php b/app/code/Magento/Eav/Model/Resource/Form/Type/Collection.php index 7190125885c..024d5c18f7c 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Type/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Type/Collection.php @@ -36,7 +36,7 @@ namespace Magento\Eav\Model\Resource\Form\Type; use Magento\Eav\Model\Entity\Type; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize collection model diff --git a/app/code/Magento/Eav/Model/Resource/Helper.php b/app/code/Magento/Eav/Model/Resource/Helper.php index c78e87d1a96..602fd034db6 100644 --- a/app/code/Magento/Eav/Model/Resource/Helper.php +++ b/app/code/Magento/Eav/Model/Resource/Helper.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Helper extends \Magento\Core\Model\Resource\Helper +class Helper extends \Magento\DB\Helper { /** * Construct diff --git a/app/code/Magento/Eav/Model/Validator/Attribute/Backend.php b/app/code/Magento/Eav/Model/Validator/Attribute/Backend.php index 6af08c2c721..c0df9676607 100644 --- a/app/code/Magento/Eav/Model/Validator/Attribute/Backend.php +++ b/app/code/Magento/Eav/Model/Validator/Attribute/Backend.php @@ -37,15 +37,15 @@ class Backend extends \Magento\Validator\AbstractValidator /** * Returns true if and only if $value meets the validation requirements. * - * @param \Magento\Core\Model\AbstractModel $entity + * @param \Magento\Model\AbstractModel $entity * @return bool * @throws \InvalidArgumentException */ public function isValid($entity) { $this->_messages = array(); - if (!$entity instanceof \Magento\Core\Model\AbstractModel) { - throw new \InvalidArgumentException('Model must be extended from \Magento\Core\Model\AbstractModel'); + if (!$entity instanceof \Magento\Model\AbstractModel) { + throw new \InvalidArgumentException('Model must be extended from \Magento\Model\AbstractModel'); } /** @var \Magento\Eav\Model\Entity\AbstractEntity $resource */ $resource = $entity->getResource(); @@ -72,7 +72,7 @@ class Backend extends \Magento\Validator\AbstractValidator } elseif (is_string($result)) { $this->_messages[$attribute->getAttributeCode()][] = $result; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_messages[$attribute->getAttributeCode()][] = $e->getMessage(); } } diff --git a/app/code/Magento/Eav/Model/Validator/Attribute/Data.php b/app/code/Magento/Eav/Model/Validator/Attribute/Data.php index ab6efff5c83..cba4be41f43 100644 --- a/app/code/Magento/Eav/Model/Validator/Attribute/Data.php +++ b/app/code/Magento/Eav/Model/Validator/Attribute/Data.php @@ -125,7 +125,7 @@ class Data extends \Magento\Validator\AbstractValidator /** * Validate EAV model attributes with data models * - * @param \Magento\Core\Model\AbstractModel $entity + * @param \Magento\Model\AbstractModel $entity * @return bool */ public function isValid($entity) @@ -174,10 +174,9 @@ class Data extends \Magento\Validator\AbstractValidator if ($this->_attributes) { $attributes = $this->_attributes; - } elseif ($entity instanceof \Magento\Core\Model\AbstractModel && + } elseif ($entity instanceof \Magento\Model\AbstractModel && $entity->getResource() instanceof \Magento\Eav\Model\Entity\AbstractEntity - ) { - // $entity is EAV-model + ) { // $entity is EAV-model $attributes = $entity->getEntityType()->getAttributeCollection()->getItems(); } diff --git a/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php b/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php index 0ecef8a001a..77d4bb165cf 100644 --- a/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php +++ b/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php @@ -198,7 +198,7 @@ class Template extends \Magento\Backend\App\Action // go to grid $this->_redirect('adminhtml/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError( diff --git a/app/code/Magento/Email/Model/Resource/Template.php b/app/code/Magento/Email/Model/Resource/Template.php index fc58c04f8ca..f555bf9db92 100644 --- a/app/code/Magento/Email/Model/Resource/Template.php +++ b/app/code/Magento/Email/Model/Resource/Template.php @@ -25,7 +25,7 @@ */ namespace Magento\Email\Model\Resource; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Template db resource @@ -34,7 +34,7 @@ use Magento\Core\Model\AbstractModel; * @package Magento_Email * @author Magento Core Team <core@magentocommerce.com> */ -class Template extends \Magento\Core\Model\Resource\Db\AbstractDb +class Template extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime diff --git a/app/code/Magento/Email/Model/Resource/Template/Collection.php b/app/code/Magento/Email/Model/Resource/Template/Collection.php index a8b5d5aad0a..238e077f033 100644 --- a/app/code/Magento/Email/Model/Resource/Template/Collection.php +++ b/app/code/Magento/Email/Model/Resource/Template/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Email\Model\Resource\Template; * @package Magento_Email * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Template table name diff --git a/app/code/Magento/Email/Model/Template.php b/app/code/Magento/Email/Model/Template.php index f2ed3964882..b5ea656352f 100644 --- a/app/code/Magento/Email/Model/Template.php +++ b/app/code/Magento/Email/Model/Template.php @@ -25,7 +25,7 @@ */ namespace Magento\Email\Model; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Email\Model\Template\Filter; use Magento\Filter\Template as FilterTemplate; diff --git a/app/code/Magento/GiftMessage/Model/Message.php b/app/code/Magento/GiftMessage/Model/Message.php index f106b8ae7e4..f5c3c1dd475 100644 --- a/app/code/Magento/GiftMessage/Model/Message.php +++ b/app/code/Magento/GiftMessage/Model/Message.php @@ -43,7 +43,7 @@ namespace Magento\GiftMessage\Model; * @package Magento_GiftMessage * @author Magento Core Team <core@magentocommerce.com> */ -class Message extends \Magento\Core\Model\AbstractModel +class Message extends \Magento\Model\AbstractModel { /** * @var \Magento\GiftMessage\Model\TypeFactory diff --git a/app/code/Magento/GiftMessage/Model/Resource/Message.php b/app/code/Magento/GiftMessage/Model/Resource/Message.php index dabebf2623b..7d792ebb4c6 100644 --- a/app/code/Magento/GiftMessage/Model/Resource/Message.php +++ b/app/code/Magento/GiftMessage/Model/Resource/Message.php @@ -32,7 +32,7 @@ namespace Magento\GiftMessage\Model\Resource; * @package Magento_GiftMessage * @author Magento Core Team <core@magentocommerce.com> */ -class Message extends \Magento\Core\Model\Resource\Db\AbstractDb +class Message extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/GiftMessage/Model/Resource/Message/Collection.php b/app/code/Magento/GiftMessage/Model/Resource/Message/Collection.php index ae476f41227..e92f31e304f 100644 --- a/app/code/Magento/GiftMessage/Model/Resource/Message/Collection.php +++ b/app/code/Magento/GiftMessage/Model/Resource/Message/Collection.php @@ -32,7 +32,7 @@ namespace Magento\GiftMessage\Model\Resource\Message; * @package Magento_GiftMessage * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource model diff --git a/app/code/Magento/GiftMessage/Model/TypeFactory.php b/app/code/Magento/GiftMessage/Model/TypeFactory.php index 3dd95710ca5..8ef8d20bf8b 100644 --- a/app/code/Magento/GiftMessage/Model/TypeFactory.php +++ b/app/code/Magento/GiftMessage/Model/TypeFactory.php @@ -65,13 +65,13 @@ class TypeFactory * * @param string $eavType * @return mixed - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function createType($eavType) { $types = $this->_allowedEntityTypes; if (!isset($types[$eavType])) { - throw new \Magento\Core\Exception(__('Unknown entity type')); + throw new \Magento\Model\Exception(__('Unknown entity type')); } return $this->_objectManager->create($types[$eavType]); } diff --git a/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php b/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php index b49e6599527..6d4c08c95fe 100644 --- a/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php +++ b/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php @@ -47,7 +47,7 @@ abstract class AbstractConversion extends \Magento\Core\Model\Config\Value * @param \Magento\App\ConfigInterface $config * @param \Magento\Validator\ObjectFactory $validatorCompositeFactory * @param \Magento\GoogleAdwords\Model\Validator\Factory $validatorFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -58,7 +58,7 @@ abstract class AbstractConversion extends \Magento\Core\Model\Config\Value \Magento\App\ConfigInterface $config, \Magento\Validator\ObjectFactory $validatorCompositeFactory, \Magento\GoogleAdwords\Model\Validator\Factory $validatorFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/GoogleOptimizer/Helper/Code.php b/app/code/Magento/GoogleOptimizer/Helper/Code.php index bdc1b5e8ade..96a311a2687 100644 --- a/app/code/Magento/GoogleOptimizer/Helper/Code.php +++ b/app/code/Magento/GoogleOptimizer/Helper/Code.php @@ -33,7 +33,7 @@ class Code protected $_codeModel; /** - * @var \Magento\Core\Model\AbstractModel + * @var \Magento\Model\AbstractModel */ protected $_entity; @@ -48,10 +48,10 @@ class Code /** * Get loaded Code object by Entity * - * @param \Magento\Core\Model\AbstractModel $entity + * @param \Magento\Model\AbstractModel $entity * @return \Magento\GoogleOptimizer\Model\Code */ - public function getCodeObjectByEntity(\Magento\Core\Model\AbstractModel $entity) + public function getCodeObjectByEntity(\Magento\Model\AbstractModel $entity) { $this->_entity = $entity; diff --git a/app/code/Magento/GoogleOptimizer/Model/Code.php b/app/code/Magento/GoogleOptimizer/Model/Code.php index 4ce03f74624..6da6a135d29 100644 --- a/app/code/Magento/GoogleOptimizer/Model/Code.php +++ b/app/code/Magento/GoogleOptimizer/Model/Code.php @@ -35,7 +35,7 @@ namespace Magento\GoogleOptimizer\Model; * @method \Magento\GoogleOptimizer\Model\Code setExperimentScript(int $value) * @method string getExperimentScript() */ -class Code extends \Magento\Core\Model\AbstractModel +class Code extends \Magento\Model\AbstractModel { /**#@+ * Entity types diff --git a/app/code/Magento/GoogleOptimizer/Model/Resource/Code.php b/app/code/Magento/GoogleOptimizer/Model/Resource/Code.php index fa49252f88d..ccac9852e10 100644 --- a/app/code/Magento/GoogleOptimizer/Model/Resource/Code.php +++ b/app/code/Magento/GoogleOptimizer/Model/Resource/Code.php @@ -25,7 +25,7 @@ */ namespace Magento\GoogleOptimizer\Model\Resource; -class Code extends \Magento\Core\Model\Resource\Db\AbstractDb +class Code extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php index 52417f9252b..44dd4de0209 100644 --- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php +++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php @@ -396,7 +396,7 @@ class Items extends \Magento\Backend\App\Action * Get store object, basing on request * * @return \Magento\Core\Model\Store - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function _getStore() { @@ -406,7 +406,7 @@ class Items extends \Magento\Backend\App\Action (int)$this->getRequest()->getParam('store', 0) ); if (!$store || 0 == $store->getId()) { - throw new \Magento\Core\Exception(__('Unable to select a Store View')); + throw new \Magento\Model\Exception(__('Unable to select a Store View')); } return $store; } diff --git a/app/code/Magento/GoogleShopping/Model/Attribute.php b/app/code/Magento/GoogleShopping/Model/Attribute.php index 122ffae96dd..4cfbf952a26 100644 --- a/app/code/Magento/GoogleShopping/Model/Attribute.php +++ b/app/code/Magento/GoogleShopping/Model/Attribute.php @@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Attribute extends \Magento\Core\Model\AbstractModel +class Attribute extends \Magento\Model\AbstractModel { /** * Default ignored attribute codes diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/DefaultAttribute.php b/app/code/Magento/GoogleShopping/Model/Attribute/DefaultAttribute.php index 7440c490440..1668b45c271 100644 --- a/app/code/Magento/GoogleShopping/Model/Attribute/DefaultAttribute.php +++ b/app/code/Magento/GoogleShopping/Model/Attribute/DefaultAttribute.php @@ -131,7 +131,7 @@ class DefaultAttribute extends \Magento\GoogleShopping\Model\Attribute protected function _setAttribute($entry, $name, $type = self::ATTRIBUTE_TYPE_TEXT, $value = '', $unit = null) { if (is_object($value) || (string)$value != $value) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Please correct the attribute "%1" type for Google Shopping. The product with this attribute hasn\'t been updated in Google Content.', $name diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/Tax.php b/app/code/Magento/GoogleShopping/Model/Attribute/Tax.php index 1f18aefa166..61b1657f2fb 100644 --- a/app/code/Magento/GoogleShopping/Model/Attribute/Tax.php +++ b/app/code/Magento/GoogleShopping/Model/Attribute/Tax.php @@ -116,7 +116,7 @@ class Tax extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute $regions = $this->_parseRegions($rate['state'], $rate['postcode']); $ratesTotal += count($regions); if ($ratesTotal > self::RATES_MAX) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __("Google shopping only supports %1 tax rates per product", self::RATES_MAX) ); } diff --git a/app/code/Magento/GoogleShopping/Model/Flag.php b/app/code/Magento/GoogleShopping/Model/Flag.php index 6fd3f467ef9..bf04d912d71 100644 --- a/app/code/Magento/GoogleShopping/Model/Flag.php +++ b/app/code/Magento/GoogleShopping/Model/Flag.php @@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Flag extends \Magento\Core\Model\Flag +class Flag extends \Magento\Flag { /** * Flag time to live in seconds diff --git a/app/code/Magento/GoogleShopping/Model/Item.php b/app/code/Magento/GoogleShopping/Model/Item.php index 9e84bf4fd34..592d56705b7 100644 --- a/app/code/Magento/GoogleShopping/Model/Item.php +++ b/app/code/Magento/GoogleShopping/Model/Item.php @@ -34,7 +34,7 @@ use Magento\Catalog\Model\Product as CatalogModelProduct; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { /** * Registry keys for caching attributes and types @@ -213,7 +213,7 @@ class Item extends \Magento\Core\Model\AbstractModel $attributeSetId = $this->getProduct()->getAttributeSetId(); $targetCountry = $this->getTargetCountry(); - $registry = $this->_coreRegistry->registry(self::TYPES_REGISTRY_KEY); + $registry = $this->_registry->registry(self::TYPES_REGISTRY_KEY); if (is_array($registry) && isset($registry[$attributeSetId][$targetCountry])) { return $registry[$attributeSetId][$targetCountry]; } @@ -221,8 +221,8 @@ class Item extends \Magento\Core\Model\AbstractModel $type = $this->_typeFactory->create()->loadByAttributeSetId($attributeSetId, $targetCountry); $registry[$attributeSetId][$targetCountry] = $type; - $this->_coreRegistry->unregister(self::TYPES_REGISTRY_KEY); - $this->_coreRegistry->register(self::TYPES_REGISTRY_KEY, $registry); + $this->_registry->unregister(self::TYPES_REGISTRY_KEY); + $this->_registry->register(self::TYPES_REGISTRY_KEY, $registry); return $type; } diff --git a/app/code/Magento/GoogleShopping/Model/MassOperations.php b/app/code/Magento/GoogleShopping/Model/MassOperations.php index ba530fe7364..e51919f471b 100644 --- a/app/code/Magento/GoogleShopping/Model/MassOperations.php +++ b/app/code/Magento/GoogleShopping/Model/MassOperations.php @@ -25,7 +25,7 @@ */ namespace Magento\GoogleShopping\Model; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; use Magento\GoogleShopping\Model\Resource\Item\Collection as ItemCollection; /** diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Attribute.php b/app/code/Magento/GoogleShopping/Model/Resource/Attribute.php index 777744e3f13..08332663a55 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Attribute.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Attribute.php @@ -33,7 +33,7 @@ */ namespace Magento\GoogleShopping\Model\Resource; -class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb +class Attribute extends \Magento\Model\Resource\Db\AbstractDb { /** * @return void diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Attribute/Collection.php b/app/code/Magento/GoogleShopping/Model/Resource/Attribute/Collection.php index 3f31195f4c6..d1b59f391d2 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Attribute/Collection.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Attribute/Collection.php @@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model\Resource\Attribute; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Whether to join attribute_set_id to attributes or not diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Item.php b/app/code/Magento/GoogleShopping/Model/Resource/Item.php index bd9dc1ec8e0..b9574ee0bdf 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Item.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Item.php @@ -33,7 +33,7 @@ */ namespace Magento\GoogleShopping\Model\Resource; -class Item extends \Magento\Core\Model\Resource\Db\AbstractDb +class Item extends \Magento\Model\Resource\Db\AbstractDb { /** * @return void diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Item/Collection.php b/app/code/Magento/GoogleShopping/Model/Resource/Item/Collection.php index 2aecfe06a7c..3cc5fb12e21 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Item/Collection.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Item/Collection.php @@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model\Resource\Item; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Config @@ -44,7 +44,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * Resource helper * - * @var \Magento\Core\Model\Resource\Helper + * @var \Magento\DB\Helper */ protected $_resourceHelper; @@ -53,20 +53,20 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Eav\Model\Config $config * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Eav\Model\Config $config, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_resourceHelper = $resourceHelper; $this->_eavConfig = $config; diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Type.php b/app/code/Magento/GoogleShopping/Model/Resource/Type.php index 96390f919cb..9d9c327ba8b 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Type.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Type.php @@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model\Resource; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\Resource\Db\AbstractDb +class Type extends \Magento\Model\Resource\Db\AbstractDb { /** * @return void diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Type/Collection.php b/app/code/Magento/GoogleShopping/Model/Resource/Type/Collection.php index 86fb1fd529b..16289de6beb 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Type/Collection.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Type/Collection.php @@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model\Resource\Type; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @return void diff --git a/app/code/Magento/GoogleShopping/Model/Service.php b/app/code/Magento/GoogleShopping/Model/Service.php index e7aad0225a7..5c1c1f88c3b 100644 --- a/app/code/Magento/GoogleShopping/Model/Service.php +++ b/app/code/Magento/GoogleShopping/Model/Service.php @@ -106,7 +106,7 @@ class Service extends \Magento\Object * @param int $storeId * @param string $loginToken * @param string $loginCaptcha - * @throws \Magento\Core\Exception On http connection failure + * @throws \Magento\Model\Exception On http connection failure * @return \Zend_Http_Client */ public function getClient($storeId = null, $loginToken = null, $loginCaptcha = null) @@ -139,9 +139,9 @@ class Service extends \Magento\Object } catch (\Zend_Gdata_App_CaptchaRequiredException $e) { throw $e; } catch (\Zend_Gdata_App_HttpException $e) { - throw new \Magento\Core\Exception($errorMsg . __('Error: %1', $e->getMessage())); + throw new \Magento\Model\Exception($errorMsg . __('Error: %1', $e->getMessage())); } catch (\Zend_Gdata_App_AuthException $e) { - throw new \Magento\Core\Exception($errorMsg . __('Error: %1', $e->getMessage())); + throw new \Magento\Model\Exception($errorMsg . __('Error: %1', $e->getMessage())); } return $this->_coreRegistry->registry($this->_clientRegistryId); diff --git a/app/code/Magento/GoogleShopping/Model/Type.php b/app/code/Magento/GoogleShopping/Model/Type.php index 5e99728b64b..0600c79307b 100644 --- a/app/code/Magento/GoogleShopping/Model/Type.php +++ b/app/code/Magento/GoogleShopping/Model/Type.php @@ -35,7 +35,7 @@ use Magento\Gdata\Gshopping\Entry; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\AbstractModel +class Type extends \Magento\Model\AbstractModel { /** * Mapping attributes collection diff --git a/app/code/Magento/GoogleShopping/etc/di.xml b/app/code/Magento/GoogleShopping/etc/di.xml index 2489566795b..2f8482ad857 100644 --- a/app/code/Magento/GoogleShopping/etc/di.xml +++ b/app/code/Magento/GoogleShopping/etc/di.xml @@ -24,7 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> - <virtualType name="Magento\GoogleShopping\Model\Resource\Helper" type="Magento\Core\Model\Resource\Helper"> + <virtualType name="Magento\GoogleShopping\Model\Resource\Helper" type="Magento\DB\Helper"> <arguments> <argument name="modulePrefix" xsi:type="string">Core</argument> </arguments> diff --git a/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php b/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php index 5ccf7b31829..4d0a48ba49b 100644 --- a/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php +++ b/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php @@ -29,6 +29,9 @@ */ namespace Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset; +use Magento\Customer\Controller\RegistryConstants; +use Magento\Customer\Service\V1\CustomerAccountServiceInterface as CustomerAccountService; + /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -50,57 +53,33 @@ class Grouped extends \Magento\GroupedProduct\Block\Product\View\Type\Grouped protected $_coreHelper; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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 + * @var CustomerAccountService + */ + protected $_customerAccountService; + + /** + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param \Magento\Catalog\Helper\Product\Price $priceHelper * @param \Magento\Core\Helper\Data $coreHelper + * @param CustomerAccountService $customerAccountService * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Catalog\Helper\Product\Price $priceHelper, \Magento\Core\Helper\Data $coreHelper, + CustomerAccountService $customerAccountService, array $data = array(), array $priceBlockTypes = array() ) { + $this->_customerAccountService = $customerAccountService; $this->_coreHelper = $coreHelper; $this->priceHelper = $priceHelper; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $arrayUtils, $data, $priceBlockTypes @@ -120,8 +99,11 @@ class Grouped extends \Magento\GroupedProduct\Block\Product\View\Type\Grouped $this->_block = 'Magento\Catalog\Block\Adminhtml\Product\Price'; $this->_useLinkForAsLowAs = false; - if (!$this->priceHelper->getCustomer() && $this->_coreRegistry->registry('current_customer')) { - $this->priceHelper->setCustomer($this->_coreRegistry->registry('current_customer')); + if (is_null($this->priceHelper->getCustomer()->getId()) + && $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID) + ) { + $customerId = $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->priceHelper->setCustomer($this->_customerAccountService->getCustomer($customerId)); } } diff --git a/app/code/Magento/GroupedProduct/etc/module.xml b/app/code/Magento/GroupedProduct/etc/module.xml index bf60b8e7d9f..c49b99b70a4 100644 --- a/app/code/Magento/GroupedProduct/etc/module.xml +++ b/app/code/Magento/GroupedProduct/etc/module.xml @@ -37,7 +37,6 @@ <module name="Magento_Core" /> <module name="Magento_Tax" /> <module name="Magento_Checkout" /> - <module name="Magento_Wishlist" /> <module name="Magento_Backend" /> <module name="Magento_Eav" /> <module name="Magento_Customer" /> diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Form/After.php b/app/code/Magento/ImportExport/Block/Adminhtml/Form/After.php index 0913db1759b..8242604f247 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Form/After.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Form/After.php @@ -53,7 +53,7 @@ class After extends \Magento\Backend\Block\Template /** * Get current operation * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ public function getOperation() { diff --git a/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php b/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php index 8f003dac2e2..50fab907812 100644 --- a/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php +++ b/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php @@ -95,7 +95,7 @@ class Export extends \Magento\Backend\App\Action \Magento\App\Filesystem::VAR_DIR, $model->getContentType() ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); diff --git a/app/code/Magento/ImportExport/Model/Export.php b/app/code/Magento/ImportExport/Model/Export.php index 502cba40281..3b78be53604 100644 --- a/app/code/Magento/ImportExport/Model/Export.php +++ b/app/code/Magento/ImportExport/Model/Export.php @@ -106,7 +106,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * Create instance of entity adapter and return it * * @return \Magento\ImportExport\Model\Export\Entity\AbstractEntity|\Magento\ImportExport\Model\Export\AbstractEntity - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getEntityAdapter() { @@ -118,12 +118,12 @@ class Export extends \Magento\ImportExport\Model\AbstractModel $this->_entityAdapter = $this->_entityFactory->create($entities[$this->getEntity()]['model']); } catch (\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('Please enter a correct entity model')); + throw new \Magento\Model\Exception(__('Please enter a correct entity model')); } if (!$this->_entityAdapter instanceof \Magento\ImportExport\Model\Export\Entity\AbstractEntity && !$this->_entityAdapter instanceof \Magento\ImportExport\Model\Export\AbstractEntity ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Entity adapter object must be an instance of %1 or %2', 'Magento\ImportExport\Model\Export\Entity\AbstractEntity', @@ -134,12 +134,12 @@ class Export extends \Magento\ImportExport\Model\AbstractModel // check for entity codes integrity if ($this->getEntity() != $this->_entityAdapter->getEntityTypeCode()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The input entity code is not equal to entity adapter code.') ); } } else { - throw new \Magento\Core\Exception(__('Please enter a correct entity.')); + throw new \Magento\Model\Exception(__('Please enter a correct entity.')); } $this->_entityAdapter->setParameters($this->getData()); } @@ -150,7 +150,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * Get writer object. * * @return \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getWriter() { @@ -162,10 +162,10 @@ class Export extends \Magento\ImportExport\Model\AbstractModel $this->_writer = $this->_exportAdapterFac->create($fileFormats[$this->getFileFormat()]['model']); } catch (\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('Please enter a correct entity model')); + throw new \Magento\Model\Exception(__('Please enter a correct entity model')); } if (!$this->_writer instanceof \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Adapter object must be an instance of %1', 'Magento\ImportExport\Model\Export\Adapter\AbstractAdapter' @@ -173,7 +173,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel ); } } else { - throw new \Magento\Core\Exception(__('Please correct the file format.')); + throw new \Magento\Model\Exception(__('Please correct the file format.')); } } return $this->_writer; @@ -183,7 +183,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * Export data. * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function export() { @@ -192,14 +192,14 @@ class Export extends \Magento\ImportExport\Model\AbstractModel $result = $this->_getEntityAdapter()->setWriter($this->_getWriter())->export(); $countRows = substr_count(trim($result), "\n"); if (!$countRows) { - throw new \Magento\Core\Exception(__('There is no data for export')); + throw new \Magento\Model\Exception(__('There is no data for export')); } if ($result) { $this->addLogComment(array(__('Exported %1 rows.', $countRows), __('Export has been done.'))); } return $result; } else { - throw new \Magento\Core\Exception(__('Please provide filter data.')); + throw new \Magento\Model\Exception(__('Please provide filter data.')); } } @@ -220,7 +220,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * @static * @param \Magento\Eav\Model\Entity\Attribute $attribute * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public static function getAttributeFilterType(\Magento\Eav\Model\Entity\Attribute $attribute) { @@ -236,7 +236,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel ) { return self::FILTER_TYPE_INPUT; } else { - throw new \Magento\Core\Exception(__('Cannot determine attribute filter type')); + throw new \Magento\Model\Exception(__('Cannot determine attribute filter type')); } } @@ -254,12 +254,12 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * Override standard entity getter. * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getEntity() { if (empty($this->_data['entity'])) { - throw new \Magento\Core\Exception(__('Entity is unknown')); + throw new \Magento\Model\Exception(__('Entity is unknown')); } return $this->_data['entity']; } @@ -278,12 +278,12 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * Override standard entity getter. * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getFileFormat() { if (empty($this->_data['file_format'])) { - throw new \Magento\Core\Exception(__('File format is unknown')); + throw new \Magento\Model\Exception(__('File format is unknown')); } return $this->_data['file_format']; } diff --git a/app/code/Magento/ImportExport/Model/Export/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Export/AbstractEntity.php index a8e130a3f7a..3acf4db71bd 100644 --- a/app/code/Magento/ImportExport/Model/Export/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Export/AbstractEntity.php @@ -281,7 +281,7 @@ abstract class AbstractEntity /** * Export one item * - * @param \Magento\Core\Model\AbstractModel $item + * @param \Magento\Model\AbstractModel $item * @return void */ abstract public function exportItem($item); @@ -415,12 +415,12 @@ abstract class AbstractEntity * Inner writer object getter * * @return AbstractAdapter - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getWriter() { if (!$this->_writer) { - throw new \Magento\Core\Exception(__('Please specify writer.')); + throw new \Magento\Model\Exception(__('Please specify writer.')); } return $this->_writer; diff --git a/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php b/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php index 27b06401a00..eb636f0f1cb 100644 --- a/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php +++ b/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php @@ -58,7 +58,7 @@ abstract class AbstractAdapter * * @param \Magento\App\Filesystem $filesystem * @param string|null $destination - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function __construct(\Magento\App\Filesystem $filesystem, $destination = null) { @@ -68,14 +68,14 @@ abstract class AbstractAdapter $this->_directoryHandle->touch($destination); } if (!is_string($destination)) { - throw new \Magento\Core\Exception(__('Destination file path must be a string')); + throw new \Magento\Model\Exception(__('Destination file path must be a string')); } if (!$this->_directoryHandle->isWritable()) { - throw new \Magento\Core\Exception(__('Destination directory is not writable')); + throw new \Magento\Model\Exception(__('Destination directory is not writable')); } if ($this->_directoryHandle->isFile($destination) && !$this->_directoryHandle->isWritable($destination)) { - throw new \Magento\Core\Exception(__('Destination file is not writable')); + throw new \Magento\Model\Exception(__('Destination file is not writable')); } $this->_destination = $destination; diff --git a/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php b/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php index ffa460a98cc..3a87715065a 100644 --- a/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php +++ b/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php @@ -106,7 +106,7 @@ class Csv extends \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter public function setHeaderCols(array $headerColumns) { if (null !== $this->_headerCols) { - throw new \Magento\Core\Exception(__('Header column names already set')); + throw new \Magento\Model\Exception(__('Header column names already set')); } if ($headerColumns) { foreach ($headerColumns as $columnName) { diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php index 154838a549f..51ea13eb7d9 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php @@ -299,11 +299,11 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Export\AbstractEn /** * Fill row with attributes values * - * @param \Magento\Core\Model\AbstractModel $item export entity + * @param \Magento\Model\AbstractModel $item export entity * @param array $row data row * @return array */ - protected function _addAttributeValuesToRow(\Magento\Core\Model\AbstractModel $item, array $row = array()) + protected function _addAttributeValuesToRow(\Magento\Model\AbstractModel $item, array $row = array()) { $validAttributeCodes = $this->_getExportAttributeCodes(); // go through all valid attribute codes diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php index 77040a05f76..0f103225a72 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php @@ -512,12 +512,12 @@ abstract class AbstractEntity * Inner writer object getter. * * @return AbstractAdapter - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getWriter() { if (!$this->_writer) { - throw new \Magento\Core\Exception(__('Please specify writer.')); + throw new \Magento\Model\Exception(__('Please specify writer.')); } return $this->_writer; } diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/Product.php b/app/code/Magento/ImportExport/Model/Export/Entity/Product.php index 18c83105ef6..da7d74da646 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/Product.php @@ -319,7 +319,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity /** * Initialize product type models. * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ protected function _initTypeModels() @@ -327,10 +327,10 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity $productTypes = $this->_exportConfig->getProductTypes(); foreach ($productTypes as $productTypeName => $productTypeConfig) { if (!($model = $this->_typeFactory->create($productTypeConfig['model']))) { - throw new \Magento\Core\Exception("Entity type model '{$productTypeConfig['model']}' is not found"); + throw new \Magento\Model\Exception("Entity type model '{$productTypeConfig['model']}' is not found"); } if (!$model instanceof \Magento\ImportExport\Model\Export\Entity\Product\Type\AbstractType) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Entity type model must be an instance of \Magento\ImportExport\Model\Export\Entity\Product\Type\AbstractType' ) @@ -346,7 +346,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity } } if (!$this->_productTypeModels) { - throw new \Magento\Core\Exception(__('There are no product types available for export')); + throw new \Magento\Model\Exception(__('There are no product types available for export')); } $this->_disabledAttrs = array_unique($this->_disabledAttrs); diff --git a/app/code/Magento/ImportExport/Model/Import.php b/app/code/Magento/ImportExport/Model/Import.php index c3b00de0096..6767d3b2bf1 100644 --- a/app/code/Magento/ImportExport/Model/Import.php +++ b/app/code/Magento/ImportExport/Model/Import.php @@ -189,7 +189,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel /** * Create instance of entity adapter and return it * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\ImportExport\Model\Import\Entity\AbstractEntity|\Magento\ImportExport\Model\Import\AbstractEntity */ protected function _getEntityAdapter() @@ -202,12 +202,12 @@ class Import extends \Magento\ImportExport\Model\AbstractModel $this->_entityAdapter = $this->_entityFactory->create($entities[$this->getEntity()]['model']); } catch (\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('Please enter a correct entity model')); + throw new \Magento\Model\Exception(__('Please enter a correct entity model')); } if (!$this->_entityAdapter instanceof \Magento\ImportExport\Model\Import\Entity\AbstractEntity && !$this->_entityAdapter instanceof \Magento\ImportExport\Model\Import\AbstractEntity ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Entity adapter object must be an instance of %1 or %2', 'Magento\ImportExport\Model\Import\Entity\AbstractEntity', @@ -218,12 +218,12 @@ class Import extends \Magento\ImportExport\Model\AbstractModel // check for entity codes integrity if ($this->getEntity() != $this->_entityAdapter->getEntityTypeCode()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The input entity code is not equal to entity adapter code.') ); } } else { - throw new \Magento\Core\Exception(__('Please enter a correct entity.')); + throw new \Magento\Model\Exception(__('Please enter a correct entity.')); } $this->_entityAdapter->setParameters($this->getData()); } @@ -339,13 +339,13 @@ class Import extends \Magento\ImportExport\Model\AbstractModel /** * Override standard entity getter. * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return string */ public function getEntity() { if (empty($this->_data['entity'])) { - throw new \Magento\Core\Exception(__('Entity is unknown')); + throw new \Magento\Model\Exception(__('Entity is unknown')); } return $this->_data['entity']; } @@ -537,7 +537,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel /** * Move uploaded file and create source adapter instance. * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return string Source file path */ public function uploadSource() @@ -551,7 +551,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel } else { $errorMessage = __('File was not uploaded.'); } - throw new \Magento\Core\Exception($errorMessage); + throw new \Magento\Model\Exception($errorMessage); } $entity = $this->getEntity(); @@ -564,7 +564,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel $uploadedFile = $result['path'] . $result['file']; if (!$extension) { $this->_varDirectory->delete($uploadedFile); - throw new \Magento\Core\Exception(__('Uploaded file has no extension')); + throw new \Magento\Model\Exception(__('Uploaded file has no extension')); } $sourceFile = $this->getWorkingDir() . $entity; @@ -582,7 +582,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel $sourceFileRelative ); } catch (\Magento\Filesystem\FilesystemException $e) { - throw new \Magento\Core\Exception(__('Source file moving failed')); + throw new \Magento\Model\Exception(__('Source file moving failed')); } } $this->_removeBom($sourceFile); @@ -591,7 +591,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel $this->_getSourceAdapter($sourceFile); } catch (\Exception $e) { $this->_varDirectory->delete($sourceFileRelative); - throw new \Magento\Core\Exception($e->getMessage()); + throw new \Magento\Model\Exception($e->getMessage()); } return $sourceFile; } @@ -665,7 +665,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel * ) * * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getEntityBehaviors() { @@ -681,7 +681,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel 'code' => $behavior->getCode() . '_behavior' ); } else { - throw new \Magento\Core\Exception(__('Invalid behavior token for %1', $entityCode)); + throw new \Magento\Model\Exception(__('Invalid behavior token for %1', $entityCode)); } } return $behaviourData; diff --git a/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php index 3b83d05fd63..774ec251dc3 100644 --- a/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php @@ -546,12 +546,12 @@ abstract class AbstractEntity * Source object getter * * @return AbstractSource - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getSource() { if (!$this->_source) { - throw new \Magento\Core\Exception(__('Source is not set')); + throw new \Magento\Model\Exception(__('Source is not set')); } return $this->_source; } @@ -702,7 +702,7 @@ abstract class AbstractEntity * Validate data * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validateData() { @@ -710,7 +710,7 @@ abstract class AbstractEntity // do all permanent columns exist? $absentColumns = array_diff($this->_permanentAttributes, $this->getSource()->getColNames()); if ($absentColumns) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Cannot find required columns: %1', implode(', ', $absentColumns)) ); } @@ -731,12 +731,12 @@ abstract class AbstractEntity } if ($emptyHeaderColumns) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Columns number: "%1" have empty headers', implode('", "', $emptyHeaderColumns)) ); } if ($invalidColumns) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Column names: "%1" are invalid', implode('", "', $invalidColumns)) ); } diff --git a/app/code/Magento/ImportExport/Model/Import/Adapter.php b/app/code/Magento/ImportExport/Model/Import/Adapter.php index 03728dd6351..13d9ed65a45 100644 --- a/app/code/Magento/ImportExport/Model/Import/Adapter.php +++ b/app/code/Magento/ImportExport/Model/Import/Adapter.php @@ -44,22 +44,22 @@ class Adapter * @param Write $directory * @param mixed $options OPTIONAL Adapter constructor options * @return AbstractSource - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ 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.')); + throw new \Magento\Model\Exception(__('The adapter type must be a non empty string.')); } $adapterClass = 'Magento\ImportExport\Model\Import\Source\\' . ucfirst(strtolower($type)); if (!class_exists($adapterClass)) { - throw new \Magento\Core\Exception("'{$type}' file extension is not supported"); + throw new \Magento\Model\Exception("'{$type}' file extension is not supported"); } $adapter = new $adapterClass($options, $directory); if (!$adapter instanceof AbstractSource) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Adapter must be an instance of \Magento\ImportExport\Model\Import\AbstractSource') ); } diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php index 8e5d3b72576..fc8575ebce0 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php @@ -254,12 +254,12 @@ abstract class AbstractEntity * Inner source object getter. * * @return AbstractSource - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getSource() { if (!$this->_source) { - throw new \Magento\Core\Exception(__('Please specify a source.')); + throw new \Magento\Model\Exception(__('Please specify a source.')); } return $this->_source; } @@ -555,12 +555,12 @@ abstract class AbstractEntity * Source object getter. * * @return AbstractSource - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getSource() { if (!$this->_source) { - throw new \Magento\Core\Exception(__('Source is not set')); + throw new \Magento\Model\Exception(__('Source is not set')); } return $this->_source; } @@ -711,14 +711,14 @@ abstract class AbstractEntity * Validate data. * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validateData() { if (!$this->_dataValidated) { // do all permanent columns exist? if ($absentColumns = array_diff($this->_permanentAttributes, $this->getSource()->getColNames())) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Cannot find required columns: %1', implode(', ', $absentColumns)) ); } @@ -739,12 +739,12 @@ abstract class AbstractEntity } if ($emptyHeaderColumns) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Columns number: "%1" have empty headers', implode('", "', $emptyHeaderColumns)) ); } if ($invalidColumns) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Column names: "%1" are invalid', implode('", "', $invalidColumns)) ); } diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php index d254446443a..d2b158a3203 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php @@ -731,7 +731,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * Initialize product type models. * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initTypeModels() { @@ -740,12 +740,12 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $params = array($this, $productTypeName); if (!($model = $this->_productTypeFactory->create($productTypeConfig['model'], array('params' => $params))) ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\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( + throw new \Magento\Model\Exception( __( 'Entity type model must be an instance of ' . 'Magento\ImportExport\Model\Import\Entity\Product\Type\AbstractType' @@ -1549,7 +1549,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * Returns an object for upload a media files * * @return \Magento\ImportExport\Model\Import\Uploader - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getUploader() { @@ -1560,14 +1560,14 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $tmpPath = $this->_mediaDirectory->getAbsolutePath('import'); if (!$this->_fileUploader->setTmpDir($tmpPath)) { - throw new \Magento\Core\Exception(sprintf("File directory '%s' is not readable.", $tmpPath)); + throw new \Magento\Model\Exception(sprintf("File directory '%s' is not readable.", $tmpPath)); } $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)); + throw new \Magento\Model\Exception(sprintf("File directory '%s' is not writable.", $destinationPath)); } } return $this->_fileUploader; diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php index c07e16d1082..a46cb75973f 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php @@ -472,7 +472,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * * @param array $data * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initSourceEntities(array $data) { @@ -492,7 +492,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity if (isset($data['product_entity'])) { $this->_productEntity = $data['product_entity']; } else { - throw new \Magento\Core\Exception(__('Option entity must have a parent product entity.')); + throw new \Magento\Model\Exception(__('Option entity must have a parent product entity.')); } if (isset($data['collection_by_pages_iterator'])) { $this->_byPagesIterator = $data['collection_by_pages_iterator']; diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/AbstractType.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/AbstractType.php index c083d3eb83f..b279c770afa 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/AbstractType.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/AbstractType.php @@ -107,7 +107,7 @@ abstract class AbstractType * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFac * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac * @param array $params - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function __construct( \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFac, @@ -126,7 +126,7 @@ abstract class AbstractType $params[0] ) || !$params[0] instanceof \Magento\ImportExport\Model\Import\Entity\Product ) { - throw new \Magento\Core\Exception(__('Please correct the parameters.')); + throw new \Magento\Model\Exception(__('Please correct the parameters.')); } $this->_entityModel = $params[0]; $this->_type = $params[1]; diff --git a/app/code/Magento/ImportExport/Model/Import/Uploader.php b/app/code/Magento/ImportExport/Model/Import/Uploader.php index 5263fd0b8cb..a0951fa4043 100644 --- a/app/code/Magento/ImportExport/Model/Import/Uploader.php +++ b/app/code/Magento/ImportExport/Model/Import/Uploader.php @@ -128,12 +128,12 @@ class Uploader extends \Magento\Core\Model\File\Uploader * * @param string $filePath * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _setUploadFile($filePath) { if (!$this->_directory->isReadable($filePath)) { - throw new \Magento\Core\Exception("File '{$filePath}' was not found or has read restriction."); + throw new \Magento\Model\Exception("File '{$filePath}' was not found or has read restriction."); } $this->_file = $this->_readFileInfo($filePath); diff --git a/app/code/Magento/ImportExport/Model/Resource/Helper.php b/app/code/Magento/ImportExport/Model/Resource/Helper.php index e836725cd63..a3c804b1e68 100644 --- a/app/code/Magento/ImportExport/Model/Resource/Helper.php +++ b/app/code/Magento/ImportExport/Model/Resource/Helper.php @@ -34,7 +34,7 @@ */ namespace Magento\ImportExport\Model\Resource; -class Helper extends \Magento\Core\Model\Resource\Helper +class Helper extends \Magento\DB\Helper { /** * Constants to be used for DB @@ -79,7 +79,7 @@ class Helper extends \Magento\Core\Model\Resource\Helper $entityStatus = $adapter->showTableStatus($tableName); if (empty($entityStatus['Auto_increment'])) { - throw new \Magento\Core\Exception(__('Cannot get autoincrement value')); + throw new \Magento\Model\Exception(__('Cannot get autoincrement value')); } return $entityStatus['Auto_increment']; } diff --git a/app/code/Magento/ImportExport/Model/Resource/Import/Data.php b/app/code/Magento/ImportExport/Model/Resource/Import/Data.php index 2e87cbb22c8..09755256870 100644 --- a/app/code/Magento/ImportExport/Model/Resource/Import/Data.php +++ b/app/code/Magento/ImportExport/Model/Resource/Import/Data.php @@ -32,7 +32,7 @@ namespace Magento\ImportExport\Model\Resource\Import; * @package Magento_ImportExport * @author Magento Core Team <core@magentocommerce.com> */ -class Data extends \Magento\Core\Model\Resource\Db\AbstractDb implements \IteratorAggregate +class Data extends \Magento\Model\Resource\Db\AbstractDb implements \IteratorAggregate { /** * @var \Iterator @@ -130,7 +130,7 @@ class Data extends \Magento\Core\Model\Resource\Db\AbstractDb implements \Iterat * * @param string $code parameter name * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getUniqueColumnData($code) { @@ -138,7 +138,7 @@ class Data extends \Magento\Core\Model\Resource\Db\AbstractDb implements \Iterat $values = array_unique($adapter->fetchCol($adapter->select()->from($this->getMainTable(), array($code)))); if (count($values) != 1) { - throw new \Magento\Core\Exception(__('Error in data structure: %1 values are mixed', $code)); + throw new \Magento\Model\Exception(__('Error in data structure: %1 values are mixed', $code)); } return $values[0]; } diff --git a/app/code/Magento/Index/App/Indexer.php b/app/code/Magento/Index/App/Indexer.php index 3597eb70f77..eba37876491 100644 --- a/app/code/Magento/Index/App/Indexer.php +++ b/app/code/Magento/Index/App/Indexer.php @@ -26,9 +26,9 @@ namespace Magento\Index\App; use Magento\App\Console\Response; -use Magento\LauncherInterface; +use Magento\AppInterface; -class Indexer implements LauncherInterface +class Indexer implements AppInterface { /** * Report directory diff --git a/app/code/Magento/Index/App/Shell.php b/app/code/Magento/Index/App/Shell.php index 7d0bf5960b7..a7af2049c50 100644 --- a/app/code/Magento/Index/App/Shell.php +++ b/app/code/Magento/Index/App/Shell.php @@ -26,9 +26,9 @@ namespace Magento\Index\App; use Magento\App\Console\Response; -use Magento\LauncherInterface; +use Magento\AppInterface; -class Shell implements LauncherInterface +class Shell implements AppInterface { /** * Filename of the entry point script diff --git a/app/code/Magento/Index/Controller/Adminhtml/Process.php b/app/code/Magento/Index/Controller/Adminhtml/Process.php index 1886c02cc02..df84c78c7c5 100644 --- a/app/code/Magento/Index/Controller/Adminhtml/Process.php +++ b/app/code/Magento/Index/Controller/Adminhtml/Process.php @@ -138,7 +138,7 @@ class Process extends \Magento\Backend\App\Action try { $process->save(); $this->messageManager->addSuccess(__('The index has been saved.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('There was a problem with saving process.')); @@ -166,7 +166,7 @@ class Process extends \Magento\Backend\App\Action $process->reindexEverything(); \Magento\Profiler::stop('__INDEX_PROCESS_REINDEX_ALL__'); $this->messageManager->addSuccess(__('%1 index was rebuilt.', $process->getIndexer()->getName())); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('There was a problem with reindexing process.')); @@ -218,7 +218,7 @@ class Process extends \Magento\Backend\App\Action } } $this->messageManager->addSuccess(__('Total of %1 index(es) have reindexed data.', $counter)); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Cannot initialize the indexer process.')); @@ -251,7 +251,7 @@ class Process extends \Magento\Backend\App\Action } } $this->messageManager->addSuccess(__('Total of %1 index(es) have changed index mode.', $counter)); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Cannot initialize the indexer process.')); diff --git a/app/code/Magento/Index/Model/Event.php b/app/code/Magento/Index/Model/Event.php index f41acf63b8b..ca6b1f48aec 100644 --- a/app/code/Magento/Index/Model/Event.php +++ b/app/code/Magento/Index/Model/Event.php @@ -44,7 +44,7 @@ use Magento\Index\Model\Indexer; * @package Magento_Index * @author Magento Core Team <core@magentocommerce.com> */ -class Event extends \Magento\Core\Model\AbstractModel +class Event extends \Magento\Model\AbstractModel { /** * Predefined event types @@ -92,7 +92,7 @@ class Event extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param Indexer $indexer * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -101,7 +101,7 @@ class Event extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, Indexer $indexer, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Index/Model/Indexer/AbstractIndexer.php b/app/code/Magento/Index/Model/Indexer/AbstractIndexer.php index af64bfdda57..9f7f40c85ec 100644 --- a/app/code/Magento/Index/Model/Indexer/AbstractIndexer.php +++ b/app/code/Magento/Index/Model/Indexer/AbstractIndexer.php @@ -33,7 +33,7 @@ namespace Magento\Index\Model\Indexer; use Magento\Index\Model\Event; use Magento\Index\Model\IndexerInterface; -abstract class AbstractIndexer extends \Magento\Core\Model\AbstractModel implements IndexerInterface +abstract class AbstractIndexer extends \Magento\Model\AbstractModel implements IndexerInterface { /** * @var array diff --git a/app/code/Magento/Index/Model/Process.php b/app/code/Magento/Index/Model/Process.php index e1e801538f2..cb3eeacc14d 100644 --- a/app/code/Magento/Index/Model/Process.php +++ b/app/code/Magento/Index/Model/Process.php @@ -45,7 +45,7 @@ use Magento\Index\Model\Resource\Event\Collection; * @package Magento_Index * @author Magento Core Team <core@magentocommerce.com> */ -class Process extends \Magento\Core\Model\AbstractModel +class Process extends \Magento\Model\AbstractModel { /** * Process statuses @@ -132,7 +132,7 @@ class Process extends \Magento\Core\Model\AbstractModel * @param \Magento\Index\Model\Indexer\ConfigInterface $indexerConfig * @param \Magento\Index\Model\Lock\Storage $lockStorage * @param \Magento\Index\Model\EventRepository $eventRepository - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -145,7 +145,7 @@ class Process extends \Magento\Core\Model\AbstractModel \Magento\Index\Model\Indexer\ConfigInterface $indexerConfig, \Magento\Index\Model\Lock\Storage $lockStorage, \Magento\Index\Model\EventRepository $eventRepository, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -245,13 +245,13 @@ class Process extends \Magento\Core\Model\AbstractModel * Reindex all data what this process responsible is * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Exception */ public function reindexAll() { if ($this->isLocked()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( '%1 Index process is not working now. Please try running this process later.', $this->getIndexer()->getName() @@ -364,7 +364,7 @@ class Process extends \Magento\Core\Model\AbstractModel /** * Get Indexer strategy object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Index\Model\IndexerInterface */ public function getIndexer() @@ -372,17 +372,17 @@ class Process extends \Magento\Core\Model\AbstractModel if ($this->_currentIndexer === null) { $name = $this->_getData('indexer_code'); if (!$name) { - throw new \Magento\Core\Exception(__('Indexer name is not defined.')); + throw new \Magento\Model\Exception(__('Indexer name is not defined.')); } $indexerConfiguration = $this->_indexerConfig->getIndexer($name); if (!$indexerConfiguration || empty($indexerConfiguration['instance'])) { - throw new \Magento\Core\Exception(__('Indexer model is not defined.')); + throw new \Magento\Model\Exception(__('Indexer model is not defined.')); } $indexerModel = $this->_indexerFactory->create($indexerConfiguration['instance']); if ($indexerModel instanceof \Magento\Index\Model\Indexer\AbstractIndexer) { $this->_currentIndexer = $indexerModel; } else { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Indexer model should extend \Magento\Index\Model\Indexer\Abstract.') ); } diff --git a/app/code/Magento/Index/Model/Resource/AbstractResource.php b/app/code/Magento/Index/Model/Resource/AbstractResource.php index 79c5c0ed16e..b51c309dbe6 100644 --- a/app/code/Magento/Index/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Index/Model/Resource/AbstractResource.php @@ -36,7 +36,7 @@ namespace Magento\Index\Model\Resource; use Magento\DB\Adapter\AdapterInterface; use Magento\DB\Select; -abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractResource extends \Magento\Model\Resource\Db\AbstractDb { const IDX_SUFFIX = '_idx'; diff --git a/app/code/Magento/Index/Model/Resource/Event.php b/app/code/Magento/Index/Model/Resource/Event.php index 4a660101414..76b1419196c 100644 --- a/app/code/Magento/Index/Model/Resource/Event.php +++ b/app/code/Magento/Index/Model/Resource/Event.php @@ -25,7 +25,7 @@ */ namespace Magento\Index\Model\Resource; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Index\Model\Process as ProcessModel; /** @@ -35,7 +35,7 @@ use Magento\Index\Model\Process as ProcessModel; * @package Magento_Index * @author Magento Core Team <core@magentocommerce.com> */ -class Event extends \Magento\Core\Model\Resource\Db\AbstractDb +class Event extends \Magento\Model\Resource\Db\AbstractDb { /** * @return void diff --git a/app/code/Magento/Index/Model/Resource/Event/Collection.php b/app/code/Magento/Index/Model/Resource/Event/Collection.php index 0976be726e8..5beacc73851 100644 --- a/app/code/Magento/Index/Model/Resource/Event/Collection.php +++ b/app/code/Magento/Index/Model/Resource/Event/Collection.php @@ -34,7 +34,7 @@ use Magento\Index\Model\Process; * @package Magento_Index * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource diff --git a/app/code/Magento/Index/Model/Resource/Process.php b/app/code/Magento/Index/Model/Resource/Process.php index 3f97553e5f8..d3c9033b172 100644 --- a/app/code/Magento/Index/Model/Resource/Process.php +++ b/app/code/Magento/Index/Model/Resource/Process.php @@ -34,7 +34,7 @@ use Magento\Index\Model\Process as ModelProcess; * @package Magento_Index * @author Magento Core Team <core@magentocommerce.com> */ -class Process extends \Magento\Core\Model\Resource\Db\AbstractDb +class Process extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime diff --git a/app/code/Magento/Index/Model/Resource/Process/Collection.php b/app/code/Magento/Index/Model/Resource/Process/Collection.php index f75bc4e7f7c..c78e3acb31c 100644 --- a/app/code/Magento/Index/Model/Resource/Process/Collection.php +++ b/app/code/Magento/Index/Model/Resource/Process/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Index\Model\Resource\Process; * @package Magento_Index * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource diff --git a/app/code/Magento/Index/Model/Shell.php b/app/code/Magento/Index/Model/Shell.php index 6c4940e6b38..b7e42e46e1c 100644 --- a/app/code/Magento/Index/Model/Shell.php +++ b/app/code/Magento/Index/Model/Shell.php @@ -164,7 +164,7 @@ class Shell extends \Magento\App\AbstractShell try { $process->setMode($mode)->save(); echo $process->getIndexer()->getName() . " index was successfully changed index mode\n"; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { echo $e->getMessage() . "\n"; $this->_hasErrors = true; } catch (\Exception $e) { @@ -194,7 +194,7 @@ class Shell extends \Magento\App\AbstractShell try { $process->reindexEverything(); echo $process->getIndexer()->getName() . " index was rebuilt successfully\n"; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { echo $e->getMessage() . "\n"; $this->_hasErrors = true; } catch (\Exception $e) { diff --git a/app/code/Magento/Indexer/App/Indexer.php b/app/code/Magento/Indexer/App/Indexer.php index d09eb6dac8d..2822af37707 100644 --- a/app/code/Magento/Indexer/App/Indexer.php +++ b/app/code/Magento/Indexer/App/Indexer.php @@ -23,7 +23,7 @@ */ namespace Magento\Indexer\App; -class Indexer implements \Magento\LauncherInterface +class Indexer implements \Magento\AppInterface { /** * Report directory diff --git a/app/code/Magento/Indexer/App/Shell.php b/app/code/Magento/Indexer/App/Shell.php index 6ff464fd60d..9d31630ece1 100644 --- a/app/code/Magento/Indexer/App/Shell.php +++ b/app/code/Magento/Indexer/App/Shell.php @@ -23,7 +23,7 @@ */ namespace Magento\Indexer\App; -class Shell implements \Magento\LauncherInterface +class Shell implements \Magento\AppInterface { /** * Filename of the entry point script diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php index 5c9c4cac45e..1d954fa9f24 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php @@ -65,7 +65,7 @@ class Indexer extends \Magento\Backend\App\Action $this->messageManager->addSuccess( __('A total of %1 indexer(s) have been turned Update on Save mode on.', count($indexerIds)) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -101,7 +101,7 @@ class Indexer extends \Magento\Backend\App\Action $this->messageManager->addSuccess( __('A total of %1 indexer(s) have been turned Update by Schedule mode on.', count($indexerIds)) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( diff --git a/app/code/Magento/Indexer/Model/Indexer/State.php b/app/code/Magento/Indexer/Model/Indexer/State.php index 2952ff9d1be..df2366e939d 100644 --- a/app/code/Magento/Indexer/Model/Indexer/State.php +++ b/app/code/Magento/Indexer/Model/Indexer/State.php @@ -30,7 +30,7 @@ namespace Magento\Indexer\Model\Indexer; * @method string getUpdated() * @method \Magento\Indexer\Model\Indexer\State setUpdated($value) */ -class State extends \Magento\Core\Model\AbstractModel +class State extends \Magento\Model\AbstractModel { /** * Indexer statuses diff --git a/app/code/Magento/Core/Model/Mview/View/State.php b/app/code/Magento/Indexer/Model/Mview/View/State.php similarity index 89% rename from app/code/Magento/Core/Model/Mview/View/State.php rename to app/code/Magento/Indexer/Model/Mview/View/State.php index 8efde770878..51504fa158e 100644 --- a/app/code/Magento/Core/Model/Mview/View/State.php +++ b/app/code/Magento/Indexer/Model/Mview/View/State.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Mview\View; +namespace Magento\Indexer\Model\Mview\View; /** * @method \Magento\Indexer\Model\Indexer\State setViewId(string $value) */ -class State extends \Magento\Core\Model\AbstractModel implements \Magento\Mview\View\StateInterface +class State extends \Magento\Model\AbstractModel implements \Magento\Mview\View\StateInterface { /** * Prefix of model events names @@ -45,15 +45,15 @@ class State extends \Magento\Core\Model\AbstractModel implements \Magento\Mview\ /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\Mview\View\State $resource - * @param \Magento\Core\Model\Resource\Mview\View\State\Collection $resourceCollection + * @param \Magento\Indexer\Model\Resource\Mview\View\State $resource + * @param \Magento\Indexer\Model\Resource\Mview\View\State\Collection $resourceCollection * @param array $data */ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Resource\Mview\View\State $resource, - \Magento\Core\Model\Resource\Mview\View\State\Collection $resourceCollection, + \Magento\Indexer\Model\Resource\Mview\View\State $resource, + \Magento\Indexer\Model\Resource\Mview\View\State\Collection $resourceCollection, array $data = array() ) { if (!isset($data['mode'])) { diff --git a/app/code/Magento/Indexer/Model/Resource/Indexer/State.php b/app/code/Magento/Indexer/Model/Resource/Indexer/State.php index 301c5e5210d..79533f29d1c 100644 --- a/app/code/Magento/Indexer/Model/Resource/Indexer/State.php +++ b/app/code/Magento/Indexer/Model/Resource/Indexer/State.php @@ -23,7 +23,7 @@ */ namespace Magento\Indexer\Model\Resource\Indexer; -class State extends \Magento\Core\Model\Resource\Db\AbstractDb +class State extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Indexer/Model/Resource/Indexer/State/Collection.php b/app/code/Magento/Indexer/Model/Resource/Indexer/State/Collection.php index 4783571bf5a..fc10b1ba75f 100644 --- a/app/code/Magento/Indexer/Model/Resource/Indexer/State/Collection.php +++ b/app/code/Magento/Indexer/Model/Resource/Indexer/State/Collection.php @@ -23,7 +23,7 @@ */ namespace Magento\Indexer\Model\Resource\Indexer\State; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Collection initialization diff --git a/app/code/Magento/Core/Model/Resource/Mview/View/State.php b/app/code/Magento/Indexer/Model/Resource/Mview/View/State.php similarity index 91% rename from app/code/Magento/Core/Model/Resource/Mview/View/State.php rename to app/code/Magento/Indexer/Model/Resource/Mview/View/State.php index 78ba4d6f183..fb915655685 100644 --- a/app/code/Magento/Core/Model/Resource/Mview/View/State.php +++ b/app/code/Magento/Indexer/Model/Resource/Mview/View/State.php @@ -21,9 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Mview\View; +namespace Magento\Indexer\Model\Resource\Mview\View; -class State extends \Magento\Core\Model\Resource\Db\AbstractDb +class State extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Core/Model/Resource/Mview/View/State/Collection.php b/app/code/Magento/Indexer/Model/Resource/Mview/View/State/Collection.php similarity index 80% rename from app/code/Magento/Core/Model/Resource/Mview/View/State/Collection.php rename to app/code/Magento/Indexer/Model/Resource/Mview/View/State/Collection.php index e7bbdca52cb..da97e537f0f 100644 --- a/app/code/Magento/Core/Model/Resource/Mview/View/State/Collection.php +++ b/app/code/Magento/Indexer/Model/Resource/Mview/View/State/Collection.php @@ -21,9 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Mview\View\State; +namespace Magento\Indexer\Model\Resource\Mview\View\State; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection implements +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection implements \Magento\Mview\View\State\CollectionInterface { /** @@ -33,6 +33,6 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ protected function _construct() { - $this->_init('Magento\Core\Model\Mview\View\State', 'Magento\Core\Model\Resource\Mview\View\State'); + $this->_init('Magento\Indexer\Model\Mview\View\State', 'Magento\Indexer\Model\Resource\Mview\View\State'); } } diff --git a/app/code/Magento/Indexer/Model/Shell.php b/app/code/Magento/Indexer/Model/Shell.php index 88a58b47ceb..fe5ee2cb764 100644 --- a/app/code/Magento/Indexer/Model/Shell.php +++ b/app/code/Magento/Indexer/Model/Shell.php @@ -156,7 +156,7 @@ class Shell extends \Magento\App\AbstractShell try { $indexer->{$method}(); echo $indexer->getTitle() . " indexer was successfully changed index mode" . PHP_EOL; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { echo $e->getMessage() . PHP_EOL; $this->hasErrors = true; } catch (\Exception $e) { @@ -186,7 +186,7 @@ class Shell extends \Magento\App\AbstractShell try { $indexer->reindexAll(); echo $indexer->getTitle() . " index has been rebuilt successfully" . PHP_EOL; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { echo $e->getMessage() . PHP_EOL; $this->hasErrors = true; } catch (\Exception $e) { diff --git a/app/code/Magento/Indexer/etc/di.xml b/app/code/Magento/Indexer/etc/di.xml index 691840ef43f..94d2719dffb 100644 --- a/app/code/Magento/Indexer/etc/di.xml +++ b/app/code/Magento/Indexer/etc/di.xml @@ -24,6 +24,8 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <preference for="Magento\Mview\View\State\CollectionInterface" type="Magento\Indexer\Model\Resource\Mview\View\State\Collection" /> + <preference for="Magento\Mview\View\StateInterface" type="Magento\Indexer\Model\Mview\View\State" /> <preference for="Magento\Indexer\Model\ConfigInterface" type="Magento\Indexer\Model\Config" /> <preference for="Magento\Indexer\Model\IndexerInterface" type="Magento\Indexer\Model\Indexer" /> <type name="Magento\Indexer\Model\Indexer"> @@ -41,6 +43,11 @@ <argument name="stateCollection" xsi:type="object" shared="false">Magento\Indexer\Model\Resource\Indexer\State\Collection</argument> </arguments> </type> + <type name="Magento\Mview\View\Subscription"> + <arguments> + <argument name="viewCollection" xsi:type="object" shared="false">Magento\Mview\View\CollectionInterface</argument> + </arguments> + </type> <type name="Magento\Indexer\Model\Processor"> <plugin name="page-cache-indexer-reindex-invalidate" type="Magento\Indexer\Model\Processor\InvalidateCache" sortOrder="10"/> diff --git a/app/code/Magento/Indexer/etc/module.xml b/app/code/Magento/Indexer/etc/module.xml index 70cd4db611f..cd1fced8c23 100644 --- a/app/code/Magento/Indexer/etc/module.xml +++ b/app/code/Magento/Indexer/etc/module.xml @@ -25,11 +25,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_Indexer" version="1.0.0.0" active="true"> - <sequence> - <module name="Magento_Core"/> - </sequence> <depends> - <module name="Magento_Core"/> <module name="Magento_Backend"/> <module name="Magento_PageCache"/> </depends> diff --git a/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php b/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php index bba07d6a219..2a94037505c 100644 --- a/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php +++ b/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php @@ -64,4 +64,60 @@ $table = $installer->getConnection()->newTable( ); $installer->getConnection()->createTable($table); +/** + * Create table 'mview_state' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('mview_state') + )->addColumn( + 'state_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array( + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + ), + 'View State Id' + )->addColumn( + 'view_id', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array(), + 'View Id' + )->addColumn( + 'mode', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 16, + array('default' => \Magento\Mview\View\StateInterface::MODE_DISABLED,), + 'View Mode' + )->addColumn( + 'status', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 16, + array('default' => \Magento\Mview\View\StateInterface::STATUS_IDLE,), + 'View Status' + )->addColumn( + 'updated', + \Magento\DB\Ddl\Table::TYPE_DATETIME, + null, + array(), + 'View updated time' + )->addColumn( + 'version_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true,), + 'View Version Id' + )->addIndex( + $installer->getIdxName('mview_state', array('view_id')), + array('view_id') + )->addIndex( + $installer->getIdxName('mview_state', array('mode')), + array('mode') + )->setComment('View State'); +$installer->getConnection()->createTable($table); + $installer->endSetup(); diff --git a/app/code/Magento/Install/App/Action/Plugin/Design.php b/app/code/Magento/Install/App/Action/Plugin/Design.php index 459fb8ecba8..840d7a6709e 100644 --- a/app/code/Magento/Install/App/Action/Plugin/Design.php +++ b/app/code/Magento/Install/App/Action/Plugin/Design.php @@ -33,9 +33,9 @@ class Design protected $_request; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\AreaList */ - protected $_app; + protected $_areaList; /** * @var \Magento\View\LayoutInterface @@ -53,15 +53,15 @@ class Design protected $_viewDesign; /** - * @param \Magento\App\RequestInterface $request - * @param \Magento\Core\Model\App $app + * @param RequestInterface $request + * @param \Magento\App\AreaList $areaList * @param \Magento\View\LayoutInterface $layout * @param \Magento\View\DesignInterface $viewDesign * @param \Magento\View\Design\Theme\ListInterface $themeList */ public function __construct( \Magento\App\RequestInterface $request, - \Magento\Core\Model\App $app, + \Magento\App\AreaList $areaList, \Magento\View\LayoutInterface $layout, \Magento\View\DesignInterface $viewDesign, \Magento\View\Design\Theme\ListInterface $themeList @@ -69,7 +69,7 @@ class Design $this->_viewDesign = $viewDesign; $this->_themeList = $themeList; $this->_request = $request; - $this->_app = $app; + $this->_areaList = $areaList; $this->_layout = $layout; } @@ -85,7 +85,7 @@ class Design public function beforeDispatch(\Magento\Install\Controller\Action $subject, RequestInterface $request) { $areaCode = $this->_layout->getArea(); - $area = $this->_app->getArea($areaCode); + $area = $this->_areaList->getArea($areaCode); $area->load(\Magento\Core\Model\App\Area::PART_CONFIG); $themePath = $this->_viewDesign->getConfigurationDesignTheme($areaCode); diff --git a/app/code/Magento/Install/App/Console.php b/app/code/Magento/Install/App/Console.php index ab8a04f95b9..806e11ef9f6 100644 --- a/app/code/Magento/Install/App/Console.php +++ b/app/code/Magento/Install/App/Console.php @@ -27,7 +27,7 @@ namespace Magento\Install\App; use Magento\App\Console\Response; -class Console implements \Magento\LauncherInterface +class Console implements \Magento\AppInterface { /** * @var \Magento\Install\Model\Installer\ConsoleFactory diff --git a/app/code/Magento/Install/Controller/Wizard.php b/app/code/Magento/Install/Controller/Wizard.php index 1f37447a0e9..27bdd680bc5 100644 --- a/app/code/Magento/Install/Controller/Wizard.php +++ b/app/code/Magento/Install/Controller/Wizard.php @@ -514,7 +514,7 @@ class Wizard extends \Magento\Install\Controller\Action $this->getResponse()->setRedirect($step->getNextUrl()); } catch (\Exception $e) { $this->_session->setAdminData($adminData); - if ($e instanceof \Magento\Core\Exception) { + if ($e instanceof \Magento\Model\Exception) { $this->messageManager->addMessages($e->getMessages()); } else { $this->messageManager->addError($e->getMessage()); diff --git a/app/code/Magento/Install/Model/Installer.php b/app/code/Magento/Install/Model/Installer.php index 12534ca0656..aa80892b7a5 100644 --- a/app/code/Magento/Install/Model/Installer.php +++ b/app/code/Magento/Install/Model/Installer.php @@ -95,11 +95,11 @@ class Installer extends \Magento\Object protected $_filesystem; /** - * Application + * Area list * - * @var \Magento\Core\Model\App + * @var \Magento\App\AreaList */ - protected $_app; + protected $_areaList; /** * Application @@ -198,7 +198,7 @@ class Installer extends \Magento\Object * @param \Magento\App\Cache\StateInterface $cacheState * @param \Magento\Module\Updater\SetupFactory $setupFactory * @param \Magento\App\Arguments $arguments - * @param \Magento\Core\Model\App $app + * @param \Magento\App\AreaList $areaList * @param \Magento\App\State $appState * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\User\Model\UserFactory $userModelFactory @@ -225,7 +225,7 @@ class Installer extends \Magento\Object \Magento\App\Cache\StateInterface $cacheState, \Magento\Module\Updater\SetupFactory $setupFactory, \Magento\App\Arguments $arguments, - \Magento\Core\Model\App $app, + \Magento\App\AreaList $areaList, \Magento\App\State $appState, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\User\Model\UserFactory $userModelFactory, @@ -253,7 +253,7 @@ class Installer extends \Magento\Object $this->_encryptor = $encryptor; $this->mathRandom = $mathRandom; $this->_arguments = $arguments; - $this->_app = $app; + $this->_areaList = $areaList; $this->_appState = $appState; $this->_storeManager = $storeManager; $this->_userModelFactory = $userModelFactory; @@ -503,10 +503,9 @@ class Installer extends \Magento\Object public function createAdministrator($data) { // \Magento\User\Model\User belongs to adminhtml area - $this->_app->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG - ); + $this->_areaList + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\App\AreaInterface::PART_CONFIG); /** @var $user \Magento\User\Model\User */ $user = $this->_userModelFactory->create(); diff --git a/app/code/Magento/Install/Model/Installer/Config.php b/app/code/Magento/Install/Model/Installer/Config.php index e4d8c80c577..f24e7773bb4 100644 --- a/app/code/Magento/Install/Model/Installer/Config.php +++ b/app/code/Magento/Install/Model/Installer/Config.php @@ -222,7 +222,7 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller * * @param string $baseUrl * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Exception */ protected function _checkUrl($baseUrl) @@ -240,7 +240,7 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller } if ($response->getStatus() != 200) { $this->messageManager->addError(__('The URL "%1" is invalid.', $baseUrl)); - throw new \Magento\Core\Exception(__('Response from the server is invalid.')); + throw new \Magento\Model\Exception(__('Response from the server is invalid.')); } } diff --git a/app/code/Magento/Install/Model/Installer/Console.php b/app/code/Magento/Install/Model/Installer/Console.php index 317610602e5..f4e35e4c68e 100644 --- a/app/code/Magento/Install/Model/Installer/Console.php +++ b/app/code/Magento/Install/Model/Installer/Console.php @@ -388,7 +388,7 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller return $encryptionKey; } catch (\Exception $e) { - if ($e instanceof \Magento\Core\Exception) { + if ($e instanceof \Magento\Model\Exception) { foreach ($e->getMessages(\Magento\Message\MessageInterface::TYPE_ERROR) as $errorMessage) { $this->addError($errorMessage); } diff --git a/app/code/Magento/Install/Model/Installer/Db.php b/app/code/Magento/Install/Model/Installer/Db.php index 7d478760f2f..f492ec67780 100644 --- a/app/code/Magento/Install/Model/Installer/Db.php +++ b/app/code/Magento/Install/Model/Installer/Db.php @@ -81,7 +81,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller * * @param array $data * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function checkDbConnectionData($data) { @@ -101,7 +101,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller } } if (!empty($absenteeExtensions)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('PHP Extensions "%1" must be loaded.', implode(',', $absenteeExtensions)) ); } @@ -113,7 +113,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller // check DB server version if (version_compare($version, $requiredVersion) == -1) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'The database server version doesn\'t match system requirements (required: %1, actual: %2).', $requiredVersion, @@ -124,16 +124,16 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller // check InnoDB support if (!$resource->supportEngine()) { - throw new \Magento\Core\Exception(__('Database server does not support the InnoDB storage engine.')); + throw new \Magento\Model\Exception(__('Database server does not support the InnoDB storage engine.')); } // TODO: check user roles - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception(__($e->getMessage())); + throw new \Magento\Model\Exception(__($e->getMessage())); } catch (\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('Something went wrong while connecting to the database.')); + throw new \Magento\Model\Exception(__('Something went wrong while connecting to the database.')); } return $data; @@ -148,7 +148,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller protected function _getCheckedData($data) { if (!isset($data['db_name']) || empty($data['db_name'])) { - throw new \Magento\Core\Exception(__('The Database Name field cannot be empty.')); + throw new \Magento\Model\Exception(__('The Database Name field cannot be empty.')); } //make all table prefix to lower letter if ($data['db_prefix'] != '') { @@ -157,7 +157,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller //check table prefix if ($data['db_prefix'] != '') { if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $data['db_prefix'])) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_); the first character should be a letter.' ) @@ -187,7 +187,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller * Retrieve the database resource * * @return \Magento\Install\Model\Installer\Db\AbstractDb - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getDbResource() { diff --git a/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php b/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php index 96c78dd4a23..ed42f763120 100644 --- a/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php +++ b/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php @@ -38,7 +38,7 @@ abstract class AbstractDb /** * Resource connection adapter factory * - * @var \Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory + * @var \Magento\Model\Resource\Type\Db\Pdo\MysqlFactory */ protected $_adapterFactory; @@ -78,12 +78,12 @@ abstract class AbstractDb protected $_arguments; /** - * @param \Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory + * @param \Magento\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory * @param \Magento\App\Arguments $arguments * @param array $dbExtensions */ public function __construct( - \Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory, + \Magento\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory, \Magento\App\Arguments $arguments, array $dbExtensions = array() ) { diff --git a/app/code/Magento/Install/view/install/config.phtml b/app/code/Magento/Install/view/install/config.phtml index 58228d0644a..fdc41575654 100644 --- a/app/code/Magento/Install/view/install/config.phtml +++ b/app/code/Magento/Install/view/install/config.phtml @@ -90,7 +90,7 @@ <p style="margin-top:4px; line-height:1.3em; color:#666;"> <small> - <?php echo __('You could enable this option to use web server rewrites functionality for improved search engines optimization.') ?> + <?php echo __('You could enable this option to use web server rewrites functionality for improved Search Engine Optimization.') ?> <br/> <strong><?php echo __('Please make sure that <code>mod_rewrite</code> is enabled in Apache configuration.') ?></strong> </small> diff --git a/app/code/Magento/Install/view/install/page.phtml b/app/code/Magento/Install/view/install/page.phtml index 60bd43b8308..cc55f4f7d62 100644 --- a/app/code/Magento/Install/view/install/page.phtml +++ b/app/code/Magento/Install/view/install/page.phtml @@ -112,7 +112,7 @@ <p class="legality"> <?php echo __('Help Us Keep Magento Healthy') ?> - <a href="http://www.magentocommerce.com/bug-tracking" - target="varien_external"><strong><?php echo __('Report All Bugs') ?></strong></a> <?php echo __('(ver. %1)', \Magento\Core\Model\App::VERSION) ?> + target="varien_external"><strong><?php echo __('Report All Bugs') ?></strong></a> <?php echo __('(ver. %1)', \Magento\AppInterface::VERSION) ?> <br/> <?php echo $this->getChildHtml('copyright');?> </p> diff --git a/app/code/Magento/Integration/Controller/Adminhtml/Integration.php b/app/code/Magento/Integration/Controller/Adminhtml/Integration.php index f4417ed1783..cf2978003b1 100644 --- a/app/code/Magento/Integration/Controller/Adminhtml/Integration.php +++ b/app/code/Magento/Integration/Controller/Adminhtml/Integration.php @@ -268,7 +268,7 @@ class Integration extends Action $this->messageManager->addError($this->escaper->escapeHtml($e->getMessage())); $this->_getSession()->setIntegrationData($integrationData); $this->_redirectOnSaveError(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($this->escaper->escapeHtml($e->getMessage())); $this->_redirectOnSaveError(); } catch (\Exception $e) { @@ -387,7 +387,7 @@ class Integration extends Action self::REGISTRY_KEY_CURRENT_INTEGRATION, $this->_integrationService->get($integrationId)->getData() ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*'); return; @@ -434,7 +434,7 @@ class Integration extends Action 'popup_content' => $popupContent ); $this->getResponse()->setBody($this->_coreHelper->jsonEncode($result)); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*'); return; diff --git a/app/code/Magento/Integration/Exception.php b/app/code/Magento/Integration/Exception.php index b2f00f950e4..ecf8af15b41 100644 --- a/app/code/Magento/Integration/Exception.php +++ b/app/code/Magento/Integration/Exception.php @@ -25,6 +25,6 @@ */ namespace Magento\Integration; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Integration/Model/Integration.php b/app/code/Magento/Integration/Model/Integration.php index a4b43b4ec16..316adc6ca6c 100644 --- a/app/code/Magento/Integration/Model/Integration.php +++ b/app/code/Magento/Integration/Model/Integration.php @@ -44,7 +44,7 @@ namespace Magento\Integration\Model; * @method \string getUpdatedAt() * @method Integration setUpdatedAt(\string $createdAt) */ -class Integration extends \Magento\Core\Model\AbstractModel +class Integration extends \Magento\Model\AbstractModel { /**#@+ * Integration Status values @@ -94,7 +94,7 @@ class Integration extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -102,7 +102,7 @@ class Integration extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Integration/Model/Oauth/Consumer.php b/app/code/Magento/Integration/Model/Oauth/Consumer.php index 12ad275feb0..59095603be4 100644 --- a/app/code/Magento/Integration/Model/Oauth/Consumer.php +++ b/app/code/Magento/Integration/Model/Oauth/Consumer.php @@ -44,7 +44,7 @@ use Magento\Oauth\ConsumerInterface; * @method string getRejectedCallbackUrl() * @method Consumer setRejectedCallbackUrl() setRejectedCallbackUrl(string $rejectedCallbackUrl) */ -class Consumer extends \Magento\Core\Model\AbstractModel implements ConsumerInterface +class Consumer extends \Magento\Model\AbstractModel implements ConsumerInterface { /** * @var \Magento\Url\Validator @@ -61,7 +61,7 @@ class Consumer extends \Magento\Core\Model\AbstractModel implements ConsumerInte * @param \Magento\Registry $registry * @param \Magento\Integration\Model\Oauth\Consumer\Validator\KeyLengthFactory $keyLengthFactory * @param \Magento\Url\Validator $urlValidator - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -70,7 +70,7 @@ class Consumer extends \Magento\Core\Model\AbstractModel implements ConsumerInte \Magento\Registry $registry, \Magento\Integration\Model\Oauth\Consumer\Validator\KeyLengthFactory $keyLengthFactory, \Magento\Url\Validator $urlValidator, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -115,10 +115,10 @@ class Consumer extends \Magento\Core\Model\AbstractModel implements ConsumerInte $this->setRejectedCallbackUrl(trim($this->getRejectedCallbackUrl())); if ($this->getCallbackUrl() && !$this->_urlValidator->isValid($this->getCallbackUrl())) { - throw new \Magento\Core\Exception(__('Invalid Callback URL')); + throw new \Magento\Model\Exception(__('Invalid Callback URL')); } if ($this->getRejectedCallbackUrl() && !$this->_urlValidator->isValid($this->getRejectedCallbackUrl())) { - throw new \Magento\Core\Exception(__('Invalid Rejected Callback URL')); + throw new \Magento\Model\Exception(__('Invalid Rejected Callback URL')); } } @@ -130,14 +130,14 @@ class Consumer extends \Magento\Core\Model\AbstractModel implements ConsumerInte $validatorLength->setName('Consumer Key'); if (!$validatorLength->isValid($this->getKey())) { $messages = $validatorLength->getMessages(); - throw new \Magento\Core\Exception(array_shift($messages)); + throw new \Magento\Model\Exception(array_shift($messages)); } $validatorLength->setLength(\Magento\Oauth\Helper\Oauth::LENGTH_CONSUMER_SECRET); $validatorLength->setName('Consumer Secret'); if (!$validatorLength->isValid($this->getSecret())) { $messages = $validatorLength->getMessages(); - throw new \Magento\Core\Exception(array_shift($messages)); + throw new \Magento\Model\Exception(array_shift($messages)); } return true; } diff --git a/app/code/Magento/Integration/Model/Oauth/Nonce.php b/app/code/Magento/Integration/Model/Oauth/Nonce.php index d6109360d5a..14e02893a44 100644 --- a/app/code/Magento/Integration/Model/Oauth/Nonce.php +++ b/app/code/Magento/Integration/Model/Oauth/Nonce.php @@ -35,7 +35,7 @@ namespace Magento\Integration\Model\Oauth; * @method \Magento\Integration\Model\Resource\Oauth\Nonce getResource() * @method \Magento\Integration\Model\Resource\Oauth\Nonce _getResource() */ -class Nonce extends \Magento\Core\Model\AbstractModel +class Nonce extends \Magento\Model\AbstractModel { /** * Oauth data @@ -48,7 +48,7 @@ class Nonce extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Integration\Helper\Oauth\Data $oauthData - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -56,7 +56,7 @@ class Nonce extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Integration\Helper\Oauth\Data $oauthData, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Integration/Model/Oauth/Token.php b/app/code/Magento/Integration/Model/Oauth/Token.php index ce203eb2d49..297c747d69b 100644 --- a/app/code/Magento/Integration/Model/Oauth/Token.php +++ b/app/code/Magento/Integration/Model/Oauth/Token.php @@ -57,7 +57,7 @@ use Magento\Oauth\Exception as OauthException; * @method Token setAuthorized() setAuthorized(int $authorized) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Token extends \Magento\Core\Model\AbstractModel +class Token extends \Magento\Model\AbstractModel { /**#@+ * Token types @@ -120,7 +120,7 @@ class Token extends \Magento\Core\Model\AbstractModel * @param \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory * @param \Magento\Integration\Helper\Oauth\Data $oauthData * @param OauthHelper $oauthHelper - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -134,7 +134,7 @@ class Token extends \Magento\Core\Model\AbstractModel \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory, \Magento\Integration\Helper\Oauth\Data $oauthData, OauthHelper $oauthHelper, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Integration/Model/Resource/Integration.php b/app/code/Magento/Integration/Model/Resource/Integration.php index fdd2563ca79..6a302dc6757 100644 --- a/app/code/Magento/Integration/Model/Resource/Integration.php +++ b/app/code/Magento/Integration/Model/Resource/Integration.php @@ -26,7 +26,7 @@ namespace Magento\Integration\Model\Resource; /** * Integration resource model */ -class Integration extends \Magento\Core\Model\Resource\Db\AbstractDb +class Integration extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize resource model diff --git a/app/code/Magento/Integration/Model/Resource/Integration/Collection.php b/app/code/Magento/Integration/Model/Resource/Integration/Collection.php index fce8300e2f9..c22f6dd25fd 100644 --- a/app/code/Magento/Integration/Model/Resource/Integration/Collection.php +++ b/app/code/Magento/Integration/Model/Resource/Integration/Collection.php @@ -26,7 +26,7 @@ namespace Magento\Integration\Model\Resource\Integration; /** * Integrations collection. */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource collection initialization. diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Consumer.php b/app/code/Magento/Integration/Model/Resource/Oauth/Consumer.php index 3ea3130308d..f8f12fc2a41 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Consumer.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Consumer.php @@ -23,7 +23,7 @@ */ namespace Magento\Integration\Model\Resource\Oauth; -class Consumer extends \Magento\Core\Model\Resource\Db\AbstractDb +class Consumer extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime @@ -53,10 +53,10 @@ class Consumer extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Set updated_at automatically before saving * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function _beforeSave(\Magento\Core\Model\AbstractModel $object) + public function _beforeSave(\Magento\Model\AbstractModel $object) { $object->setUpdatedAt($this->_dateTime->formatDate(time())); return parent::_beforeSave($object); @@ -65,10 +65,10 @@ class Consumer extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Delete all Nonce entries associated with the consumer * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function _afterDelete(\Magento\Core\Model\AbstractModel $object) + public function _afterDelete(\Magento\Model\AbstractModel $object) { $adapter = $this->_getWriteAdapter(); $adapter->delete($this->getTable('oauth_nonce'), array('consumer_id' => $object->getId())); diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Consumer/Collection.php b/app/code/Magento/Integration/Model/Resource/Oauth/Consumer/Collection.php index c1b68152867..d99e21f0572 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Consumer/Collection.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Consumer/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Integration\Model\Resource\Oauth\Consumer; * @package Magento_Oauth * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize collection model diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Nonce.php b/app/code/Magento/Integration/Model/Resource/Oauth/Nonce.php index 81859acc0c8..9f2772e2167 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Nonce.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Nonce.php @@ -30,7 +30,7 @@ namespace Magento\Integration\Model\Resource\Oauth; * * @author Magento Core Team <core@magentocommerce.com> */ -class Nonce extends \Magento\Core\Model\Resource\Db\AbstractDb +class Nonce extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize resource model diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Nonce/Collection.php b/app/code/Magento/Integration/Model/Resource/Oauth/Nonce/Collection.php index 028c66ae051..a42f2c70256 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Nonce/Collection.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Nonce/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Integration\Model\Resource\Oauth\Nonce; * @package Magento_Oauth * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize collection model diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Token.php b/app/code/Magento/Integration/Model/Resource/Oauth/Token.php index 2a83cc4466d..97c600e34fe 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Token.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Token.php @@ -28,7 +28,7 @@ namespace Magento\Integration\Model\Resource\Oauth; /** * OAuth token resource model */ -class Token extends \Magento\Core\Model\Resource\Db\AbstractDb +class Token extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime @@ -59,13 +59,13 @@ class Token extends \Magento\Core\Model\Resource\Db\AbstractDb * Clean up old authorized tokens for specified consumer-user pairs * * @param \Magento\Integration\Model\Oauth\Token $exceptToken Token just created to exclude from delete - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return int The number of affected rows */ public function cleanOldAuthorizedTokensExcept(\Magento\Integration\Model\Oauth\Token $exceptToken) { if (!$exceptToken->getId() || !$exceptToken->getAuthorized()) { - throw new \Magento\Core\Exception('Invalid token to except'); + throw new \Magento\Model\Exception('Invalid token to except'); } $adapter = $this->_getWriteAdapter(); $where = $adapter->quoteInto( @@ -80,7 +80,7 @@ class Token extends \Magento\Core\Model\Resource\Db\AbstractDb } elseif ($exceptToken->getAdminId()) { $where .= $adapter->quoteInto(' AND admin_id = ?', $exceptToken->getAdminId(), \Zend_Db::INT_TYPE); } else { - throw new \Magento\Core\Exception('Invalid token to except'); + throw new \Magento\Model\Exception('Invalid token to except'); } return $adapter->delete($this->getMainTable(), $where); } diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Token/Collection.php b/app/code/Magento/Integration/Model/Resource/Oauth/Token/Collection.php index a7ce3f76f10..f9133ec5a0c 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Token/Collection.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Token/Collection.php @@ -30,7 +30,7 @@ namespace Magento\Integration\Model\Resource\Oauth\Token; * * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize collection model diff --git a/app/code/Magento/Integration/Service/OauthV1.php b/app/code/Magento/Integration/Service/OauthV1.php index 812f5055090..7f88cfdf9f7 100644 --- a/app/code/Magento/Integration/Service/OauthV1.php +++ b/app/code/Magento/Integration/Service/OauthV1.php @@ -123,7 +123,7 @@ class OauthV1 implements OauthV1Interface $consumer = $this->_consumerFactory->create($consumerData); $consumer->save(); return $consumer; - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { throw $exception; } catch (\Exception $exception) { throw new \Magento\Oauth\Exception(__('Unexpected error. Unable to create oAuth consumer account.')); @@ -178,7 +178,7 @@ class OauthV1 implements OauthV1Interface { try { return $this->_consumerFactory->create()->load($consumerId); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { throw $exception; } catch (\Exception $exception) { throw new \Magento\Oauth\Exception(__('Unexpected error. Unable to load oAuth consumer account.')); @@ -192,7 +192,7 @@ class OauthV1 implements OauthV1Interface { try { return $this->_consumerFactory->create()->load($key, 'key'); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { throw $exception; } catch (\Exception $exception) { throw new \Magento\Oauth\Exception(__('Unexpected error. Unable to load oAuth consumer account.')); @@ -229,7 +229,7 @@ class OauthV1 implements OauthV1Interface $this->_httpClient->setConfig(array('maxredirects' => $maxredirects, 'timeout' => $timeout)); $this->_httpClient->request(\Magento\HTTP\ZendClient::POST); return $verifier->getVerifier(); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { throw $exception; } catch (\Magento\Oauth\Exception $exception) { throw $exception; diff --git a/app/code/Magento/Integration/Service/OauthV1Interface.php b/app/code/Magento/Integration/Service/OauthV1Interface.php index 330ba6af661..763dfd87125 100644 --- a/app/code/Magento/Integration/Service/OauthV1Interface.php +++ b/app/code/Magento/Integration/Service/OauthV1Interface.php @@ -41,7 +41,7 @@ interface OauthV1Interface * ) * </pre> * @return \Magento\Integration\Model\Oauth\Consumer - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Magento\Oauth\Exception */ public function createConsumer($consumerData); @@ -69,7 +69,7 @@ interface OauthV1Interface * @param int $consumerId * @return \Magento\Integration\Model\Oauth\Consumer * @throws \Magento\Oauth\Exception - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function loadConsumer($consumerId); @@ -79,7 +79,7 @@ interface OauthV1Interface * @param string $key * @return \Magento\Integration\Model\Oauth\Consumer * @throws \Magento\Oauth\Exception - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function loadConsumerByKey($key); @@ -89,7 +89,7 @@ interface OauthV1Interface * @param int $consumerId - The consumer Id. * @param string $endpointUrl - The integration endpoint Url (for HTTP Post) * @return string - The oauth_verifier. - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Magento\Oauth\Exception */ public function postToConsumer($consumerId, $endpointUrl); diff --git a/app/code/Magento/Log/App/Shell.php b/app/code/Magento/Log/App/Shell.php index 469aa8f4e86..1cd2bfee5f8 100644 --- a/app/code/Magento/Log/App/Shell.php +++ b/app/code/Magento/Log/App/Shell.php @@ -26,9 +26,9 @@ namespace Magento\Log\App; use Magento\App\Console\Response; -use Magento\LauncherInterface; +use Magento\AppInterface; -class Shell implements LauncherInterface +class Shell implements AppInterface { /** * Filename of the entry point script diff --git a/app/code/Magento/Log/Model/Aggregation.php b/app/code/Magento/Log/Model/Aggregation.php index 1d1045e9fcb..30e8fa28c31 100644 --- a/app/code/Magento/Log/Model/Aggregation.php +++ b/app/code/Magento/Log/Model/Aggregation.php @@ -35,7 +35,7 @@ namespace Magento\Log\Model; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Aggregation extends \Magento\Core\Model\AbstractModel +class Aggregation extends \Magento\Model\AbstractModel { /** * Last record data @@ -53,7 +53,7 @@ class Aggregation extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -61,7 +61,7 @@ class Aggregation extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Log/Model/Cron.php b/app/code/Magento/Log/Model/Cron.php index f83f6c946e9..70d35de7b6a 100644 --- a/app/code/Magento/Log/Model/Cron.php +++ b/app/code/Magento/Log/Model/Cron.php @@ -34,7 +34,7 @@ */ namespace Magento\Log\Model; -class Cron extends \Magento\Core\Model\AbstractModel +class Cron extends \Magento\Model\AbstractModel { const XML_PATH_EMAIL_LOG_CLEAN_TEMPLATE = 'system/log/error_email_template'; @@ -58,11 +58,6 @@ class Cron extends \Magento\Core\Model\AbstractModel */ protected $_coreStoreConfig; - /** - * @var \Magento\TranslateInterface - */ - protected $_translate; - /** * @var \Magento\Core\Model\StoreManagerInterface */ @@ -78,15 +73,20 @@ class Cron extends \Magento\Core\Model\AbstractModel */ protected $_transportBuilder; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Log\Model\Log $log + * @param Log $log * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\TranslateInterface $translate * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -96,17 +96,17 @@ class Cron extends \Magento\Core\Model\AbstractModel \Magento\Mail\Template\TransportBuilder $transportBuilder, \Magento\Log\Model\Log $log, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\TranslateInterface $translate, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Translate\Inline\StateInterface $inlineTranslation, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_transportBuilder = $transportBuilder; $this->_log = $log; $this->_storeManager = $storeManager; - $this->_translate = $translate; $this->_coreStoreConfig = $coreStoreConfig; + $this->inlineTranslation = $inlineTranslation; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -124,7 +124,7 @@ class Cron extends \Magento\Core\Model\AbstractModel return $this; } - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $transport = $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_LOG_CLEAN_TEMPLATE) @@ -143,7 +143,8 @@ class Cron extends \Magento\Core\Model\AbstractModel $transport->sendMessage(); - $this->_translate->setTranslateInline(true); + $this->inlineTranslation->resume(); + return $this; } diff --git a/app/code/Magento/Log/Model/Customer.php b/app/code/Magento/Log/Model/Customer.php index 10e696e1943..ea6b708d270 100644 --- a/app/code/Magento/Log/Model/Customer.php +++ b/app/code/Magento/Log/Model/Customer.php @@ -45,7 +45,7 @@ namespace Magento\Log\Model; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Customer extends \Magento\Core\Model\AbstractModel +class Customer extends \Magento\Model\AbstractModel { /** * @var \Magento\Stdlib\DateTime @@ -56,7 +56,7 @@ class Customer extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -64,7 +64,7 @@ class Customer extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -86,16 +86,12 @@ class Customer extends \Magento\Core\Model\AbstractModel /** * Load last log by customer id * - * @param \Magento\Customer\Model\Customer|int $customer - * @return $this + * @param int $customerId + * @return \Magento\Log\Model\Customer */ - public function loadByCustomer($customer) + public function loadByCustomer($customerId) { - if ($customer instanceof \Magento\Customer\Model\Customer) { - $customer = $customer->getId(); - } - - return $this->load($customer, 'customer_id'); + return $this->load($customerId, 'customer_id'); } /** diff --git a/app/code/Magento/Log/Model/Log.php b/app/code/Magento/Log/Model/Log.php index fe636fd6341..a5239095872 100644 --- a/app/code/Magento/Log/Model/Log.php +++ b/app/code/Magento/Log/Model/Log.php @@ -45,7 +45,7 @@ namespace Magento\Log\Model; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Log extends \Magento\Core\Model\AbstractModel +class Log extends \Magento\Model\AbstractModel { const XML_LOG_CLEAN_DAYS = 'system/log/clean_after_day'; @@ -60,7 +60,7 @@ class Log extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -68,7 +68,7 @@ class Log extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Log/Model/Resource/Aggregation.php b/app/code/Magento/Log/Model/Resource/Aggregation.php index fe2f10ae40e..c7adfb74fcf 100644 --- a/app/code/Magento/Log/Model/Resource/Aggregation.php +++ b/app/code/Magento/Log/Model/Resource/Aggregation.php @@ -32,7 +32,7 @@ namespace Magento\Log\Model\Resource; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Aggregation extends \Magento\Core\Model\Resource\Db\AbstractDb +class Aggregation extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Log/Model/Resource/Customer.php b/app/code/Magento/Log/Model/Resource/Customer.php index da432d4a137..d4139cf3043 100644 --- a/app/code/Magento/Log/Model/Resource/Customer.php +++ b/app/code/Magento/Log/Model/Resource/Customer.php @@ -32,7 +32,7 @@ namespace Magento\Log\Model\Resource; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Customer extends \Magento\Core\Model\Resource\Db\AbstractDb +class Customer extends \Magento\Model\Resource\Db\AbstractDb { /** * Visitor data table name diff --git a/app/code/Magento/Log/Model/Resource/Helper.php b/app/code/Magento/Log/Model/Resource/Helper.php index b562e5a13a3..7fa5ce2d0a0 100644 --- a/app/code/Magento/Log/Model/Resource/Helper.php +++ b/app/code/Magento/Log/Model/Resource/Helper.php @@ -33,7 +33,7 @@ */ namespace Magento\Log\Model\Resource; -class Helper extends \Magento\Core\Model\Resource\Helper +class Helper extends \Magento\DB\Helper { /** * Returns information about table in DB diff --git a/app/code/Magento/Log/Model/Resource/Log.php b/app/code/Magento/Log/Model/Resource/Log.php index 771b2e8af71..218a5bc0bc0 100644 --- a/app/code/Magento/Log/Model/Resource/Log.php +++ b/app/code/Magento/Log/Model/Resource/Log.php @@ -32,7 +32,7 @@ namespace Magento\Log\Model\Resource; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Log extends \Magento\Core\Model\Resource\Db\AbstractDb +class Log extends \Magento\Model\Resource\Db\AbstractDb { /** * Core event manager proxy diff --git a/app/code/Magento/Log/Model/Resource/Shell.php b/app/code/Magento/Log/Model/Resource/Shell.php index 8789b4f57dd..4ca3dba3f5f 100644 --- a/app/code/Magento/Log/Model/Resource/Shell.php +++ b/app/code/Magento/Log/Model/Resource/Shell.php @@ -41,17 +41,19 @@ class Shell protected $_resource; /** - * @var \Magento\Core\Model\Resource\HelperFactory + * @var \Magento\Log\Model\Resource\Helper */ - protected $_helperPool; + protected $_resourceHelper; /** - * @param \Magento\Core\Model\Resource\HelperPool $helperPool + * @param \Magento\Log\Model\Resource\Helper $resourceHelper * @param \Magento\App\Resource $resource */ - public function __construct(\Magento\Core\Model\Resource\HelperPool $helperPool, \Magento\App\Resource $resource) - { - $this->_helperPool = $helperPool; + public function __construct( + \Magento\Log\Model\Resource\Helper $resourceHelper, + \Magento\App\Resource $resource + ) { + $this->_resourceHelper = $resourceHelper; $this->_resource = $resource; } @@ -75,10 +77,9 @@ class Shell 'catalog_compare_item' ); - $resHelper = $this->_helperPool->get('Magento_Log'); $result = array(); foreach ($tables as $table) { - $info = $resHelper->getTableInfo($this->_resource->getTableName($table)); + $info = $this->_resourceHelper->getTableInfo($this->_resource->getTableName($table)); if (!$info) { continue; } diff --git a/app/code/Magento/Log/Model/Resource/Visitor.php b/app/code/Magento/Log/Model/Resource/Visitor.php index 1cbcb931e05..fa093a98afa 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor.php +++ b/app/code/Magento/Log/Model/Resource/Visitor.php @@ -28,7 +28,7 @@ namespace Magento\Log\Model\Resource; /** * Visitor log resource */ -class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb +class Visitor extends \Magento\Model\Resource\Db\AbstractDb { /** * Magento string lib @@ -78,10 +78,10 @@ class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Prepare data for save * - * @param \Magento\Core\Model\AbstractModel $visitor + * @param \Magento\Model\AbstractModel $visitor * @return array */ - protected function _prepareDataForSave(\Magento\Core\Model\AbstractModel $visitor) + protected function _prepareDataForSave(\Magento\Model\AbstractModel $visitor) { return array( 'session_id' => $visitor->getSessionId(), @@ -119,10 +119,10 @@ class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save url info before save * - * @param \Magento\Core\Model\AbstractModel $visitor + * @param \Magento\Model\AbstractModel $visitor * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $visitor) + protected function _beforeSave(\Magento\Model\AbstractModel $visitor) { if (!$visitor->getIsNewVisitor()) { $this->_saveUrlInfo($visitor); @@ -133,10 +133,10 @@ class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Actions after save * - * @param \Magento\Core\Model\AbstractModel $visitor + * @param \Magento\Model\AbstractModel $visitor * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $visitor) + protected function _afterSave(\Magento\Model\AbstractModel $visitor) { if ($visitor->getIsNewVisitor()) { $this->_saveVisitorInfo($visitor); @@ -156,10 +156,10 @@ class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions after object load * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel|\Magento\Object $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { parent::_afterLoad($object); // Add information about quote to visitor diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Collection.php b/app/code/Magento/Log/Model/Resource/Visitor/Collection.php index 6971c61d61d..ea1aae1a30e 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Collection.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Log\Model\Resource\Visitor; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Visitor data table name @@ -180,7 +180,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * * @param boolean $printQuery * @param boolean $logQuery - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function load($printQuery = false, $logQuery = false) { diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Online.php b/app/code/Magento/Log/Model/Resource/Visitor/Online.php index edfb4485262..c5102b3499c 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Online.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Online.php @@ -32,7 +32,7 @@ namespace Magento\Log\Model\Resource\Visitor; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Online extends \Magento\Core\Model\Resource\Db\AbstractDb +class Online extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime\DateTime diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php b/app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php index 50eb8e56f6e..440793e1974 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php @@ -25,6 +25,8 @@ */ namespace Magento\Log\Model\Resource\Visitor\Online; +use Magento\Customer\Service\V1\CustomerMetadataServiceInterface; + /** * Log Online visitors collection * @@ -32,7 +34,7 @@ namespace Magento\Log\Model\Resource\Visitor\Online; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Joined fields array @@ -42,29 +44,29 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl protected $_fields = array(); /** - * @var \Magento\Customer\Model\CustomerFactory + * @var \Magento\Eav\Helper\Data */ - protected $_customerFactory; + protected $_eavHelper; /** * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Customer\Model\CustomerFactory $customerFactory + * @param \Magento\Eav\Helper\Data $eavHelper * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Customer\Model\CustomerFactory $customerFactory, + \Magento\Eav\Helper\Data $eavHelper, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { - $this->_customerFactory = $customerFactory; + $this->_eavHelper = $eavHelper; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); } @@ -85,7 +87,6 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function addCustomerData() { - $customer = $this->_customerFactory->create(); // alias => attribute_code $attributes = array( 'customer_lastname' => 'lastname', @@ -94,37 +95,34 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl ); foreach ($attributes as $alias => $attributeCode) { - $attribute = $customer->getAttribute($attributeCode); - /* @var $attribute \Magento\Eav\Model\Entity\Attribute\AbstractAttribute */ - if ($attribute->getBackendType() == 'static') { - $tableAlias = 'customer_' . $attribute->getAttributeCode(); + $attribute = $this->_eavHelper->getAttributeMetadata( + CustomerMetadataServiceInterface::ENTITY_TYPE_CUSTOMER, + $attributeCode + ); + + $tableAlias = 'customer_' . $attributeCode; + if ($attribute['backend_type'] == 'static') { $this->getSelect()->joinLeft( - array($tableAlias => $attribute->getBackend()->getTable()), + array($tableAlias => $attribute['attribute_table']), sprintf('%s.entity_id=main_table.customer_id', $tableAlias), - array($alias => $attribute->getAttributeCode()) + array($alias => $attributeCode) ); - - $this->_fields[$alias] = sprintf('%s.%s', $tableAlias, $attribute->getAttributeCode()); + $this->_fields[$alias] = sprintf('%s.%s', $tableAlias, $attributeCode); } else { - $tableAlias = 'customer_' . $attribute->getAttributeCode(); - - $joinConds = array( + $joinConds = array( sprintf('%s.entity_id=main_table.customer_id', $tableAlias), - $this->getConnection()->quoteInto($tableAlias . '.attribute_id=?', $attribute->getAttributeId()) + $this->getConnection()->quoteInto($tableAlias . '.attribute_id=?', $attribute['attribute_id']) ); - $this->getSelect()->joinLeft( - array($tableAlias => $attribute->getBackend()->getTable()), + array($tableAlias => $attribute['attribute_table']), join(' AND ', $joinConds), array($alias => 'value') ); - $this->_fields[$alias] = sprintf('%s.value', $tableAlias); } } - $this->setFlag('has_customer_data', true); return $this; } diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Collection.php b/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Collection.php index 6c9e676e225..60e26ee91a8 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Collection.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Collection.php @@ -37,20 +37,20 @@ class Collection extends \Magento\Log\Model\Resource\Visitor\Online\Collection * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Customer\Model\CustomerFactory $customerFactory + * @param \Magento\Eav\Helper\Data $eavHelper * @param \Magento\Log\Model\Visitor\OnlineFactory $onlineFactory * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Customer\Model\CustomerFactory $customerFactory, + \Magento\Eav\Helper\Data $eavHelper, \Magento\Log\Model\Visitor\OnlineFactory $onlineFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_onlineFactory = $onlineFactory; parent::__construct( @@ -58,7 +58,7 @@ class Collection extends \Magento\Log\Model\Resource\Visitor\Online\Collection $logger, $fetchStrategy, $eventManager, - $customerFactory, + $eavHelper, $connection, $resource ); diff --git a/app/code/Magento/Log/Model/Visitor.php b/app/code/Magento/Log/Model/Visitor.php index 4797e58b315..428fd2b2bde 100644 --- a/app/code/Magento/Log/Model/Visitor.php +++ b/app/code/Magento/Log/Model/Visitor.php @@ -37,7 +37,7 @@ namespace Magento\Log\Model; * @method int getStoreId() * @method \Magento\Log\Model\Visitor setStoreId(int $value) */ -class Visitor extends \Magento\Core\Model\AbstractModel +class Visitor extends \Magento\Model\AbstractModel { const DEFAULT_ONLINE_MINUTES_INTERVAL = 15; @@ -89,11 +89,6 @@ class Visitor extends \Magento\Core\Model\AbstractModel */ protected $_quoteFactory; - /** - * @var \Magento\Customer\Model\CustomerFactory - */ - protected $_customerFactory; - /** * @var \Magento\HTTP\Header */ @@ -118,7 +113,6 @@ class Visitor extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -127,7 +121,8 @@ class Visitor extends \Magento\Core\Model\AbstractModel * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress * @param \Magento\HTTP\PhpEnvironment\ServerAddress $serverAddress * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Module\Manager $moduleManager + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $ignoredUserAgents * @param array $ignores @@ -137,7 +132,6 @@ class Visitor extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\Session\SessionManagerInterface $session, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -146,14 +140,14 @@ class Visitor extends \Magento\Core\Model\AbstractModel \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress, \Magento\HTTP\PhpEnvironment\ServerAddress $serverAddress, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Module\Manager $moduleManager, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $ignoredUserAgents = array(), array $ignores = array(), array $data = array() ) { $this->_coreStoreConfig = $coreStoreConfig; - $this->_customerFactory = $customerFactory; $this->_quoteFactory = $quoteFactory; $this->_session = $session; $this->_storeManager = $storeManager; @@ -409,28 +403,6 @@ class Visitor extends \Magento\Core\Model\AbstractModel return $this; } - /** - * Load customer data into $data - * - * @param object $data - * @return $this - */ - public function addCustomerData($data) - { - $customerId = $data->getCustomerId(); - if (intval($customerId) <= 0) { - return $this; - } - $customerData = $this->_customerFactory->create()->load($customerId); - $newCustomerData = array(); - foreach ($customerData->getData() as $propName => $propValue) { - $newCustomerData['customer_' . $propName] = $propValue; - } - - $data->addData($newCustomerData); - return $this; - } - /** * Load quote data into $data * diff --git a/app/code/Magento/Log/Model/Visitor/Online.php b/app/code/Magento/Log/Model/Visitor/Online.php index c1342b8fb72..d625224e73b 100644 --- a/app/code/Magento/Log/Model/Visitor/Online.php +++ b/app/code/Magento/Log/Model/Visitor/Online.php @@ -46,7 +46,7 @@ namespace Magento\Log\Model\Visitor; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Online extends \Magento\Core\Model\AbstractModel +class Online extends \Magento\Model\AbstractModel { const XML_PATH_ONLINE_INTERVAL = 'customer/online_customers/online_minutes_interval'; @@ -63,7 +63,7 @@ class Online extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -71,7 +71,7 @@ class Online extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Log/etc/module.xml b/app/code/Magento/Log/etc/module.xml index 04ec2fc0a42..280e757c075 100644 --- a/app/code/Magento/Log/etc/module.xml +++ b/app/code/Magento/Log/etc/module.xml @@ -32,6 +32,7 @@ <depends> <module name="Magento_Core"/> <module name="Magento_Customer"/> + <module name="Magento_Eav"/> <module name="Magento_Sales"/> <module name="Magento_Backend"/> </depends> diff --git a/app/code/Magento/Multishipping/Controller/Checkout.php b/app/code/Magento/Multishipping/Controller/Checkout.php index 0046d9c7cad..de025198e8b 100755 --- a/app/code/Magento/Multishipping/Controller/Checkout.php +++ b/app/code/Magento/Multishipping/Controller/Checkout.php @@ -280,7 +280,7 @@ class Checkout extends \Magento\Checkout\Controller\Action implements if ($shipToInfo = $this->getRequest()->getPost('ship')) { $this->_getCheckout()->setShippingItemsInformation($shipToInfo); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/addresses'); } catch (\Exception $e) { @@ -462,7 +462,7 @@ class Checkout extends \Magento\Checkout\Controller\Action implements $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/billing'); } catch (\Exception $e) { @@ -530,7 +530,7 @@ class Checkout extends \Magento\Checkout\Controller\Action implements $this->_getCheckout()->getCheckoutSession()->clearQuote(); $this->messageManager->addError($e->getMessage()); $this->_redirect('*/cart'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get( 'Magento\Checkout\Helper\Data' )->sendPaymentFailedEmail( diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php index a742d2c8645..01e9dc342a0 100644 --- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php @@ -283,7 +283,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * * @param array $info * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setShippingItemsInformation($info) { @@ -299,7 +299,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType $maxQty = $this->helper->getMaximumQty(); if ($allQty > $maxQty) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Maximum qty allowed for Shipping to multiple addresses is %1', $maxQty) ); } @@ -460,7 +460,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * * @param array $methods * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setShippingMethods($methods) { @@ -469,7 +469,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType if (isset($methods[$address->getId()])) { $address->setShippingMethod($methods[$address->getId()]); } elseif (!$address->getShippingMethod()) { - throw new \Magento\Core\Exception(__('Please select shipping methods for all addresses.')); + throw new \Magento\Model\Exception(__('Please select shipping methods for all addresses.')); } } $this->save(); @@ -481,15 +481,15 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * * @param array $payment * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setPaymentMethod($payment) { if (!isset($payment['method'])) { - throw new \Magento\Core\Exception(__('Payment method is not defined')); + throw new \Magento\Model\Exception(__('Payment method is not defined')); } if (!$this->paymentSpecification->isSatisfiedBy($payment['method'])) { - throw new \Magento\Core\Exception(__('The requested Payment Method is not available for multishipping.')); + throw new \Magento\Model\Exception(__('The requested Payment Method is not available for multishipping.')); } $quote = $this->getQuote(); $quote->getPayment()->importData($payment); @@ -555,7 +555,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * Validate quote data * * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validate() { @@ -564,24 +564,24 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType /** @var $paymentMethod \Magento\Payment\Model\Method\AbstractMethod */ $paymentMethod = $quote->getPayment()->getMethodInstance(); if (!empty($paymentMethod) && !$paymentMethod->isAvailable($quote)) { - throw new \Magento\Core\Exception(__('Please specify a payment method.')); + throw new \Magento\Model\Exception(__('Please specify a payment method.')); } $addresses = $quote->getAllShippingAddresses(); foreach ($addresses as $address) { $addressValidation = $address->validate(); if ($addressValidation !== true) { - throw new \Magento\Core\Exception(__('Please check shipping addresses information.')); + throw new \Magento\Model\Exception(__('Please check shipping addresses information.')); } $method = $address->getShippingMethod(); $rate = $address->getShippingRateByCode($method); if (!$method || !$rate) { - throw new \Magento\Core\Exception(__('Please specify shipping methods for all addresses.')); + throw new \Magento\Model\Exception(__('Please specify shipping methods for all addresses.')); } } $addressValidation = $quote->getBillingAddress()->validate(); if ($addressValidation !== true) { - throw new \Magento\Core\Exception(__('Please check billing address information.')); + throw new \Magento\Model\Exception(__('Please check billing address information.')); } return $this; } diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php index ffe8f7ea7a9..fe7d0f8b4ad 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php @@ -59,7 +59,7 @@ class Website extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Core\Model\Resource\Website\CollectionFactory $websitesFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Registry $registry @@ -67,7 +67,7 @@ class Website extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Core\Model\Resource\Website\CollectionFactory $websitesFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Registry $registry, diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php index 2403b4819e9..796aca675ad 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php @@ -282,7 +282,7 @@ class Queue extends \Magento\Backend\App\Action /** * Save Newsletter queue * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return void */ public function saveAction() @@ -297,7 +297,7 @@ class Queue extends \Magento\Backend\App\Action $template = $this->_objectManager->create('Magento\Newsletter\Model\Template')->load($templateId); if (!$template->getId() || $template->getIsSystem()) { - throw new \Magento\Core\Exception(__('Please correct the newsletter template and try again.')); + throw new \Magento\Model\Exception(__('Please correct the newsletter template and try again.')); } $queue->setTemplateId( @@ -351,7 +351,7 @@ class Queue extends \Magento\Backend\App\Action $this->_getSession()->setFormData(false); $this->_redirect('*/*'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $id = $this->getRequest()->getParam('id'); if ($id) { diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php index a6a439f06f6..95924c54deb 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php @@ -227,7 +227,7 @@ class Template extends \Magento\Backend\App\Action $this->_redirect('*/template'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError(nl2br($e->getMessage())); $this->_getSession()->setData('newsletter_template_form_data', $this->getRequest()->getParams()); } catch (\Exception $e) { @@ -255,7 +255,7 @@ class Template extends \Magento\Backend\App\Action $template->delete(); $this->messageManager->addSuccess(__('The newsletter template has been deleted.')); $this->_getSession()->setFormData(false); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('An error occurred while deleting this template.')); diff --git a/app/code/Magento/Newsletter/Controller/Subscriber.php b/app/code/Magento/Newsletter/Controller/Subscriber.php index 074a2777f40..1392bf2dfca 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber.php @@ -95,7 +95,7 @@ class Subscriber extends \Magento\App\Action\Action /** * New subscription action * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return void */ public function newAction() @@ -105,7 +105,7 @@ class Subscriber extends \Magento\App\Action\Action try { if (!\Zend_Validate::is($email, 'EmailAddress')) { - throw new \Magento\Core\Exception(__('Please enter a valid email address.')); + throw new \Magento\Model\Exception(__('Please enter a valid email address.')); } if ($this->_objectManager->get( @@ -114,7 +114,7 @@ class Subscriber extends \Magento\App\Action\Action \Magento\Newsletter\Model\Subscriber::XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG ) != 1 && !$this->_customerSession->isLoggedIn() ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Sorry, but the administrator denied subscription for guests. ' . 'Please <a href="%1">register</a>.', @@ -129,7 +129,7 @@ class Subscriber extends \Magento\App\Action\Action $email )->getId(); if ($ownerId !== null && $ownerId != $this->_customerSession->getId()) { - throw new \Magento\Core\Exception(__('This email address is already assigned to another user.')); + throw new \Magento\Model\Exception(__('This email address is already assigned to another user.')); } $status = $this->_subscriberFactory->create()->subscribe($email); @@ -138,7 +138,7 @@ class Subscriber extends \Magento\App\Action\Action } else { $this->messageManager->addSuccess(__('Thank you for your subscription.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addException( $e, __('There was a problem with the subscription: %1', $e->getMessage()) @@ -190,7 +190,7 @@ class Subscriber extends \Magento\App\Action\Action try { $this->_subscriberFactory->create()->load($id)->setCheckCode($code)->unsubscribe(); $this->messageManager->addSuccess(__('You have been unsubscribed.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addException($e, $e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong with the un-subscription.')); diff --git a/app/code/Magento/Newsletter/Model/Problem.php b/app/code/Magento/Newsletter/Model/Problem.php index d6f3d4cd470..afe21d0abf4 100644 --- a/app/code/Magento/Newsletter/Model/Problem.php +++ b/app/code/Magento/Newsletter/Model/Problem.php @@ -43,7 +43,7 @@ namespace Magento\Newsletter\Model; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Problem extends \Magento\Core\Model\AbstractModel +class Problem extends \Magento\Model\AbstractModel { /** * Current Subscriber @@ -65,7 +65,7 @@ class Problem extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -73,7 +73,7 @@ class Problem extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Newsletter/Model/Resource/Grid/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Grid/Collection.php index 09f8820d6e5..8fd107795eb 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Grid/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Grid/Collection.php @@ -39,7 +39,7 @@ class Collection extends \Magento\Newsletter\Model\Resource\Problem\Collection /** * Adds queue info to grid * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection|\Magento\Newsletter\Model\Resource\Grid\Collection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection|\Magento\Newsletter\Model\Resource\Grid\Collection */ protected function _initSelect() { diff --git a/app/code/Magento/Newsletter/Model/Resource/Problem.php b/app/code/Magento/Newsletter/Model/Resource/Problem.php index b52a02d6a44..4372fe715b9 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Problem.php +++ b/app/code/Magento/Newsletter/Model/Resource/Problem.php @@ -32,7 +32,7 @@ namespace Magento\Newsletter\Model\Resource; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Problem extends \Magento\Core\Model\Resource\Db\AbstractDb +class Problem extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/Newsletter/Model/Resource/Problem/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Problem/Collection.php index 5f733639364..8f2a95f631a 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Problem/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Problem/Collection.php @@ -30,7 +30,7 @@ namespace Magento\Newsletter\Model\Resource\Problem; * * @SuppressWarnings(PHPMD.LongVariable) */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * True when subscribers info joined @@ -60,7 +60,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerCollectionFactory * @param null|\Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -69,7 +69,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerCollectionFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_customerCollectionFactory = $customerCollectionFactory; diff --git a/app/code/Magento/Newsletter/Model/Resource/Queue.php b/app/code/Magento/Newsletter/Model/Resource/Queue.php index 2b4dda041da..025d08b3f5f 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Queue.php +++ b/app/code/Magento/Newsletter/Model/Resource/Queue.php @@ -26,7 +26,7 @@ namespace Magento\Newsletter\Model\Resource; use Magento\Newsletter\Model\Queue as ModelQueue; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Newsletter queue resource model @@ -35,7 +35,7 @@ use Magento\Core\Model\AbstractModel; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Queue extends \Magento\Core\Model\Resource\Db\AbstractDb +class Queue extends \Magento\Model\Resource\Db\AbstractDb { /** * Subscriber collection @@ -74,16 +74,16 @@ class Queue extends \Magento\Core\Model\Resource\Db\AbstractDb * @param ModelQueue $queue * @param array $subscriberIds * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addSubscribersToQueue(ModelQueue $queue, array $subscriberIds) { if (count($subscriberIds) == 0) { - throw new \Magento\Core\Exception(__('There are no subscribers selected.')); + throw new \Magento\Model\Exception(__('There are no subscribers selected.')); } if (!$queue->getId() && $queue->getQueueStatus() != Magento_Newsletter_Model_Queue::STATUS_NEVER) { - throw new \Magento\Core\Exception(__('You selected an invalid queue.')); + throw new \Magento\Model\Exception(__('You selected an invalid queue.')); } $adapter = $this->_getWriteAdapter(); diff --git a/app/code/Magento/Newsletter/Model/Resource/Queue/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Queue/Collection.php index 4d8c89c6ccf..879ff3bca7f 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Queue/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Queue/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Newsletter\Model\Resource\Queue; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * True when subscribers info joined @@ -62,7 +62,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Stdlib\DateTime\DateTime $date * @param null|\Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -71,7 +71,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Stdlib\DateTime\DateTime $date, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_date = $date; diff --git a/app/code/Magento/Newsletter/Model/Resource/Subscriber.php b/app/code/Magento/Newsletter/Model/Resource/Subscriber.php index 78e89e550dc..3c82cf898f8 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Resource/Subscriber.php @@ -32,7 +32,7 @@ namespace Magento\Newsletter\Model\Resource; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Subscriber extends \Magento\Core\Model\Resource\Db\AbstractDb +class Subscriber extends \Magento\Model\Resource\Db\AbstractDb { /** * DB read connection @@ -178,7 +178,7 @@ class Subscriber extends \Magento\Core\Model\Resource\Db\AbstractDb * @param \Magento\Newsletter\Model\Subscriber $subscriber * @param \Magento\Newsletter\Model\Queue $queue * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function received(\Magento\Newsletter\Model\Subscriber $subscriber, \Magento\Newsletter\Model\Queue $queue) { @@ -193,7 +193,7 @@ class Subscriber extends \Magento\Core\Model\Resource\Db\AbstractDb $this->_write->commit(); } catch (\Exception $e) { $this->_write->rollBack(); - throw new \Magento\Core\Exception(__('We cannot mark as received subscriber.')); + throw new \Magento\Model\Exception(__('We cannot mark as received subscriber.')); } return $this; } diff --git a/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php index 8e0647f0f20..0788cf15b8f 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php @@ -34,7 +34,7 @@ use Magento\Newsletter\Model\Queue as ModelQueue; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Queue link table name @@ -85,7 +85,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param null|\Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -94,7 +94,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Customer\Model\CustomerFactory $customerFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { // _customerFactory is used in parent class constructor $this->_customerFactory = $customerFactory; diff --git a/app/code/Magento/Newsletter/Model/Resource/Template.php b/app/code/Magento/Newsletter/Model/Resource/Template.php index 2c8d4d843ac..08eaf75852f 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Template.php +++ b/app/code/Magento/Newsletter/Model/Resource/Template.php @@ -32,7 +32,7 @@ namespace Magento\Newsletter\Model\Resource; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Template extends \Magento\Core\Model\Resource\Db\AbstractDb +class Template extends \Magento\Model\Resource\Db\AbstractDb { /** * Date @@ -153,14 +153,14 @@ class Template extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if ($this->checkCodeUsage($object)) { - throw new \Magento\Core\Exception(__('Duplicate template code')); + throw new \Magento\Model\Exception(__('Duplicate template code')); } if (!$object->hasTemplateActual()) { diff --git a/app/code/Magento/Newsletter/Model/Resource/Template/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Template/Collection.php index 54415b79ced..f6a6ed7723e 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Template/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Template/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Newsletter\Model\Resource\Template; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define resource model and model diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php index 9fadd615058..d3b6d0b91f9 100644 --- a/app/code/Magento/Newsletter/Model/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Subscriber.php @@ -43,7 +43,7 @@ namespace Magento\Newsletter\Model; * @method int getSubscriberId() * @method Subscriber setSubscriberId(int $value) */ -class Subscriber extends \Magento\Core\Model\AbstractModel +class Subscriber extends \Magento\Model\AbstractModel { const STATUS_SUBSCRIBED = 1; @@ -113,13 +113,6 @@ class Subscriber extends \Magento\Core\Model\AbstractModel */ protected $_customerSession; - /** - * Translate - * - * @var \Magento\TranslateInterface - */ - protected $_translate; - /** * Store manager * @@ -140,8 +133,11 @@ class Subscriber extends \Magento\Core\Model\AbstractModel protected $_transportBuilder; /** - * Construct - * + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + + /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Newsletter\Helper\Data $newsletterData @@ -149,9 +145,9 @@ class Subscriber extends \Magento\Core\Model\AbstractModel * @param \Magento\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\TranslateInterface $translate * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -163,20 +159,20 @@ class Subscriber extends \Magento\Core\Model\AbstractModel \Magento\Mail\Template\TransportBuilder $transportBuilder, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\TranslateInterface $translate, \Magento\Customer\Model\Session $customerSession, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Translate\Inline\StateInterface $inlineTranslation, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_newsletterData = $newsletterData; $this->_coreStoreConfig = $coreStoreConfig; $this->_transportBuilder = $transportBuilder; $this->_customerFactory = $customerFactory; $this->_storeManager = $storeManager; - $this->_translate = $translate; $this->_customerSession = $customerSession; + $this->inlineTranslation = $inlineTranslation; + parent::__construct($context, $registry, $resource, $resourceCollection, $data); } /** @@ -467,13 +463,13 @@ class Subscriber extends \Magento\Core\Model\AbstractModel /** * Unsubscribes loaded subscription * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function unsubscribe() { if ($this->hasCheckCode() && $this->getCode() != $this->getCheckCode()) { - throw new \Magento\Core\Exception(__('This is an invalid subscription confirmation code.')); + throw new \Magento\Model\Exception(__('This is an invalid subscription confirmation code.')); } $this->setSubscriberStatus(self::STATUS_UNSUBSCRIBED)->save(); @@ -625,8 +621,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel return $this; } - $translate = $this->_translate->getTranslateInline(); - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_TEMPLATE) @@ -646,7 +641,8 @@ class Subscriber extends \Magento\Core\Model\AbstractModel $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); - $this->_translate->setTranslateInline($translate); + $this->inlineTranslation->resume(); + return $this; } @@ -670,8 +666,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel return $this; } - $translate = $this->_translate->getTranslateInline(); - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_TEMPLATE) @@ -691,7 +686,8 @@ class Subscriber extends \Magento\Core\Model\AbstractModel $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); - $this->_translate->setTranslateInline($translate); + $this->inlineTranslation->resume(); + return $this; } @@ -714,8 +710,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel return $this; } - $translate = $this->_translate->getTranslateInline(); - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE) @@ -735,7 +730,8 @@ class Subscriber extends \Magento\Core\Model\AbstractModel $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); - $this->_translate->setTranslateInline($translate); + $this->inlineTranslation->resume(); + return $this; } diff --git a/app/code/Magento/Newsletter/Model/Template.php b/app/code/Magento/Newsletter/Model/Template.php index d539fe7c355..d8907278458 100644 --- a/app/code/Magento/Newsletter/Model/Template.php +++ b/app/code/Magento/Newsletter/Model/Template.php @@ -160,7 +160,7 @@ class Template extends \Magento\Core\Model\Template * Validate Newsletter template * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate() { @@ -188,7 +188,7 @@ class Template extends \Magento\Core\Model\Template } } - throw new \Magento\Core\Exception(join("\n", $errorMessages)); + throw new \Magento\Model\Exception(join("\n", $errorMessages)); } } diff --git a/app/code/Magento/OfflineShipping/Model/Config/Backend/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Config/Backend/Tablerate.php index 00a4105295d..0195e5200f2 100644 --- a/app/code/Magento/OfflineShipping/Model/Config/Backend/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Config/Backend/Tablerate.php @@ -23,7 +23,7 @@ */ namespace Magento\OfflineShipping\Model\Config\Backend; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Backend model for shipping table rates CSV importing @@ -43,7 +43,7 @@ class Tablerate extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\OfflineShipping\Model\Resource\Carrier\TablerateFactory $tablerateFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -53,7 +53,7 @@ class Tablerate extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\OfflineShipping\Model\Resource\Carrier\TablerateFactory $tablerateFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php index 9bdbdfb47e2..dcc235bacf7 100644 --- a/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php @@ -31,7 +31,7 @@ */ namespace Magento\OfflineShipping\Model\Resource\Carrier; -class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb +class Tablerate extends \Magento\Model\Resource\Db\AbstractDb { /** * Import table rates website ID @@ -254,7 +254,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb * Upload table rate file and import data from it * * @param \Magento\Object $object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\OfflineShipping\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 @@ -281,7 +281,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb $headers = $stream->readCsv(); if ($headers === false || count($headers) < 5) { $stream->close(); - throw new \Magento\Core\Exception(__('Please correct Table Rates File Format.')); + throw new \Magento\Model\Exception(__('Please correct Table Rates File Format.')); } if ($object->getData('groups/tablerate/fields/condition_name/inherit') == '1') { @@ -327,15 +327,15 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb } $this->_saveImportData($importData); $stream->close(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $adapter->rollback(); $stream->close(); - throw new \Magento\Core\Exception($e->getMessage()); + throw new \Magento\Model\Exception($e->getMessage()); } catch (\Exception $e) { $adapter->rollback(); $stream->close(); $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('Something went wrong while importing table rates.')); + throw new \Magento\Model\Exception(__('Something went wrong while importing table rates.')); } $adapter->commit(); @@ -345,7 +345,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb 'We couldn\'t import this file because of these errors: %1', implode(" \n", $this->_importErrors) ); - throw new \Magento\Core\Exception($error); + throw new \Magento\Model\Exception($error); } return $this; diff --git a/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate/Collection.php b/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate/Collection.php index d22f6d015f6..a854a890e3e 100644 --- a/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate/Collection.php +++ b/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate/Collection.php @@ -28,7 +28,7 @@ namespace Magento\OfflineShipping\Model\Resource\Carrier\Tablerate; * * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Directory/country table name diff --git a/app/code/Magento/Ogone/Controller/Api.php b/app/code/Magento/Ogone/Controller/Api.php index 1f34dbf0b9d..05695d9952b 100644 --- a/app/code/Magento/Ogone/Controller/Api.php +++ b/app/code/Magento/Ogone/Controller/Api.php @@ -45,18 +45,18 @@ class Api extends \Magento\App\Action\Action protected $_salesOrderFactory; /** - * @var \Magento\Core\Model\Resource\TransactionFactory + * @var \Magento\DB\TransactionFactory */ protected $_transactionFactory; /** * @param \Magento\App\Action\Context $context - * @param \Magento\Core\Model\Resource\TransactionFactory $transactionFactory + * @param \Magento\DB\TransactionFactory $transactionFactory * @param \Magento\Sales\Model\OrderFactory $salesOrderFactory */ public function __construct( \Magento\App\Action\Context $context, - \Magento\Core\Model\Resource\TransactionFactory $transactionFactory, + \Magento\DB\TransactionFactory $transactionFactory, \Magento\Sales\Model\OrderFactory $salesOrderFactory ) { parent::__construct($context); diff --git a/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php b/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php index daf7ed6a83e..f4c1fadeafc 100644 --- a/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php +++ b/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php @@ -35,14 +35,14 @@ class Ttl extends \Magento\Core\Model\Config\Value /** * Throw exception if Ttl data is invalid or empty * - * @return $this|\Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return $this + * @throws \Magento\Model\Exception */ protected function _beforeSave() { $value = $this->getValue(); if ($value < 0 || !preg_match('/^[0-9]+$/', $value)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Ttl value "%1" is not valid. Please use only numbers equal or greater than zero.', $value) ); } diff --git a/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php b/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php index c42748f82ec..33574f73886 100644 --- a/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php +++ b/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php @@ -39,8 +39,8 @@ class Varnish extends \Magento\Core\Model\Config\Value /** * Set default data if empty fields have been left * - * @return $this|\Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return $this|\Magento\Model\AbstractModel + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -69,7 +69,7 @@ class Varnish extends \Magento\Core\Model\Config\Value /** * If fields are empty fill them with default data * - * @return $this|\Magento\Core\Model\AbstractModel + * @return $this|\Magento\Model\AbstractModel */ protected function _afterLoad() { diff --git a/app/code/Magento/PayPalRecurringPayment/Model/Api/Nvp.php b/app/code/Magento/PayPalRecurringPayment/Model/Api/Nvp.php index 2c2c438a8cc..89eb59b78e9 100644 --- a/app/code/Magento/PayPalRecurringPayment/Model/Api/Nvp.php +++ b/app/code/Magento/PayPalRecurringPayment/Model/Api/Nvp.php @@ -125,7 +125,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp * SetExpressCheckout call * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout * TODO: put together style and giropay settings */ @@ -156,7 +156,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp foreach ($payments as $payment) { $payment->setMethodCode(\Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS); if (!$payment->isValid()) { - throw new \Magento\Core\Exception($payment->getValidationErrors()); + throw new \Magento\Model\Exception($payment->getValidationErrors()); } $request["L_BILLINGTYPE{$i}"] = 'RecurringPayments'; $request["L_BILLINGAGREEMENTDESCRIPTION{$i}"] = $payment->getScheduleDescription(); @@ -223,7 +223,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp * ManageRecurringPaymentStatus call * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function callManageRecurringPaymentStatus() { @@ -233,7 +233,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp } try { $this->call('ManageRecurringPaymentsProfileStatus', $request); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if (in_array( 11556, $this->_callErrors @@ -245,7 +245,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp $this->_callErrors ) && 'Reactivate' === $request['ACTION'] ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We can\'t change the status because the current status doesn\'t match the real status.') ); } diff --git a/app/code/Magento/PayPalRecurringPayment/Model/Express.php b/app/code/Magento/PayPalRecurringPayment/Model/Express.php index 21eab4d0d02..319f97d3079 100644 --- a/app/code/Magento/PayPalRecurringPayment/Model/Express.php +++ b/app/code/Magento/PayPalRecurringPayment/Model/Express.php @@ -59,7 +59,7 @@ class Express implements ManagerInterface * * @param RecurringPayment $payment * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate(RecurringPayment $payment) { @@ -81,7 +81,7 @@ class Express implements ManagerInterface $errors[] = __('The schedule description is too long.'); } if ($errors) { - throw new \Magento\Core\Exception(implode(' ', $errors)); + throw new \Magento\Model\Exception(implode(' ', $errors)); } } diff --git a/app/code/Magento/PayPalRecurringPayment/Model/Ipn.php b/app/code/Magento/PayPalRecurringPayment/Model/Ipn.php index aa0648f4c15..b032a058c3a 100644 --- a/app/code/Magento/PayPalRecurringPayment/Model/Ipn.php +++ b/app/code/Magento/PayPalRecurringPayment/Model/Ipn.php @@ -120,7 +120,7 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements \Magento\Paypal\M * Process notification from recurring payments * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws Exception */ protected function _processRecurringPayment() @@ -173,7 +173,7 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements \Magento\Paypal\M $message = __('You notified customer about invoice #%1.', $invoice->getIncrementId()); $order->sendNewOrderEmail()->addStatusHistoryComment($message)->setIsCustomerNotified(true)->save(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $comment = $this->_createIpnComment(__('Note: %1', $e->getMessage()), true); //TODO: add to payment comments //$comment->save(); diff --git a/app/code/Magento/PayPalRecurringPayment/etc/module.xml b/app/code/Magento/PayPalRecurringPayment/etc/module.xml index 8c212ec8acf..d95906ac37a 100644 --- a/app/code/Magento/PayPalRecurringPayment/etc/module.xml +++ b/app/code/Magento/PayPalRecurringPayment/etc/module.xml @@ -26,7 +26,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_PayPalRecurringPayment" version="1.0.0.0" active="true"> <depends> - <module name="Magento_Core"/> <module name="Magento_Customer" /> <module name="Magento_Directory" /> <module name="Magento_Payment"/> diff --git a/app/code/Magento/Payment/Block/Form.php b/app/code/Magento/Payment/Block/Form.php index ef032ff6a76..5e5ec4f5145 100644 --- a/app/code/Magento/Payment/Block/Form.php +++ b/app/code/Magento/Payment/Block/Form.php @@ -34,14 +34,14 @@ class Form extends \Magento\View\Element\Template * Retrieve payment method model * * @return \Magento\Payment\Model\MethodInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getMethod() { $method = $this->getData('method'); if (!$method instanceof \Magento\Payment\Model\MethodInterface) { - throw new \Magento\Core\Exception(__('We cannot retrieve the payment method model object.')); + throw new \Magento\Model\Exception(__('We cannot retrieve the payment method model object.')); } return $method; } diff --git a/app/code/Magento/Payment/Block/Info.php b/app/code/Magento/Payment/Block/Info.php index ac47b245402..07f8dfec54d 100644 --- a/app/code/Magento/Payment/Block/Info.php +++ b/app/code/Magento/Payment/Block/Info.php @@ -46,13 +46,13 @@ class Info extends \Magento\View\Element\Template * Retrieve info model * * @return \Magento\Payment\Model\Info - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getInfo() { $info = $this->getData('info'); if (!$info instanceof \Magento\Payment\Model\Info) { - throw new \Magento\Core\Exception(__('We cannot retrieve the payment info model object.')); + throw new \Magento\Model\Exception(__('We cannot retrieve the payment info model object.')); } return $info; } diff --git a/app/code/Magento/Payment/Model/Checks/SpecificationFactory.php b/app/code/Magento/Payment/Model/Checks/SpecificationFactory.php index a429864e17e..58511c276b4 100644 --- a/app/code/Magento/Payment/Model/Checks/SpecificationFactory.php +++ b/app/code/Magento/Payment/Model/Checks/SpecificationFactory.php @@ -55,7 +55,7 @@ class SpecificationFactory * * @param array $data * @return SpecificationInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($data) { diff --git a/app/code/Magento/Payment/Model/Info.php b/app/code/Magento/Payment/Model/Info.php index c6d42e88bd0..260c3f183bf 100644 --- a/app/code/Magento/Payment/Model/Info.php +++ b/app/code/Magento/Payment/Model/Info.php @@ -28,7 +28,7 @@ namespace Magento\Payment\Model; /** * Payment information model */ -class Info extends \Magento\Core\Model\AbstractModel +class Info extends \Magento\Model\AbstractModel { /** * Additional information container @@ -54,7 +54,7 @@ class Info extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Encryption\EncryptorInterface $encryptor - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -63,7 +63,7 @@ class Info extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Payment\Helper\Data $paymentData, \Magento\Encryption\EncryptorInterface $encryptor, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -98,7 +98,7 @@ class Info extends \Magento\Core\Model\AbstractModel * Retrieve payment method model object * * @return \Magento\Payment\Model\MethodInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getMethodInstance() { @@ -111,7 +111,7 @@ class Info extends \Magento\Core\Model\AbstractModel return $instance; } } - throw new \Magento\Core\Exception(__('The payment method you requested is not available.')); + throw new \Magento\Model\Exception(__('The payment method you requested is not available.')); } return $this->_getData('method_instance'); @@ -153,12 +153,12 @@ class Info extends \Magento\Core\Model\AbstractModel * @param string|array $key * @param mixed $value * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setAdditionalInformation($key, $value = null) { if (is_object($value)) { - throw new \Magento\Core\Exception(__('The payment disallows storing objects.')); + throw new \Magento\Model\Exception(__('The payment disallows storing objects.')); } $this->_initAdditionalInformation(); if (is_array($key) && is_null($value)) { diff --git a/app/code/Magento/Payment/Model/Info/Exception.php b/app/code/Magento/Payment/Model/Info/Exception.php index ff92ffae48a..b127a3ca54c 100644 --- a/app/code/Magento/Payment/Model/Info/Exception.php +++ b/app/code/Magento/Payment/Model/Info/Exception.php @@ -34,6 +34,6 @@ namespace Magento\Payment\Model\Info; * @package Magento_Payment * @author Magento Core Team <core@magentocommerce.com> */ -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Payment/Model/Method/AbstractMethod.php b/app/code/Magento/Payment/Model/Method/AbstractMethod.php index 9e660f6c569..59eef7598d3 100644 --- a/app/code/Magento/Payment/Model/Method/AbstractMethod.php +++ b/app/code/Magento/Payment/Model/Method/AbstractMethod.php @@ -414,12 +414,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * Retrieve payment method code * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getCode() { if (empty($this->_code)) { - throw new \Magento\Core\Exception(__('We cannot retrieve the payment method code.')); + throw new \Magento\Model\Exception(__('We cannot retrieve the payment method code.')); } return $this->_code; } @@ -448,13 +448,13 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * Retrieve payment iformation model object * * @return \Magento\Payment\Model\Info - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getInfoInstance() { $instance = $this->getData('info_instance'); if (!$instance instanceof \Magento\Payment\Model\Info) { - throw new \Magento\Core\Exception(__('We cannot retrieve the payment information object instance.')); + throw new \Magento\Model\Exception(__('We cannot retrieve the payment information object instance.')); } return $instance; } @@ -463,7 +463,7 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * Validate payment method information object * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate() { @@ -477,7 +477,7 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen $billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId(); } if (!$this->canUseForCountry($billingCountry)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('You can\'t use the payment type you selected to make payments to the billing country.') ); } @@ -491,12 +491,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * @param float $amount * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function order(\Magento\Object $payment, $amount) { if (!$this->canOrder()) { - throw new \Magento\Core\Exception(__('The order action is not available.')); + throw new \Magento\Model\Exception(__('The order action is not available.')); } return $this; } @@ -508,12 +508,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * @param float $amount * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function authorize(\Magento\Object $payment, $amount) { if (!$this->canAuthorize()) { - throw new \Magento\Core\Exception(__('The authorize action is not available.')); + throw new \Magento\Model\Exception(__('The authorize action is not available.')); } return $this; } @@ -525,12 +525,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * @param float $amount * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function capture(\Magento\Object $payment, $amount) { if (!$this->canCapture()) { - throw new \Magento\Core\Exception(__('The capture action is not available.')); + throw new \Magento\Model\Exception(__('The capture action is not available.')); } return $this; @@ -572,12 +572,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * @param \Magento\Object $payment * @param float $amount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function refund(\Magento\Object $payment, $amount) { if (!$this->canRefund()) { - throw new \Magento\Core\Exception(__('The refund action is not available.')); + throw new \Magento\Model\Exception(__('The refund action is not available.')); } return $this; } @@ -611,12 +611,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * * @param \Magento\Object $payment * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function void(\Magento\Object $payment) { if (!$this->canVoid($payment)) { - throw new \Magento\Core\Exception(__('Void action is not available.')); + throw new \Magento\Model\Exception(__('Void action is not available.')); } return $this; } @@ -637,12 +637,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * * @param \Magento\Payment\Model\Info $payment * @return false - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function acceptPayment(\Magento\Payment\Model\Info $payment) { if (!$this->canReviewPayment($payment)) { - throw new \Magento\Core\Exception(__('The payment review action is unavailable.')); + throw new \Magento\Model\Exception(__('The payment review action is unavailable.')); } return false; } @@ -652,12 +652,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * * @param \Magento\Payment\Model\Info $payment * @return false - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function denyPayment(\Magento\Payment\Model\Info $payment) { if (!$this->canReviewPayment($payment)) { - throw new \Magento\Core\Exception(__('The payment review action is unavailable.')); + throw new \Magento\Model\Exception(__('The payment review action is unavailable.')); } return false; } diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index dc7077efb4e..4304f2ef94b 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -151,7 +151,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod * Validate payment method information object * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -245,7 +245,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod } if ($errorMsg) { - throw new \Magento\Core\Exception($errorMsg); + throw new \Magento\Model\Exception($errorMsg); } //This must be after all validation conditions diff --git a/app/code/Magento/Payment/Model/Method/Factory.php b/app/code/Magento/Payment/Model/Method/Factory.php index 1134b9ea9d5..a8c90fa1012 100644 --- a/app/code/Magento/Payment/Model/Method/Factory.php +++ b/app/code/Magento/Payment/Model/Method/Factory.php @@ -51,13 +51,13 @@ class Factory * @param string $className * @param array $data * @return \Magento\Payment\Model\MethodInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($className, $data = array()) { $method = $this->_objectManager->create($className, $data); if (!$method instanceof \Magento\Payment\Model\MethodInterface) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( sprintf("%s class doesn't implement \Magento\Payment\Model\MethodInterface", $className) ); } diff --git a/app/code/Magento/Paypal/Block/Iframe.php b/app/code/Magento/Paypal/Block/Iframe.php index 22751df758d..d4852ca0fd7 100644 --- a/app/code/Magento/Paypal/Block/Iframe.php +++ b/app/code/Magento/Paypal/Block/Iframe.php @@ -127,7 +127,7 @@ class Iframe extends \Magento\Payment\Block\Form * Get current block instance * * @return \Magento\Payment\Block\Form - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getBlock() { @@ -140,7 +140,7 @@ class Iframe extends \Magento\Payment\Block\Form ) . '\\Iframe' ); if (!$this->_block instanceof \Magento\Paypal\Block\Iframe) { - throw new \Magento\Core\Exception('Invalid block type'); + throw new \Magento\Model\Exception('Invalid block type'); } } diff --git a/app/code/Magento/Paypal/Block/Payflow/Advanced/Iframe.php b/app/code/Magento/Paypal/Block/Payflow/Advanced/Iframe.php index 8e40c6a6c7d..0a267280434 100644 --- a/app/code/Magento/Paypal/Block/Payflow/Advanced/Iframe.php +++ b/app/code/Magento/Paypal/Block/Payflow/Advanced/Iframe.php @@ -34,6 +34,26 @@ namespace Magento\Paypal\Block\Payflow\Advanced; */ class Iframe extends \Magento\Paypal\Block\Payflow\Link\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 + */ + public function __construct( + \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() + ) { + parent::__construct($context, $orderFactory, $checkoutSession, $hssHelper, $paymentData, $data); + $this->_isScopePrivate = false; + } + /** * Set payment method code * diff --git a/app/code/Magento/Paypal/Controller/Adminhtml/Billing/Agreement.php b/app/code/Magento/Paypal/Controller/Adminhtml/Billing/Agreement.php index 971cd2c437d..28cc38ec827 100644 --- a/app/code/Magento/Paypal/Controller/Adminhtml/Billing/Agreement.php +++ b/app/code/Magento/Paypal/Controller/Adminhtml/Billing/Agreement.php @@ -132,7 +132,7 @@ class Agreement extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You canceled the billing agreement.')); $this->_redirect('paypal/*/view', array('_current' => true)); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We could not cancel the billing agreement.')); @@ -158,7 +158,7 @@ class Agreement extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You deleted the billing agreement.')); $this->_redirect('paypal/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We could not delete the billing agreement.')); diff --git a/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php b/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php index dd97af93737..d4a1a96f742 100644 --- a/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php +++ b/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php @@ -124,7 +124,7 @@ class Reports extends \Magento\Backend\App\Action * Forced fetch reports action * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function fetchAction() { @@ -133,7 +133,7 @@ class Reports extends \Magento\Backend\App\Action /* @var $reports \Magento\Paypal\Model\Report\Settlement */ $credentials = $reports->getSftpCredentials(); if (empty($credentials)) { - throw new \Magento\Core\Exception(__('We found nothing to fetch because of an empty configuration.')); + throw new \Magento\Model\Exception(__('We found nothing to fetch because of an empty configuration.')); } foreach ($credentials as $config) { try { @@ -155,7 +155,7 @@ class Reports extends \Magento\Backend\App\Action $this->_logger->logException($e); } } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_logger->logException($e); diff --git a/app/code/Magento/Paypal/Controller/Billing/Agreement.php b/app/code/Magento/Paypal/Controller/Billing/Agreement.php index 9e07594cb1c..10fbd747956 100644 --- a/app/code/Magento/Paypal/Controller/Billing/Agreement.php +++ b/app/code/Magento/Paypal/Controller/Billing/Agreement.php @@ -140,7 +140,7 @@ class Agreement extends \Magento\App\Action\Action ); return $this->getResponse()->setRedirect($agreement->initToken()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); @@ -176,7 +176,7 @@ class Agreement extends \Magento\App\Action\Action ); $this->_redirect('*/*/view', array('agreement' => $agreement->getId())); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); @@ -214,7 +214,7 @@ class Agreement extends \Magento\App\Action\Action $this->messageManager->addNotice( __('The billing agreement "%1" has been canceled.', $agreement->getReferenceId()) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); diff --git a/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php b/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php index 7e980e813e5..5faab9ef7fd 100644 --- a/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php +++ b/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php @@ -197,7 +197,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements $this->getResponse()->setRedirect($url); return; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t start Express Checkout.')); @@ -249,7 +249,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements } else { $this->messageManager->addSuccess(__('Express Checkout has been canceled.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Unable to cancel Express Checkout')); @@ -271,7 +271,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements $this->_checkout->returnFromPaypal($this->_initToken()); $this->_redirect('*/*/review'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t process Express Checkout approval.')); @@ -300,7 +300,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements } $this->_view->renderLayout(); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t initialize Express Checkout review.')); @@ -318,7 +318,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements { try { $this->getResponse()->setRedirect($this->_config->getExpressCheckoutEditUrl($this->_initToken())); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/review'); } @@ -342,7 +342,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements ); return; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t update shipping method.')); @@ -379,7 +379,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements )->toHtml() ); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t update Order data.')); @@ -408,7 +408,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements ); return; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t update Order data.')); @@ -429,7 +429,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements * Submit the order * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function placeOrderAction() { @@ -440,7 +440,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements if ($requiredAgreements) { $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array())); if (array_diff($requiredAgreements, $postedAgreements)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please agree to all the terms and conditions before placing the order.') ); } @@ -481,7 +481,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements // no need in token anymore $this->_redirect('checkout/onepage/success'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t place the order.')); @@ -494,14 +494,14 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements * Instantiate quote and checkout * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ private function _initCheckout() { $quote = $this->_getQuote(); if (!$quote->hasItems() || $quote->getHasError()) { $this->getResponse()->setHeader('HTTP/1.1', '403 Forbidden'); - throw new \Magento\Core\Exception(__('We can\'t initialize Express Checkout.')); + throw new \Magento\Model\Exception(__('We can\'t initialize Express Checkout.')); } if (!isset($this->_checkoutTypes[$this->_checkoutType])) { $parameters = array('params' => array('quote' => $quote, 'config' => $this->_config)); @@ -519,7 +519,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements * * @param string|null $setToken * @return \Magento\Paypal\Controller\Express|string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initToken($setToken = null) { @@ -527,7 +527,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements if (false === $setToken) { // security measure for avoid unsetting token twice if (!$this->_getSession()->getExpressCheckoutToken()) { - throw new \Magento\Core\Exception(__('PayPal Express Checkout Token does not exist.')); + throw new \Magento\Model\Exception(__('PayPal Express Checkout Token does not exist.')); } $this->_getSession()->unsExpressCheckoutToken(); } else { @@ -538,7 +538,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements $setToken = $this->getRequest()->getParam('token'); if ($setToken) { if ($setToken !== $this->_getSession()->getExpressCheckoutToken()) { - throw new \Magento\Core\Exception(__('A wrong PayPal Express Checkout Token is specified.')); + throw new \Magento\Model\Exception(__('A wrong PayPal Express Checkout Token is specified.')); } } else { $setToken = $this->_getSession()->getExpressCheckoutToken(); diff --git a/app/code/Magento/Paypal/Exception.php b/app/code/Magento/Paypal/Exception.php index deb9c148aff..026ecf539ba 100644 --- a/app/code/Magento/Paypal/Exception.php +++ b/app/code/Magento/Paypal/Exception.php @@ -25,6 +25,6 @@ */ namespace Magento\Paypal; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Paypal/Model/Api/Nvp.php b/app/code/Magento/Paypal/Model/Api/Nvp.php index 1befeea7187..80287448be6 100644 --- a/app/code/Magento/Paypal/Model/Api/Nvp.php +++ b/app/code/Magento/Paypal/Model/Api/Nvp.php @@ -1080,7 +1080,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi $request = $this->_exportToRequest($this->_updateBillingAgreementRequest); try { $response = $this->call('BillAgreementUpdate', $request); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if (in_array(10201, $this->_callErrors)) { $this->setIsBillingAgreementAlreadyCancelled(true); } @@ -1159,7 +1159,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi * @param string $methodName * @param array $request * @return array - * @throws \Magento\Core\Exception|\Exception + * @throws \Magento\Model\Exception|\Exception */ public function call($methodName, array $request) { @@ -1216,7 +1216,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi ); $http->close(); - throw new \Magento\Core\Exception(__('We can\'t contact the PayPal gateway.')); + throw new \Magento\Model\Exception(__('We can\'t contact the PayPal gateway.')); } // cUrl resource must be closed after checking it for errors @@ -1224,7 +1224,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi if (!$this->_validateResponse($methodName, $response)) { $this->_logger->logException(new \Exception(__("PayPal response hasn't required fields."))); - throw new \Magento\Core\Exception(__('Something went wrong while processing your order.')); + throw new \Magento\Model\Exception(__('Something went wrong while processing your order.')); } $this->_callErrors = array(); @@ -1255,7 +1255,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi * * @param array $response * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _handleCallErrors($response) { @@ -1283,7 +1283,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi } if ($errors) { $errors = implode(' ', $errors); - $e = new \Magento\Core\Exception( + $e = new \Magento\Model\Exception( sprintf( 'PayPal NVP gateway errors: %s Correlation ID: %s. Version: %s.', $errors, diff --git a/app/code/Magento/Paypal/Model/Api/PayflowNvp.php b/app/code/Magento/Paypal/Model/Api/PayflowNvp.php index f94c4486e88..7114a088aba 100644 --- a/app/code/Magento/Paypal/Model/Api/PayflowNvp.php +++ b/app/code/Magento/Paypal/Model/Api/PayflowNvp.php @@ -632,7 +632,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp * * @param array $response * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _handleCallErrors($response) { @@ -640,7 +640,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp $message = $response['RESPMSG']; $e = new \Exception(sprintf('PayPal gateway errors: %s.', $message)); $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('PayPal gateway rejected the request. %1', $message)); + throw new \Magento\Model\Exception(__('PayPal gateway rejected the request. %1', $message)); } } diff --git a/app/code/Magento/Paypal/Model/Billing/AbstractAgreement.php b/app/code/Magento/Paypal/Model/Billing/AbstractAgreement.php index 86c010bbd22..02c42adf3cd 100644 --- a/app/code/Magento/Paypal/Model/Billing/AbstractAgreement.php +++ b/app/code/Magento/Paypal/Model/Billing/AbstractAgreement.php @@ -26,7 +26,7 @@ namespace Magento\Paypal\Model\Billing; /** * Billing Agreement abstaract class */ -abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel +abstract class AbstractAgreement extends \Magento\Model\AbstractModel { /** * Payment method instance @@ -81,7 +81,7 @@ abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -89,7 +89,7 @@ abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -133,8 +133,8 @@ abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel /** * Before save, it's overridden just to make data validation on before save event * - * @throws \Magento\Core\Exception - * @return \Magento\Core\Model\AbstractModel + * @throws \Magento\Model\Exception + * @return \Magento\Model\AbstractModel */ protected function _beforeSave() { @@ -142,6 +142,6 @@ abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel return parent::_beforeSave(); } array_unshift($this->_errors, __('Unable to save Billing Agreement:')); - throw new \Magento\Core\Exception(implode(' ', $this->_errors)); + throw new \Magento\Model\Exception(implode(' ', $this->_errors)); } } diff --git a/app/code/Magento/Paypal/Model/Billing/Agreement.php b/app/code/Magento/Paypal/Model/Billing/Agreement.php index 52145362df8..1685646f7a8 100644 --- a/app/code/Magento/Paypal/Model/Billing/Agreement.php +++ b/app/code/Magento/Paypal/Model/Billing/Agreement.php @@ -76,7 +76,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Paypal\Model\Resource\Billing\Agreement\CollectionFactory $billingAgreementFactory * @param \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -86,7 +86,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement \Magento\Payment\Helper\Data $paymentData, \Magento\Paypal\Model\Resource\Billing\Agreement\CollectionFactory $billingAgreementFactory, \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -108,7 +108,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement /** * Set created_at parameter * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _beforeSave() { @@ -124,7 +124,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement /** * Save agreement order relations * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterSave() { diff --git a/app/code/Magento/Paypal/Model/Cert.php b/app/code/Magento/Paypal/Model/Cert.php index ab4edd8acc5..16caa272012 100644 --- a/app/code/Magento/Paypal/Model/Cert.php +++ b/app/code/Magento/Paypal/Model/Cert.php @@ -30,7 +30,7 @@ use Magento\Filesystem\Directory\WriteInterface; /** * PayPal specific model for certificate based authentication */ -class Cert extends \Magento\Core\Model\AbstractModel +class Cert extends \Magento\Model\AbstractModel { /** * Certificate base path @@ -52,7 +52,7 @@ class Cert extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\App\Filesystem $filesystem * @param \Magento\Encryption\EncryptorInterface $encryptor - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -61,7 +61,7 @@ class Cert extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\App\Filesystem $filesystem, \Magento\Encryption\EncryptorInterface $encryptor, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -98,12 +98,12 @@ class Cert extends \Magento\Core\Model\AbstractModel * Get path to PayPal certificate file, if file does not exist try to create it * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getCertPath() { if (!$this->getContent()) { - throw new \Magento\Core\Exception(__('The PayPal certificate does not exist.')); + throw new \Magento\Model\Exception(__('The PayPal certificate does not exist.')); } $certFileName = sprintf('cert_%s_%s.pem', $this->getWebsiteId(), strtotime($this->getUpdatedAt())); diff --git a/app/code/Magento/Paypal/Model/Direct.php b/app/code/Magento/Paypal/Model/Direct.php index 88b8c491a73..ddb2d1b082e 100644 --- a/app/code/Magento/Paypal/Model/Direct.php +++ b/app/code/Magento/Paypal/Model/Direct.php @@ -503,7 +503,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc try { $api->callGetTransactionDetails(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { // if we receive errors, but DoDirectPayment response is Success, then set Pending status for transaction $payment->setIsTransactionPending(true); } diff --git a/app/code/Magento/Paypal/Model/Express.php b/app/code/Magento/Paypal/Model/Express.php index afaea5b11cb..6c0b2c3bfdf 100644 --- a/app/code/Magento/Paypal/Model/Express.php +++ b/app/code/Magento/Paypal/Model/Express.php @@ -403,7 +403,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod * * @param \Magento\Object|Payment $payment * @param float $amount - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function capture(\Magento\Object $payment, $amount) @@ -438,7 +438,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod if ($authorizationTransaction->getIsClosed() || $voided) { if ($payment->getAdditionalInformation($this->_authorizationCountKey) > $maxAuthorizationNumber - 1) { - throw new \Magento\Core\Exception(__('The maximum number of child authorizations is reached.')); + throw new \Magento\Model\Exception(__('The maximum number of child authorizations is reached.')); } $api = $this->_callDoAuthorize($amount, $payment, $authorizationTransaction->getParentTxnId()); diff --git a/app/code/Magento/Paypal/Model/Express/Checkout.php b/app/code/Magento/Paypal/Model/Express/Checkout.php index c97eefb1a28..3fdb92932af 100644 --- a/app/code/Magento/Paypal/Model/Express/Checkout.php +++ b/app/code/Magento/Paypal/Model/Express/Checkout.php @@ -414,14 +414,14 @@ class Checkout * @param string $returnUrl * @param string $cancelUrl * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function start($returnUrl, $cancelUrl) { $this->_quote->collectTotals(); if (!$this->_quote->getGrandTotal() && !$this->_quote->hasNominalItems()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'PayPal can\'t process orders with a zero balance due. ' . 'To finish your purchase, please go through the standard checkout process.' @@ -593,13 +593,13 @@ class Checkout * * @param string|null $token * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function prepareOrderReview($token = null) { $payment = $this->_quote->getPayment(); if (!$payment || !$payment->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_PAYER_ID)) { - throw new \Magento\Core\Exception(__('Payer is not identified.')); + throw new \Magento\Model\Exception(__('Payer is not identified.')); } $this->_quote->setMayEditShippingAddress( 1 != $this->_quote->getPayment()->getAdditionalInformation( diff --git a/app/code/Magento/Paypal/Model/Hostedpro.php b/app/code/Magento/Paypal/Model/Hostedpro.php index a3962420470..a5d536224ca 100644 --- a/app/code/Magento/Paypal/Model/Hostedpro.php +++ b/app/code/Magento/Paypal/Model/Hostedpro.php @@ -209,7 +209,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct * * @param \Magento\Payment\Model\Info $payment * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _setPaymentFormUrl(\Magento\Payment\Model\Info $payment) { @@ -218,7 +218,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct if ($response) { $payment->setAdditionalInformation('secure_form_url', $response); } else { - throw new \Magento\Core\Exception('Cannot get secure form URL from PayPal'); + throw new \Magento\Model\Exception('Cannot get secure form URL from PayPal'); } } diff --git a/app/code/Magento/Paypal/Model/Ipn.php b/app/code/Magento/Paypal/Model/Ipn.php index 90b79b88aec..3f97ead9a72 100644 --- a/app/code/Magento/Paypal/Model/Ipn.php +++ b/app/code/Magento/Paypal/Model/Ipn.php @@ -143,7 +143,7 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements IpnInterface * Admin will be notified on errors. * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processOrder() { @@ -165,7 +165,7 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements IpnInterface $this->_registerTransaction(); break; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $comment = $this->_createIpnComment(__('Note: %1', $e->getMessage()), true); $comment->save(); throw $e; @@ -218,7 +218,7 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements IpnInterface * Process regular IPN notifications * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws Exception */ protected function _registerTransaction() @@ -264,7 +264,7 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements IpnInterface default: throw new Exception("Cannot handle payment status '{$paymentStatus}'."); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $comment = $this->_createIpnComment(__('Note: %1', $e->getMessage()), true); $comment->save(); throw $e; diff --git a/app/code/Magento/Paypal/Model/Method/Agreement.php b/app/code/Magento/Paypal/Model/Method/Agreement.php index c03e6e103c4..c7ee0a0f132 100644 --- a/app/code/Magento/Paypal/Model/Method/Agreement.php +++ b/app/code/Magento/Paypal/Model/Method/Agreement.php @@ -257,7 +257,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr * * @param \Magento\Paypal\Model\Billing\AbstractAgreement $agreement * @return $this - * @throws \Exception|\Magento\Core\Exception + * @throws \Exception|\Magento\Model\Exception */ public function updateBillingAgreementStatus(\Magento\Paypal\Model\Billing\AbstractAgreement $agreement) { @@ -269,7 +269,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr ); try { $api->callUpdateBillingAgreement(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { // when BA was already canceled, just pretend that the operation succeeded if (!(\Magento\Paypal\Model\Billing\Agreement::STATUS_CANCELED == $targetStatus && $api->getIsBillingAgreementAlreadyCancelled()) diff --git a/app/code/Magento/Paypal/Model/Payflow/Pro.php b/app/code/Magento/Paypal/Model/Payflow/Pro.php index 79c6b25ee7f..de930d102b7 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Pro.php +++ b/app/code/Magento/Paypal/Model/Payflow/Pro.php @@ -120,12 +120,12 @@ class Pro extends \Magento\Paypal\Model\Pro * * @param \Magento\Payment\Model\Info $payment * @param string $transactionId - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return void */ public function fetchTransactionInfo(\Magento\Payment\Model\Info $payment, $transactionId) { - throw new \Magento\Core\Exception(__('Fetch transaction details method does not exists in Payflow')); + throw new \Magento\Model\Exception(__('Fetch transaction details method does not exists in Payflow')); } /** diff --git a/app/code/Magento/Paypal/Model/Payflowlink.php b/app/code/Magento/Paypal/Model/Payflowlink.php index dfd71ca7c2f..d797e3b7d72 100644 --- a/app/code/Magento/Paypal/Model/Payflowlink.php +++ b/app/code/Magento/Paypal/Model/Payflowlink.php @@ -324,7 +324,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * * @param array $responseData * @return void - * @throws \Magento\Core\Exception In case of validation error or order creation error + * @throws \Magento\Model\Exception In case of validation error or order creation error */ public function process($responseData) { @@ -343,7 +343,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * * @param \Magento\Sales\Model\Order $order * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processOrder(\Magento\Sales\Model\Order $order) { @@ -392,7 +392,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro } $this->_quoteFactory->create()->load($order->getQuoteId())->setIsActive(false)->save(); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('We cannot send the new order email.')); + throw new \Magento\Model\Exception(__('We cannot send the new order email.')); } } @@ -416,7 +416,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * Check response from Payflow gateway. * * @return false|\Magento\Sales\Model\Order in case of validation passed - * @throws \Magento\Core\Exception In other cases + * @throws \Magento\Model\Exception In other cases */ protected function _getOrderFromResponse() { @@ -437,7 +437,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro if ($order->getState() != \Magento\Sales\Model\Order::STATE_CANCELED) { $order->registerCancellation($response->getRespmsg())->save(); } - throw new \Magento\Core\Exception($response->getRespmsg()); + throw new \Magento\Model\Exception($response->getRespmsg()); } $amountCompared = $response->getAmt() == $order->getPayment()->getBaseAmountAuthorized() ? true : false; @@ -445,12 +445,12 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro $order->getState() != \Magento\Sales\Model\Order::STATE_PENDING_PAYMENT || !$amountCompared ) { - throw new \Magento\Core\Exception($this->_formatStr(self::RESPONSE_ERROR_MSG, 'Order')); + throw new \Magento\Model\Exception($this->_formatStr(self::RESPONSE_ERROR_MSG, 'Order')); } $fetchData = $this->fetchTransactionInfo($order->getPayment(), $response->getPnref()); if (!isset($fetchData['custref']) || $fetchData['custref'] != $order->getIncrementId()) { - throw new \Magento\Core\Exception($this->_formatStr(self::RESPONSE_ERROR_MSG, 'Transaction')); + throw new \Magento\Model\Exception($this->_formatStr(self::RESPONSE_ERROR_MSG, 'Transaction')); } return $order; @@ -651,7 +651,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * @param \Magento\Object $response * @param \Magento\Sales\Model\Order\Payment $payment * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processTokenErrors($response, $payment) { @@ -659,7 +659,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro $response->getResult() != self::RESPONSE_CODE_APPROVED && $response->getResult() != self::RESPONSE_CODE_FRAUDSERVICE_FILTER ) { - throw new \Magento\Core\Exception($response->getRespmsg()); + throw new \Magento\Model\Exception($response->getRespmsg()); } else { $payment->setAdditionalInformation( 'secure_token_id', @@ -726,7 +726,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * @deprecated since 1.6.2.0 * @param mixed|null $token * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function prepareOrderReview($token = null) { @@ -776,7 +776,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * * @deprecated since 1.6.2.0 * @return \Magento\Sales\Model\AbstractModel in case of validation passed - * @throws \Magento\Core\Exception In other cases + * @throws \Magento\Model\Exception In other cases */ protected function _getDocumentFromResponse() { diff --git a/app/code/Magento/Paypal/Model/Payflowpro.php b/app/code/Magento/Paypal/Model/Payflowpro.php index 36dd46ae6eb..b6f8f3cae7c 100644 --- a/app/code/Magento/Paypal/Model/Payflowpro.php +++ b/app/code/Magento/Paypal/Model/Payflowpro.php @@ -719,7 +719,7 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc * * @param \Magento\Object $response * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processErrors(\Magento\Object $response) { @@ -728,7 +728,7 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc } elseif ($response->getResultCode() != self::RESPONSE_CODE_APPROVED && $response->getResultCode() != self::RESPONSE_CODE_FRAUDSERVICE_FILTER ) { - throw new \Magento\Core\Exception($response->getRespmsg()); + throw new \Magento\Model\Exception($response->getRespmsg()); } } diff --git a/app/code/Magento/Paypal/Model/Payment/Transaction.php b/app/code/Magento/Paypal/Model/Payment/Transaction.php index 8643452d177..ad10383fff0 100644 --- a/app/code/Magento/Paypal/Model/Payment/Transaction.php +++ b/app/code/Magento/Paypal/Model/Payment/Transaction.php @@ -33,7 +33,7 @@ namespace Magento\Paypal\Model\Payment; * @method string getCreatedAt() * @method \Magento\Paypal\Model\Payment\Transaction setCreatedAt(string $value) */ -class Transaction extends \Magento\Core\Model\AbstractModel +class Transaction extends \Magento\Model\AbstractModel { /** * Whether to throw exceptions on different operations @@ -74,7 +74,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -82,7 +82,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -161,12 +161,12 @@ class Transaction extends \Magento\Core\Model\AbstractModel * @param string $key * @param mixed $value * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setAdditionalInformation($key, $value) { if (is_object($value)) { - throw new \Magento\Core\Exception(__('Payment transactions disallow storing objects.')); + throw new \Magento\Model\Exception(__('Payment transactions disallow storing objects.')); } $info = $this->_getData('additional_information'); if (!$info) { @@ -232,7 +232,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * Verify data required for saving * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -247,12 +247,12 @@ class Transaction extends \Magento\Core\Model\AbstractModel * * @param string $txnId * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _verifyTxnId($txnId) { if (null !== $txnId && 0 == strlen($txnId)) { - throw new \Magento\Core\Exception(__('You need to enter a transaction ID.')); + throw new \Magento\Model\Exception(__('You need to enter a transaction ID.')); } } @@ -262,12 +262,12 @@ class Transaction extends \Magento\Core\Model\AbstractModel * TODO for more restriction we can check for data consistency * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _verifyThisTransactionExists() { if (!$this->getId()) { - throw new \Magento\Core\Exception(__('This operation requires an existing transaction object.')); + throw new \Magento\Model\Exception(__('This operation requires an existing transaction object.')); } } } diff --git a/app/code/Magento/Paypal/Model/Pro.php b/app/code/Magento/Paypal/Model/Pro.php index be79b7460d4..b13e3e7f200 100644 --- a/app/code/Magento/Paypal/Model/Pro.php +++ b/app/code/Magento/Paypal/Model/Pro.php @@ -233,7 +233,7 @@ class Pro * * @param \Magento\Object $payment * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function void(\Magento\Object $payment) { @@ -243,7 +243,7 @@ class Pro $api->setPayment($payment)->setAuthorizationId($authTransactionId)->callDoVoid(); $this->importPaymentInfo($api, $payment); } else { - throw new \Magento\Core\Exception(__('You need an authorization transaction to void.')); + throw new \Magento\Model\Exception(__('You need an authorization transaction to void.')); } } @@ -284,7 +284,7 @@ class Pro * @param \Magento\Object $payment * @param float $amount * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function refund(\Magento\Object $payment, $amount) { @@ -310,7 +310,7 @@ class Pro $api->callRefundTransaction(); $this->_importRefundResultToPayment($api, $payment, $canRefundMore); } else { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We can\'t issue a refund transaction because there is no capture transaction.') ); } diff --git a/app/code/Magento/Paypal/Model/Report/Settlement.php b/app/code/Magento/Paypal/Model/Report/Settlement.php index 3849e0bb03b..b7c37113cd6 100644 --- a/app/code/Magento/Paypal/Model/Report/Settlement.php +++ b/app/code/Magento/Paypal/Model/Report/Settlement.php @@ -42,7 +42,7 @@ namespace Magento\Paypal\Model\Report; * @method string getLastModified() * @method \Magento\Paypal\Model\Report\Settlement setLastModified(string $value) */ -class Settlement extends \Magento\Core\Model\AbstractModel +class Settlement extends \Magento\Model\AbstractModel { /** * Default PayPal SFTP host @@ -173,7 +173,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -182,7 +182,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\App\Filesystem $filesystem, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -204,7 +204,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel /** * Stop saving process if file with same report date, account ID and last modified date was already ferched * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _beforeSave() { @@ -224,7 +224,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel * * @param \Magento\Io\Sftp $connection * @return int Number of report rows that were fetched and saved successfully - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function fetchAndSave(\Magento\Io\Sftp $connection) { @@ -235,7 +235,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel $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.')); + throw new \Magento\Model\Exception(__('We cannot create a target file for reading reports.')); } $encoded = $this->_tmpDirectory->readFile($localCsv); diff --git a/app/code/Magento/Paypal/Model/Report/Settlement/Row.php b/app/code/Magento/Paypal/Model/Report/Settlement/Row.php index 25bb61dd7d0..37b23bcab1f 100644 --- a/app/code/Magento/Paypal/Model/Report/Settlement/Row.php +++ b/app/code/Magento/Paypal/Model/Report/Settlement/Row.php @@ -68,7 +68,7 @@ namespace Magento\Paypal\Model\Report\Settlement; * @package Magento_Paypal * @author Magento Core Team <core@magentocommerce.com> */ -class Row extends \Magento\Core\Model\AbstractModel +class Row extends \Magento\Model\AbstractModel { /** * Assoc array event code => label diff --git a/app/code/Magento/Paypal/Model/Resource/Billing/Agreement.php b/app/code/Magento/Paypal/Model/Resource/Billing/Agreement.php index 30f8d37e7e1..1ea6bae7230 100644 --- a/app/code/Magento/Paypal/Model/Resource/Billing/Agreement.php +++ b/app/code/Magento/Paypal/Model/Resource/Billing/Agreement.php @@ -26,7 +26,7 @@ namespace Magento\Paypal\Model\Resource\Billing; /** * Billing agreement resource model */ -class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb +class Agreement extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Paypal/Model/Resource/Billing/Agreement/Collection.php b/app/code/Magento/Paypal/Model/Resource/Billing/Agreement/Collection.php index d7edbc57f29..74ea4c85eca 100644 --- a/app/code/Magento/Paypal/Model/Resource/Billing/Agreement/Collection.php +++ b/app/code/Magento/Paypal/Model/Resource/Billing/Agreement/Collection.php @@ -28,7 +28,7 @@ use Magento\Customer\Service\V1\CustomerMetadataServiceInterface; /** * Billing agreements resource collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Mapping for fields @@ -63,7 +63,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Customer\Model\Resource\Customer $customerResource * @param \Magento\Eav\Helper\Data $eavHelper * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -73,7 +73,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Customer\Model\Resource\Customer $customerResource, \Magento\Eav\Helper\Data $eavHelper, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_eavHelper = $eavHelper; diff --git a/app/code/Magento/Paypal/Model/Resource/Cert.php b/app/code/Magento/Paypal/Model/Resource/Cert.php index afceb8a749c..32886a68f6e 100644 --- a/app/code/Magento/Paypal/Model/Resource/Cert.php +++ b/app/code/Magento/Paypal/Model/Resource/Cert.php @@ -28,7 +28,7 @@ namespace Magento\Paypal\Model\Resource; /** * PayPal resource model for certificate based authentication */ -class Cert extends \Magento\Core\Model\Resource\Db\AbstractDb +class Cert extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime\DateTime @@ -68,10 +68,10 @@ class Cert extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Set date of last update * - * @param \Magento\Core\Model\AbstractModel $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { $object->setUpdatedAt($this->dateTime->formatDate($this->_coreDate->gmtDate())); return parent::_beforeSave($object); diff --git a/app/code/Magento/Paypal/Model/Resource/Payment/Transaction.php b/app/code/Magento/Paypal/Model/Resource/Payment/Transaction.php index a0507a2a9a1..0e4db5f91e7 100644 --- a/app/code/Magento/Paypal/Model/Resource/Payment/Transaction.php +++ b/app/code/Magento/Paypal/Model/Resource/Payment/Transaction.php @@ -33,7 +33,7 @@ namespace Magento\Paypal\Model\Resource\Payment; * @package Magento_Paypal * @author Magento Core Team <core@magentocommerce.com> */ -class Transaction extends \Magento\Core\Model\Resource\Db\AbstractDb +class Transaction extends \Magento\Model\Resource\Db\AbstractDb { /** * Serializeable field: additional_information @@ -71,11 +71,11 @@ class Transaction extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Serialize additional information, if any * - * @param \Magento\Core\Model\AbstractModel $transaction + * @param \Magento\Model\AbstractModel $transaction * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $transaction) + protected function _beforeSave(\Magento\Model\AbstractModel $transaction) { $txnId = $transaction->getData('txn_id'); $idFieldName = $this->getIdFieldName(); diff --git a/app/code/Magento/Paypal/Model/Resource/Payment/Transaction/Collection.php b/app/code/Magento/Paypal/Model/Resource/Payment/Transaction/Collection.php index d7881e077c4..21699d562ea 100644 --- a/app/code/Magento/Paypal/Model/Resource/Payment/Transaction/Collection.php +++ b/app/code/Magento/Paypal/Model/Resource/Payment/Transaction/Collection.php @@ -33,7 +33,7 @@ namespace Magento\Paypal\Model\Resource\Payment\Transaction; * @package Magento_Paypal * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Created Before filter diff --git a/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php b/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php index 65ed5deef9f..216f62e5ba2 100644 --- a/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php +++ b/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php @@ -28,7 +28,7 @@ namespace Magento\Paypal\Model\Resource\Report; /** * Report settlement resource model */ -class Settlement extends \Magento\Core\Model\Resource\Db\AbstractDb +class Settlement extends \Magento\Model\Resource\Db\AbstractDb { /** * Table name @@ -66,10 +66,10 @@ class Settlement extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save report rows collected in settlement model * - * @param \Magento\Core\Model\AbstractModel|\Magento\Paypal\Model\Report\Settlement $object + * @param \Magento\Model\AbstractModel|\Magento\Paypal\Model\Report\Settlement $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $rows = $object->getRows(); if (is_array($rows)) { diff --git a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row.php b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row.php index 73de8f5017e..667d4f9dc08 100644 --- a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row.php +++ b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row.php @@ -32,7 +32,7 @@ namespace Magento\Paypal\Model\Resource\Report\Settlement; * @package Magento_Paypal * @author Magento Core Team <core@magentocommerce.com> */ -class Row extends \Magento\Core\Model\Resource\Db\AbstractDb +class Row extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource model initialization. diff --git a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row/Collection.php b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row/Collection.php index 5027ae2b817..59a1a1527e6 100644 --- a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row/Collection.php +++ b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Paypal\Model\Resource\Report\Settlement\Row; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initializing 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 9ab6440ed68..bca06332716 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php +++ b/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php @@ -53,7 +53,7 @@ class Cert extends \Magento\Core\Model\Config\Value * @param \Magento\Paypal\Model\CertFactory $certFactory * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -65,7 +65,7 @@ class Cert extends \Magento\Core\Model\Config\Value \Magento\Paypal\Model\CertFactory $certFactory, \Magento\Encryption\EncryptorInterface $encryptor, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -79,7 +79,7 @@ class Cert extends \Magento\Core\Model\Config\Value * Process additional data before save config * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -97,7 +97,7 @@ class Cert extends \Magento\Core\Model\Config\Value ); if ($tmpPath && $this->_tmpDirectory->isExist($tmpPath)) { if (!$this->_tmpDirectory->stat($tmpPath)['size']) { - throw new \Magento\Core\Exception(__('The PayPal certificate file is empty.')); + throw new \Magento\Model\Exception(__('The PayPal certificate file is empty.')); } $this->setValue($_FILES['groups']['name'][$this->getGroupId()]['fields'][$this->getField()]['value']); $content = $this->_encryptor->encrypt($this->_tmpDirectory->readFile($tmpPath)); diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php b/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php index 0db219bc0d7..42112746d7b 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php +++ b/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php @@ -42,7 +42,7 @@ class Cron extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -52,7 +52,7 @@ class Cron extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php b/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php index 440b778b0a1..de2a6c6a8fc 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php +++ b/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php @@ -43,7 +43,7 @@ class MerchantCountry extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -53,7 +53,7 @@ class MerchantCountry extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_cancelpayment.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_cancelpayment.xml index 2588666802b..bd5d78e2c61 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_cancelpayment.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_cancelpayment.xml @@ -25,5 +25,5 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" output="1" - template="payflowadvanced/redirect.phtml"/> + template="payflowadvanced/redirect.phtml" cacheable="false"/> </layout> diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_form.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_form.xml index 98c418cb3cd..141092800b9 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_form.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_form.xml @@ -25,5 +25,5 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" output="1" - template="payflowadvanced/form.phtml"/> + template="payflowadvanced/form.phtml" cacheable="false"/> </layout> diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_returnurl.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_returnurl.xml index 2588666802b..bd5d78e2c61 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_returnurl.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_returnurl.xml @@ -25,5 +25,5 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" output="1" - template="payflowadvanced/redirect.phtml"/> + template="payflowadvanced/redirect.phtml" cacheable="false"/> </layout> diff --git a/app/code/Magento/Persistent/Model/Persistent/Config.php b/app/code/Magento/Persistent/Model/Persistent/Config.php index d7553869bf5..27b91bb5511 100644 --- a/app/code/Magento/Persistent/Model/Persistent/Config.php +++ b/app/code/Magento/Persistent/Model/Persistent/Config.php @@ -120,7 +120,7 @@ class Config * Get persistent XML config xpath * * @return \DOMXPath - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getConfigDomXPath() { @@ -129,7 +129,7 @@ class Config $isFile = $this->_modulesDirectory->isFile($filePath); $isReadable = $this->_modulesDirectory->isReadable($filePath); if (!$isFile || !$isReadable) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We cannot load the configuration from file %1.', $this->_configFilePath) ); } @@ -230,7 +230,7 @@ class Config * @param array $info * @param bool $instance * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function fireOne($info, $instance = false) { @@ -250,7 +250,7 @@ class Config if (method_exists($object, $method)) { $object->{$method}($instance); } elseif ($this->_appState->getMode() == \Magento\App\State::MODE_DEVELOPER) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( 'Method "' . $method . '" is not defined in "' . get_class($object) . '"' ); } diff --git a/app/code/Magento/Persistent/Model/Resource/Session.php b/app/code/Magento/Persistent/Model/Resource/Session.php index 4535ba7b927..8ef15f60708 100644 --- a/app/code/Magento/Persistent/Model/Resource/Session.php +++ b/app/code/Magento/Persistent/Model/Resource/Session.php @@ -28,7 +28,7 @@ namespace Magento\Persistent\Model\Resource; /** * Persistent Session Resource Model */ -class Session extends \Magento\Core\Model\Resource\Db\AbstractDb +class Session extends \Magento\Model\Resource\Db\AbstractDb { /** * Use is object new method for object saving diff --git a/app/code/Magento/Persistent/Model/Session.php b/app/code/Magento/Persistent/Model/Session.php index 419b6a4818b..0c4acc9c161 100644 --- a/app/code/Magento/Persistent/Model/Session.php +++ b/app/code/Magento/Persistent/Model/Session.php @@ -28,7 +28,7 @@ namespace Magento\Persistent\Model; /** * Persistent Session Model */ -class Session extends \Magento\Core\Model\AbstractModel +class Session extends \Magento\Model\AbstractModel { /** * Persistent cookie key length @@ -116,7 +116,7 @@ class Session extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Math\Random $mathRandom * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -130,7 +130,7 @@ class Session extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Math\Random $mathRandom, \Magento\Session\Config\ConfigInterface $sessionConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/ProductAlert/Helper/Data.php b/app/code/Magento/ProductAlert/Helper/Data.php index 04309d241f5..fe488b07fce 100644 --- a/app/code/Magento/ProductAlert/Helper/Data.php +++ b/app/code/Magento/ProductAlert/Helper/Data.php @@ -152,7 +152,7 @@ class Data extends \Magento\Core\Helper\Url * * @param string|\Magento\View\Element\AbstractBlock $block * @return \Magento\View\Element\AbstractBlock - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function createBlock($block) { @@ -162,7 +162,7 @@ class Data extends \Magento\Core\Helper\Url } } if (!$block instanceof \Magento\View\Element\AbstractBlock) { - throw new \Magento\Core\Exception(__('Invalid block type: %1', $block)); + throw new \Magento\Model\Exception(__('Invalid block type: %1', $block)); } return $block; } diff --git a/app/code/Magento/ProductAlert/Model/Email.php b/app/code/Magento/ProductAlert/Model/Email.php index 335b8cb7f89..e2a0b89352c 100644 --- a/app/code/Magento/ProductAlert/Model/Email.php +++ b/app/code/Magento/ProductAlert/Model/Email.php @@ -32,7 +32,7 @@ namespace Magento\ProductAlert\Model; * @package Magento_ProductAlert * @author Magento Core Team <core@magentocommerce.com> */ -class Email extends \Magento\Core\Model\AbstractModel +class Email extends \Magento\Model\AbstractModel { const XML_PATH_EMAIL_PRICE_TEMPLATE = 'catalog/productalert/email_price_template'; @@ -132,7 +132,7 @@ class Email extends \Magento\Core\Model\AbstractModel * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Core\Model\App\Emulation $appEmulation * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -145,7 +145,7 @@ class Email extends \Magento\Core\Model\AbstractModel \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Core\Model\App\Emulation $appEmulation, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/ProductAlert/Model/Observer.php b/app/code/Magento/ProductAlert/Model/Observer.php index 64bffd48e2c..88ecc5bf527 100644 --- a/app/code/Magento/ProductAlert/Model/Observer.php +++ b/app/code/Magento/ProductAlert/Model/Observer.php @@ -119,11 +119,6 @@ class Observer */ protected $_stockColFactory; - /** - * @var \Magento\TranslateInterface - */ - protected $_translate; - /** * @var \Magento\Mail\Template\TransportBuilder */ @@ -134,6 +129,11 @@ class Observer */ protected $_emailFactory; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\Store\Config $coreStoreConfig @@ -143,9 +143,9 @@ class Observer * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory * @param \Magento\ProductAlert\Model\Resource\Stock\CollectionFactory $stockColFactory - * @param \Magento\TranslateInterface $translate * @param \Magento\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\ProductAlert\Model\EmailFactory $emailFactory + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\Tax\Helper\Data $taxData, @@ -156,9 +156,9 @@ class Observer \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory, \Magento\ProductAlert\Model\Resource\Stock\CollectionFactory $stockColFactory, - \Magento\TranslateInterface $translate, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\ProductAlert\Model\EmailFactory $emailFactory + \Magento\ProductAlert\Model\EmailFactory $emailFactory, + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_taxData = $taxData; $this->_coreStoreConfig = $coreStoreConfig; @@ -168,9 +168,9 @@ class Observer $this->_productFactory = $productFactory; $this->_dateFactory = $dateFactory; $this->_stockColFactory = $stockColFactory; - $this->_translate = $translate; $this->_transportBuilder = $transportBuilder; $this->_emailFactory = $emailFactory; + $this->inlineTranslation = $inlineTranslation; } /** @@ -378,7 +378,7 @@ class Observer return $this; } - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $transport = $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE) @@ -397,7 +397,7 @@ class Observer $transport->sendMessage(); - $this->_translate->setTranslateInline(true); + $this->inlineTranslation->resume(); $this->_errors[] = array(); } return $this; diff --git a/app/code/Magento/ProductAlert/Model/Price.php b/app/code/Magento/ProductAlert/Model/Price.php index e330666e80d..6582d6ecf1a 100644 --- a/app/code/Magento/ProductAlert/Model/Price.php +++ b/app/code/Magento/ProductAlert/Model/Price.php @@ -53,7 +53,7 @@ use Resource\Price\Customer\Collection; * @package Magento_ProductAlert * @author Magento Core Team <core@magentocommerce.com> */ -class Price extends \Magento\Core\Model\AbstractModel +class Price extends \Magento\Model\AbstractModel { /** * @var \Magento\ProductAlert\Model\Resource\Price\Customer\CollectionFactory @@ -64,7 +64,7 @@ class Price extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\ProductAlert\Model\Resource\Price\Customer\CollectionFactory $customerColFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -72,7 +72,7 @@ class Price extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\ProductAlert\Model\Resource\Price\Customer\CollectionFactory $customerColFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/ProductAlert/Model/Resource/AbstractResource.php b/app/code/Magento/ProductAlert/Model/Resource/AbstractResource.php index a2b4380e28c..75c9c649a8a 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/AbstractResource.php +++ b/app/code/Magento/ProductAlert/Model/Resource/AbstractResource.php @@ -32,15 +32,15 @@ namespace Magento\ProductAlert\Model\Resource; * @package Magento_ProductAlert * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractResource extends \Magento\Model\Resource\Db\AbstractDb { /** * Retrieve alert row by object parameters * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return array|false */ - protected function _getAlertRow(\Magento\Core\Model\AbstractModel $object) + protected function _getAlertRow(\Magento\Model\AbstractModel $object) { $adapter = $this->_getReadAdapter(); if ($object->getCustomerId() && $object->getProductId() && $object->getWebsiteId()) { @@ -66,10 +66,10 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Load object data by parameters * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function loadByParam(\Magento\Core\Model\AbstractModel $object) + public function loadByParam(\Magento\Model\AbstractModel $object) { $row = $this->_getAlertRow($object); if ($row) { @@ -81,12 +81,12 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Delete all customer alerts on website * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param int $customerId * @param int $websiteId * @return $this */ - public function deleteCustomer(\Magento\Core\Model\AbstractModel $object, $customerId, $websiteId = null) + public function deleteCustomer(\Magento\Model\AbstractModel $object, $customerId, $websiteId = null) { $adapter = $this->_getWriteAdapter(); $where = array(); diff --git a/app/code/Magento/ProductAlert/Model/Resource/Price.php b/app/code/Magento/ProductAlert/Model/Resource/Price.php index 64678c44e32..165949255c9 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/Price.php +++ b/app/code/Magento/ProductAlert/Model/Resource/Price.php @@ -58,10 +58,10 @@ class Price extends \Magento\ProductAlert\Model\Resource\AbstractResource /** * Before save process, check exists the same alert * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if (is_null($object->getId()) && $object->getCustomerId() && $object->getProductId() && $object->getWebsiteId() ) { diff --git a/app/code/Magento/ProductAlert/Model/Resource/Price/Collection.php b/app/code/Magento/ProductAlert/Model/Resource/Price/Collection.php index 87ae940cc54..726efb61632 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/Price/Collection.php +++ b/app/code/Magento/ProductAlert/Model/Resource/Price/Collection.php @@ -32,7 +32,7 @@ namespace Magento\ProductAlert\Model\Resource\Price; * @package Magento_ProductAlert * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define price collection diff --git a/app/code/Magento/ProductAlert/Model/Resource/Stock.php b/app/code/Magento/ProductAlert/Model/Resource/Stock.php index 421f7bc7efb..7dea67151e2 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/Stock.php +++ b/app/code/Magento/ProductAlert/Model/Resource/Stock.php @@ -58,10 +58,10 @@ class Stock extends \Magento\ProductAlert\Model\Resource\AbstractResource /** * Before save action * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if (is_null($object->getId()) && $object->getCustomerId() && $object->getProductId() && $object->getWebsiteId() ) { diff --git a/app/code/Magento/ProductAlert/Model/Resource/Stock/Collection.php b/app/code/Magento/ProductAlert/Model/Resource/Stock/Collection.php index 1d48138fb5c..fc8bc416633 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/Stock/Collection.php +++ b/app/code/Magento/ProductAlert/Model/Resource/Stock/Collection.php @@ -32,7 +32,7 @@ namespace Magento\ProductAlert\Model\Resource\Stock; * @package Magento_ProductAlert * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define stock collection diff --git a/app/code/Magento/ProductAlert/Model/Stock.php b/app/code/Magento/ProductAlert/Model/Stock.php index d21faef6f48..eabf55c3332 100644 --- a/app/code/Magento/ProductAlert/Model/Stock.php +++ b/app/code/Magento/ProductAlert/Model/Stock.php @@ -51,7 +51,7 @@ use Resource\Price\Customer\Collection; * @package Magento_ProductAlert * @author Magento Core Team <core@magentocommerce.com> */ -class Stock extends \Magento\Core\Model\AbstractModel +class Stock extends \Magento\Model\AbstractModel { /** * @var \Magento\ProductAlert\Model\Resource\Stock\Customer\CollectionFactory @@ -62,7 +62,7 @@ class Stock extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\ProductAlert\Model\Resource\Stock\Customer\CollectionFactory $customerColFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -70,7 +70,7 @@ class Stock extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\ProductAlert\Model\Resource\Stock\Customer\CollectionFactory $customerColFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Rating/Model/Rating.php b/app/code/Magento/Rating/Model/Rating.php index 6dd429fbe77..b1263291b34 100644 --- a/app/code/Magento/Rating/Model/Rating.php +++ b/app/code/Magento/Rating/Model/Rating.php @@ -40,7 +40,7 @@ namespace Magento\Rating\Model; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Rating extends \Magento\Core\Model\AbstractModel +class Rating extends \Magento\Model\AbstractModel { /** * rating entity codes @@ -66,7 +66,7 @@ class Rating extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Rating\Model\Rating\OptionFactory $ratingOptionFactory * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -75,7 +75,7 @@ class Rating extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Rating\Model\Rating\OptionFactory $ratingOptionFactory, \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Rating/Model/Rating/Entity.php b/app/code/Magento/Rating/Model/Rating/Entity.php index 0dbdd834419..1fdfd8be830 100644 --- a/app/code/Magento/Rating/Model/Rating/Entity.php +++ b/app/code/Magento/Rating/Model/Rating/Entity.php @@ -37,7 +37,7 @@ namespace Magento\Rating\Model\Rating; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Entity extends \Magento\Core\Model\AbstractModel +class Entity extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Rating/Model/Rating/Option.php b/app/code/Magento/Rating/Model/Rating/Option.php index dbe44a95154..d9011e622a6 100644 --- a/app/code/Magento/Rating/Model/Rating/Option.php +++ b/app/code/Magento/Rating/Model/Rating/Option.php @@ -43,7 +43,7 @@ namespace Magento\Rating\Model\Rating; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\AbstractModel +class Option extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Rating/Model/Rating/Option/Vote.php b/app/code/Magento/Rating/Model/Rating/Option/Vote.php index 0b74a01b6b9..823a655a257 100644 --- a/app/code/Magento/Rating/Model/Rating/Option/Vote.php +++ b/app/code/Magento/Rating/Model/Rating/Option/Vote.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Rating\Option; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Vote extends \Magento\Core\Model\AbstractModel +class Vote extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Rating/Model/Resource/Rating.php b/app/code/Magento/Rating/Model/Resource/Rating.php index 2e79ae98c5e..2e8911c20cf 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating.php +++ b/app/code/Magento/Rating/Model/Resource/Rating.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Rating extends \Magento\Core\Model\Resource\Db\AbstractDb +class Rating extends \Magento\Model\Resource\Db\AbstractDb { const RATING_STATUS_APPROVED = 'Approved'; @@ -131,10 +131,10 @@ class Rating extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Actions after load * - * @param \Magento\Core\Model\AbstractModel|\Magento\Rating\Model\Rating $object + * @param \Magento\Model\AbstractModel|\Magento\Rating\Model\Rating $object * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { parent::_afterLoad($object); @@ -184,10 +184,10 @@ class Rating extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Actions after save * - * @param \Magento\Core\Model\AbstractModel|\Magento\Rating\Model\Rating $object + * @param \Magento\Model\AbstractModel|\Magento\Rating\Model\Rating $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { parent::_afterSave($object); @@ -273,10 +273,10 @@ class Rating extends \Magento\Core\Model\Resource\Db\AbstractDb * Perform actions after object delete * Prepare rating data for reaggregate all data for reviews * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $object) + protected function _afterDelete(\Magento\Model\AbstractModel $object) { parent::_afterDelete($object); if (!$this->_ratingData->isModuleEnabled('Magento_Review')) { diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Collection.php index d3a83dd6ecd..4d987a19408 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Collection.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource\Rating; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var \Magento\Core\Model\StoreManagerInterface @@ -58,7 +58,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -68,7 +68,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_ratingCollectionF = $ratingCollectionF; diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Entity.php b/app/code/Magento/Rating/Model/Resource/Rating/Entity.php index 6776ce46048..a20d688c1d7 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Entity.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Entity.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource\Rating; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Entity extends \Magento\Core\Model\Resource\Db\AbstractDb +class Entity extends \Magento\Model\Resource\Db\AbstractDb { /** * Rating entity resource initialization diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php index 0896a9dd4a2..83e37040cfc 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php @@ -50,7 +50,7 @@ class Collection extends \Magento\Rating\Model\Resource\Rating\Collection * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF * @param \Magento\Registry $coreRegistry * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -61,7 +61,7 @@ class Collection extends \Magento\Rating\Model\Resource\Rating\Collection \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, \Magento\Registry $coreRegistry, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_coreRegistry = $coreRegistry; parent::__construct( diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option.php b/app/code/Magento/Rating/Model/Resource/Rating/Option.php index 9369bbf48e5..b1f8172851b 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Option.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource\Rating; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\Resource\Db\AbstractDb +class Option extends \Magento\Model\Resource\Db\AbstractDb { /** * Review table diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Option/Collection.php index 59273ca55a5..d0be2398752 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option/Collection.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Option/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource\Rating\Option; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Rating votes table diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote.php b/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote.php index adb62a50f33..9612a6ecbc3 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource\Rating\Option; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Vote extends \Magento\Core\Model\Resource\Db\AbstractDb +class Vote extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php index 1d6ce8582b3..179fb83076e 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource\Rating\Option\Vote; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store list manager @@ -54,7 +54,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -64,7 +64,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_ratingCollectionF = $ratingCollectionF; diff --git a/app/code/Magento/RecurringPayment/Block/Adminhtml/Payment/View/Items.php b/app/code/Magento/RecurringPayment/Block/Adminhtml/Payment/View/Items.php index 698813ef857..dcce70c5810 100644 --- a/app/code/Magento/RecurringPayment/Block/Adminhtml/Payment/View/Items.php +++ b/app/code/Magento/RecurringPayment/Block/Adminhtml/Payment/View/Items.php @@ -40,7 +40,7 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems protected function _beforeToHtml() { if (!$this->getParentBlock()) { - throw new \Magento\Core\Exception(__('Invalid parent block for this block')); + throw new \Magento\Model\Exception(__('Invalid parent block for this block')); } parent::_beforeToHtml(); } diff --git a/app/code/Magento/RecurringPayment/Controller/Adminhtml/RecurringPayment.php b/app/code/Magento/RecurringPayment/Controller/Adminhtml/RecurringPayment.php index 975f0d11b1c..1a68efb3b7c 100644 --- a/app/code/Magento/RecurringPayment/Controller/Adminhtml/RecurringPayment.php +++ b/app/code/Magento/RecurringPayment/Controller/Adminhtml/RecurringPayment.php @@ -24,7 +24,7 @@ namespace Magento\RecurringPayment\Controller\Adminhtml; use Magento\App\Action\NotFoundException; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; use Magento\Customer\Controller\RegistryConstants; /** @@ -244,7 +244,7 @@ class RecurringPayment extends \Magento\Backend\App\Action * Load/set payment * * @return \Magento\RecurringPayment\Model\Payment - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initPayment() { diff --git a/app/code/Magento/RecurringPayment/Controller/RecurringPayment.php b/app/code/Magento/RecurringPayment/Controller/RecurringPayment.php index 7161394f7fe..0ab0ef6b0bf 100644 --- a/app/code/Magento/RecurringPayment/Controller/RecurringPayment.php +++ b/app/code/Magento/RecurringPayment/Controller/RecurringPayment.php @@ -28,6 +28,7 @@ namespace Magento\RecurringPayment\Controller; use Magento\App\RequestInterface; +use Magento\Customer\Controller\RegistryConstants; class RecurringPayment extends \Magento\App\Action\Action { @@ -79,7 +80,9 @@ class RecurringPayment extends \Magento\App\Action\Action if (!$this->_session->authenticate($this)) { $this->_actionFlag->set('', 'no-dispatch', true); } - $this->_coreRegistry->register('current_customer', $this->_session->getCustomer()); + $customer = $this->_session->getCustomer(); + $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER, $customer); + $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customer->getId()); return parent::dispatch($request); } @@ -141,7 +144,7 @@ class RecurringPayment extends \Magento\App\Action\Action break; } $this->messageManager->addSuccess(__('The payment state has been updated.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We couldn\'t update the payment.')); @@ -171,7 +174,7 @@ class RecurringPayment extends \Magento\App\Action\Action } else { $this->messageManager->addNotice(__('The payment has no changes.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We couldn\'t update the payment.')); @@ -199,7 +202,7 @@ class RecurringPayment extends \Magento\App\Action\Action $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); @@ -211,7 +214,7 @@ class RecurringPayment extends \Magento\App\Action\Action * Instantiate current payment and put it into registry * * @return \Magento\RecurringPayment\Model\Payment - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initPayment() { @@ -221,7 +224,7 @@ class RecurringPayment extends \Magento\App\Action\Action $this->getRequest()->getParam('payment') ); if (!$payment->getId()) { - throw new \Magento\Core\Exception(__('We can\'t find the payment you specified.')); + throw new \Magento\Model\Exception(__('We can\'t find the payment you specified.')); } $this->_coreRegistry->register('current_recurring_payment', $payment); return $payment; diff --git a/app/code/Magento/RecurringPayment/Model/ManagerInterface.php b/app/code/Magento/RecurringPayment/Model/ManagerInterface.php index 54fbe75207e..3bf7d6cec46 100644 --- a/app/code/Magento/RecurringPayment/Model/ManagerInterface.php +++ b/app/code/Magento/RecurringPayment/Model/ManagerInterface.php @@ -36,7 +36,7 @@ interface ManagerInterface * * @param RecurringPayment $payment * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate(RecurringPayment $payment); diff --git a/app/code/Magento/RecurringPayment/Model/Observer/CheckoutManagerObserver.php b/app/code/Magento/RecurringPayment/Model/Observer/CheckoutManagerObserver.php index e014a908df7..5493e87436e 100644 --- a/app/code/Magento/RecurringPayment/Model/Observer/CheckoutManagerObserver.php +++ b/app/code/Magento/RecurringPayment/Model/Observer/CheckoutManagerObserver.php @@ -57,14 +57,14 @@ class CheckoutManagerObserver * * @param \Magento\Event\Observer $observer * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function submitRecurringPayments($observer) { $this->_recurringPayments = $this->_quoteImporter->import($observer->getEvent()->getQuote()); foreach ($this->_recurringPayments as $payment) { if (!$payment->isValid()) { - throw new \Magento\Core\Exception($payment->getValidationErrors()); + throw new \Magento\Model\Exception($payment->getValidationErrors()); } $payment->submit(); } diff --git a/app/code/Magento/RecurringPayment/Model/Payment.php b/app/code/Magento/RecurringPayment/Model/Payment.php index f5c09e84e07..ab76d3cc605 100644 --- a/app/code/Magento/RecurringPayment/Model/Payment.php +++ b/app/code/Magento/RecurringPayment/Model/Payment.php @@ -141,7 +141,7 @@ class Payment extends \Magento\RecurringPayment\Model\RecurringPayment * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory * @param \Magento\Math\Random $mathRandom * @param States $states - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -162,7 +162,7 @@ class Payment extends \Magento\RecurringPayment\Model\RecurringPayment \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, \Magento\Math\Random $mathRandom, States $states, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -625,7 +625,7 @@ class Payment extends \Magento\RecurringPayment\Model\RecurringPayment * @param string $againstState * @param bool $soft * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _checkWorkflow($againstState, $soft = true) { @@ -633,7 +633,7 @@ class Payment extends \Magento\RecurringPayment\Model\RecurringPayment $state = $this->getState(); $result = !empty($this->_workflow[$state]) && in_array($againstState, $this->_workflow[$state]); if (!$soft && !$result) { - throw new \Magento\Core\Exception(__('This payment state cannot be changed to "%1".', $againstState)); + throw new \Magento\Model\Exception(__('This payment state cannot be changed to "%1".', $againstState)); } return $result; } diff --git a/app/code/Magento/RecurringPayment/Model/RecurringPayment.php b/app/code/Magento/RecurringPayment/Model/RecurringPayment.php index 2d06560a92a..7bb51257c56 100644 --- a/app/code/Magento/RecurringPayment/Model/RecurringPayment.php +++ b/app/code/Magento/RecurringPayment/Model/RecurringPayment.php @@ -38,7 +38,7 @@ namespace Magento\RecurringPayment\Model; * @method RecurringPayment setToken() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class RecurringPayment extends \Magento\Core\Model\AbstractModel +class RecurringPayment extends \Magento\Model\AbstractModel { /** * Constants for passing data through catalog @@ -117,7 +117,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel * @param ManagerInterfaceFactory $managerFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Locale\ResolverInterface $localeResolver - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data * @@ -132,7 +132,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel ManagerInterfaceFactory $managerFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Locale\ResolverInterface $localeResolver, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -223,7 +223,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel if ($this->_manager) { try { $this->_manager->validate($this); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_errors['payment_method'][] = $e->getMessage(); } } @@ -235,7 +235,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel * Getter for errors that may appear after validation * * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getValidationErrors() { @@ -244,7 +244,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel foreach ($this->_errors as $row) { $result[] = implode(' ', $row); } - throw new \Magento\Core\Exception(__("The payment is invalid:\n%1.", implode("\n", $result))); + throw new \Magento\Model\Exception(__("The payment is invalid:\n%1.", implode("\n", $result))); } return $this->_errors; } @@ -268,7 +268,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel * * @param \Magento\Object $buyRequest * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Exception */ public function importBuyRequest(\Magento\Object $buyRequest) @@ -283,7 +283,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel ); $localeCode = $this->_localeResolver->getLocaleCode(); if (!\Zend_Date::isDate($startDate, $dateFormat, $localeCode)) { - throw new \Magento\Core\Exception(__('The recurring payment start date has invalid format.')); + throw new \Magento\Model\Exception(__('The recurring payment start date has invalid format.')); } $utcTime = $this->_localeDate->utcDate( $this->_store, @@ -525,15 +525,15 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel * Perform full validation before saving * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validateBeforeSave() { if (!$this->isValid()) { - throw new \Magento\Core\Exception($this->getValidationErrors()); + throw new \Magento\Model\Exception($this->getValidationErrors()); } if (!$this->getInternalReferenceId()) { - throw new \Magento\Core\Exception(__('An internal reference ID is required to save the payment.')); + throw new \Magento\Model\Exception(__('An internal reference ID is required to save the payment.')); } } diff --git a/app/code/Magento/RecurringPayment/Model/Resource/Order/CollectionFilter.php b/app/code/Magento/RecurringPayment/Model/Resource/Order/CollectionFilter.php index b82f7ceecf5..6194b8f4f25 100644 --- a/app/code/Magento/RecurringPayment/Model/Resource/Order/CollectionFilter.php +++ b/app/code/Magento/RecurringPayment/Model/Resource/Order/CollectionFilter.php @@ -33,7 +33,7 @@ class CollectionFilter /** * Add filter by specified recurring payment id(s) * - * @param \Magento\Core\Model\Resource\Db\Collection\AbstractCollection $collection + * @param \Magento\Model\Resource\Db\Collection\AbstractCollection $collection * @param array|int $ids * @return \Magento\Sales\Model\Resource\Order\Collection */ diff --git a/app/code/Magento/RecurringPayment/Model/Resource/Payment/Collection.php b/app/code/Magento/RecurringPayment/Model/Resource/Payment/Collection.php index ece00325143..b8b326a00f0 100644 --- a/app/code/Magento/RecurringPayment/Model/Resource/Payment/Collection.php +++ b/app/code/Magento/RecurringPayment/Model/Resource/Payment/Collection.php @@ -26,7 +26,7 @@ namespace Magento\RecurringPayment\Model\Resource\Payment; /** * Recurring payment collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Event prefix 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 f0260c9fe64..5e238032539 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 @@ -48,7 +48,7 @@ class Customer extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra return sprintf( '<a href="%s">%s</a>', - $this->getUrl('catalog/product_review/', array('customerId' => $id)), + $this->getUrl('review/product/', array('customerId' => $id)), __('Show Reviews') ); } 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 a40e633e4a3..3cceacd6c62 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 @@ -44,7 +44,7 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstrac return sprintf( '<a href="%s">%s</a>', - $this->getUrl('catalog/product_review/', array('productId' => $id)), + $this->getUrl('review/product/', array('productId' => $id)), __('Show Reviews') ); } diff --git a/app/code/Magento/Reports/Block/Product/AbstractProduct.php b/app/code/Magento/Reports/Block/Product/AbstractProduct.php index e863d23add4..f1c231cd009 100644 --- a/app/code/Magento/Reports/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Reports/Block/Product/AbstractProduct.php @@ -57,36 +57,14 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr protected $_indexFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Reports\Model\Product\Index\Factory $indexFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Reports\Model\Product\Index\Factory $indexFactory, array $data = array(), @@ -94,16 +72,6 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr ) { parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); @@ -145,7 +113,7 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr try { $model = $this->_indexFactory->get($this->_indexType); } catch (\InvalidArgumentException $e) { - new \Magento\Core\Exception(__('Index type is not valid')); + new \Magento\Model\Exception(__('Index type is not valid')); } return $model; diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Report/Statistics.php b/app/code/Magento/Reports/Controller/Adminhtml/Report/Statistics.php index 35995f9b16e..6a5a28d0fa6 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Report/Statistics.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Report/Statistics.php @@ -169,7 +169,7 @@ class Statistics extends \Magento\Backend\App\Action $this->_objectManager->create($collectionName)->aggregate($date); } $this->messageManager->addSuccess(__('Recent statistics have been updated.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t refresh recent statistics.')); @@ -196,7 +196,7 @@ class Statistics extends \Magento\Backend\App\Action $this->_objectManager->create($collectionName)->aggregate(); } $this->messageManager->addSuccess(__('We updated lifetime statistics.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t refresh lifetime statistics.')); diff --git a/app/code/Magento/Reports/Model/Event.php b/app/code/Magento/Reports/Model/Event.php index 96c79b44706..a1a7b2edb0b 100644 --- a/app/code/Magento/Reports/Model/Event.php +++ b/app/code/Magento/Reports/Model/Event.php @@ -47,7 +47,7 @@ namespace Magento\Reports\Model; * @package Magento_Reports * @author Magento Core Team <core@magentocommerce.com> */ -class Event extends \Magento\Core\Model\AbstractModel +class Event extends \Magento\Model\AbstractModel { const EVENT_PRODUCT_VIEW = 1; @@ -76,7 +76,7 @@ class Event extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory * @param \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -85,7 +85,7 @@ class Event extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory, \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Reports/Model/Event/Type.php b/app/code/Magento/Reports/Model/Event/Type.php index 1459460b878..f5f9b55bfbc 100644 --- a/app/code/Magento/Reports/Model/Event/Type.php +++ b/app/code/Magento/Reports/Model/Event/Type.php @@ -39,7 +39,7 @@ namespace Magento\Reports\Model\Event; * @package Magento_Reports * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\AbstractModel +class Type extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Reports/Model/Flag.php b/app/code/Magento/Reports/Model/Flag.php index 1e72f008e48..77effab7f12 100644 --- a/app/code/Magento/Reports/Model/Flag.php +++ b/app/code/Magento/Reports/Model/Flag.php @@ -32,7 +32,7 @@ namespace Magento\Reports\Model; * @package Magento_Reports * @author Magento Core Team <core@magentocommerce.com> */ -class Flag extends \Magento\Core\Model\Flag +class Flag extends \Magento\Flag { const REPORT_ORDER_FLAG_CODE = 'report_order_aggregated'; diff --git a/app/code/Magento/Reports/Model/Grouped/Collection.php b/app/code/Magento/Reports/Model/Grouped/Collection.php index c3155074e3f..5c90c6b3229 100644 --- a/app/code/Magento/Reports/Model/Grouped/Collection.php +++ b/app/code/Magento/Reports/Model/Grouped/Collection.php @@ -27,7 +27,7 @@ namespace Magento\Reports\Model\Grouped; use Magento\Data\Collection\Db; -class Collection extends \Magento\Data\Collection //\Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Data\Collection { /** * Column name for group by clause @@ -39,7 +39,7 @@ class Collection extends \Magento\Data\Collection //\Magento\Core\Model\Resource /** * Collection resource * - * @var \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @var \Magento\Model\Resource\Db\Collection\AbstractCollection */ protected $_resourceCollection = null; diff --git a/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php b/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php index 34193fb31e5..a8da1919015 100644 --- a/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php +++ b/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php @@ -28,7 +28,7 @@ namespace Magento\Reports\Model\Product\Index; /** * Reports Product Index Abstract Model */ -abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel +abstract class AbstractIndex extends \Magento\Model\AbstractModel { /** * Cache key name for Count of product index @@ -76,7 +76,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel * @param \Magento\Session\Generic $reportSession * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -89,7 +89,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel \Magento\Session\Generic $reportSession, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Reports/Model/Product/Index/Compared.php b/app/code/Magento/Reports/Model/Product/Index/Compared.php index d30844c34f3..3994a86183f 100644 --- a/app/code/Magento/Reports/Model/Product/Index/Compared.php +++ b/app/code/Magento/Reports/Model/Product/Index/Compared.php @@ -68,7 +68,7 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Catalog\Helper\Product\Compare $productCompare - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -82,7 +82,7 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Stdlib\DateTime $dateTime, \Magento\Catalog\Helper\Product\Compare $productCompare, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -126,8 +126,8 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex } } - if ($this->_coreRegistry->registry('current_product')) { - $productIds[] = $this->_coreRegistry->registry('current_product')->getId(); + if ($this->_registry->registry('current_product')) { + $productIds[] = $this->_registry->registry('current_product')->getId(); } return array_unique($productIds); diff --git a/app/code/Magento/Reports/Model/Product/Index/Viewed.php b/app/code/Magento/Reports/Model/Product/Index/Viewed.php index 2188535875a..93c32b37bfc 100644 --- a/app/code/Magento/Reports/Model/Product/Index/Viewed.php +++ b/app/code/Magento/Reports/Model/Product/Index/Viewed.php @@ -70,8 +70,8 @@ class Viewed extends \Magento\Reports\Model\Product\Index\AbstractIndex { $productIds = array(); - if ($this->_coreRegistry->registry('current_product')) { - $productIds[] = $this->_coreRegistry->registry('current_product')->getId(); + if ($this->_registry->registry('current_product')) { + $productIds[] = $this->_registry->registry('current_product')->getId(); } return $productIds; diff --git a/app/code/Magento/Reports/Model/Resource/Event.php b/app/code/Magento/Reports/Model/Resource/Event.php index dc68e78332b..423ae58eb5d 100644 --- a/app/code/Magento/Reports/Model/Resource/Event.php +++ b/app/code/Magento/Reports/Model/Resource/Event.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource; -class Event extends \Magento\Core\Model\Resource\Db\AbstractDb +class Event extends \Magento\Model\Resource\Db\AbstractDb { /** * Core store config diff --git a/app/code/Magento/Reports/Model/Resource/Event/Collection.php b/app/code/Magento/Reports/Model/Resource/Event/Collection.php index f0ed8c74f9e..542c82c0a1e 100644 --- a/app/code/Magento/Reports/Model/Resource/Event/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Event/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource\Event; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store Ids diff --git a/app/code/Magento/Reports/Model/Resource/Event/Type.php b/app/code/Magento/Reports/Model/Resource/Event/Type.php index 7ec67e7afc4..30fb1d00cfa 100644 --- a/app/code/Magento/Reports/Model/Resource/Event/Type.php +++ b/app/code/Magento/Reports/Model/Resource/Event/Type.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource\Event; -class Type extends \Magento\Core\Model\Resource\Db\AbstractDb +class Type extends \Magento\Model\Resource\Db\AbstractDb { /** * Main table initialization diff --git a/app/code/Magento/Reports/Model/Resource/Event/Type/Collection.php b/app/code/Magento/Reports/Model/Resource/Event/Type/Collection.php index 524ca542b15..fdb69772690 100644 --- a/app/code/Magento/Reports/Model/Resource/Event/Type/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Event/Type/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource\Event\Type; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Reports/Model/Resource/Helper.php b/app/code/Magento/Reports/Model/Resource/Helper.php index 489e6f42d0c..499c52e2879 100644 --- a/app/code/Magento/Reports/Model/Resource/Helper.php +++ b/app/code/Magento/Reports/Model/Resource/Helper.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource; -class Helper extends \Magento\Core\Model\Resource\Helper implements \Magento\Reports\Model\Resource\HelperInterface +class Helper extends \Magento\DB\Helper implements \Magento\Reports\Model\Resource\HelperInterface { /** * @param \Magento\App\Resource $resource diff --git a/app/code/Magento/Reports/Model/Resource/HelperInterface.php b/app/code/Magento/Reports/Model/Resource/HelperInterface.php index d48f3168591..5431e877231 100644 --- a/app/code/Magento/Reports/Model/Resource/HelperInterface.php +++ b/app/code/Magento/Reports/Model/Resource/HelperInterface.php @@ -48,7 +48,7 @@ interface HelperInterface * @param string $column * @param string $mainTable * @param string $aggregationTable - * @return \Magento\Core\Model\Resource\Helper\AbstractHelper + * @return \Magento\DB\Helper\AbstractHelper */ public function updateReportRatingPos($type, $column, $mainTable, $aggregationTable); } diff --git a/app/code/Magento/Reports/Model/Resource/Order/Collection.php b/app/code/Magento/Reports/Model/Resource/Order/Collection.php index 6e25ebdaa26..bd94f6612a6 100644 --- a/app/code/Magento/Reports/Model/Resource/Order/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Order/Collection.php @@ -80,15 +80,15 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource\Helper $coreResourceHelper + * @param \Magento\DB\Helper $coreResourceHelper * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Sales\Model\Order\Config $orderConfig * @param \Magento\Sales\Model\Resource\Report\OrderFactory $reportOrderFactory * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource - * + * @param \Magento\Model\Resource\Db\AbstractDb $resource + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -96,14 +96,14 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource\Helper $coreResourceHelper, + \Magento\DB\Helper $coreResourceHelper, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Sales\Model\Order\Config $orderConfig, \Magento\Sales\Model\Resource\Report\OrderFactory $reportOrderFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct( $entityFactory, diff --git a/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php b/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php index 9d7e4affb42..fd3aefaaa4f 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php @@ -28,7 +28,7 @@ namespace Magento\Reports\Model\Resource\Product\Index; /** * Reports Product Index Abstract Resource Model */ -abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractIndex extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime @@ -36,22 +36,22 @@ abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb protected $dateTime; /** - * @var \Magento\Reports\Model\Resource\HelperFactory + * @var \Magento\Reports\Model\Resource\Helper */ - protected $_helperFactory; + protected $_resourceHelper; /** * @param \Magento\App\Resource $resource - * @param \Magento\Reports\Model\Resource\HelperFactory $helperFactory + * @param \Magento\Reports\Model\Resource\Helper $resourceHelper * @param \Magento\Stdlib\DateTime $dateTime */ public function __construct( \Magento\App\Resource $resource, - \Magento\Reports\Model\Resource\HelperFactory $helperFactory, + \Magento\Reports\Model\Resource\Helper $resourceHelper, \Magento\Stdlib\DateTime $dateTime ) { parent::__construct($resource); - $this->_helperFactory = $helperFactory; + $this->_resourceHelper = $resourceHelper; $this->dateTime = $dateTime; } @@ -141,10 +141,10 @@ abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save Product Index data (forced save) * - * @param \Magento\Core\Model\AbstractModel $object - * @return $this|\Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel $object + * @return $this|\Magento\Model\Resource\Db\AbstractDb */ - public function save(\Magento\Core\Model\AbstractModel $object) + public function save(\Magento\Model\AbstractModel $object) { if ($object->isDeleted()) { return $this->delete($object); @@ -159,8 +159,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb $matchFields = array('product_id', 'store_id'); - $this->_helperFactory->create()->mergeVisitorProductIndex($this->getMainTable(), $data, $matchFields); - + $this->_resourceHelper->mergeVisitorProductIndex($this->getMainTable(), $data, $matchFields); $this->unserializeFields($object); $this->_afterSave($object); @@ -233,7 +232,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb $matchFields = array('product_id', 'store_id'); foreach ($data as $row) { - $this->_helperFactory->create()->mergeVisitorProductIndex($this->getMainTable(), $row, $matchFields); + $this->_resourceHelper->mergeVisitorProductIndex($this->getMainTable(), $row, $matchFields); } return $this; } diff --git a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php index 8869328b5bd..7df5ea0568a 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php @@ -256,7 +256,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection public function filterByProductType($typeFilter) { if (!is_string($typeFilter) && !is_array($typeFilter)) { - new \Magento\Core\Exception(__('The product type filter specified is incorrect.')); + new \Magento\Model\Exception(__('The product type filter specified is incorrect.')); } $this->addAttributeToFilter('type_id', $typeFilter); return $this; diff --git a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php index 1abcf7617a7..63050477abb 100644 --- a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php @@ -75,7 +75,7 @@ class Collection extends \Magento\Sales\Model\Resource\Quote\Collection * @param \Magento\Catalog\Model\Resource\Product\Collection $productResource * @param \Magento\Customer\Model\Resource\Customer $customerResource * @param null $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -85,7 +85,7 @@ class Collection extends \Magento\Sales\Model\Resource\Quote\Collection \Magento\Catalog\Model\Resource\Product\Collection $productResource, \Magento\Customer\Model\Resource\Customer $customerResource, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_productResource = $productResource; diff --git a/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php b/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php index a980e3d946e..7ba5d1c5fdc 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php +++ b/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource\Report; -abstract class AbstractReport extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractReport extends \Magento\Model\Resource\Db\AbstractDb { /** * Flag object diff --git a/app/code/Magento/Reports/Model/Resource/Report/Collection.php b/app/code/Magento/Reports/Model/Resource/Report/Collection.php index f0ca912b42f..2da872666f3 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Collection.php @@ -356,7 +356,7 @@ class Collection extends \Magento\Data\Collection * * @param int $fromDate * @param int $toDate - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ protected function _getReport($fromDate, $toDate) { diff --git a/app/code/Magento/Reports/Model/Resource/Report/Collection/AbstractCollection.php b/app/code/Magento/Reports/Model/Resource/Report/Collection/AbstractCollection.php index beceb075268..c97674cbe12 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Collection/AbstractCollection.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Collection/AbstractCollection.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource\Report\Collection; -class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class AbstractCollection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * From date diff --git a/app/code/Magento/Reports/Model/Resource/Report/Collection/Factory.php b/app/code/Magento/Reports/Model/Resource/Report/Collection/Factory.php index aea1fd6e504..e448cef0649 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Collection/Factory.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Collection/Factory.php @@ -43,7 +43,7 @@ class Factory * * @param string $className * @param array $arguments - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function create($className, array $arguments = array()) { diff --git a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed.php b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed.php index bc2e6b3420b..131a567eec2 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed.php @@ -57,9 +57,9 @@ class Viewed extends \Magento\Sales\Model\Resource\Report\AbstractReport protected $_productResource; /** - * @var \Magento\Reports\Model\Resource\HelperFactory + * @var \Magento\Reports\Model\Resource\Helper */ - protected $_helperFactory; + protected $_resourceHelper; /** * @param \Magento\App\Resource $resource @@ -69,7 +69,7 @@ class Viewed extends \Magento\Sales\Model\Resource\Report\AbstractReport * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Stdlib\DateTime\Timezone\Validator $timezoneValidator * @param \Magento\Catalog\Model\Resource\Product $productResource - * @param \Magento\Reports\Model\Resource\HelperFactory $helperFactory + * @param \Magento\Reports\Model\Resource\Helper $resourceHelper */ public function __construct( \Magento\App\Resource $resource, @@ -79,11 +79,11 @@ class Viewed extends \Magento\Sales\Model\Resource\Report\AbstractReport \Magento\Stdlib\DateTime $dateTime, \Magento\Stdlib\DateTime\Timezone\Validator $timezoneValidator, \Magento\Catalog\Model\Resource\Product $productResource, - \Magento\Reports\Model\Resource\HelperFactory $helperFactory + \Magento\Reports\Model\Resource\Helper $resourceHelper ) { parent::__construct($resource, $logger, $localeDate, $reportsFlagFactory, $dateTime, $timezoneValidator); $this->_productResource = $productResource; - $this->_helperFactory = $helperFactory; + $this->_resourceHelper = $resourceHelper; } /** @@ -234,10 +234,9 @@ class Viewed extends \Magento\Sales\Model\Resource\Report\AbstractReport $insertQuery = $select->insertFromSelect($this->getMainTable(), array_keys($columns)); $adapter->query($insertQuery); - $helper = $this->_helperFactory->create(); - $helper->updateReportRatingPos('day', 'views_num', $mainTable, $this->getTable(self::AGGREGATION_DAILY)); - $helper->updateReportRatingPos('month', 'views_num', $mainTable, $this->getTable(self::AGGREGATION_MONTHLY)); - $helper->updateReportRatingPos('year', 'views_num', $mainTable, $this->getTable(self::AGGREGATION_YEARLY)); + $this->_resourceHelper->updateReportRatingPos('day', 'views_num', $mainTable, $this->getTable(self::AGGREGATION_DAILY)); + $this->_resourceHelper->updateReportRatingPos('month', 'views_num', $mainTable, $this->getTable(self::AGGREGATION_MONTHLY)); + $this->_resourceHelper->updateReportRatingPos('year', 'views_num', $mainTable, $this->getTable(self::AGGREGATION_YEARLY)); $this->_setFlagData(\Magento\Reports\Model\Flag::REPORT_PRODUCT_VIEWED_FLAG_CODE); diff --git a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php index b0a4dfcb80a..490c5aa0cb4 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php @@ -239,7 +239,7 @@ class Collection extends \Magento\Reports\Model\Resource\Report\Collection\Abstr * Re-declare parent method for applying filters after parent method, but before adding unions and calculating * totals * - * @return $this|\Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return $this|\Magento\Model\Resource\Db\Collection\AbstractCollection */ protected function _beforeLoad() { diff --git a/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php b/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php index c7ac843caa0..77fdb60fc71 100644 --- a/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php @@ -51,7 +51,7 @@ class Collection extends \Magento\Review\Model\Resource\Review\Collection * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Resource\Customer $customerResource * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -63,7 +63,7 @@ class Collection extends \Magento\Review\Model\Resource\Review\Collection \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Resource\Customer $customerResource, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_customerResource = $customerResource; parent::__construct( diff --git a/app/code/Magento/Reports/Model/Resource/Wishlist/Collection.php b/app/code/Magento/Reports/Model/Resource/Wishlist/Collection.php index bb8f81e783c..8b1c46d309b 100644 --- a/app/code/Magento/Reports/Model/Resource/Wishlist/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Wishlist/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource\Wishlist; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Wishlist table name @@ -55,7 +55,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerResFactory * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -64,7 +64,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerResFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_customerResFactory = $customerResFactory; diff --git a/app/code/Magento/Reports/etc/di.xml b/app/code/Magento/Reports/etc/di.xml index 1304c822160..03ef739d036 100644 --- a/app/code/Magento/Reports/etc/di.xml +++ b/app/code/Magento/Reports/etc/di.xml @@ -49,4 +49,9 @@ <argument name="reportSession" xsi:type="object">Magento\Reports\Model\Session</argument> </arguments> </type> + <type name="Magento\Reports\Model\Resource\Helper"> + <arguments> + <argument name="modulePrefix" xsi:type="string">reports</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Reports/etc/module.xml b/app/code/Magento/Reports/etc/module.xml index e14249a2f8a..ac2e3e0d987 100644 --- a/app/code/Magento/Reports/etc/module.xml +++ b/app/code/Magento/Reports/etc/module.xml @@ -49,8 +49,6 @@ <module name="Magento_Rating"/> <module name="Magento_Downloadable"/> <module name="Magento_SalesRule"/> - <module name="Magento_Checkout"/> - <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml index dc9c86ad939..71ab3265bad 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml @@ -51,7 +51,7 @@ <argument name="filter_visibility" xsi:type="string">0</argument> <argument name="id" xsi:type="string">customers_grid</argument> <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">catalog/product_review</item> + <item name="path" xsi:type="string">review/product</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="customerId" xsi:type="string">getCustomerId</item> </item> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_product_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_product_grid.xml index 7f6e77c4890..ed9530aa909 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_product_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_product_grid.xml @@ -51,7 +51,7 @@ <argument name="filter_visibility" xsi:type="string">0</argument> <argument name="id" xsi:type="string">gridProducts</argument> <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">catalog/product_review</item> + <item name="path" xsi:type="string">review/product</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="productId" xsi:type="string">getId</item> </item> diff --git a/app/code/Magento/Review/Block/Adminhtml/Add.php b/app/code/Magento/Review/Block/Adminhtml/Add.php index 1051f83fa41..760f4ba67f0 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Add.php +++ b/app/code/Magento/Review/Block/Adminhtml/Add.php @@ -97,7 +97,7 @@ class Add extends \Magento\Backend\Block\Widget\Form\Container } new Ajax.Updater("rating_detail", "' . $this->getUrl( - 'catalog/*/ratingItems' + 'review/product/ratingItems' ) . '", {parameters:params, evalScripts: true, onComplete:function(){ $(\'save_button\').disabled = false; } }); }, @@ -106,7 +106,7 @@ class Add extends \Magento\Backend\Block\Widget\Form\Container var response = Ext.util.JSON.decode(o.responseText); if( response.error ) { alert(response.message); - } elseif( response.id ){ + } else if( response.id ){ $("product_id").value = response.id; $("product_name").innerHTML = \'<a href="' . @@ -114,7 +114,7 @@ class Add extends \Magento\Backend\Block\Widget\Form\Container 'catalog/product/edit' ) . 'id/\' + response.id + \'" target="_blank">\' + response.name + \'</a>\'; - } elseif ( response.message ) { + } else if ( response.message ) { alert(response.message); } } diff --git a/app/code/Magento/Review/Block/Adminhtml/Add/Form.php b/app/code/Magento/Review/Block/Adminhtml/Add/Form.php index 2adb9f1312a..22c5586b5dc 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Add/Form.php +++ b/app/code/Magento/Review/Block/Adminhtml/Add/Form.php @@ -172,7 +172,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $form->setMethod('post'); $form->setUseContainer(true); $form->setId('edit_form'); - $form->setAction($this->getUrl('catalog/*/post')); + $form->setAction($this->getUrl('review/product/post')); $this->setForm($form); } diff --git a/app/code/Magento/Review/Block/Adminhtml/Edit.php b/app/code/Magento/Review/Block/Adminhtml/Edit.php index 9bdd984bd8a..ad021f25909 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Edit.php +++ b/app/code/Magento/Review/Block/Adminhtml/Edit.php @@ -96,7 +96,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container 'previous', array( 'label' => __('Previous'), - 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/*', array('id' => $prevId)) . '\')' + 'onclick' => 'setLocation(\'' . $this->getUrl('review/*/*', array('id' => $prevId)) . '\')' ), 3, 10 @@ -145,7 +145,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container 'next', array( 'label' => __('Next'), - 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/*', array('id' => $nextId)) . '\')' + 'onclick' => 'setLocation(\'' . $this->getUrl('review/*/*', array('id' => $nextId)) . '\')' ), 3, 105 @@ -209,7 +209,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container "rating_detail", "' . $this->getUrl( - 'catalog/*/ratingItems', + 'review/*/ratingItems', array('_current' => true) ) . '", diff --git a/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php index a3362e1d111..58407479827 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php +++ b/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php @@ -39,11 +39,9 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic protected $_reviewData = null; /** - * Customer model factory - * - * @var \Magento\Customer\Model\CustomerFactory + * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface */ - protected $_customerFactory; + protected $customerAccount; /** * Catalog product factory @@ -64,7 +62,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Model\System\Store $systemStore - * @param \Magento\Customer\Model\CustomerFactory $customerFactory + * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccount * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Review\Helper\Data $reviewData * @param array $data @@ -74,13 +72,13 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Core\Model\System\Store $systemStore, - \Magento\Customer\Model\CustomerFactory $customerFactory, + \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccount, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Review\Helper\Data $reviewData, array $data = array() ) { $this->_reviewData = $reviewData; - $this->_customerFactory = $customerFactory; + $this->customerAccount = $customerAccount; $this->_productFactory = $productFactory; $this->_systemStore = $systemStore; parent::__construct($context, $registry, $formFactory, $data); @@ -95,7 +93,6 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { $review = $this->_coreRegistry->registry('review_data'); $product = $this->_productFactory->create()->load($review->getEntityPkValue()); - $customer = $this->_customerFactory->create()->load($review->getCustomerId()); /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create( @@ -103,7 +100,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic 'data' => array( 'id' => 'edit_form', 'action' => $this->getUrl( - 'catalog/*/save', + 'review/*/save', array( 'id' => $this->getRequest()->getParam('id'), 'ret' => $this->_coreRegistry->registry('ret') @@ -133,18 +130,18 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic ) ); - if ($customer->getId()) { + try { + $customer = $this->customerAccount->getCustomer($review->getCustomerId()); $customerText = __( '<a href="%1" onclick="this.target=\'blank\'">%2 %3</a> <a href="mailto:%4">(%4)</a>', - $this->getUrl('customer/index/edit', array('id' => $customer->getId(), 'active_tab' => 'review')), + $this->getUrl('customer/index/edit', array('id' => $customer->getId(), 'active_tab'=>'review')), $this->escapeHtml($customer->getFirstname()), $this->escapeHtml($customer->getLastname()), $this->escapeHtml($customer->getEmail()) ); - } elseif ($review->getStoreId() == \Magento\Core\Model\Store::DEFAULT_STORE_ID) { - $customerText = __('Administrator'); - } else { - $customerText = __('Guest'); + } catch (\Magento\Exception\NoSuchEntityException $e) { + $customerText = ($review->getStoreId() == \Magento\Core\Model\Store::DEFAULT_STORE_ID) + ? __('Administrator') : __('Guest'); } $fieldset->addField('customer', 'note', array('label' => __('Posted By'), 'text' => $customerText)); diff --git a/app/code/Magento/Review/Block/Adminhtml/Grid.php b/app/code/Magento/Review/Block/Adminhtml/Grid.php index c0f65919ad0..29415b7ba61 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Review/Block/Adminhtml/Grid.php @@ -307,7 +307,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended array( 'caption' => __('Edit'), 'url' => array( - 'base' => 'catalog/product_review/edit', + 'base' => 'review/product/edit', 'params' => array( 'productId' => $this->getProductId(), 'customerId' => $this->getCustomerId(), @@ -383,7 +383,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended public function getRowUrl($row) { return $this->getUrl( - 'catalog/product_review/edit', + 'review/product/edit', array( 'id' => $row->getReviewId(), 'productId' => $this->getProductId(), @@ -402,7 +402,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { if ($this->getProductId() || $this->getCustomerId()) { return $this->getUrl( - 'catalog/product_review/' . ($this->_coreRegistry->registry('usePendingFilter') ? 'pending' : ''), + 'review/product' . ($this->_coreRegistry->registry('usePendingFilter') ? 'pending' : ''), array('productId' => $this->getProductId(), 'customerId' => $this->getCustomerId()) ); } else { diff --git a/app/code/Magento/Review/Block/Adminhtml/Main.php b/app/code/Magento/Review/Block/Adminhtml/Main.php index 855cdcd4b1f..1e2e8e248b0 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Main.php +++ b/app/code/Magento/Review/Block/Adminhtml/Main.php @@ -39,11 +39,9 @@ class Main extends \Magento\Backend\Block\Widget\Grid\Container protected $_coreRegistry = null; /** - * Customer model factory - * - * @var \Magento\Customer\Model\CustomerFactory + * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface */ - protected $_customerFactory; + protected $customerAccount; /** * Catalog product model factory @@ -54,20 +52,20 @@ class Main extends \Magento\Backend\Block\Widget\Grid\Container /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Customer\Model\CustomerFactory $customerFactory + * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccount * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Registry $registry * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Customer\Model\CustomerFactory $customerFactory, + \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccount, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Registry $registry, array $data = array() ) { $this->_coreRegistry = $registry; - $this->_customerFactory = $customerFactory; + $this->customerAccount = $customerAccount; $this->_productFactory = $productFactory; parent::__construct($context, $data); } @@ -89,7 +87,7 @@ class Main extends \Magento\Backend\Block\Widget\Grid\Container $customerId = $this->getRequest()->getParam('customerId', false); $customerName = ''; if ($customerId) { - $customer = $this->_customerFactory->create()->load($customerId); + $customer = $this->customerAccount->getCustomer($customerId); $customerName = $customer->getFirstname() . ' ' . $customer->getLastname(); $customerName = $this->escapeHtml($customerName); } diff --git a/app/code/Magento/Backend/Model/Translate/Inline/ConfigFactory.php b/app/code/Magento/Review/Block/Adminhtml/Product/Edit/Tab.php similarity index 63% rename from app/code/Magento/Backend/Model/Translate/Inline/ConfigFactory.php rename to app/code/Magento/Review/Block/Adminhtml/Product/Edit/Tab.php index 41ea96b9974..b77ee104c0d 100644 --- a/app/code/Magento/Backend/Model/Translate/Inline/ConfigFactory.php +++ b/app/code/Magento/Review/Block/Adminhtml/Product/Edit/Tab.php @@ -18,25 +18,25 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Backend * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backend\Model\Translate\Inline; +namespace Magento\Review\Block\Adminhtml\Product\Edit; -/** - * Backend Inline Translation config factory - */ -class ConfigFactory extends \Magento\Translate\Inline\ConfigFactory +class Tab extends \Magento\Backend\Block\Widget\Tab { /** - * Get instance of inline translate config - * - * @return \Magento\Translate\Inline\ConfigFactory + * @param \Magento\Backend\Block\Template\Context $context + * @param array $data */ - public function get() - { - return $this->_objectManager->get('Magento\Backend\Model\Translate\Inline\Config'); + public function __construct( + \Magento\Backend\Block\Template\Context $context, + array $data = array() + ) { + parent::__construct($context, $data); + + if (!$this->_request->getParam('id') || !$this->_authorization->isAllowed('Magento_Review::reviews_all')) { + $this->setCanShow(false); + } } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Reviews.php b/app/code/Magento/Review/Block/Adminhtml/Product/Edit/Tab/Reviews.php similarity index 74% rename from app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Reviews.php rename to app/code/Magento/Review/Block/Adminhtml/Product/Edit/Tab/Reviews.php index 2c94e414e35..825a5a3bf57 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Reviews.php +++ b/app/code/Magento/Review/Block/Adminhtml/Product/Edit/Tab/Reviews.php @@ -1,5 +1,7 @@ <?php /** + * Reviews products admin grid + * * Magento * * NOTICE OF LICENSE @@ -18,27 +20,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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -/** - * Reviews products admin grid - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab; +namespace Magento\Review\Block\Adminhtml\Product\Edit\Tab; class Reviews extends \Magento\Review\Block\Adminhtml\Grid { /** * Hide grid mass action elements * - * @return \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Reviews + * @return $this */ protected function _prepareMassaction() { @@ -52,6 +44,6 @@ class Reviews extends \Magento\Review\Block\Adminhtml\Grid */ public function getGridUrl() { - return $this->getUrl('catalog/*/reviews', array('_current' => true)); + return $this->getUrl('review/product_reviews/grid', array('_current' => true)); } } diff --git a/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php index ae63934c0c1..91e3d9e2266 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php @@ -155,7 +155,7 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid */ public function getGridUrl() { - return $this->getUrl('catalog/*/productGrid', array('_current' => true)); + return $this->getUrl('catalog/product/productGrid', array('_current' => true)); } /** @@ -166,7 +166,7 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid */ public function getRowUrl($row) { - return $this->getUrl('catalog/*/jsonProductInfo', array('id' => $row->getId())); + return $this->getUrl('review/product/jsonProductInfo', array('id' => $row->getId())); } /** diff --git a/app/code/Magento/Review/Block/Customer/View.php b/app/code/Magento/Review/Block/Customer/View.php index 28980596699..125bd917c0e 100644 --- a/app/code/Magento/Review/Block/Customer/View.php +++ b/app/code/Magento/Review/Block/Customer/View.php @@ -79,17 +79,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct protected $currentCustomer; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory @@ -97,21 +87,9 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Customer\Service\V1\CustomerCurrentService $currentCustomer * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, @@ -128,16 +106,6 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Review/Block/Form.php b/app/code/Magento/Review/Block/Form.php index 4b3e116a621..21434fda40b 100644 --- a/app/code/Magento/Review/Block/Form.php +++ b/app/code/Magento/Review/Block/Form.php @@ -141,7 +141,7 @@ class Form extends \Magento\View\Element\Template // add logged in customer name as nickname if (!$data->getNickname()) { - $customer = $this->_customerSession->getCustomer(); + $customer = $this->_customerSession->getCustomerDataObject(); if ($customer && $customer->getId()) { $data->setNickname($customer->getFirstname()); } diff --git a/app/code/Magento/Review/Block/Helper.php b/app/code/Magento/Review/Block/Product/ReviewRenderer.php similarity index 79% rename from app/code/Magento/Review/Block/Helper.php rename to app/code/Magento/Review/Block/Product/ReviewRenderer.php index 46613c506ad..722f5e507dd 100644 --- a/app/code/Magento/Review/Block/Helper.php +++ b/app/code/Magento/Review/Block/Product/ReviewRenderer.php @@ -1,5 +1,7 @@ <?php /** + * Review renderer + * * Magento * * NOTICE OF LICENSE @@ -18,23 +20,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_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Review\Block; +namespace Magento\Review\Block\Product; +use Magento\Catalog\Block\Product\ReviewRendererInterface; use Magento\Catalog\Model\Product; -/** - * Review helper - * - * @category Magento - * @package Magento_Review - * @author Magento Core Team <core@magentocommerce.com> - */ -class Helper extends \Magento\View\Element\Template +class ReviewRenderer extends \Magento\View\Element\Template implements ReviewRendererInterface { /** * Array of available template name @@ -42,8 +36,8 @@ class Helper extends \Magento\View\Element\Template * @var array */ protected $_availableTemplates = array( - 'default' => 'helper/summary.phtml', - 'short' => 'helper/summary_short.phtml' + self::DEFAULT_REVIEW => 'helper/summary.phtml', + self::SHORT_REVIEW => 'helper/summary_short.phtml' ); /** @@ -73,13 +67,17 @@ class Helper extends \Magento\View\Element\Template * @param Product $product * @param string $templateType * @param bool $displayIfNoReviews + * * @return string */ - public function getSummaryHtml($product, $templateType, $displayIfNoReviews) - { + public function getReviewsSummaryHtml( + \Magento\Catalog\Model\Product $product, + $templateType = self::DEFAULT_REVIEW, + $displayIfNoReviews = false + ) { // pick template among available if (empty($this->_availableTemplates[$templateType])) { - $templateType = 'default'; + $templateType = self::DEFAULT_REVIEW; } $this->setTemplate($this->_availableTemplates[$templateType]); @@ -125,18 +123,4 @@ class Helper extends \Magento\View\Element\Template array('id' => $this->getProduct()->getId(), 'category' => $this->getProduct()->getCategoryId()) ); } - - /** - * Add an available template by type - * - * It should be called before getSummaryHtml() - * - * @param string $type - * @param string $template - * @return void - */ - public function addTemplate($type, $template) - { - $this->_availableTemplates[$type] = $template; - } } diff --git a/app/code/Magento/Review/Block/Product/View.php b/app/code/Magento/Review/Block/Product/View.php index 9ae2a5c2dab..300b0de852d 100644 --- a/app/code/Magento/Review/Block/Product/View.php +++ b/app/code/Magento/Review/Block/Product/View.php @@ -51,17 +51,7 @@ class View extends \Magento\Catalog\Block\Product\View protected $_reviewsColFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\ProductFactory $productFactory @@ -73,21 +63,9 @@ class View extends \Magento\Catalog\Block\Product\View * @param \Magento\Review\Model\Resource\Review\CollectionFactory $collectionFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Model\ProductFactory $productFactory, @@ -103,16 +81,6 @@ class View extends \Magento\Catalog\Block\Product\View $this->_reviewsColFactory = $collectionFactory; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $coreData, $jsonEncoder, $productFactory, diff --git a/app/code/Magento/Review/Block/View.php b/app/code/Magento/Review/Block/View.php index f41d4dfc59b..09c5f44cd00 100644 --- a/app/code/Magento/Review/Block/View.php +++ b/app/code/Magento/Review/Block/View.php @@ -61,37 +61,15 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct protected $_reviewFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory * @param \Magento\Rating\Model\RatingFactory $ratingFactory * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, \Magento\Rating\Model\RatingFactory $ratingFactory, \Magento\Review\Model\ReviewFactory $reviewFactory, @@ -103,16 +81,6 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php b/app/code/Magento/Review/Controller/Adminhtml/Product.php similarity index 93% rename from app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php rename to app/code/Magento/Review/Controller/Adminhtml/Product.php index 247ed051302..233b1fb9121 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php +++ b/app/code/Magento/Review/Controller/Adminhtml/Product.php @@ -19,16 +19,16 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Catalog\Controller\Adminhtml\Product; +namespace Magento\Review\Controller\Adminhtml; /** * Reviews admin controller */ -class Review extends \Magento\Backend\App\Action +class Product extends \Magento\Backend\App\Action { /** * Array of actions which can be processed without secret key validation @@ -181,7 +181,7 @@ class Review extends \Magento\Backend\App\Action $review->aggregate(); $this->messageManager->addSuccess(__('You saved the review.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong while saving this review.')); @@ -191,11 +191,11 @@ class Review extends \Magento\Backend\App\Action $nextId = (int)$this->getRequest()->getParam('next_item'); $url = $this->getUrl($this->getRequest()->getParam('ret') == 'pending' ? '*/*/pending' : '*/*/'); if ($nextId) { - $url = $this->getUrl('catalog/*/edit', array('id' => $nextId)); + $url = $this->getUrl('review/*/edit', array('id' => $nextId)); } return $this->getResponse()->setRedirect($url); } - $this->_redirect('catalog/*/'); + $this->_redirect('review/*/'); } /** @@ -209,18 +209,18 @@ class Review extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('The review has been deleted.')); if ($this->getRequest()->getParam('ret') == 'pending') { - $this->getResponse()->setRedirect($this->getUrl('catalog/*/pending')); + $this->getResponse()->setRedirect($this->getUrl('review/*/pending')); } else { - $this->getResponse()->setRedirect($this->getUrl('catalog/*/')); + $this->getResponse()->setRedirect($this->getUrl('review/*/')); } return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong deleting this review.')); } - $this->_redirect('catalog/*/edit/', array('id' => $reviewId)); + $this->_redirect('review/*/edit/', array('id' => $reviewId)); } /** @@ -241,14 +241,14 @@ class Review extends \Magento\Backend\App\Action $this->messageManager->addSuccess( __('A total of %1 record(s) have been deleted.', count($reviewsIds)) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('An error occurred while deleting record(s).')); } } - $this->_redirect('catalog/*/' . $this->getRequest()->getParam('ret', 'index')); + $this->_redirect('review/*/' . $this->getRequest()->getParam('ret', 'index')); } /** @@ -269,7 +269,7 @@ class Review extends \Magento\Backend\App\Action $this->messageManager->addSuccess( __('A total of %1 record(s) have been updated.', count($reviewsIds)) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -279,7 +279,7 @@ class Review extends \Magento\Backend\App\Action } } - $this->_redirect('catalog/*/' . $this->getRequest()->getParam('ret', 'index')); + $this->_redirect('review/*/' . $this->getRequest()->getParam('ret', 'index')); } /** @@ -302,7 +302,7 @@ class Review extends \Magento\Backend\App\Action $this->messageManager->addSuccess( __('A total of %1 record(s) have been updated.', count($reviewsIds)) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -312,7 +312,7 @@ class Review extends \Magento\Backend\App\Action } } - $this->_redirect('catalog/*/pending'); + $this->_redirect('review/*/pending'); } /** @@ -401,19 +401,19 @@ class Review extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You saved the review.')); if ($this->getRequest()->getParam('ret') == 'pending') { - $this->getResponse()->setRedirect($this->getUrl('catalog/*/pending')); + $this->getResponse()->setRedirect($this->getUrl('review/*/pending')); } else { - $this->getResponse()->setRedirect($this->getUrl('catalog/*/')); + $this->getResponse()->setRedirect($this->getUrl('review/*/')); } return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('An error occurred while saving review.')); } } - $this->getResponse()->setRedirect($this->getUrl('catalog/*/')); + $this->getResponse()->setRedirect($this->getUrl('review/*/')); return; } diff --git a/app/code/Magento/Core/Model/Resource/HelperFactory.php b/app/code/Magento/Review/Controller/Adminhtml/Product/Reviews.php similarity index 51% rename from app/code/Magento/Core/Model/Resource/HelperFactory.php rename to app/code/Magento/Review/Controller/Adminhtml/Product/Reviews.php index beda5d89006..ace0dc0a0dc 100644 --- a/app/code/Magento/Core/Model/Resource/HelperFactory.php +++ b/app/code/Magento/Review/Controller/Adminhtml/Product/Reviews.php @@ -1,7 +1,5 @@ <?php /** - * Resource helper factory - * * Magento * * NOTICE OF LICENSE @@ -23,35 +21,39 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Review\Controller\Adminhtml\Product; -abstract class HelperFactory +class Reviews extends \Magento\Backend\App\Action { /** - * @var string + * @var \Magento\Catalog\Controller\Adminhtml\Product\Builder */ - protected $_moduleName; + protected $productBuilder; /** - * @var \Magento\Core\Model\Resource\HelperPool + * @param \Magento\Backend\App\Action\Context $context + * @param \Magento\Catalog\Controller\Adminhtml\Product\Builder $productBuilder */ - protected $_helperPool; - - /** - * @param \Magento\Core\Model\Resource\HelperPool $helperPool - */ - public function __construct(\Magento\Core\Model\Resource\HelperPool $helperPool) - { - $this->_helperPool = $helperPool; + public function __construct( + \Magento\Backend\App\Action\Context $context, + \Magento\Catalog\Controller\Adminhtml\Product\Builder $productBuilder + ) { + $this->productBuilder = $productBuilder; + parent::__construct($context); } /** - * Create resource helper instance + * Get product reviews grid * * @return void */ - public function create() + public function gridAction() { - return $this->_helperPool->get($this->_moduleName); + $product = $this->productBuilder->build($this->getRequest()); + $this->_view->loadLayout(); + $this->_view->getLayout()->getBlock('admin.product.reviews') + ->setProductId($product->getId()) + ->setUseAjax(true); + $this->_view->renderLayout(); } } diff --git a/app/code/Magento/Review/Controller/Product.php b/app/code/Magento/Review/Controller/Product.php index 538c1fa3341..75e113fe84a 100644 --- a/app/code/Magento/Review/Controller/Product.php +++ b/app/code/Magento/Review/Controller/Product.php @@ -224,7 +224,7 @@ class Product extends \Magento\App\Action\Action 'review_controller_product_init_after', array('product' => $product, 'controller_action' => $this) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_logger->logException($e); return false; } diff --git a/app/code/Magento/Review/Helper/Action/Pager.php b/app/code/Magento/Review/Helper/Action/Pager.php index b38c60ba2bd..6509a1e9761 100644 --- a/app/code/Magento/Review/Helper/Action/Pager.php +++ b/app/code/Magento/Review/Helper/Action/Pager.php @@ -25,7 +25,7 @@ */ namespace Magento\Review\Helper\Action; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Action pager helper for iterating over search results diff --git a/app/code/Magento/Review/Model/Resource/Review.php b/app/code/Magento/Review/Model/Resource/Review.php index 52b10def3d5..adbd31a2d64 100644 --- a/app/code/Magento/Review/Model/Resource/Review.php +++ b/app/code/Magento/Review/Model/Resource/Review.php @@ -25,7 +25,7 @@ */ namespace Magento\Review\Model\Resource; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Review resource model @@ -34,7 +34,7 @@ use Magento\Core\Model\AbstractModel; * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ -class Review extends \Magento\Core\Model\Resource\Db\AbstractDb +class Review extends \Magento\Model\Resource\Db\AbstractDb { /** * Review table diff --git a/app/code/Magento/Review/Model/Resource/Review/Collection.php b/app/code/Magento/Review/Model/Resource/Review/Collection.php index a33565ef8ba..450e0955d37 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Review/Collection.php @@ -30,7 +30,7 @@ namespace Magento\Review\Model\Resource\Review; * * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Review table @@ -103,7 +103,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -114,7 +114,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_reviewData = $reviewData; $this->_voteFactory = $voteFactory; diff --git a/app/code/Magento/Review/Model/Resource/Review/Status.php b/app/code/Magento/Review/Model/Resource/Review/Status.php index 5b3d62b4c69..9b2340e2062 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Status.php +++ b/app/code/Magento/Review/Model/Resource/Review/Status.php @@ -30,7 +30,7 @@ namespace Magento\Review\Model\Resource\Review; * * @author Magento Core Team <core@magentocommerce.com> */ -class Status extends \Magento\Core\Model\Resource\Db\AbstractDb +class Status extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource status model initialization diff --git a/app/code/Magento/Review/Model/Resource/Review/Status/Collection.php b/app/code/Magento/Review/Model/Resource/Review/Status/Collection.php index e75373a565a..12a2724fac1 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Status/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Review/Status/Collection.php @@ -33,7 +33,7 @@ */ namespace Magento\Review\Model\Resource\Review\Status; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Review status table diff --git a/app/code/Magento/Review/Model/Resource/Review/Summary.php b/app/code/Magento/Review/Model/Resource/Review/Summary.php index 747af7ea080..63a0b3aa92f 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Summary.php +++ b/app/code/Magento/Review/Model/Resource/Review/Summary.php @@ -25,14 +25,14 @@ */ namespace Magento\Review\Model\Resource\Review; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Review summary resource model * * @author Magento Core Team <core@magentocommerce.com> */ -class Summary extends \Magento\Core\Model\Resource\Db\AbstractDb +class Summary extends \Magento\Model\Resource\Db\AbstractDb { /** * Define module diff --git a/app/code/Magento/Review/Model/Review.php b/app/code/Magento/Review/Model/Review.php index 0111e1f34a6..7df4187ffa7 100644 --- a/app/code/Magento/Review/Model/Review.php +++ b/app/code/Magento/Review/Model/Review.php @@ -46,7 +46,7 @@ use Magento\Catalog\Model\Product; * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ -class Review extends \Magento\Core\Model\AbstractModel +class Review extends \Magento\Model\AbstractModel { /** * Event prefix for observer @@ -129,7 +129,7 @@ class Review extends \Magento\Core\Model\AbstractModel * @param \Magento\Review\Model\Review\Summary $reviewSummary * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\UrlInterface $urlModel - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -143,7 +143,7 @@ class Review extends \Magento\Core\Model\AbstractModel \Magento\Review\Model\Review\Summary $reviewSummary, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\UrlInterface $urlModel, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -276,7 +276,7 @@ class Review extends \Magento\Core\Model\AbstractModel /** * Perform actions after object delete * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterDeleteCommit() { @@ -325,7 +325,6 @@ class Review extends \Magento\Core\Model\AbstractModel */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); return parent::_beforeDelete(); } diff --git a/app/code/Magento/Review/Model/Review/Status.php b/app/code/Magento/Review/Model/Review/Status.php index d4d8fcf1291..bda94ce1c46 100644 --- a/app/code/Magento/Review/Model/Review/Status.php +++ b/app/code/Magento/Review/Model/Review/Status.php @@ -33,19 +33,19 @@ */ namespace Magento\Review\Model\Review; -class Status extends \Magento\Core\Model\AbstractModel +class Status extends \Magento\Model\AbstractModel { /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Review/Model/Review/Summary.php b/app/code/Magento/Review/Model/Review/Summary.php index 6414fcdb239..fb0d5f4ed1e 100644 --- a/app/code/Magento/Review/Model/Review/Summary.php +++ b/app/code/Magento/Review/Model/Review/Summary.php @@ -28,7 +28,7 @@ namespace Magento\Review\Model\Review; /** * Review summary */ -class Summary extends \Magento\Core\Model\AbstractModel +class Summary extends \Magento\Model\AbstractModel { /** * @param \Magento\Model\Context $context diff --git a/app/code/Magento/Review/etc/adminhtml/menu.xml b/app/code/Magento/Review/etc/adminhtml/menu.xml index ebff77dc91f..a31a6e7f83f 100644 --- a/app/code/Magento/Review/etc/adminhtml/menu.xml +++ b/app/code/Magento/Review/etc/adminhtml/menu.xml @@ -28,7 +28,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Backend/etc/menu.xsd"> <menu> <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::catalog_reviews_ratings_reviews_all" title="Reviews" module="Magento_Review" parent="Magento_Backend::marketing_user_content" sortOrder="10" action="review/product/index" 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/Customer/etc/frontend/events.xml b/app/code/Magento/Review/etc/adminhtml/routes.xml similarity index 78% rename from app/code/Magento/Customer/etc/frontend/events.xml rename to app/code/Magento/Review/etc/adminhtml/routes.xml index 0c456c5fdf2..859cc6b8208 100644 --- a/app/code/Magento/Customer/etc/frontend/events.xml +++ b/app/code/Magento/Review/etc/adminhtml/routes.xml @@ -23,8 +23,10 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/Event/etc/events.xsd"> - <event name="sales_model_service_quote_submit_after"> - <observer name="restore_customer_group_id" instance="Magento\Customer\Model\Observer" method="quoteSubmitAfter" /> - </event> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/App/etc/routes.xsd"> + <router id="admin"> + <route id="review" frontName="review"> + <module name="Magento_Review" /> + </route> + </router> </config> diff --git a/app/code/Magento/Review/etc/di.xml b/app/code/Magento/Review/etc/di.xml new file mode 100644 index 00000000000..639abe1f711 --- /dev/null +++ b/app/code/Magento/Review/etc/di.xml @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <preference for="Magento\Catalog\Block\Product\ReviewRendererInterface" type="Magento\Review\Block\Product\ReviewRenderer" /> + <type name="Magento\Model\ActionValidator\RemoveAction"> + <arguments> + <argument name="protectedModels" xsi:type="array"> + <item name="review" xsi:type="string">Magento\Review\Model\Review</item> + </argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/Review/etc/module.xml b/app/code/Magento/Review/etc/module.xml index 9f86ed7ff62..27e24a63542 100644 --- a/app/code/Magento/Review/etc/module.xml +++ b/app/code/Magento/Review/etc/module.xml @@ -39,8 +39,6 @@ <module name="Magento_Backend"/> <module name="Magento_Tax"/> <module name="Magento_Newsletter"/> - <module name="Magento_Checkout"/> - <module name="Magento_Wishlist"/> </depends> </module> </config> diff --git a/app/code/Magento/Review/i18n/de_DE.csv b/app/code/Magento/Review/i18n/de_DE.csv index fd00ded0e34..a211543d41e 100644 --- a/app/code/Magento/Review/i18n/de_DE.csv +++ b/app/code/Magento/Review/i18n/de_DE.csv @@ -91,3 +91,13 @@ "Your Rating:","Ihre Bewertung:" "Your Review (submitted on %s):","Ihr Review (von % hinzugefügt)" "Your review has been accepted for moderation.","Ihr Review wurde für Moderation akzeptiert." +"An error occurred while deleting this review.","Beim Löschen dieser Rezension ist ein Fehler aufgetreten." +"An error occurred while saving this review.","Beim Speichern der Rezension ist ein Fehler aufgetreten." +"Product Reviews","Produktreviews" +"The review has been deleted","Diese Bewertung wurde gelöscht" +"The review has been saved.","Diese Bewertung wrude gespeichert." +"The review was removed by another user or does not exist.","Diese Bewertung wurde von einem anderen Benutzer entfernt oder existiert nicht." +"Pending Reviews RSS","Ausstehende Kundenmeinungen RSS" +"Products Reviews","Artikelbewertungen" +"Reviews","Bewertungen" +"Customers Reviews","Berichte der Kunden" diff --git a/app/code/Magento/Review/i18n/en_US.csv b/app/code/Magento/Review/i18n/en_US.csv index 367ef415570..bcd62bf78c7 100644 --- a/app/code/Magento/Review/i18n/en_US.csv +++ b/app/code/Magento/Review/i18n/en_US.csv @@ -92,3 +92,13 @@ "Your Rating:","Your Rating:" "Your Review (submitted on %s):","Your Review (submitted on %s):" "Your review has been accepted for moderation.","Your review has been accepted for moderation." +"An error occurred while deleting this review.","An error occurred while deleting this review." +"An error occurred while saving this review.","An error occurred while saving this review." +"The review has been deleted","The review has been deleted" +"The review has been saved.","The review has been saved." +"The review was removed by another user or does not exist.","The review was removed by another user or does not exist." +"Customers Reviews","Customers Reviews" +"Pending Reviews RSS","Pending Reviews RSS" +"Product Reviews","Product Reviews" +"Products Reviews","Products Reviews" +"Reviews","Reviews" diff --git a/app/code/Magento/Review/i18n/es_ES.csv b/app/code/Magento/Review/i18n/es_ES.csv index bbd0019f5c9..5c28b9230ae 100644 --- a/app/code/Magento/Review/i18n/es_ES.csv +++ b/app/code/Magento/Review/i18n/es_ES.csv @@ -91,3 +91,13 @@ "Your Rating:","Tu Valoración:" "Your Review (submitted on %s):","Tu Revisión (enviada en %s):" "Your review has been accepted for moderation.","Tu revisión se ha aceptado para ser moderada." +"An error occurred while deleting this review.","Se produjo un error al eliminar esta revisión." +"An error occurred while saving this review.","Se produjo un error al guardar esta revisión." +"The review has been deleted","Se eliminó la reseña" +"The review has been saved.","Se guardó la reseña." +"The review was removed by another user or does not exist.","La reseña no existe o fue eliminada por otro usuario." +"Customers Reviews","Revisiones Personalizadas" +"Pending Reviews RSS","RSS de reseñas pendientes" +"Product Reviews","Opiniones de Producto" +"Products Reviews","Opiniones de Productos" +"Reviews","Reseñas" diff --git a/app/code/Magento/Review/i18n/fr_FR.csv b/app/code/Magento/Review/i18n/fr_FR.csv index be523f8a103..ba54b3f3943 100644 --- a/app/code/Magento/Review/i18n/fr_FR.csv +++ b/app/code/Magento/Review/i18n/fr_FR.csv @@ -91,3 +91,13 @@ "Your Rating:","Votre évaluation :" "Your Review (submitted on %s):","Votre avis (envoyé le %s) :" "Your review has been accepted for moderation.","Votre avis a été accepté pour la modération." +"An error occurred while deleting this review.","Une erreur est survenue en effaçant ce commentaire" +"An error occurred while saving this review.","Une erreur est survenue en enregistrant ce commentaire" +"The review has been deleted","Le rapport a été supprimé" +"The review has been saved.","Le rapport a été enregistré." +"The review was removed by another user or does not exist.","Le rapport a été supprimé par un autre utilisateur ou n'existe pas." +"Customers Reviews","Avis des clients" +"Pending Reviews RSS","RSS des avis en attente" +"Product Reviews","Avis sur le produit" +"Products Reviews","Avis sur les produits" +"Reviews","Commentaires" diff --git a/app/code/Magento/Review/i18n/nl_NL.csv b/app/code/Magento/Review/i18n/nl_NL.csv index 9da9f411908..44dadffa9f0 100644 --- a/app/code/Magento/Review/i18n/nl_NL.csv +++ b/app/code/Magento/Review/i18n/nl_NL.csv @@ -91,3 +91,13 @@ "Your Rating:","Uw beoordeling:" "Your Review (submitted on %s):","Uw recensie (verzonden op %s):" "Your review has been accepted for moderation.","Uw beoordeling is geaccepteerd voor evaluatie." +"An error occurred while deleting this review.","Er is een fout opgetreden bij het verwijderen van deze recentie." +"An error occurred while saving this review.","Er is een fout opgetreden bij het opslaan van deze recensie." +"The review has been deleted","De beoordeling is verwijderd" +"The review has been saved.","De beoordeling is opgeslagen." +"The review was removed by another user or does not exist.","De beoordeling werd verwijderd door een andere gebruiker of bestaat niet." +"Customers Reviews","Klantenrecensies" +"Pending Reviews RSS","In Afwachting van Reviews RSS" +"Product Reviews","Productbeoordelingen" +"Products Reviews","Productrecensies" +"Reviews","Reviews" diff --git a/app/code/Magento/Review/i18n/pt_BR.csv b/app/code/Magento/Review/i18n/pt_BR.csv index ea1bf5212ac..f9714f20faa 100644 --- a/app/code/Magento/Review/i18n/pt_BR.csv +++ b/app/code/Magento/Review/i18n/pt_BR.csv @@ -91,3 +91,13 @@ "Your Rating:","Sua avaliação:" "Your Review (submitted on %s):","Sua revisão (enviada em %s):" "Your review has been accepted for moderation.","Sua avaliação foi aceita para moderação." +"An error occurred while deleting this review.","Ocorreu um erro ao excluir essa resenha." +"An error occurred while saving this review.","Ocorreu um erro ao salvar a resenha." +"The review has been deleted","A análise foi apagada" +"The review has been saved.","A análise foi salva." +"The review was removed by another user or does not exist.","A análise foi removida por outro usuário ou não existe." +"Customers Reviews","Análises dos clientes" +"Pending Reviews RSS","Comentários RSS Pendentes" +"Product Reviews","Comentários sobre Produto" +"Products Reviews","Comentários sobre Produtos" +"Reviews","Resenhas" diff --git a/app/code/Magento/Review/i18n/zh_CN.csv b/app/code/Magento/Review/i18n/zh_CN.csv index 57907575727..b42851ad102 100644 --- a/app/code/Magento/Review/i18n/zh_CN.csv +++ b/app/code/Magento/Review/i18n/zh_CN.csv @@ -91,3 +91,13 @@ "Your Rating:","您的评分:" "Your Review (submitted on %s):","您的评测(æäº¤äºŽ %s):" "Your review has been accepted for moderation.","您的评测已被管ç†å‘˜æ‰¹å‡†ã€‚" +"An error occurred while deleting this review.","åˆ é™¤è¯¥è¯„è®ºæ—¶å‡ºé”™ã€‚" +"An error occurred while saving this review.","ä¿å˜è¯¥è¯„论时出错。" +"The review has been deleted","è¯„è®ºå·²è¢«åˆ é™¤" +"The review has been saved.","评论已ä¿å˜ã€‚" +"The review was removed by another user or does not exist.","评论已被å¦ä¸€ç”¨æˆ·åˆ 除,或评论ä¸å˜åœ¨ã€‚" +"Customers Reviews","客户评测" +"Pending Reviews RSS","挂起评测RSS" +"Product Reviews","产å“评测" +"Products Reviews","产å“评论" +"Reviews","评测" diff --git a/app/code/Magento/Review/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/Review/view/adminhtml/layout/catalog_product_new.xml new file mode 100644 index 00000000000..860ec5d436e --- /dev/null +++ b/app/code/Magento/Review/view/adminhtml/layout/catalog_product_new.xml @@ -0,0 +1,43 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <referenceBlock name="product_tabs"> + <block class="Magento\Review\Block\Adminhtml\Product\Edit\Tab" name="product.reviews"> + <arguments> + <argument name="label" xsi:type="string" translate="true">Product Reviews</argument> + <argument name="url" xsi:type="url" path="review/product_reviews/grid"> + <param name="_current">1</param> + </argument> + <argument name="class" xsi:type="string">ajax</argument> + <argument name="group_code" xsi:type="string">advanced</argument> + </arguments> + </block> + <action method="addTab"> + <argument name="name" xsi:type="string">product-reviews</argument> + <argument name="block" xsi:type="string">product.reviews</argument> + </action> + </referenceBlock> +</layout> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_review_edit.xml b/app/code/Magento/Review/view/adminhtml/layout/review_product_edit.xml similarity index 95% rename from app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_review_edit.xml rename to app/code/Magento/Review/view/adminhtml/layout/review_product_edit.xml index 302f3a241b8..bb5469701a5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_review_edit.xml +++ b/app/code/Magento/Review/view/adminhtml/layout/review_product_edit.xml @@ -24,5 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> - <update handle="catalog_product_review_new"/> + <update handle="review_product_new"/> </layout> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_review_new.xml b/app/code/Magento/Review/view/adminhtml/layout/review_product_new.xml similarity index 100% rename from app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_review_new.xml rename to app/code/Magento/Review/view/adminhtml/layout/review_product_new.xml diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reviews.xml b/app/code/Magento/Review/view/adminhtml/layout/review_product_reviews_grid.xml similarity index 91% rename from app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reviews.xml rename to app/code/Magento/Review/view/adminhtml/layout/review_product_reviews_grid.xml index ef4fbea621e..3ddc307e087 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reviews.xml +++ b/app/code/Magento/Review/view/adminhtml/layout/review_product_reviews_grid.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <container name="root" label="Root" output="1"> - <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Reviews" name="admin.product.reviews"/> + <block class="Magento\Review\Block\Adminhtml\Product\Edit\Tab\Reviews" name="admin.product.reviews"/> </container> </layout> diff --git a/app/code/Magento/Rss/Block/Catalog/NewCatalog.php b/app/code/Magento/Rss/Block/Catalog/NewCatalog.php index fed6b85d025..3215e9cc64e 100644 --- a/app/code/Magento/Rss/Block/Catalog/NewCatalog.php +++ b/app/code/Magento/Rss/Block/Catalog/NewCatalog.php @@ -46,7 +46,7 @@ class NewCatalog extends \Magento\Rss\Block\Catalog\AbstractCatalog protected $_visibility; /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_resourceIterator; @@ -62,7 +62,7 @@ class NewCatalog extends \Magento\Rss\Block\Catalog\AbstractCatalog * @param \Magento\Rss\Model\RssFactory $rssFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Product\Visibility $visibility - * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Model\Resource\Iterator $resourceIterator * @param \Magento\Catalog\Helper\Image $imageHelper * @param array $data */ @@ -73,7 +73,7 @@ class NewCatalog extends \Magento\Rss\Block\Catalog\AbstractCatalog \Magento\Rss\Model\RssFactory $rssFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Product\Visibility $visibility, - \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Model\Resource\Iterator $resourceIterator, \Magento\Catalog\Helper\Image $imageHelper, array $data = array() ) { diff --git a/app/code/Magento/Rss/Block/Catalog/NotifyStock.php b/app/code/Magento/Rss/Block/Catalog/NotifyStock.php index f55d7a3a3bf..3f1fa556ab2 100644 --- a/app/code/Magento/Rss/Block/Catalog/NotifyStock.php +++ b/app/code/Magento/Rss/Block/Catalog/NotifyStock.php @@ -51,7 +51,7 @@ class NotifyStock extends \Magento\Backend\Block\AbstractBlock protected $_productStatus; /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_resourceIterator; @@ -61,7 +61,7 @@ class NotifyStock extends \Magento\Backend\Block\AbstractBlock * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\CatalogInventory\Model\Resource\StockFactory $stockFactory * @param \Magento\Catalog\Model\Product\Attribute\Source\Status $productStatus - * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Model\Resource\Iterator $resourceIterator * @param array $data */ public function __construct( @@ -70,7 +70,7 @@ class NotifyStock extends \Magento\Backend\Block\AbstractBlock \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\CatalogInventory\Model\Resource\StockFactory $stockFactory, \Magento\Catalog\Model\Product\Attribute\Source\Status $productStatus, - \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Model\Resource\Iterator $resourceIterator, array $data = array() ) { $this->_rssFactory = $rssFactory; diff --git a/app/code/Magento/Rss/Block/Catalog/Review.php b/app/code/Magento/Rss/Block/Catalog/Review.php index 25652152032..6cfe4d18b44 100644 --- a/app/code/Magento/Rss/Block/Catalog/Review.php +++ b/app/code/Magento/Rss/Block/Catalog/Review.php @@ -36,7 +36,7 @@ class Review extends \Magento\Backend\Block\AbstractBlock protected $_rssFactory; /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_resourceIterator; @@ -53,7 +53,7 @@ class Review extends \Magento\Backend\Block\AbstractBlock /** * @param \Magento\Backend\Block\Context $context * @param \Magento\Rss\Model\RssFactory $rssFactory - * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Model\Resource\Iterator $resourceIterator * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param array $data @@ -61,7 +61,7 @@ class Review extends \Magento\Backend\Block\AbstractBlock public function __construct( \Magento\Backend\Block\Context $context, \Magento\Rss\Model\RssFactory $rssFactory, - \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Model\Resource\Iterator $resourceIterator, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, array $data = array() @@ -127,7 +127,7 @@ class Review extends \Magento\Backend\Block\AbstractBlock array('id' => $row['entity_id']) ); $reviewUrl = $this->getUrl( - 'catalog/product_review/edit/', + 'review/product/edit/', array('id' => $row['review_id'], '_secure' => true, '_nosecret' => true) ); $storeName = $this->_storeManager->getStore($row['store_id'])->getName(); diff --git a/app/code/Magento/Rss/Block/Catalog/Special.php b/app/code/Magento/Rss/Block/Catalog/Special.php index 14dddb18856..fcd0c1671a7 100644 --- a/app/code/Magento/Rss/Block/Catalog/Special.php +++ b/app/code/Magento/Rss/Block/Catalog/Special.php @@ -48,7 +48,7 @@ class Special extends \Magento\Rss\Block\Catalog\AbstractCatalog protected $_rssFactory; /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_resourceIterator; @@ -74,7 +74,7 @@ class Special extends \Magento\Rss\Block\Catalog\AbstractCatalog * @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\Model\Resource\Iterator $resourceIterator * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Catalog\Helper\Output $outputHelper * @param array $data @@ -86,7 +86,7 @@ class Special extends \Magento\Rss\Block\Catalog\AbstractCatalog \Magento\Core\Helper\Data $coreData, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Rss\Model\RssFactory $rssFactory, - \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Model\Resource\Iterator $resourceIterator, \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Helper\Output $outputHelper, array $data = array() diff --git a/app/code/Magento/Rss/Block/Order/NewOrder.php b/app/code/Magento/Rss/Block/Order/NewOrder.php index 9b5ccdc4720..93462621280 100644 --- a/app/code/Magento/Rss/Block/Order/NewOrder.php +++ b/app/code/Magento/Rss/Block/Order/NewOrder.php @@ -41,7 +41,7 @@ class NewOrder extends \Magento\Backend\Block\AbstractBlock protected $_orderFactory; /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_resourceIterator; @@ -54,7 +54,7 @@ class NewOrder extends \Magento\Backend\Block\AbstractBlock * @param \Magento\Backend\Block\Context $context * @param \Magento\Rss\Model\RssFactory $rssFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Model\Resource\Iterator $resourceIterator * @param \Magento\Stdlib\DateTime $dateTime * @param array $data */ @@ -62,7 +62,7 @@ class NewOrder extends \Magento\Backend\Block\AbstractBlock \Magento\Backend\Block\Context $context, \Magento\Rss\Model\RssFactory $rssFactory, \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Model\Resource\Iterator $resourceIterator, \Magento\Stdlib\DateTime $dateTime, array $data = array() ) { diff --git a/app/code/Magento/Rss/Block/Wishlist.php b/app/code/Magento/Rss/Block/Wishlist.php index c423881132f..e9111f755be 100644 --- a/app/code/Magento/Rss/Block/Wishlist.php +++ b/app/code/Magento/Rss/Block/Wishlist.php @@ -34,13 +34,6 @@ namespace Magento\Rss\Block; */ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock { - /** - * Customer instance - * - * @var \Magento\Customer\Model\Customer - */ - protected $_customer; - /** * Default MAP renderer type * @@ -53,11 +46,6 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock */ protected $_wishlistFactory; - /** - * @var \Magento\Customer\Model\CustomerFactory - */ - protected $_customerFactory; - /** * @var \Magento\Rss\Model\RssFactory */ @@ -74,46 +62,22 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock protected $_outputHelper; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\App\Http\Context $httpContext * @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 * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\App\Http\Context $httpContext, \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(), @@ -122,20 +86,9 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $this->_outputHelper = $outputHelper; $this->_coreData = $coreData; $this->_wishlistFactory = $wishlistFactory; - $this->_customerFactory = $customerFactory; $this->_rssFactory = $rssFactory; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $httpContext, $productFactory, $data, @@ -151,41 +104,13 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock protected function _getWishlist() { if (is_null($this->_wishlist)) { - $this->_wishlist = $this->_wishlistFactory->create(); - $wishlistId = $this->getRequest()->getParam('wishlist_id'); - if ($wishlistId) { - $this->_wishlist->load($wishlistId); - if ($this->_wishlist->getCustomerId() != $this->_getCustomer()->getId()) { - $this->_wishlist->unsetData(); - } - } else { - if ($this->_getCustomer()->getId()) { - $this->_wishlist->loadByCustomer($this->_getCustomer()); - } + $this->_wishlist = parent::_getWishlist(); + if ($this->_wishlist->getCustomerId() != $this->_getHelper()->getCustomer()->getId()) { + $this->_wishlist->unsetData(); } } - return $this->_wishlist; - } - - /** - * Retrieve Customer instance - * - * @return \Magento\Customer\Model\Customer - */ - protected function _getCustomer() - { - if (is_null($this->_customer)) { - $this->_customer = $this->_customerFactory->create(); - $params = $this->_coreData->urlDecode($this->getRequest()->getParam('data')); - $data = explode(',', $params); - $cId = abs(intval($data[0])); - if ($cId && ($cId == $this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_AUTH))) { - $this->_customer->load($cId); - } - } - - return $this->_customer; + return $this->_wishlist; } /** @@ -195,7 +120,7 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock */ protected function _getTitle() { - return __('%1\'s Wishlist', $this->_getCustomer()->getName()); + return __('%1\'s Wishlist', $this->_getHelper()->getCustomerName()); } /** diff --git a/app/code/Magento/Rss/Controller/Index.php b/app/code/Magento/Rss/Controller/Index.php index 8cc7819786d..6192cdb4c84 100644 --- a/app/code/Magento/Rss/Controller/Index.php +++ b/app/code/Magento/Rss/Controller/Index.php @@ -30,31 +30,35 @@ use Magento\App\Action\NotFoundException; class Index extends \Magento\App\Action\Action { /** - * Current wishlist - * - * @var \Magento\Wishlist\Model\Wishlist + * @var \Magento\Core\Model\Store\Config */ - protected $_wishlist; + protected $_storeConfig; /** - * Current customer - * - * @var \Magento\Customer\Model\Customer + * @var \Magento\Rss\Helper\WishlistRss */ - protected $_customer; + protected $_wishlistHelper; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\Customer\Model\Session */ - protected $_storeConfig; + protected $_customerSession; /** * @param \Magento\App\Action\Context $context * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\Rss\Helper\WishlistRss $wishlistHelper + * @param \Magento\Customer\Model\Session $customerSession */ - public function __construct(\Magento\App\Action\Context $context, \Magento\Core\Model\Store\Config $storeConfig) - { + public function __construct( + \Magento\App\Action\Context $context, + \Magento\Core\Model\Store\Config $storeConfig, + \Magento\Rss\Helper\WishlistRss $wishlistHelper, + \Magento\Customer\Model\Session $customerSession + ) { $this->_storeConfig = $storeConfig; + $this->_wishlistHelper = $wishlistHelper; + $this->_customerSession = $customerSession; parent::__construct($context); } @@ -104,12 +108,10 @@ class Index extends \Magento\App\Action\Action public function wishlistAction() { if ($this->_storeConfig->getConfig('rss/wishlist/active')) { - $wishlist = $this->_getWishlist(); - if ($wishlist && ($wishlist->getVisibility() || $this->_objectManager->get( - 'Magento\Customer\Model\Session' - )->authenticate( - $this - ) && $wishlist->getCustomerId() == $this->_getCustomer()->getId()) + $wishlist = $this->_wishlistHelper->getWishlist(); + if ($wishlist && ($wishlist->getVisibility() + || $this->_customerSession->authenticate($this) + && $wishlist->getCustomerId() == $this->_wishlistHelper->getCustomer()->getId()) ) { $this->getResponse()->setHeader('Content-Type', 'text/xml; charset=UTF-8'); $this->_view->loadLayout(false); @@ -119,51 +121,4 @@ class Index extends \Magento\App\Action\Action } $this->nofeedAction(); } - - /** - * Retrieve Wishlist model - * - * @return \Magento\Wishlist\Model\Wishlist - */ - protected function _getWishlist() - { - if (is_null($this->_wishlist)) { - $this->_wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist'); - $wishlistId = $this->getRequest()->getParam('wishlist_id'); - if ($wishlistId) { - $this->_wishlist->load($wishlistId); - } else { - if ($this->_getCustomer()->getId()) { - $this->_wishlist->loadByCustomer($this->_getCustomer()); - } - } - } - return $this->_wishlist; - } - - /** - * Retrieve Customer instance - * - * @return \Magento\Customer\Model\Customer - */ - protected function _getCustomer() - { - if (is_null($this->_customer)) { - $this->_customer = $this->_objectManager->create('Magento\Customer\Model\Customer'); - $params = $this->_objectManager->get( - 'Magento\Core\Helper\Data' - )->urlDecode( - $this->getRequest()->getParam('data') - ); - $data = explode(',', $params); - $customerId = abs(intval($data[0])); - if ($customerId && $customerId == $this->_objectManager->get( - 'Magento\Customer\Model\Session' - )->getCustomerId() - ) { - $this->_customer->load($customerId); - } - } - return $this->_customer; - } } diff --git a/app/code/Magento/Rss/Helper/WishlistRss.php b/app/code/Magento/Rss/Helper/WishlistRss.php new file mode 100644 index 00000000000..e1482ca9db8 --- /dev/null +++ b/app/code/Magento/Rss/Helper/WishlistRss.php @@ -0,0 +1,158 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Rss\Helper; + +class WishlistRss extends \Magento\Wishlist\Helper\Data +{ + /** + * @var \Magento\Customer\Service\V1\Data\Customer + */ + protected $_customer; + + /** + * @var \Magento\Customer\Service\V1\Data\CustomerBuilder + */ + protected $_customerBuilder; + + /** + * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface + */ + protected $_customerAccountService; + + /** + * @var \Magento\Customer\Helper\View + */ + protected $_customerViewHelper; + + /** + * @param \Magento\App\Helper\Context $context + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Registry $coreRegistry + * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Wishlist\Model\WishlistFactory $wishlistFactory + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\Helper\PostData $postDataHelper + * @param \Magento\Customer\Helper\View $customerViewHelper + * @param \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder + * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService + */ + public function __construct( + \Magento\App\Helper\Context $context, + \Magento\Core\Helper\Data $coreData, + \Magento\Registry $coreRegistry, + \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Customer\Model\Session $customerSession, + \Magento\Wishlist\Model\WishlistFactory $wishlistFactory, + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\Helper\PostData $postDataHelper, + \Magento\Customer\Helper\View $customerViewHelper, + \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder, + \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService + ) { + $this->_customerViewHelper = $customerViewHelper; + $this->_customerBuilder = $customerBuilder; + $this->_customerAccountService = $customerAccountService; + + parent::__construct( + $context, + $coreData, + $coreRegistry, + $coreStoreConfig, + $customerSession, + $wishlistFactory, + $storeManager, + $postDataHelper + ); + } + + /** + * Retrieve Wishlist model + * + * @return \Magento\Wishlist\Model\Wishlist + */ + public function getWishlist() + { + if (is_null($this->_wishlist)) { + $this->_wishlist = $this->_wishlistFactory->create(); + + $wishlistId = $this->_getRequest()->getParam('wishlist_id'); + if ($wishlistId) { + $this->_wishlist->load($wishlistId); + } else { + if ($this->getCustomer()->getId()) { + $this->_wishlist->loadByCustomerId($this->getCustomer()->getId()); + } + } + } + return $this->_wishlist; + } + + /** + * Retrieve Customer instance + * + * @return \Magento\Customer\Service\V1\Data\Customer + */ + public function getCustomer() + { + if (is_null($this->_customer)) { + $this->_customer = $this->_customerBuilder->create(); + + $params = $this->_coreData->urlDecode($this->_getRequest()->getParam('data')); + $data = explode(',', $params); + $cId = abs(intval($data[0])); + if ($cId && ($cId == $this->_customerSession->getCustomerId())) { + $this->_customer = $this->_customerSession->getCustomerDataObject(); + } + } + + return $this->_customer; + } + + /** + * Set current customer + * + * @param \Magento\Customer\Model\Customer $customer + * @return void + */ + public function setCustomer(\Magento\Customer\Model\Customer $customer) + { + /* TODO this method must be eliminated after refactoring of Magento\Wishlist\Helper\Data */ + $this->_customer = $this->_customerAccountService->getCustomer($customer->getId()); + } + + /** + * Retrieve customer name + * + * @return string|void + */ + public function getCustomerName() + { + /* TODO this method must be eliminated after refactoring of Magento\Wishlist\Helper\Data */ + return $this->getCustomer() + ? $this->_customerViewHelper->getCustomerName($this->getCustomer()) + : null; + } +} diff --git a/app/code/Magento/Rss/Model/System/Config/Backend/Links.php b/app/code/Magento/Rss/Model/System/Config/Backend/Links.php index 17aa62d2a90..ae9e2fe2b52 100644 --- a/app/code/Magento/Rss/Model/System/Config/Backend/Links.php +++ b/app/code/Magento/Rss/Model/System/Config/Backend/Links.php @@ -42,7 +42,7 @@ class Links extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\App\Cache\TypeListInterface $cacheTypeList - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -52,7 +52,7 @@ class Links extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\App\Cache\TypeListInterface $cacheTypeList, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Rss/etc/di.xml b/app/code/Magento/Rss/etc/di.xml new file mode 100644 index 00000000000..02f7ed6ff5b --- /dev/null +++ b/app/code/Magento/Rss/etc/di.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <virtualType name="Magento\Rss\Block\Context" type="Magento\Catalog\Block\Product\Context"> + <arguments> + <argument name="wishlistHelper" xsi:type="object">Magento\Rss\Helper\WishlistRss</argument> + </arguments> + </virtualType> + <type name="Magento\Rss\Block\Wishlist"> + <arguments> + <argument name="context" xsi:type="object">Magento\Rss\Block\Context</argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/Rss/etc/module.xml b/app/code/Magento/Rss/etc/module.xml index b9e2def7231..774ccf502fc 100644 --- a/app/code/Magento/Rss/etc/module.xml +++ b/app/code/Magento/Rss/etc/module.xml @@ -36,7 +36,6 @@ </sequence> <depends> <module name="Magento_Catalog"/> - <module name="Magento_Tax"/> <module name="Magento_CatalogInventory"/> <module name="Magento_Sales"/> <module name="Magento_SalesRule"/> @@ -46,8 +45,6 @@ <module name="Magento_Customer"/> <module name="Magento_Backend"/> <module name="Magento_GiftMessage"/> - <module name="Magento_Checkout"/> - <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Rule/Block/Editable.php b/app/code/Magento/Rule/Block/Editable.php index a8483602bfc..c7bc0ec4c66 100644 --- a/app/code/Magento/Rule/Block/Editable.php +++ b/app/code/Magento/Rule/Block/Editable.php @@ -30,6 +30,25 @@ use Magento\View\Element\AbstractBlock; class Editable extends AbstractBlock implements RendererInterface { + /** + * @var \Magento\Translate\InlineInterface + */ + protected $inlineTranslate; + + /** + * @param \Magento\View\Element\Context $context + * @param \Magento\Translate\InlineInterface $inlineTranslate + * @param array $data + */ + public function __construct( + \Magento\View\Element\Context $context, + \Magento\Translate\InlineInterface $inlineTranslate, + array $data = array() + ) { + $this->inlineTranslate = $inlineTranslate; + parent::__construct($context, $data); + } + /** * Render element * @@ -66,7 +85,7 @@ class Editable extends AbstractBlock implements RendererInterface '>' . '<a href="javascript:void(0)" class="label">'; - if ($this->_translator->isAllowed()) { + if ($this->inlineTranslate->isAllowed()) { $html .= $this->escapeHtml($valueName); } else { $html .= $this->escapeHtml( diff --git a/app/code/Magento/Rule/Model/AbstractModel.php b/app/code/Magento/Rule/Model/AbstractModel.php index 7f1c63d3eb7..9bc2dfc83ea 100644 --- a/app/code/Magento/Rule/Model/AbstractModel.php +++ b/app/code/Magento/Rule/Model/AbstractModel.php @@ -29,9 +29,9 @@ */ namespace Magento\Rule\Model; -use Magento\Core\Exception; +use Magento\Model\Exception; -abstract class AbstractModel extends \Magento\Core\Model\AbstractModel +abstract class AbstractModel extends \Magento\Model\AbstractModel { /** * Store rule combine conditions model @@ -97,7 +97,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -106,7 +106,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Rule/Model/Resource/AbstractResource.php b/app/code/Magento/Rule/Model/Resource/AbstractResource.php index ed4a7ecdb8b..4f40d7c8001 100644 --- a/app/code/Magento/Rule/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Rule/Model/Resource/AbstractResource.php @@ -33,7 +33,7 @@ */ namespace Magento\Rule\Model\Resource; -abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractResource extends \Magento\Model\Resource\Db\AbstractDb { /** * Store associated with rule entities information map @@ -60,10 +60,10 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Prepare rule's active "from" and "to" dates * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function _beforeSave(\Magento\Core\Model\AbstractModel $object) + public function _beforeSave(\Magento\Model\AbstractModel $object) { $fromDate = $object->getFromDate(); if ($fromDate instanceof \Zend_Date) { @@ -241,7 +241,7 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract * * @param string $entityType * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getAssociatedEntityInfo($entityType) { @@ -249,7 +249,7 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract return $this->_associatedEntitiesMap[$entityType]; } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('There is no information about associated entity type "%1".', $entityType), 0 ); diff --git a/app/code/Magento/Rule/Model/Resource/Rule/Collection/AbstractCollection.php b/app/code/Magento/Rule/Model/Resource/Rule/Collection/AbstractCollection.php index eb35698a09c..d084d1e7fac 100644 --- a/app/code/Magento/Rule/Model/Resource/Rule/Collection/AbstractCollection.php +++ b/app/code/Magento/Rule/Model/Resource/Rule/Collection/AbstractCollection.php @@ -33,7 +33,7 @@ */ namespace Magento\Rule\Model\Resource\Rule\Collection; -abstract class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +abstract class AbstractCollection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store associated with rule entities information map @@ -165,7 +165,7 @@ abstract class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collec * * @param string $entityType * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return array */ protected function _getAssociatedEntityInfo($entityType) @@ -174,7 +174,7 @@ abstract class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collec return $this->_associatedEntitiesMap[$entityType]; } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('There is no information about associated entity type "%1".', $entityType), 0 ); diff --git a/app/code/Magento/Rule/Model/Rule.php b/app/code/Magento/Rule/Model/Rule.php index e6b521573f0..5f481782b72 100644 --- a/app/code/Magento/Rule/Model/Rule.php +++ b/app/code/Magento/Rule/Model/Rule.php @@ -54,7 +54,7 @@ class Rule extends AbstractModel * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Rule\Model\Condition\CombineFactory $conditionsFactory * @param \Magento\Rule\Model\Action\CollectionFactory $actionsFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -65,7 +65,7 @@ class Rule extends AbstractModel \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Rule\Model\Condition\CombineFactory $conditionsFactory, \Magento\Rule\Model\Action\CollectionFactory $actionsFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php b/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php index 965c94c12ba..3bff3d51549 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php @@ -215,7 +215,7 @@ class AbstractItems extends \Magento\Backend\Block\Template /** * Retrieve available order * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return Order */ public function getOrder() @@ -239,7 +239,7 @@ class AbstractItems extends \Magento\Backend\Block\Template return $this->getItem()->getOrder(); } - throw new \Magento\Core\Exception(__('We cannot get the order instance.')); + throw new \Magento\Model\Exception(__('We cannot get the order instance.')); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php b/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php index 8f2d9ae6c6e..e466a423384 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php @@ -71,7 +71,7 @@ class AbstractOrder extends \Magento\Backend\Block\Widget * Retrieve available order * * @return Order - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getOrder() { @@ -84,7 +84,7 @@ class AbstractOrder extends \Magento\Backend\Block\Widget if ($this->_coreRegistry->registry('order')) { return $this->_coreRegistry->registry('order'); } - throw new \Magento\Core\Exception(__('We cannot get the order instance.')); + throw new \Magento\Model\Exception(__('We cannot get the order instance.')); } /** 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 14d45c7a377..6dde7fa2bc1 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php @@ -59,12 +59,12 @@ class View extends \Magento\Backend\Block\Template * Retrieve required options from parent * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeToHtml() { if (!$this->getParentBlock()) { - throw new \Magento\Core\Exception(__('Please correct the parent block for this block.')); + throw new \Magento\Model\Exception(__('Please correct the parent block for this block.')); } $this->setEntity($this->getParentBlock()->getSource()); parent::_beforeToHtml(); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Payment.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Payment.php index 9f04c0b7776..5bf0e5b9506 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Payment.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Payment.php @@ -61,12 +61,12 @@ class Payment extends \Magento\Backend\Block\Template * Retrieve required options from parent * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeToHtml() { if (!$this->getParentBlock()) { - throw new \Magento\Core\Exception(__('Invalid parent block for this block')); + throw new \Magento\Model\Exception(__('Invalid parent block for this block')); } $this->setPayment($this->getParentBlock()->getOrder()->getPayment()); parent::_beforeToHtml(); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Totalbar.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Totalbar.php index c0c0a375b6e..1c0d0cb5ee6 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Totalbar.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Totalbar.php @@ -45,12 +45,12 @@ class Totalbar extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder * Retrieve required options from parent * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeToHtml() { if (!$this->getParentBlock()) { - throw new \Magento\Core\Exception(__('Please correct the parent block for this block.')); + throw new \Magento\Model\Exception(__('Please correct the parent block for this block.')); } $this->setOrder($this->getParentBlock()->getOrder()); $this->setSource($this->getParentBlock()->getSource()); 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 00025662678..b77f9d95a7b 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php @@ -84,7 +84,7 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder protected function _beforeToHtml() { if (!$this->getParentBlock()) { - throw new \Magento\Core\Exception(__('Please correct the parent block for this block.')); + throw new \Magento\Model\Exception(__('Please correct the parent block for this block.')); } $this->setOrder($this->getParentBlock()->getOrder()); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items.php index fbae5008403..546cae95121 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items.php @@ -40,12 +40,12 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems * Retrieve required options from parent * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeToHtml() { if (!$this->getParentBlock()) { - throw new \Magento\Core\Exception(__('Invalid parent block for this block')); + throw new \Magento\Model\Exception(__('Invalid parent block for this block')); } $this->setOrder($this->getParentBlock()->getOrder()); parent::_beforeToHtml(); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tabs.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tabs.php index f4e120ad35b..50e1d91b0dd 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tabs.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tabs.php @@ -59,7 +59,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs * Retrieve available order * * @return \Magento\Sales\Model\Order - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getOrder() { @@ -72,7 +72,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs if ($this->_coreRegistry->registry('order')) { return $this->_coreRegistry->registry('order'); } - throw new \Magento\Core\Exception(__('We cannot get the order instance.')); + throw new \Magento\Model\Exception(__('We cannot get the order instance.')); } /** diff --git a/app/code/Magento/Sales/Block/Order/Comments.php b/app/code/Magento/Sales/Block/Order/Comments.php index 9b2de31ac6d..e0758c0f678 100644 --- a/app/code/Magento/Sales/Block/Order/Comments.php +++ b/app/code/Magento/Sales/Block/Order/Comments.php @@ -104,7 +104,7 @@ class Comments extends \Magento\View\Element\Template * Initialize model comments and return comment collection * * @return \Magento\Sales\Model\Resource\Order\Comment\Collection\AbstractCollection - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getComments() { @@ -117,7 +117,7 @@ class Comments extends \Magento\View\Element\Template } else if ($entity instanceof \Magento\Sales\Model\Order\Shipment) { $this->_commentCollection = $this->_shipmentCollectionFactory->create(); } else { - throw new \Magento\Core\Exception(__('We found an invalid entity model.')); + throw new \Magento\Model\Exception(__('We found an invalid entity model.')); } $this->_commentCollection->setParentFilter($entity)->setCreatedAtOrder()->addVisibleOnFrontFilter(); diff --git a/app/code/Magento/Sales/Controller/AbstractController.php b/app/code/Magento/Sales/Controller/AbstractController.php index 9ab3515718b..414c185b3f5 100644 --- a/app/code/Magento/Sales/Controller/AbstractController.php +++ b/app/code/Magento/Sales/Controller/AbstractController.php @@ -174,7 +174,7 @@ abstract class AbstractController extends \Magento\App\Action\Action foreach ($items as $item) { try { $cart->addOrderItem($item); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($this->_objectManager->get('Magento\Checkout\Model\Session')->getUseNotice(true)) { $this->messageManager->addNotice($e->getMessage()); } else { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order.php b/app/code/Magento/Sales/Controller/Adminhtml/Order.php index 6e3b72af35a..d6d3ef3eff4 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order.php @@ -193,7 +193,7 @@ class Order extends \Magento\Backend\App\Action $historyItem->save(); } $this->messageManager->addSuccess(__('You sent the order email.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We couldn\'t send the email order.')); @@ -215,7 +215,7 @@ class Order extends \Magento\Backend\App\Action try { $order->cancel()->save(); $this->messageManager->addSuccess(__('You canceled the order.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('You have not canceled the item.')); @@ -237,7 +237,7 @@ class Order extends \Magento\Backend\App\Action try { $order->hold()->save(); $this->messageManager->addSuccess(__('You put the order on hold.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('You have not put the order on hold.')); @@ -258,7 +258,7 @@ class Order extends \Magento\Backend\App\Action try { $order->unhold()->save(); $this->messageManager->addSuccess(__('You released the order from holding status.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('The order was not on hold.')); @@ -303,7 +303,7 @@ class Order extends \Magento\Backend\App\Action } $order->save(); $this->messageManager->addSuccess($message); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We couldn\'t update the payment.')); @@ -325,7 +325,7 @@ class Order extends \Magento\Backend\App\Action $response = false; $data = $this->getRequest()->getPost('history'); if (empty($data['comment']) && $data['status'] == $order->getDataByKey('status')) { - throw new \Magento\Core\Exception(__('Comment text cannot be empty.')); + throw new \Magento\Model\Exception(__('Comment text cannot be empty.')); } $notify = isset($data['is_customer_notified']) ? $data['is_customer_notified'] : false; @@ -343,7 +343,7 @@ class Order extends \Magento\Backend\App\Action $this->_view->loadLayout('empty'); $this->_view->renderLayout(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $response = array('error' => true, 'message' => __('We cannot add order history.')); @@ -404,12 +404,13 @@ class Order extends \Magento\Backend\App\Action public function commentsHistoryAction() { $this->_initOrder(); + $html = $this->_view->getLayout()->createBlock( 'Magento\Sales\Block\Adminhtml\Order\View\Tab\History' )->toHtml(); - if ($this->_translateInline->isAllowed()) { - $this->_translateInline->processResponseBody($html); - } + + $this->_translateInline->processResponseBody($html); + $this->getResponse()->setBody($html); } @@ -806,7 +807,7 @@ class Order extends \Magento\Backend\App\Action $order->getPayment()->void(new \Magento\Object()); // workaround for backwards compatibility $order->save(); $this->messageManager->addSuccess(__('The payment has been voided.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We couldn\'t void the payment.')); @@ -944,7 +945,7 @@ class Order extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You updated the order address.')); $this->_redirect('sales/*/view', array('order_id' => $address->getParentId())); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $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 72cc8b8e9e0..21a9e334b12 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php @@ -391,7 +391,7 @@ class Create extends \Magento\Backend\App\Action $request = $this->getRequest(); try { $this->_initSession()->_processData(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_reloadQuote(); $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { @@ -530,7 +530,7 @@ class Create extends \Magento\Backend\App\Action $this->messageManager->addError($message); } $this->_redirect('sales/*/'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $message = $e->getMessage(); if (!empty($message)) { $this->messageManager->addError($message); @@ -618,12 +618,12 @@ class Create extends \Magento\Backend\App\Action try { $quoteItemId = (int)$this->getRequest()->getParam('id'); if (!$quoteItemId) { - throw new \Magento\Core\Exception(__('Quote item id is not received.')); + throw new \Magento\Model\Exception(__('Quote item id is not received.')); } $quoteItem = $this->_objectManager->create('Magento\Sales\Model\Quote\Item')->load($quoteItemId); if (!$quoteItem->getId()) { - throw new \Magento\Core\Exception(__('Quote item is not loaded.')); + throw new \Magento\Model\Exception(__('Quote item is not loaded.')); } $configureResult->setOk(true); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php index 5a38afab997..853b135d7d9 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php @@ -189,7 +189,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract protected function _saveCreditmemo($creditmemo) { $transactionSave = $this->_objectManager->create( - 'Magento\Core\Model\Resource\Transaction' + 'Magento\DB\Transaction' )->addObject( $creditmemo )->addObject( @@ -281,7 +281,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $creditmemo = $this->_initCreditmemo(true); $this->_view->loadLayout(); $response = $this->_view->getLayout()->getBlock('order_items')->toHtml(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); $response = $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response); } catch (\Exception $e) { @@ -307,7 +307,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $creditmemo = $this->_initCreditmemo(); if ($creditmemo) { if ($creditmemo->getGrandTotal() <= 0 && !$creditmemo->getAllowZeroGrandTotal()) { - throw new \Magento\Core\Exception(__('Credit memo\'s total must be positive.')); + throw new \Magento\Model\Exception(__('Credit memo\'s total must be positive.')); } $comment = ''; @@ -328,7 +328,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract if (isset($data['do_offline'])) { //do not allow online refund for Refund to Store Credit if (!$data['do_offline'] && !empty($data['refund_customerbalance_return_enable'])) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Cannot create online refund for Refund to Store Credit.') ); } @@ -351,7 +351,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $this->_forward('noroute'); return; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_getSession()->setFormData($data); } catch (\Exception $e) { @@ -374,7 +374,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $creditmemo->cancel(); $this->_saveCreditmemo($creditmemo); $this->messageManager->addSuccess(__('The credit memo has been canceled.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('You canceled the credit memo.')); @@ -398,7 +398,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $creditmemo->void(); $this->_saveCreditmemo($creditmemo); $this->messageManager->addSuccess(__('You voided the credit memo.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t void the credit memo.')); @@ -420,7 +420,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $this->getRequest()->setParam('creditmemo_id', $this->getRequest()->getParam('id')); $data = $this->getRequest()->getPost('comment'); if (empty($data['comment'])) { - throw new \Magento\Core\Exception(__('The Comment Text field cannot be empty.')); + throw new \Magento\Model\Exception(__('The Comment Text field cannot be empty.')); } $creditmemo = $this->_initCreditmemo(); $comment = $creditmemo->addComment( @@ -433,7 +433,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $this->_view->loadLayout(); $response = $this->_view->getLayout()->getBlock('creditmemo_comments')->toHtml(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); $response = $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response); } catch (\Exception $e) { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Edit.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Edit.php index e8e75d82471..7dade411b17 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Edit.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Edit.php @@ -53,7 +53,7 @@ class Edit extends \Magento\Sales\Controller\Adminhtml\Order\Create } else { $this->_redirect('sales/order/'); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('sales/order/view', array('order_id' => $orderId)); } catch (\Exception $e) { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php index cafabffeb01..ad7039a40c6 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php @@ -25,7 +25,7 @@ */ namespace Magento\Sales\Controller\Adminhtml\Order; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\App\ResponseInterface; /** @@ -141,7 +141,7 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic { $invoice->getOrder()->setIsInProcess(true); $this->_objectManager->create( - 'Magento\Core\Model\Resource\Transaction' + 'Magento\DB\Transaction' )->addObject( $invoice )->addObject( @@ -311,7 +311,7 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic $invoice->getOrder()->setIsInProcess(true); $transactionSave = $this->_objectManager->create( - 'Magento\Core\Model\Resource\Transaction' + 'Magento\DB\Transaction' )->addObject( $invoice )->addObject( diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php index 05f35dca12f..388e532cf3c 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php @@ -160,7 +160,7 @@ class Status extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You have saved the order status.')); $this->_redirect('sales/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -211,7 +211,7 @@ class Status extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You have assigned the order status.')); $this->_redirect('sales/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -239,7 +239,7 @@ class Status extends \Magento\Backend\App\Action try { $status->unassignState($state); $this->messageManager->addSuccess(__('You have unassigned the order status.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( 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 77628119757..6866b1c135d 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/View/Giftmessage.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/View/Giftmessage.php @@ -43,7 +43,7 @@ class Giftmessage extends \Magento\Backend\App\Action $this->_getGiftmessageSaveModel()->setGiftmessages( $this->getRequest()->getParam('giftmessage') )->saveAllInOrder(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong while saving the gift message.')); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php b/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php index e747db34f6a..8f7853a6332 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php @@ -136,7 +136,7 @@ class Transactions extends \Magento\Backend\App\Action $txn->getOrderPaymentObject()->setOrder($txn->getOrder())->importTransactionInfo($txn); $txn->save(); $this->messageManager->addSuccess(__('The transaction details have been updated.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t update the transaction details.')); diff --git a/app/code/Magento/Sales/Helper/Admin.php b/app/code/Magento/Sales/Helper/Admin.php index 234283fb917..116b145a915 100644 --- a/app/code/Magento/Sales/Helper/Admin.php +++ b/app/code/Magento/Sales/Helper/Admin.php @@ -113,8 +113,8 @@ class Admin extends \Magento\App\Helper\AbstractHelper /** * Filter collection by removing not available product types * - * @param \Magento\Core\Model\Resource\Db\Collection\AbstractCollection $collection - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @param \Magento\Model\Resource\Db\Collection\AbstractCollection $collection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function applySalableProductTypesFilter($collection) { diff --git a/app/code/Magento/Sales/Model/AbstractModel.php b/app/code/Magento/Sales/Model/AbstractModel.php index 7b51ce6f075..16c30c276ef 100644 --- a/app/code/Magento/Sales/Model/AbstractModel.php +++ b/app/code/Magento/Sales/Model/AbstractModel.php @@ -29,7 +29,7 @@ namespace Magento\Sales\Model; * Sales abstract model * Provide date processing functionality */ -abstract class AbstractModel extends \Magento\Core\Model\AbstractModel +abstract class AbstractModel extends \Magento\Model\AbstractModel { /** * @var \Magento\Stdlib\DateTime\TimezoneInterface @@ -46,7 +46,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 3d1309109dc..913e4599f73 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -383,7 +383,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * * @param \Magento\Sales\Model\Order $order * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function initFromOrder(\Magento\Sales\Model\Order $order) { @@ -407,7 +407,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car if ($qty > 0) { $item = $this->initFromOrderItem($orderItem, $qty); if (is_string($item)) { - throw new \Magento\Core\Exception($item); + throw new \Magento\Model\Exception($item); } } } @@ -583,7 +583,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $customerId = (int)$this->getSession()->getCustomerId(); if ($customerId) { $this->_wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist'); - $this->_wishlist->loadByCustomer($customerId, true); + $this->_wishlist->loadByCustomerId($customerId, true); $this->_wishlist->setStore( $this->getSession()->getStore() )->setSharedStoreIds( @@ -662,7 +662,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * @param string $moveTo * @param int $qty * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function moveQuoteItem($item, $moveTo, $qty) { @@ -687,7 +687,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $newItem = $this->getQuote()->addProduct($product, $info); if (is_string($newItem)) { - throw new \Magento\Core\Exception($newItem); + throw new \Magento\Model\Exception($newItem); } $product->unsSkipCheckRequiredOption(); $newItem->checkData(); @@ -722,7 +722,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $cartItem = $cart->addProduct($product, $info); if (is_string($cartItem)) { - throw new \Magento\Core\Exception($cartItem); + throw new \Magento\Model\Exception($cartItem); } $cartItem->setPrice($item->getProduct()->getPrice()); $this->_needCollectCart = true; @@ -734,7 +734,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car if (!isset($moveTo[1])) { $wishlist = $this->_objectManager->create( 'Magento\Wishlist\Model\Wishlist' - )->loadByCustomer( + )->loadByCustomerId( $this->getSession()->getCustomerId(), true ); @@ -746,7 +746,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car } } if (!$wishlist) { - throw new \Magento\Core\Exception(__('We couldn\'t find this wish list.')); + throw new \Magento\Model\Exception(__('We couldn\'t find this wish list.')); } $wishlist->setStore( $this->getSession()->getStore() @@ -786,7 +786,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * * @param array $data * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function applySidebarData($data) { @@ -796,7 +796,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $orderItem = $this->_objectManager->create('Magento\Sales\Model\Order\Item')->load($orderItemId); $item = $this->initFromOrderItem($orderItem); if (is_string($item)) { - throw new \Magento\Core\Exception($item); + throw new \Magento\Model\Exception($item); } } } @@ -893,7 +893,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * @param int|\Magento\Catalog\Model\Product $product * @param array|float|int|\Magento\Object $config * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addProduct($product, $config = 1) { @@ -914,7 +914,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $product ); if (!$product->getId()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We could not add a product to cart by the ID "%1".', $productId) ); } @@ -923,7 +923,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $item = $this->quoteInitializer->init($this->getQuote(), $product, $config); if (is_string($item)) { - throw new \Magento\Core\Exception($item); + throw new \Magento\Model\Exception($item); } $item->checkData(); @@ -943,7 +943,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $config['qty'] = isset($config['qty']) ? (double)$config['qty'] : 1; try { $this->addProduct($productId, $config); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { return $e; @@ -957,7 +957,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * * @param array $data * @return $this - * @throws \Exception|\Magento\Core\Exception + * @throws \Exception|\Magento\Model\Exception */ public function updateQuoteItems($data) { @@ -1002,7 +1002,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car } } } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->recollectCart(); throw $e; } catch (\Exception $e) { @@ -1019,7 +1019,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * @param \Magento\Sales\Model\Quote\Item $item * @param string $additionalOptions * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _parseOptions(\Magento\Sales\Model\Quote\Item $item, $additionalOptions) { @@ -1036,11 +1036,11 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car if (strlen(trim($_additionalOption))) { try { if (strpos($_additionalOption, ':') === false) { - throw new \Magento\Core\Exception(__('There is an error in one of the option rows.')); + throw new \Magento\Model\Exception(__('There is an error in one of the option rows.')); } list($label, $value) = explode(':', $_additionalOption, 2); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('There is an error in one of the option rows.')); + throw new \Magento\Model\Exception(__('There is an error in one of the option rows.')); } $label = trim($label); $value = trim($value); @@ -1804,17 +1804,17 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * Validate quote data before order creation * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validate() { $customerId = $this->getSession()->getCustomerId(); if (is_null($customerId)) { - throw new \Magento\Core\Exception(__('Please select a customer.')); + throw new \Magento\Model\Exception(__('Please select a customer.')); } if (!$this->getSession()->getStore()->getId()) { - throw new \Magento\Core\Exception(__('Please select a store.')); + throw new \Magento\Model\Exception(__('Please select a store.')); } $items = $this->getQuote()->getAllItems(); @@ -1847,7 +1847,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car } else { try { $method->validate(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_errors[] = $e->getMessage(); } } @@ -1857,7 +1857,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car foreach ($this->_errors as $error) { $this->messageManager->addError($error); } - throw new \Magento\Core\Exception(''); + throw new \Magento\Model\Exception(''); } return $this; } diff --git a/app/code/Magento/Sales/Model/Config/Ordered.php b/app/code/Magento/Sales/Model/Config/Ordered.php index 57876cde80f..15085604d78 100644 --- a/app/code/Magento/Sales/Model/Config/Ordered.php +++ b/app/code/Magento/Sales/Model/Config/Ordered.php @@ -153,17 +153,38 @@ abstract class Ordered extends \Magento\Core\Model\Config\Base /** * Aggregate before/after information from all items and sort totals based on this data + * Invoke simple sorting if the first element contains the "sort_order" key * * @param array $config * @return array */ - protected function _getSortedCollectorCodes(array $config) + private function _getSortedCollectorCodes(array $config) { - // invoke simple sorting if the first element contains the "sort_order" key reset($config); $element = current($config); if (isset($element['sort_order'])) { - uasort($config, array($this, '_compareSortOrder')); + uasort( + $config, + // @codingStandardsIgnoreStart + /** + * @param array $a + * @param array $b + * @return int + */ + // @codingStandardsIgnoreEnd + function ($a, $b) { + if (!isset($a['sort_order']) || !isset($b['sort_order'])) { + return 0; + } + if ($a['sort_order'] > $b['sort_order']) { + return 1; + } elseif ($a['sort_order'] < $b['sort_order']) { + return -1; + } else { + return 0; + } + } + ); } $result = array_keys($config); return $result; @@ -192,26 +213,4 @@ abstract class Ordered extends \Magento\Core\Model\Config\Base return $this; } - - /** - * Callback that uses sort_order for comparison - * - * @param array $a - * @param array $b - * @return int - */ - protected function _compareSortOrder($a, $b) - { - if (!isset($a['sort_order']) || !isset($b['sort_order'])) { - return 0; - } - if ($a['sort_order'] > $b['sort_order']) { - $res = 1; - } elseif ($a['sort_order'] < $b['sort_order']) { - $res = -1; - } else { - $res = 0; - } - return $res; - } } diff --git a/app/code/Magento/Sales/Model/Config/Source/Order/Status.php b/app/code/Magento/Sales/Model/Config/Source/Order/Status.php index fcf884cfe28..3dbbf675174 100644 --- a/app/code/Magento/Sales/Model/Config/Source/Order/Status.php +++ b/app/code/Magento/Sales/Model/Config/Source/Order/Status.php @@ -31,9 +31,10 @@ namespace Magento\Sales\Model\Config\Source\Order; class Status implements \Magento\Option\ArrayInterface { - // set null to enable all possible + const UNDEFINED_OPTION_LABEL = '-- Please Select --'; + /** - * @var array + * @var string[] */ protected $_stateStatuses = array( \Magento\Sales\Model\Order::STATE_NEW, @@ -62,15 +63,13 @@ class Status implements \Magento\Option\ArrayInterface */ public function toOptionArray() { - if ($this->_stateStatuses) { - $statuses = $this->_orderConfig->getStateStatuses($this->_stateStatuses); - } else { - $statuses = $this->_orderConfig->getStatuses(); - } - $options = array(); - $options[] = array('value' => '', 'label' => __('-- Please Select --')); + $statuses = $this->_stateStatuses + ? $this->_orderConfig->getStateStatuses($this->_stateStatuses) + : $this->_orderConfig->getStatuses(); + + $options = [['value' => '', 'label' => __(self::UNDEFINED_OPTION_LABEL)]]; foreach ($statuses as $code => $label) { - $options[] = array('value' => $code, 'label' => $label); + $options[] = ['value' => $code, 'label' => $label]; } return $options; } diff --git a/app/code/Magento/Sales/Model/ConverterInterface.php b/app/code/Magento/Sales/Model/ConverterInterface.php index 3bf8d21ef1c..334aa991aa6 100644 --- a/app/code/Magento/Sales/Model/ConverterInterface.php +++ b/app/code/Magento/Sales/Model/ConverterInterface.php @@ -39,18 +39,18 @@ interface ConverterInterface /** * Decode data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $filedName * @return mixed */ - public function decode(\Magento\Core\Model\AbstractModel $object, $filedName); + public function decode(\Magento\Model\AbstractModel $object, $filedName); /** * Encode data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $filedName * @return mixed */ - public function encode(\Magento\Core\Model\AbstractModel $object, $filedName); + public function encode(\Magento\Model\AbstractModel $object, $filedName); } diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index e2ee876d4e4..e7a52eaec6b 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -632,7 +632,7 @@ class Order extends \Magento\Sales\Model\AbstractModel * @param Resource\Order\Shipment\CollectionFactory $shipmentCollectionFactory * @param Resource\Order\Creditmemo\CollectionFactory $memoCollectionFactory * @param Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -663,7 +663,7 @@ class Order extends \Magento\Sales\Model\AbstractModel \Magento\Sales\Model\Resource\Order\Shipment\CollectionFactory $shipmentCollectionFactory, \Magento\Sales\Model\Resource\Order\Creditmemo\CollectionFactory $memoCollectionFactory, \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -1268,7 +1268,7 @@ class Order extends \Magento\Sales\Model\AbstractModel * @param bool $isCustomerNotified * @param bool $shouldProtectState * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _setState( $state, @@ -1280,7 +1280,7 @@ class Order extends \Magento\Sales\Model\AbstractModel // attempt to set the specified state if ($shouldProtectState) { if ($this->isStateProtected($state)) { - throw new \Magento\Core\Exception(__('The Order State "%1" must not be set manually.', $state)); + throw new \Magento\Model\Exception(__('The Order State "%1" must not be set manually.', $state)); } } $this->setData('state', $state); @@ -1389,12 +1389,12 @@ class Order extends \Magento\Sales\Model\AbstractModel /** * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function hold() { if (!$this->canHold()) { - throw new \Magento\Core\Exception(__('A hold action is not available.')); + throw new \Magento\Model\Exception(__('A hold action is not available.')); } $this->setHoldBeforeState($this->getState()); $this->setHoldBeforeStatus($this->getStatus()); @@ -1406,12 +1406,12 @@ class Order extends \Magento\Sales\Model\AbstractModel * Attempt to unhold the order * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function unhold() { if (!$this->canUnhold()) { - throw new \Magento\Core\Exception(__('You cannot remove the hold.')); + throw new \Magento\Model\Exception(__('You cannot remove the hold.')); } $this->setState($this->getHoldBeforeState(), $this->getHoldBeforeStatus()); $this->setHoldBeforeState(null); @@ -1441,7 +1441,7 @@ class Order extends \Magento\Sales\Model\AbstractModel * @param string $comment * @param bool $graceful * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function registerCancellation($comment = '', $graceful = true) { @@ -1475,7 +1475,7 @@ class Order extends \Magento\Sales\Model\AbstractModel $this->_setState($cancelState, true, $comment); } elseif (!$graceful) { - throw new \Magento\Core\Exception(__('We cannot cancel this order.')); + throw new \Magento\Model\Exception(__('We cannot cancel this order.')); } return $this; } @@ -2341,10 +2341,10 @@ class Order extends \Magento\Sales\Model\AbstractModel /** * Add New object to related array * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function addRelatedObject(\Magento\Core\Model\AbstractModel $object) + public function addRelatedObject(\Magento\Model\AbstractModel $object) { $this->_relatedObjects[] = $object; return $this; @@ -2599,7 +2599,6 @@ class Order extends \Magento\Sales\Model\AbstractModel */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); return parent::_beforeDelete(); } } diff --git a/app/code/Magento/Sales/Model/Order/Address.php b/app/code/Magento/Sales/Model/Order/Address.php index 4973938f7b9..77466aa02b3 100644 --- a/app/code/Magento/Sales/Model/Order/Address.php +++ b/app/code/Magento/Sales/Model/Order/Address.php @@ -98,7 +98,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -111,7 +111,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Directory\Model\CountryFactory $countryFactory, \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php index a17e0c364c7..51b0e516bc4 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php @@ -25,7 +25,7 @@ */ namespace Magento\Sales\Model\Order; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Order creditmemo model @@ -277,7 +277,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel * @param Creditmemo\CommentFactory $commentFactory * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollectionFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -297,7 +297,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel \Magento\Sales\Model\Order\Creditmemo\CommentFactory $commentFactory, \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollectionFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -1063,11 +1063,10 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel } /** - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); return parent::_beforeDelete(); } diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php index 1d5d7c335d8..8f7aa96a43a 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php @@ -59,7 +59,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -69,7 +69,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php index f8b5761bb00..90bc82ac4e7 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php @@ -92,7 +92,7 @@ namespace Magento\Sales\Model\Order\Creditmemo; * @method float getBaseHiddenTaxAmount() * @method \Magento\Sales\Model\Order\Creditmemo\Item setBaseHiddenTaxAmount(float $value) */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { /** * @var string @@ -123,7 +123,7 @@ class Item extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -131,7 +131,7 @@ class Item extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -206,7 +206,7 @@ class Item extends \Magento\Core\Model\AbstractModel * * @param float $qty * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setQty($qty) { @@ -222,7 +222,7 @@ class Item extends \Magento\Core\Model\AbstractModel if ($qty <= $this->getOrderItem()->getQtyToRefund() || $this->getOrderItem()->isDummy()) { $this->setData('qty', $qty); } else { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We found an invalid quantity to refund item "%1".', $this->getName()) ); } diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Shipping.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Shipping.php index ed3c865aaf7..159a1fbe670 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Shipping.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Shipping.php @@ -58,7 +58,7 @@ class Shipping extends AbstractTotal /** * @param \Magento\Sales\Model\Order\Creditmemo $creditmemo * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function collect(\Magento\Sales\Model\Order\Creditmemo $creditmemo) { @@ -108,7 +108,7 @@ class Shipping extends AbstractTotal } } else { $baseAllowedAmount = $order->getBaseCurrency()->format($baseAllowedAmount, null, false); - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Maximum shipping amount allowed to refund is: %1', $baseAllowedAmount) ); } diff --git a/app/code/Magento/Sales/Model/Order/Invoice.php b/app/code/Magento/Sales/Model/Order/Invoice.php index f14e00140ef..0a75ed42cdb 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Invoice.php @@ -287,7 +287,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel * @param Invoice\CommentFactory $invoiceCommentFactory * @param \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $commentCollectionFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -307,7 +307,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel \Magento\Sales\Model\Order\Invoice\CommentFactory $invoiceCommentFactory, \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $commentCollectionFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -739,12 +739,12 @@ class Invoice extends \Magento\Sales\Model\AbstractModel * Apply to order, order items etc. * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function register() { if ($this->getId()) { - throw new \Magento\Core\Exception(__('We cannot register an existing invoice')); + throw new \Magento\Model\Exception(__('We cannot register an existing invoice')); } foreach ($this->getAllItems() as $item) { @@ -1073,11 +1073,10 @@ class Invoice extends \Magento\Sales\Model\AbstractModel } /** - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); return parent::_beforeDelete(); } diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php index 7cd47248a18..40b03529fd8 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php @@ -59,7 +59,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -69,7 +69,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Item.php b/app/code/Magento/Sales/Model/Order/Invoice/Item.php index bb200ef3936..135bc399de0 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Item.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Item.php @@ -92,7 +92,7 @@ namespace Magento\Sales\Model\Order\Invoice; * @method float getBaseHiddenTaxAmount() * @method \Magento\Sales\Model\Order\Invoice\Item setBaseHiddenTaxAmount(float $value) */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { /** * @var string @@ -123,7 +123,7 @@ class Item extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -131,7 +131,7 @@ class Item extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -206,7 +206,7 @@ class Item extends \Magento\Core\Model\AbstractModel * * @param float $qty * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setQty($qty) { @@ -224,7 +224,7 @@ class Item extends \Magento\Core\Model\AbstractModel if ($qty <= $qtyToInvoice || $this->getOrderItem()->isDummy()) { $this->setData('qty', $qty); } else { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We found an invalid quantity to invoice item "%1".', $this->getName()) ); } diff --git a/app/code/Magento/Sales/Model/Order/Item.php b/app/code/Magento/Sales/Model/Order/Item.php index 502a845198a..860c3d07a23 100644 --- a/app/code/Magento/Sales/Model/Order/Item.php +++ b/app/code/Magento/Sales/Model/Order/Item.php @@ -188,7 +188,7 @@ namespace Magento\Sales\Model\Order; * @method float getBaseDiscountRefunded() * @method \Magento\Sales\Model\Order\Item setBaseDiscountRefunded(float $value) */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { const STATUS_PENDING = 1; @@ -266,7 +266,7 @@ class Item extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -275,7 +275,7 @@ class Item extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php index fb6a556ef20..3828a0eb5f2 100644 --- a/app/code/Magento/Sales/Model/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Order/Payment.php @@ -215,7 +215,7 @@ class Payment extends \Magento\Payment\Model\Info * @param \Magento\Sales\Model\Order\Payment\TransactionFactory $transactionFactory * @param \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $transactionCollectionFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -228,7 +228,7 @@ class Payment extends \Magento\Payment\Model\Info \Magento\Sales\Model\Order\Payment\TransactionFactory $transactionFactory, \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $transactionCollectionFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -415,7 +415,7 @@ class Payment extends \Magento\Payment\Model\Info * TODO: eliminate logic duplication with registerCaptureNotification() * * @param null|Invoice $invoice - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function capture($invoice) @@ -495,7 +495,7 @@ class Payment extends \Magento\Payment\Model\Info $this->getMethodInstance()->processInvoice($invoice, $this); return $this; } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The transaction "%1" cannot be captured yet.', $invoice->getTransactionId()) ); } @@ -708,7 +708,7 @@ class Payment extends \Magento\Payment\Model\Info * @param Creditmemo $creditmemo * @return $this * @throws \Exception - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function refund($creditmemo) { @@ -745,7 +745,7 @@ class Payment extends \Magento\Payment\Model\Info $creditmemo, $this ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if (!$captureTxn) { $e->setMessage( ' ' . __('If the invoice was created offline, try creating an offline credit memo.'), diff --git a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php index 1abf5f66a39..5272ffd24de 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php @@ -49,7 +49,7 @@ namespace Magento\Sales\Model\Order\Payment; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Transaction extends \Magento\Core\Model\AbstractModel +class Transaction extends \Magento\Model\AbstractModel { /**#@+ * Supported transaction types @@ -175,7 +175,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * @param \Magento\Sales\Model\Order\PaymentFactory $paymentFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -185,7 +185,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel \Magento\Sales\Model\Order\PaymentFactory $paymentFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -238,14 +238,14 @@ class Transaction extends \Magento\Core\Model\AbstractModel * @param string $parentTxnId * @param string $txnId * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setParentTxnId($parentTxnId, $txnId = null) { $this->_verifyTxnId($parentTxnId); if (empty($txnId)) { if ('' == $this->getTxnId()) { - throw new \Magento\Core\Exception(__('The parent transaction ID must have a transaction ID.')); + throw new \Magento\Model\Exception(__('The parent transaction ID must have a transaction ID.')); } } else { $this->setTxnId($txnId); @@ -439,7 +439,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel return false; } return true; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { // jam all logical exceptions, fallback to false } return false; @@ -515,12 +515,12 @@ class Transaction extends \Magento\Core\Model\AbstractModel * @param string $key * @param mixed $value * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setAdditionalInformation($key, $value) { if (is_object($value)) { - throw new \Magento\Core\Exception(__('Payment transactions disallow storing objects.')); + throw new \Magento\Model\Exception(__('Payment transactions disallow storing objects.')); } $info = $this->_getData('additional_information'); if (!$info) { @@ -572,7 +572,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * * @param bool $shouldSave * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Exception */ public function close($shouldSave = true) @@ -581,7 +581,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel $this->_verifyThisTransactionExists(); } if (1 == $this->getIsClosed() && $this->_isFailsafe) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The transaction "%1" (%2) is already closed.', $this->getTxnId(), $this->getTxnType()) ); } @@ -666,7 +666,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * * @param \Magento\Sales\Model\Order|null|boolean $order * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setOrder($order = null) { @@ -681,7 +681,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel } elseif (!$this->getId() || $this->getOrderId() == $order->getId()) { $this->_order = $order; } else { - throw new \Magento\Core\Exception(__('Set order for existing transactions not allowed')); + throw new \Magento\Model\Exception(__('Set order for existing transactions not allowed')); } return $this; @@ -730,7 +730,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * Load child transactions * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _loadChildren() { @@ -743,7 +743,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel $payment = $this->_verifyPaymentObject(true); $paymentId = $payment ? $payment->getId() : $this->_getData('payment_id'); if (!$paymentId) { - throw new \Magento\Core\Exception(__('At minimum, you need to set a payment ID.')); + throw new \Magento\Model\Exception(__('At minimum, you need to set a payment ID.')); } $this->setOrder(true); @@ -841,7 +841,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * * @param string $txnType * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _verifyTxnType($txnType = null) { @@ -857,7 +857,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel case self::TYPE_REFUND: break; default: - throw new \Magento\Core\Exception(__('We found an unsupported transaction type "%1".', $txnType)); + throw new \Magento\Model\Exception(__('We found an unsupported transaction type "%1".', $txnType)); } } @@ -867,13 +867,13 @@ class Transaction extends \Magento\Core\Model\AbstractModel * * @param bool $dryRun * @return \Magento\Sales\Model\Order\Payment|null|false - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _verifyPaymentObject($dryRun = false) { if (!$this->_paymentObject || !$this->getOrderId()) { if (!$dryRun) { - throw new \Magento\Core\Exception(__('Please set a proper payment object.')); + throw new \Magento\Model\Exception(__('Please set a proper payment object.')); } } return $this->_paymentObject; @@ -884,12 +884,12 @@ class Transaction extends \Magento\Core\Model\AbstractModel * * @param string $txnId * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _verifyTxnId($txnId) { if (null !== $txnId && 0 == strlen($txnId)) { - throw new \Magento\Core\Exception(__('The Transaction ID field cannot be empty.')); + throw new \Magento\Model\Exception(__('The Transaction ID field cannot be empty.')); } } @@ -898,12 +898,12 @@ class Transaction extends \Magento\Core\Model\AbstractModel * TODO for more restriction we can check for data consistency * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _verifyThisTransactionExists() { if (!$this->getId()) { - throw new \Magento\Core\Exception(__('You can\'t do this without a transaction object.')); + throw new \Magento\Model\Exception(__('You can\'t do this without a transaction object.')); } $this->_verifyTxnType(); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php index 7fa65d8b3d9..496d0641f93 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php @@ -93,11 +93,6 @@ abstract class AbstractPdf extends \Magento\Object */ protected $_coreStoreConfig; - /** - * @var \Magento\TranslateInterface - */ - protected $_translate; - /** * @var \Magento\Filesystem\Directory\WriteInterface */ @@ -123,16 +118,21 @@ abstract class AbstractPdf extends \Magento\Object */ protected $_pdfItemsFactory; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\TranslateInterface $translate * @param \Magento\App\Filesystem $filesystem * @param Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -141,24 +141,24 @@ abstract class AbstractPdf extends \Magento\Object \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\TranslateInterface $translate, \Magento\App\Filesystem $filesystem, Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, array $data = array() ) { $this->_paymentData = $paymentData; $this->_localeDate = $localeDate; $this->string = $string; $this->_coreStoreConfig = $coreStoreConfig; - $this->_translate = $translate; $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $this->_pdfConfig = $pdfConfig; $this->_pdfTotalFactory = $pdfTotalFactory; $this->_pdfItemsFactory = $pdfItemsFactory; + $this->inlineTranslation = $inlineTranslation; parent::__construct($data); } @@ -709,7 +709,7 @@ abstract class AbstractPdf extends \Magento\Object */ protected function _beforeGetPdf() { - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); } /** @@ -719,7 +719,7 @@ abstract class AbstractPdf extends \Magento\Object */ protected function _afterGetPdf() { - $this->_translate->setTranslateInline(true); + $this->inlineTranslation->resume(); } /** @@ -767,7 +767,7 @@ abstract class AbstractPdf extends \Magento\Object * * @param string $type * @return \Magento\Sales\Model\Order\Pdf\Items\AbstractItems - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getRenderer($type) { @@ -776,7 +776,7 @@ abstract class AbstractPdf extends \Magento\Object } if (!isset($this->_renderers[$type])) { - throw new \Magento\Core\Exception(__('We found an invalid renderer model.')); + throw new \Magento\Model\Exception(__('We found an invalid renderer model.')); } if (is_null($this->_renderers[$type]['renderer'])) { @@ -885,13 +885,13 @@ abstract class AbstractPdf extends \Magento\Object /** * Retrieve PDF object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Zend_Pdf */ protected function _getPdf() { if (!$this->_pdf instanceof \Zend_Pdf) { - throw new \Magento\Core\Exception(__('Please define the PDF object before using.')); + throw new \Magento\Model\Exception(__('Please define the PDF object before using.')); } return $this->_pdf; @@ -935,14 +935,14 @@ abstract class AbstractPdf extends \Magento\Object * @param \Zend_Pdf_Page $page * @param array $draw * @param array $pageSettings - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Zend_Pdf_Page */ public function drawLineBlocks(\Zend_Pdf_Page $page, array $draw, array $pageSettings = array()) { foreach ($draw as $itemsProp) { if (!isset($itemsProp['lines']) || !is_array($itemsProp['lines'])) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We don\'t recognize the draw line data. Please define the "lines" array.') ); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php index 10b8cdd952d..8fd9fad05c9 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php @@ -60,12 +60,12 @@ class Creditmemo extends AbstractPdf \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\TranslateInterface $translate, \Magento\App\Filesystem $filesystem, Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() @@ -76,12 +76,12 @@ class Creditmemo extends AbstractPdf $paymentData, $string, $coreStoreConfig, - $translate, $filesystem, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, $localeDate, + $inlineTranslation, $data ); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php index ae09f3ef9ea..e3755c7e5fd 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php @@ -44,12 +44,12 @@ class Invoice extends AbstractPdf * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\TranslateInterface $translate * @param \Magento\App\Filesystem $filesystem * @param Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data @@ -60,12 +60,12 @@ class Invoice extends AbstractPdf \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\TranslateInterface $translate, \Magento\App\Filesystem $filesystem, Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() @@ -76,12 +76,12 @@ class Invoice extends AbstractPdf $paymentData, $string, $coreStoreConfig, - $translate, $filesystem, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, $localeDate, + $inlineTranslation, $data ); } 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 59d6acbc251..b91a0832f48 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php @@ -28,7 +28,7 @@ namespace Magento\Sales\Model\Order\Pdf\Items; /** * Sales Order Pdf Items renderer Abstract */ -abstract class AbstractItems extends \Magento\Core\Model\AbstractModel +abstract class AbstractItems extends \Magento\Model\AbstractModel { /** * Order model @@ -40,7 +40,7 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Source model (invoice, shipment, creditmemo) * - * @var \Magento\Core\Model\AbstractModel + * @var \Magento\Model\AbstractModel */ protected $_source; @@ -88,7 +88,7 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\App\Filesystem $filesystem , * @param \Magento\Filter\FilterManager $filterManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -98,7 +98,7 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel \Magento\Tax\Helper\Data $taxData, \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -123,10 +123,10 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Set Source model * - * @param \Magento\Core\Model\AbstractModel $source + * @param \Magento\Model\AbstractModel $source * @return $this */ - public function setSource(\Magento\Core\Model\AbstractModel $source) + public function setSource(\Magento\Model\AbstractModel $source) { $this->_source = $source; return $this; @@ -171,13 +171,13 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Retrieve order object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Sales\Model\Order */ public function getOrder() { if (null === $this->_order) { - throw new \Magento\Core\Exception(__('The order object is not specified.')); + throw new \Magento\Model\Exception(__('The order object is not specified.')); } return $this->_order; } @@ -185,13 +185,13 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Retrieve source object * - * @throws \Magento\Core\Exception - * @return \Magento\Core\Model\AbstractModel + * @throws \Magento\Model\Exception + * @return \Magento\Model\AbstractModel */ public function getSource() { if (null === $this->_source) { - throw new \Magento\Core\Exception(__('The source object is not specified.')); + throw new \Magento\Model\Exception(__('The source object is not specified.')); } return $this->_source; } @@ -199,13 +199,13 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Retrieve item object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Object */ public function getItem() { if (null === $this->_item) { - throw new \Magento\Core\Exception(__('An item object is not specified.')); + throw new \Magento\Model\Exception(__('An item object is not specified.')); } return $this->_item; } @@ -213,13 +213,13 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Retrieve Pdf model * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Sales\Model\Order\Pdf\AbstractPdf */ public function getPdf() { if (null === $this->_pdf) { - throw new \Magento\Core\Exception(__('A PDF object is not specified.')); + throw new \Magento\Model\Exception(__('A PDF object is not specified.')); } return $this->_pdf; } @@ -227,13 +227,13 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Retrieve Pdf page object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Zend_Pdf_Page */ public function getPage() { if (null === $this->_pdfPage) { - throw new \Magento\Core\Exception(__('A PDF page object is not specified.')); + throw new \Magento\Model\Exception(__('A PDF page object is not specified.')); } return $this->_pdfPage; } 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 bdf64655d3c..ec21d8430da 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 @@ -44,7 +44,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { 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 efed464d882..b25083fdca2 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 @@ -44,7 +44,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { 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 78305852952..b1b52f57b27 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 @@ -44,7 +44,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php index 8b704cc57de..3cbba9b75d9 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php @@ -44,12 +44,12 @@ class Shipment extends AbstractPdf * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\TranslateInterface $translate * @param \Magento\App\Filesystem $filesystem * @param Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data @@ -60,12 +60,12 @@ class Shipment extends AbstractPdf \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\TranslateInterface $translate, \Magento\App\Filesystem $filesystem, Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() @@ -76,12 +76,12 @@ class Shipment extends AbstractPdf $paymentData, $string, $coreStoreConfig, - $translate, $filesystem, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, $localeDate, + $inlineTranslation, $data ); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Total/Factory.php b/app/code/Magento/Sales/Model/Order/Pdf/Total/Factory.php index 1efb105b6fa..7d982bdf759 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Total/Factory.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Total/Factory.php @@ -51,13 +51,13 @@ class Factory * @param string|null $class * @param array $arguments * @return \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($class = null, $arguments = array()) { $class = $class ?: $this->_defaultTotalModel; if (!is_a($class, 'Magento\Sales\Model\Order\Pdf\Total\DefaultTotal', true)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( "The PDF total model {$class} must be or extend " . "\\Magento\\Sales\\Model\\Order\\Pdf\\Total\\DefaultTotal." diff --git a/app/code/Magento/Sales/Model/Order/Shipment.php b/app/code/Magento/Sales/Model/Order/Shipment.php index 8b6671395c8..e06df0dca37 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment.php @@ -202,7 +202,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel * @param Shipment\CommentFactory $commentFactory * @param \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $commentCollectionFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -220,7 +220,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel \Magento\Sales\Model\Order\Shipment\CommentFactory $commentFactory, \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $commentCollectionFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -325,12 +325,12 @@ class Shipment extends \Magento\Sales\Model\AbstractModel * Apply to order, order items etc. * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function register() { if ($this->getId()) { - throw new \Magento\Core\Exception(__('We cannot register an existing shipment')); + throw new \Magento\Model\Exception(__('We cannot register an existing shipment')); } $totalQty = 0; @@ -475,7 +475,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel /** * Track saving is implemented in _afterSave() - * This enforces \Magento\Core\Model\AbstractModel::save() not to skip _afterSave() + * This enforces \Magento\Model\AbstractModel::save() not to skip _afterSave() */ $this->_hasDataChanges = true; @@ -738,12 +738,12 @@ class Shipment extends \Magento\Sales\Model\AbstractModel * Before object save * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { if ((!$this->getId() || null !== $this->_items) && !count($this->getAllItems())) { - throw new \Magento\Core\Exception(__('We cannot create an empty shipment.')); + throw new \Magento\Model\Exception(__('We cannot create an empty shipment.')); } if (!$this->getOrderId() && $this->getOrder()) { @@ -755,11 +755,10 @@ class Shipment extends \Magento\Sales\Model\AbstractModel } /** - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); return parent::_beforeDelete(); } diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php index a9d5f6bc14b..7d3ec25edc3 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php @@ -59,7 +59,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -69,7 +69,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Item.php b/app/code/Magento/Sales/Model/Order/Shipment/Item.php index 8650f73e8ec..15667539a0a 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Item.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Item.php @@ -50,7 +50,7 @@ namespace Magento\Sales\Model\Order\Shipment; * @method string getSku() * @method \Magento\Sales\Model\Order\Shipment\Item setSku(string $value) */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { /** * @var string @@ -81,7 +81,7 @@ class Item extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -89,7 +89,7 @@ class Item extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -164,7 +164,7 @@ class Item extends \Magento\Core\Model\AbstractModel * * @param float $qty * @return \Magento\Sales\Model\Order\Invoice\Item - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setQty($qty) { @@ -180,7 +180,7 @@ class Item extends \Magento\Core\Model\AbstractModel if ($qty <= $this->getOrderItem()->getQtyToShip() || $this->getOrderItem()->isDummy(true)) { $this->setData('qty', $qty); } else { - throw new \Magento\Core\Exception(__('We found an invalid qty to ship for item "%1".', $this->getName())); + throw new \Magento\Model\Exception(__('We found an invalid qty to ship for item "%1".', $this->getName())); } return $this; } diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Track.php b/app/code/Magento/Sales/Model/Order/Shipment/Track.php index ef835c901d4..71f30fccef1 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Track.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Track.php @@ -90,7 +90,7 @@ class Track extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -101,7 +101,7 @@ class Track extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Status.php b/app/code/Magento/Sales/Model/Order/Status.php index 228e5585972..dccf30e0044 100644 --- a/app/code/Magento/Sales/Model/Order/Status.php +++ b/app/code/Magento/Sales/Model/Order/Status.php @@ -25,7 +25,7 @@ */ namespace Magento\Sales\Model\Order; -class Status extends \Magento\Core\Model\AbstractModel +class Status extends \Magento\Model\AbstractModel { /** * @var \Magento\Core\Model\StoreManagerInterface @@ -36,7 +36,7 @@ class Status extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -44,7 +44,7 @@ class Status extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Status/History.php b/app/code/Magento/Sales/Model/Order/Status/History.php index 1bf6d3112be..754ead6f62d 100644 --- a/app/code/Magento/Sales/Model/Order/Status/History.php +++ b/app/code/Magento/Sales/Model/Order/Status/History.php @@ -74,7 +74,7 @@ class History extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -84,7 +84,7 @@ class History extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Tax.php b/app/code/Magento/Sales/Model/Order/Tax.php index 4b6566f538a..fd356b42ed4 100644 --- a/app/code/Magento/Sales/Model/Order/Tax.php +++ b/app/code/Magento/Sales/Model/Order/Tax.php @@ -56,7 +56,7 @@ namespace Magento\Sales\Model\Order; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Tax extends \Magento\Core\Model\AbstractModel +class Tax extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php index bd88a70b83a..cb33393baf0 100644 --- a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php +++ b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php @@ -81,13 +81,13 @@ class Base extends \Magento\Sales\Model\Config\Ordered * @param string $totalCode * @param array $totalConfig * @return \Magento\Sales\Model\Order\Total\AbstractTotal - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initModelInstance($class, $totalCode, $totalConfig) { $model = $this->_orderTotalFactory->create($class); if (!$model instanceof \Magento\Sales\Model\Order\Total\AbstractTotal) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The total model should be extended from \Magento\Sales\Model\Order\Total\AbstractTotal.') ); } diff --git a/app/code/Magento/Sales/Model/Payment/Method/Converter.php b/app/code/Magento/Sales/Model/Payment/Method/Converter.php index 0b2afd9fdae..029aa55efc4 100644 --- a/app/code/Magento/Sales/Model/Payment/Method/Converter.php +++ b/app/code/Magento/Sales/Model/Payment/Method/Converter.php @@ -62,11 +62,11 @@ class Converter /** * Check if specified field is encrypted * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $filedName * @return bool */ - protected function _shouldBeEncrypted(\Magento\Core\Model\AbstractModel $object, $filedName) + protected function _shouldBeEncrypted(\Magento\Model\AbstractModel $object, $filedName) { $method = $object->getData('method'); return isset($this->_encryptFields[$method][$filedName]) && $this->_encryptFields[$method][$filedName]; @@ -75,11 +75,11 @@ class Converter /** * Decode data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $filedName * @return mixed */ - public function decode(\Magento\Core\Model\AbstractModel $object, $filedName) + public function decode(\Magento\Model\AbstractModel $object, $filedName) { $value = $object->getData($filedName); @@ -93,11 +93,11 @@ class Converter /** * Encode data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $filedName * @return mixed */ - public function encode(\Magento\Core\Model\AbstractModel $object, $filedName) + public function encode(\Magento\Model\AbstractModel $object, $filedName) { $value = $object->getData($filedName); diff --git a/app/code/Magento/Sales/Model/Quote.php b/app/code/Magento/Sales/Model/Quote.php index 9ac153386b6..c8ef7835159 100644 --- a/app/code/Magento/Sales/Model/Quote.php +++ b/app/code/Magento/Sales/Model/Quote.php @@ -134,7 +134,7 @@ use Magento\Customer\Service\V1\CustomerGroupServiceInterface; * @method bool|null getIsPersistent() * @method Quote setIsPersistent(bool $value) */ -class Quote extends \Magento\Core\Model\AbstractModel +class Quote extends \Magento\Model\AbstractModel { /** * Checkout login method key @@ -321,7 +321,7 @@ class Quote extends \Magento\Core\Model\AbstractModel * @param \Magento\Customer\Model\Converter $converter * @param \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService * @param \Magento\Customer\Model\Address\Converter $addressConverter - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -347,7 +347,7 @@ class Quote extends \Magento\Core\Model\AbstractModel \Magento\Customer\Model\Converter $converter, \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService, \Magento\Customer\Model\Address\Converter $addressConverter, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -1234,7 +1234,7 @@ class Quote extends \Magento\Core\Model\AbstractModel * * @param \Magento\Sales\Model\Quote\Item $item * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addItem(\Magento\Sales\Model\Quote\Item $item) { @@ -1247,7 +1247,7 @@ class Quote extends \Magento\Core\Model\AbstractModel * Proper solution is to submit items one by one with customer confirmation each time. */ if ($item->isNominal() && $this->hasItems() || $this->hasNominalItems()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Sorry, but items with payment agreements must be ordered one at a time To continue, please remove or buy the other items in your cart, then order this item by itself.' ) @@ -1270,7 +1270,7 @@ class Quote extends \Magento\Core\Model\AbstractModel * @param null|float|\Magento\Object $request * @param null|string $processMode * @return \Magento\Sales\Model\Quote\Item|string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addProductAdvanced(\Magento\Catalog\Model\Product $product, $request = null, $processMode = null) { @@ -1281,7 +1281,7 @@ class Quote extends \Magento\Core\Model\AbstractModel $request = new \Magento\Object(array('qty' => $request)); } if (!$request instanceof \Magento\Object) { - throw new \Magento\Core\Exception(__('We found an invalid request for adding product to quote.')); + throw new \Magento\Model\Exception(__('We found an invalid request for adding product to quote.')); } $cartCandidates = $product->getTypeInstance()->prepareForCartAdvanced($request, $product, $processMode); @@ -1338,7 +1338,7 @@ class Quote extends \Magento\Core\Model\AbstractModel } } if (!empty($errors)) { - throw new \Magento\Core\Exception(implode("\n", $errors)); + throw new \Magento\Model\Exception(implode("\n", $errors)); } $this->_eventManager->dispatch('sales_quote_product_add_after', array('items' => $items)); @@ -1421,7 +1421,7 @@ class Quote extends \Magento\Core\Model\AbstractModel * @param \Magento\Object $buyRequest * @param null|array|\Magento\Object $params * @return \Magento\Sales\Model\Quote\Item - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * * @see \Magento\Catalog\Helper\Product::addParamsToBuyRequest() */ @@ -1429,7 +1429,7 @@ class Quote extends \Magento\Core\Model\AbstractModel { $item = $this->getItemById($itemId); if (!$item) { - throw new \Magento\Core\Exception(__('This is the wrong quote item id to update configuration.')); + throw new \Magento\Model\Exception(__('This is the wrong quote item id to update configuration.')); } $productId = $item->getProduct()->getId(); @@ -1449,7 +1449,7 @@ class Quote extends \Magento\Core\Model\AbstractModel $resultItem = $this->addProduct($product, $buyRequest); if (is_string($resultItem)) { - throw new \Magento\Core\Exception($resultItem); + throw new \Magento\Model\Exception($resultItem); } if ($resultItem->getParentItem()) { diff --git a/app/code/Magento/Sales/Model/Quote/Address.php b/app/code/Magento/Sales/Model/Quote/Address.php index fd6b3455992..2aab04ed407 100644 --- a/app/code/Magento/Sales/Model/Quote/Address.php +++ b/app/code/Magento/Sales/Model/Quote/Address.php @@ -285,7 +285,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress * @param CustomerAddressBuilder $customerAddressBuilder * @param CustomerAddressServiceInterface $customerAddressService * @param \Magento\Customer\Model\Address\Converter $addressConverter - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -312,7 +312,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress CustomerAddressBuilder $customerAddressBuilder, CustomerAddressServiceInterface $customerAddressService, \Magento\Customer\Model\Address\Converter $addressConverter, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Quote/Address/AbstractCarrierInterface.php b/app/code/Magento/Sales/Model/Quote/Address/AbstractCarrierInterface.php index 49138e48200..2815479a302 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/AbstractCarrierInterface.php +++ b/app/code/Magento/Sales/Model/Quote/Address/AbstractCarrierInterface.php @@ -84,7 +84,7 @@ interface AbstractCarrierInterface /** * @param \Magento\Sales\Model\Quote\Address\RateRequest $request - * @return $this|bool|false|\Magento\Core\Model\AbstractModel + * @return $this|bool|false|\Magento\Model\AbstractModel */ public function checkAvailableShipCountries(\Magento\Sales\Model\Quote\Address\RateRequest $request); diff --git a/app/code/Magento/Sales/Model/Quote/Address/Rate.php b/app/code/Magento/Sales/Model/Quote/Address/Rate.php index 4af3bb36d0a..ccba4d040b9 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Rate.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Rate.php @@ -25,7 +25,7 @@ */ namespace Magento\Sales\Model\Quote\Address; -use Magento\Core\Model\AbstractModel; +use \Magento\Model\AbstractModel; /** * @method \Magento\Sales\Model\Resource\Quote\Address\Rate _getResource() diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/AbstractTotal.php b/app/code/Magento/Sales/Model/Quote/Address/Total/AbstractTotal.php index 5fe47831ef8..55409acdc29 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Total/AbstractTotal.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Total/AbstractTotal.php @@ -140,12 +140,12 @@ abstract class AbstractTotal * Get quote address object * * @return \Magento\Sales\Model\Quote\Address - * @throws \Magento\Core\Exception if address not declared + * @throws \Magento\Model\Exception if address not declared */ protected function _getAddress() { if ($this->_address === null) { - throw new \Magento\Core\Exception(__('The address model is not defined.')); + throw new \Magento\Model\Exception(__('The address model is not defined.')); } return $this->_address; } diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php b/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php index 3c16844ae6e..401dc1339b6 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php @@ -134,13 +134,13 @@ class Collector extends \Magento\Sales\Model\Config\Ordered * @param string $totalCode * @param array $totalConfig * @return \Magento\Sales\Model\Quote\Address\Total\AbstractTotal - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initModelInstance($class, $totalCode, $totalConfig) { $model = $this->_totalFactory->create($class); if (!$model instanceof \Magento\Sales\Model\Quote\Address\Total\AbstractTotal) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'The address total model should be extended from \Magento\Sales\Model\Quote\Address\Total\AbstractTotal.' ) @@ -159,7 +159,7 @@ class Collector extends \Magento\Sales\Model\Config\Ordered * * @return $this */ - protected function _initRetrievers() + private function _initRetrievers() { $sorts = $this->_coreStoreConfig->getConfig(self::XML_PATH_SALES_TOTALS_SORT, $this->_store); foreach ($sorts as $code => $sortOrder) { diff --git a/app/code/Magento/Sales/Model/Quote/Item.php b/app/code/Magento/Sales/Model/Quote/Item.php index fbef7894563..9c9b552bba1 100644 --- a/app/code/Magento/Sales/Model/Quote/Item.php +++ b/app/code/Magento/Sales/Model/Quote/Item.php @@ -206,7 +206,7 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem * @param \Magento\Sales\Model\Status\ListFactory $statusListFactory * @param \Magento\Locale\FormatInterface $localeFormat * @param \Magento\Sales\Model\Quote\Item\OptionFactory $itemOptionFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data * @@ -219,7 +219,7 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem \Magento\Sales\Model\Status\ListFactory $statusListFactory, \Magento\Locale\FormatInterface $localeFormat, \Magento\Sales\Model\Quote\Item\OptionFactory $itemOptionFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -632,7 +632,7 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem * * @param \Magento\Sales\Model\Quote\Item\Option|\Magento\Object $option * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addOption($option) { @@ -649,7 +649,7 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem } elseif ($option instanceof \Magento\Sales\Model\Quote\Item\Option) { $option->setItem($this); } else { - throw new \Magento\Core\Exception(__('We found an invalid item option format.')); + throw new \Magento\Model\Exception(__('We found an invalid item option format.')); } $exOption = $this->getOptionByCode($option->getCode()); @@ -710,14 +710,14 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem * * @param \Magento\Sales\Model\Quote\Item\Option $option * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _addOptionCode($option) { if (!isset($this->_optionsByCode[$option->getCode()])) { $this->_optionsByCode[$option->getCode()] = $option; } else { - throw new \Magento\Core\Exception(__('An item option with code %1 already exists.', $option->getCode())); + throw new \Magento\Model\Exception(__('An item option with code %1 already exists.', $option->getCode())); } return $this; } diff --git a/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php b/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php index dad68dc8674..9235a6e3136 100644 --- a/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php +++ b/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php @@ -54,7 +54,7 @@ use Magento\Sales\Model\Quote\Item; * @method int[] getAppliedRuleIds() * @method \Magento\Sales\Model\Quote\Item\AbstractItem setAppliedRuleIds(array $ruleIds) */ -abstract class AbstractItem extends \Magento\Core\Model\AbstractModel implements +abstract class AbstractItem extends \Magento\Model\AbstractModel implements \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface { /** @@ -88,7 +88,7 @@ abstract class AbstractItem extends \Magento\Core\Model\AbstractModel implements * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -96,7 +96,7 @@ abstract class AbstractItem extends \Magento\Core\Model\AbstractModel implements \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -318,7 +318,7 @@ abstract class AbstractItem extends \Magento\Core\Model\AbstractModel implements try { $this->setQty($qty); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->setHasError(true); $this->setMessage($e->getMessage()); } catch (\Exception $e) { @@ -328,7 +328,7 @@ abstract class AbstractItem extends \Magento\Core\Model\AbstractModel implements try { $this->getProduct()->getTypeInstance()->checkProductBuyState($this->getProduct()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->setHasError(true)->setMessage($e->getMessage()); $this->getQuote()->setHasError( true diff --git a/app/code/Magento/Sales/Model/Quote/Item/Option.php b/app/code/Magento/Sales/Model/Quote/Item/Option.php index aa324031144..8fb48d48884 100644 --- a/app/code/Magento/Sales/Model/Quote/Item/Option.php +++ b/app/code/Magento/Sales/Model/Quote/Item/Option.php @@ -38,7 +38,7 @@ namespace Magento\Sales\Model\Quote\Item; * @method \Magento\Sales\Model\Quote\Item\Option setCode(string $value) * @method \Magento\Sales\Model\Quote\Item\Option setValue(string $value) */ -class Option extends \Magento\Core\Model\AbstractModel implements +class Option extends \Magento\Model\AbstractModel implements \Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface { /** diff --git a/app/code/Magento/Sales/Model/Quote/Payment.php b/app/code/Magento/Sales/Model/Quote/Payment.php index 1e163a5be9b..4d0a13f29e9 100644 --- a/app/code/Magento/Sales/Model/Quote/Payment.php +++ b/app/code/Magento/Sales/Model/Quote/Payment.php @@ -93,7 +93,7 @@ class Payment extends \Magento\Payment\Model\Info * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Payment\Model\Checks\SpecificationFactory $methodSpecificationFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -103,7 +103,7 @@ class Payment extends \Magento\Payment\Model\Info \Magento\Payment\Helper\Data $paymentData, \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Payment\Model\Checks\SpecificationFactory $methodSpecificationFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -151,7 +151,7 @@ class Payment extends \Magento\Payment\Model\Info * * @param array $data * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function importData(array $data) { @@ -179,7 +179,7 @@ class Payment extends \Magento\Payment\Model\Info $this->getQuote() ) ) { - throw new \Magento\Core\Exception(__('The requested Payment Method is not available.')); + throw new \Magento\Model\Exception(__('The requested Payment Method is not available.')); } $method->assignData($data); @@ -202,7 +202,7 @@ class Payment extends \Magento\Payment\Model\Info } try { $method = $this->getMethodInstance(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { return parent::_beforeSave(); } $method->prepareSave(); diff --git a/app/code/Magento/Sales/Model/Resource/AbstractResource.php b/app/code/Magento/Sales/Model/Resource/AbstractResource.php index d0fa595d647..22dd41d55b3 100644 --- a/app/code/Magento/Sales/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Sales/Model/Resource/AbstractResource.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractResource extends \Magento\Model\Resource\Db\AbstractDb { /** * Data converter object @@ -59,10 +59,10 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Prepare data for save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return array */ - protected function _prepareDataForSave(\Magento\Core\Model\AbstractModel $object) + protected function _prepareDataForSave(\Magento\Model\AbstractModel $object) { $currentTime = $this->dateTime->now(); if ((!$object->getId() || $object->isObjectNew()) && !$object->getCreatedAt()) { @@ -86,10 +86,10 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { parent::_beforeSave($object); @@ -104,10 +104,10 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { if (true == $this->_shouldBeConverted()) { foreach ($object->getData() as $fieldName => $fieldValue) { @@ -120,10 +120,10 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Perform actions after object load * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { if (true == $this->_shouldBeConverted()) { foreach ($object->getData() as $fieldName => $fieldValue) { diff --git a/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php b/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php index 875a681eff3..5336327dfc2 100644 --- a/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php +++ b/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php @@ -32,14 +32,14 @@ namespace Magento\Sales\Model\Resource\Collection; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +abstract class AbstractCollection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Check if $attribute is \Magento\Eav\Model\Entity\Attribute and convert to string field name * * @param string|\Magento\Eav\Model\Entity\Attribute $attribute * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _attributeToField($attribute) { @@ -50,7 +50,7 @@ abstract class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collec $field = $attribute->getAttributeCode(); } if (!$field) { - throw new \Magento\Core\Exception(__('We cannot determine the field name.')); + throw new \Magento\Model\Exception(__('We cannot determine the field name.')); } return $field; } diff --git a/app/code/Magento/Sales/Model/Resource/Helper.php b/app/code/Magento/Sales/Model/Resource/Helper.php index 371caba1fe5..503f30206f1 100644 --- a/app/code/Magento/Sales/Model/Resource/Helper.php +++ b/app/code/Magento/Sales/Model/Resource/Helper.php @@ -28,7 +28,7 @@ namespace Magento\Sales\Model\Resource; /** * Sales Mysql resource helper model */ -class Helper extends \Magento\Core\Model\Resource\Helper implements HelperInterface +class Helper extends \Magento\DB\Helper implements HelperInterface { /** * @var \Magento\Reports\Model\Resource\Helper diff --git a/app/code/Magento/Sales/Model/Resource/Order/AbstractOrder.php b/app/code/Magento/Sales/Model/Resource/Order/AbstractOrder.php index 811160d3298..88ee734ab87 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/AbstractOrder.php +++ b/app/code/Magento/Sales/Model/Resource/Order/AbstractOrder.php @@ -123,14 +123,14 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou * @param array $joinCondition * @param string $column * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addVirtualGridColumn($alias, $table, $joinCondition, $column) { $table = $this->getTable($table); if (!in_array($alias, $this->getGridColumns())) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please specify a valid grid column alias name that exists in the grid table.') ); } @@ -304,11 +304,11 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * Before save object attribute * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $attribute * @return $this */ - protected function _beforeSaveAttribute(\Magento\Core\Model\AbstractModel $object, $attribute) + protected function _beforeSaveAttribute(\Magento\Model\AbstractModel $object, $attribute) { if ($this->_eventObject && $this->_eventPrefix) { $this->_eventManager->dispatch( @@ -322,11 +322,11 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * After save object attribute * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $attribute * @return $this */ - protected function _afterSaveAttribute(\Magento\Core\Model\AbstractModel $object, $attribute) + protected function _afterSaveAttribute(\Magento\Model\AbstractModel $object, $attribute) { if ($this->_eventObject && $this->_eventPrefix) { $this->_eventManager->dispatch( @@ -340,12 +340,12 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $attribute * @return $this * @throws \Exception */ - public function saveAttribute(\Magento\Core\Model\AbstractModel $object, $attribute) + public function saveAttribute(\Magento\Model\AbstractModel $object, $attribute) { if ($attribute instanceof \Magento\Eav\Model\Entity\Attribute\AbstractAttribute) { $attribute = $attribute->getAttributeCode(); @@ -386,10 +386,10 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object + * @param \Magento\Model\AbstractModel|\Magento\Object $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if ($this->_useIncrementId && !$object->getIncrementId()) { /* @var $entityType \Magento\Eav\Model\Entity\Type */ @@ -403,7 +403,7 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * Update field in table if model have been already saved * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param array $data * @return $this */ @@ -437,10 +437,10 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * Save object data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function save(\Magento\Core\Model\AbstractModel $object) + public function save(\Magento\Model\AbstractModel $object) { if (!$object->getForceObjectSave()) { parent::save($object); diff --git a/app/code/Magento/Sales/Model/Resource/Order/Address.php b/app/code/Magento/Sales/Model/Resource/Order/Address.php index f2f0fede4ee..a577d1dceb3 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Address.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Address.php @@ -96,10 +96,10 @@ class Address extends AbstractOrder /** * Update related grid table after object save * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel|\Magento\Object $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $resource = parent::_afterSave($object); if ($object->hasDataChanges() && $object->getOrder()) { diff --git a/app/code/Magento/Sales/Model/Resource/Order/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Collection.php index 3cfffd52823..fdd1d301e76 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Collection.php @@ -49,7 +49,7 @@ class Collection extends \Magento\Sales\Model\Resource\Collection\AbstractCollec protected $_eventObject = 'order_collection'; /** - * @var \Magento\Core\Model\Resource\Helper + * @var \Magento\DB\Helper */ protected $_coreResourceHelper; @@ -58,18 +58,18 @@ class Collection extends \Magento\Sales\Model\Resource\Collection\AbstractCollec * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource\Helper $coreResourceHelper + * @param \Magento\DB\Helper $coreResourceHelper * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource\Helper $coreResourceHelper, + \Magento\DB\Helper $coreResourceHelper, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_coreResourceHelper = $coreResourceHelper; diff --git a/app/code/Magento/Sales/Model/Resource/Order/Comment/Collection/AbstractCollection.php b/app/code/Magento/Sales/Model/Resource/Order/Comment/Collection/AbstractCollection.php index f6ebf20e23b..2da874e2bed 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Comment/Collection/AbstractCollection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Comment/Collection/AbstractCollection.php @@ -37,12 +37,12 @@ abstract class AbstractCollection extends \Magento\Sales\Model\Resource\Collecti /** * Set filter on comments by their parent item * - * @param \Magento\Core\Model\AbstractModel|int $parent + * @param \Magento\Model\AbstractModel|int $parent * @return $this */ public function setParentFilter($parent) { - if ($parent instanceof \Magento\Core\Model\AbstractModel) { + if ($parent instanceof \Magento\Model\AbstractModel) { $parent = $parent->getId(); } return $this->addFieldToFilter('parent_id', $parent); diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php index 85c9d890139..88aabc71981 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php @@ -56,7 +56,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection\Abstract * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Sales\Model\Payment\Method\Converter $converter * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -65,7 +65,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection\Abstract \Magento\Event\ManagerInterface $eventManager, \Magento\Sales\Model\Payment\Method\Converter $converter, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_converter = $converter; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php index eed4b27bf03..6b8b37a381a 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php @@ -149,9 +149,9 @@ class Transaction extends \Magento\Sales\Model\Resource\Order\AbstractOrder * * @param \Magento\Sales\Model\Order\Payment\Transaction $transaction * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $transaction) + protected function _beforeSave(\Magento\Model\AbstractModel $transaction) { $parentTxnId = $transaction->getData('parent_txn_id'); $txnId = $transaction->getData('txn_id'); @@ -161,7 +161,7 @@ class Transaction extends \Magento\Sales\Model\Resource\Order\AbstractOrder if ($parentTxnId) { if (!$txnId || !$orderId || !$paymentId) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We don\'t have enough information to save the parent transaction ID.') ); } diff --git a/app/code/Magento/Sales/Model/Resource/Order/Status.php b/app/code/Magento/Sales/Model/Resource/Order/Status.php index ed588e9e645..6d91bcbc425 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Status.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Status.php @@ -25,7 +25,7 @@ */ namespace Magento\Sales\Model\Resource\Order; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Order status resource model @@ -34,7 +34,7 @@ use Magento\Core\Exception; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Status extends \Magento\Core\Model\Resource\Db\AbstractDb +class Status extends \Magento\Model\Resource\Db\AbstractDb { /** * Status labels table @@ -68,7 +68,7 @@ class Status extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Zend_Db_Select */ protected function _getLoadSelect($field, $value, $object) @@ -98,10 +98,10 @@ class Status extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Store labels getter * - * @param \Magento\Core\Model\AbstractModel $status + * @param \Magento\Model\AbstractModel $status * @return array */ - public function getStoreLabels(\Magento\Core\Model\AbstractModel $status) + public function getStoreLabels(\Magento\Model\AbstractModel $status) { $select = $this->_getWriteAdapter()->select()->from( $this->_labelsTable, @@ -116,10 +116,10 @@ class Status extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save status labels per store * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { if ($object->hasStoreLabels()) { $labels = $object->getStoreLabels(); diff --git a/app/code/Magento/Sales/Model/Resource/Order/Status/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Status/Collection.php index 3281a016465..7dfdb45f465 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Status/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Status/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Order\Status; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Internal constructor diff --git a/app/code/Magento/Sales/Model/Resource/Order/Tax.php b/app/code/Magento/Sales/Model/Resource/Order/Tax.php index 2621bdc0042..5dfb3898878 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Tax.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Tax.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Order; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Tax extends \Magento\Core\Model\Resource\Db\AbstractDb +class Tax extends \Magento\Model\Resource\Db\AbstractDb { /** * Model initialization diff --git a/app/code/Magento/Sales/Model/Resource/Order/Tax/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Tax/Collection.php index 0ec4a83d374..a0b8b62b2d0 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Tax/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Tax/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Order\Tax; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Model initialization diff --git a/app/code/Magento/Sales/Model/Resource/Quote.php b/app/code/Magento/Sales/Model/Resource/Quote.php index 86315534a03..f91148fa76f 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote.php +++ b/app/code/Magento/Sales/Model/Resource/Quote.php @@ -64,7 +64,7 @@ class Quote extends AbstractResource * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Magento\DB\Select */ protected function _getLoadSelect($field, $value, $object) diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Collection.php index c8ac0bec8a4..ab6add06a2c 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Quote\Address; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Event prefix diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Item/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Item/Collection.php index 5a2b2865b1c..97c29adde61 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Item/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Item/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Quote\Address\Item; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate/Collection.php index 33bcf0b1b40..0c443ff57f9 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Quote\Address\Rate; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Whether to load fixed items only @@ -48,7 +48,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -57,7 +57,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_carrierFactory = $carrierFactory; diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Collection.php index 1dd818e1f4f..6dbf74fda59 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Quote; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php index 4dc759dd399..c1104e0d42d 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Sales\Model\Resource\Quote\Item; /** * Quote item resource collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Collection quote instance @@ -68,7 +68,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param \Magento\Sales\Model\Quote\Config $quoteConfig * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -79,7 +79,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Sales\Model\Quote\Config $quoteConfig, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_itemOptionCollectionFactory = $itemOptionCollectionFactory; diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php b/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php index 0c86a58a15a..16bf507e9ec 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Quote\Item; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\Resource\Db\AbstractDb +class Option extends \Magento\Model\Resource\Db\AbstractDb { /** * Main table and field initialization diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Item/Option/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Item/Option/Collection.php index fec5db123f8..12317cf9273 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Item/Option/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Item/Option/Collection.php @@ -34,7 +34,7 @@ use Magento\Sales\Model\Quote\Item; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Array of option ids grouped by item id diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Payment/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Payment/Collection.php index a263d08cade..d51b2472923 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Payment/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Payment/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Sales\Model\Resource\Quote\Payment; /** * Quote payments collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var \Magento\Sales\Model\Payment\Method\Converter @@ -42,7 +42,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Sales\Model\Payment\Method\Converter $converter * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -51,7 +51,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Sales\Model\Payment\Method\Converter $converter, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_converter = $converter; diff --git a/app/code/Magento/Sales/Model/Resource/Report.php b/app/code/Magento/Sales/Model/Resource/Report.php index bffc8c5a144..b2161eae0d3 100644 --- a/app/code/Magento/Sales/Model/Resource/Report.php +++ b/app/code/Magento/Sales/Model/Resource/Report.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Report extends \Magento\Core\Model\Resource\Db\AbstractDb +class Report extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Sales/Model/Service/Quote.php b/app/code/Magento/Sales/Model/Service/Quote.php index 88fa030eaa6..fd453a22aab 100755 --- a/app/code/Magento/Sales/Model/Service/Quote.php +++ b/app/code/Magento/Sales/Model/Service/Quote.php @@ -82,7 +82,7 @@ class Quote protected $_customerSession; /** - * @var \Magento\Core\Model\Resource\TransactionFactory + * @var \Magento\DB\TransactionFactory */ protected $_transactionFactory; @@ -118,7 +118,7 @@ class Quote * @param \Magento\Sales\Model\Quote $quote * @param \Magento\Sales\Model\Convert\QuoteFactory $convertQuoteFactory * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Core\Model\Resource\TransactionFactory $transactionFactory + * @param \Magento\DB\TransactionFactory $transactionFactory * @param CustomerAccountServiceInterface $customerAccountService * @param CustomerAddressServiceInterface $customerAddressService * @param AddressBuilder $customerAddressBuilder @@ -130,7 +130,7 @@ class Quote \Magento\Sales\Model\Quote $quote, \Magento\Sales\Model\Convert\QuoteFactory $convertQuoteFactory, \Magento\Customer\Model\Session $customerSession, - \Magento\Core\Model\Resource\TransactionFactory $transactionFactory, + \Magento\DB\TransactionFactory $transactionFactory, CustomerAccountServiceInterface $customerAccountService, CustomerAddressServiceInterface $customerAddressService, AddressBuilder $customerAddressBuilder, @@ -410,10 +410,6 @@ class Quote ); throw $e; } - $this->_eventManager->dispatch( - 'sales_model_service_quote_submit_after', - array('order' => $order, 'quote' => $quote) - ); $this->_order = $order; return $order; } @@ -516,7 +512,7 @@ class Quote * Validate quote data before converting to order * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validate() { @@ -524,26 +520,26 @@ class Quote $address = $this->getQuote()->getShippingAddress(); $addressValidation = $address->validate(); if ($addressValidation !== true) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please check the shipping address information. %1', implode(' ', $addressValidation)) ); } $method = $address->getShippingMethod(); $rate = $address->getShippingRateByCode($method); if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) { - throw new \Magento\Core\Exception(__('Please specify a shipping method.')); + throw new \Magento\Model\Exception(__('Please specify a shipping method.')); } } $addressValidation = $this->getQuote()->getBillingAddress()->validate(); if ($addressValidation !== true) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please check the billing address information. %1', implode(' ', $addressValidation)) ); } if (!$this->getQuote()->getPayment()->getMethod()) { - throw new \Magento\Core\Exception(__('Please select a valid payment method.')); + throw new \Magento\Model\Exception(__('Please select a valid payment method.')); } return $this; diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index c0c1b5e76af..e6599110d75 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -69,4 +69,14 @@ </argument> </arguments> </type> + <type name="Magento\Model\ActionValidator\RemoveAction"> + <arguments> + <argument name="protectedModels" xsi:type="array"> + <item name="salesOrder" xsi:type="string">Magento\Sales\Model\Order</item> + <item name="salesOrderCreditmemo" xsi:type="string">Magento\Sales\Model\Order\Creditmemo</item> + <item name="salesOrderInvoice" xsi:type="string">Magento\Sales\Model\Order\Invoice</item> + <item name="salesOrderShipment" xsi:type="string">Magento\Sales\Model\Order\Shipment</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php index 9c83226309c..6e9b76239cd 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php @@ -186,7 +186,7 @@ class Quote extends \Magento\Backend\App\Action if ($id) { $model->load($id); if ($id != $model->getId()) { - throw new \Magento\Core\Exception(__('The wrong rule is specified.')); + throw new \Magento\Model\Exception(__('The wrong rule is specified.')); } } @@ -233,7 +233,7 @@ class Quote extends \Magento\Backend\App\Action } $this->_redirect('sales_rule/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $id = (int)$this->getRequest()->getParam('rule_id'); if (!empty($id)) { @@ -271,7 +271,7 @@ class Quote extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('The rule has been deleted.')); $this->_redirect('sales_rule/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError( @@ -492,7 +492,7 @@ class Quote extends \Magento\Backend\App\Action $this->_view->getLayout()->initMessages(); $result['messages'] = $this->_view->getLayout()->getMessagesBlock()->getGroupedHtml(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result['error'] = $e->getMessage(); } catch (\Exception $e) { $result['error'] = __( diff --git a/app/code/Magento/SalesRule/Model/Coupon.php b/app/code/Magento/SalesRule/Model/Coupon.php index 23cf86b4a12..5f89e4d5c90 100644 --- a/app/code/Magento/SalesRule/Model/Coupon.php +++ b/app/code/Magento/SalesRule/Model/Coupon.php @@ -47,7 +47,7 @@ namespace Magento\SalesRule\Model; * @method int getType() * @method \Magento\SalesRule\Model\Coupon setType(int $value) */ -class Coupon extends \Magento\Core\Model\AbstractModel +class Coupon extends \Magento\Model\AbstractModel { /** * Coupon's owner rule instance diff --git a/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php b/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php index 23273b387bc..001f9d6ba9c 100644 --- a/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php +++ b/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php @@ -34,7 +34,7 @@ namespace Magento\SalesRule\Model\Coupon; * @package Magento_SalesRule * @author Magento Core Team <core@magentocommerce.com> */ -class Massgenerator extends \Magento\Core\Model\AbstractModel implements +class Massgenerator extends \Magento\Model\AbstractModel implements \Magento\SalesRule\Model\Coupon\CodegeneratorInterface { /** @@ -79,7 +79,7 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel implements * @param \Magento\SalesRule\Model\CouponFactory $couponFactory * @param \Magento\Stdlib\DateTime\DateTime $date * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -90,7 +90,7 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel implements \Magento\SalesRule\Model\CouponFactory $couponFactory, \Magento\Stdlib\DateTime\DateTime $date, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -161,7 +161,7 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel implements /** * Generate Coupons Pool * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function generatePool() @@ -195,7 +195,7 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel implements $attempt = 0; do { if ($attempt >= $maxAttempts) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We cannot create the requested Coupon Qty. Please check your settings and try again.') ); } diff --git a/app/code/Magento/SalesRule/Model/Resource/Coupon.php b/app/code/Magento/SalesRule/Model/Resource/Coupon.php index e41c343bdeb..9bbf7e3559f 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Coupon.php +++ b/app/code/Magento/SalesRule/Model/Resource/Coupon.php @@ -25,7 +25,7 @@ */ namespace Magento\SalesRule\Model\Resource; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * SalesRule Resource Coupon @@ -34,7 +34,7 @@ use Magento\Core\Model\AbstractModel; * @package Magento_SalesRule * @author Magento Core Team <core@magentocommerce.com> */ -class Coupon extends \Magento\Core\Model\Resource\Db\AbstractDb +class Coupon extends \Magento\Model\Resource\Db\AbstractDb { /** * Constructor adds unique fields diff --git a/app/code/Magento/SalesRule/Model/Resource/Coupon/Collection.php b/app/code/Magento/SalesRule/Model/Resource/Coupon/Collection.php index 866b2b5395b..0a7c5125bda 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Coupon/Collection.php +++ b/app/code/Magento/SalesRule/Model/Resource/Coupon/Collection.php @@ -25,7 +25,7 @@ */ namespace Magento\SalesRule\Model\Resource\Coupon; -use Magento\Core\Model\Resource\Db\Collection\AbstractCollection; +use Magento\Model\Resource\Db\Collection\AbstractCollection; use Magento\Backend\Block\Widget\Grid\Column; use Magento\SalesRule\Model\Rule; diff --git a/app/code/Magento/SalesRule/Model/Resource/Coupon/Usage.php b/app/code/Magento/SalesRule/Model/Resource/Coupon/Usage.php index dabbf0a0fcf..18f8dc6cc57 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Coupon/Usage.php +++ b/app/code/Magento/SalesRule/Model/Resource/Coupon/Usage.php @@ -32,7 +32,7 @@ namespace Magento\SalesRule\Model\Resource\Coupon; * @package Magento_SalesRule * @author Magento Core Team <core@magentocommerce.com> */ -class Usage extends \Magento\Core\Model\Resource\Db\AbstractDb +class Usage extends \Magento\Model\Resource\Db\AbstractDb { /** * Constructor @@ -104,7 +104,7 @@ class Usage extends \Magento\Core\Model\Resource\Db\AbstractDb $object->setData($data); } } - if ($object instanceof \Magento\Core\Model\AbstractModel) { + if ($object instanceof \Magento\Model\AbstractModel) { $this->_afterLoad($object); } return $this; diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule.php b/app/code/Magento/SalesRule/Model/Resource/Rule.php index 852115887b8..c864da287b3 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule.php @@ -25,7 +25,7 @@ */ namespace Magento\SalesRule\Model\Resource; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Sales Rule resource model diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php b/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php index 911a75799c2..bf38d356c03 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php @@ -64,7 +64,7 @@ class Collection extends \Magento\Rule\Model\Resource\Rule\Collection\AbstractCo * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Stdlib\DateTime\DateTime $date * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -73,7 +73,7 @@ class Collection extends \Magento\Rule\Model\Resource\Rule\Collection\AbstractCo \Magento\Event\ManagerInterface $eventManager, \Magento\Stdlib\DateTime\DateTime $date, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_date = $date; diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule/Customer.php b/app/code/Magento/SalesRule/Model/Resource/Rule/Customer.php index 50f387a1ee8..ee72b972dac 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule/Customer.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule/Customer.php @@ -32,7 +32,7 @@ namespace Magento\SalesRule\Model\Resource\Rule; * @package Magento_SalesRule * @author Magento Core Team <core@magentocommerce.com> */ -class Customer extends \Magento\Core\Model\Resource\Db\AbstractDb +class Customer extends \Magento\Model\Resource\Db\AbstractDb { /** * Constructor diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule/Customer/Collection.php b/app/code/Magento/SalesRule/Model/Resource/Rule/Customer/Collection.php index b56263f4905..264ec080061 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule/Customer/Collection.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule/Customer/Collection.php @@ -32,7 +32,7 @@ namespace Magento\SalesRule\Model\Resource\Rule\Customer; * @package Magento_SalesRule * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Collection constructor diff --git a/app/code/Magento/SalesRule/Model/Rule.php b/app/code/Magento/SalesRule/Model/Rule.php index f5124c4aeb0..bc164513f1c 100644 --- a/app/code/Magento/SalesRule/Model/Rule.php +++ b/app/code/Magento/SalesRule/Model/Rule.php @@ -210,7 +210,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param \Magento\SalesRule\Model\Rule\Condition\Product\CombineFactory $condProdCombineF * @param \Magento\SalesRule\Model\Resource\Coupon\Collection $couponCollection * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -225,7 +225,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel \Magento\SalesRule\Model\Rule\Condition\Product\CombineFactory $condProdCombineF, \Magento\SalesRule\Model\Resource\Coupon\Collection $couponCollection, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -463,7 +463,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param bool $saveNewlyCreated Whether or not to save newly created coupon * @param int $saveAttemptCount Number of attempts to save newly created coupon * @return \Magento\SalesRule\Model\Coupon|null - * @throws \Exception|\Magento\Core\Exception + * @throws \Exception|\Magento\Model\Exception */ public function acquireCoupon($saveNewlyCreated = true, $saveAttemptCount = 10) { @@ -498,7 +498,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel try { $coupon->save(); } catch (\Exception $e) { - if ($e instanceof \Magento\Core\Exception || $coupon->getId()) { + if ($e instanceof \Magento\Model\Exception || $coupon->getId()) { throw $e; } $coupon->setCode( @@ -511,7 +511,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel } } if (!$ok) { - throw new \Magento\Core\Exception(__('Can\'t acquire coupon.')); + throw new \Magento\Model\Exception(__('Can\'t acquire coupon.')); } return $coupon; diff --git a/app/code/Magento/SalesRule/Model/Rule/Customer.php b/app/code/Magento/SalesRule/Model/Rule/Customer.php index c518d47ec5e..fb9a3b7a482 100644 --- a/app/code/Magento/SalesRule/Model/Rule/Customer.php +++ b/app/code/Magento/SalesRule/Model/Rule/Customer.php @@ -41,7 +41,7 @@ namespace Magento\SalesRule\Model\Rule; * @package Magento_SalesRule * @author Magento Core Team <core@magentocommerce.com> */ -class Customer extends \Magento\Core\Model\AbstractModel +class Customer extends \Magento\Model\AbstractModel { /** * Constructor diff --git a/app/code/Magento/SalesRule/Model/Validator.php b/app/code/Magento/SalesRule/Model/Validator.php index 5e3fc61af08..8a82a78ec37 100644 --- a/app/code/Magento/SalesRule/Model/Validator.php +++ b/app/code/Magento/SalesRule/Model/Validator.php @@ -40,7 +40,7 @@ use Magento\Sales\Model\Quote\Address; * @method mixed getCustomerGroupId() * @method \Magento\SalesRule\Model\Validator setCustomerGroupId($id) */ -class Validator extends \Magento\Core\Model\AbstractModel +class Validator extends \Magento\Model\AbstractModel { /** * Rule source collection @@ -129,7 +129,7 @@ class Validator extends \Magento\Core\Model\AbstractModel * @param \Magento\SalesRule\Model\CouponFactory $couponFactory * @param \Magento\SalesRule\Model\Rule\CustomerFactory $customerFactory * @param \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -142,7 +142,7 @@ class Validator extends \Magento\Core\Model\AbstractModel \Magento\SalesRule\Model\CouponFactory $couponFactory, \Magento\SalesRule\Model\Rule\CustomerFactory $customerFactory, \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -773,12 +773,12 @@ class Validator extends \Magento\Core\Model\AbstractModel /** * @param int $key * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getRuleItemTotalsInfo($key) { if (empty($this->_rulesItemTotals[$key])) { - throw new \Magento\Core\Exception(__('Item totals are not set for the rule.')); + throw new \Magento\Model\Exception(__('Item totals are not set for the rule.')); } return $this->_rulesItemTotals[$key]; diff --git a/app/code/Magento/Sendfriend/Controller/Product.php b/app/code/Magento/Sendfriend/Controller/Product.php index b3f8e653036..722509b8813 100644 --- a/app/code/Magento/Sendfriend/Controller/Product.php +++ b/app/code/Magento/Sendfriend/Controller/Product.php @@ -240,7 +240,7 @@ class Product extends \Magento\App\Action\Action $this->messageManager->addError(__('We found some problems with the data.')); } } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Some emails were not sent.')); diff --git a/app/code/Magento/Sendfriend/Model/Resource/Sendfriend.php b/app/code/Magento/Sendfriend/Model/Resource/Sendfriend.php index 1d4eb4028e8..5c470a58e6d 100644 --- a/app/code/Magento/Sendfriend/Model/Resource/Sendfriend.php +++ b/app/code/Magento/Sendfriend/Model/Resource/Sendfriend.php @@ -32,7 +32,7 @@ namespace Magento\Sendfriend\Model\Resource; * @package Magento_Sendfriend * @author Magento Core Team <core@magentocommerce.com> */ -class Sendfriend extends \Magento\Core\Model\Resource\Db\AbstractDb +class Sendfriend extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and table diff --git a/app/code/Magento/Sendfriend/Model/Resource/Sendfriend/Collection.php b/app/code/Magento/Sendfriend/Model/Resource/Sendfriend/Collection.php index 23b1bae0a5e..91f3ae54fbe 100644 --- a/app/code/Magento/Sendfriend/Model/Resource/Sendfriend/Collection.php +++ b/app/code/Magento/Sendfriend/Model/Resource/Sendfriend/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sendfriend\Model\Resource\Sendfriend; * @package Magento_Sendfriend * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init resource collection diff --git a/app/code/Magento/Sendfriend/Model/Sendfriend.php b/app/code/Magento/Sendfriend/Model/Sendfriend.php index d41f8db64d5..da257a10f5a 100644 --- a/app/code/Magento/Sendfriend/Model/Sendfriend.php +++ b/app/code/Magento/Sendfriend/Model/Sendfriend.php @@ -25,7 +25,7 @@ */ namespace Magento\Sendfriend\Model; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; /** * SendFriend Log @@ -41,7 +41,7 @@ use Magento\Core\Exception as CoreException; * @package Magento_Sendfriend * @author Magento Core Team <core@magentocommerce.com> */ -class Sendfriend extends \Magento\Core\Model\AbstractModel +class Sendfriend extends \Magento\Model\AbstractModel { /** * Recipient Names @@ -114,16 +114,21 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel */ protected $_escaper; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\TranslateInterface $translate * @param \Magento\Catalog\Helper\Image $catalogImage * @param \Magento\Sendfriend\Helper\Data $sendfriendData * @param \Magento\Escaper $escaper - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -132,20 +137,20 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\TranslateInterface $translate, \Magento\Catalog\Helper\Image $catalogImage, \Magento\Sendfriend\Helper\Data $sendfriendData, \Magento\Escaper $escaper, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Translate\Inline\StateInterface $inlineTranslation, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_storeManager = $storeManager; $this->_transportBuilder = $transportBuilder; - $this->_translate = $translate; $this->_catalogImage = $catalogImage; $this->_sendfriendData = $sendfriendData; $this->_escaper = $escaper; + $this->inlineTranslation = $inlineTranslation; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -166,13 +171,12 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel public function send() { if ($this->isExceedLimit()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('You\'ve met your limit of %1 sends in an hour.', $this->getMaxSendsToFriend()) ); } - $translate = $this->_translate->getTranslateInline(); - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $message = nl2br(htmlspecialchars($this->getSender()->getMessage())); $sender = array( @@ -209,7 +213,9 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); } - $this->_translate->setTranslateInline($translate); + + $this->inlineTranslation->resume(); + $this->_incrementSentCount(); return $this; @@ -277,14 +283,14 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel /** * Retrieve Cookie instance * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Stdlib\Cookie */ public function getCookie() { $cookie = $this->_getData('_cookie'); if (!$cookie instanceof \Magento\Stdlib\Cookie) { - throw new \Magento\Core\Exception(__('Please define a correct Cookie instance.')); + throw new \Magento\Model\Exception(__('Please define a correct Cookie instance.')); } return $cookie; } @@ -402,14 +408,14 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel /** * Retrieve Product instance * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Catalog\Model\Product */ public function getProduct() { $product = $this->_getData('_product'); if (!$product instanceof \Magento\Catalog\Model\Product) { - throw new \Magento\Core\Exception(__('Please define a correct Product instance.')); + throw new \Magento\Model\Exception(__('Please define a correct Product instance.')); } return $product; } @@ -432,14 +438,14 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel /** * Retrieve Sender Information Object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Object */ public function getSender() { $sender = $this->_getData('_sender'); if (!$sender instanceof \Magento\Object) { - throw new \Magento\Core\Exception(__('Please define the correct Sender information.')); + throw new \Magento\Model\Exception(__('Please define the correct Sender information.')); } return $sender; } @@ -590,8 +596,8 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel */ public function register() { - if (!$this->_coreRegistry->registry('send_to_friend_model')) { - $this->_coreRegistry->register('send_to_friend_model', $this); + if (!$this->_registry->registry('send_to_friend_model')) { + $this->_registry->register('send_to_friend_model', $this); } return $this; } diff --git a/app/code/Magento/Service/Exception.php b/app/code/Magento/Service/Exception.php index 3fc43d9f340..9173ba42eac 100644 --- a/app/code/Magento/Service/Exception.php +++ b/app/code/Magento/Service/Exception.php @@ -25,7 +25,7 @@ */ namespace Magento\Service; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { /** @var array */ protected $_parameters; diff --git a/app/code/Magento/Service/etc/module.xml b/app/code/Magento/Service/etc/module.xml index 128941add1d..38cd40bff9e 100644 --- a/app/code/Magento/Service/etc/module.xml +++ b/app/code/Magento/Service/etc/module.xml @@ -24,12 +24,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> - <module name="Magento_Service" version="1.0.0.0" active="true"> - <sequence> - <module name="Magento_Core"/> - </sequence> - <depends> - <module name="Magento_Core"/> - </depends> - </module> + <module name="Magento_Service" version="1.0.0.0" active="true" /> </config> diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php index 28e4d7ad1d9..674845c9ff8 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php @@ -88,7 +88,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip /** * Initialize shipment model instance * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Sales\Model\Order\Shipment|bool */ protected function _initShipment() @@ -136,7 +136,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip if ($tracks) { foreach ($tracks as $data) { if (empty($data['number'])) { - throw new \Magento\Core\Exception(__('Please enter a tracking number.')); + throw new \Magento\Model\Exception(__('Please enter a tracking number.')); } $track = $this->_objectManager->create('Magento\Sales\Model\Order\Shipment\Track')->addData($data); $shipment->addTrack($track); @@ -158,7 +158,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip { $shipment->getOrder()->setIsInProcess(true); $transactionSave = $this->_objectManager->create( - 'Magento\Core\Model\Resource\Transaction' + 'Magento\DB\Transaction' )->addObject( $shipment )->addObject( @@ -284,7 +284,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $isNeedCreateLabel ? $shipmentCreatedMessage . ' ' . $labelCreatedMessage : $shipmentCreatedMessage ); $this->_objectManager->get('Magento\Backend\Model\Session')->getCommentText(true); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($isNeedCreateLabel) { $responseAjax->setError(true); $responseAjax->setMessage($e->getMessage()); @@ -332,7 +332,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip } $this->messageManager->addSuccess(__('You sent the shipment.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Cannot send shipment information.')); @@ -344,7 +344,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip * Add new tracking number action * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addTrackAction() { @@ -353,10 +353,10 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $number = $this->getRequest()->getPost('number'); $title = $this->getRequest()->getPost('title'); if (empty($carrier)) { - throw new \Magento\Core\Exception(__('Please specify a carrier.')); + throw new \Magento\Model\Exception(__('Please specify a carrier.')); } if (empty($number)) { - throw new \Magento\Core\Exception(__('Please enter a tracking number.')); + throw new \Magento\Model\Exception(__('Please enter a tracking number.')); } $shipment = $this->_initShipment(); if ($shipment) { @@ -379,7 +379,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip 'message' => __('Cannot initialize shipment for adding tracking number.') ); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $response = array('error' => true, 'message' => __('Cannot add tracking number.')); @@ -435,7 +435,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $this->getRequest()->setParam('shipment_id', $this->getRequest()->getParam('id')); $data = $this->getRequest()->getPost('comment'); if (empty($data['comment'])) { - throw new \Magento\Core\Exception(__("The comment text field cannot be empty.")); + throw new \Magento\Model\Exception(__("The comment text field cannot be empty.")); } $shipment = $this->_initShipment(); $shipment->addComment( @@ -448,7 +448,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $this->_view->loadLayout(false); $response = $this->_view->getLayout()->getBlock('shipment_comments')->toHtml(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); $response = $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response); } catch (\Exception $e) { @@ -462,7 +462,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip * Create shipping label for specific shipment with validation. * * @param \Magento\Sales\Model\Order\Shipment $shipment - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ protected function _createShippingLabel(\Magento\Sales\Model\Order\Shipment $shipment) @@ -482,7 +482,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $shipment ); if ($response->hasErrors()) { - throw new \Magento\Core\Exception($response->getErrors()); + throw new \Magento\Model\Exception($response->getErrors()); } if (!$response->hasInfo()) { return false; @@ -537,7 +537,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $this->messageManager->addSuccess(__('You created the shipping label.')); $response->setOk(true); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response->setError(true); $response->setMessage($e->getMessage()); } catch (\Exception $e) { @@ -585,7 +585,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip 'application/pdf' ); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php index 4b05ad7bd5a..0917ea8b890 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php @@ -275,7 +275,7 @@ abstract class AbstractCarrier extends \Magento\Object implements AbstractCarrie /** * @param \Magento\Sales\Model\Quote\Address\RateRequest $request - * @return $this|bool|false|\Magento\Core\Model\AbstractModel + * @return $this|bool|false|\Magento\Model\AbstractModel */ public function checkAvailableShipCountries(\Magento\Sales\Model\Quote\Address\RateRequest $request) { diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php index ba94ee15e53..9d9cdd0634c 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php @@ -23,7 +23,7 @@ */ namespace Magento\Shipping\Model\Carrier; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Sales\Model\Quote\Address\RateRequest; use Magento\Sales\Model\Quote\Address\RateResult\Error; use Magento\Shipping\Model\Shipment\Request; diff --git a/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php b/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php index e02d2e73a81..37234cbc206 100644 --- a/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php +++ b/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php @@ -53,12 +53,12 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\TranslateInterface $translate * @param \Magento\App\Filesystem $filesystem * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\Shipping\Helper\Carrier $carrierHelper * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\View\LayoutInterface $layout @@ -71,12 +71,12 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\TranslateInterface $translate, \Magento\App\Filesystem $filesystem, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, Carrier $carrierHelper, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\View\LayoutInterface $layout, @@ -92,12 +92,12 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $paymentData, $string, $coreStoreConfig, - $translate, $filesystem, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, $localeDate, + $inlineTranslation, $data ); } diff --git a/app/code/Magento/Shipping/Model/Order/Track.php b/app/code/Magento/Shipping/Model/Order/Track.php index 158d3c6c2a0..3ae690d75a9 100644 --- a/app/code/Magento/Shipping/Model/Order/Track.php +++ b/app/code/Magento/Shipping/Model/Order/Track.php @@ -62,7 +62,7 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data * @@ -76,7 +76,7 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory, \Magento\Shipping\Model\CarrierFactory $carrierFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Shipping/Model/Shipping/Labels.php b/app/code/Magento/Shipping/Model/Shipping/Labels.php index 2daf195de20..a3d2e77ca16 100644 --- a/app/code/Magento/Shipping/Model/Shipping/Labels.php +++ b/app/code/Magento/Shipping/Model/Shipping/Labels.php @@ -85,7 +85,7 @@ class Labels extends \Magento\Shipping\Model\Shipping * * @param Shipment $orderShipment * @return \Magento\Object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function requestToShipment(Shipment $orderShipment) { @@ -97,7 +97,7 @@ class Labels extends \Magento\Shipping\Model\Shipping $shipmentCarrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); $baseCurrencyCode = $this->_storeManager->getStore($shipmentStoreId)->getBaseCurrencyCode(); if (!$shipmentCarrier) { - throw new \Magento\Core\Exception('Invalid carrier: ' . $shippingMethod->getCarrierCode()); + throw new \Magento\Model\Exception('Invalid carrier: ' . $shippingMethod->getCarrierCode()); } $shipperRegionCode = $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_REGION_ID, $shipmentStoreId); if (is_numeric($shipperRegionCode)) { @@ -129,7 +129,7 @@ class Labels extends \Magento\Shipping\Model\Shipping $shipmentStoreId ) ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'We don\'t have enough information to create shipping labels. Please make sure your store information and settings are complete.' ) diff --git a/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php b/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php index 698b03a3f57..5c1c4b9f560 100644 --- a/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php +++ b/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php @@ -301,7 +301,7 @@ class Sitemap extends \Magento\Backend\App\Action $this->messageManager->addSuccess( __('The sitemap "%1" has been generated.', $sitemap->getSitemapFilename()) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong generating the sitemap.')); diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php index 368300de98e..ee0a80569fe 100644 --- a/app/code/Magento/Sitemap/Model/Observer.php +++ b/app/code/Magento/Sitemap/Model/Observer.php @@ -75,34 +75,34 @@ class Observer protected $_transportBuilder; /** - * @var \Magento\TranslateInterface + * @var \Magento\Core\Model\StoreManagerInterface */ - protected $_translateModel; + protected $_storeManager; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Translate\Inline\StateInterface */ - protected $_storeManager; + protected $inlineTranslation; /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param Resource\Sitemap\CollectionFactory $collectionFactory - * @param \Magento\TranslateInterface $translateModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Mail\Template\TransportBuilder $transportBuilder + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Sitemap\Model\Resource\Sitemap\CollectionFactory $collectionFactory, - \Magento\TranslateInterface $translateModel, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Mail\Template\TransportBuilder $transportBuilder + \Magento\Mail\Template\TransportBuilder $transportBuilder, + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_coreStoreConfig = $coreStoreConfig; $this->_collectionFactory = $collectionFactory; - $this->_translateModel = $translateModel; $this->_storeManager = $storeManager; $this->_transportBuilder = $transportBuilder; + $this->inlineTranslation = $inlineTranslation; } /** @@ -133,8 +133,7 @@ class Observer } if ($errors && $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT)) { - $translate = $this->_translateModel->getTranslateInline(); - $this->_translateModel->setTranslateInline(false); + $this->inlineTranslation->suspend(); $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE) @@ -153,7 +152,7 @@ class Observer $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); - $this->_translateModel->setTranslateInline($translate); + $this->inlineTranslation->resume(); } } } diff --git a/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php b/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php index 2ed955eddec..c2abe1e58f9 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php +++ b/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php @@ -30,7 +30,7 @@ namespace Magento\Sitemap\Model\Resource\Catalog; * * @author Magento Core Team <core@magentocommerce.com> */ -class Category extends \Magento\Core\Model\Resource\Db\AbstractDb +class Category extends \Magento\Model\Resource\Db\AbstractDb { /** * Collection Zend Db select diff --git a/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php b/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php index d93916921a1..14b7f774cf5 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php @@ -30,7 +30,7 @@ namespace Magento\Sitemap\Model\Resource\Catalog; * * @author Magento Core Team <core@magentocommerce.com> */ -class Product extends \Magento\Core\Model\Resource\Db\AbstractDb +class Product extends \Magento\Model\Resource\Db\AbstractDb { const NOT_SELECTED_IMAGE = 'no_selection'; diff --git a/app/code/Magento/Sitemap/Model/Resource/Cms/Page.php b/app/code/Magento/Sitemap/Model/Resource/Cms/Page.php index 9bbddafa25e..d5bd7e03aad 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Cms/Page.php +++ b/app/code/Magento/Sitemap/Model/Resource/Cms/Page.php @@ -30,7 +30,7 @@ namespace Magento\Sitemap\Model\Resource\Cms; * * @author Magento Core Team <core@magentocommerce.com> */ -class Page extends \Magento\Core\Model\Resource\Db\AbstractDb +class Page extends \Magento\Model\Resource\Db\AbstractDb { /** * Init resource model (catalog/category) diff --git a/app/code/Magento/Sitemap/Model/Resource/Sitemap.php b/app/code/Magento/Sitemap/Model/Resource/Sitemap.php index 8ca469b8219..ada1a609e6b 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Resource/Sitemap.php @@ -30,7 +30,7 @@ namespace Magento\Sitemap\Model\Resource; * * @author Magento Core Team <core@magentocommerce.com> */ -class Sitemap extends \Magento\Core\Model\Resource\Db\AbstractDb +class Sitemap extends \Magento\Model\Resource\Db\AbstractDb { /** * Init resource model diff --git a/app/code/Magento/Sitemap/Model/Resource/Sitemap/Collection.php b/app/code/Magento/Sitemap/Model/Resource/Sitemap/Collection.php index 1f420341a78..998e10cad9f 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Sitemap/Collection.php +++ b/app/code/Magento/Sitemap/Model/Resource/Sitemap/Collection.php @@ -30,7 +30,7 @@ namespace Magento\Sitemap\Model\Resource\Sitemap; * * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init collection diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index 070d1e091d2..84870f3c64f 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -41,7 +41,7 @@ namespace Magento\Sitemap\Model; * @method int getStoreId() * @method \Magento\Sitemap\Model\Sitemap setStoreId(int $value) */ -class Sitemap extends \Magento\Core\Model\AbstractModel +class Sitemap extends \Magento\Model\AbstractModel { const OPEN_TAG_KEY = 'start'; @@ -172,7 +172,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\RequestInterface $request * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -189,7 +189,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\RequestInterface $request, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -220,14 +220,14 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * Get file handler * * @return \Magento\Filesystem\File\WriteInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getStream() { if ($this->_stream) { return $this->_stream; } else { - throw new \Magento\Core\Exception(__('File handler unreachable')); + throw new \Magento\Model\Exception(__('File handler unreachable')); } } @@ -289,8 +289,8 @@ class Sitemap extends \Magento\Core\Model\AbstractModel /** * Check sitemap file location and permissions * - * @return \Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return \Magento\Model\AbstractModel + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -300,13 +300,13 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * Check path is allow */ if ($path && preg_match('#\.\.[\\\/]#', $path)) { - throw new \Magento\Core\Exception(__('Please define a correct path.')); + throw new \Magento\Model\Exception(__('Please define a correct path.')); } /** * Check exists and writable path */ if (!$this->_directory->isExist($path)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Please create the specified folder "%1" before saving the sitemap.', $this->_escaper->escapeHtml($this->getSitemapPath()) @@ -315,7 +315,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel } if (!$this->_directory->isWritable($path)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please make sure that "%1" is writable by the web-server.', $this->getSitemapPath()) ); } @@ -323,7 +323,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * Check allow filename */ if (!preg_match('#^[a-zA-Z0-9_\.]+$#', $this->getSitemapFilename())) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Please use only letters (a-z or A-Z), numbers (0-9) or underscores (_) in the filename. No spaces or other characters are allowed.' ) @@ -523,7 +523,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * @param null|string $fileName * @param string $type * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _createSitemap($fileName = null, $type = self::TYPE_URL) { diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate.php index 0243046c5d2..c44192a20cb 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate.php @@ -132,7 +132,7 @@ class Rate extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('The tax rate has been saved.')); $this->getResponse()->setRedirect($this->getUrl("*/*/")); return true; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData($ratePost); $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { @@ -166,7 +166,7 @@ class Rate extends \Magento\Backend\App\Action 'code' => $rate->getCode() ) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $responseContent = $this->_objectManager->get( 'Magento\Core\Helper\Data' )->jsonEncode( @@ -275,7 +275,7 @@ class Rate extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('The tax rate has been deleted.')); $this->getResponse()->setRedirect($this->getUrl("*/*/")); return true; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong deleting this rate.')); @@ -312,7 +312,7 @@ class Rate extends \Magento\Backend\App\Action )->jsonEncode( array('success' => true, 'error_message' => '') ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $responseContent = $this->_objectManager->get( 'Magento\Core\Helper\Data' )->jsonEncode( @@ -408,7 +408,7 @@ class Rate extends \Magento\Backend\App\Action $importHandler->importFromCsvFile($this->getRequest()->getFiles('import_rates_file')); $this->messageManager->addSuccess(__('The tax rate has been imported.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Invalid file upload attempt')); diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rule.php b/app/code/Magento/Tax/Controller/Adminhtml/Rule.php index daab190806e..1d39bb8b3f9 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rule.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rule.php @@ -132,7 +132,7 @@ class Rule extends \Magento\Backend\App\Action $this->_redirect('tax/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong saving this tax rule.')); @@ -165,7 +165,7 @@ class Rule extends \Magento\Backend\App\Action $this->_redirect('tax/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong deleting this tax rule.')); diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Tax.php b/app/code/Magento/Tax/Controller/Adminhtml/Tax.php index aff2295fb2e..59a670231ee 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Tax.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Tax.php @@ -60,7 +60,7 @@ class Tax extends \Magento\Backend\App\Action 'class_name' => $class->getClassName() ) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $responseContent = $this->_objectManager->get( 'Magento\Core\Helper\Data' )->jsonEncode( @@ -99,7 +99,7 @@ class Tax extends \Magento\Backend\App\Action )->jsonEncode( array('success' => true, 'error_message' => '') ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $responseContent = $this->_objectManager->get( 'Magento\Core\Helper\Data' )->jsonEncode( @@ -120,7 +120,7 @@ class Tax extends \Magento\Backend\App\Action * * @param string $classType * @return string processed class type - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processClassType($classType) { @@ -129,7 +129,7 @@ class Tax extends \Magento\Backend\App\Action \Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_PRODUCT ); if (!in_array($classType, $validClassTypes)) { - throw new \Magento\Core\Exception(__('Invalid type of tax class specified.')); + throw new \Magento\Model\Exception(__('Invalid type of tax class specified.')); } return $classType; } @@ -139,13 +139,13 @@ class Tax extends \Magento\Backend\App\Action * * @param string $className * @return string processed class name - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processClassName($className) { $className = trim($this->_objectManager->get('Magento\Escaper')->escapeHtml($className)); if ($className == '') { - throw new \Magento\Core\Exception(__('Invalid name of tax class specified.')); + throw new \Magento\Model\Exception(__('Invalid name of tax class specified.')); } return $className; } diff --git a/app/code/Magento/Tax/Exception.php b/app/code/Magento/Tax/Exception.php index 7a464a47c23..a952e07d080 100644 --- a/app/code/Magento/Tax/Exception.php +++ b/app/code/Magento/Tax/Exception.php @@ -25,6 +25,6 @@ */ namespace Magento\Tax; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Tax/Model/Calculation.php b/app/code/Magento/Tax/Model/Calculation.php index 15a3fd5ba42..81df6986bf7 100644 --- a/app/code/Magento/Tax/Model/Calculation.php +++ b/app/code/Magento/Tax/Model/Calculation.php @@ -34,7 +34,7 @@ use Magento\Exception\NoSuchEntityException; /** * Tax Calculation Model */ -class Calculation extends \Magento\Core\Model\AbstractModel +class Calculation extends \Magento\Model\AbstractModel { const CALC_TAX_BEFORE_DISCOUNT_ON_EXCL = '0_0'; diff --git a/app/code/Magento/Tax/Model/Calculation/Rate.php b/app/code/Magento/Tax/Model/Calculation/Rate.php index b499ec2c182..ca25ab6f983 100644 --- a/app/code/Magento/Tax/Model/Calculation/Rate.php +++ b/app/code/Magento/Tax/Model/Calculation/Rate.php @@ -48,7 +48,7 @@ */ namespace Magento\Tax\Model\Calculation; -class Rate extends \Magento\Core\Model\AbstractModel +class Rate extends \Magento\Model\AbstractModel { /** * @var mixed @@ -75,7 +75,7 @@ class Rate extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Tax\Model\Calculation\Rate\TitleFactory $taxTitleFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -84,7 +84,7 @@ class Rate extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Tax\Model\Calculation\Rate\TitleFactory $taxTitleFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -107,7 +107,7 @@ class Rate extends \Magento\Core\Model\AbstractModel * Prepare location settings and tax postcode before save rate * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -119,11 +119,11 @@ class Rate extends \Magento\Core\Model\AbstractModel $this->getTaxPostcode() === ''; if ($isEmptyValues || $isWrongRange) { - throw new \Magento\Core\Exception(__('Please fill all required fields with valid information.')); + throw new \Magento\Model\Exception(__('Please fill all required fields with valid information.')); } if (!is_numeric($this->getRate()) || $this->getRate() <= 0) { - throw new \Magento\Core\Exception(__('Rate Percent should be a positive number.')); + throw new \Magento\Model\Exception(__('Rate Percent should be a positive number.')); } if ($this->getZipIsRange()) { @@ -131,15 +131,15 @@ class Rate extends \Magento\Core\Model\AbstractModel $zipTo = $this->getZipTo(); if (strlen($zipFrom) > 9 || strlen($zipTo) > 9) { - throw new \Magento\Core\Exception(__('Maximum zip code length is 9.')); + throw new \Magento\Model\Exception(__('Maximum zip code length is 9.')); } if (!is_numeric($zipFrom) || !is_numeric($zipTo) || $zipFrom < 0 || $zipTo < 0) { - throw new \Magento\Core\Exception(__('Zip code should not contain characters other than digits.')); + throw new \Magento\Model\Exception(__('Zip code should not contain characters other than digits.')); } if ($zipFrom > $zipTo) { - throw new \Magento\Core\Exception(__('Range To should be equal or greater than Range From.')); + throw new \Magento\Model\Exception(__('Range To should be equal or greater than Range From.')); } $this->setTaxPostcode($zipFrom . '-' . $zipTo); @@ -181,12 +181,12 @@ class Rate extends \Magento\Core\Model\AbstractModel * Processing object before delete data * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeDelete() { if ($this->_isInRule()) { - throw new \Magento\Core\Exception(__('The tax rate cannot be removed. It exists in a tax rule.')); + throw new \Magento\Model\Exception(__('The tax rate cannot be removed. It exists in a tax rule.')); } return parent::_beforeDelete(); } diff --git a/app/code/Magento/Tax/Model/Calculation/Rate/Title.php b/app/code/Magento/Tax/Model/Calculation/Rate/Title.php index 92e3274cd4b..c40924e23ba 100644 --- a/app/code/Magento/Tax/Model/Calculation/Rate/Title.php +++ b/app/code/Magento/Tax/Model/Calculation/Rate/Title.php @@ -43,7 +43,7 @@ */ namespace Magento\Tax\Model\Calculation\Rate; -class Title extends \Magento\Core\Model\AbstractModel +class Title extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Tax/Model/Calculation/Rule.php b/app/code/Magento/Tax/Model/Calculation/Rule.php index 82c9f670f67..eb198bd8829 100644 --- a/app/code/Magento/Tax/Model/Calculation/Rule.php +++ b/app/code/Magento/Tax/Model/Calculation/Rule.php @@ -38,7 +38,7 @@ */ namespace Magento\Tax\Model\Calculation; -class Rule extends \Magento\Core\Model\AbstractModel +class Rule extends \Magento\Model\AbstractModel { /** * @var mixed @@ -102,7 +102,7 @@ class Rule extends \Magento\Core\Model\AbstractModel * @param \Magento\Tax\Helper\Data $taxHelper * @param \Magento\Tax\Model\ClassModel $taxClass * @param \Magento\Tax\Model\Calculation $calculation - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -112,7 +112,7 @@ class Rule extends \Magento\Core\Model\AbstractModel \Magento\Tax\Helper\Data $taxHelper, \Magento\Tax\Model\ClassModel $taxClass, \Magento\Tax\Model\Calculation $calculation, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Tax/Model/ClassModel.php b/app/code/Magento/Tax/Model/ClassModel.php index 747a906ba2a..f07cdec6488 100644 --- a/app/code/Magento/Tax/Model/ClassModel.php +++ b/app/code/Magento/Tax/Model/ClassModel.php @@ -40,7 +40,7 @@ */ namespace Magento\Tax\Model; -class ClassModel extends \Magento\Core\Model\AbstractModel +class ClassModel extends \Magento\Model\AbstractModel { /** * Defines Customer Tax Class string @@ -61,7 +61,7 @@ class ClassModel extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Tax\Model\TaxClass\Factory $classFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -69,7 +69,7 @@ class ClassModel extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Tax\Model\TaxClass\Factory $classFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -89,18 +89,18 @@ class ClassModel extends \Magento\Core\Model\AbstractModel * Check whether this class can be deleted * * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function checkClassCanBeDeleted() { if (!$this->getId()) { - throw new \Magento\Core\Exception(__('This class no longer exists.')); + throw new \Magento\Model\Exception(__('This class no longer exists.')); } $typeModel = $this->_classFactory->create($this); if ($typeModel->getAssignedToRules()->getSize() > 0) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'You cannot delete this tax class because it is used in Tax Rules. You have to delete the rules it is used in first.' ) @@ -109,7 +109,7 @@ class ClassModel extends \Magento\Core\Model\AbstractModel $objectCount = $typeModel->getAssignedToObjects()->getSize(); if ($objectCount > 0) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'You cannot delete this tax class because it is used for %1 %2(s).', $objectCount, diff --git a/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php b/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php index 2bd94c85d54..ccc51315ddf 100644 --- a/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php +++ b/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php @@ -27,41 +27,12 @@ namespace Magento\Tax\Model\Config\Price; class IncludePrice extends \Magento\Core\Model\Config\Value { - /** - * @var \Magento\Core\Model\App - */ - protected $_app; - - /** - * @param \Magento\Model\Context $context - * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\App $app - * @param \Magento\Core\Model\Resource\AbstractResource $resource - * @param \Magento\Data\Collection\Db $resourceCollection - * @param array $data - */ - public function __construct( - \Magento\Model\Context $context, - \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\App $app, - \Magento\Core\Model\Resource\AbstractResource $resource = null, - \Magento\Data\Collection\Db $resourceCollection = null, - array $data = array() - ) { - $this->_app = $app; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); - } - /** * @return void */ public function _afterSave() { parent::_afterSave(); - $this->_app->cleanCache('checkout_quote'); + $this->_cacheManager->clean(array('checkout_quote')); } } diff --git a/app/code/Magento/Tax/Model/Rate/CsvImportHandler.php b/app/code/Magento/Tax/Model/Rate/CsvImportHandler.php index 1069d3aaa8c..95b4df47ab0 100644 --- a/app/code/Magento/Tax/Model/Rate/CsvImportHandler.php +++ b/app/code/Magento/Tax/Model/Rate/CsvImportHandler.php @@ -105,12 +105,12 @@ class CsvImportHandler * * @param array $file file info retrieved from $_FILES array * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function importFromCsvFile($file) { if (!isset($file['tmp_name'])) { - throw new \Magento\Core\Exception('Invalid file upload attempt.'); + throw new \Magento\Model\Exception('Invalid file upload attempt.'); } $csvProcessor = new \Magento\File\Csv(); $ratesRawData = $csvProcessor->getData($file['tmp_name']); @@ -162,7 +162,7 @@ class CsvImportHandler * @param array $invalidFields assoc array of invalid file fields * @param array $validFields assoc array of valid file fields * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _filterRateData(array $rateRawData, array $invalidFields, array $validFields) { @@ -181,7 +181,7 @@ class CsvImportHandler } // check if number of fields in row match with number of valid fields if (count($rateRawData[$rowIndex]) != $validFieldsNum) { - throw new \Magento\Core\Exception('Invalid file format.'); + throw new \Magento\Model\Exception('Invalid file format.'); } } return $rateRawData; @@ -237,7 +237,7 @@ class CsvImportHandler * @param array $regionsCache cache of regions of already used countries (is used to optimize performance) * @param array $storesCache cache of stores related to tax rate titles * @return array regions cache populated with regions related to country of imported tax rate - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _importRate(array $rateData, array $regionsCache, array $storesCache) { @@ -245,7 +245,7 @@ class CsvImportHandler $countryCode = $rateData[1]; $country = $this->_countryFactory->create()->loadByCode($countryCode, 'iso2_code'); if (!$country->getId()) { - throw new \Magento\Core\Exception('One of the countries has invalid code.'); + throw new \Magento\Model\Exception('One of the countries has invalid code.'); } $regionsCache = $this->_addCountryRegionsToCache($countryCode, $regionsCache); diff --git a/app/code/Magento/Tax/Model/Resource/Calculation.php b/app/code/Magento/Tax/Model/Resource/Calculation.php index b8efcbf4f01..f8bc44628f8 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation.php @@ -30,7 +30,7 @@ */ namespace Magento\Tax\Model\Resource; -class Calculation extends \Magento\Core\Model\Resource\Db\AbstractDb +class Calculation extends \Magento\Model\Resource\Db\AbstractDb { /** * Rates cache diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Collection.php b/app/code/Magento/Tax/Model/Resource/Calculation/Collection.php index 5550a1b8525..24b5e4f9f4d 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Calculation; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rate.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rate.php index 6e8ce866f12..0c13b00a151 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rate.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rate.php @@ -34,7 +34,7 @@ */ namespace Magento\Tax\Model\Resource\Calculation; -class Rate extends \Magento\Core\Model\Resource\Db\AbstractDb +class Rate extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php index ed9c571b44f..a0f99155e93 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php @@ -30,7 +30,7 @@ */ namespace Magento\Tax\Model\Resource\Calculation\Rate; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var \Magento\Core\Model\StoreManagerInterface @@ -44,7 +44,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -53,7 +53,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); @@ -186,12 +186,16 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * Convert items array to hash for select options * using fetchItem method * - * @see _toOptionHashOptimized() + * @see fetchItem() * * @return array */ public function toOptionHashOptimized() { - return $this->_toOptionHashOptimized('tax_calculation_rate_id', 'code'); + $result = array(); + while ($item = $this->fetchItem()) { + $result[$item->getData('tax_calculation_rate_id')] = $item->getData('code'); + } + return $result; } } diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title.php index 49f3360d99d..e22349a3f0e 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Calculation\Rate; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Title extends \Magento\Core\Model\Resource\Db\AbstractDb +class Title extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title/Collection.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title/Collection.php index 6c75b33a810..e4074426861 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Calculation\Rate\Title; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rule.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rule.php index e04ea361e59..43339527ab2 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rule.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rule.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Calculation; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Rule extends \Magento\Core\Model\Resource\Db\AbstractDb +class Rule extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rule/Collection.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rule/Collection.php index 99fb35d7dce..7bbb2f3ce2c 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rule/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rule/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Calculation\Rule; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization @@ -151,7 +151,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param string $type * @param int $id * @return \Magento\Tax\Model\Resource\Calculation\Rule\Collection - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setClassTypeFilter($type, $id) { @@ -163,7 +163,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl $field = 'cd.customer_tax_class_id'; break; default: - throw new \Magento\Core\Exception('Invalid type supplied'); + throw new \Magento\Model\Exception('Invalid type supplied'); } $this->joinCalculationData('cd'); diff --git a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax.php b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax.php index b872b74b673..2a66756efc0 100644 --- a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax.php +++ b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Sales\Order; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Tax extends \Magento\Core\Model\Resource\Db\AbstractDb +class Tax extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Collection.php b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Collection.php index ca675d95e33..def135c52a3 100644 --- a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Sales\Order\Tax; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item.php b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item.php index 22331e4030a..7eada36bf69 100644 --- a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item.php +++ b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item.php @@ -34,7 +34,7 @@ */ namespace Magento\Tax\Model\Resource\Sales\Order\Tax; -class Item extends \Magento\Core\Model\Resource\Db\AbstractDb +class Item extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item/Collection.php b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item/Collection.php index 989bdf0ba75..e865c06f206 100644 --- a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Sales\Order\Tax\Item; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource diff --git a/app/code/Magento/Tax/Model/Resource/TaxClass.php b/app/code/Magento/Tax/Model/Resource/TaxClass.php index 97e2c11c939..7e97af80be5 100644 --- a/app/code/Magento/Tax/Model/Resource/TaxClass.php +++ b/app/code/Magento/Tax/Model/Resource/TaxClass.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class TaxClass extends \Magento\Core\Model\Resource\Db\AbstractDb +class TaxClass extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/TaxClass/Collection.php b/app/code/Magento/Tax/Model/Resource/TaxClass/Collection.php index 314a31eb658..8ed1c07036c 100644 --- a/app/code/Magento/Tax/Model/Resource/TaxClass/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/TaxClass/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Tax\Model\Resource\TaxClass; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Sales/Order/Tax.php b/app/code/Magento/Tax/Model/Sales/Order/Tax.php index 515217d8b9c..d3c3aee98bb 100644 --- a/app/code/Magento/Tax/Model/Sales/Order/Tax.php +++ b/app/code/Magento/Tax/Model/Sales/Order/Tax.php @@ -51,7 +51,7 @@ namespace Magento\Tax\Model\Sales\Order; * @method int getHidden() * @method \Magento\Tax\Model\Sales\Order\Tax setHidden(int $value) */ -class Tax extends \Magento\Core\Model\AbstractModel +class Tax extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Tax/Model/Sales/Order/Tax/Item.php b/app/code/Magento/Tax/Model/Sales/Order/Tax/Item.php index 04c0cc283dc..f2723806cfe 100644 --- a/app/code/Magento/Tax/Model/Sales/Order/Tax/Item.php +++ b/app/code/Magento/Tax/Model/Sales/Order/Tax/Item.php @@ -30,7 +30,7 @@ namespace Magento\Tax\Model\Sales\Order\Tax; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { /** * Initialization diff --git a/app/code/Magento/Tax/Model/TaxClass/AbstractType.php b/app/code/Magento/Tax/Model/TaxClass/AbstractType.php index 5f986536f11..6a26805604e 100644 --- a/app/code/Magento/Tax/Model/TaxClass/AbstractType.php +++ b/app/code/Magento/Tax/Model/TaxClass/AbstractType.php @@ -56,7 +56,7 @@ abstract class AbstractType extends \Magento\Object implements \Magento\Tax\Mode /** * Get Collection of Tax Rules that are assigned to this tax class * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getAssignedToRules() { diff --git a/app/code/Magento/Tax/Model/TaxClass/Factory.php b/app/code/Magento/Tax/Model/TaxClass/Factory.php index 7fab195f3b6..3de9c823da5 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Factory.php +++ b/app/code/Magento/Tax/Model/TaxClass/Factory.php @@ -59,13 +59,13 @@ class Factory * * @param \Magento\Tax\Model\ClassModel $taxClass * @return \Magento\Tax\Model\TaxClass\Type\TypeInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create(\Magento\Tax\Model\ClassModel $taxClass) { $taxClassType = $taxClass->getClassType(); if (!array_key_exists($taxClassType, $this->_types)) { - throw new \Magento\Core\Exception(sprintf('Invalid type of tax class "%s"', $taxClassType)); + throw new \Magento\Model\Exception(sprintf('Invalid type of tax class "%s"', $taxClassType)); } return $this->_objectManager->create( $this->_types[$taxClassType], diff --git a/app/code/Magento/Tax/Model/TaxClass/Type/Customer.php b/app/code/Magento/Tax/Model/TaxClass/Type/Customer.php index fa245f1f155..da60eae3646 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Type/Customer.php +++ b/app/code/Magento/Tax/Model/TaxClass/Type/Customer.php @@ -87,7 +87,7 @@ class Customer extends \Magento\Tax\Model\TaxClass\AbstractType * \Magento\Tax\Model\TaxClass\Type\TypeInterface::getAssignedToObjects are refactored to return Data Objects. * Will be revisited in MAGETWO-21827 * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getAssignedToObjects() { diff --git a/app/code/Magento/Tax/Model/TaxClass/Type/Product.php b/app/code/Magento/Tax/Model/TaxClass/Type/Product.php index 8b6e4ab35f0..3bafa2e6247 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Type/Product.php +++ b/app/code/Magento/Tax/Model/TaxClass/Type/Product.php @@ -60,7 +60,7 @@ class Product extends \Magento\Tax\Model\TaxClass\AbstractType /** * Get Products with this tax class * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getAssignedToObjects() { diff --git a/app/code/Magento/Tax/Model/TaxClass/Type/TypeInterface.php b/app/code/Magento/Tax/Model/TaxClass/Type/TypeInterface.php index 03162fcdecf..56a4b56a612 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Type/TypeInterface.php +++ b/app/code/Magento/Tax/Model/TaxClass/Type/TypeInterface.php @@ -34,14 +34,14 @@ interface TypeInterface /** * Get Collection of Objects that are assigned to this tax class * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getAssignedToObjects(); /** * Get Collection of Tax Rules that are assigned to this tax class * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getAssignedToRules(); 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 3fd0f0304d5..1735231aedc 100644 --- a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php +++ b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php @@ -67,6 +67,7 @@ class Theme extends \Magento\Backend\App\Action */ public function indexAction() { + $this->_eventManager->dispatch('theme_registration_from_filesystem'); $this->_view->loadLayout(); $this->_setActiveMenu('Magento_Theme::system_design_theme'); $this->_view->renderLayout(); @@ -106,7 +107,7 @@ class Theme extends \Magento\Backend\App\Action try { $theme->setType(\Magento\View\Design\ThemeInterface::TYPE_VIRTUAL); if ($themeId && (!$theme->load($themeId)->getId() || !$theme->isVisible())) { - throw new \Magento\Core\Exception(__('We cannot find theme "%1".', $themeId)); + throw new \Magento\Model\Exception(__('We cannot find theme "%1".', $themeId)); } $this->_coreRegistry->register('current_theme', $theme); @@ -121,7 +122,7 @@ class Theme extends \Magento\Backend\App\Action } $this->_setActiveMenu('Magento_Theme::system_design_theme'); $this->_view->renderLayout(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('adminhtml/*/'); } catch (\Exception $e) { @@ -166,7 +167,7 @@ class Theme extends \Magento\Backend\App\Action ); } if ($theme && !$theme->isEditable()) { - throw new \Magento\Core\Exception(__('Theme isn\'t editable.')); + throw new \Magento\Model\Exception(__('Theme isn\'t editable.')); } $theme->addData($themeData); if (isset($themeData['preview']['delete'])) { @@ -181,7 +182,7 @@ class Theme extends \Magento\Backend\App\Action $singleFile->update($theme, $customCssData); $this->messageManager->addSuccess(__('You saved the theme.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_getSession()->setThemeData($themeData); $this->_getSession()->setThemeCustomCssData($customCssData); @@ -222,7 +223,7 @@ class Theme extends \Magento\Backend\App\Action $theme->delete(); $this->messageManager->addSuccess(__('You deleted the theme.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('We cannot delete the theme.')); @@ -246,7 +247,7 @@ class Theme extends \Magento\Backend\App\Action try { $cssFileContent = $serviceModel->uploadCssFile('css_file_uploader'); $result = array('error' => false, 'content' => $cssFileContent['content']); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $result = array('error' => true, 'message' => __('We cannot upload the CSS file.')); @@ -259,7 +260,7 @@ class Theme extends \Magento\Backend\App\Action * Upload js file * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function uploadJsAction() { @@ -273,7 +274,7 @@ class Theme extends \Magento\Backend\App\Action try { $theme = $themeFactory->create($themeId); if (!$theme) { - throw new \Magento\Core\Exception(__('We cannot find a theme with id "%1".', $themeId)); + throw new \Magento\Model\Exception(__('We cannot find a theme with id "%1".', $themeId)); } $jsFileData = $serviceModel->uploadJsFile('js_files_uploader'); $jsFile = $jsService->create(); @@ -289,7 +290,7 @@ class Theme extends \Magento\Backend\App\Action ); $customJsFiles = $customization->getFilesByType(\Magento\View\Design\Theme\Customization\File\Js::TYPE); $result = array('error' => false, 'files' => $customization->generateFileInfo($customJsFiles)); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $result = array('error' => true, 'message' => __('We cannot upload the JS file.')); 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 d62108eae1e..cc66f382d36 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 @@ -93,7 +93,7 @@ class Files extends \Magento\Backend\App\Action try { $path = $this->_getSession()->getStoragePath(); $result = $this->_getStorage()->createFolder($name, $path); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $result = array('error' => true, 'message' => __('Sorry, there was an unknown error.')); diff --git a/app/code/Magento/Theme/Model/Uploader/Service.php b/app/code/Magento/Theme/Model/Uploader/Service.php index f6bb2980af9..31f5980bcf8 100644 --- a/app/code/Magento/Theme/Model/Uploader/Service.php +++ b/app/code/Magento/Theme/Model/Uploader/Service.php @@ -100,7 +100,7 @@ class Service * * @param string $file - Key in the $_FILES array * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function uploadCssFile($file) { @@ -112,7 +112,7 @@ class Service $isValidFileSize = $this->_validateFileSize($fileUploader->getFileSize(), $this->getCssUploadMaxSize()); if (!$isValidFileSize) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The CSS file must be less than %1M.', $this->getCssUploadMaxSizeInMb()) ); } @@ -126,7 +126,7 @@ class Service * * @param string $file - Key in the $_FILES array * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function uploadJsFile($file) { @@ -138,7 +138,7 @@ class Service $isValidFileSize = $this->_validateFileSize($fileUploader->getFileSize(), $this->getJsUploadMaxSize()); if (!$isValidFileSize) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The JS file must be less than %1M.', $this->getJsUploadMaxSizeInMb()) ); } diff --git a/app/code/Magento/Theme/Model/Wysiwyg/Storage.php b/app/code/Magento/Theme/Model/Wysiwyg/Storage.php index 737c97016d9..f3e7b740077 100644 --- a/app/code/Magento/Theme/Model/Wysiwyg/Storage.php +++ b/app/code/Magento/Theme/Model/Wysiwyg/Storage.php @@ -108,7 +108,7 @@ class Storage * * @param string $targetPath * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function uploadFile($targetPath) { @@ -120,7 +120,7 @@ class Storage $result = $uploader->save($targetPath); if (!$result) { - throw new \Magento\Core\Exception(__('We cannot upload the file.')); + throw new \Magento\Model\Exception(__('We cannot upload the file.')); } $this->_createThumbnail($targetPath . '/' . $uploader->getUploadedFileName()); @@ -178,12 +178,12 @@ class Storage * @param string $name * @param string $path * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function createFolder($name, $path) { if (!preg_match(self::DIRECTORY_NAME_REGEXP, $name)) { - throw new \Magento\Core\Exception(__('Use only standard alphanumeric, dashes and underscores.')); + throw new \Magento\Model\Exception(__('Use only standard alphanumeric, dashes and underscores.')); } if (!$this->mediaWriteDirectory->isWritable($path)) { $path = $this->_helper->getStorageRoot(); @@ -192,7 +192,7 @@ class Storage $newPath = $path . '/' . $name; if ($this->mediaWriteDirectory->isExist($newPath)) { - throw new \Magento\Core\Exception(__('We found a directory with the same name.')); + throw new \Magento\Model\Exception(__('We found a directory with the same name.')); } $this->mediaWriteDirectory->create($newPath); @@ -233,12 +233,12 @@ class Storage * * @param string $currentPath * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getDirsCollection($currentPath) { if (!$this->mediaWriteDirectory->isExist($currentPath)) { - throw new \Magento\Core\Exception(__('We cannot find a directory with this name.')); + throw new \Magento\Model\Exception(__('We cannot find a directory with this name.')); } $paths = $this->mediaWriteDirectory->search('.*', $currentPath); $directories = array(); @@ -306,7 +306,7 @@ class Storage * * @param string $path * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function deleteDirectory($path) { @@ -314,7 +314,7 @@ class Storage $pathCmp = rtrim($path, '/'); if ($rootCmp == $pathCmp) { - throw new \Magento\Core\Exception(__('We cannot delete root directory %1.', $path)); + throw new \Magento\Model\Exception(__('We cannot delete root directory %1.', $path)); } return $this->mediaWriteDirectory->delete($path); diff --git a/app/code/Magento/Theme/view/frontend/html/bugreport.phtml b/app/code/Magento/Theme/view/frontend/html/bugreport.phtml index af86bbb4e80..220c76c6979 100644 --- a/app/code/Magento/Theme/view/frontend/html/bugreport.phtml +++ b/app/code/Magento/Theme/view/frontend/html/bugreport.phtml @@ -29,5 +29,5 @@ target="_blank"> <?php echo __('Report All Bugs') ?> </a> - <strong><?php echo __('(ver. %1)', \Magento\Core\Model\App::VERSION) ?></strong> + <strong><?php echo __('(ver. %1)', \Magento\AppInterface::VERSION) ?></strong> </small> diff --git a/app/code/Magento/Theme/view/frontend/html/footer.phtml b/app/code/Magento/Theme/view/frontend/html/footer.phtml index 8db58345ee1..0998dbefb4c 100644 --- a/app/code/Magento/Theme/view/frontend/html/footer.phtml +++ b/app/code/Magento/Theme/view/frontend/html/footer.phtml @@ -29,7 +29,7 @@ <?php echo $this->getChildHtml() ?> <p class="bugs"><?php echo __('Help Us to Keep Magento Healthy') ?> - <a href="http://www.magentocommerce.com/bug-tracking" - target="_blank"><strong><?php echo __('Report All Bugs') ?></strong></a> <?php echo __('(ver. %1)', \Magento\Core\Model\App::VERSION) ?> + target="_blank"><strong><?php echo __('Report All Bugs') ?></strong></a> <?php echo __('(ver. %1)', \Magento\AppInterface::VERSION) ?> </p> <address><?php echo $this->getCopyright() ?></address> </div> diff --git a/app/code/Magento/Core/Helper/Translate.php b/app/code/Magento/Translation/Controller/Ajax.php similarity index 52% rename from app/code/Magento/Core/Helper/Translate.php rename to app/code/Magento/Translation/Controller/Ajax.php index d2589494f61..b5fdb069d14 100644 --- a/app/code/Magento/Core/Helper/Translate.php +++ b/app/code/Magento/Translation/Controller/Ajax.php @@ -18,68 +18,48 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Translation\Controller; -/** - * Core translate helper - */ -namespace Magento\Core\Helper; - -class Translate extends \Magento\App\Helper\AbstractHelper +class Ajax extends \Magento\App\Action\Action { /** - * Design package instance - * - * @var \Magento\View\DesignInterface - */ - protected $_design; - - /** - * Inline translate - * * @var \Magento\Translate\Inline\ParserInterface */ - protected $_inlineParser; + protected $inlineParser; /** - * @param \Magento\App\Helper\Context $context - * @param \Magento\View\DesignInterface $design + * @param \Magento\App\Action\Context $context * @param \Magento\Translate\Inline\ParserInterface $inlineParser */ public function __construct( - \Magento\App\Helper\Context $context, - \Magento\View\DesignInterface $design, + \Magento\App\Action\Context $context, \Magento\Translate\Inline\ParserInterface $inlineParser ) { - $this->_design = $design; - $this->_inlineParser = $inlineParser; parent::__construct($context); + + $this->inlineParser = $inlineParser; } /** - * Save translation data to database for specific area + * Ajax action for inline translation * - * @param array $translate - * @param string $area - * @param string $returnType - * @return string + * @return void */ - public function apply($translate, $area, $returnType = 'json') + public function indexAction() { - try { - if ($area) { - $this->_design->setArea($area); - } + $translate = (array)$this->getRequest()->getPost('translate'); - $this->_inlineParser->processAjaxPost($translate); - $result = $returnType == 'json' ? "{success:true}" : true; + try { + $this->inlineParser->processAjaxPost($translate); + $response = "{success:true}"; } catch (\Exception $e) { - $result = $returnType == 'json' ? "{error:true,message:'" . $e->getMessage() . "'}" : false; + $response = "{error:true,message:'" . $e->getMessage() . "'}"; } - return $result; + $this->getResponse()->setBody($response); + + $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); } } diff --git a/app/code/Magento/Core/Model/Translate/Inline/Config.php b/app/code/Magento/Translation/Model/Inline/Config.php similarity index 76% rename from app/code/Magento/Core/Model/Translate/Inline/Config.php rename to app/code/Magento/Translation/Model/Inline/Config.php index 5676b30fe93..f88c6c40729 100644 --- a/app/code/Magento/Core/Model/Translate/Inline/Config.php +++ b/app/code/Magento/Translation/Model/Inline/Config.php @@ -18,26 +18,21 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Translation\Model\Inline; /** * Inline Translation config */ -namespace Magento\Core\Model\Translate\Inline; - class Config implements \Magento\Translate\Inline\ConfigInterface { /** - * Core store config - * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\Core\Model\Store\ConfigInterface */ - protected $_coreStoreConfig; + protected $config; /** * @var \Magento\Core\Helper\Data @@ -45,12 +40,12 @@ class Config implements \Magento\Translate\Inline\ConfigInterface protected $_helper; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Core\Model\Store\ConfigInterface $config * @param \Magento\Core\Helper\Data $helper */ - public function __construct(\Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Helper\Data $helper) + public function __construct(\Magento\Core\Model\Store\ConfigInterface $config, \Magento\Core\Helper\Data $helper) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->config = $config; $this->_helper = $helper; } @@ -59,7 +54,7 @@ class Config implements \Magento\Translate\Inline\ConfigInterface */ public function isActive($scope = null) { - return $this->_coreStoreConfig->getConfigFlag('dev/translate_inline/active', $scope); + return $this->config->getConfigFlag('dev/translate_inline/active', $scope); } /** diff --git a/app/code/Magento/Core/Model/Translate/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php similarity index 94% rename from app/code/Magento/Core/Model/Translate/Inline/Parser.php rename to app/code/Magento/Translation/Model/Inline/Parser.php index 9af6858f23a..8ca3d2dd073 100644 --- a/app/code/Magento/Core/Model/Translate/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +26,7 @@ * This class is responsible for parsing content and applying necessary html element * wrapping and client scripts for inline translation. */ -namespace Magento\Core\Model\Translate\Inline; +namespace Magento\Translation\Model\Inline; class Parser implements \Magento\Translate\Inline\ParserInterface { @@ -37,13 +35,6 @@ class Parser implements \Magento\Translate\Inline\ParserInterface */ const DATA_TRANSLATE = 'data-translate'; - /** - * Regular Expression for detected and replace translate - * - * @var string - */ - protected $_tokenRegex = '\{\{\{(.*?)\}\}\{\{(.*?)\}\}\{\{(.*?)\}\}\{\{(.*?)\}\}\}'; - /** * Response body or JSON content string * @@ -56,7 +47,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface * * @var bool */ - protected $_isJson = \Magento\Translate\Inline\ParserInterface::JSON_FLAG_DEFAULT_STATE; + protected $_isJson = false; /** * Get max translate block in same tag @@ -117,7 +108,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface ); /** - * @var \Magento\Core\Model\Resource\Translate\StringFactory + * @var \Magento\Translation\Model\Resource\StringFactory */ protected $_resourceFactory; @@ -149,7 +140,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface /** * Initialize base inline translation model * - * @param \Magento\Core\Model\Resource\Translate\StringFactory $resource + * @param \Magento\Translation\Model\Resource\StringFactory $resource * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Zend_Filter_Interface $inputFilter * @param \Magento\App\State $appState @@ -157,7 +148,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface * @param \Magento\Translate\InlineInterface $translateInline */ public function __construct( - \Magento\Core\Model\Resource\Translate\StringFactory $resource, + \Magento\Translation\Model\Resource\StringFactory $resource, \Magento\Core\Model\StoreManagerInterface $storeManager, \Zend_Filter_Interface $inputFilter, \Magento\App\State $appState, @@ -191,7 +182,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface /** @var $validStoreId int */ $validStoreId = $this->_storeManager->getStore()->getId(); - /** @var $resource \Magento\Core\Model\Resource\Translate\String */ + /** @var $resource \Magento\Translation\Model\Resource\String */ $resource = $this->_resourceFactory->create(); foreach ($translateParams as $param) { if ($this->_appState->getAreaCode() == \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { @@ -420,13 +411,13 @@ class Parser implements \Magento\Translate\Inline\ParserInterface private function _prepareTagAttributesForContent(&$content) { $quoteHtml = $this->_getHtmlQuote(); - $tagMatch = array(); - $nextTag = 0; - $tagRegExp = '#<([a-z]+)\s*?[^>]+?((' . $this->_tokenRegex . ')[^>]*?)+\\\\?/?>#iS'; + $tagMatch = array(); + $nextTag = 0; + $tagRegExp = '#<([a-z]+)\s*?[^>]+?((' . self::REGEXP_TOKEN . ')[^>]*?)+\\\\?/?>#iS'; while (preg_match($tagRegExp, $content, $tagMatch, PREG_OFFSET_CAPTURE, $nextTag)) { $tagHtml = $tagMatch[0][0]; $matches = array(); - $attrRegExp = '#' . $this->_tokenRegex . '#S'; + $attrRegExp = '#' . self::REGEXP_TOKEN . '#S'; $trArr = $this->_getTranslateData($attrRegExp, $tagHtml, array($this, '_getAttributeLocation')); if ($trArr) { $transRegExp = '# ' . $this->_getHtmlAttribute( @@ -548,7 +539,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface $tagClosurePos = $tagMatch[0][1] + strlen($tagHtml); $trArr = $this->_getTranslateData( - '#' . $this->_tokenRegex . '#iS', + '#' . self::REGEXP_TOKEN . '#iS', $tagHtml, array($this, '_getTagLocation'), array('tagName' => $tagName, 'tagList' => $tagsList) @@ -602,14 +593,14 @@ class Parser implements \Magento\Translate\Inline\ParserInterface { $next = 0; $matches = array(); - while (preg_match('#' . $this->_tokenRegex . '#', $this->_content, $matches, PREG_OFFSET_CAPTURE, $next)) { + while (preg_match('#' . self::REGEXP_TOKEN . '#', $this->_content, $matches, PREG_OFFSET_CAPTURE, $next)) { $translateProperties = json_encode( array( 'shown' => $matches[1][0], 'translated' => $matches[2][0], 'original' => $matches[3][0], 'location' => 'Text', - 'scope' => $matches[4][0] + 'scope' => $matches[4][0], ) ); diff --git a/app/code/Magento/Core/Model/Resource/Translate/String.php b/app/code/Magento/Translation/Model/Resource/String.php similarity index 83% rename from app/code/Magento/Core/Model/Resource/Translate/String.php rename to app/code/Magento/Translation/Model/Resource/String.php index ee94eceec41..90148505703 100644 --- a/app/code/Magento/Core/Model/Resource/Translate/String.php +++ b/app/code/Magento/Translation/Model/Resource/String.php @@ -18,21 +18,12 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Translate; +namespace Magento\Translation\Model\Resource; -/** - * String translate resource model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> - */ -class String extends \Magento\Core\Model\Resource\Db\AbstractDb +class String extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Locale\ResolverInterface @@ -40,23 +31,31 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_localeResolver; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\BaseScopeResolverInterface + */ + protected $scopeResolver; + + /** + * @var null|string */ - protected $_storeManager; + protected $scope; /** * @param \Magento\App\Resource $resource * @param \Magento\Locale\ResolverInterface $localeResolver - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\BaseScopeResolverInterface $scopeResolver + * @param null $scope */ public function __construct( \Magento\App\Resource $resource, \Magento\Locale\ResolverInterface $localeResolver, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\BaseScopeResolverInterface $scopeResolver, + $scope = null ) { - parent::__construct($resource); $this->_localeResolver = $localeResolver; - $this->_storeManager = $storeManager; + $this->scopeResolver = $scopeResolver; + $this->scope = $scope; + parent::__construct($resource); } /** @@ -66,18 +65,18 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected function _construct() { - $this->_init('core_translate', 'key_id'); + $this->_init('translation', 'key_id'); } /** * Load * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param String $value * @param String $field * @return array|$this */ - public function load(\Magento\Core\Model\AbstractModel $object, $value, $field = null) + public function load(\Magento\Model\AbstractModel $object, $value, $field = null) { if (is_string($value)) { $select = $this->_getReadAdapter()->select()->from( @@ -99,7 +98,7 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param String $field * @param String $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Magento\DB\Select */ protected function _getLoadSelect($field, $value, $object) @@ -112,10 +111,10 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb /** * After translation loading * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function _afterLoad(\Magento\Core\Model\AbstractModel $object) + public function _afterLoad(\Magento\Model\AbstractModel $object) { $adapter = $this->_getReadAdapter(); $select = $adapter->select()->from( @@ -132,10 +131,10 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Before save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { $adapter = $this->_getWriteAdapter(); $select = $adapter->select()->from( @@ -156,10 +155,10 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb /** * After save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $adapter = $this->_getWriteAdapter(); $select = $adapter->select()->from( @@ -237,7 +236,7 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb } if (is_null($storeId)) { - $storeId = $this->_getStoreId(); + $storeId = $this->getStoreId(); } $select = $write->select()->from( @@ -262,7 +261,7 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb if ($row = $write->fetchRow($select, $bind)) { $original = $string; if (strpos($original, '::') !== false) { - list($scope, $original) = explode('::', $original); + list( , $original) = explode('::', $original); } if ($original == $translate) { $write->delete($table, array('key_id=?' => $row['key_id'])); @@ -286,12 +285,12 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb } /** - * Get current store id + * Retrieve current store identifier * - * @return int + * @return \Magento\BaseScopeInterface */ - protected function _getStoreId() + protected function getStoreId() { - return $this->_storeManager->getStore()->getId(); + return $this->scopeResolver->getScope($this->scope)->getId(); } } diff --git a/app/code/Magento/Core/Model/Resource/Translate.php b/app/code/Magento/Translation/Model/Resource/Translate.php similarity index 79% rename from app/code/Magento/Core/Model/Resource/Translate.php rename to app/code/Magento/Translation/Model/Resource/Translate.php index 251e4a175c8..128af4713e5 100644 --- a/app/code/Magento/Core/Model/Resource/Translate.php +++ b/app/code/Magento/Translation/Model/Resource/Translate.php @@ -18,21 +18,12 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Translation\Model\Resource; -/** - * Translation resource model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> - */ -class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb implements \Magento\Translate\ResourceInterface +class Translate extends \Magento\Model\Resource\Db\AbstractDb implements \Magento\Translate\ResourceInterface { /** * @var \Magento\App\State @@ -40,23 +31,31 @@ class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb implements \M protected $_appState; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\BaseScopeResolverInterface */ - protected $_storeManager; + protected $scopeResolver; + + /** + * @var null|string + */ + protected $scope; /** * @param \Magento\App\Resource $resource * @param \Magento\App\State $appState - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\BaseScopeResolverInterface $scopeResolver + * @param null|string $scope */ public function __construct( \Magento\App\Resource $resource, \Magento\App\State $appState, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\BaseScopeResolverInterface $scopeResolver, + $scope = null ) { - parent::__construct($resource); $this->_appState = $appState; - $this->_storeManager = $storeManager; + $this->scopeResolver = $scopeResolver; + $this->scope = $scope; + parent::__construct($resource); } /** @@ -66,7 +65,7 @@ class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb implements \M */ protected function _construct() { - $this->_init('core_translate', 'key_id'); + $this->_init('translation', 'key_id'); } /** @@ -83,7 +82,7 @@ class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb implements \M } if (is_null($storeId)) { - $storeId = $this->_getStoreId(); + $storeId = $this->getStoreId(); } $adapter = $this->_getReadAdapter(); @@ -121,7 +120,7 @@ class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb implements \M } if (is_null($storeId)) { - $this->_getStoreId(); + $storeId = $this->getStoreId(); } $adapter = $this->_getReadAdapter(); @@ -158,12 +157,12 @@ class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb implements \M } /** - * Get store id for translations + * Retrieve current store identifier * - * @return int + * @return \Magento\BaseScopeInterface */ - protected function _getStoreId() + protected function getStoreId() { - return $this->_storeManager->getStore()->getId(); + return $this->scopeResolver->getScope($this->scope)->getId(); } } diff --git a/app/code/Magento/Core/Model/Translate/String.php b/app/code/Magento/Translation/Model/String.php similarity index 68% rename from app/code/Magento/Core/Model/Translate/String.php rename to app/code/Magento/Translation/Model/String.php index 6775f04bb94..623e74785b8 100644 --- a/app/code/Magento/Core/Model/Translate/String.php +++ b/app/code/Magento/Translation/Model/String.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,29 +25,25 @@ /** * String translation model * - * @method \Magento\Core\Model\Resource\Translate\String _getResource() - * @method \Magento\Core\Model\Resource\Translate\String getResource() + * @method \Magento\Translation\Model\Resource\String _getResource() + * @method \Magento\Translation\Model\Resource\String getResource() * @method int getStoreId() - * @method \Magento\Core\Model\Translate\String setStoreId(int $value) + * @method \Magento\Translation\Model\String setStoreId(int $value) * @method string getTranslate() - * @method \Magento\Core\Model\Translate\String setTranslate(string $value) + * @method \Magento\Translation\Model\String setTranslate(string $value) * @method string getLocale() - * @method \Magento\Core\Model\Translate\String setLocale(string $value) - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * @method \Magento\Translation\Model\String setLocale(string $value) */ -namespace Magento\Core\Model\Translate; +namespace Magento\Translation\Model; -class String extends \Magento\Core\Model\AbstractModel +class String extends \Magento\Model\AbstractModel { /** * @return void */ protected function _construct() { - $this->_init('Magento\Core\Model\Resource\Translate\String'); + $this->_init('Magento\Translation\Model\Resource\String'); } /** diff --git a/dev/tests/integration/testsuite/Magento/PubSub/Event/QueueWriterTest.php b/app/code/Magento/Translation/data/translation_setup/data-upgrade-1.0.0.0-1.0.0.1.php similarity index 68% rename from dev/tests/integration/testsuite/Magento/PubSub/Event/QueueWriterTest.php rename to app/code/Magento/Translation/data/translation_setup/data-upgrade-1.0.0.0-1.0.0.1.php index 9dc6cfa2a4c..6e2120b4e8c 100644 --- a/dev/tests/integration/testsuite/Magento/PubSub/Event/QueueWriterTest.php +++ b/app/code/Magento/Translation/data/translation_setup/data-upgrade-1.0.0.0-1.0.0.1.php @@ -1,7 +1,5 @@ <?php /** - * \Magento\PubSub\Event\QueueWriter - * * Magento * * NOTICE OF LICENSE @@ -23,16 +21,19 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\PubSub\Event; -class QueueWriterTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $event = new \Magento\PubSub\Event('topic', array()); - $queue = new \Magento\PubSub\Event\QueueWriter(); - $result = $queue->offer($event); +/* @var $installer \Magento\Core\Model\Resource\Setup */ +$installer = $this; + +$installer->startSetup(); + +$select = $installer->getConnection() + ->select() + ->from($installer->getTable('core_translate')) + ->insertFromSelect($installer->getTable('translation')); + +$installer->getConnection()->query($select); + +$installer->getConnection()->dropTable($installer->getTable('core_translate')); - $this->assertNull($result); - } -} +$installer->endSetup(); diff --git a/app/code/Magento/Translation/etc/adminhtml/di.xml b/app/code/Magento/Translation/etc/adminhtml/di.xml new file mode 100644 index 00000000000..5ade7363c26 --- /dev/null +++ b/app/code/Magento/Translation/etc/adminhtml/di.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <preference for="Magento\Translate\Inline\ConfigInterface" type="Magento\Backend\Model\Translate\Inline\Config" /> + <type name="Magento\Translation\Model\Resource\Translate"> + <arguments> + <argument name="scope" xsi:type="string">admin</argument> + </arguments> + </type> + <type name="Magento\Translation\Model\Resource\String"> + <arguments> + <argument name="scope" xsi:type="string">admin</argument> + </arguments> + </type> + <type name="Magento\Translate\Inline"> + <arguments> + <argument name="templateFileName" xsi:type="string">Magento_Translation::translate_inline.phtml</argument> + <argument name="translatorRoute" xsi:type="string">adminhtml/ajax/translate</argument> + <argument name="layout" xsi:type="object">Magento\View\LayoutInterface\Proxy</argument> + <argument name="url" xsi:type="object">Magento\Backend\Model\UrlInterface</argument> + <argument name="scope" xsi:type="string">admin</argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/Translation/etc/adminhtml/routes.xml b/app/code/Magento/Translation/etc/adminhtml/routes.xml new file mode 100644 index 00000000000..f54eea71c04 --- /dev/null +++ b/app/code/Magento/Translation/etc/adminhtml/routes.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/App/etc/routes.xsd"> + <router id="admin"> + <route id="translation" frontName="translation"> + <module name="Magento_Translation" /> + </route> + </router> +</config> \ No newline at end of file diff --git a/app/code/Magento/Translation/etc/cache.xml b/app/code/Magento/Translation/etc/cache.xml new file mode 100644 index 00000000000..d8e3c37ea7c --- /dev/null +++ b/app/code/Magento/Translation/etc/cache.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Cache/etc/cache.xsd"> + <type name="translate" translate="label,description" instance="Magento\App\Cache\Type\Translate"> + <label>Translations</label> + <description>Translation files.</description> + </type> +</config> diff --git a/app/code/Magento/Translation/etc/config.xml b/app/code/Magento/Translation/etc/config.xml new file mode 100644 index 00000000000..95c9f1b2a6d --- /dev/null +++ b/app/code/Magento/Translation/etc/config.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> + <default> + <dev> + <translate_inline> + <active>0</active> + <active_admin>0</active_admin> + <invalid_caches> + <block_html /> + </invalid_caches> + </translate_inline> + </dev> + </default> +</config> diff --git a/app/code/Magento/Translation/etc/di.xml b/app/code/Magento/Translation/etc/di.xml new file mode 100644 index 00000000000..f0c02add04e --- /dev/null +++ b/app/code/Magento/Translation/etc/di.xml @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <preference for="Magento\Translate\InlineInterface" type="Magento\Translate\Inline" /> + <preference for="Magento\Translate\Inline\ConfigInterface" type="Magento\Translation\Model\Inline\Config" /> + <preference for="Magento\Translate\Inline\ProviderInterface" type="Magento\Translate\Inline\Provider" /> + <preference for="Magento\Translate\Inline\ParserInterface" type="Magento\Translation\Model\Inline\Parser" /> + <preference for="Magento\Translate\ResourceInterface" type="Magento\Translation\Model\Resource\Translate" /> + <preference for="Magento\Translate\Inline\StateInterface" type="Magento\Translate\Inline\State" /> + <preference for="Magento\Phrase\RendererInterface" type="Magento\Phrase\Renderer\Composite" /> + <type name="Magento\Translate\Inline"> + <arguments> + <argument name="templateFileName" xsi:type="string">Magento_Translation::translate_inline.phtml</argument> + <argument name="translatorRoute" xsi:type="string">translation/ajax/index</argument> + <argument name="layout" xsi:type="object">Magento\View\LayoutInterface\Proxy</argument> + <argument name="config" xsi:type="object">Magento\Translate\Inline\ConfigInterface\Proxy</argument> + </arguments> + </type> + <type name="Magento\Translation\Model\Inline\Parser"> + <arguments> + <argument name="inputFilter" xsi:type="object">Magento\Filter\Input\MaliciousCode</argument> + </arguments> + </type> + <type name="Magento\Translate\Inline\Provider"> + <arguments> + <argument name="inlineTranslate" xsi:type="object">Magento\Translate\Inline\Proxy</argument> + </arguments> + </type> + <type name="Magento\Phrase\Renderer\Composite"> + <arguments> + <argument name="renderers" xsi:type="array"> + <item name="translation" xsi:type="object">Magento\Phrase\Renderer\Translate</item> + <item name="placeholder" xsi:type="object">Magento\Phrase\Renderer\Placeholder</item> + <item name="inline" xsi:type="object">Magento\Phrase\Renderer\Inline</item> + </argument> + </arguments> + </type> + <type name="Magento\Phrase\Renderer\Translate"> + <arguments> + <argument name="translator" xsi:type="object">Magento\Translate</argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/Translation/etc/frontend/routes.xml b/app/code/Magento/Translation/etc/frontend/routes.xml new file mode 100644 index 00000000000..0cfe58766bc --- /dev/null +++ b/app/code/Magento/Translation/etc/frontend/routes.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/App/etc/routes.xsd"> + <router id="standard"> + <route id="translation" frontName="translation"> + <module name="Magento_Translation" /> + </route> + </router> +</config> \ No newline at end of file diff --git a/app/code/Magento/Translation/etc/module.xml b/app/code/Magento/Translation/etc/module.xml new file mode 100644 index 00000000000..05d7fae094c --- /dev/null +++ b/app/code/Magento/Translation/etc/module.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> + <module name="Magento_Translation" version="1.0.0.1" active="true"> + <sequence> + <module name="Magento_Core"/> + </sequence> + <depends> + <module name="Magento_Core"/> + <module name="Magento_Backend"/> + </depends> + </module> +</config> diff --git a/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php b/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php new file mode 100644 index 00000000000..0629dd3ff0a --- /dev/null +++ b/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/* @var $installer \Magento\Core\Model\Resource\Setup */ +$installer = $this; + +$installer->startSetup(); + +/** + * Create table 'translation' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('translation')) + ->addColumn( + 'key_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array( + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + ), + 'Key Id of Translation' + )->addColumn( + 'string', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array( + 'nullable' => false, + 'default' => \Magento\TranslateInterface::DEFAULT_STRING, + ), + 'Translation String' + )->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array( + 'unsigned' => true, + 'nullable' => false, + 'default' => '0', + ), + 'Store Id' + )->addColumn( + 'translate', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array(), + 'Translate' + )->addColumn( + 'locale', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 20, + array( + 'nullable' => false, + 'default' => 'en_US', + ), + 'Locale' + )->addColumn( + 'crc_string', + \Magento\DB\Ddl\Table::TYPE_BIGINT, + null, + array( + 'nullable' => false, + 'default' => crc32(\Magento\TranslateInterface::DEFAULT_STRING) + ), + 'Translation String CRC32 Hash' + )->addIndex( + $installer->getIdxName( + 'translation', + array('store_id', 'locale', 'crc_string', 'string'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('store_id', 'locale', 'crc_string', 'string'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) + )->addIndex( + $installer->getIdxName('translation', array('store_id')), + array('store_id') + )->addForeignKey( + $installer->getFkName('translation', 'store_id', 'core_store', 'store_id'), + 'store_id', + $installer->getTable('core_store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE + )->setComment('Translations'); +$installer->getConnection()->createTable($table); + +$installer->endSetup(); diff --git a/app/code/Magento/Core/view/adminhtml/translate_inline.phtml b/app/code/Magento/Translation/view/adminhtml/translate_inline.phtml similarity index 100% rename from app/code/Magento/Core/view/adminhtml/translate_inline.phtml rename to app/code/Magento/Translation/view/adminhtml/translate_inline.phtml diff --git a/app/code/Magento/Core/view/frontend/translate_inline.phtml b/app/code/Magento/Translation/view/frontend/translate_inline.phtml similarity index 100% rename from app/code/Magento/Core/view/frontend/translate_inline.phtml rename to app/code/Magento/Translation/view/frontend/translate_inline.phtml diff --git a/app/code/Magento/User/Controller/Adminhtml/Auth.php b/app/code/Magento/User/Controller/Adminhtml/Auth.php index a44e9625151..532417c8c10 100644 --- a/app/code/Magento/User/Controller/Adminhtml/Auth.php +++ b/app/code/Magento/User/Controller/Adminhtml/Auth.php @@ -174,7 +174,7 @@ class Auth extends \Magento\Backend\App\AbstractAction $this->getResponse()->setRedirect( $this->_objectManager->get('Magento\Backend\Helper\Data')->getHomePageUrl() ); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { $this->messageManager->addMessages($exception->getMessages()); $this->_redirect( 'adminhtml/auth/resetpassword', @@ -189,7 +189,7 @@ class Auth extends \Magento\Backend\App\AbstractAction * @param int $userId * @param string $resetPasswordToken * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validateResetPasswordLinkToken($userId, $resetPasswordToken) { @@ -199,18 +199,18 @@ class Auth extends \Magento\Backend\App\AbstractAction $resetPasswordToken ) || empty($resetPasswordToken) || empty($userId) || $userId < 0 ) { - throw new \Magento\Core\Exception(__('Please correct the password reset token.')); + throw new \Magento\Model\Exception(__('Please correct the password reset token.')); } /** @var $user \Magento\User\Model\User */ $user = $this->_userFactory->create()->load($userId); if (!$user->getId()) { - throw new \Magento\Core\Exception(__('Please specify the correct account and try again.')); + throw new \Magento\Model\Exception(__('Please specify the correct account and try again.')); } $userToken = $user->getRpToken(); if (strcmp($userToken, $resetPasswordToken) != 0 || $user->isResetPasswordLinkTokenExpired()) { - throw new \Magento\Core\Exception(__('Your password reset link has expired.')); + throw new \Magento\Model\Exception(__('Your password reset link has expired.')); } } diff --git a/app/code/Magento/User/Controller/Adminhtml/User.php b/app/code/Magento/User/Controller/Adminhtml/User.php index e8a28bf4b3c..5dd25d0d9b5 100644 --- a/app/code/Magento/User/Controller/Adminhtml/User.php +++ b/app/code/Magento/User/Controller/Adminhtml/User.php @@ -177,7 +177,7 @@ class User extends \Magento\Backend\App\AbstractAction $this->messageManager->addSuccess(__('You saved the user.')); $this->_getSession()->setUserData(false); $this->_redirect('adminhtml/*/'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addMessages($e->getMessages()); $this->_getSession()->setUserData($data); $this->_redirect('adminhtml/*/edit', array('_current' => true)); diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Role.php b/app/code/Magento/User/Controller/Adminhtml/User/Role.php index 61406409521..da3ac59c511 100644 --- a/app/code/Magento/User/Controller/Adminhtml/User/Role.php +++ b/app/code/Magento/User/Controller/Adminhtml/User/Role.php @@ -262,7 +262,7 @@ class Role extends \Magento\Backend\App\AbstractAction $this->_addUserToRole($nRuid, $role->getId()); } $this->messageManager->addSuccess(__('You saved the role.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('An error occurred while saving this role.')); diff --git a/app/code/Magento/User/Model/Resource/Permissions/Collection.php b/app/code/Magento/User/Model/Resource/Permissions/Collection.php index 67df01ab2db..f31ab4b3fa5 100644 --- a/app/code/Magento/User/Model/Resource/Permissions/Collection.php +++ b/app/code/Magento/User/Model/Resource/Permissions/Collection.php @@ -32,7 +32,7 @@ namespace Magento\User\Model\Resource\Permissions; * @package Magento_User * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource diff --git a/app/code/Magento/User/Model/Resource/Role.php b/app/code/Magento/User/Model/Resource/Role.php index 4299b11cd6b..cb6dd6ed93c 100644 --- a/app/code/Magento/User/Model/Resource/Role.php +++ b/app/code/Magento/User/Model/Resource/Role.php @@ -28,7 +28,7 @@ use Magento\User\Model\Acl\Role\User as RoleUser; /** * Admin role resource model */ -class Role extends \Magento\Core\Model\Resource\Db\AbstractDb +class Role extends \Magento\Model\Resource\Db\AbstractDb { /** * Users table @@ -87,10 +87,10 @@ class Role extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Process role before saving * - * @param \Magento\Core\Model\AbstractModel $role + * @param \Magento\Model\AbstractModel $role * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $role) + protected function _beforeSave(\Magento\Model\AbstractModel $role) { if (!$role->getId()) { $role->setCreated($this->dateTime->formatDate(true)); @@ -134,10 +134,10 @@ class Role extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Process role after saving * - * @param \Magento\Core\Model\AbstractModel $role + * @param \Magento\Model\AbstractModel $role * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $role) + protected function _afterSave(\Magento\Model\AbstractModel $role) { $this->_updateRoleUsersAcl($role); $this->_cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, array(\Magento\Backend\Block\Menu::CACHE_TAGS)); @@ -147,10 +147,10 @@ class Role extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Process role after deleting * - * @param \Magento\Core\Model\AbstractModel $role + * @param \Magento\Model\AbstractModel $role * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $role) + protected function _afterDelete(\Magento\Model\AbstractModel $role) { $adapter = $this->_getWriteAdapter(); diff --git a/app/code/Magento/User/Model/Resource/Role/Collection.php b/app/code/Magento/User/Model/Resource/Role/Collection.php index 2b0240dad09..ff99e071531 100644 --- a/app/code/Magento/User/Model/Resource/Role/Collection.php +++ b/app/code/Magento/User/Model/Resource/Role/Collection.php @@ -28,7 +28,7 @@ use Magento\User\Model\Acl\Role\Group as RoleGroup; /** * Admin role collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource model diff --git a/app/code/Magento/User/Model/Resource/Role/User/Collection.php b/app/code/Magento/User/Model/Resource/Role/User/Collection.php index c14ba5cbfe4..d1f4e10817b 100644 --- a/app/code/Magento/User/Model/Resource/Role/User/Collection.php +++ b/app/code/Magento/User/Model/Resource/Role/User/Collection.php @@ -32,7 +32,7 @@ namespace Magento\User\Model\Resource\Role\User; * @package Magento_User * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource model diff --git a/app/code/Magento/User/Model/Resource/Rules.php b/app/code/Magento/User/Model/Resource/Rules.php index 83f2e3a9920..887b80576b5 100644 --- a/app/code/Magento/User/Model/Resource/Rules.php +++ b/app/code/Magento/User/Model/Resource/Rules.php @@ -26,7 +26,7 @@ namespace Magento\User\Model\Resource; /** * Admin rule resource model */ -class Rules extends \Magento\Core\Model\Resource\Db\AbstractDb +class Rules extends \Magento\Model\Resource\Db\AbstractDb { /** * Root ACL resource @@ -88,7 +88,7 @@ class Rules extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param \Magento\User\Model\Rules $rule * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function saveRel(\Magento\User\Model\Rules $rule) { @@ -130,7 +130,7 @@ class Rules extends \Magento\Core\Model\Resource\Db\AbstractDb $adapter->commit(); $this->_aclCache->clean(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $adapter->rollBack(); throw $e; } catch (\Exception $e) { diff --git a/app/code/Magento/User/Model/Resource/Rules/Collection.php b/app/code/Magento/User/Model/Resource/Rules/Collection.php index a80c129da19..a343164a6d6 100644 --- a/app/code/Magento/User/Model/Resource/Rules/Collection.php +++ b/app/code/Magento/User/Model/Resource/Rules/Collection.php @@ -32,7 +32,7 @@ namespace Magento\User\Model\Resource\Rules; * @package Magento_User * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource model diff --git a/app/code/Magento/User/Model/Resource/User.php b/app/code/Magento/User/Model/Resource/User.php index 44541ddc2fa..2dcc688ae28 100644 --- a/app/code/Magento/User/Model/Resource/User.php +++ b/app/code/Magento/User/Model/Resource/User.php @@ -30,7 +30,7 @@ use Magento\User\Model\User as ModelUser; /** * ACL user resource */ -class User extends \Magento\Core\Model\Resource\Db\AbstractDb +class User extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Acl\CacheInterface @@ -139,7 +139,7 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb { if (is_numeric($user)) { $userId = $user; - } elseif ($user instanceof \Magento\Core\Model\AbstractModel) { + } elseif ($user instanceof \Magento\Model\AbstractModel) { $userId = $user->getUserId(); } else { return null; @@ -162,10 +162,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Set created/modified values before user save * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $user) + protected function _beforeSave(\Magento\Model\AbstractModel $user) { if ($user->isObjectNew()) { $user->setCreated($this->dateTime->formatDate(true)); @@ -178,10 +178,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Unserialize user extra data after user save * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $user) + protected function _afterSave(\Magento\Model\AbstractModel $user) { $user->setExtra(unserialize($user->getExtra())); if ($user->hasRoleId()) { @@ -241,10 +241,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Unserialize user extra data after user load * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $user) + protected function _afterLoad(\Magento\Model\AbstractModel $user) { if (is_string($user->getExtra())) { $user->setExtra(unserialize($user->getExtra())); @@ -255,11 +255,11 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Delete user role record with user * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - public function delete(\Magento\Core\Model\AbstractModel $user) + public function delete(\Magento\Model\AbstractModel $user) { $this->_beforeDelete($user); $adapter = $this->_getWriteAdapter(); @@ -271,7 +271,7 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb $adapter->delete($this->getMainTable(), $conditions); $adapter->delete($this->getTable('admin_role'), $conditions); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { throw $e; return false; } catch (\Exception $e) { @@ -286,10 +286,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Get user roles * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return array */ - public function getRoles(\Magento\Core\Model\AbstractModel $user) + public function getRoles(\Magento\Model\AbstractModel $user) { if (!$user->getId()) { return array(); @@ -323,10 +323,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Delete user role * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return $this */ - public function deleteFromRole(\Magento\Core\Model\AbstractModel $user) + public function deleteFromRole(\Magento\Model\AbstractModel $user) { if ($user->getUserId() <= 0) { return $this; @@ -346,10 +346,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check if role user exists * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return array */ - public function roleUserExists(\Magento\Core\Model\AbstractModel $user) + public function roleUserExists(\Magento\Model\AbstractModel $user) { if ($user->getUserId() > 0) { $roleTable = $this->getTable('admin_role'); @@ -369,10 +369,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check if user exists * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return array */ - public function userExists(\Magento\Core\Model\AbstractModel $user) + public function userExists(\Magento\Model\AbstractModel $user) { $adapter = $this->_getReadAdapter(); $select = $adapter->select(); @@ -397,10 +397,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Whether a user's identity is confirmed * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return bool */ - public function isUserUnique(\Magento\Core\Model\AbstractModel $user) + public function isUserUnique(\Magento\Model\AbstractModel $user) { return !$this->userExists($user); } @@ -408,7 +408,7 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save user extra data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $data * @return $this */ diff --git a/app/code/Magento/User/Model/Resource/User/Collection.php b/app/code/Magento/User/Model/Resource/User/Collection.php index fab622aa7a2..da464402a16 100644 --- a/app/code/Magento/User/Model/Resource/User/Collection.php +++ b/app/code/Magento/User/Model/Resource/User/Collection.php @@ -32,7 +32,7 @@ namespace Magento\User\Model\Resource\User; * @package Magento_User * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define resource model diff --git a/app/code/Magento/User/Model/Resource/User/Locked/Collection.php b/app/code/Magento/User/Model/Resource/User/Locked/Collection.php index 84273a9111a..29f552d9531 100644 --- a/app/code/Magento/User/Model/Resource/User/Locked/Collection.php +++ b/app/code/Magento/User/Model/Resource/User/Locked/Collection.php @@ -37,7 +37,7 @@ class Collection extends \Magento\User\Model\Resource\User\Collection /** * Collection Init Select * - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource * @return $this */ protected function _initSelect() diff --git a/app/code/Magento/User/Model/Role.php b/app/code/Magento/User/Model/Role.php index cc5802cd771..fbca5b9dbe5 100644 --- a/app/code/Magento/User/Model/Role.php +++ b/app/code/Magento/User/Model/Role.php @@ -43,7 +43,7 @@ namespace Magento\User\Model; * @method string getRoleName() * @method \Magento\User\Model\Role setRoleName(string $value) */ -class Role extends \Magento\Core\Model\AbstractModel +class Role extends \Magento\Model\AbstractModel { /** * @var string diff --git a/app/code/Magento/User/Model/Rules.php b/app/code/Magento/User/Model/Rules.php index 08035e08280..579efc6e762 100644 --- a/app/code/Magento/User/Model/Rules.php +++ b/app/code/Magento/User/Model/Rules.php @@ -39,7 +39,7 @@ namespace Magento\User\Model; * @method string getPermission() * @method \Magento\User\Model\Rules setPermission(string $value) */ -class Rules extends \Magento\Core\Model\AbstractModel +class Rules extends \Magento\Model\AbstractModel { /** * Class constructor diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php index bd6d39e67d2..eb476a74e9a 100644 --- a/app/code/Magento/User/Model/User.php +++ b/app/code/Magento/User/Model/User.php @@ -54,7 +54,7 @@ namespace Magento\User\Model; * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.LongVariable) */ -class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend\Model\Auth\Credential\StorageInterface +class User extends \Magento\Model\AbstractModel implements \Magento\Backend\Model\Auth\Credential\StorageInterface { /** * Configuration paths for email templates and identities @@ -149,7 +149,7 @@ class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend * @param \Magento\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param array $data @@ -167,7 +167,7 @@ class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -223,7 +223,7 @@ class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend $this->_eventManager = $objectManager->get('Magento\Event\ManagerInterface'); $this->_userData = $objectManager->get('Magento\User\Helper\Data'); $this->_config = $objectManager->get('Magento\Backend\App\ConfigInterface'); - $this->_coreRegistry = $objectManager->get('Magento\Registry'); + $this->_registry = $objectManager->get('Magento\Registry'); $this->_validatorObject = $objectManager->get('Magento\Validator\ObjectFactory'); $this->_roleFactory = $objectManager->get('Magento\User\Model\RoleFactory'); $this->_encryptor = $objectManager->get('Magento\Encryption\EncryptorInterface'); @@ -519,7 +519,7 @@ class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend * @param string $username * @param string $password * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Magento\Backend\Model\Auth\Exception * @throws \Magento\Backend\Model\Auth\Plugin\Exception */ @@ -550,7 +550,7 @@ class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend 'admin_user_authenticate_after', array('username' => $username, 'password' => $password, 'user' => $this, 'result' => $result) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->unsetData(); throw $e; } @@ -633,12 +633,12 @@ class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend * * @param string $newToken * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function changeResetPasswordLinkToken($newToken) { if (!is_string($newToken) || empty($newToken)) { - throw new \Magento\Core\Exception(__('Please correct the password reset token.')); + throw new \Magento\Model\Exception(__('Please correct the password reset token.')); } $this->setRpToken($newToken); $this->setRpTokenCreatedAt($this->dateTime->now()); diff --git a/app/code/Magento/Webapi/Controller/ErrorProcessor.php b/app/code/Magento/Webapi/Controller/ErrorProcessor.php index cdadb7c32a6..5ef64077034 100644 --- a/app/code/Magento/Webapi/Controller/ErrorProcessor.php +++ b/app/code/Magento/Webapi/Controller/ErrorProcessor.php @@ -25,6 +25,8 @@ */ namespace Magento\Webapi\Controller; +use Magento\App\State; + class ErrorProcessor { const DEFAULT_SHUTDOWN_FUNCTION = 'apiShutdownFunction'; @@ -42,13 +44,19 @@ class ErrorProcessor /**#@-*/ - /** @var \Magento\Core\Helper\Data */ + /** + * @var \Magento\Core\Helper\Data + */ protected $_coreHelper; - /** @var \Magento\Core\Model\App */ - protected $_app; + /** + * @var \Magento\App\State + */ + protected $_appState; - /** @var \Magento\Logger */ + /** + * @var \Magento\Logger + */ protected $_logger; /** @@ -64,21 +72,19 @@ class ErrorProcessor protected $directoryWrite; /** - * Initialize dependencies. Register custom shutdown function. - * * @param \Magento\Core\Helper\Data $helper - * @param \Magento\Core\Model\App $app + * @param \Magento\App\State $appState * @param \Magento\Logger $logger * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Core\Helper\Data $helper, - \Magento\AppInterface $app, + \Magento\App\State $appState, \Magento\Logger $logger, \Magento\App\Filesystem $filesystem ) { $this->_coreHelper = $helper; - $this->_app = $app; + $this->_appState = $appState; $this->_logger = $logger; $this->_filesystem = $filesystem; $this->directoryWrite = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); @@ -115,7 +121,7 @@ class ErrorProcessor } else if ($exception instanceof \Magento\Webapi\Exception) { $maskedException = $exception; } else { - if (!$this->_app->isDeveloperMode()) { + if ($this->_appState->getMode() !== State::MODE_DEVELOPER) { /** Create exception with masked message. */ $maskedException = new \Magento\Webapi\Exception( __('Internal Error. Details are available in Magento log file. Report ID: %1', $reportId), @@ -145,7 +151,7 @@ class ErrorProcessor */ public function renderException(\Exception $exception, $httpCode = self::DEFAULT_ERROR_HTTP_CODE) { - if ($this->_app->isDeveloperMode() || $exception instanceof \Magento\Webapi\Exception) { + if ($this->_appState->getMode() == State::MODE_DEVELOPER || $exception instanceof \Magento\Webapi\Exception) { $this->render($exception->getMessage(), $exception->getTraceAsString(), $httpCode); } else { $reportId = $this->_logException($exception); @@ -218,7 +224,8 @@ class ErrorProcessor { $errorData = array(); $message = array('code' => $httpCode, 'message' => $errorMessage); - if ($this->_app->isDeveloperMode()) { + $isDeveloperMode = $this->_appState->getMode() == State::MODE_DEVELOPER; + if ($isDeveloperMode) { $message['trace'] = $trace; } $errorData['messages']['error'][] = $message; @@ -227,24 +234,18 @@ class ErrorProcessor $errorData = $this->_coreHelper->jsonEncode($errorData); break; case self::DATA_FORMAT_XML: - $errorData = '<?xml version="1.0"?>' . - '<error>' . - '<messages>' . - '<error>' . - '<data_item>' . - '<code>' . - $httpCode . - '</code>' . - '<message><![CDATA[' . - $errorMessage . - ']]></message>' . - ($this->_app->isDeveloperMode() ? '<trace><![CDATA[' . - $trace . - ']]></trace>' : '') . - '</data_item>' . - '</error>' . - '</messages>' . - '</error>'; + $errorData = '<?xml version="1.0"?>' + . '<error>' + . '<messages>' + . '<error>' + . '<data_item>' + . '<code>' . $httpCode . '</code>' + . '<message><![CDATA[' . $errorMessage . ']]></message>' + . ($isDeveloperMode ? '<trace><![CDATA[' . $trace . ']]></trace>' : '') + . '</data_item>' + . '</error>' + . '</messages>' + . '</error>'; break; } return $errorData; @@ -273,7 +274,7 @@ class ErrorProcessor if ($error && $error['type'] & $fatalErrorFlag) { $errorMessage = "Fatal Error: '{$error['message']}' in '{$error['file']}' on line {$error['line']}"; $reportId = $this->_saveFatalErrorReport($errorMessage); - if ($this->_app->isDeveloperMode()) { + if ($this->_appState->getMode() == State::MODE_DEVELOPER) { $this->render($errorMessage); } else { $this->render(__('Server internal error. See details in report api/%1', $reportId)); diff --git a/app/code/Magento/Webapi/Controller/Rest.php b/app/code/Magento/Webapi/Controller/Rest.php index d705305c396..0047d63acff 100644 --- a/app/code/Magento/Webapi/Controller/Rest.php +++ b/app/code/Magento/Webapi/Controller/Rest.php @@ -52,8 +52,8 @@ class Rest implements \Magento\App\FrontControllerInterface /** @var \Magento\App\State */ protected $_appState; - /** @var \Magento\AppInterface */ - protected $_application; + /** @var \Magento\View\LayoutInterface */ + protected $_layout; /** @var \Magento\Oauth\OauthInterface */ protected $_oauthService; @@ -71,19 +71,25 @@ class Rest implements \Magento\App\FrontControllerInterface protected $_errorProcessor; /** - * Initialize dependencies. + * Initialize dependencies * + * @var \Magento\App\AreaList + */ + protected $areaList; + + /** * @param RestRequest $request * @param RestResponse $response * @param Router $router * @param \Magento\ObjectManager $objectManager * @param \Magento\App\State $appState - * @param \Magento\AppInterface $application + * @param \Magento\View\LayoutInterface $layout * @param \Magento\Oauth\OauthInterface $oauthService * @param \Magento\Oauth\Helper\Request $oauthHelper * @param AuthorizationService $authorizationService * @param ServiceArgsSerializer $serializer * @param ErrorProcessor $errorProcessor + * @param \Magento\App\AreaList $areaList * * TODO: Consider removal of warning suppression * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -94,24 +100,26 @@ class Rest implements \Magento\App\FrontControllerInterface Router $router, \Magento\ObjectManager $objectManager, \Magento\App\State $appState, - \Magento\AppInterface $application, + \Magento\View\LayoutInterface $layout, \Magento\Oauth\OauthInterface $oauthService, \Magento\Oauth\Helper\Request $oauthHelper, AuthorizationService $authorizationService, ServiceArgsSerializer $serializer, - ErrorProcessor $errorProcessor + ErrorProcessor $errorProcessor, + \Magento\App\AreaList $areaList ) { $this->_router = $router; $this->_request = $request; $this->_response = $response; $this->_objectManager = $objectManager; $this->_appState = $appState; - $this->_application = $application; + $this->_layout = $layout; $this->_oauthService = $oauthService; $this->_oauthHelper = $oauthHelper; $this->_authorizationService = $authorizationService; $this->_serializer = $serializer; $this->_errorProcessor = $errorProcessor; + $this->areaList = $areaList; } /** @@ -125,10 +133,8 @@ class Rest implements \Magento\App\FrontControllerInterface $pathParts = explode('/', trim($request->getPathInfo(), '/')); array_shift($pathParts); $request->setPathInfo('/' . implode('/', $pathParts)); - $this->_application->loadAreaPart( - $this->_application->getLayout()->getArea(), - \Magento\Core\Model\App\Area::PART_TRANSLATE - ); + $this->areaList->getArea($this->_layout->getArea()) + ->load(\Magento\Core\Model\App\Area::PART_TRANSLATE); try { if (!$this->_appState->isInstalled()) { throw new \Magento\Webapi\Exception(__('Magento is not yet installed')); diff --git a/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Json.php b/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Json.php index f79ac01eb55..cbde612db3e 100644 --- a/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Json.php +++ b/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Json.php @@ -25,24 +25,28 @@ */ namespace Magento\Webapi\Controller\Rest\Request\Deserializer; +use \Magento\App\State; + class Json implements \Magento\Webapi\Controller\Rest\Request\DeserializerInterface { - /** @var \Magento\Core\Helper\Data */ + /** + * @var \Magento\Core\Helper\Data + */ protected $_helper; - /** @var \Magento\Core\Model\App */ - protected $_app; + /** + * @var State + */ + protected $_appState; /** - * Initialize dependencies. - * * @param \Magento\Core\Helper\Data $helper - * @param \Magento\Core\Model\App $app + * @param \Magento\App\State $appState */ - public function __construct(\Magento\Core\Helper\Data $helper, \Magento\Core\Model\App $app) + public function __construct(\Magento\Core\Helper\Data $helper, State $appState) { $this->_helper = $helper; - $this->_app = $app; + $this->_appState = $appState; } /** @@ -63,7 +67,7 @@ class Json implements \Magento\Webapi\Controller\Rest\Request\DeserializerInterf try { $decodedBody = $this->_helper->jsonDecode($encodedBody); } catch (\Zend_Json_Exception $e) { - if (!$this->_app->isDeveloperMode()) { + if ($this->_appState->getMode() !== State::MODE_DEVELOPER) { throw new \Magento\Webapi\Exception(__('Decoding error.')); } else { throw new \Magento\Webapi\Exception( diff --git a/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Xml.php b/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Xml.php index 67ba2730dd9..23cbc4a9818 100644 --- a/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Xml.php +++ b/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Xml.php @@ -25,24 +25,24 @@ */ namespace Magento\Webapi\Controller\Rest\Request\Deserializer; +use Magento\App\State; + class Xml implements \Magento\Webapi\Controller\Rest\Request\DeserializerInterface { /** @var \Magento\Xml\Parser */ protected $_xmlParser; - /** @var \Magento\Core\Model\App */ - protected $_app; + /** @var State */ + protected $_appState; /** - * Initialize dependencies. - * * @param \Magento\Xml\Parser $xmlParser - * @param \Magento\Core\Model\App $app + * @param State $appState */ - public function __construct(\Magento\Xml\Parser $xmlParser, \Magento\Core\Model\App $app) + public function __construct(\Magento\Xml\Parser $xmlParser, State $appState) { $this->_xmlParser = $xmlParser; - $this->_app = $app; + $this->_appState = $appState; } /** @@ -80,7 +80,7 @@ class Xml implements \Magento\Webapi\Controller\Rest\Request\DeserializerInterfa /** Process errors during XML parsing. */ if ($this->_errorMessage !== null) { - if (!$this->_app->isDeveloperMode()) { + if ($this->_appState->getMode() !== State::MODE_DEVELOPER) { $exceptionMessage = __('Decoding error.'); } else { $exceptionMessage = 'Decoding Error: ' . $this->_errorMessage; diff --git a/app/code/Magento/Webapi/Controller/Rest/Response.php b/app/code/Magento/Webapi/Controller/Rest/Response.php index e962edf0690..b2f530660f6 100644 --- a/app/code/Magento/Webapi/Controller/Rest/Response.php +++ b/app/code/Magento/Webapi/Controller/Rest/Response.php @@ -33,24 +33,26 @@ class Response extends \Magento\Webapi\Controller\Response /** @var \Magento\Webapi\Controller\Rest\Response\RendererInterface */ protected $_renderer; - /** @var \Magento\Core\Model\App */ - protected $_app; + /** + * @var \Magento\App\State + */ + protected $_appState; /** * Initialize dependencies. * * @param \Magento\Webapi\Controller\Rest\Response\Renderer\Factory $rendererFactory * @param \Magento\Webapi\Controller\ErrorProcessor $errorProcessor - * @param \Magento\Core\Model\App $app + * @param \Magento\App\State $appState */ public function __construct( \Magento\Webapi\Controller\Rest\Response\Renderer\Factory $rendererFactory, \Magento\Webapi\Controller\ErrorProcessor $errorProcessor, - \Magento\Core\Model\App $app + \Magento\App\State $appState ) { $this->_renderer = $rendererFactory->get(); $this->_errorProcessor = $errorProcessor; - $this->_app = $app; + $this->_appState = $appState; } /** @@ -103,7 +105,7 @@ class Response extends \Magento\Webapi\Controller\Response if ($maskedException->getDetails()) { $messageData['parameters'] = $maskedException->getDetails(); } - if ($this->_app->isDeveloperMode()) { + if ($this->_appState->getMode() == \Magento\App\State::MODE_DEVELOPER) { $messageData['trace'] = $exception->getTraceAsString(); } $formattedMessages['errors'][] = $messageData; diff --git a/app/code/Magento/Webapi/Controller/Soap.php b/app/code/Magento/Webapi/Controller/Soap.php index bd2e20048b4..7875b4460f7 100644 --- a/app/code/Magento/Webapi/Controller/Soap.php +++ b/app/code/Magento/Webapi/Controller/Soap.php @@ -62,8 +62,8 @@ class Soap implements \Magento\App\FrontControllerInterface /** @var \Magento\App\State */ protected $_appState; - /** @var \Magento\AppInterface */ - protected $_application; + /** @var \Magento\View\LayoutInterface */ + protected $_layout; /** * @var \Magento\Oauth\OauthInterface @@ -75,6 +75,11 @@ class Soap implements \Magento\App\FrontControllerInterface */ protected $_localeResolver; + /** + * @var \Magento\App\AreaList + */ + protected $areaList; + /** * @param Soap\Request $request * @param Response $response @@ -82,9 +87,12 @@ class Soap implements \Magento\App\FrontControllerInterface * @param \Magento\Webapi\Model\Soap\Server $soapServer * @param ErrorProcessor $errorProcessor * @param \Magento\App\State $appState - * @param \Magento\AppInterface $application + * @param \Magento\View\LayoutInterface $layout * @param \Magento\Oauth\OauthInterface $oauthService * @param \Magento\Locale\ResolverInterface $localeResolver + * @param \Magento\App\AreaList $areaList + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Webapi\Controller\Soap\Request $request, @@ -93,9 +101,10 @@ class Soap implements \Magento\App\FrontControllerInterface \Magento\Webapi\Model\Soap\Server $soapServer, ErrorProcessor $errorProcessor, \Magento\App\State $appState, - \Magento\AppInterface $application, + \Magento\View\LayoutInterface $layout, \Magento\Oauth\OauthInterface $oauthService, - \Magento\Locale\ResolverInterface $localeResolver + \Magento\Locale\ResolverInterface $localeResolver, + \Magento\App\AreaList $areaList ) { $this->_request = $request; $this->_response = $response; @@ -103,9 +112,10 @@ class Soap implements \Magento\App\FrontControllerInterface $this->_soapServer = $soapServer; $this->_errorProcessor = $errorProcessor; $this->_appState = $appState; - $this->_application = $application; $this->_oauthService = $oauthService; $this->_localeResolver = $localeResolver; + $this->_layout = $layout; + $this->areaList = $areaList; } /** @@ -119,10 +129,8 @@ class Soap implements \Magento\App\FrontControllerInterface $pathParts = explode('/', trim($request->getPathInfo(), '/')); array_shift($pathParts); $request->setPathInfo('/' . implode('/', $pathParts)); - $this->_application->loadAreaPart( - $this->_application->getLayout()->getArea(), - \Magento\Core\Model\App\Area::PART_TRANSLATE - ); + $this->areaList->getArea($this->_layout->getArea()) + ->load(\Magento\Core\Model\App\Area::PART_TRANSLATE); try { if (!$this->_appState->isInstalled()) { throw new WebapiException(__('Magento is not yet installed')); @@ -193,10 +201,11 @@ class Soap implements \Magento\App\FrontControllerInterface $this->_setResponseContentType($contentType); $this->_response->setHttpResponseCode($httpCode); $soapFault = new \Magento\Webapi\Model\Soap\Fault( - $this->_application, + $this->_request, $this->_soapServer, $maskedException, - $this->_localeResolver + $this->_localeResolver, + $this->_appState ); // TODO: Generate list of available URLs when invalid WSDL URL specified $this->_setResponseBody($soapFault->toXml()); diff --git a/app/code/Magento/Webapi/Model/Soap/Fault.php b/app/code/Magento/Webapi/Model/Soap/Fault.php index f7c4d9f8b9b..cb1f639ce38 100644 --- a/app/code/Magento/Webapi/Model/Soap/Fault.php +++ b/app/code/Magento/Webapi/Model/Soap/Fault.php @@ -25,6 +25,8 @@ */ namespace Magento\Webapi\Model\Soap; +use Magento\App\State; + class Fault extends \RuntimeException { const FAULT_REASON_INTERNAL = 'Internal Error.'; @@ -84,9 +86,9 @@ class Fault extends \RuntimeException protected $_details = array(); /** - * @var \Magento\Core\Model\App + * @var \Magento\App\RequestInterface */ - protected $_application; + protected $_request; /** * @var Server @@ -99,24 +101,32 @@ class Fault extends \RuntimeException protected $_localeResolver; /** - * @param \Magento\Core\Model\App $application + * @var \Magento\App\State + */ + protected $appState; + + /** + * @param \Magento\App\RequestInterface $request * @param Server $soapServer * @param \Magento\Webapi\Exception $previousException * @param \Magento\Locale\ResolverInterface $localeResolver + * @param State $appState */ public function __construct( - \Magento\Core\Model\App $application, + \Magento\App\RequestInterface $request, Server $soapServer, \Magento\Webapi\Exception $previousException, - \Magento\Locale\ResolverInterface $localeResolver + \Magento\Locale\ResolverInterface $localeResolver, + State $appState ) { parent::__construct($previousException->getMessage(), $previousException->getCode(), $previousException); $this->_soapCode = $previousException->getOriginator(); $this->_parameters = $previousException->getDetails(); $this->_errorCode = $previousException->getCode(); - $this->_application = $application; + $this->_request = $request; $this->_soapServer = $soapServer; $this->_localeResolver = $localeResolver; + $this->appState = $appState; $this->_setFaultName($previousException->getName()); } @@ -127,7 +137,7 @@ class Fault extends \RuntimeException */ public function toXml() { - if ($this->_application->isDeveloperMode()) { + if ($this->appState->getMode() == State::MODE_DEVELOPER) { $this->addDetails(array(self::NODE_DETAIL_TRACE => "<![CDATA[{$this->getTraceAsString()}]]>")); } if ($this->getParameters()) { @@ -169,7 +179,7 @@ class Fault extends \RuntimeException protected function _setFaultName($exceptionName) { if ($exceptionName) { - $contentType = $this->_application->getRequest()->getHeader('Content-Type'); + $contentType = $this->_request->getHeader('Content-Type'); /** SOAP action is specified in content type header if content type is application/soap+xml */ if (preg_match('|application/soap\+xml.+action="(.+)".*|', $contentType, $matches)) { $soapAction = $matches[1]; diff --git a/app/code/Magento/Webapi/etc/webapi_rest/di.xml b/app/code/Magento/Webapi/etc/webapi_rest/di.xml index 69e4d199206..9d49baaf002 100644 --- a/app/code/Magento/Webapi/etc/webapi_rest/di.xml +++ b/app/code/Magento/Webapi/etc/webapi_rest/di.xml @@ -31,6 +31,7 @@ </arguments> </type> <preference for="Magento\App\FrontControllerInterface" type="Magento\Webapi\Controller\Rest" /> + <preference for="Magento\Model\ActionValidator\RemoveAction" type="Magento\Model\ActionValidator\RemoveAction\Allowed" /> <type name="Magento\Webapi\Controller\Rest\Router\Route" shared="false" /> <type name="Magento\Webapi\Controller\Rest\Request\Deserializer\Factory"> <arguments> diff --git a/app/code/Magento/Webapi/etc/webapi_soap/di.xml b/app/code/Magento/Webapi/etc/webapi_soap/di.xml index 52e0ee9a1c7..4415bbc060b 100644 --- a/app/code/Magento/Webapi/etc/webapi_soap/di.xml +++ b/app/code/Magento/Webapi/etc/webapi_soap/di.xml @@ -31,6 +31,7 @@ </arguments> </type> <preference for="Magento\App\FrontControllerInterface" type="Magento\Webapi\Controller\Soap" /> + <preference for="Magento\Model\ActionValidator\RemoveAction" type="Magento\Model\ActionValidator\RemoveAction\Allowed" /> <type name="Magento\Webapi\Controller\Rest\Router\Route" shared="false" /> <type name="Magento\Webapi\Controller\Soap"> <arguments> diff --git a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php index 7adbc06e577..39eb5de39f1 100644 --- a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php +++ b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php @@ -25,7 +25,7 @@ */ namespace Magento\Weee\Model\Attribute\Backend\Weee; -use Magento\Core\Exception; +use Magento\Model\Exception; class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price { diff --git a/app/code/Magento/Weee/Model/Observer.php b/app/code/Magento/Weee/Model/Observer.php index 2f800f61694..7ec5addd9af 100644 --- a/app/code/Magento/Weee/Model/Observer.php +++ b/app/code/Magento/Weee/Model/Observer.php @@ -25,7 +25,7 @@ */ namespace Magento\Weee\Model; -class Observer extends \Magento\Core\Model\AbstractModel +class Observer extends \Magento\Model\AbstractModel { /** * @var \Magento\Catalog\Model\Product\Type @@ -62,7 +62,7 @@ class Observer extends \Magento\Core\Model\AbstractModel * @param \Magento\Weee\Helper\Data $weeeData * @param \Magento\Catalog\Model\Product\Type $productType * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -74,7 +74,7 @@ class Observer extends \Magento\Core\Model\AbstractModel \Magento\Weee\Helper\Data $weeeData, \Magento\Catalog\Model\Product\Type $productType, \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -251,7 +251,7 @@ class Observer extends \Magento\Core\Model\AbstractModel $response = $observer->getEvent()->getResponseObject(); $options = $response->getAdditionalOptions(); - $_product = $this->_coreRegistry->registry('current_product'); + $_product = $this->_registry->registry('current_product'); if (!$_product) { return $this; } @@ -287,7 +287,7 @@ class Observer extends \Magento\Core\Model\AbstractModel $selection = $observer->getEvent()->getSelection(); $options = $response->getAdditionalOptions(); - $_product = $this->_coreRegistry->registry('current_product'); + $_product = $this->_registry->registry('current_product'); $typeDynamic = \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Attributes\Extend::DYNAMIC; if (!$_product || $_product->getPriceType() != $typeDynamic) { diff --git a/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php b/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php index bde9a7bbbc2..d622c1f004f 100644 --- a/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php +++ b/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php @@ -32,7 +32,7 @@ namespace Magento\Weee\Model\Resource\Attribute\Backend\Weee; * @package Magento_Weee * @author Magento Core Team <core@magentocommerce.com> */ -class Tax extends \Magento\Core\Model\Resource\Db\AbstractDb +class Tax extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Core\Model\StoreManagerInterface diff --git a/app/code/Magento/Weee/Model/Resource/Tax.php b/app/code/Magento/Weee/Model/Resource/Tax.php index 0205ce4c2d7..3d8c6d73db0 100644 --- a/app/code/Magento/Weee/Model/Resource/Tax.php +++ b/app/code/Magento/Weee/Model/Resource/Tax.php @@ -31,7 +31,7 @@ use Magento\Catalog\Model\Product\Condition\ConditionInterface; /** * Wee tax resource model */ -class Tax extends \Magento\Core\Model\Resource\Db\AbstractDb +class Tax extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime diff --git a/app/code/Magento/Weee/Model/Tax.php b/app/code/Magento/Weee/Model/Tax.php index 425d4a51623..e15d9623ad9 100644 --- a/app/code/Magento/Weee/Model/Tax.php +++ b/app/code/Magento/Weee/Model/Tax.php @@ -28,7 +28,7 @@ namespace Magento\Weee\Model; use Magento\Catalog\Model\Product; use Magento\Core\Model\Website; -class Tax extends \Magento\Core\Model\AbstractModel +class Tax extends \Magento\Model\AbstractModel { /** * Including FPT only diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php index b2d44402b2a..00a54f43687 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php @@ -131,14 +131,14 @@ class Options extends \Magento\Backend\Block\Widget\Form\Generic /** * Add fields to main fieldset based on specified widget type * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function addFields() { // get configuration node and translation helper if (!$this->getWidgetType()) { - throw new \Magento\Core\Exception(__('Please specify a Widget Type.')); + throw new \Magento\Model\Exception(__('Please specify a Widget Type.')); } $config = $this->_widget->getConfigAsObject($this->getWidgetType()); if (!$config->getParameters()) { diff --git a/app/code/Magento/Widget/Controller/Adminhtml/Widget.php b/app/code/Magento/Widget/Controller/Adminhtml/Widget.php index e80ebdb7983..98ca02c4b30 100644 --- a/app/code/Magento/Widget/Controller/Adminhtml/Widget.php +++ b/app/code/Magento/Widget/Controller/Adminhtml/Widget.php @@ -110,7 +110,7 @@ class Widget extends \Magento\Backend\App\Action } $this->_view->renderLayout(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result = array('error' => true, 'message' => $e->getMessage()); $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); } diff --git a/app/code/Magento/Widget/Model/Resource/Widget.php b/app/code/Magento/Widget/Model/Resource/Widget.php index fb3b72f5145..bd7f1e28a8c 100644 --- a/app/code/Magento/Widget/Model/Resource/Widget.php +++ b/app/code/Magento/Widget/Model/Resource/Widget.php @@ -34,7 +34,7 @@ */ namespace Magento\Widget\Model\Resource; -class Widget extends \Magento\Core\Model\Resource\Db\AbstractDb +class Widget extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/Widget/Model/Resource/Widget/Instance.php b/app/code/Magento/Widget/Model/Resource/Widget/Instance.php index 9bbc407b3c6..3d7269e1fa3 100644 --- a/app/code/Magento/Widget/Model/Resource/Widget/Instance.php +++ b/app/code/Magento/Widget/Model/Resource/Widget/Instance.php @@ -34,9 +34,9 @@ */ namespace Magento\Widget\Model\Resource\Widget; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; -class Instance extends \Magento\Core\Model\Resource\Db\AbstractDb +class Instance extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/Widget/Model/Resource/Widget/Instance/Collection.php b/app/code/Magento/Widget/Model/Resource/Widget/Instance/Collection.php index daf2cb9a1a0..624d11ca5a9 100644 --- a/app/code/Magento/Widget/Model/Resource/Widget/Instance/Collection.php +++ b/app/code/Magento/Widget/Model/Resource/Widget/Instance/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Widget\Model\Resource\Widget\Instance; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Fields map for corellation names & real selected fields diff --git a/app/code/Magento/Widget/Model/Widget/Instance.php b/app/code/Magento/Widget/Model/Widget/Instance.php index f7b223cd47d..66090c5e3a5 100644 --- a/app/code/Magento/Widget/Model/Widget/Instance.php +++ b/app/code/Magento/Widget/Model/Widget/Instance.php @@ -43,7 +43,7 @@ namespace Magento\Widget\Model\Widget; * @package Magento_Widget * @author Magento Core Team <core@magentocommerce.com> */ -class Instance extends \Magento\Core\Model\AbstractModel +class Instance extends \Magento\Model\AbstractModel { const SPECIFIC_ENTITIES = 'specific'; @@ -137,7 +137,7 @@ class Instance extends \Magento\Core\Model\AbstractModel * @param \Magento\Widget\Model\NamespaceResolver $namespaceResolver * @param \Magento\Math\Random $mathRandom * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string[] $relatedCacheTypes * @param array $data @@ -154,7 +154,7 @@ class Instance extends \Magento\Core\Model\AbstractModel \Magento\Widget\Model\NamespaceResolver $namespaceResolver, \Magento\Math\Random $mathRandom, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $relatedCacheTypes = array(), array $data = array() diff --git a/app/code/Magento/Wishlist/Block/AbstractBlock.php b/app/code/Magento/Wishlist/Block/AbstractBlock.php index f6623f5653a..27e89673681 100644 --- a/app/code/Magento/Wishlist/Block/AbstractBlock.php +++ b/app/code/Magento/Wishlist/Block/AbstractBlock.php @@ -61,36 +61,14 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd protected $_productFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\App\Http\Context $httpContext * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, array $data = array(), @@ -100,16 +78,6 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd $this->_productFactory = $productFactory; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Wishlist/Block/Customer/Sidebar.php b/app/code/Magento/Wishlist/Block/Customer/Sidebar.php index de342a37172..9e301f4ef97 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Sidebar.php +++ b/app/code/Magento/Wishlist/Block/Customer/Sidebar.php @@ -128,9 +128,11 @@ class Sidebar extends \Magento\Wishlist\Block\AbstractBlock implements \Magento\ public function getIdentities() { $identities = array(); - foreach ($this->getWishlistItems() as $item) { - /** @var $item \Magento\Wishlist\Model\Item */ - $identities = array_merge($identities, $item->getProduct()->getIdentities()); + if ($this->getItemCount()) { + foreach ($this->getWishlistItems() as $item) { + /** @var $item \Magento\Wishlist\Model\Item */ + $identities = array_merge($identities, $item->getProduct()->getIdentities()); + } } return $identities; } diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php index cd79559be5c..6dbefdbb1df 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php @@ -54,38 +54,16 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock protected $_formKey; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\App\Http\Context $httpContext * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool * @param \Magento\Data\Form\FormKey $formKey * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool, @@ -97,16 +75,6 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $this->_helperPool = $helperPool; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $httpContext, $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 d3ebf8e4bd1..5a50c00c839 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php @@ -53,37 +53,15 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock ); /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\App\Http\Context $httpContext * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool, @@ -93,16 +71,6 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock $this->_helperPool = $helperPool; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $httpContext, $productFactory, $data, diff --git a/app/code/Magento/Wishlist/Block/Share/Wishlist.php b/app/code/Magento/Wishlist/Block/Share/Wishlist.php index 1525ba5d71c..7d6bd305531 100644 --- a/app/code/Magento/Wishlist/Block/Share/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Share/Wishlist.php @@ -49,37 +49,15 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock protected $_customerFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\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\Catalog\Block\Product\Context $context * @param \Magento\App\Http\Context $httpContext * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \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\Block\Product\Context $context, \Magento\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, @@ -89,16 +67,6 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $this->_customerFactory = $customerFactory; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $httpContext, $productFactory, $data, diff --git a/app/code/Magento/Wishlist/Controller/AbstractController.php b/app/code/Magento/Wishlist/Controller/AbstractController.php index bf2a8b50551..9e0455e83ba 100644 --- a/app/code/Magento/Wishlist/Controller/AbstractController.php +++ b/app/code/Magento/Wishlist/Controller/AbstractController.php @@ -127,7 +127,7 @@ abstract class AbstractController extends \Magento\App\Action\Action if ($item->addToCart($cart, $isOwner)) { $addedItems[] = $item->getProduct(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_NOT_SALABLE) { $notSalable[] = $item; } elseif ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS) { diff --git a/app/code/Magento/Wishlist/Controller/Index.php b/app/code/Magento/Wishlist/Controller/Index.php index b9c03c92aed..9fd3d969fc0 100644 --- a/app/code/Magento/Wishlist/Controller/Index.php +++ b/app/code/Magento/Wishlist/Controller/Index.php @@ -70,6 +70,11 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements */ protected $_transportBuilder; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\App\Action\Context $context * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator @@ -77,6 +82,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements * @param \Magento\Wishlist\Model\Config $wishlistConfig * @param \Magento\App\Response\Http\FileFactory $fileResponseFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\App\Action\Context $context, @@ -84,12 +90,14 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements \Magento\Registry $coreRegistry, \Magento\Wishlist\Model\Config $wishlistConfig, \Magento\App\Response\Http\FileFactory $fileResponseFactory, - \Magento\Mail\Template\TransportBuilder $transportBuilder + \Magento\Mail\Template\TransportBuilder $transportBuilder, + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_coreRegistry = $coreRegistry; $this->_wishlistConfig = $wishlistConfig; $this->_fileResponseFactory = $fileResponseFactory; $this->_transportBuilder = $transportBuilder; + $this->inlineTranslation = $inlineTranslation; parent::__construct($context, $formKeyValidator); } @@ -153,16 +161,16 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements if ($wishlistId) { $wishlist->load($wishlistId); } else { - $wishlist->loadByCustomer($customerId, true); + $wishlist->loadByCustomerId($customerId, true); } if (!$wishlist->getId() || $wishlist->getCustomerId() != $customerId) { $wishlist = null; - throw new \Magento\Core\Exception(__("The requested wish list doesn't exist.")); + throw new \Magento\Model\Exception(__("The requested wish list doesn't exist.")); } $this->_coreRegistry->register('wishlist', $wishlist); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); return false; } catch (\Exception $e) { @@ -242,7 +250,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $result = $wishlist->addNewItem($product, $buyRequest); if (is_string($result)) { - throw new \Magento\Core\Exception($result); + throw new \Magento\Model\Exception($result); } $wishlist->save(); @@ -271,7 +279,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $this->_objectManager->get('Magento\Escaper')->escapeUrl($referer) ); $this->messageManager->addSuccess($message); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError( __('An error occurred while adding item to wish list: %1', $e->getMessage()) ); @@ -297,7 +305,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $item = $this->_objectManager->create('Magento\Wishlist\Model\Item'); $item->loadWithOptions($id); if (!$item->getId()) { - throw new \Magento\Core\Exception(__('We can\'t load the wish list item.')); + throw new \Magento\Model\Exception(__('We can\'t load the wish list item.')); } $wishlist = $this->_getWishlist($item->getWishlistId()); if (!$wishlist) { @@ -325,7 +333,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $this, $params ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('*'); return; @@ -383,7 +391,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $message = __('%1 has been updated in your wish list.', $product->getName()); $this->messageManager->addSuccess($message); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('An error occurred while updating wish list.')); @@ -501,7 +509,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements try { $item->delete(); $wishlist->save(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError( __('An error occurred while deleting the item from wish list: %1', $e->getMessage()) ); @@ -593,7 +601,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $redirectUrl = $this->_redirect->getRefererUrl(); } $this->_objectManager->get('Magento\Wishlist\Helper\Data')->calculate(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_NOT_SALABLE) { $this->messageManager->addError(__('This product(s) is out of stock.')); } elseif ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS) { @@ -633,7 +641,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements try { $item = $cart->getQuote()->getItemById($itemId); if (!$item) { - throw new \Magento\Core\Exception(__("The requested cart item doesn't exist.")); + throw new \Magento\Model\Exception(__("The requested cart item doesn't exist.")); } $productId = $item->getProductId(); @@ -649,7 +657,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $wishlistName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($wishlist->getName()); $this->messageManager->addSuccess(__("%1 has been moved to wish list %2", $productName, $wishlistName)); $wishlist->save(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('We can\'t move the item to the wish list.')); @@ -727,9 +735,8 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements return; } - $translate = $this->_objectManager->get('Magento\TranslateInterface'); - /* @var $translate \Magento\TranslateInterface */ - $translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); + $sent = 0; try { @@ -790,13 +797,13 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $wishlist->setShared($wishlist->getShared() + $sent); $wishlist->save(); - $translate->setTranslateInline(true); + $this->inlineTranslation->resume(); $this->_eventManager->dispatch('wishlist_share', array('wishlist' => $wishlist)); $this->messageManager->addSuccess(__('Your wish list has been shared.')); $this->_redirect('*/*', array('wishlist_id' => $wishlist->getId())); } catch (\Exception $e) { - $translate->setTranslateInline(true); + $this->inlineTranslation->resume(); $this->messageManager->addError($e->getMessage()); $this->_objectManager->get( 'Magento\Wishlist\Model\Session' diff --git a/app/code/Magento/Wishlist/Controller/Shared.php b/app/code/Magento/Wishlist/Controller/Shared.php index f2c204c3d83..b3dc3fcb2df 100644 --- a/app/code/Magento/Wishlist/Controller/Shared.php +++ b/app/code/Magento/Wishlist/Controller/Shared.php @@ -139,7 +139,7 @@ class Shared extends AbstractController if ($this->_objectManager->get('Magento\Checkout\Helper\Cart')->getShouldRedirectToCart()) { $redirectUrl = $this->_objectManager->get('Magento\Checkout\Helper\Cart')->getCartUrl(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_NOT_SALABLE) { $this->messageManager->addError(__('This product(s) is out of stock.')); } else { diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php index 34958fb5850..648f786e8f0 100644 --- a/app/code/Magento/Wishlist/Helper/Data.php +++ b/app/code/Magento/Wishlist/Helper/Data.php @@ -204,7 +204,7 @@ class Data extends \Magento\App\Helper\AbstractHelper } else { $this->_wishlist = $this->_wishlistFactory->create(); if ($this->getCustomer()) { - $this->_wishlist->loadByCustomer($this->getCustomer()); + $this->_wishlist->loadByCustomerId($this->getCustomer()->getId()); } } } diff --git a/app/code/Magento/Wishlist/Model/Item.php b/app/code/Magento/Wishlist/Model/Item.php index cc0f431c3da..f147de4aa2d 100644 --- a/app/code/Magento/Wishlist/Model/Item.php +++ b/app/code/Magento/Wishlist/Model/Item.php @@ -42,7 +42,7 @@ use Magento\Wishlist\Model\Item\Option; use Magento\Wishlist\Model\Item\OptionFactory; use Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory; -class Item extends \Magento\Core\Model\AbstractModel implements +class Item extends \Magento\Model\AbstractModel implements \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface { const EXCEPTION_CODE_NOT_SALABLE = 901; @@ -144,7 +144,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements * @param OptionFactory $wishlistOptFactory * @param CollectionFactory $wishlOptionCollectionFactory * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -158,7 +158,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements OptionFactory $wishlistOptFactory, CollectionFactory $wishlOptionCollectionFactory, \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -230,14 +230,14 @@ class Item extends \Magento\Core\Model\AbstractModel implements * * @param Option $option * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _addOptionCode($option) { if (!isset($this->_optionsByCode[$option->getCode()])) { $this->_optionsByCode[$option->getCode()] = $option; } else { - throw new \Magento\Core\Exception(__('An item option with code %1 already exists.', $option->getCode())); + throw new \Magento\Model\Exception(__('An item option with code %1 already exists.', $option->getCode())); } return $this; } @@ -313,15 +313,15 @@ class Item extends \Magento\Core\Model\AbstractModel implements * Validate wish list item data * * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate() { if (!$this->getWishlistId()) { - throw new \Magento\Core\Exception(__('We can\'t specify a wish list.')); + throw new \Magento\Model\Exception(__('We can\'t specify a wish list.')); } if (!$this->getProductId()) { - throw new \Magento\Core\Exception(__('Cannot specify product.')); + throw new \Magento\Model\Exception(__('Cannot specify product.')); } return true; @@ -372,7 +372,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements /** * Retrieve item product instance * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Catalog\Model\Product */ public function getProduct() @@ -380,7 +380,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements $product = $this->_getData('product'); if (is_null($product)) { if (!$this->getProductId()) { - throw new \Magento\Core\Exception(__('Cannot specify product.')); + throw new \Magento\Model\Exception(__('Cannot specify product.')); } $product = $this->_productFactory->create()->setStoreId($this->getStoreId())->load($this->getProductId()); @@ -405,7 +405,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements * @param \Magento\Checkout\Model\Cart $cart * @param bool $delete delete the item after successful add to cart * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addToCart(\Magento\Checkout\Model\Cart $cart, $delete = false) { @@ -433,7 +433,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements } if (!$product->isSalable()) { - throw new \Magento\Core\Exception(null, self::EXCEPTION_CODE_NOT_SALABLE); + throw new \Magento\Model\Exception(null, self::EXCEPTION_CODE_NOT_SALABLE); } $buyRequest = $this->getBuyRequest(); @@ -661,7 +661,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements * * @param Option|\Magento\Object|array $option * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addOption($option) { @@ -674,7 +674,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements ->setProduct($option->getProduct()) ->setItem($this); } else { - throw new \Magento\Core\Exception(__('Invalid item option format.')); + throw new \Magento\Model\Exception(__('Invalid item option format.')); } $exOption = $this->getOptionByCode($option->getCode()); diff --git a/app/code/Magento/Wishlist/Model/Item/Option.php b/app/code/Magento/Wishlist/Model/Item/Option.php index e137b6259a0..618c53abbd3 100644 --- a/app/code/Magento/Wishlist/Model/Item/Option.php +++ b/app/code/Magento/Wishlist/Model/Item/Option.php @@ -29,7 +29,7 @@ namespace Magento\Wishlist\Model\Item; use Magento\Catalog\Model\Product; use Magento\Wishlist\Model\Item; -class Option extends \Magento\Core\Model\AbstractModel implements +class Option extends \Magento\Model\AbstractModel implements \Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface { /** diff --git a/app/code/Magento/Wishlist/Model/Observer.php b/app/code/Magento/Wishlist/Model/Observer.php index 4994f827ef1..d2a00e3b79a 100644 --- a/app/code/Magento/Wishlist/Model/Observer.php +++ b/app/code/Magento/Wishlist/Model/Observer.php @@ -31,7 +31,7 @@ */ namespace Magento\Wishlist\Model; -class Observer extends \Magento\Core\Model\AbstractModel +class Observer extends \Magento\Model\AbstractModel { /** * Wishlist data @@ -68,7 +68,7 @@ class Observer extends \Magento\Core\Model\AbstractModel * @param \Magento\Customer\Model\Session $customerSession * @param WishlistFactory $wishlistFactory * @param \Magento\Message\ManagerInterface $messageManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -80,7 +80,7 @@ class Observer extends \Magento\Core\Model\AbstractModel \Magento\Customer\Model\Session $customerSession, WishlistFactory $wishlistFactory, \Magento\Message\ManagerInterface $messageManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -103,7 +103,7 @@ class Observer extends \Magento\Core\Model\AbstractModel if (!$customerId) { return false; } - return $this->_wishlistFactory->create()->loadByCustomer($customerId, true); + return $this->_wishlistFactory->create()->loadByCustomerId($customerId, true); } /** @@ -172,7 +172,7 @@ class Observer extends \Magento\Core\Model\AbstractModel if ($this->_customerSession->isLoggedIn()) { $wishlist = $this->_wishlistFactory->create() - ->loadByCustomer($this->_customerSession->getCustomer(), true); + ->loadByCustomerId($this->_customerSession->getCustomerId(), true); } elseif ($sharedWishlist) { $wishlist = $this->_wishlistFactory->create()->loadByCode($sharedWishlist); } else { diff --git a/app/code/Magento/Wishlist/Model/Resource/Item.php b/app/code/Magento/Wishlist/Model/Resource/Item.php index a77b9c87689..0ed6419f892 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item.php @@ -34,7 +34,7 @@ */ namespace Magento\Wishlist\Model\Resource; -class Item extends \Magento\Core\Model\Resource\Db\AbstractDb +class Item extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php b/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php index eaac0c3fcb0..abc5bdd144a 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Wishlist\Model\Resource\Item; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Product Visibility Filter to product collection flag diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Option.php b/app/code/Magento/Wishlist/Model/Resource/Item/Option.php index 84147c97286..fc44a53bf95 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item/Option.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item/Option.php @@ -33,7 +33,7 @@ */ namespace Magento\Wishlist\Model\Resource\Item; -class Option extends \Magento\Core\Model\Resource\Db\AbstractDb +class Option extends \Magento\Model\Resource\Db\AbstractDb { /** * @return void diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Option/Collection.php b/app/code/Magento/Wishlist/Model/Resource/Item/Option/Collection.php index b8692269e51..33e9dfb4bc7 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item/Option/Collection.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item/Option/Collection.php @@ -37,7 +37,7 @@ namespace Magento\Wishlist\Model\Resource\Item\Option; use Magento\Catalog\Model\Product; use Magento\Wishlist\Model\Item; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Array of option ids grouped by item id diff --git a/app/code/Magento/Wishlist/Model/Resource/Wishlist.php b/app/code/Magento/Wishlist/Model/Resource/Wishlist.php index 58b6b4bccc0..cd727a342c0 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Wishlist.php +++ b/app/code/Magento/Wishlist/Model/Resource/Wishlist.php @@ -34,7 +34,7 @@ */ namespace Magento\Wishlist\Model\Resource; -class Wishlist extends \Magento\Core\Model\Resource\Db\AbstractDb +class Wishlist extends \Magento\Model\Resource\Db\AbstractDb { /** * Store wishlist items count @@ -65,7 +65,7 @@ class Wishlist extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Zend_Db_Select */ protected function _getLoadSelect($field, $value, $object) diff --git a/app/code/Magento/Wishlist/Model/Resource/Wishlist/Collection.php b/app/code/Magento/Wishlist/Model/Resource/Wishlist/Collection.php index f766a82d827..b22fe690c95 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Wishlist/Collection.php +++ b/app/code/Magento/Wishlist/Model/Resource/Wishlist/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Wishlist\Model\Resource\Wishlist; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource diff --git a/app/code/Magento/Wishlist/Model/Wishlist.php b/app/code/Magento/Wishlist/Model/Wishlist.php index 0b7cd9cba33..1bb6fa98b88 100644 --- a/app/code/Magento/Wishlist/Model/Wishlist.php +++ b/app/code/Magento/Wishlist/Model/Wishlist.php @@ -25,7 +25,7 @@ */ namespace Magento\Wishlist\Model; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Customer\Model\Customer; use Magento\Wishlist\Model\Resource\Item\CollectionFactory; use Magento\Wishlist\Model\Resource\Wishlist as ResourceWishlist; @@ -43,7 +43,7 @@ use Magento\Wishlist\Model\Resource\Wishlist\Collection; * @method string getUpdatedAt() * @method \Magento\Wishlist\Model\Wishlist setUpdatedAt(string $value) */ -class Wishlist extends \Magento\Core\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Wishlist extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { /** * Cache tag @@ -180,23 +180,19 @@ class Wishlist extends \Magento\Core\Model\AbstractModel implements \Magento\Obj } /** - * Load wishlist by customer + * Load wishlist by customer id * - * @param Customer|int $customer + * @param int $customerId * @param bool $create Create wishlist if don't exists * @return $this */ - public function loadByCustomer($customer, $create = false) + public function loadByCustomerId($customerId, $create = false) { - if ($customer instanceof Customer) { - $customer = $customer->getId(); - } - - $customer = (int)$customer; + $customerId = (int)$customerId; $customerIdFieldName = $this->_getResource()->getCustomerIdFieldName(); - $this->_getResource()->load($this, $customer, $customerIdFieldName); + $this->_getResource()->load($this, $customerId, $customerIdFieldName); if (!$this->getId() && $create) { - $this->setCustomerId($customer); + $this->setCustomerId($customerId); $this->setSharingCode($this->_getSharingRandomCode()); $this->save(); } diff --git a/app/design/adminhtml/magento_backend/css/admin.css b/app/design/adminhtml/magento_backend/css/admin.css index b42a4da9d26..f35e355d900 100644 --- a/app/design/adminhtml/magento_backend/css/admin.css +++ b/app/design/adminhtml/magento_backend/css/admin.css @@ -131,7 +131,7 @@ button.primary, .adminhtml-catalog-event-index .page-actions .add, .adminhtml-urlrewrite-index .page-actions .add, .catalog-search-index .page-actions .add, -.catalog-product-review-index .page-actions .add, +.review-product-index .page-actions .add, .catalog-rule-promo-catalog-index .page-actions .add, .sales-rule-promo-quote-index .page-actions .add, .adminhtml-reminder-index .page-actions .add, @@ -256,9 +256,9 @@ button.primary:active, .catalog-search-index .page-actions .add:hover, .catalog-search-index .page-actions .add:focus, .catalog-search-index .page-actions .add:active, -.catalog-product-review-index .page-actions .add:hover, -.catalog-product-review-index .page-actions .add:focus, -.catalog-product-review-index .page-actions .add:active, +.review-product-index .page-actions .add:hover, +.review-product-index .page-actions .add:focus, +.review-product-index .page-actions .add:active, .catalog-rule-promo-catalog-index .page-actions .add:hover, .catalog-rule-promo-catalog-index .page-actions .add:focus, .catalog-rule-promo-catalog-index .page-actions .add:active, @@ -405,7 +405,7 @@ button.primary:active, .adminhtml-catalog-event-index .page-actions .add:active, .adminhtml-urlrewrite-index .page-actions .add:active, .catalog-search-index .page-actions .add:active, -.catalog-product-review-index .page-actions .add:active, +.review-product-index .page-actions .add:active, .catalog-rule-promo-catalog-index .page-actions .add:active, .sales-rule-promo-quote-index .page-actions .add:active, .adminhtml-reminder-index .page-actions .add:active, @@ -470,7 +470,7 @@ button.primary:visited, .adminhtml-catalog-event-index .page-actions .add:visited, .adminhtml-urlrewrite-index .page-actions .add:visited, .catalog-search-index .page-actions .add:visited, -.catalog-product-review-index .page-actions .add:visited, +.review-product-index .page-actions .add:visited, .catalog-rule-promo-catalog-index .page-actions .add:visited, .sales-rule-promo-quote-index .page-actions .add:visited, .adminhtml-reminder-index .page-actions .add:visited, @@ -557,8 +557,8 @@ button.primary.disabled, .adminhtml-urlrewrite-index .page-actions .add.disabled, .catalog-search-index .page-actions .add[disabled], .catalog-search-index .page-actions .add.disabled, -.catalog-product-review-index .page-actions .add[disabled], -.catalog-product-review-index .page-actions .add.disabled, +.review-product-index .page-actions .add[disabled], +.review-product-index .page-actions .add.disabled, .catalog-rule-promo-catalog-index .page-actions .add[disabled], .catalog-rule-promo-catalog-index .page-actions .add.disabled, .sales-rule-promo-quote-index .page-actions .add[disabled], @@ -731,10 +731,10 @@ button.primary.disabled:active, .catalog-search-index .page-actions .add.disabled:hover, .catalog-search-index .page-actions .add[disabled]:active, .catalog-search-index .page-actions .add.disabled:active, -.catalog-product-review-index .page-actions .add[disabled]:hover, -.catalog-product-review-index .page-actions .add.disabled:hover, -.catalog-product-review-index .page-actions .add[disabled]:active, -.catalog-product-review-index .page-actions .add.disabled:active, +.review-product-index .page-actions .add[disabled]:hover, +.review-product-index .page-actions .add.disabled:hover, +.review-product-index .page-actions .add[disabled]:active, +.review-product-index .page-actions .add.disabled:active, .catalog-rule-promo-catalog-index .page-actions .add[disabled]:hover, .catalog-rule-promo-catalog-index .page-actions .add.disabled:hover, .catalog-rule-promo-catalog-index .page-actions .add[disabled]:active, @@ -914,7 +914,7 @@ button.primary, .adminhtml-catalog-event-index .page-actions .add, .adminhtml-urlrewrite-index .page-actions .add, .catalog-search-index .page-actions .add, -.catalog-product-review-index .page-actions .add, +.review-product-index .page-actions .add, .catalog-rule-promo-catalog-index .page-actions .add, .sales-rule-promo-quote-index .page-actions .add, .adminhtml-reminder-index .page-actions .add, @@ -989,8 +989,8 @@ button.primary:hover, .adminhtml-urlrewrite-index .page-actions .add:hover, .catalog-search-index .page-actions .add:focus, .catalog-search-index .page-actions .add:hover, -.catalog-product-review-index .page-actions .add:focus, -.catalog-product-review-index .page-actions .add:hover, +.review-product-index .page-actions .add:focus, +.review-product-index .page-actions .add:hover, .catalog-rule-promo-catalog-index .page-actions .add:focus, .catalog-rule-promo-catalog-index .page-actions .add:hover, .sales-rule-promo-quote-index .page-actions .add:focus, @@ -1090,7 +1090,7 @@ button.primary:active, .adminhtml-catalog-event-index .page-actions .add:active, .adminhtml-urlrewrite-index .page-actions .add:active, .catalog-search-index .page-actions .add:active, -.catalog-product-review-index .page-actions .add:active, +.review-product-index .page-actions .add:active, .catalog-rule-promo-catalog-index .page-actions .add:active, .sales-rule-promo-quote-index .page-actions .add:active, .adminhtml-reminder-index .page-actions .add:active, @@ -1150,7 +1150,7 @@ button.primary:visited, .adminhtml-catalog-event-index .page-actions .add:visited, .adminhtml-urlrewrite-index .page-actions .add:visited, .catalog-search-index .page-actions .add:visited, -.catalog-product-review-index .page-actions .add:visited, +.review-product-index .page-actions .add:visited, .catalog-rule-promo-catalog-index .page-actions .add:visited, .sales-rule-promo-quote-index .page-actions .add:visited, .adminhtml-reminder-index .page-actions .add:visited, @@ -1253,10 +1253,10 @@ button.primary.disabled:active, .catalog-search-index .page-actions .add.disabled:hover, .catalog-search-index .page-actions .add[disabled]:active, .catalog-search-index .page-actions .add.disabled:active, -.catalog-product-review-index .page-actions .add[disabled]:hover, -.catalog-product-review-index .page-actions .add.disabled:hover, -.catalog-product-review-index .page-actions .add[disabled]:active, -.catalog-product-review-index .page-actions .add.disabled:active, +.review-product-index .page-actions .add[disabled]:hover, +.review-product-index .page-actions .add.disabled:hover, +.review-product-index .page-actions .add[disabled]:active, +.review-product-index .page-actions .add.disabled:active, .catalog-rule-promo-catalog-index .page-actions .add[disabled]:hover, .catalog-rule-promo-catalog-index .page-actions .add.disabled:hover, .catalog-rule-promo-catalog-index .page-actions .add[disabled]:active, @@ -1428,7 +1428,7 @@ button.primary.disabled:active, .adminhtml-catalog-event-index .page-actions .add, .adminhtml-urlrewrite-index .page-actions .add, .catalog-search-index .page-actions .add, -.catalog-product-review-index .page-actions .add, +.review-product-index .page-actions .add, .catalog-rule-promo-catalog-index .page-actions .add, .sales-rule-promo-quote-index .page-actions .add, .adminhtml-reminder-index .page-actions .add, @@ -1479,7 +1479,7 @@ button.primary.disabled:active, .adminhtml-catalog-event-index .page-actions .add:focus, .adminhtml-urlrewrite-index .page-actions .add:focus, .catalog-search-index .page-actions .add:focus, -.catalog-product-review-index .page-actions .add:focus, +.review-product-index .page-actions .add:focus, .catalog-rule-promo-catalog-index .page-actions .add:focus, .sales-rule-promo-quote-index .page-actions .add:focus, .adminhtml-reminder-index .page-actions .add:focus, @@ -1525,7 +1525,7 @@ button.primary.disabled:active, .adminhtml-catalog-event-index .page-actions .add > span, .adminhtml-urlrewrite-index .page-actions .add > span, .catalog-search-index .page-actions .add > span, -.catalog-product-review-index .page-actions .add > span, +.review-product-index .page-actions .add > span, .catalog-rule-promo-catalog-index .page-actions .add > span, .sales-rule-promo-quote-index .page-actions .add > span, .adminhtml-reminder-index .page-actions .add > span, @@ -1574,7 +1574,7 @@ button.primary.disabled:active, .adminhtml-catalog-event-index .page-actions .add > span:before, .adminhtml-urlrewrite-index .page-actions .add > span:before, .catalog-search-index .page-actions .add > span:before, -.catalog-product-review-index .page-actions .add > span:before, +.review-product-index .page-actions .add > span:before, .catalog-rule-promo-catalog-index .page-actions .add > span:before, .sales-rule-promo-quote-index .page-actions .add > span:before, .adminhtml-reminder-index .page-actions .add > span:before, @@ -1634,7 +1634,7 @@ button.primary.disabled:active, .eq-ie9 .adminhtml-catalog-event-index .page-actions .add > span:before, .eq-ie9 .adminhtml-urlrewrite-index .page-actions .add > span:before, .eq-ie9 .catalog-search-index .page-actions .add > span:before, -.eq-ie9 .catalog-product-review-index .page-actions .add > span:before, +.eq-ie9 .review-product-index .page-actions .add > span:before, .eq-ie9 .catalog-rule-promo-catalog-index .page-actions .add > span:before, .eq-ie9 .sales-rule-promo-quote-index .page-actions .add > span:before, .eq-ie9 .adminhtml-reminder-index .page-actions .add > span:before, @@ -6291,7 +6291,7 @@ table .col-draggable .draggable-handle { .adminhtml-catalog-event-index .col-1-layout, .adminhtml-urlrewrite-index .col-1-layout, .catalog-search-index .col-1-layout, -.catalog-product-review-index .col-1-layout, +.review-product-index .col-1-layout, .catalog-rule-promo-catalog-index .col-1-layout, .sales-rule-promo-quote-index .col-1-layout, .adminhtml-reminder-index .col-1-layout, @@ -6374,7 +6374,7 @@ table .col-draggable .draggable-handle { .adminhtml-catalog-event-index .grid-actions, .adminhtml-urlrewrite-index .grid-actions, .catalog-search-index .grid-actions, -.catalog-product-review-index .grid-actions, +.review-product-index .grid-actions, .catalog-rule-promo-catalog-index .grid-actions, .sales-rule-promo-quote-index .grid-actions, .adminhtml-reminder-index .grid-actions, @@ -6418,7 +6418,7 @@ table .col-draggable .draggable-handle { .adminhtml-catalog-event-index .page-actions.fixed, .adminhtml-urlrewrite-index .page-actions.fixed, .catalog-search-index .page-actions.fixed, -.catalog-product-review-index .page-actions.fixed, +.review-product-index .page-actions.fixed, .catalog-rule-promo-catalog-index .page-actions.fixed, .sales-rule-promo-quote-index .page-actions.fixed, .adminhtml-reminder-index .page-actions.fixed, @@ -6463,7 +6463,7 @@ table .col-draggable .draggable-handle { .adminhtml-catalog-event-index .page-actions, .adminhtml-urlrewrite-index .page-actions, .catalog-search-index .page-actions, -.catalog-product-review-index .page-actions, +.review-product-index .page-actions, .catalog-rule-promo-catalog-index .page-actions, .sales-rule-promo-quote-index .page-actions, .adminhtml-reminder-index .page-actions, diff --git a/app/etc/di.xml b/app/etc/di.xml index 4e9b0158b60..189debd0ccd 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -30,7 +30,6 @@ <preference for="Magento\App\RouterListInterface" type="Magento\App\RouterList" /> <preference for="Magento\App\FrontControllerInterface" type="Magento\App\FrontController" /> <preference for="Magento\Module\UpdaterInterface" type="Magento\Module\Updater" /> - <preference for="Magento\AppInterface" type="Magento\Core\Model\App\Proxy" /> <preference for="Magento\App\CacheInterface" type="Magento\App\Cache\Proxy" /> <preference for="Magento\App\Cache\StateInterface" type="Magento\App\Cache\State" /> <preference for="Magento\App\Cache\TypeListInterface" type="Magento\App\Cache\TypeList" /> @@ -87,7 +86,12 @@ <preference for="Magento\Mview\ProcessorInterface" type="Magento\Mview\Processor" /> <preference for="Magento\Mview\View\CollectionInterface" type="Magento\Mview\View\Collection" /> <preference for="Magento\Mview\View\SubscriptionInterface" type="Magento\Mview\View\Subscription" /> - <preference for="Magento\Mview\View\ChangelogInterface" type="Magento\Mview\View\Changelog" /> + <preference for="Magento\Mview\View\ChangelogInterface" type="Magento\Mview\View\Changelog" /> + <type name="Magento\Model\Context"> + <arguments> + <argument name="actionValidator" xsi:type="object">Magento\Model\ActionValidator\RemoveAction\Proxy</argument> + </arguments> + </type> <type name="Magento\Message\Manager"> <arguments> <argument name="session" xsi:type="object">Magento\Message\Session\Proxy</argument> @@ -141,12 +145,12 @@ </type> <type name="Magento\Module\Declaration\Reader\Filesystem"> <arguments> - <argument name="allowedModules" xsi:type="init_parameter">Magento\Core\Model\App::PARAM_ALLOWED_MODULES</argument> + <argument name="allowedModules" xsi:type="init_parameter">Magento\Module\Declaration\Reader\Filesystem::PARAM_ALLOWED_MODULES</argument> </arguments> </type> <type name="Magento\App\Cache\Frontend\Factory"> <arguments> - <argument name="enforcedOptions" xsi:type="init_parameter">Magento\Core\Model\App::PARAM_CACHE_FORCED_OPTIONS</argument> + <argument name="enforcedOptions" xsi:type="init_parameter">Magento\App\Cache\Frontend\Factory::PARAM_CACHE_FORCED_OPTIONS</argument> <argument name="decorators" xsi:type="array"> <item name="tag" xsi:type="array"> <item name="class" xsi:type="string">Magento\Cache\Frontend\Decorator\TagScope</item> @@ -160,19 +164,26 @@ </type> <type name="Magento\App\Cache\State"> <arguments> - <argument name="banAll" xsi:type="init_parameter">Magento\Core\Model\App::PARAM_BAN_CACHE</argument> + <argument name="banAll" xsi:type="init_parameter">Magento\App\Cache\State::PARAM_BAN_CACHE</argument> </arguments> </type> <type name="Magento\Core\Model\StoreManager"> <arguments> - <argument name="scopeCode" xsi:type="init_parameter">Magento\Core\Model\App::PARAM_RUN_CODE</argument> - <argument name="scopeType" xsi:type="init_parameter">Magento\Core\Model\App::PARAM_RUN_TYPE</argument> + <argument name="scopeCode" xsi:type="init_parameter">Magento\Core\Model\StoreManager::PARAM_RUN_CODE</argument> + <argument name="scopeType" xsi:type="init_parameter">Magento\Core\Model\StoreManager::PARAM_RUN_TYPE</argument> </arguments> </type> <type name="Magento\Translate"> <arguments> <argument name="cache" xsi:type="object">Magento\App\Cache\Type\Translate</argument> <argument name="locale" xsi:type="object">Magento\Locale\Resolver\Proxy</argument> + <argument name="translate" xsi:type="object">Magento\Translate\ResourceInterface\Proxy</argument> + <argument name="request" xsi:type="object">Magento\App\Request\Http\Proxy</argument> + </arguments> + </type> + <type name="Magento\App\Helper\Context"> + <arguments> + <argument name="translateInline" xsi:type="object">Magento\Translate\InlineInterface\Proxy</argument> </arguments> </type> <type name="Magento\Data\Structure" shared="false" /> @@ -326,7 +337,7 @@ </type> <type name="Magento\Mview\View"> <arguments> - <argument name="state" xsi:type="object" shared="false">Magento\Core\Model\Mview\View\State</argument> + <argument name="state" xsi:type="object" shared="false">Magento\Indexer\Model\Mview\View\State</argument> <argument name="changelog" xsi:type="object" shared="false">Magento\Mview\View\Changelog</argument> </arguments> </type> @@ -368,4 +379,9 @@ </argument> </arguments> </type> + <type name="Magento\Translate\Inline"> + <arguments> + <argument name="parser" xsi:type="object">Magento\Translate\Inline\ParserInterface\Proxy</argument> + </arguments> + </type> </config> diff --git a/app/etc/local.xml.template b/app/etc/local.xml.template index a54acc9e4a5..5c517a2403d 100644 --- a/app/etc/local.xml.template +++ b/app/etc/local.xml.template @@ -55,7 +55,7 @@ <!-- DB model layer. Used to determine names of resource helpers and specific installs/upgrades for a DB vendor. --> <model>{{db_model}}</model> - <adapter>Magento\Core\Model\Resource\Type\Db\Pdo\Mysql</adapter> + <adapter>Magento\Model\Resource\Type\Db\Pdo\Mysql</adapter> <!-- Connection activation. Default connection is last level of fallback, thus it must be always left active. --> <active>1</active> diff --git a/dev/shell/indexer.php b/dev/shell/indexer.php index 7ac4fca66c1..5de788f9c0c 100644 --- a/dev/shell/indexer.php +++ b/dev/shell/indexer.php @@ -25,9 +25,11 @@ */ require_once __DIR__ . '/../../app/bootstrap.php'; +use Magento\Core\Model\StoreManager; + $params = array( - \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', - \Magento\Core\Model\App::PARAM_RUN_TYPE => 'store' + StoreManager::PARAM_RUN_CODE => 'admin', + StoreManager::PARAM_RUN_TYPE => 'store' ); $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); diff --git a/dev/shell/log.php b/dev/shell/log.php index b026dc0330d..87a85315b0f 100644 --- a/dev/shell/log.php +++ b/dev/shell/log.php @@ -25,9 +25,12 @@ */ require_once __DIR__ . '/../../app/bootstrap.php'; +use Magento\Core\Model\StoreManager; + $params = array( - \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', - \Magento\Core\Model\App::PARAM_RUN_TYPE => 'store' + StoreManager::PARAM_RUN_CODE => 'admin', + StoreManager::PARAM_RUN_TYPE => 'store' ); + $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); $entryPoint->run('Magento\Log\App\Shell', array('entryFileName' => basename(__FILE__))); diff --git a/dev/shell/newindexer.php b/dev/shell/newindexer.php index 5aba5c90f75..d6ecda69728 100644 --- a/dev/shell/newindexer.php +++ b/dev/shell/newindexer.php @@ -25,9 +25,11 @@ */ require_once __DIR__ . '/../../app/bootstrap.php'; +use Magento\Core\Model\StoreManager; + $params = array( - \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', - \Magento\Core\Model\App::PARAM_RUN_TYPE => 'store' + StoreManager::PARAM_RUN_CODE => 'admin', + StoreManager::PARAM_RUN_TYPE => 'store' ); $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); diff --git a/dev/tests/integration/framework/Magento/TestFramework/App.php b/dev/tests/integration/framework/Magento/TestFramework/App.php deleted file mode 100644 index ad1a7211399..00000000000 --- a/dev/tests/integration/framework/Magento/TestFramework/App.php +++ /dev/null @@ -1,40 +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 - * @subpackage integration_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\TestFramework; - -/** - * App class for integration test framework - */ -class App extends \Magento\Core\Model\App -{ - public function loadArea($code) - { - $area = $this->getArea($code); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode($code); - $area->load(); - } -} diff --git a/dev/tests/integration/framework/Magento/TestFramework/Application.php b/dev/tests/integration/framework/Magento/TestFramework/Application.php index 55c422a26f9..237f60f66b1 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Application.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Application.php @@ -231,8 +231,7 @@ class Application $objectManager->configure( array( 'preferences' => array( - 'Magento\App\State' => 'Magento\TestFramework\App\State', - 'Magento\Core\Model\App' => 'Magento\TestFramework\App' + 'Magento\App\State' => 'Magento\TestFramework\App\State' ) ) ); @@ -253,7 +252,7 @@ class Application ); $this->loadArea(\Magento\TestFramework\Application::DEFAULT_APP_AREA); - \Magento\Phrase::setRenderer($objectManager->get('Magento\Phrase\Renderer\Placeholder')); + \Magento\Phrase::setRenderer($objectManager->get('Magento\Phrase\RendererInterface')); /** @var \Magento\App\Filesystem\DirectoryList\Verification $verification */ $verification = $objectManager->get('Magento\App\Filesystem\DirectoryList\Verification'); @@ -346,12 +345,8 @@ class Application /* Initialize an application in non-installed mode */ $this->initialize(); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadAreaPart( - 'install', - \Magento\Core\Model\App\Area::PART_CONFIG - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea('install')->load(\Magento\Core\Model\App\Area::PART_CONFIG); /* Run all install and data-install scripts */ /** @var $updater \Magento\Module\Updater */ @@ -518,11 +513,11 @@ class Application $areaCode ) ); - $app = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App'); + $app = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList'); if ($areaCode == \Magento\TestFramework\Application::DEFAULT_APP_AREA) { - $app->loadAreaPart($areaCode, \Magento\Core\Model\App\Area::PART_CONFIG); + $app->getArea($areaCode)->load(\Magento\Core\Model\App\Area::PART_CONFIG); } else { - $app->loadArea($areaCode); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea($areaCode); } } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Db/ConnectionAdapter.php b/dev/tests/integration/framework/Magento/TestFramework/Db/ConnectionAdapter.php index a4b7b447593..f5807f9f2ac 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Db/ConnectionAdapter.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Db/ConnectionAdapter.php @@ -25,7 +25,7 @@ */ namespace Magento\TestFramework\Db; -class ConnectionAdapter extends \Magento\Core\Model\Resource\Type\Db\Pdo\Mysql +class ConnectionAdapter extends \Magento\Model\Resource\Type\Db\Pdo\Mysql { /** * Retrieve DB adapter class name diff --git a/dev/tests/integration/framework/Magento/TestFramework/Entity.php b/dev/tests/integration/framework/Magento/TestFramework/Entity.php index 318dfbe5612..b579163a30e 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Entity.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Entity.php @@ -26,20 +26,20 @@ */ /** - * Class that implements CRUP tests for \Magento\Core\Model\AbstractModel based objects + * Class that implements CRUP tests for \Magento\Model\AbstractModel based objects */ namespace Magento\TestFramework; class Entity { /** - * @var \Magento\Core\Model\AbstractModel + * @var \Magento\Model\AbstractModel */ protected $_model; protected $_updateData; - public function __construct(\Magento\Core\Model\AbstractModel $model, array $updateData) + public function __construct(\Magento\Model\AbstractModel $model, array $updateData) { $this->_model = $model; $this->_updateData = $updateData; @@ -59,7 +59,7 @@ class Entity } /** - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _getEmptyModel() { diff --git a/dev/tests/integration/framework/Magento/TestFramework/Helper/Bootstrap.php b/dev/tests/integration/framework/Magento/TestFramework/Helper/Bootstrap.php index 140f0dd2c09..024c4cf05cb 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Helper/Bootstrap.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Helper/Bootstrap.php @@ -177,4 +177,14 @@ class Bootstrap { return $this->_bootstrap; } + + /** + * Load area + * @param string $areaCode + */ + public function loadArea($areaCode) + { + self::$_objectManager->get('Magento\App\State')->setAreaCode($areaCode); + self::$_objectManager->get('Magento\App\AreaList')->getArea($areaCode)->load(); + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php index 06c4db3428b..0690631c2a1 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php +++ b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php @@ -116,7 +116,7 @@ abstract class AbstractController extends \PHPUnit_Framework_TestCase /** * Request getter * - * @return \Magento\App\RequestInterface + * @return \Magento\TestFramework\Request */ public function getRequest() { @@ -129,7 +129,7 @@ abstract class AbstractController extends \PHPUnit_Framework_TestCase /** * Response getter * - * @return \Magento\App\ResponseInterface + * @return \Magento\TestFramework\Response */ public function getResponse() { diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/EntityTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/EntityTest.php index 3f6efda1e69..32a6b2d77e3 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/EntityTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/EntityTest.php @@ -29,7 +29,7 @@ namespace Magento\Test; class EntityTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\AbstractModel|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Model\AbstractModel|\PHPUnit_Framework_MockObject_MockObject */ protected $_model; @@ -79,7 +79,7 @@ class EntityTest extends \PHPUnit_Framework_TestCase $this->setExpectedException($expectedException); $this->_model = $this->getMock( - 'Magento\Core\Model\AbstractModel', + 'Magento\Model\AbstractModel', array('load', 'save', 'delete', 'getIdFieldName', '__wakeup'), array(), '', diff --git a/dev/tests/integration/phpunit.xml.dist b/dev/tests/integration/phpunit.xml.dist index 3fa1f5dd986..2477b7ef3c4 100644 --- a/dev/tests/integration/phpunit.xml.dist +++ b/dev/tests/integration/phpunit.xml.dist @@ -41,14 +41,12 @@ </testsuites> <!-- Code coverage filters --> <filter> - <whitelist> - <!-- All CE modules --> + <whitelist addUncoveredFilesFromWhiteList="true"> <directory suffix=".php">../../../app/code/Magento</directory> + <directory suffix=".php">../../../lib/Magento</directory> <exclude> - <!-- Excluding installation and upgrade scripts --> - <directory>../../../app/code/Magento/*/sql</directory> - <!-- Excluding data installation and upgrade scripts --> - <directory>../../../app/code/Magento/*/data</directory> + <directory suffix=".php">../../../app/code/Magento/*/sql</directory> + <directory suffix=".php">../../../app/code/Magento/*/data</directory> </exclude> </whitelist> </filter> @@ -57,7 +55,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"/> + <ini name="memory_limit" value="4096M"/> <!-- 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 --> 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 d770ead3f31..80d5dd29b23 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 @@ -25,6 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Backend\Block\System\Config; +use Magento\App\Cache\State; /** * @magentoAppArea adminhtml @@ -251,20 +252,15 @@ class FormTest extends \PHPUnit_Framework_TestCase */ protected function _setupFieldsInheritCheckbox($useConfigField, $isConfigDataEmpty, $configDataValue) { - \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize( - array(\Magento\Core\Model\App::PARAM_BAN_CACHE => true) - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Config\ScopeInterface' - )->setCurrentScope( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( + State::PARAM_BAN_CACHE => true, + )); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Config\ScopeInterface') + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); $fileResolverMock = $this->getMockBuilder( 'Magento\Core\Model\Config\FileResolver' 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 23331fa9de2..d4126a6b6cb 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 @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Backend\Block\Widget\Grid; - +use Magento\Core\Model\StoreManager; /** * @magentoDataFixture Magento/Backend/Block/_files/backend_theme.php * @@ -67,15 +67,13 @@ class MassactionTest extends \PHPUnit_Framework_TestCase */ protected function _setFixtureTheme() { - \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\Filesystem::PARAM_APP_DIRS => array( - \Magento\App\Filesystem::THEMES_DIR => array('path' => __DIR__ . '/../../_files/design') - ) - ) - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( + StoreManager::PARAM_RUN_CODE => 'admin', + StoreManager::PARAM_RUN_TYPE => 'store', + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => __DIR__ . '/../../_files/design') + ), + )); } /** diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php index 2c76ae39c83..f0e47ab05ba 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 @@ -22,13 +22,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** @var $registration \Magento\Core\Model\Theme\Registration */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->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()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); +$registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Core\Model\Theme\Registration'); +$registration->register( + __DIR__ . '/design', + '*/*/theme.xml' ); -$registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Theme\Registration' -); -$registration->register(__DIR__ . '/design', '*/*/theme.xml'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php index 21912f882d1..369e00ff6c9 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php @@ -128,9 +128,7 @@ class AuthTest extends \Magento\TestFramework\TestCase\AbstractController $this->dispatch('backend/admin/index/index'); - $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getResponse(); + $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\ResponseInterface'); $code = $response->getHttpResponseCode(); $this->assertTrue($code >= 300 && $code < 400, 'Incorrect response code'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/AuthTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/AuthTest.php index 50a44f70e07..7a445822d2f 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/AuthTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/AuthTest.php @@ -42,14 +42,10 @@ class AuthTest extends \PHPUnit_Framework_TestCase { parent::setUp(); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Backend\Model\Auth' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Backend\Model\Auth'); } /** diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php index cde89d2f052..f130e87a05c 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php @@ -117,7 +117,7 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase * @param string $path * @param string $value * @magentoDbIsolation enabled - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @dataProvider validationExceptionDataProvider */ public function testValidationException($path, $value) diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Image/AdapterTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Image/AdapterTest.php index 1e5eb35f7b1..d395b6ef718 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Image/AdapterTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Image/AdapterTest.php @@ -42,7 +42,7 @@ class AdapterTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * expectedExceptionMessage The specified image adapter cannot be used because of some missed dependencies. * @magentoDbIsolation enabled * @magentoAppIsolation enabled diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/MenuTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/MenuTest.php index 82129c29d2d..eb49b87ed33 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/MenuTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/MenuTest.php @@ -41,19 +41,12 @@ class MenuTest extends \PHPUnit_Framework_TestCase protected function setUp() { parent::setUp(); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Backend\Model\Auth' - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Config\ScopeInterface' - )->setCurrentScope( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Backend\Model\Auth'); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\ScopeInterface') + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); } public function testMenuItemManipulation() diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/ObserverTest.php index 7cb0ce99e77..27961d87326 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/ObserverTest.php @@ -71,9 +71,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $observer = $this->_buildObserver(); $this->_model->actionPreDispatchAdmin($observer); - $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getResponse(); + $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\ResponseInterface'); $code = $response->getHttpResponseCode(); $this->assertTrue($code >= 300 && $code < 400); @@ -94,9 +92,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $observer = $this->_buildObserver(); $this->_model->actionPreDispatchAdmin($observer); - $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getResponse(); + $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\ResponseInterface'); $code = $response->getHttpResponseCode(); $this->assertFalse($code >= 300 && $code < 400); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php index fd73a81248b..df1eff680af 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php @@ -33,11 +33,8 @@ class GridTest extends \PHPUnit_Framework_TestCase */ public function testToHtmlHasOnClick() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Layout', diff --git a/dev/tests/integration/testsuite/Magento/Captcha/_files/dummy_user.php b/dev/tests/integration/testsuite/Magento/Captcha/_files/dummy_user.php index 59123f02fc8..abd97027ec6 100644 --- a/dev/tests/integration/testsuite/Magento/Captcha/_files/dummy_user.php +++ b/dev/tests/integration/testsuite/Magento/Captcha/_files/dummy_user.php @@ -28,11 +28,8 @@ /** * Create dummy user */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE -); +\Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $user \Magento\User\Model\User */ $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\User\Model\User'); $user->setFirstname( diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php index b5a8ff217c8..329b1529bb1 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php @@ -40,7 +40,7 @@ class NewTest extends \PHPUnit_Framework_TestCase protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + \Magento\TestFramework\Helper\Bootstrap::getInstance() ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Http\Context') ->setValue( diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php index 4705f5fa8f8..663b8090b62 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php @@ -35,14 +35,10 @@ class CrosssellTest extends \PHPUnit_Framework_TestCase { public function testAll() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Product' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); $product->load(2); /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php index 8a4de53a87a..03634ace170 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php @@ -35,14 +35,10 @@ class RelatedTest extends \PHPUnit_Framework_TestCase { public function testAll() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Product' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); $product->load(2); /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/SendTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/SendTest.php new file mode 100644 index 00000000000..96d9d0ac5f3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/SendTest.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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Block\Product; + +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Customer\Model\Session; + +class SendTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Send + */ + protected $block; + + /** + * @var Session + */ + protected $customerSession; + + protected function setUp() + { + $objectManager = Bootstrap::getObjectManager(); + $objectManager->get('Magento\App\State')->setAreaCode('frontend'); + + $this->customerSession = $objectManager->get('Magento\Customer\Model\Session'); + $this->block = $objectManager->get('Magento\View\LayoutInterface') + ->createBlock( + 'Magento\Catalog\Block\Product\Send', + '', + ['customerSession' => $this->customerSession] + ); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testGetUserName() + { + $this->customerSession->setCustomerId(1); + $this->assertEquals('Firstname Lastname', $this->block->getUserName()); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testGetEmail() + { + $this->customerSession->setCustomerId(1); + $this->assertEquals('customer@example.com', $this->block->getEmail()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php index 8152599f13b..489ef47e82f 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php @@ -73,21 +73,21 @@ class AttributeTest extends \Magento\Backend\Utility\Controller } /** - * @magentoDataFixture Magento/Core/_files/db_translate_admin_store.php + * @magentoDataFixture Magento/Translation/_files/db_translate_admin_store.php * @magentoDataFixture Magento/Backend/controllers/_files/cache/all_types_enabled.php * @magentoDataFixture Magento/Catalog/controllers/_files/attribute_user_defined.php * @magentoAppIsolation enabled */ public function testSaveActionCleanAttributeLabelCache() { - /** @var \Magento\Core\Model\Resource\Translate\String $string */ - $string = $this->_objectManager->create('Magento\Core\Model\Resource\Translate\String'); - $this->assertEquals($this->_translate('string to translate'), 'predefined string translation'); + /** @var \Magento\Translation\Model\Resource\String $string */ + $string = $this->_objectManager->create('Magento\Translation\Model\Resource\String'); + $this->assertEquals('predefined string translation', $this->_translate('string to translate')); $string->saveTranslate('string to translate', 'new string translation'); $postData = $this->_getAttributeData() + array('attribute_id' => 1); $this->getRequest()->setPost($postData); $this->dispatch('backend/catalog/product_attribute/save'); - $this->assertEquals($this->_translate('string to translate'), 'new string translation'); + $this->assertEquals('new string translation', $this->_translate('string to translate')); } /** @@ -105,9 +105,9 @@ class AttributeTest extends \Magento\Backend\Utility\Controller 1 ); /** @var \Magento\TranslateInterface $translate */ - $translate = $this->_objectManager->create('Magento\TranslateInterface'); - $translate->init(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, null, true); - return $translate->translate(array($string)); + $translate = $this->_objectManager->get('Magento\TranslateInterface'); + $translate->loadData(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, true); + return __($string); } /** diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/ReviewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/ReviewTest.php index 15c73dc4638..a84d6b38e68 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/ReviewTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/ReviewTest.php @@ -42,7 +42,7 @@ class ReviewTest extends \Magento\Backend\Utility\Controller 1, 'entity_pk_value' )->getId(); - $this->dispatch('backend/catalog/product_review/edit/id/' . $reviewId); + $this->dispatch('backend/review/product/edit/id/' . $reviewId); $responseBody = $this->getResponse()->getBody(); $this->assertContains('<script>alert("xss");</script>', $responseBody); $this->assertNotContains('<script>alert("xss");</script>', $responseBody); 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 55c9d3f9660..d709a83cc96 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php @@ -83,6 +83,23 @@ class CompareTest extends \Magento\TestFramework\TestCase\AbstractController $this->_assertCompareListEquals(array(1)); } + public function testRemoveActionWithSession() + { + $this->_requireCustomerWithTwoProducts(); + + $this->dispatch('catalog/product_compare/remove/product/1'); + + /** @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)$messageManager->getMessages()->getLastAddedMessage()->getText()); + + $this->assertRedirect(); + + $this->_assertCompareListEquals(array(2)); + } + public function testIndexActionDisplay() { $this->_requireVisitorWithTwoProducts(); @@ -211,6 +228,64 @@ class CompareTest extends \Magento\TestFramework\TestCase\AbstractController $this->_assertCompareListEquals(array(1, 2)); } + protected function _requireCustomerWithTwoProducts() + { + $customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Customer\Model\Customer'); + /** @var \Magento\Customer\Model\Customer $customer */ + $customer + ->setWebsiteId(1) + ->setId(1) + ->setEntityTypeId(1) + ->setAttributeSetId(1) + ->setEmail('customer@example.com') + ->setPassword('password') + ->setGroupId(1) + ->setStoreId(1) + ->setIsActive(1) + ->setFirstname('Firstname') + ->setLastname('Lastname') + ->setDefaultBilling(1) + ->setDefaultShipping(1) + ; + $customer->isObjectNew(true); + $customer->save(); + + /** @var $session \Magento\Customer\Model\Session */ + $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Customer\Model\Session'); + $session->setCustomerId(1); + + /** @var $visitor \Magento\Log\Model\Visitor */ + $visitor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Log\Model\Visitor'); + /** @var \Magento\Stdlib\DateTime $dateTime */ + $dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Stdlib\DateTime'); + $visitor->setSessionId(md5(time()) . md5(microtime())) + ->setLastVisitAt($dateTime->now()) + ->save(); + + /** @var $item \Magento\Catalog\Model\Product\Compare\Item */ + $item = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product\Compare\Item'); + $item->setVisitorId($visitor->getId()) + ->setCustomerId(1) + ->setProductId(1) + ->save(); + + /** @var $item \Magento\Catalog\Model\Product\Compare\Item */ + $item = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product\Compare\Item'); + $item->setVisitorId($visitor->getId()) + ->setProductId(2) + ->save(); + + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Log\Model\Visitor') + ->load($visitor->getId()); + + $this->_assertCompareListEquals(array(1, 2)); + } + /** * Assert that current visitor has exactly expected products in compare list * diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompositeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompositeTest.php new file mode 100644 index 00000000000..bf50deadd19 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompositeTest.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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Helper\Product; + +use Magento\Customer\Controller\RegistryConstants; +use Magento\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +/** + * Test Composite + */ +class CompositeTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Composite + */ + protected $helper; + + /** + * @var Registry + */ + protected $registry; + + protected function setUp() + { + $this->helper = Bootstrap::getObjectManager()->get('Magento\Catalog\Helper\Product\Composite'); + $this->registry = Bootstrap::getObjectManager()->get('Magento\Registry'); + } + + protected function tearDown() + { + $this->registry->unregister('composite_configure_result_error_message'); + $this->registry->unregister(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->registry->unregister(RegistryConstants::CURRENT_CUSTOMER); + $this->registry->unregister('current_product'); + $this->registry->unregister('product'); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testRenderConfigureResult() + { + $configureResult = new \Magento\Object(); + $configureResult->setOk(true) + ->setProductId(1) + ->setCurrentCustomerId(1); + + $this->helper->renderConfigureResult($configureResult); + + $customerId = $this->registry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->assertEquals(1, $customerId); + $errorMessage = $this->registry->registry('composite_configure_result_error_message'); + $this->assertNull($errorMessage); + } + + public function testRenderConfigureResultNotOK() + { + $configureResult = new \Magento\Object(); + $configureResult->setError(true) + ->setMessage('Test Message'); + + $this->helper->renderConfigureResult($configureResult); + + $customerId = $this->registry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->assertNull($customerId); + $errorMessage = $this->registry->registry('composite_configure_result_error_message'); + $this->assertEquals('Test Message', $errorMessage); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/PriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/PriceTest.php new file mode 100644 index 00000000000..944b4be6795 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/PriceTest.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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Helper\Product; + +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; +use Magento\TestFramework\Helper\Bootstrap; + +/** + * Test class for Magento\Catalog\Helper\Product\Price + */ +class PriceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Helper\Product\Price + */ + protected $_helper; + + /** + * @var CustomerGroupServiceInterface CustomerAccountServiceInterface + */ + protected $_customerAccountService; + + protected function setUp() + { + $this->_helper = Bootstrap::getObjectManager()->get('Magento\Catalog\Helper\Product\Price'); + $this->_customerAccountService = Bootstrap::getObjectManager()->get( + 'Magento\Customer\Service\V1\CustomerAccountServiceInterface' + ); + + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testSetCustomer() + { + $customerData = $this->_customerAccountService->getCustomer(1); + $this->assertInstanceOf('Magento\Catalog\Helper\Product\Price', $this->_helper->setCustomer($customerData)); + $customerDataRetrieved = $this->_helper->getCustomer(); + $this->assertEquals($customerData->__toArray(), $customerDataRetrieved->__toArray()); + } + +} 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 d03c3ce0bab..8c228f0b96e 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php @@ -132,7 +132,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @magentoAppIsolation enabled */ public function testPrepareAndRenderWrongController() @@ -144,7 +144,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase /** * @magentoAppIsolation enabled - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testPrepareAndRenderWrongProduct() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php index da1ae41fdd6..504b447c667 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php @@ -97,7 +97,7 @@ class CategoryTreeTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testMoveWrongParent() { @@ -106,7 +106,7 @@ class CategoryTreeTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testMoveWrongId() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php index 37b48822102..d44ac5689cb 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php @@ -72,12 +72,11 @@ class RowTest extends \Magento\TestFramework\Indexer\TestCase */ public function testProductUpdate() { - $categoryFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\CategoryFactory' - ); - $listProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Block\Product\ListProduct' - ); + $this->markTestSkipped('Incomplete due to MAGETWO-21369'); + $categoryFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\CategoryFactory'); + $listProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Block\Product\ListProduct'); $this->_processor->getIndexer()->setScheduled(false); $this->assertFalse( diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php index 6ca3b3b07dd..a08681eed03 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php @@ -150,7 +150,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase ->create('Magento\Catalog\Model\Layer\Category'); $model->setCurrentCategory(new \Magento\Object()); $this->fail('Assign category of invalid class.'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { } try { @@ -159,7 +159,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase $model->setCurrentCategory(\Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Catalog\Model\Category')); $this->fail('Assign category with invalid id.'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php index a055f201ea3..4d7e45a7d4b 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php @@ -59,7 +59,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetFilterException() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php index 039725871b9..274000f36d1 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php @@ -66,7 +66,7 @@ class TierpriceTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateDuplicate() { @@ -82,7 +82,7 @@ class TierpriceTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateDuplicateWebsite() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Compare/ListCompareTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Compare/ListCompareTest.php new file mode 100644 index 00000000000..b2190e50602 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Compare/ListCompareTest.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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Model\Product\Compare; + +/** + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDataFixture Magento/Customer/_files/customer.php + */ +class ListCompareTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Model\Product\Compare\ListCompare + */ + protected $_model; + + /** + * @var \Magento\Log\Model\Visitor + */ + protected $_visitor; + + /** @var \Magento\Customer\Model\Session */ + protected $_session; + + protected function setUp() + { + /** @var $session \Magento\Customer\Model\Session */ + $this->_session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Customer\Model\Session'); + $this->_visitor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Log\Model\Visitor'); + /** @var \Magento\Stdlib\DateTime $dateTime */ + $dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Stdlib\DateTime'); + $this->_visitor->setSessionId(md5(time()) . md5(microtime())) + ->setLastVisitAt($dateTime->now()) + ->save(); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product\Compare\ListCompare', ['logVisitor' => $this->_visitor]); + } + + protected function tearDown() + { + $this->_session->setCustomerId(null); + } + + public function testAddProductWithSession() + { + $this->_session->setCustomerId(1); + /** @var $product \Magento\Catalog\Model\Product */ + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product') + ->load(1); + $this->_model->addProduct($product); + $this->assertTrue($this->_model->hasItems(1, $this->_visitor->getId())); + } + + public function testAddProductWithoutSession() + { + /** @var $product \Magento\Catalog\Model\Product */ + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product') + ->load(1); + $this->_model->addProduct($product); + $this->assertFalse($this->_model->hasItems(1, $this->_visitor->getId())); + $this->assertTrue($this->_model->hasItems(0, $this->_visitor->getId())); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php index 717c91cb6f1..abc83afbef2 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php @@ -247,7 +247,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase /** * @magentoDataFixture Magento/Catalog/_files/product_simple.php - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testCheckProductBuyStateException() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php index 29fdd966c80..fb2e8b2c25a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php @@ -110,21 +110,13 @@ class ProductTest extends \PHPUnit_Framework_TestCase public function testCleanCache() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->saveCache( - 'test', - 'catalog_product_999', - array('catalog_product_999') - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') + ->save('test', 'catalog_product_999', array('catalog_product_999')); // potential bug: it cleans by cache tags, generated from its ID, which doesn't make much sense $this->_model->setId(999)->cleanCache(); $this->assertFalse( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadCache( - 'catalog_product_999' - ) + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') + ->load('catalog_product_999') ); } @@ -216,7 +208,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase /** * Delete model * - * @param \Magento\Core\Model\AbstractModel $duplicate + * @param \Magento\Model\AbstractModel $duplicate */ protected function _undo($duplicate) { @@ -399,7 +391,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase /** * Check is model empty or not * - * @param \Magento\Core\Model\AbstractModel $model + * @param \Magento\Model\AbstractModel $model */ protected function _assertEmpty($model) { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/CollectionTest.php index 3910fc992d1..8b6ef68f008 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/CollectionTest.php @@ -26,6 +26,8 @@ */ namespace Magento\Catalog\Model\Resource\Product; +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; + class CollectionTest extends \PHPUnit_Framework_TestCase { /** @@ -90,4 +92,21 @@ class CollectionTest extends \PHPUnit_Framework_TestCase ); $this->assertEquals($expectedResult, $this->_collection->getColumnValues('request_path')); } + + /** + * @magentoDataFixture Magento/Catalog/Model/Resource/_files/product_simple.php + */ + public function testAddTierPriceData() + { + $this->_collection->setFlag('tier_price_added', false); + $this->_collection->addIdFilter(2); + $this->assertInstanceOf( + '\Magento\Catalog\Model\Resource\Product\Collection', + $this->_collection->addTierPriceData() + ); + $tierPrice = $this->_collection->getFirstItem()->getDataByKey('tier_price'); + $this->assertEquals(CustomerGroupServiceInterface::NOT_LOGGED_IN_ID, current($tierPrice)['cust_group']); + $this->assertEquals(CustomerGroupServiceInterface::CUST_GROUP_ALL, next($tierPrice)['cust_group']); + $this->assertTrue($this->_collection->getFlag('tier_price_added')); + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/_files/product_simple.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/_files/product_simple.php new file mode 100644 index 00000000000..1426f5ec534 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/_files/product_simple.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_Catalog + * @subpackage integration_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; + +/** @var $product \Magento\Catalog\Model\Product */ +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); +$product->isObjectNew(true); +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) + ->setId(2) + ->setAttributeSetId(4) + ->setWebsiteIds(array(1)) + ->setName('Simple Products') + ->setSku('simple products') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription("Short description") + ->setTaxClassId(0) + ->setTierPrice( + array( + array( + 'website_id' => 0, + 'cust_group' => CustomerGroupServiceInterface::NOT_LOGGED_IN_ID, + 'price_qty' => 2, + 'price' => 8, + ), + array( + 'website_id' => 0, + 'cust_group' => CustomerGroupServiceInterface::CUST_GROUP_ALL, + 'price_qty' => 21, + 'price' => 81, + ) + ) + ) + ->setDescription('Description with <b>html tag</b>') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setUrlKey('url-key') + ->setUrlPath('url-key.html') + ->save(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php index 18e43419627..acc9d791f59 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php @@ -186,7 +186,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGeneratePathDefault() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php index 04fa15a5d3b..d9cd3b8ea96 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php @@ -18,147 +18,138 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Catalog - * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** @var $product \Magento\Catalog\Model\Product */ -$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); $product->isObjectNew(true); -$product->setTypeId( - \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE -)->setId( - 1 -)->setAttributeSetId( - 4 -)->setWebsiteIds( - array(1) -)->setName( - 'Simple Product' -)->setSku( - 'simple' -)->setPrice( - 10 -)->setWeight( - 1 -)->setShortDescription( - "Short description" -)->setTaxClassId( - 0 -)->setTierPrice( - array( +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) + ->setId(1) + ->setAttributeSetId(4) + ->setWebsiteIds(array(1)) + ->setName('Simple Product') + ->setSku('simple') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription("Short description") + ->setTaxClassId(0) + ->setTierPrice( array( - 'website_id' => 0, - 'cust_group' => \Magento\Customer\Model\Group::CUST_GROUP_ALL, - 'price_qty' => 2, - 'price' => 8 - ), - array( - 'website_id' => 0, - 'cust_group' => \Magento\Customer\Model\Group::CUST_GROUP_ALL, - 'price_qty' => 5, - 'price' => 5 + array( + 'website_id' => 0, + 'cust_group' => \Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL, + 'price_qty' => 2, + 'price' => 8, + ), + array( + 'website_id' => 0, + 'cust_group' => \Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL, + 'price_qty' => 5, + 'price' => 5, + ), ) ) -)->setDescription( - 'Description with <b>html tag</b>' -)->setMetaTitle( - 'meta title' -)->setMetaKeyword( - 'meta keyword' -)->setMetaDescription( - 'meta description' -)->setVisibility( - \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH -)->setStatus( - \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED -)->setCategoryIds( - array(2) -)->setStockData( - array('use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1) -)->setCanSaveCustomOptions( - true -)->setProductOptions( - array( - array( - 'id' => 1, - 'option_id' => 0, - 'previous_group' => 'text', - 'title' => 'Test Field', - 'type' => 'field', - 'is_require' => 1, - 'sort_order' => 0, - 'price' => 1, - 'price_type' => 'fixed', - 'sku' => '1-text', - 'max_characters' => 100 - ), + ->setDescription('Description with <b>html tag</b>') + + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + + ->setCategoryIds(array(2)) + + ->setStockData( array( - 'id' => 2, - 'option_id' => 0, - 'previous_group' => 'date', - 'title' => 'Test Date and Time', - 'type' => 'date_time', - 'is_require' => 1, - 'sort_order' => 0, - 'price' => 2, - 'price_type' => 'fixed', - 'sku' => '2-date' - ), + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ) + ) + ->setCanSaveCustomOptions(true) + ->setProductOptions( array( - 'id' => 3, - 'option_id' => 0, - 'previous_group' => 'select', - 'title' => 'Test Select', - 'type' => 'drop_down', - 'is_require' => 1, - 'sort_order' => 0, - 'values' => array( - array( - 'option_type_id' => -1, - 'title' => 'Option 1', - 'price' => 3, - 'price_type' => 'fixed', - 'sku' => '3-1-select' - ), - array( - 'option_type_id' => -1, - 'title' => 'Option 2', - 'price' => 3, - 'price_type' => 'fixed', - 'sku' => '3-2-select' + array( + 'id' => 1, + 'option_id' => 0, + 'previous_group' => 'text', + 'title' => 'Test Field', + 'type' => 'field', + 'is_require'=> 1, + 'sort_order'=> 0, + 'price' => 1, + 'price_type'=> 'fixed', + 'sku' => '1-text', + 'max_characters' => 100 + ), + array( + 'id' => 2, + 'option_id' => 0, + 'previous_group' => 'date', + 'title' => 'Test Date and Time', + 'type' => 'date_time', + 'is_require'=> 1, + 'sort_order'=> 0, + 'price' => 2, + 'price_type'=> 'fixed', + 'sku' => '2-date', + ), + array( + 'id' => 3, + 'option_id' => 0, + 'previous_group' => 'select', + 'title' => 'Test Select', + 'type' => 'drop_down', + 'is_require'=> 1, + 'sort_order'=> 0, + 'values' => array( + array( + 'option_type_id'=> -1, + 'title' => 'Option 1', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '3-1-select', + ), + array( + 'option_type_id'=> -1, + 'title' => 'Option 2', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '3-2-select', + ), ) - ) - ), - array( - 'id' => 4, - 'option_id' => 0, - 'previous_group' => 'select', - 'title' => 'Test Radio', - 'type' => 'radio', - 'is_require' => 1, - 'sort_order' => 0, - 'values' => array( - array( - 'option_type_id' => -1, - 'title' => 'Option 1', - 'price' => 3, - 'price_type' => 'fixed', - 'sku' => '4-1-radio' - ), - array( - 'option_type_id' => -1, - 'title' => 'Option 2', - 'price' => 3, - 'price_type' => 'fixed', - 'sku' => '4-2-radio' + ), + array( + 'id' => 4, + 'option_id' => 0, + 'previous_group' => 'select', + 'title' => 'Test Radio', + 'type' => 'radio', + 'is_require'=> 1, + 'sort_order'=> 0, + 'values' => array( + array( + 'option_type_id'=> -1, + 'title' => 'Option 1', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '4-1-radio', + ), + array( + 'option_type_id'=> -1, + 'title' => 'Option 2', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '4-2-radio', + ), ) - ) + ), ) ) -)->setHasOptions( - true -)->save(); + ->setHasOptions(true) + ->save(); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php index 04208ae05fa..76ea3b2ce32 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php @@ -38,16 +38,10 @@ class RendererTest extends \PHPUnit_Framework_TestCase protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\LayoutInterface' - )->createBlock( - 'Magento\Checkout\Block\Cart\Item\Renderer' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') + ->createBlock('Magento\Checkout\Block\Cart\Item\Renderer'); /** @var $item \Magento\Sales\Model\Quote\Item */ $item = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Quote\Item'); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php index a617c39b47d..ab31955c328 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php @@ -81,7 +81,7 @@ class ManagerStub extends Manager * * @param string $eventName * @param array $params - * @return \Magento\Core\Model\App|null + * @return null */ public function dispatch($eventName, array $params = array()) { 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 139798f0e2c..a07d77ea11d 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 @@ -60,13 +60,11 @@ class StorageTest extends \PHPUnit_Framework_TestCase */ public function testGetFilesCollection() { + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $objectManager->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - $objectManager->get('Magento\View\DesignInterface')->setDesignTheme('magento_backend'); + $objectManager->get('Magento\View\DesignInterface') + ->setDesignTheme('magento_backend'); /** @var $model \Magento\Cms\Model\Wysiwyg\Images\Storage */ $model = $objectManager->create('Magento\Cms\Model\Wysiwyg\Images\Storage'); $collection = $model->getFilesCollection(self::$_baseDir, 'media'); diff --git a/dev/tests/integration/testsuite/Magento/Core/Helper/JsTest.php b/dev/tests/integration/testsuite/Magento/Core/Helper/JsTest.php index 329605f9c4a..9e322f8d53e 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Helper/JsTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Helper/JsTest.php @@ -40,17 +40,12 @@ class JsTest extends \PHPUnit_Framework_TestCase $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Helper\Js'); } - public function testGetTranslateJson() - { - $this->assertNotNull(json_decode($this->_helper->getTranslateJson())); - } - public function testGetTranslatorScript() { $this->assertEquals( "<script type=\"text/javascript\">//<![CDATA[\n" . '(function($) {$.mage.translate.add(' . - $this->_helper->getTranslateJson() . + $this->_helper->encode($this->_helper->getTranslateData()) . ')})(jQuery);' . "\n//]]></script>", $this->_helper->getTranslatorScript() diff --git a/dev/tests/integration/testsuite/Magento/Core/Helper/Url/RewriteTest.php b/dev/tests/integration/testsuite/Magento/Core/Helper/Url/RewriteTest.php index e73f666000b..8dc1a337975 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Helper/Url/RewriteTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Helper/Url/RewriteTest.php @@ -50,7 +50,7 @@ class RewriteTest extends \PHPUnit_Framework_TestCase /** * @dataProvider requestPathExceptionDataProvider - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateRequestPathException($requestPath) { @@ -67,7 +67,7 @@ class RewriteTest extends \PHPUnit_Framework_TestCase /** * @dataProvider requestPathExceptionDataProvider - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateSuffixException($suffix) { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php index 671539966ca..a61d4d77ea4 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php @@ -35,11 +35,8 @@ class AreaTest extends \PHPUnit_Framework_TestCase public static function tearDownAfterClass() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->cleanCache( - array(\Magento\Core\Model\Design::CACHE_TAG) - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface')-> + clean(array(\Magento\Core\Model\Design::CACHE_TAG)); } protected function setUp() diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/App/EmulationTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/App/EmulationTest.php index d387d2b552d..c00cf351fb6 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/App/EmulationTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/App/EmulationTest.php @@ -39,15 +39,12 @@ class EmulationTest extends \PHPUnit_Framework_TestCase */ public function testEnvironmentEmulation() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\App\Emulation' - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface'); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Core\Model\App\Emulation'); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\View\DesignInterface'); $initialEnvInfo = $this->_model->startEnvironmentEmulation(1); $initialDesign = $initialEnvInfo->getInitialDesign(); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/AppTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/AppTest.php deleted file mode 100644 index fb3a67252b5..00000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/AppTest.php +++ /dev/null @@ -1,155 +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_Core - * @subpackage integration_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model; - -class AppTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Model\App - */ - protected $_model; - - /** - * Application instance initialized with environment - * Is used in some tests that require initialization - * - * @var \Magento\Core\Model\App - */ - protected $_mageModel; - - /** - * Callback test flag - * - * @var bool - */ - protected $_errorCatchFlag = false; - - protected function setUp() - { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\App'); - $this->_mageModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App'); - } - - public function testGetCookie() - { - $this->assertInstanceOf('Magento\Stdlib\Cookie', $this->_model->getCookie()); - } - - public function testSetErrorHandler() - { - $this->_model->setErrorHandler(array($this, 'errorHandler')); - try { - trigger_error('test', E_USER_NOTICE); - if (!$this->_errorCatchFlag) { - $this->fail('Error handler is not working'); - } - restore_error_handler(); - } catch (\Exception $e) { - restore_error_handler(); - throw $e; - } - } - - public function errorHandler() - { - $this->_errorCatchFlag = true; - } - - public function testGetArea() - { - $area = $this->_model->getArea('frontend'); - $this->assertInstanceOf('Magento\Core\Model\App\Area', $area); - $this->assertSame($area, $this->_model->getArea('frontend')); - } - - public function testGetDistroLocaleCode() - { - $this->assertEquals(\Magento\Core\Model\App::DISTRO_LOCALE_CODE, $this->_model->getDistroLocaleCode()); - } - - public function testGetBaseCurrencyCode() - { - $this->assertEquals('USD', $this->_model->getBaseCurrencyCode()); - } - - public function testGetCacheInstance() - { - $cache = $this->_mageModel->getCacheInstance(); - $this->assertInstanceOf('Magento\App\CacheInterface', $cache); - $this->assertSame($cache, $this->_mageModel->getCacheInstance()); - } - - public function testGetCache() - { - $this->assertInstanceOf('Magento\Cache\FrontendInterface', $this->_mageModel->getCache()); - } - - public function testLoadSaveRemoveCache() - { - $this->assertEmpty($this->_mageModel->loadCache('test_id')); - $this->_mageModel->saveCache('test_data', 'test_id'); - $this->assertEquals('test_data', $this->_mageModel->loadCache('test_id')); - $this->_mageModel->removeCache('test_id'); - $this->assertEmpty($this->_mageModel->loadCache('test_id')); - } - - public function testCleanCache() - { - $this->assertEmpty($this->_mageModel->loadCache('test_id')); - $this->_mageModel->saveCache('test_data', 'test_id', array('test_tag')); - $this->assertEquals('test_data', $this->_mageModel->loadCache('test_id')); - $this->_mageModel->cleanCache(array('test_tag')); - $this->assertEmpty($this->_mageModel->loadCache('test_id')); - } - - public function testSetGetRequest() - { - $this->assertInstanceOf('Magento\App\RequestInterface', $this->_model->getRequest()); - /** @var $objectManager \Magento\TestFramework\ObjectManager */ - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $request \Magento\TestFramework\Request */ - $request = $objectManager->get('Magento\TestFramework\Request'); - $this->_model->setRequest($request); - $this->assertSame($request, $this->_model->getRequest()); - } - - public function testSetGetResponse() - { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\App\ResponseInterface' - )->headersSentThrowsException = false; - $this->assertInstanceOf('Magento\App\ResponseInterface', $this->_model->getResponse()); - $expectedHeader = array('name' => 'Content-Type', 'value' => 'text/html; charset=UTF-8', 'replace' => false); - $this->assertContains($expectedHeader, $this->_model->getResponse()->getHeaders()); - $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\App\ResponseInterface' - ); - $this->_model->setResponse($response); - $this->assertSame($response, $this->_model->getResponse()); - $this->assertEmpty($this->_model->getResponse()->getHeaders()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Config/DataTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Config/DataTest.php index f3a0cac935d..0e1ad4f572d 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Config/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Config/DataTest.php @@ -63,11 +63,8 @@ class DataTest extends \PHPUnit_Framework_TestCase */ protected static function _refreshConfiguration() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->cleanCache( - array(\Magento\App\Config::CACHE_TAG) - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') + ->clean(array(\Magento\App\Config::CACHE_TAG)); \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Design/Backend/ExceptionsTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Design/Backend/ExceptionsTest.php index f458f19e5da..b00b4757e09 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Design/Backend/ExceptionsTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Design/Backend/ExceptionsTest.php @@ -120,7 +120,7 @@ class ExceptionsTest extends \PHPUnit_Framework_TestCase /** * @var array $value - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @dataProvider saveWrongExceptionDataProvider * @magentoDbIsolation enabled */ diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php index bea1b0a7d4f..b3a1fe9a28b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php @@ -88,7 +88,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase $model->setId(null); $model->save(); $this->fail('A validation failure is expected.'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { // intentionally swallow exception } @@ -132,11 +132,8 @@ class DesignTest extends \PHPUnit_Framework_TestCase $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Design'); $design->loadChange($storeId, $date); - $cachedDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadCache( - $cacheId - ); + $cachedDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') + ->load($cacheId); $cachedDesign = unserialize($cachedDesign); $this->assertInternalType('array', $cachedDesign); @@ -148,11 +145,8 @@ class DesignTest extends \PHPUnit_Framework_TestCase $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Design'); $design->loadChange($storeId, $date); - $cachedDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadCache( - $cacheId - ); + $cachedDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') + ->load($cacheId); $cachedDesign = unserialize($cachedDesign); $this->assertTrue(is_array($cachedDesign)); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php index a3b1d44d6be..e92faeecdb1 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php @@ -246,7 +246,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase /** * @dataProvider blockNotExistsDataProvider - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testCreateBlockNotExists($name) { @@ -391,7 +391,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testAddBlockInvalidType() { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php index 8c8e0f712e7..d5ccdd5ca94 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php @@ -64,8 +64,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase 'Magento\Core\Model\Theme\Registration', 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\Resource\Theme\Data\CollectionFactory'), + $this->_objectManager->create('Magento\Core\Model\Theme\Data\Collection'), $this->_objectManager->create('Magento\App\Filesystem') ) ); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php index c72b28c2ba8..35a6958e1a3 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php @@ -29,7 +29,7 @@ namespace Magento\Core\Model\Resource; class HelperTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Helper + * @var \Magento\DB\Helper */ protected $_model; @@ -41,7 +41,7 @@ class HelperTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Helper', + 'Magento\DB\Helper', array('modulePrefix' => 'core') ); $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Store/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Store/CollectionTest.php index 4fb7e91b4ac..cad51a5602b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Store/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Store/CollectionTest.php @@ -112,8 +112,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Db\Collection\AbstractCollection::addFieldToSelect - * @covers \Magento\Core\Model\Resource\Db\Collection\AbstractCollection::removeFieldFromSelect + * @covers \Magento\Model\Resource\Db\Collection\AbstractCollection::addFieldToSelect + * @covers \Magento\Model\Resource\Db\Collection\AbstractCollection::removeFieldFromSelect */ public function testAddRemoveFieldToSelect() { @@ -132,7 +132,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Db\Collection\AbstractCollection::addExpressionFieldToSelect + * @covers \Magento\Model\Resource\Db\Collection\AbstractCollection::addExpressionFieldToSelect */ public function testAddExpressionFieldToSelect() { @@ -142,7 +142,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Db\Collection\AbstractCollection::getAllIds + * @covers \Magento\Model\Resource\Db\Collection\AbstractCollection::getAllIds */ public function testGetAllIds() { @@ -150,7 +150,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Db\Collection\AbstractCollection::getData + * @covers \Magento\Model\Resource\Db\Collection\AbstractCollection::getData */ public function testGetData() { @@ -158,7 +158,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Db\Collection\AbstractCollection::join + * @covers \Magento\Model\Resource\Db\Collection\AbstractCollection::join */ public function testJoin() { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/TransactionTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/TransactionTest.php index 2dac3dd7440..5d8ba652c0e 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/TransactionTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/TransactionTest.php @@ -29,15 +29,14 @@ namespace Magento\Core\Model\Resource; class TransactionTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Transaction + * @var \Magento\DB\Transaction */ protected $_model; protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Transaction' - ); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\DB\Transaction'); } /** diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php index 1534e6e91a2..66c121d3f4f 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php @@ -64,7 +64,8 @@ class StoreTest extends \PHPUnit_Framework_TestCase 'storeManager' => $objectManager->get('Magento\Core\Model\StoreManager'), 'sidResolver' => $objectManager->get('Magento\Session\SidResolverInterface'), 'cookie' => $objectManager->get('Magento\Stdlib\Cookie'), - 'httpContext' => $objectManager->get('Magento\App\Http\Context') + 'httpContext' => $objectManager->get('Magento\App\Http\Context'), + 'config' => $objectManager->get('Magento\App\ConfigInterface') ); return $this->getMock('Magento\Core\Model\Store', array('getUrl'), $this->_modelParams); @@ -322,7 +323,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase * @dataProvider saveValidationDataProvider * @magentoAppIsolation enabled * @magentoDbIsolation enabled - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testSaveValidation($badStoreData) { 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 051cc76719b..9e38fe746a4 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/RegistrationTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/RegistrationTest.php @@ -50,13 +50,17 @@ class RegistrationTest extends \PHPUnit_Framework_TestCase ) ) ); - $this->_theme = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\View\Design\ThemeInterface' - ); - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Theme\Registration', - array('theme' => $this->_theme) - ); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); + + $objectManager->get('Magento\App\State') + ->setAreaCode(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $this->_theme = $objectManager + ->create('Magento\View\Design\ThemeInterface'); + $this->_model = $objectManager + ->create('Magento\Core\Model\Theme\Registration'); } /** @@ -128,4 +132,15 @@ class RegistrationTest extends \PHPUnit_Framework_TestCase $testTheme->load($testTheme->getId()); $this->assertNotEquals((int)$testTheme->getType(), \Magento\View\Design\ThemeInterface::TYPE_PHYSICAL); } + + /** + * @magentoDbIsolation enabled + */ + public function testRegister() + { + $this->registerThemes(); + $themePath = implode(\Magento\View\Design\ThemeInterface::PATH_SEPARATOR, array('frontend', 'test_test_theme')); + $theme = $this->_model->getThemeFromDb($themePath); + $this->assertEquals($themePath, $theme->getFullPath()); + } } 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 e3003369722..d9ca1292b9a 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php @@ -89,15 +89,13 @@ class DesignTest extends \PHPUnit_Framework_TestCase */ protected function _emulateFixtureTheme($themePath = 'test_default') { - \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize( - array( - \Magento\App\Filesystem::PARAM_APP_DIRS => array( - \Magento\App\Filesystem::THEMES_DIR => array('path' => realpath(__DIR__ . '/../_files/design')) - ) - ) - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => realpath(__DIR__ . '/../_files/design')), + ), + )); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('frontend'); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $objectManager->get('Magento\Core\Model\App')->loadArea('frontend'); $objectManager->get('Magento\View\DesignInterface')->setDesignTheme($themePath); $this->_viewFileSystem = $objectManager->create('Magento\View\FileSystem'); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/images/preview_image.jpg b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/images/preview_image.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3c9b11dae2719b47bf95d41e69136f1e56ce2904 GIT binary patch literal 11420 zcmch71z1$?w)X}UMM9BoK>-2jZk3LqJEbLt4rvUK5D@8>7#c=m=unYCK;RF<P&0Hn zLrFJ$<Nuy>zjMz0{`ZUfeD^ocvuCgMuG;Tf&)WOl@4lM6ng{NvE2}93czAe#D((kd zp#X*7)PD)Tjr^Ak{8qmD43OW%Bg7*lz#|9n$?*ut@vgoB%m5yMk57Ob2mTHM!s|Ei zuiYfVyM-H9z60P9;NxE-A|kv-h)?iahTz(D!W($_H_2HADX6IL3qR5IsioAn@p_q5 zQ1^?7MnvJu$X#0Yod=>~imw;wiaG2YaCR7R4*uB<KzQTY^_w^zZd9Hez`KTzM?ipg zjquv-KLf$Xxxpj6ahHPfCOH)~4cq+(w5;sHBBC62_K}<q1%<?(Di|0V+d4SDj=Gu# zNC<G|$qC2-dEoNb-!J6<!#|s@0YdwYt~-%D3JSf=6x0YF!;4!=k<gw$uSSb^TYF%j zXuM32;#l_^ZQIa}tY1giiL;3RT_6P1ySifM(?Ll60K3qOY(KZtsmeRtTZ|7Ew8)kG z*C&veiNvD)F+AEE4sE@pr=kIu#>QRiw*g`XN#!j`m?T7I{0fMIR!7i1{?A<9FzkkJ z?5t6($xK*JL|pe;E_y37r<hk0H&wsi3%z}Z<k_Fv_EY^2=d$&4wZn@RP?(Fyyu4^} z&-|NNT~^W^)^~{h$^+irSdJ_Uww%#md2N-=wikrgm*M+UXNK6r@Y##Uw9FK5#tL(- zm@LC<hE;S}KK{*&YE~>q>CJqRQuhn%xj7V+blz#|N0|BGWq{*g9{pLk4#~FK5a-3| z&eYqZiNDCK?QFle$6)C&*F@V=7inki?2pGhHH;G0@;3`RtIs@lb^vSy&K*g&gdf#d zQG&C)Q%Y#qN4h+IhcCZEXwJK~WKR#=PuGFZ?Qx!SdNEi-+2*aCbtEd9P~dlz{^sqT z!^|FJ9^uyyFh^%QKtug|_oZxPta@OTT)XFIg7)81{{(`Hg(ZK?UhMXHe$;m2NBrhp z-R^j`(((s~3thcXV|Re|Gfp0F%6+i=M__wk2bzDPbY}ZA{vSiKZJ{P$Lv87UHYiKt zvl}5ev7U}N_oW=|OnqoTuRnvV^hI-ov4yy2R2ZpZhxwt+(mWpWw{yBQeQxp9i8cKz zU<z4jy?GX4^4>E$<ya9pRXMZMi<-oH_*?AX@vzW&;VaJ|=R}ireN(_T2KXYAao!kw zzBSk;BYGGXL3^E2S4l!iN~=ArQw|Ntsm*AtLD<<3W3=_e-~(gg?s<tL?!0LB+Ow0= zpWJ#M;{!bJ=crk2-z&T8qpf5hXh@uXSQKmdY1ptcK7MI+m(F=Dx?#X<678njlwLT2 zlz03pIzBcS{-gGm@MeVz<w}>ru|8=h3Tx@%tokFhaW0T&gP%y+Npq=&v2DNJJg{l| zAV{e=&n{yyYVHv1TsLE+;bfXJrX{=UN{uX@Zh?W7XJp17l%$EYgwt<WObaZXRKwbh z2@#mK!`G{gV%%k2R5Hn6nw5!Hugh35w39(W8FgDe8sF6ngdfWGWvMxE(B8)b!QrZ! z2DcpE?@|g3Fm`fCfjP!EQBA#w?=9~a{niWy_+fO78Hsu|Sac|wpXtZSm`xf3*u5jK z^IaHyeEl>>ZR=^!{+IZ!B+T(_;r;gR>y-@jeG?zn%*?kpZAna0JsA_K6rVm*^B$Tu zX#V6%k<qD;`J?1hP|{XzihdlELrn*bg5klYc`<Riz<B4#6GywW(u{J}v5@IX+g*^` zWUq>Xp7wnfc5z)NkO4zcYJI!ud@R;>R=MLVTLpJjp+c${Xfy@sXD7?70EMNNs8g=` zpcHfsrho07!1Z!$xG{%ALC%e`5*wu699ICuje&_7rUvH~miL@}<aJ;44!2W@bi)VQ z=vhHNgR@2s70XaPgSU)6e6@1}@uh9)^`}NgNYSa7IvSJ;Hd$pL-uMZ~z<;w1JD%M< zHs}t|{+=BB@?EI5rnn=r;auZ-omy-3(2Sd|O_HHSt6Pb`YR8djoqAYbYj&3L&(%JM ziTMTZr6F50TDZ_DIh&MTO8cnrTgq{-oCW3+z2v+c9*Tek7y4>Gr+Yh19Amo)P&Ehq z(&ye{U9J_V^--`vW5u$1X_Md4OjR~JOwrNX(t}K`|IUC`fe>TjT7~?kL`EuXOz8?J zZ!oBNw!xTksqV63DZ-PXW>OjcV710iQ`n5{wg?GW!}{rRUyl}hNoLO%fy9jWJ{lr= zdRFozP!YkC>l3bp7P2)1wz<8ZzO9pJI*%_%l=CFyG>n^qPvY&EU=mn!hns#b2|3MJ zxr<sa41Oos!Y8jD55e{EoOtRsvDT8j)iybj!L0iR?@-^}{h}U0kgh&sP|-3SmP|V~ zP1<S;nGDb3HNgutH{X$RmpF{tRB(JzwU-0kOsq?B#fG1up+UoWTh=9C+Vh--3JQZC z+>#Ro97!+ri5%vaA;tC?3tz<EKPgNwTeS`#a1H~tyR?jbz$V)<ornrOkQ=DTK>IHA z3apdbNk(na4g2s)ETUDg>Z3X3l7lvlo*+YUW{YhpD5vY$`YE{DQ2d@g0%`ix!#v${ zccI(+dcy&vBbFfT;SY`tHibB9WzQx%iCxn`-qAeFk`K0&3ZzuD`ZoR6scDv&i#wU# zhA_08Tlm50em5j@jBIm;iEr?HC6IXp;lw+|Pg{8FyTlXa6Z4Oq7JVx{R&#Psi{(L8 zgN>E3>(!FBnMs8U8@)z4y9LUAJV9o6i_5w61K~!+Ys{0wSn-_;X%|CM10!#1@pYNt z4y(t|PcbE3H5Rk0ur^2YFj#KhA;nH5Y>HoKU8@sa+!{S7k?y@7zeYUV^k`+Om>=?~ zaBGHeVIWJdB}(0ve;}!U>deB^)X`(<fq6*<<~}<)2Xez8_PK=j-2HLa759~|v>bIG zDh6oB|6rR^&`V`DH}UJN@~xJKa+$lrg>!7+IqKO~f~lOu>a7M<!A>I7J0&waTc}XT z21o=s)FJ8V_+rapa@elmHawlGhZWXx*G(lOlgeELQIT*K=vR`{pRN6#+fov1!PoP> za8oN@9DmomjfFpr@L<Nwy|}cnPOqNV{Mq5hxZ<A}d++aPH7VyBZikfE=wv(I6);k% z{(5#b^Ugl_0(J!?<x;oCIuvuKON%u=k{fuDfYpzbK|imtYY~N0<bMN~-q|)1epAHN zPuW&iiC8i6oiRJ|TCwy{o;ty&cJt+x8?P9$t-05}Wm28)6G$2uSEUFGE)`e>#jw#h ze3RHnk%)PuvPTwarmFPw;?VDB;UI)TZ-zMCr-Ha%efrE&HIQ3B)wf%t%lm=-gyGr7 zq;OQkYnvz){bY9`2`y17R9TT5#>r68m%e(*cUr48r6(-pWZR_or8Pt8Z8bkJ{j^nY z*u{9J154nV;kyOeexH;zx*;#H&jgLea=v~${A>bdmR4Rqj!9>5p9z?;41Gk?P;K@| zd4yh0dT*oZfrIA6L_-OZ3*7vsHFbf=`r~^<*l9zSj~n;qEv$=zD*dZ`vyyuMz6)&A zR(Ws>3laaFNH@6DMiI-0?1(aFdfO+P&#-jo!BrN$-^zN0OA?pak^@`d6YlAT_*zxx zuIZUSV!so^-jqCgkErG_W2pTqP0~Rxg=7cu-oh#bs^}Rt{;ELE;w|-l6m1;c>jBNt zk592x2BPl&48AXRYLNNMvE>PyQAP`QLv2-SV{8wDa8aKVsai%1t;6w730ER%Xf8jW zBKU?L#_C7`JBzhYKTN7NF9=)O-f$ay66DCSU3HDx<vI+K@c{&Bi+b(d<186FYTC)w z+l|UJrA!^__bVb9k!ANmMPI_JT`b>BB|+H5Z?=FZsu}%f(n3Tgq}n+sG|TDC>vDSQ z=wB`F<P<D_{K=xf<EPek-I`Q%u=TQ_a=pobuci0yi$#N5gJe|U%u^;yb^$(-RN8Kc zD*6x6pUP}nBGqym6k;3LPuGf<ejY@Ps+Y6|a5U5%Y4r~OJPG8wWhK<16`NW)U-`2& z;dRP~;aj<C1cr!eQx#cI4%{MX^kMOw6z_}#=$ciF=bKj~rDJWxhZGP)Q-cnW6TP&L zAYC7?CivK0GVRlu5Uu*1Dt5FDF<dam#uP39b0YpK$@AejtW*bC*0jm_o+pq;xveR^ zhI@;NJ)ubmYWtQ-7-?(=a@>#6<T{o#C>t;@_kw5Z$0Z=Nl)aV9dbQAV-;FHA_RMBp zEI}E0^LbA@PrMq!*X30GuYld#`z6xNrB}eHfL!fm)P?!Z+{~rZ#l(_)+)nt>6+n7n zeeedl?|B8#@sDh;^Ivvh=FW-N!<Sj4FQ(4d&pZyFwiv4pD_lTQWjc63yYRBOGck^0 z=T?OTI(>9So?SR&%iEIUOC?de`QzOu96LFl7wmM(fyQaA+EO>U(plc5GrNYp-*A*E zC;h3_{LKnWyKAL1nu1_j6HF1FwYod!_oANxyKW@>&VE`?u{s~aT}V3E^cnHvz`^?N z^xl^w=U>P=iIEZ~^ALL_Hp9eTCG&b2+5yFw(0ry;_Fjq{<I91wo?_AOb-p}2`R-Uc zGbX8^_N3@hy^3~0zv6@LJg_f2Ed<n6#5}*+9J^Rj<7i9&L$j~N;WamJD<~OMRb~79 zT;gzaH&j!^<VooF7q)is)_o1`=7>B{Ty!^abZ2?|;b^IuMon|Euc8*kJ9hX^d}$RE zMI21)>EyBt1IU6m#wZJ|h6aHOH9uA(*DVnR-z^(lk561Jvsc^4h=!lMBrT^)3d7Fm z<wXj*hpIeMNKm8DRUG@Gh@4O9c5?h7?>^WTA^c;NLZ6IuSfn)fcxyk@4H*9S$6MS9 z<=fkg5*VtP6HBWrph^ai`V8F8JsN*E%Kc_^Ja^Rl`&9G5HshX3x)@(U5oL?-OkHZU zq4YaQ(CkNLvvMUzvTSIA|3+P-dt7Qu`ish>M!M{ZV&+BmW!cpDSB2$mDSYt;+usJ? z1Rc>2ajv>pch`BPa7iAiOX){C9q`PRZmr3x_0pW1*8WN@y|YVw!XLjP*#Br()biAi z2i(cH%wwq4uxY!XFM&?8^dRz9w)BH%pDPCmZP%A657Zr2v={F;B8=7y1SA9s`DW=Q z7Cf9JhUjKR2`QNxQcAIC30O*8=8GIQ2>Kp^kz-Q%Bz))DqWA#)@{dl7)2ykaMsVGi z!yq=(bDCF2UXXxusUzCt<L73%u8r6a`EZ5M@HO%A9H$2w;pl_5PV)VWG9%MKX|kll z>I0>Kx3c-~PLsiJozzZR$jx4h557VqUJfVo!!es08!}bm`2?^tiLF7Kf|6L@8A}gL zjCn!Pk4<#Atb?mM@`sYVxqbkBS6+G`abz&KbZjvOZHLmQ(BYrf^71D0GEA8b$rSMK zmf@sVdXsBzp2$rZ;O5L+Z;lj#lsB^1O1Tb|=Zg_cZOZ<Uu`SdfI}#aOfL>x!9oDWy z66S-3We{E}_2yp@flr%M;!V5$_(N1^^wosnxa+f8c}z!LtsFQYWwR$V#c91go&M_s z<5KPoHLbZ3PDN)a>PsDCBKi8&*pW;KOMlL;A380KDs`>gs83L7%oqDmcdQDmxSRdG ze$9Ju`g^&th;N*U(sGW<e9oxu03^4@)m^dWtvJ1#I;HZi^oNOB^@eZ>f1V9H@}hzR z!7Z5N8>o<86?;{4aj<mMUNltLM-%imK}^;r4B~O(a5fyRX&J;%I`TYK)qnxprqmMX z!BHbyn8cK!)j=l$6=|wsh(+gA;IFWHT>)HKkHZ(vn5a+i-p+MOtiz*LKom_ZtKr+X ztwiM?o-jd^nr--@Dbk-7xA(Mv-Ny{%*K3!a%THecTX~As$5%l1xk`A?CCyHF=oO%{ zEw^xXI0&CBnVa4o%b(w7S)L4IKD*Sr5I!$my!1I)Tkc8=cfO?9yV2m`2Z3TY1w<HI z4OZmeMBZ@n9JMBnlYCQrUxw=k-*sqAsWXW{T<C*wTXQ1ksDb+Kn-4K^{Fk>MChu~z z)bVHOx|$1V4U|s`3|mMI=k8f<iRATWTcOCiNL@8*0+_V)k01IJp~{EeoY@!pk`9|g z7Wj3f;vwnrweDAdgS@8kvCrIzc1a_qF+Dsxk!n(){UN{D6|hMsD3ez+rgb){|Kdck zbgD?uncb<}!Iz?NzxB0In9T~Sp9x0S*p&Vyz4sIBkgXk0h0><xC~M#gMXLTUP6kDk z^c^l!R6b=3yKyag?L*NkK8Y$rMKtzK{8DA(4=3%BvQgCS<&7(FeT)a6P|m)CF5*o! z7u+Y6Uvemzj=A#Q*8BD95iI>tq#L<8QCx?V%I(qZgBmkso5m82iJGFZ4$)>KGFCmE z!5?p#ZPtw5K*})S;tR-#+_ZcHHU7({I$tIpH>)S!5Vw6QDnmmmn6ze*w3&e)gEFa0 zMc+o`6QLtvHG9Uv7Vk}?Kqp2uR?<{jMY|-ek%?zDjaiJGti2J9A@5chP4BXQf-|R_ zVV>Hno6Y)J^4VyWtM_|u8Kre(eHBc&vkIz_+w5at9;C2sMwxs%jzZMV>5u7{PS><X z)l_515F@qpjRdqo6!DLpOLQ(>QL)P#H9;#9Q2Hk*u+V-`8@+-)wbrEhS-h)nLhAw3 zLS)MUd)U{EVJGbR8)O!h8O(vLj?Zab;(L?ZA3ih`p!?~<jq!JT)D&snd-lDtDU+7v zjUNjtyR&9IYtrR7cC^a+ZoDreg+tjMJ|whXg3=QxLD|t_)xEYB4PdM^xlxEOIhiFp zxs7Ly8(Ez*J=0*TBze8c@nsaJKV&>FwBKIeQf$d^OmC&`?A<`NOZ!54p0%b5!#l*T z%tZ3WYHO-{WYB%R)YJ~h%2sEB{!#4Hf;y^d_f?MEYD{*jX9ZFE`}`Nw@B)3>m<_vZ zz54gJr?h`}BGZ)BkQQ7gl8gJl>qLVUPy_l<ahW|(5A&c0F=*x146~@?6`=5VY(R?G z(%7{6)we64<gowS32ausiRw_d*f@|+bcC&o&dBsbZgQbj^k@q2<;NN}c_$=A5rdR; zs^oHIInyH^>0v#d4~}tVm@%Cq%=6RuP03WJp_Oddd%bFx73xoMeG-XZB#VpEG^8!Y z(J?+`?jn;Z595~u*rB$m&o4bUj3?puRTQvxGcG<vR`w7R4O1`G!vNAXax2HxjO^PC z8$n+$)aSehj`HthwC-Cm6pnDeFB6CP$9Zqff-HhH3#A2egM^%|oIOm$smdh{uJ=DZ zebk^i`Z9ki(P4wcPoe=lT;$Gh`f6=D>WH2>+ibzSrzW+h%$|2k<F%Hi?90RzMu#U_ znvQ-SJgzY;J7?BM3Uz4+GlmpdbZNac){GKDAJ-f0pDqtMzZ;CqCW6*bb9};1sf0FV z_*9aeaS~ySJlh=z6%!m6RW3}nLz1{h?!tIx97WwBEs~W(4IZXb*<+%y-%&!aN>$wr zhY*Wal&XY-j?hv?I9Wpu-0FdyXaV)xiCf>Dop}8Ao^KKqZB~`<J0+J0>kFjE1h=+} zcKi7{XENHl&`n|1l0WEgW2OV>Qu7hDq(7B)r;6<EynsAO(-(%;lvjhwC(*UX%FdO` zIxQ@M)AfdFW?7YlG^oI}JpCG(M%t|vH?fRpWt~~7^tN0R#<Rgz+>6+5fqk^MUm`pB zK&JXGiW;%+zhAQE`Up!s;w4ts+S(F(3>&H16ueHp$<b0P&vO^j{FO(T^wCe3dZlXV zte*~+&t)~I)Y%*pid|H0KVSctI|9k>pSfi?xZ+_g^!hDig++O}#355UY_T9EqjJ?Y zYc(p$3y+C$*8w5UCwlj}*uD!w^x=UQQykL)pUAn1N_QGL@_A;NbJ-SeyNcf}vplaU zzQ&w}(afim*!K_<5p)w~T19%jvw*j0;8?tg3S1jd!LQro&0OR;9(@R73qeJ{Qy*-g zBT;d$dq8g@%>3<S(^M_x8@07Fv`G6=PY?Jo;^KIRjC;Ckd5ze#e^w+C86SLvj5q%# zqXCyGoao!sV|4AIeG1;ye9+!@&Lwk<=`uU-aykqjonu-KpuZGfY0n#WZJE31o!jzn zv&J4tU1IuKOxLZ8IH$Jz!Zqb)F6)mI$-+-X55s@uv+pwV_gn!Y=g_ySC%F4UyEV&B zyuwFAx?;naVw0Z;-$!VB%Z|n$m8HJ0gP0ay^nlq6dhnZ%j*7y?Y@^DpJR0dVDw*yL z_F}^)*Yw_~B}Z{dhown8bFSs*S}c6^wY+iuvto}*v&&cM^0ZPXuEXhH`iZPL<#(B^ z{eCP+bW1!<isZl6GzPf>sJ&&E^UM%OeLiCGb;`{>!;FJt)gNV{f&@m6brx4Z1+$MR zHIXAo@#aY+6`9oH1`TUDv8~X>Wi-X>w9f!R2lGz1A2~=g5N7-n7A$%yiUnH!;SpB! z_-}8C6XJR2vXNV--QV!x{k&~qURr@#)pMlB;C=VQXLu>URhW!#Gc;kS)~L>FIzl@- zJ0>IiBY^9oCHX`L$jzyXCNM$SjQ<wJ0)=tq`V#UC@c)ccBII2*bC>*fP+W33es<>X zI(5)w1sF4m8@A@q$ArGv#`e~uZ<qjhJmEd}=Nf+j9T7OCzv0i|K2d-~e$9`rCS#|d zC{)|w{_nxtNXqY7A-Ju8&}`Ugh;*n_1dj)Yc**cI)VTig2n%%MUimMuQ|?`aGi4ne zoImD|0B+Xr^90Zy+v2H$lqmGyXlLm+g+aHsHz%Tg32&^*^R8Y2()EtRq@i79gaO5C z6qgq-HoDK&aq|NJY+gyC43%GfW}y>MvYI)Q>$p9uzYZ9uKw{pfym``af|MEG#%-H? zq?*7j6!e+NE$31XkPQSCc*C5k`QeE_@InDVDZjwHxwreyt$P4L-ON(di@g^<!N>ei z?XJ1#>jgQl1L$j~KjgWthg-3beI`2w@E={=nt{vFM(6^--KKLr*)tD-c=C6c{{{l< z2moOCeLgV{05@cE*+MVn1+MP{c+_E$?n^8rk00U${(?_re#ymr(G+og<F|o-10M7< z0FXxD2-jb@&AB|SB)KbqB?JEy0OI7IHhCpR-J^W`*8|t8uK>!#Fw|%KL!61f<9BR? zp8){)Gs*w!=>Yy>n(&RTfLN6-@H}2H&cNUCXK>GO6#Y5wu$Ek`-POAabVdMd!+%tx z?G~bOS^F#gf1XX!Fr1=K-zewY(jH*_7$A50X|yHy>l=RbU-MJD7L&G7F9560IGMlU z&%l0Xim(fJkX*)4Z10>z@PGWDwW;{meD%2<)uYXJfd3gz=5P2jFgG0WXU-XSePfP} z&p*@r0bDaZrD}T@A_x@X2LFQ3?r~fkd^iixeEPe&zXc|SqyNk~S)i2S*?HJA;-CLi zbiiNm|9gs2)pN!O>*>ONu+&w_JnYHz3?TfB3;6$`j0oBX+uoAhH56%S$nmK-l@1X- z#E#*4<Ba_siiK)r`Gkcs+~HluM$GiE4OAHc{w_<<yNhzaVEJwTPb9Z*e8GaWy2xsv z2#?Y#(pNZ5Tpbd2HXZ4`YPD!uesIKmfktzGK#p6FuG&dtbrj3QrRd0y+Z7#m#~pvk zKTw78MFn(+zfAJ^Qh81*P-SCs62>sIP3Rkov5r~~Ew2rd-nis>zW#Gvdr^FRwBvFq z_HekN$O$24DUR7L=Lr+XR$G<&6r3*;<%PilmqRSmm)X^KLZDPvK;PibS}p4Qn^8~_ zvR3HN;(&Y6{GZgDDoB)4|Fw3me!YL!=JqBsYF>C_;R+DMHA&HW_uozOBcY!NLYs_K zw*1f^+dWrl{SOV}_w+Ftlb|{#3$1szP)$~Y8R4^19ru_%{#&KWNgD?lSZ9Fm`kuFp zz~+*TskJrD`jIHQPEFlPZ^u`$E&f^gHUvF2Tr0L5A$e>i+0O7(0wUAYkfwg>Bwd7K zoOor4TL7=CG~~69l%v6>P-W%p&f;3{o0&-0n@)`-LWmAt)j-+aKbBh7u>+ZU`YA{5 zP2Cn?`Rop1?A?RTt+wwn<O(gD2e?ZLnH$)s_v0NO0;Q)R3ppQe4V6K|yQ`9K;md>} zymSVjjhiKvP?4=B@x{^U81r&hZq8|=Z^oEW)g^b`#K@7Yu-6Xc1_tYJN0;pcK66zU z)4c}PI;0Rt;?(uNgH;jj;PsL4Bo6l_{KZBXihgaPPFS40c7B0WPnMKaEh)u;duv!j zH?0`9ERnF+tYsWEnzIlT1oA*cP4qI<tlt2kE9`#3qUtJ}<jTD*-*S#`)H&%Jhzs8q zoOjV4Zb|5_-vg0f0rAj*?+Go5t*E3X_KYs^#!Qb=CP?Q*(5&V}7M~ELxE!^qH@fjW zR@OhjXtv*wQlWn|qg3!oA<6u*sqj~|6lFjAeES#0`o_0s9iFcYIau~o5}|m&8wJwB z)|vsdO<_`O%KeX6CE3_kRP3fC6f~X&N4rXTy)ZIYPpe{APuRBb`-qapocSybayq`O z*<C*(e{{TCF>`j-IEOfVp2|Q#DK?(rwZ`%(_G~JK&0CjRDnqe1>mA(6p_-^LFUJoA zg7^{Jp`8uYojuenP3YI;0!^}Mc<fhrBaKxaOIMoLE8Ni8sj7(ecjw@<EOH98*6i%@ zpQ7>0;^cnrkcn7F*~c(Ys;9aMHcE_>3=Dg<rgP^&lc-YF)V;<=DOl69!DA2;^U5P_ zy}DV!chYt~G^N<sJjTgDyc*_~h2UzrUTbxm!R3d+8=%Il-M%biYad>%lnbR|qWXKC zdy<KSatwZ;`j{5;%$Fp7`-lqc^OZo6>5p3%UB%#Rv!Gw!QI(8a(_i|f9F%qGDkMl? zaTNz!h7R7wI$Eq&V~-XdWDM%n?+U6mgnW5tP$Re*PVUiUqG!74^=JVek>)l*2+_f< zq~a+$hf~Vq;1=H+4My`cv{)y%dE42aE4ce|qHARK_sYDZ5<i<$C)dq@JxqS?h$TFB za`_bXBX00DmA_=6lSN{RqEUw}`jE%^Qyj<j9yjL%S!T_c_dD!Zhb6>xLotSz;-UCa zT2`GO)A&f?j8$8Hn2Ux3rx&_-tK^l-%*|=N*-;&>g`JGNd^;W0&fTAl0wlD>A4pOX zhd+z?EFyeT>BV5A{<T<pQ=KP`pIVZvmJe+7=+yPl&jmB}Ehq96w)m?Xgx=WED(mK@ zRNhzIpLh}wFqr)Sd<*s7#dpYjy7^3d$)&oJqpW|jtTu3heFjY9|7iFd{d6Cd*ZmiJ z4@~<$z*<;^lF@#-u#Ytvh=8zP#^XY^yNFg5l`ntrZprclvhwB(7A9HNJO7;aE`U@7 z3F&dO7J5uc<wS)t9@5oS)z@3PQ6~khXl~jz28E4oLW-vYz$P6E0?BfsMWS2d{9GD? zpUwlx8NtO1&-Dj+iJc{t^{URAAx>QG6j<?BJo{i8vt<)0s#41S+9^vUUxPGLE8z}R zlVx?ftFe!EIGO!gI=zDE-jaIavvqHQGw@1t(v-SY_JK)lg5W>g*zsFadMPhq>j%dN zU?9HDe-kl}&{*#cfX?IH1O6j^-^S%a#!iX6KXg0m+K26*$DL%1k`;8GmoCevc=IGy za^J09hTh%nAkz!vWP8z-C^3EG?UFptqHjoCU+!0X=b2M*LeX-NT-fGW{{3$3j`V0j z-%gvAUhst+r%G_^u(3}iEFmG)_dvev3W!<GqhIDP3Q4S!6R2DYk3Nlq9o&Hbv5}H5 zyvuTJ?b}i3$K6ipuXUTpx%raA_uGdHwy0uOE-pqI4|gkL!_yD82^ljN<@r}UW?{_m z4_AQHQj~?lH#sFZ%Zjjt^Vbv3{q6bPoU@j(S@0lLSMv0+b_#A$2JJg}SQdXai<Oqm zOX!-BMjv6$<=v~s>7froh2iMx-Y(MBi_%ciGwbCLk2j}$r%H3XR{)_(Ur2h=;uXMP zy|5q9C5oH^F)#eQPv8UbMf&KWiAa*@ZQzsRnM;M3{Vdrgk1986<vYWO6f5UNLo@Gs zUK348`(jJk)Hb7a#a~<JrSHg*pfS_D)zQ*beptP@UQQ!QLVbY`lEVsF_|aOW+MNI) zE0+Z4rIhlXRaQbNHl4;~6H0Ht%&Hh);`X?yv3w($+u_4pVtwy2!*#V>I!{!@R}7Mj zc=TDrsl(LDM6SCBIB(+J>aCZ51T8(C1u<`fhDH;@wzN$|YV7T928_cqi@1))E&`tJ z@(Bsu;!DkN@6QM(&NLQE_DMh)-W3i1)zb^jVttslzINO_whD97aF%}-)Q1hxeoAj~ zbH~(NnC(S%<AB$U`u*~%6)h=jGOKquDcz<`!<sZ{V*WwksW|)3pnP&8j3GLqL(d{} z<PhbGdU$Ad*u6KpGO5x0YW?ts_E-8CYpZS;xwBBYxA`~ZpkKpzd1tK7_)NlkGa=K9 zdkwLM5MzC`3BBu66BNU}xCyETbp0x6?o-QB5}KjvTq{>8QGF8=st>~kqsN8QD#DPJ zd`YX$rXQ*gTMDXL+WH@S&l#Yv;5LqQG_R>9(l=6nTA$S;yUEHcoa3k%vcS`yvbdM` zWoc}KLE+qWK)RQH=M_^)DRKiGcxZeNZsA|Xv!L=}U5wt&+x)9|RORT30%F75%!T*Y zQmyBJ&QinN=)t~7YHE|2WLHT|D9BzUqK?`u0ruR&>`9g7Q{=uPSo9X$F};GT+~P$^ zWoaEqh3mnWiW+nKCx>oByJd}Zbq)izPKI9JMKls^*b1?QCA{8FN*W#zusBn(G_ztr zIGG01`0gS_Dkmg7c#e}%d|0Po)1s0drCqixC$ud0xD%a&^kB|3*>@h@ta|XcxwI)V zQ7Uc3a2Ih`<GV9bl7-fZ%VWxPXtGXB?@-52<Fs)HqhUN3;ELG798ZVK5~-r3xW#$; zXfsLnOfePa!tHfb3?a1=0(RUBht}+gAJP>FPxfRND5eYyPzoPf#Ih+XBOM|IP;_sp zuPLAAfCGaCmkw+^N=f%wd-%5sdc6>NT_I0fh~G<`*_Xzv75tiEVHBFlruN=I)LDU1 z*V=2T-3%s5rq@VTdG%YeGlf`TEV3BEdoAhu(HA@ibgW#6e_Z7K$3FF&b8G3lAH^EO zUitQX?ZJiX#Ub!40=MuT;7VoKbKNVy0yeNn=;6g@;ajT0^T%2=<LTS$2R6tE+*f-= zZ|Re@_0%@I!xOD)(12hBKtusj5|~G<862O7T3Y3s5C-PRb$Y>ZPn%5#8;9%vyzBN) z@!%m}^tBBo7w<K19UOWf*SqJUsREL==&pdn(zVcx(@v(W)(EM4zjg4Eov0V!5X#l$ zz1GGH|6{<Eq27J2NaNBnw<G&-ySIU$?w?HmE72|U7Nq6XB~l`vdWm9z&ebylJh2=_ zeiEX0aXW?!sDoeQxDP0u+X9H!a9zI1>Z19@afC^xQpp@MIY_;{4bis#oKWXqt^O;` zX4vXZF^|-UypRn`)ROx|B7T?st8eqKFxT~wpZlkPFjsMw^DpP3FPvw7ehW)bqnXyv O?Eh-yznc!fn))Aia{h_{ literal 0 HcmV?d00001 diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/theme.xml b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/theme.xml index 5dd26d0b174..d0008b53c35 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/theme.xml +++ b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/theme.xml @@ -30,6 +30,6 @@ <version>2.0.0.0</version> <parent>magento_default</parent> <media> - <preview_image>images/preview.png</preview_image> + <preview_image>images/preview_image.jpg</preview_image> </media> </theme> 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 4a7f9b246f7..0f27598254d 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 @@ -24,19 +24,14 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG -); -\Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize( - array( - \Magento\App\Filesystem::PARAM_APP_DIRS => array( - \Magento\App\Filesystem::THEMES_DIR => array('path' => realpath(__DIR__)) - ) - ) -); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => realpath(__DIR__)), + ), +)); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure( array('preferences' => array('Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data')) ); diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/layout_update.php b/dev/tests/integration/testsuite/Magento/Core/_files/layout_update.php index 78d27c15c79..14503047369 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/layout_update.php +++ b/dev/tests/integration/testsuite/Magento/Core/_files/layout_update.php @@ -27,12 +27,9 @@ /** @var $objectManager \Magento\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); -$objectManager->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG -); +$objectManager->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); /** @var $theme \Magento\View\Design\ThemeInterface */ $theme = $objectManager->create('Magento\View\Design\ThemeInterface'); $theme->setThemePath( 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 2fedb1e7fb5..1d68e592624 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 @@ -24,12 +24,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->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()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); $designDir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir() . '/media_for_change'; $themeDir = $designDir . '/frontend/test_default'; $sourcePath = dirname(__DIR__) . '/Model/_files/design/frontend/test_publication/'; diff --git a/dev/tests/integration/testsuite/Magento/Cron/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Cron/Model/ObserverTest.php index 6324ac62a81..e00fbd91cb3 100644 --- a/dev/tests/integration/testsuite/Magento/Cron/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Cron/Model/ObserverTest.php @@ -32,15 +32,11 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadAreaPart( - 'crontab', - \Magento\Core\Model\App\Area::PART_CONFIG - ); - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Cron\Model\Observer' - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea('crontab') + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Cron\Model\Observer'); $this->_model->dispatch('this argument is not used'); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php index e633f021be8..3e34b3df8e6 100755 --- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php @@ -1299,7 +1299,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase /** * @magentoDataFixture Magento/Customer/_files/customer.php - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Customer website ID must be specified when using the website scope */ public function testIsEmailAvailableNoWebsiteSpecified() diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/quote.php b/dev/tests/integration/testsuite/Magento/Customer/_files/quote.php index 2963668e8bd..085756b5657 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/_files/quote.php +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/quote.php @@ -22,11 +22,8 @@ * @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' -)->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE -); +\Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); diff --git a/dev/tests/integration/testsuite/Magento/Data/Argument/Interpreter/StringTest.php b/dev/tests/integration/testsuite/Magento/Data/Argument/Interpreter/StringTest.php index b191d14f1c4..a199ee03649 100644 --- a/dev/tests/integration/testsuite/Magento/Data/Argument/Interpreter/StringTest.php +++ b/dev/tests/integration/testsuite/Magento/Data/Argument/Interpreter/StringTest.php @@ -26,7 +26,7 @@ namespace Magento\Data\Argument\Interpreter; class StringTest extends \PHPUnit_Framework_TestCase { /** - * @var Number + * @var \Magento\Data\Argument\Interpreter\String */ protected $_model; @@ -50,7 +50,7 @@ class StringTest extends \PHPUnit_Framework_TestCase $translateRenderer->expects($this->any())->method('render')->will( $this->returnCallback( function ($input) { - return $input . ' (translated)'; + return end($input) . ' (translated)'; } ) ); diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineVdeTest.php b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineTest.php similarity index 96% rename from dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineVdeTest.php rename to dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineTest.php index 0abeb4fd815..d22c4e4ea93 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineVdeTest.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineTest.php @@ -26,10 +26,10 @@ */ namespace Magento\DesignEditor\Model\Translate; -class InlineVdeTest extends \PHPUnit_Framework_TestCase +class InlineTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\DesignEditor\Model\Translate\InlineVde + * @var \Magento\DesignEditor\Model\Translate\Inline */ protected $_model; @@ -57,7 +57,7 @@ class InlineVdeTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_model = $objectManager->get('Magento\DesignEditor\Model\Translate\InlineVde'); + $this->_model = $objectManager->get('Magento\DesignEditor\Model\Translate\Inline'); $this->_request = $objectManager->get('Magento\App\RequestInterface'); $this->_request->setParam('translation_mode', 'text'); @@ -67,7 +67,7 @@ class InlineVdeTest extends \PHPUnit_Framework_TestCase public function testObjectCreation() { - $this->assertInstanceOf('Magento\DesignEditor\Model\Translate\InlineVde', $this->_model); + $this->assertInstanceOf('Magento\DesignEditor\Model\Translate\Inline', $this->_model); $this->assertInstanceOf('Magento\App\RequestInterface', $this->_request); $this->assertInstanceOf('Magento\DesignEditor\Helper\Data', $this->_helperData); } 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 857074ed4f8..f93fc4b0bfe 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 @@ -32,13 +32,13 @@ ) ) ); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\App\State') + ->setAreaCode(\Magento\View\DesignInterface::DEFAULT_AREA); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->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()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php new file mode 100644 index 00000000000..a7c0bad0e14 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php @@ -0,0 +1,176 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Downloadable\Block\Catalog\Product; + +use Magento\Customer\Controller\RegistryConstants; + +/** + * Tests Magento\Downloadable\Block\Catalog\Product\Links.php + * + */ +class LinksTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\TestFramework\ObjectManager */ + private $objectManager; + + /** @var \Magento\Tax\Model\Calculation */ + private $taxCalculationModel; + + /** @var \Magento\Registry */ + private $registry; + + /** @var \Magento\Downloadable\Block\Catalog\Product\Links */ + private $linksBlock; + + public function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->registry = $this->objectManager->get('Magento\Registry'); + $this->taxCalculationModel = $this->objectManager->create('Magento\Tax\Model\Calculation'); + + $this->linksBlock = $this->objectManager->get('Magento\View\LayoutInterface') + ->createBlock('Magento\Downloadable\Block\Catalog\Product\Links'); + } + + public function tearDown() + { + $this->registry->unregister('product'); + $this->registry->unregister(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->registry->unregister('_fixture/Magento_Tax_Model_Calculation_Rule'); + $this->registry->unregister('_fixture/Magento_Tax_Model_Calculation_Rate'); + } + + /** + * Test that has no customer registered. + * + * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php + */ + public function testGetFormattedLinkPriceNoCustomer() + { + $product = $this->objectManager->create('Magento\Catalog\Model\Product')->load(1); + $this->registry->register('product', $product); + $link = array_values($this->linksBlock->getLinks())[0]; + $formattedLink = $this->linksBlock->getFormattedLinkPrice($link); + $this->assertEquals('<span class="price-notice">+<span class="price">$15.00</span></span>', $formattedLink); + } + + /** + * Test that uses customer's billing address as tax calculation base. + * + * @magentoConfigFixture current_store tax/display/type 3 + * @magentoConfigFixture current_store tax/calculation/based_on billing + * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * @magentoDataFixture Magento/Customer/_files/customer_group.php + * @magentoDataFixture Magento/Tax/_files/tax_classes.php + */ + public function testGetFormattedLinkPriceCustomerBasedTax() + { + /** set the product and tax classes from tax_class fixture */ + $this->setUpTaxClasses(); + $link = array_values($this->linksBlock->getLinks())[0]; + $formattedLink = $this->linksBlock->getFormattedLinkPrice($link); + $this->assertEquals( + '<span class="price-notice">+<span class="price">$15.00</span>'. + ' (+<span class="price">$16.13</span> Incl. Tax)</span>', + $formattedLink + ); + } + + /** + * Test a customer outside of region. + * + * @magentoConfigFixture current_store tax/display/type 3 + * @magentoConfigFixture current_store tax/calculation/based_on billing + * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * @magentoDataFixture Magento/Customer/_files/customer_group.php + * @magentoDataFixture Magento/Tax/_files/tax_classes.php + */ + public function testGetFormattedLinkPriceCustomerBasedTaxDiffRegion() + { + /** set the product and tax classes from tax_class fixture */ + $this->setUpTaxClasses(13); + $link = array_values($this->linksBlock->getLinks())[0]; + $formattedLink = $this->linksBlock->getFormattedLinkPrice($link); + $this->assertEquals('<span class="price-notice">+<span class="price">$15.00</span></span>', $formattedLink); + } + + /** + * Test that has a customer but product based tax. + * + * @magentoConfigFixture current_store tax/display/type 3 + * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testGetFormattedLinkPriceCustomerProductTax() + { + $product = $this->objectManager->create('Magento\Catalog\Model\Product')->load(1); + $product->setTaxPercent(10); + $product->save(); + + $this->registry->register('product', $product); + $this->registry->register(RegistryConstants::CURRENT_CUSTOMER_ID, 1); + + $link = array_values($this->linksBlock->getLinks())[0]; + $formattedLink = $this->linksBlock->getFormattedLinkPrice($link); + $this->assertEquals( + '<span class="price-notice">+<span class="price">$15.00</span>'. + ' (+<span class="price">$16.50</span> Incl. Tax)</span>', + $formattedLink + ); + } + + /** + * Set the product and tax classes from tax_class fixture + * + * @param int $addressRegionId Region to use for customer billing address. + * Defaults to 12 which is the same as in tax rate fixture + */ + private function setUpTaxClasses($addressRegionId = 12) + { + $taxRule = $this->registry->registry('_fixture/Magento_Tax_Model_Calculation_Rule'); + $customerTaxClasses = $taxRule->getTaxCustomerClass(); + $productTaxClasses = $taxRule->getTaxProductClass(); + + $customerGroup = $this->objectManager->create('Magento\Customer\Model\Group')->load(1); + $customerGroup->setTaxClassId($customerTaxClasses[0]); + $customerGroup->save(); + + $address = $this->objectManager->create('Magento\Customer\Model\Address')->load(1); + $address->setRegionId($addressRegionId); + $address->save(); + + $product = $this->objectManager->create('Magento\Catalog\Model\Product')->load(1); + $product->setTaxClassId($productTaxClasses[0]); + $product->save(); + + $this->registry->register('product', $product); + $this->registry->register(RegistryConstants::CURRENT_CUSTOMER_ID, 1); + } +} + \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php index 68b2f55c08f..e09e7ed7c91 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php @@ -40,17 +40,12 @@ class AbstractTest extends \PHPUnit_Framework_TestCase /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $objectManager->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - $objectManager->get('Magento\View\DesignInterface')->setDefaultDesignTheme(); - $entityType = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Eav\Model\Config' - )->getEntityType( - 'customer' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $objectManager->get('Magento\View\DesignInterface') + ->setDefaultDesignTheme(); + $entityType = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config') + ->getEntityType('customer'); $model = $objectManager->create('Magento\Customer\Model\Attribute'); $model->setEntityTypeId($entityType->getId()); $objectManager->get('Magento\Registry')->register('entity_attribute', $model); 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 9fe9222bfd5..780676ae0d7 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php @@ -67,10 +67,12 @@ class FilterTest extends \PHPUnit_Framework_TestCase ); $this->assertStringMatchesFormat('http://example.com/%sarbitrary_url/', $url); - $url = $this->_model->storeDirective( - array('{{store url="core/ajax/translate"}}', 'store', ' url="core/ajax/translate"') - ); - $this->assertStringMatchesFormat('http://example.com/%score/ajax/translate/', $url); + $url = $this->_model->storeDirective(array( + '{{store url="translation/ajax/index"}}', + 'store', + ' url="translation/ajax/index"', + )); + $this->assertStringMatchesFormat('http://example.com/%stranslation/ajax/index/', $url); } public function testEscapehtmlDirective() @@ -126,7 +128,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase $design = $objectManager->create('Magento\Core\Model\View\Design', array('themes' => $themes)); $objectManager->addSharedInstance($design, 'Magento\Core\Model\View\Design'); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadArea($area); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea($area); $collection = $objectManager->create('Magento\Core\Model\Resource\Theme\Collection'); $themeId = $collection->getThemeByFullPath('frontend/test_default')->getId(); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php index 636278dc7ca..9b4000f1ecc 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php @@ -115,11 +115,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetProcessedTemplate() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - )->load(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); $this->_setNotDefaultThemeForFixtureStore(); $expectedViewUrl = 'static/frontend/magento_plushe/en_US/Magento_Theme/favicon.ico'; $this->_model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}'); @@ -163,11 +160,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetProcessedTemplateDesignChange() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - )->load(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); $this->_model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}'); $this->assertStringEndsWith( 'static/frontend/magento_plushe/en_US/Magento_Theme/favicon.ico', @@ -181,11 +175,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetProcessedTemplateSubject() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - )->load(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); $this->_setNotDefaultThemeForFixtureStore(); $expectedViewUrl = 'static/frontend/magento_plushe/en_US/Magento_Theme/favicon.ico'; $this->_model->setTemplateSubject('{{view url="Magento_Theme::favicon.ico"}}'); @@ -208,11 +199,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetDefaultEmailLogo() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - )->load(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); $this->assertStringEndsWith( 'static/frontend/magento_blank/en_US/Magento_Email/logo_email.gif', $this->_model->getDefaultEmailLogo() 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 52d32b03a68..de6263e690b 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/themes.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/themes.php @@ -29,13 +29,15 @@ ) ); $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 -); -$objectManger->configure(array('preferences' => array('Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data'))); +$objectManger->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); + +$objectManger->configure(array( + 'preferences' => array( + 'Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data' + ) +)); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = $objectManger->create('Magento\Core\Model\Theme\Registration'); $registration->register(implode('/', array('*', '*', 'theme.xml'))); diff --git a/dev/tests/integration/testsuite/Magento/GiftMessage/Block/Message/InlineTest.php b/dev/tests/integration/testsuite/Magento/GiftMessage/Block/Message/InlineTest.php index 5b46b8fe1cd..b4d19dd5236 100644 --- a/dev/tests/integration/testsuite/Magento/GiftMessage/Block/Message/InlineTest.php +++ b/dev/tests/integration/testsuite/Magento/GiftMessage/Block/Message/InlineTest.php @@ -47,14 +47,10 @@ class InlineTest extends \PHPUnit_Framework_TestCase */ public function testThumbnail() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Product' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); $product->load(1); $size = $this->_block->getThumbnailSize(); diff --git a/dev/tests/integration/testsuite/Magento/GoogleShopping/Model/_files/flag_expired.php b/dev/tests/integration/testsuite/Magento/GoogleShopping/Model/_files/flag_expired.php index 6666010115e..d4d8469fe51 100644 --- a/dev/tests/integration/testsuite/Magento/GoogleShopping/Model/_files/flag_expired.php +++ b/dev/tests/integration/testsuite/Magento/GoogleShopping/Model/_files/flag_expired.php @@ -31,9 +31,8 @@ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $flag = $objectManager->create('Magento\GoogleShopping\Model\Flag'); $flag->lock(); -/** @var $flagResource \Magento\Core\Model\Resource\Flag */ -$flagResource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Flag' -); +/** @var $flagResource \Magento\Flag\Resource */ +$flagResource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Flag\Resource'); $flag->setLastUpdate(date('Y-m-d H:i:s', time() - \Magento\GoogleShopping\Model\Flag::FLAG_TTL - 1)); $flagResource->save($flag); diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php index c41d2c84cef..388b2241a95 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php @@ -37,17 +37,12 @@ class FilterTest extends \PHPUnit_Framework_TestCase */ public function testGetDateFromToHtmlWithValue() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\DesignInterface' - )->setDefaultDesignTheme(); - $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\ImportExport\Block\Adminhtml\Export\Filter' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') + ->setDefaultDesignTheme(); + $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\ImportExport\Block\Adminhtml\Export\Filter'); $method = new \ReflectionMethod( 'Magento\ImportExport\Block\Adminhtml\Export\Filter', '_getDateFromToHtmlWithValue' diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php index 1e09e70f8ef..016c68038e1 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php @@ -86,7 +86,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase /** * Check that method throw exception when writer was not defined * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetWriterThrowsException() { diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ExportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ExportTest.php index 54e79d021e8..5acebb9b3f3 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ExportTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ExportTest.php @@ -86,7 +86,7 @@ class ExportTest extends \PHPUnit_Framework_TestCase /** * Test method '_getEntityAdapter' in case when entity is invalid * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @covers \Magento\ImportExport\Model\Export::_getEntityAdapter */ public function testGetEntityAdapterWithInvalidEntity() 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 39fbf61a6f1..57f0cb8fcb4 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 @@ -155,18 +155,10 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase * @dataProvider importDataDataProvider * @covers \Magento\ImportExport\Model\Import\Entity\CustomerComposite::_importData */ - public function testImportData( - $behavior, - $sourceFile, - array $dataBefore, - array $dataAfter, - array $errors = array() - ) { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); + public function testImportData($behavior, $sourceFile, array $dataBefore, array $dataAfter, array $errors = array()) + { + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); // set entity adapter parameters $this->_entityAdapter->setParameters(array('behavior' => $behavior)); /** @var \Magento\App\Filesystem $filesystem */ 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 e79b45dc89a..0c3e669d3d9 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 @@ -257,13 +257,8 @@ class AddressTest extends \PHPUnit_Framework_TestCase 'Magento\Customer\Model\Address' ); $tableName = $addressModel->getResource()->getEntityTable(); - $addressId = $objectManager->get( - 'Magento\Core\Model\Resource\HelperPool' - )->get( - 'Magento_ImportExport' - )->getNextAutoincrement( - $tableName - ); + $addressId = $objectManager->get('Magento\ImportExport\Model\Resource\Helper') + ->getNextAutoincrement($tableName); /** @var \Magento\Stdlib\DateTime $dateTime */ $dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Stdlib\DateTime'); 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 11126cde90f..4525ed9cc46 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 @@ -139,11 +139,8 @@ class CustomerImportTest extends \PHPUnit_Framework_TestCase */ public function testDeleteData() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $source = new \Magento\ImportExport\Model\Import\Source\Csv( __DIR__ . '/_files/customers_to_import.csv', $this->directoryWrite diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php index abc8436c9af..2e1c65079b3 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php @@ -125,7 +125,7 @@ class ImportTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Entity is unknown */ public function testValidateSourceException() @@ -147,7 +147,7 @@ class ImportTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Entity is unknown */ public function testGetEntityEntityIsNotSet() @@ -175,7 +175,7 @@ class ImportTest extends \PHPUnit_Framework_TestCase /** * Test getEntityBehaviors with not existing behavior class * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Invalid behavior token for customer */ public function testGetEntityBehaviorsWithUnknownBehavior() diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Resource/Import/DataTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Resource/Import/DataTest.php index 4da2db25b3c..5f9915d729c 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Resource/Import/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Resource/Import/DataTest.php @@ -67,7 +67,7 @@ class DataTest extends \PHPUnit_Framework_TestCase /** * Test getUniqueColumnData() in case when in data stored in requested column is NOT unique * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetUniqueColumnDataException() { diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/themes.php b/dev/tests/integration/testsuite/Magento/Less/_files/themes.php index 5d43a26038a..3f3db4f663f 100644 --- a/dev/tests/integration/testsuite/Magento/Less/_files/themes.php +++ b/dev/tests/integration/testsuite/Magento/Less/_files/themes.php @@ -29,6 +29,8 @@ ) ); $objectManger = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$objectManger->get('Magento\App\State') + ->setAreaCode(\Magento\View\DesignInterface::DEFAULT_AREA); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = $objectManger->create('Magento\Core\Model\Theme\Registration'); diff --git a/dev/tests/integration/testsuite/Magento/Log/Model/Resource/Visitor/Online/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Log/Model/Resource/Visitor/Online/CollectionTest.php new file mode 100644 index 00000000000..6bc9125cb2f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Log/Model/Resource/Visitor/Online/CollectionTest.php @@ -0,0 +1,66 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Log\Model\Resource\Visitor\Online; + +use Magento\TestFramework\Helper\Bootstrap; + +class CollectionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Log/_files/visitor_online.php + */ + public function testAddCustomerData() + { + /** @var \Magento\Log\Model\Resource\Visitor\Online\Collection $visitorOnlineCollection */ + $visitorOnlineCollection = Bootstrap::getObjectManager() + ->create('Magento\Log\Model\Resource\Visitor\Online\Collection'); + + $visitorOnlineCollection->addCustomerData(); + + $this->assertEquals(1, $visitorOnlineCollection->count(), "Invalid collection items quantity."); + /** @var \Magento\Log\Model\Visitor\Online $collectionItem */ + $collectionItem = $visitorOnlineCollection->getFirstItem(); + + /** @var \Magento\Log\Model\Visitor\Online $visitorOnline */ + $visitorOnline = Bootstrap::getObjectManager() + ->create('Magento\Log\Model\Visitor\Online') + ->load(1); + + $visitorOnline->addData([ + 'customer_email' => 'customer@example.com', + 'customer_firstname' => 'Firstname', + 'customer_lastname' => 'Lastname' + ]); + + foreach ($visitorOnline->getData() as $field => $expectedValue) { + $this->assertEquals( + $expectedValue, + $collectionItem->getData($field), + "'{$field}' field value is invalid." + ); + } + } +} diff --git a/app/code/Magento/Backend/Model/Resource/Translate/String.php b/dev/tests/integration/testsuite/Magento/Log/_files/visitor_online.php similarity index 65% rename from app/code/Magento/Backend/Model/Resource/Translate/String.php rename to dev/tests/integration/testsuite/Magento/Log/_files/visitor_online.php index 44129bdf324..4712a7b0422 100644 --- a/app/code/Magento/Backend/Model/Resource/Translate/String.php +++ b/dev/tests/integration/testsuite/Magento/Log/_files/visitor_online.php @@ -18,26 +18,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_Backend * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backend\Model\Resource\Translate; - -/** - * Backend string translate resource model - */ -class String extends \Magento\Core\Model\Resource\Translate\String -{ - /** - * Get current store id - * Use always default scope for store id - * - * @return int - */ - protected function _getStoreId() - { - return \Magento\Core\Model\Store::DEFAULT_STORE_ID; - } -} +/** @var \Magento\Log\Model\Visitor\Online $visitorOnline */ +$visitorOnline = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Log\Model\Visitor\Online'); +$visitorOnline->setData(array( + 'visitor_type' => 'c', + 'remote_addr' => '10101010', + 'first_visit_at' => '2014-03-02 00:00:00', + 'last_visit_at' => '2014-03-02 01:01:01', + 'customer_id' => 1, + 'last_url' => 'http://last_url', +)); +$visitorOnline->save(); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/AbstractTest.php similarity index 88% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php rename to dev/tests/integration/testsuite/Magento/Model/Resource/Db/AbstractTest.php index 4b9a949d53b..6023ae8e248 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/AbstractTest.php @@ -19,25 +19,24 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Lib * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Db; +namespace Magento\Model\Resource\Db; class AbstractTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Db\AbstractDb + * @var \Magento\Model\Resource\Db\AbstractDb */ protected $_model; protected function setUp() { $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Resource'); - $this->_model = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', + $this->_model = $this->getMockForAbstractClass('Magento\Model\Resource\Db\AbstractDb', array('resource' => $resource) ); } @@ -74,8 +73,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase array('tablePrefix' => 'prefix_') ); - $model = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', + $model = $this->getMockForAbstractClass('Magento\Model\Resource\Db\AbstractDb', array('resource' => $resource) ); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/Collection/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/Collection/AbstractTest.php similarity index 78% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/Collection/AbstractTest.php rename to dev/tests/integration/testsuite/Magento/Model/Resource/Db/Collection/AbstractTest.php index 88e1e6dde2e..370453181c8 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/Collection/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/Collection/AbstractTest.php @@ -21,26 +21,21 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Db\Collection; +namespace Magento\Model\Resource\Db\Collection; class AbstractTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @var \Magento\Model\Resource\Db\Collection\AbstractCollection */ protected $_model = null; protected function setUp() { - $resourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Resource'); - $resource = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', - array($resourceModel), - '', - true, - true, - true, - array('getMainTable', 'getIdFieldName') + $resourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\App\Resource'); + $resource = $this->getMockForAbstractClass('Magento\Model\Resource\Db\AbstractDb', + array($resourceModel), '', true, true, true, array('getMainTable', 'getIdFieldName') ); $resource->expects( @@ -58,13 +53,13 @@ class AbstractTest extends \PHPUnit_Framework_TestCase 'Magento\Event\ManagerInterface' ); - $entityFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\EntityFactory' - ); - $logger = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Logger'); + $entityFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Core\Model\EntityFactory'); + $logger = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Logger'); $this->_model = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection', + 'Magento\Model\Resource\Db\Collection\AbstractCollection', array($entityFactory, $logger, $fetchStrategy, $eventManager, null, $resource) ); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/ProfilerTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/ProfilerTest.php similarity index 91% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/ProfilerTest.php rename to dev/tests/integration/testsuite/Magento/Model/Resource/Db/ProfilerTest.php index 1773df4f0b8..e66925ce7b8 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/ProfilerTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/ProfilerTest.php @@ -1,6 +1,6 @@ <?php /** - * Test for \Magento\Core\Model\Resource\Db\Profiler + * Test for \Magento\Model\Resource\Db\Profiler * * Magento * @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Db; +namespace Magento\Model\Resource\Db; class ProfilerTest extends \PHPUnit_Framework_TestCase { @@ -63,7 +63,7 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase $localConfig = $objectManager->get('Magento\App\Arguments'); $connectionConfig = $localConfig->getConnection('default'); $connectionConfig['profiler'] = array( - 'class' => 'Magento\Core\Model\Resource\Db\Profiler', + 'class' => 'Magento\Model\Resource\Db\Profiler', 'enabled' => 'true' ); $connectionConfig['dbname'] = $connectionConfig['dbName']; @@ -92,9 +92,9 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase $result->fetchAll(); } - /** @var \Magento\Core\Model\Resource\Db\Profiler $profiler */ + /** @var \Magento\Model\Resource\Db\Profiler $profiler */ $profiler = $connection->getProfiler(); - $this->assertInstanceOf('Magento\Core\Model\Resource\Db\Profiler', $profiler); + $this->assertInstanceOf('Magento\Model\Resource\Db\Profiler', $profiler); $queryProfiles = $profiler->getQueryProfiles($queryType); $this->assertCount(1, $queryProfiles); @@ -150,9 +150,9 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase $testTableName = $resource->getTableName('core_resource'); $connection->query('SELECT * FROM ' . $testTableName); - /** @var \Magento\Core\Model\Resource\Db\Profiler $profiler */ + /** @var \Magento\Model\Resource\Db\Profiler $profiler */ $profiler = $connection->getProfiler(); - $this->assertInstanceOf('Magento\Core\Model\Resource\Db\Profiler', $profiler); + $this->assertInstanceOf('Magento\Model\Resource\Db\Profiler', $profiler); $queryProfiles = $profiler->getQueryProfiles(\Magento\DB\Profiler::SELECT); $this->assertCount(2, $queryProfiles); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Entity/TableTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/Entity/TableTest.php similarity index 88% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/Entity/TableTest.php rename to dev/tests/integration/testsuite/Magento/Model/Resource/Entity/TableTest.php index 019a03f82d9..8b3b9f60d56 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Entity/TableTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/Entity/TableTest.php @@ -24,12 +24,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Entity; +namespace Magento\Model\Resource\Entity; class TableTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Entity\Table + * @var \Magento\Model\Resource\Entity\Table */ protected $_model; @@ -41,10 +41,8 @@ class TableTest extends \PHPUnit_Framework_TestCase $config->test_key = 'test'; // @codingStandardsIgnoreEnd - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Entity\Table', - array('config' => $config) - ); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Model\Resource\Entity\Table', array('config' => $config)); } public function testGetTable() diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/IteratorTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/IteratorTest.php similarity index 74% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/IteratorTest.php rename to dev/tests/integration/testsuite/Magento/Model/Resource/IteratorTest.php index b863dc51875..de6e27ee330 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/IteratorTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/IteratorTest.php @@ -24,12 +24,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Model\Resource; class IteratorTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_model; @@ -42,18 +42,8 @@ class IteratorTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Iterator' - ); - } - - public function testWalk() - { - $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Store\Collection' - ); - $this->_model->walk($collection->getSelect(), array(array($this, 'walkCallback'))); - $this->assertGreaterThan(0, $this->_callbackCounter); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Model\Resource\Iterator'); } /** @@ -69,7 +59,7 @@ class IteratorTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testWalkException() { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/ResourceTest.php b/dev/tests/integration/testsuite/Magento/Model/ResourceTest.php similarity index 86% rename from dev/tests/integration/testsuite/Magento/Core/Model/ResourceTest.php rename to dev/tests/integration/testsuite/Magento/Model/ResourceTest.php index 601946d8f23..4fd86172af5 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/ResourceTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/ResourceTest.php @@ -1,6 +1,6 @@ <?php /** - * Test for \Magento\Core\Model\Resource + * Test for \Magento\Model\Resource * * Magento * @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Model; class ResourceTest extends \PHPUnit_Framework_TestCase { @@ -66,7 +66,10 @@ class ResourceTest extends \PHPUnit_Framework_TestCase 'Magento\TestFramework\Db\Adapter\Mysql', array( 'config' => array( - 'profiler' => array('class' => 'Magento\Core\Model\Resource\Db\Profiler', 'enabled' => 'true'), + 'profiler' => array( + 'class' => 'Magento\Model\Resource\Db\Profiler', + 'enabled' => 'true' + ), 'username' => 'username', 'password' => 'password', 'host' => 'host', @@ -76,10 +79,10 @@ class ResourceTest extends \PHPUnit_Framework_TestCase ) ); - /** @var \Magento\Core\Model\Resource\Db\Profiler $profiler */ + /** @var \Magento\Model\Resource\Db\Profiler $profiler */ $profiler = $connection->getProfiler(); - $this->assertInstanceOf('Magento\Core\Model\Resource\Db\Profiler', $profiler); + $this->assertInstanceOf('Magento\Model\Resource\Db\Profiler', $profiler); $this->assertTrue($profiler->getEnabled()); } } diff --git a/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php index a04c44c0412..575383d0266 100644 --- a/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php +++ b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php @@ -40,20 +40,18 @@ class OverviewTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_objectManager->get('Magento\Core\Model\App')->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); - $this->_block = $this->_objectManager->get( - 'Magento\View\LayoutInterface' - )->createBlock( - 'Magento\Multishipping\Block\Checkout\Overview', - 'checkout_overview', - array( - 'data' => array( - 'renderer_template' => 'Magento_Multishipping::checkout/item/default.phtml', - 'row_renderer_template' => 'Magento_Multishipping::checkout/overview/item.phtml' + $this->_block = $this->_objectManager->get('Magento\View\LayoutInterface') + ->createBlock('Magento\Multishipping\Block\Checkout\Overview', + 'checkout_overview', + array( + 'data' => array( + 'renderer_template' => 'Magento_Multishipping::checkout/item/default.phtml', + 'row_renderer_template' => 'Magento_Multishipping::checkout/overview/item.phtml' + ), ) - ) - ); + ); $this->_block->addChild('renderer.list', '\Magento\View\Element\RendererList'); $this->_block->getChildBlock( diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php index 75202219d5f..735e14d41dd 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php @@ -38,9 +38,9 @@ class QueueTest extends \PHPUnit_Framework_TestCase /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $app \Magento\TestFramework\App */ - $app = $objectManager->get('Magento\Core\Model\App'); - $app->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $objectManager->get('Magento\App\State')->setAreaCode(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $area = $objectManager->get('Magento\App\AreaList')->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $area->load(); /** @var $filter \Magento\Newsletter\Model\Template\Filter */ $filter = $objectManager->get('Magento\Newsletter\Model\Template\Filter'); @@ -77,8 +77,10 @@ class QueueTest extends \PHPUnit_Framework_TestCase { $errorMsg = md5(microtime()); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $objectManager->get('Magento\Core\Model\App')->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $transport = $this->getMock('\Magento\Mail\TransportInterface'); $transport->expects( diff --git a/dev/tests/integration/testsuite/Magento/Outbound/Authentication/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Outbound/Authentication/FactoryTest.php deleted file mode 100644 index 6670f8be51e..00000000000 --- a/dev/tests/integration/testsuite/Magento/Outbound/Authentication/FactoryTest.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** - * \Magento\Outbound\Authentication\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Authentication; - -use Magento\Outbound\Authentication\Factory as AuthenticationFactory; -use Magento\Outbound\EndpointInterface; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** @var AuthenticationFactory */ - protected $_authFactory; - - protected function setUp() - { - $this->_authFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Outbound\Authentication\Factory', - array( - 'authenticationMap' => array( - EndpointInterface::AUTH_TYPE_HMAC => 'Magento\Outbound\Authentication\Hmac' - ) - ) - ); - } - - public function testGetFormatter() - { - $authObject = $this->_authFactory->getAuthentication(EndpointInterface::AUTH_TYPE_HMAC); - $this->assertInstanceOf('Magento\Outbound\Authentication\Hmac', $authObject); - } - - public function testGetFormatterIsCached() - { - $authObject = $this->_authFactory->getAuthentication(EndpointInterface::AUTH_TYPE_HMAC); - $authObject2 = $this->_authFactory->getAuthentication(EndpointInterface::AUTH_TYPE_HMAC); - $this->assertSame($authObject, $authObject2); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Outbound/Formatter/FactoryTest.php deleted file mode 100644 index 7d31e8189ba..00000000000 --- a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/FactoryTest.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php -/** - * \Magento\Outbound\Formatter\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter; - -use Magento\Outbound\Formatter\Factory as FormatterFactory; -use Magento\Outbound\EndpointInterface; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** @var FormatterFactory */ - protected $_formatterFactory; - - protected function setUp() - { - $this->_formatterFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Outbound\Formatter\Factory', - array('formatterMap' => array(EndpointInterface::FORMAT_JSON => 'Magento\Outbound\Formatter\Json')) - ); - } - - public function testGetFormatter() - { - $formatter = $this->_formatterFactory->getFormatter(EndpointInterface::FORMAT_JSON); - $this->assertInstanceOf('Magento\Outbound\Formatter\Json', $formatter); - } - - public function testGetFormatterIsCached() - { - $formatter = $this->_formatterFactory->getFormatter(EndpointInterface::FORMAT_JSON); - $formatter2 = $this->_formatterFactory->getFormatter(EndpointInterface::FORMAT_JSON); - $this->assertSame($formatter, $formatter2); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest.php b/dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest.php deleted file mode 100644 index 4d5e8d28b75..00000000000 --- a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php -/** - * \Magento\Outbound\Formatter\JsonTest - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter; - - -require_once __DIR__ . '/JsonTest/Data.php'; -class JsonTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Outbound\Formatter\Json */ - protected $_formatter; - - protected function setUp() - { - $this->_formatter = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Outbound\Formatter\Json' - ); - } - - /** - * @dataProvider encodeDataProvider - * - * @param $body - * @param $formattedBody - */ - public function testFormat($body, $formattedBody) - { - $this->assertSame($formattedBody, $this->_formatter->format($body)); - } - - /** - * DataProvider for testing the JSON formatter. - * - * @return array - */ - public function encodeDataProvider() - { - return array( - array(array(), "[]"), - array(array('a' => array('b' => 'c', 'd' => 'e'), 'f' => 'g'), '{"a":{"b":"c","d":"e"},"f":"g"}'), - array(array(null), '[null]'), - array(array(true), '[true]'), - array(array(false), '[false]'), - array(array(-1), '[-1]'), - array(array(0), '[0]'), - array(array(1), '[1]'), - array(array(2.4), '[2.4]'), - array(array(2.0), '[2]'), - array(array(new \Magento\Outbound\Formatter\JsonTest\Data('public', 'protected')), '[{"dataA":"public"}]') - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php b/dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php deleted file mode 100644 index 9c5f1be9ce1..00000000000 --- a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * Class Data is a simple class to test converting a PHP class into JSON data - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @subpackage integration_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter\JsonTest; - -class Data -{ - public $dataA; - - protected $_dataB; - - public function __construct($first, $second) - { - $this->dataA = $first; - $this->_dataB = $second; - } - - public function getB() - { - return $this->_dataB; - } -} diff --git a/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php b/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php index c23344c327c..6c9d5bc0304 100644 --- a/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php +++ b/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php @@ -73,7 +73,7 @@ class TtlTest extends \PHPUnit_Framework_TestCase */ public function testBeforeSaveWithException($value, $path) { - $this->setExpectedException('\Magento\Core\Exception'); + $this->setExpectedException('\Magento\Model\Exception'); $this->_prepareData($value, $path); } diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express.php index 74a0963f0b6..c5c02f63ee6 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express.php @@ -21,19 +21,11 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadArea('adminhtml'); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' -)->getStore()->setConfig( - 'carriers/flatrate/active', - 1 -); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' -)->getStore()->setConfig( - 'payment/paypal_express/active', - 1 -); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('adminhtml'); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() + ->setConfig('carriers/flatrate/active', 1); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() + ->setConfig('payment/paypal_express/active', 1); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); $product->setTypeId( diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php index 08630bc7ba8..54aba2fe7ee 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php @@ -22,13 +22,9 @@ * @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')->loadArea('adminhtml'); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' -)->getStore()->setConfig( - 'carriers/flatrate/active', - 1 -); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('adminhtml'); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() + ->setConfig('carriers/flatrate/active', 1); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); $product->setTypeId( diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php index dc2b80c3f5b..e255ed2b24e 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php @@ -21,13 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadArea('adminhtml'); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' -)->getStore()->setConfig( - 'carriers/flatrate/active', - 1 -); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('adminhtml'); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() + ->setConfig('carriers/flatrate/active', 1); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); $product->setTypeId( diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/Block/Email/StockTest.php b/dev/tests/integration/testsuite/Magento/ProductAlert/Block/Email/StockTest.php index fa24b92209d..cbd299281a7 100644 --- a/dev/tests/integration/testsuite/Magento/ProductAlert/Block/Email/StockTest.php +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/Block/Email/StockTest.php @@ -47,14 +47,9 @@ class StockTest extends \PHPUnit_Framework_TestCase */ public function testThumbnail() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Product' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); $product->load(1); $size = $this->_block->getThumbnailSize(); diff --git a/dev/tests/integration/testsuite/Magento/PubSub/EventTest.php b/dev/tests/integration/testsuite/Magento/PubSub/EventTest.php deleted file mode 100644 index aebb49fa21f..00000000000 --- a/dev/tests/integration/testsuite/Magento/PubSub/EventTest.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/** - * \Magento\PubSub\Event - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub; - -class EventTest extends \PHPUnit_Framework_TestCase -{ - public function testGetters() - { - $bodyData = array('some' => 'body'); - $topic = 'topic'; - - $event = new \Magento\PubSub\Event($topic, $bodyData); - - $this->assertEquals(array(), $event->getHeaders()); - $this->assertEquals($bodyData, $event->getBodyData()); - $this->assertEquals($topic, $event->getTopic()); - $this->assertEquals(\Magento\PubSub\Event::STATUS_READY_TO_SEND, $event->getStatus()); - } - - public function testMarkProcessed() - { - $bodyData = array('some' => 'body'); - $topic = 'topic'; - $event = new \Magento\PubSub\Event($topic, $bodyData); - - $event->complete(); - - $this->assertEquals(\Magento\PubSub\Event::STATUS_PROCESSED, $event->getStatus()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php b/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php index 8453d769cb5..132642503a6 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php +++ b/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php @@ -22,12 +22,9 @@ * @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' -)->loadAreaPart( - 'adminhtml', - \Magento\Core\Model\App\Area::PART_CONFIG -); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea('adminhtml') + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php'; require __DIR__ . '/../../../Magento/Catalog/_files/product_simple_duplicated.php'; diff --git a/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/FormTest.php new file mode 100644 index 00000000000..af89aac89ff --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/FormTest.php @@ -0,0 +1,54 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Review\Block\Adminhtml\Edit; + +class FormTest extends \PHPUnit_Framework_TestCase +{ + /** + * @magentoDataFixture Magento/Review/_files/customer_review.php + */ + public function testCustomerOnForm() + { + /** @var \Magento\Customer\Model\Customer $customer */ + $customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Customer\Model\Customer') + ->setWebsiteId(1) + ->loadByEmail('customer@example.com'); + $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Review\Block\Adminhtml\Edit\Form'); + /** @var \Magento\Escaper $escaper */ + $escaper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Escaper'); + $this->assertStringMatchesFormat( + '%A' . __('<a href="%1" onclick="this.target=\'blank\'">%2 %3</a> <a href="mailto:%4">(%4)</a>', + '%A', + $escaper->escapeHtml($customer->getFirstname()), + $escaper->escapeHtml($customer->getLastname()), + $escaper->escapeHtml($customer->getEmail()) + ) . '%A', + $block->toHtml() + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/MainTest.php b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/MainTest.php new file mode 100644 index 00000000000..ab88f39e7f7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/MainTest.php @@ -0,0 +1,53 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Review\Block\Adminhtml; + +class MainTest extends \PHPUnit_Framework_TestCase +{ + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoAppArea adminhtml + */ + public function testConstruct() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\Customer\Service\V1\CustomerAccountService $service */ + $service = $objectManager->create('Magento\Customer\Service\V1\CustomerAccountService'); + $customer = $service->authenticate('customer@example.com', 'password'); + $request = $objectManager->get('Magento\App\RequestInterface'); + $request->setParam('customerId', $customer->getId()); + /** @var \Magento\View\LayoutInterface $layout */ + $layout = $objectManager->get('Magento\View\LayoutInterface'); + $block = $layout->createBlock('Magento\Review\Block\Adminhtml\Main'); + $customerName = $customer->getFirstname() . ' ' . $customer->getLastname(); + /** @var \Magento\Escaper $escaper */ + $escaper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Escaper'); + $this->assertStringMatchesFormat( + '%A' . __('All Reviews of Customer `%1`', $escaper->escapeHtml($customerName)) . '%A', + $block->getHeaderHtml() + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Review/Block/FormTest.php b/dev/tests/integration/testsuite/Magento/Review/Block/FormTest.php new file mode 100644 index 00000000000..e43088ec2b2 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Review/Block/FormTest.php @@ -0,0 +1,52 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Review\Block; + +class FormTest extends \PHPUnit_Framework_TestCase +{ + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoAppArea frontend + */ + public function testCustomerOnForm() + { + $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Customer\Model\Session'); + $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Customer\Service\V1\CustomerAccountService'); + $customer = $service->authenticate('customer@example.com', 'password'); + $session->setCustomerDataAsLoggedIn($customer); + $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Review\Block\Form'); + /** @var \Magento\Escaper $escaper */ + $escaper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Escaper'); + $this->assertStringMatchesFormat( + '%A<input type="text" name="nickname" id="nickname_field" class="input-text"' + . ' data-validate="{required:true}" value="' + . $escaper->escapeHtml($customer->getFirstname()) . '" />%A', + $block->toHtml() + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Review/_files/customer_review.php b/dev/tests/integration/testsuite/Magento/Review/_files/customer_review.php new file mode 100644 index 00000000000..1535b4f74d3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Review/_files/customer_review.php @@ -0,0 +1,59 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE +); + +require __DIR__ . '/../../../Magento/Customer/_files/customer.php'; +require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php'; + +$review = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Review\Model\Review', + ['data' => [ + 'customer_id' => $customer->getId(), + 'title' => 'Review Summary', + 'detail' => 'Review text', + 'nickname' => 'Nickname', + ]] +); + +$review + ->setEntityId($review->getEntityIdByCode(\Magento\Review\Model\Review::ENTITY_PRODUCT_CODE)) + ->setEntityPkValue($product->getId()) + ->setStatusId(\Magento\Review\Model\Review::STATUS_PENDING) + ->setStoreId( + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface') + ->getStore()->getId() + ) + ->setStores([ + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface') + ->getStore()->getId() + ]) + ->save(); + +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Registry')->register( + 'review_data', + $review +); diff --git a/dev/tests/integration/testsuite/Magento/Rss/Block/WishlistTest.php b/dev/tests/integration/testsuite/Magento/Rss/Block/WishlistTest.php new file mode 100644 index 00000000000..edf9cb192e5 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Rss/Block/WishlistTest.php @@ -0,0 +1,108 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Rss\Block; + +class WishlistTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Customer\Model\Session + */ + protected $_customerSession; + + /** + * Core data + * + * @var \Magento\Core\Helper\Data + */ + protected $_coreData; + + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + protected function setUp() + { + $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_customerSession = $this->_objectManager->create('Magento\Customer\Model\Session'); + $this->_coreData = $this->_objectManager->create('Magento\Core\Helper\Data'); + + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Wishlist/_files/wishlist_with_product_qty_increments.php + * @magentoAppArea frontend + */ + public function testCustomerTitle() + { + $fixtureCustomerId = 1; + $this->_customerSession->loginById($fixtureCustomerId); + + /** @var \Magento\Wishlist\Model\Wishlist $wishlist */ + $wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist') + ->loadByCustomerId($fixtureCustomerId); + + /** @var \Magento\App\Helper\Context $contextHelper */ + $contextHelper = $this->_objectManager->create('Magento\App\Helper\Context'); + + $wishlistHelper = $this->_objectManager->create('Magento\Rss\Helper\WishlistRss', + [ + 'context' => $contextHelper, + 'customerSession' => $this->_customerSession + ] + ); + + /** @var \Magento\Catalog\Block\Product\Context $context */ + $contextBlock = $this->_objectManager->create( + 'Magento\Rss\Block\Context', + [ + 'request' => $contextHelper->getRequest(), + 'wishlistHelper' => $wishlistHelper + ] + ); + /** @var \Magento\App\Request\Http $request */ + $request = $contextHelper->getRequest(); + $request->setParam('wishlist_id', $wishlist->getId()); + $request->setParam('data', $this->_coreData->urlEncode($fixtureCustomerId)); + + /** @var \Magento\Rss\Block\Wishlist $block */ + $block = $this->_objectManager->create('Magento\Rss\Block\Wishlist', + [ + 'context' => $contextBlock + ] + ); + + /** @var \Magento\Escaper $escaper */ + $escaper = $this->_objectManager->create('Magento\Escaper'); + + $expectedSting = '%A' . __("<title><![CDATA[%1 %2's Wishlist]]></title>", + $escaper->escapeHtml($this->_customerSession->getCustomerDataObject()->getFirstname()), + $escaper->escapeHtml($this->_customerSession->getCustomerDataObject()->getLastname()) + ) . '%A'; + $this->assertStringMatchesFormat($expectedSting, $block->toHtml()); + } +} + \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php b/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php index 1147544f6b2..847c96368a9 100644 --- a/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php +++ b/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php @@ -164,22 +164,15 @@ class CatalogTest extends \Magento\TestFramework\TestCase\AbstractController */ protected function _loginAdmin() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\DesignInterface' - )->setDefaultDesignTheme(); - $this->getRequest()->setServer( - array( - 'PHP_AUTH_USER' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, - 'PHP_AUTH_PW' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD - ) - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Backend\Model\UrlInterface' - )->turnOffSecretKey(); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') + ->setDefaultDesignTheme(); + $this->getRequest()->setServer(array( + 'PHP_AUTH_USER' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, + 'PHP_AUTH_PW' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD + )); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Backend\Model\UrlInterface') + ->turnOffSecretKey(); } } diff --git a/dev/tests/integration/testsuite/Magento/Rss/Helper/WishlistRssTest.php b/dev/tests/integration/testsuite/Magento/Rss/Helper/WishlistRssTest.php new file mode 100644 index 00000000000..88799cf4a05 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Rss/Helper/WishlistRssTest.php @@ -0,0 +1,129 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Rss\Helper; + +class WishlistRssTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Customer\Model\Session + */ + protected $_customerSession; + + /** + * Core data + * + * @var \Magento\Core\Helper\Data + */ + protected $_coreData; + + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + /** + * @var \Magento\App\Helper\Context + */ + protected $_contextHelper; + + /** + * @var \Magento\Rss\Helper\WishlistRss + */ + protected $_wishlistHelper; + + /** + * @var int + */ + protected $_fixtureCustomerId; + + protected function setUp() + { + $this->_fixtureCustomerId = 1; + + $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_customerSession = $this->_objectManager->create('Magento\Customer\Model\Session'); + $this->_coreData = $this->_objectManager->create('Magento\Core\Helper\Data'); + + $this->_contextHelper = $this->_objectManager->create('Magento\App\Helper\Context'); + $request = $this->_contextHelper->getRequest(); + $request->setParam('data', $this->_coreData->urlEncode($this->_fixtureCustomerId)); + + $this->_wishlistHelper = $this->_objectManager->create('Magento\Rss\Helper\WishlistRss', + [ + 'context' => $this->_contextHelper, + 'customerSession' => $this->_customerSession + ] + ); + + $this->_customerSession->loginById($this->_fixtureCustomerId); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoAppArea frontend + */ + public function testGetCustomer() + { + $this->assertEquals($this->_customerSession->getCustomerDataObject(), $this->_wishlistHelper->getCustomer()); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Wishlist/_files/wishlist_with_product_qty_increments.php + * @magentoAppArea frontend + */ + public function testGetWishlistByParam() + { + /** @var \Magento\Wishlist\Model\Wishlist $wishlist */ + $wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist') + ->loadByCustomerId($this->_fixtureCustomerId); + $wishlist->load($wishlist->getId()); + + /** @var \Magento\App\Request\Http $request */ + $request = $this->_contextHelper->getRequest(); + $request->setParam('wishlist_id', $wishlist->getId()); + + $this->assertEquals($wishlist, $this->_wishlistHelper->getWishlist()); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Wishlist/_files/wishlist_with_product_qty_increments.php + * @magentoAppArea frontend + */ + public function testGetWishlistByCustomerId() + { + /** @var \Magento\Wishlist\Model\Wishlist $wishlist */ + $wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist') + ->loadByCustomerId($this->_fixtureCustomerId); + + /** @var \Magento\App\Request\Http $request */ + $request = $this->_contextHelper->getRequest(); + $request->setParam('wishlist_id', ''); + + $this->assertEquals($wishlist, $this->_wishlistHelper->getWishlist()); + } +} + \ No newline at end of file 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 85421462a8d..908ea87a9b4 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 @@ -43,11 +43,8 @@ class AbstractTest extends \PHPUnit_Framework_TestCase public function testAddAttributesToForm() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $objectManager->get('Magento\View\DesignInterface')->setDefaultDesignTheme(); $arguments = array( diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php index d990315e297..600ffdfb329 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php @@ -36,18 +36,17 @@ namespace Magento\Sales\Block\Adminhtml\Report\Filter\Form; class CouponTest extends \PHPUnit_Framework_TestCase { /** - * Application object + * Layout * - * @var \Magento\Core\Model\App + * @var \Magento\View\LayoutInterface */ - protected $_application; + protected $_layout; protected function setUp() { parent::setUp(); - $this->_application = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - ); + $this->_layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\View\LayoutInterface'); } /** @@ -56,9 +55,7 @@ class CouponTest extends \PHPUnit_Framework_TestCase public function testAfterToHtml() { /** @var $block \Magento\Sales\Block\Adminhtml\Report\Filter\Form\Coupon */ - $block = $this->_application->getLayout()->createBlock( - 'Magento\Sales\Block\Adminhtml\Report\Filter\Form\Coupon' - ); + $block = $this->_layout->createBlock('Magento\Sales\Block\Adminhtml\Report\Filter\Form\Coupon'); $block->setFilterData(new \Magento\Object()); $html = $block->toHtml(); 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 1bd919d5c5e..cc15c5f0017 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php @@ -77,7 +77,7 @@ class CommentsTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetCommentsWrongEntityException() { diff --git a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php index e52fc87dd84..b7c94c44d70 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php @@ -157,4 +157,28 @@ class CreateTest extends \Magento\Backend\Utility\Controller array('', true, 'Magento_Sales::actions') ); } + + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + * @magentoAppArea adminhtml + */ + public function testConfigureProductToAddAction() + { + $this->getRequest()->setParam('id', 1) + ->setParam('isAjax', true); + + $this->dispatch('backend/sales/order_create/configureProductToAdd'); + + $body = $this->getResponse()->getBody(); + + $this->assertNotEmpty($body); + $this->assertContains('>Quantity</label>', $body); + $this->assertContains('>Test Configurable</label>', $body); + $this->assertContains('"code":"test_configurable","label":"Test Configurable"', $body); + $this->assertContains('"label":"Option 1","price":"5","oldPrice":"5","products":[', $body); + $this->assertContains('"label":"Option 2","price":"5","oldPrice":"5","products":[', $body); + $this->assertContains('"basePrice":"100","oldPrice":"100","productId":"1","chooseText":"Choose an Option..."', + $body); + } } diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php index 756cff856d1..570c9abb8a6 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php @@ -277,7 +277,7 @@ class CreateTest extends \PHPUnit_Framework_TestCase try { $this->_model->createOrder(); $this->fail('Validation errors are expected to lead to exception during createOrder() call.'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { /** createOrder is expected to throw exception with empty message when validation error occurs */ } $errorMessages = array(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoTest.php index 70a54bcff6d..940cf587a4e 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoTest.php @@ -33,12 +33,10 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase */ public function testSendEmail() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Order'); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Order'); $order->loadByIncrementId('100000001'); $order->setCustomerEmail('customer@example.com'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php index 45e8f74f421..cb747bc161a 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php @@ -33,12 +33,10 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase */ public function testSendEmail() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Order'); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Order'); $order->loadByIncrementId('100000001'); $order->setCustomerEmail('customer@example.com'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/OrderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/OrderTest.php index 986e00ea292..fc2f3d6342d 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/OrderTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/OrderTest.php @@ -33,12 +33,10 @@ class OrderTest extends \PHPUnit_Framework_TestCase */ public function testSendNewOrderEmail() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Order'); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Order'); $order->loadByIncrementId('100000001'); $order->setCustomerEmail('customer@example.com'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice.php b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice.php index a64957bf7cf..5cb6328ae1b 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice.php @@ -34,7 +34,6 @@ $orderService = \Magento\TestFramework\ObjectManager::getInstance()->create( $invoice = $orderService->prepareInvoice(); $invoice->register(); $order->setIsInProcess(true); -$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Transaction' -); +$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\DB\Transaction'); $transactionSave->addObject($invoice)->addObject($order)->save(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php index eae3988b0f8..4a183d932f2 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php @@ -34,7 +34,6 @@ $orderService = \Magento\TestFramework\ObjectManager::getInstance()->create( $invoice = $orderService->prepareInvoice(); $invoice->register(); $order->setIsInProcess(true); -$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Transaction' -); +$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\DB\Transaction'); $transactionSave->addObject($invoice)->addObject($order)->save(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_payflowpro.php b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_payflowpro.php index 22519ca399d..74104e8bfba 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_payflowpro.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_payflowpro.php @@ -35,7 +35,6 @@ $invoice = $orderService->prepareInvoice(); /** To allow invoice cancelling it should be created without capturing. */ $invoice->setRequestedCaptureCase(\Magento\Sales\Model\Order\Invoice::NOT_CAPTURE)->register(); $order->setIsInProcess(true); -$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Transaction' -); +$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\DB\Transaction'); $transactionSave->addObject($invoice)->addObject($order)->save(); 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 229758d8687..cdfa0326eb9 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php @@ -25,11 +25,8 @@ * @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' -)->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE -); +\Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); @@ -136,13 +133,10 @@ foreach ($creditmemo->getAllItems() as $creditmemoItem) { $creditmemo->register(); $creditmemo->save(); -$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Transaction' -)->addObject( - $creditmemo -)->addObject( - $creditmemo->getOrder() -); +$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\DB\Transaction') + ->addObject($creditmemo) + ->addObject($creditmemo->getOrder()); if ($creditmemo->getInvoice()) { $transactionSave->addObject($creditmemo->getInvoice()); } diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php index 4342c567bd8..51e48d41f0b 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php @@ -25,9 +25,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var \Magento\Core\Model\App $app */ -$app = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App'); -$app->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); +\Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $addressData = include __DIR__ . '/address_data.php'; diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php b/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php index d1e5c806675..da673e38d43 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php @@ -24,7 +24,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadArea('frontend'); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('frontend'); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); $product->setTypeId( 'simple' 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 8cb1e7b6e99..b88a6634f8d 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 @@ -35,16 +35,10 @@ class ImportExportTest extends \PHPUnit_Framework_TestCase protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\LayoutInterface' - )->createBlock( - 'Magento\Tax\Block\Adminhtml\Rate\ImportExport' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') + ->createBlock('Magento\Tax\Block\Adminhtml\Rate\ImportExport'); } protected function tearDown() diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php index ed356b343ec..859a109f8ef 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php @@ -48,7 +48,7 @@ class ClassTest extends \PHPUnit_Framework_TestCase \Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_CUSTOMER )->getFirstItem(); - $this->setExpectedException('Magento\Core\Exception'); + $this->setExpectedException('Magento\Model\Exception'); $model->checkClassCanBeDeleted(); } @@ -90,7 +90,7 @@ class ClassTest extends \PHPUnit_Framework_TestCase $model->getId() )->save(); - $this->setExpectedException('Magento\Core\Exception'); + $this->setExpectedException('Magento\Model\Exception'); $model->checkClassCanBeDeleted(); } @@ -130,7 +130,7 @@ class ClassTest extends \PHPUnit_Framework_TestCase /** @var $model \Magento\Tax\Model\ClassModel */ $model = $this->_objectManager->create('Magento\Tax\Model\ClassModel')->load($customerClasses[0]); $this->setExpectedException( - 'Magento\Core\Exception', + 'Magento\Model\Exception', 'You cannot delete this tax class because it is used in' . ' Tax Rules. You have to delete the rules it is used in first.' ); @@ -152,7 +152,7 @@ class ClassTest extends \PHPUnit_Framework_TestCase /** @var $model \Magento\Tax\Model\ClassModel */ $model = $this->_objectManager->create('Magento\Tax\Model\ClassModel')->load($productClasses[0]); $this->setExpectedException( - 'Magento\Core\Exception', + 'Magento\Model\Exception', 'You cannot delete this tax class because it is used in' . ' Tax Rules. You have to delete the rules it is used in first.' ); 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 1978887042c..184bd170800 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/CsvImportHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/CsvImportHandlerTest.php @@ -75,7 +75,7 @@ class CsvImportHandlerTest extends \PHPUnit_Framework_TestCase /** * @magentoDbIsolation enabled - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage One of the countries has invalid code. */ public function testImportFromCsvFileThrowsExceptionWhenCountryCodeIsInvalid() diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/Calculation/Rule/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/Calculation/Rule/CollectionTest.php index c0b86b60989..add9eae9b65 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/Calculation/Rule/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/Calculation/Rule/CollectionTest.php @@ -73,7 +73,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase /** * Test setClassTypeFilter with wrong Class Type * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testSetClassTypeFilterWithWrongType() { diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php index c7a94878968..fa9b2a2413e 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php @@ -58,7 +58,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase /** @var $model \Magento\Tax\Model\TaxClass\Type\Customer */ $model = $this->_objectManager->create('Magento\Tax\Model\TaxClass\Type\Customer'); $model->setId(self::TAX_CLASS_ID); - /** @var $collection \Magento\Core\Model\Resource\Db\Collection\AbstractCollection */ + /** @var $collection \Magento\Model\Resource\Db\Collection\AbstractCollection */ $collection = $model->getAssignedToObjects(); $this->assertEquals(self::TAX_CLASS_ID, $collection->getFirstItem()->getData('tax_class_id')); $this->assertEquals(self::GROUP_CODE, $collection->getFirstItem()->getData('customer_group_code')); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php index 342ae4db75a..6a86defe013 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php @@ -57,9 +57,7 @@ class BlockInstantiationTest extends \Magento\TestFramework\TestCase\AbstractInt \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID ); - /** @var \Magento\Core\Model\App $app */ - $app = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App'); - $app->loadArea($area); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea($area); $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create($class); $this->assertNotNull($block); @@ -145,13 +143,11 @@ class BlockInstantiationTest extends \Magento\TestFramework\TestCase\AbstractInt ) { $area = 'adminhtml'; } - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG - ); - $templateBlocks[$module . ', ' . $blockClass . ', ' . $area] = array($module, $blockClass, $area); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); + $templateBlocks[$module . ', ' . $blockClass . ', ' . $area] + = array($module, $blockClass, $area); return $templateBlocks; } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php index 83a956a9c77..cecd3f6f219 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php @@ -49,7 +49,7 @@ class LayoutFilesTest extends \PHPUnit_Framework_TestCase */ public function testLayoutArguments($area, $layoutFile) { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadArea($area); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea($area); $dom = new \DOMDocument(); $dom->load($layoutFile); $xpath = new \DOMXPath($dom); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php index 6d2639cc823..7094313503b 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php @@ -106,12 +106,9 @@ class TemplateFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrit $area = 'adminhtml'; } - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadAreaPart( - $area, - \Magento\Core\Model\App\Area::PART_CONFIG - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea($area) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Config\ScopeInterface') ->setCurrentScope($area); 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 1cc5cbfe1b0..158eba67b8c 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php @@ -37,19 +37,14 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity * @param string $file */ function ($application, $file) { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - $application - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\DesignInterface' - )->setDefaultDesignTheme(); - $result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\FileSystem' - )->getViewFile( - $file - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea($application); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\View\DesignInterface') + ->setDefaultDesignTheme(); + $result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\View\FileSystem') + ->getViewFile($file); $this->assertFileExists($result); }, $this->viewFilesFromModulesViewDataProvider() diff --git a/dev/tests/integration/testsuite/Magento/Translate/InlineTest.php b/dev/tests/integration/testsuite/Magento/Translate/InlineTest.php index 78de4a3d734..5b542f6c507 100644 --- a/dev/tests/integration/testsuite/Magento/Translate/InlineTest.php +++ b/dev/tests/integration/testsuite/Magento/Translate/InlineTest.php @@ -35,6 +35,11 @@ class InlineTest extends \PHPUnit_Framework_TestCase */ protected $_storeId = 'default'; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $state; + public static function setUpBeforeClass() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); @@ -50,6 +55,9 @@ class InlineTest extends \PHPUnit_Framework_TestCase $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Translate\Inline' ); + $this->state = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\Translate\Inline\StateInterface' + ); /* Called getConfig as workaround for setConfig bug */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Core\Model\StoreManagerInterface' @@ -81,7 +89,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase ) ) ); - $this->_model->disable(); + $this->state->suspend(); $this->assertFalse($this->_model->isAllowed()); $this->assertFalse($this->_model->isAllowed($this->_storeId)); $this->assertFalse( diff --git a/dev/tests/integration/testsuite/Magento/Translate/_files/_inline_page_expected.html b/dev/tests/integration/testsuite/Magento/Translate/_files/_inline_page_expected.html index 979aa22786d..a031b1ee322 100644 --- a/dev/tests/integration/testsuite/Magento/Translate/_files/_inline_page_expected.html +++ b/dev/tests/integration/testsuite/Magento/Translate/_files/_inline_page_expected.html @@ -43,7 +43,7 @@ (function($){ $(document).ready(function() { $(this).translateInline({ - ajaxUrl: 'http://localhost/index.php/core/ajax/translate/', + ajaxUrl: 'http://localhost/index.php/translation/ajax/index/', area: 'frontend', editTrigger: {img: 'http://localhost/pub/media/theme/static/frontend/{{design_package}}/default/en_US/Magento_Core/fam_book_open.png'} }); diff --git a/dev/tests/integration/testsuite/Magento/TranslateTest.php b/dev/tests/integration/testsuite/Magento/TranslateTest.php index 7f066d9f7aa..0ad27a46c0c 100644 --- a/dev/tests/integration/testsuite/Magento/TranslateTest.php +++ b/dev/tests/integration/testsuite/Magento/TranslateTest.php @@ -48,18 +48,6 @@ class TranslateTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $pathChunks = array( - __DIR__, - 'Core', - 'Model', - '_files', - 'design', - 'frontend', - 'test_default', - 'i18n', - 'en_US.csv' - ); - $this->_viewFileSystem = $this->getMock( 'Magento\View\FileSystem', array('getFilename', 'getDesignTheme'), @@ -68,13 +56,12 @@ class TranslateTest extends \PHPUnit_Framework_TestCase false ); - $this->_viewFileSystem->expects( - $this->any() - )->method( - 'getFilename' - )->will( - $this->returnValue(implode('/', $pathChunks)) - ); + $this->_viewFileSystem->expects($this->any()) + ->method( + 'getFilename' + )->will( + $this->returnValue(__DIR__ . '/Core/Model/_files/design/frontend/test_default/i18n/en_US.csv') + ); $theme = $this->getMock('\Magento\View\Design\ThemeInterface', array()); $theme->expects($this->any())->method('getId')->will($this->returnValue(10)); @@ -110,37 +97,38 @@ class TranslateTest extends \PHPUnit_Framework_TestCase $objectManager->addSharedInstance($this->_designModel, 'Magento\Core\Model\View\Design\Proxy'); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Translate'); - $this->_model->init(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $objectManager->addSharedInstance($this->_model, 'Magento\Translate'); + $objectManager->removeSharedInstance('Magento\Phrase\Renderer\Composite'); + $objectManager->removeSharedInstance('Magento\Phrase\Renderer\Translate'); + \Magento\Phrase::setRenderer($objectManager->get('Magento\Phrase\RendererInterface')); + $this->_model->loadData(\Magento\Core\Model\App\Area::AREA_FRONTEND); } /** - * @magentoDataFixture Magento/Core/_files/db_translate.php + * @magentoDataFixture Magento/Translation/_files/db_translate.php * @magentoDataFixture Magento/Backend/controllers/_files/cache/all_types_enabled.php * @covers \Magento\Backend\Model\Resource\Translate::_getStoreId * @covers \Magento\Backend\Model\Resource\Translate\String::_getStoreId */ - public function testInitCaching() + public function testLoadDataCaching() { - // ensure string translation is cached - $this->_model->init(\Magento\Core\Model\App\Area::AREA_FRONTEND, null); - - /** @var \Magento\Core\Model\Resource\Translate\String $translateString */ + /** @var \Magento\Translation\Model\Resource\String $translateString */ $translateString = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Translate\String' + 'Magento\Translation\Model\Resource\String' ); $translateString->saveTranslate('Fixture String', 'New Db Translation'); - $this->_model->init(\Magento\Core\Model\App\Area::AREA_FRONTEND, null); + $this->_model->loadData(\Magento\Core\Model\App\Area::AREA_FRONTEND); $this->assertEquals( - 'Fixture Db Translation', - $this->_model->translate(array('Fixture String')), + 'Fixture Db Translation', + __('Fixture String'), 'Translation is expected to be cached' ); - $this->_model->init(\Magento\Core\Model\App\Area::AREA_FRONTEND, null, true); + $this->_model->loadData(\Magento\Core\Model\App\Area::AREA_FRONTEND, true); $this->assertEquals( - 'New Db Translation', - $this->_model->translate(array('Fixture String')), + 'New Db Translation', + __('Fixture String'), 'Forced load should not use cache' ); } @@ -151,10 +139,7 @@ class TranslateTest extends \PHPUnit_Framework_TestCase */ public function testTranslate($inputText, $expectedTranslation) { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Translate'); - $this->_model->init(\Magento\Core\Model\App\Area::AREA_FRONTEND); - - $actualTranslation = $this->_model->translate(array($inputText)); + $actualTranslation = __($inputText); $this->assertEquals($expectedTranslation, $actualTranslation); } @@ -170,11 +155,4 @@ class TranslateTest extends \PHPUnit_Framework_TestCase array('Design value to translate', 'Design translated value') ); } - - public function testGetSetTranslateInline() - { - $this->assertEquals(true, $this->_model->getTranslateInline()); - $this->_model->setTranslateInline(false); - $this->assertEquals(false, $this->_model->getTranslateInline()); - } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Controller/AjaxTest.php b/dev/tests/integration/testsuite/Magento/Translation/Controller/AjaxTest.php similarity index 79% rename from dev/tests/integration/testsuite/Magento/Core/Controller/AjaxTest.php rename to dev/tests/integration/testsuite/Magento/Translation/Controller/AjaxTest.php index 17fa32f5b27..385dc44315e 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Controller/AjaxTest.php +++ b/dev/tests/integration/testsuite/Magento/Translation/Controller/AjaxTest.php @@ -18,27 +18,25 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Controller; + +namespace Magento\Translation\Controller; class AjaxTest extends \Magento\TestFramework\TestCase\AbstractController { /** - * @dataProvider translateActionDataProvider + * @dataProvider indexActionDataProvider */ - public function testTranslateAction($postData) + public function testIndexAction($postData) { $this->getRequest()->setPost('translate', $postData); - $this->dispatch('core/ajax/translate'); + $this->dispatch('translation/ajax/index'); $this->assertEquals('{success:true}', $this->getResponse()->getBody()); } - public function translateActionDataProvider() + public function indexActionDataProvider() { return array(array('test'), array(array('test'))); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineParserTest.php b/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php similarity index 91% rename from dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineParserTest.php rename to dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php index dab5c946478..5211f3c32c7 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineParserTest.php +++ b/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php @@ -18,18 +18,16 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Translate; + +namespace Magento\Translation\Model; class InlineParserTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Translate\Inline\Parser + * @var \Magento\Translation\Model\Inline\Parser */ protected $_inlineParser; @@ -48,9 +46,10 @@ class InlineParserTest extends \PHPUnit_Framework_TestCase protected function setUp() { /** @var $inline \Magento\Translate\Inline */ - $inline = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Translate\Inline'); + $inline = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Translate\Inline'); $this->_inlineParser = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Translate\Inline\Parser', + 'Magento\Translation\Model\Inline\Parser', array('translateInline' => $inline) ); /* Called getConfig as workaround for setConfig bug */ @@ -83,7 +82,7 @@ class InlineParserTest extends \PHPUnit_Framework_TestCase $this->_inlineParser->processAjaxPost($inputArray); $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Translate\String' + 'Magento\Translation\Model\String' ); $model->load($originalText); try { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/StringTest.php b/dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php similarity index 81% rename from dev/tests/integration/testsuite/Magento/Core/Model/Translate/StringTest.php rename to dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php index a8c7d53497f..1703515679b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/StringTest.php +++ b/dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php @@ -18,31 +18,29 @@ * 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 integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Translate; + +namespace Magento\Translation\Model; class StringTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Translate\String + * @var \Magento\Translation\Model\String */ protected $_model; protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Translate\String' + 'Magento\Translation\Model\String' ); } public function testConstructor() { - $this->assertInstanceOf('Magento\Core\Model\Resource\Translate\String', $this->_model->getResource()); + $this->assertInstanceOf('Magento\Translation\Model\Resource\String', $this->_model->getResource()); } public function testSetGetString() diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/db_translate.php b/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate.php similarity index 89% rename from dev/tests/integration/testsuite/Magento/Core/_files/db_translate.php rename to dev/tests/integration/testsuite/Magento/Translation/_files/db_translate.php index f8a7fd6458e..97239d9ff2a 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/db_translate.php +++ b/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate.php @@ -22,8 +22,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var \Magento\Core\Model\Resource\Translate\String $translateString */ +/** @var \Magento\Translation\Model\Resource\String $translateString */ $translateString = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Translate\String' + 'Magento\Translation\Model\Resource\String' ); $translateString->saveTranslate('Fixture String', 'Fixture Db Translation'); diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/db_translate_admin_store.php b/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate_admin_store.php similarity index 84% rename from dev/tests/integration/testsuite/Magento/Core/_files/db_translate_admin_store.php rename to dev/tests/integration/testsuite/Magento/Translation/_files/db_translate_admin_store.php index 8007a6d4776..51ef0a7601d 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/db_translate_admin_store.php +++ b/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate_admin_store.php @@ -23,13 +23,14 @@ */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + 'Magento\App\AreaList' +)->getArea( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE +)->load( \Magento\Core\Model\App\Area::PART_CONFIG ); -/** @var \Magento\Core\Model\Resource\Translate\String $translateString */ +/** @var \Magento\Translation\Model\Resource\String $translateString */ $translateString = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Translate\String' + 'Magento\Translation\Model\Resource\String' ); $translateString->saveTranslate('string to translate', 'predefined string translation', null); diff --git a/dev/tests/integration/testsuite/Magento/UrlTest.php b/dev/tests/integration/testsuite/Magento/UrlTest.php index c6a2dcd2956..ea0b91fd9b6 100644 --- a/dev/tests/integration/testsuite/Magento/UrlTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlTest.php @@ -102,15 +102,14 @@ class UrlTest extends \PHPUnit_Framework_TestCase public function testGetBaseUrlWithTypeRestoring() { /** - * Get base ull with default type + * Get base URL with default type */ $this->assertEquals('http://localhost/index.php/', $this->_model->getBaseUrl(), 'Incorrect link url'); /** * Set specified type */ - $this->_model->setType(\Magento\UrlInterface::URL_TYPE_WEB); - $webUrl = $this->_model->getBaseUrl(); + $webUrl = $this->_model->getBaseUrl(['_type' => \Magento\UrlInterface::URL_TYPE_WEB]); $this->assertEquals('http://localhost/', $webUrl, 'Incorrect web url'); $this->assertEquals('http://localhost/index.php/', $this->_model->getBaseUrl(), 'Incorrect link url'); diff --git a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php index b1a03217d44..7c7254b3f6e 100644 --- a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php @@ -184,10 +184,8 @@ class UserTest extends \PHPUnit_Framework_TestCase public function testGetCollection() { - $this->assertInstanceOf( - 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection', - $this->_model->getCollection() - ); + $this->assertInstanceOf('Magento\Model\Resource\Db\Collection\AbstractCollection', + $this->_model->getCollection()); } public function testGetName() @@ -313,7 +311,7 @@ class UserTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage User Name is a required field. * @expectedExceptionMessage First Name is a required field. * @expectedExceptionMessage Last Name is a required field. @@ -363,7 +361,7 @@ class UserTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Your password confirmation must match your password. * @magentoDbIsolation enabled */ @@ -375,7 +373,7 @@ class UserTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Your password must include both numeric and alphabetic characters. * @magentoDbIsolation enabled */ @@ -387,7 +385,7 @@ class UserTest extends \PHPUnit_Framework_TestCase /** * @dataProvider beforeSavePasswordInsecureDataProvider - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Your password must include both numeric and alphabetic characters. * @magentoDbIsolation enabled * @param string $password @@ -404,7 +402,7 @@ class UserTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage A user with the same user name or email already exists. * @magentoDbIsolation enabled */ diff --git a/dev/tests/integration/testsuite/Magento/User/_files/dummy_user.php b/dev/tests/integration/testsuite/Magento/User/_files/dummy_user.php index 25980f5aca0..0c3b7f65e03 100644 --- a/dev/tests/integration/testsuite/Magento/User/_files/dummy_user.php +++ b/dev/tests/integration/testsuite/Magento/User/_files/dummy_user.php @@ -28,11 +28,9 @@ /** * Create dummy user */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE -); + +\Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\User\Model\User'); $user->setFirstname( 'Dummy' @@ -47,11 +45,8 @@ $user->setFirstname( )->save(); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE -); +\Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\User\Model\User'); $user->setFirstname( 'CreateDate' diff --git a/dev/tests/integration/testsuite/Magento/View/Design/Theme/ValidatorTest.php b/dev/tests/integration/testsuite/Magento/View/Design/Theme/ValidatorTest.php index ecd6c253aa6..7cf081f70b4 100644 --- a/dev/tests/integration/testsuite/Magento/View/Design/Theme/ValidatorTest.php +++ b/dev/tests/integration/testsuite/Magento/View/Design/Theme/ValidatorTest.php @@ -67,7 +67,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase /** * Get theme model * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _getThemeModel() { diff --git a/dev/tests/integration/testsuite/Magento/View/PublicationTest.php b/dev/tests/integration/testsuite/Magento/View/PublicationTest.php index d9bea1241e3..6713a818d90 100644 --- a/dev/tests/integration/testsuite/Magento/View/PublicationTest.php +++ b/dev/tests/integration/testsuite/Magento/View/PublicationTest.php @@ -358,7 +358,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase ) ); - $objectManager->get('Magento\Core\Model\App')->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $this->viewUrl->getViewFileUrl($cssViewFile, $designParams); @@ -643,12 +644,9 @@ class PublicationTest extends \PHPUnit_Framework_TestCase ) ) ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->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()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); /** @var $themeCollection \Magento\Core\Model\Theme\Collection */ $themeCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 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 6f40f04a19c..707147d3a09 100644 --- a/dev/tests/integration/testsuite/Magento/View/_files/design/themes.php +++ b/dev/tests/integration/testsuite/Magento/View/_files/design/themes.php @@ -24,15 +24,14 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->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('preferences' => array('Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data')) -); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->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' diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php index 8a08c250006..03e3128ec5e 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php @@ -69,11 +69,8 @@ class WidgetTest extends \PHPUnit_Framework_TestCase ' "new_products" widget in Catalog module' ); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $objectManager->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $objectManager->get('Magento\View\DesignInterface')->setDesignTheme('magento_backend'); $expectedFilePath = "/adminhtml/magento_backend/en_US/{$expectedFile}"; $expectedPubFile = $objectManager->get( diff --git a/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php b/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php index 4e456f4493a..34815b00ba9 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php +++ b/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php @@ -24,12 +24,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->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()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Theme\Registration' diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php index 3a50eb01377..eee2825692a 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php @@ -37,19 +37,9 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->_block = $this->getMockForAbstractClass( - 'Magento\Wishlist\Block\AbstractBlock', + 'Magento\Wishlist\Block\AbstractBlock', array( - $objectManager->get('Magento\View\Element\Template\Context'), - $objectManager->get('Magento\Catalog\Model\Config'), - $objectManager->get('Magento\Registry'), - $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\Catalog\Block\Product\Context'), $objectManager->get('Magento\App\Http\Context'), $objectManager->get('Magento\Catalog\Model\ProductFactory'), ) @@ -62,17 +52,12 @@ class AbstractTest extends \PHPUnit_Framework_TestCase */ public function testImage() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\DesignInterface' - )->setDefaultDesignTheme(); - $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Product' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') + ->setDefaultDesignTheme(); + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); $product->load(1); $size = $this->_block->getImageSize(); diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist.php b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist.php index 3b030637ca0..4051cf223e6 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist.php @@ -29,7 +29,7 @@ require __DIR__ . '/../../../Magento/Customer/_files/customer.php'; require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php'; $wishlist = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Wishlist\Model\Wishlist'); -$wishlist->loadByCustomer($customer->getId(), true); +$wishlist->loadByCustomerId($customer->getId(), true); $item = $wishlist->addNewItem($product, new \Magento\Object(array())); // 'product' => '1', // 'related_product' => '', diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_increments.php b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_increments.php index 15820eb08e3..8ad43321ad9 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_increments.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_increments.php @@ -37,6 +37,6 @@ $product->setStockData(array('enable_qty_increments' => 1, 'qty_increments' => 5 /** @var \Magento\Wishlist\Model\Wishlist $wishlist */ $wishlist = $objectManager->create('Magento\Wishlist\Model\Wishlist'); -$wishlist->loadByCustomer($customer->getId(), true); +$wishlist->loadByCustomerId($customer->getId(), true); $wishlist->addNewItem($product); $wishlist->save(); diff --git a/dev/tests/performance/framework/Magento/TestFramework/Application.php b/dev/tests/performance/framework/Magento/TestFramework/Application.php index d47b31f0d39..1485f253566 100644 --- a/dev/tests/performance/framework/Magento/TestFramework/Application.php +++ b/dev/tests/performance/framework/Magento/TestFramework/Application.php @@ -43,13 +43,6 @@ class Application */ protected $_config; - /** - * Application object - * - * @var \Magento\Core\Model\App - */ - protected $_application; - /** * Path to shell installer script * @@ -211,8 +204,6 @@ class Application */ protected function _bootstrap() { - /** @var $app \Magento\Core\Model\App */ - $this->_application = $this->getObjectManager()->get('Magento\Core\Model\App'); $this->getObjectManager()->configure( $this->getObjectManager()->get('Magento\App\ObjectManager\ConfigLoader')->load(self::AREA_CODE) ); diff --git a/dev/tests/performance/testsuite/home_page.jmx b/dev/tests/performance/testsuite/home_page.jmx index eb502c8233e..1c3a9155c3e 100644 --- a/dev/tests/performance/testsuite/home_page.jmx +++ b/dev/tests/performance/testsuite/home_page.jmx @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<jmeterTestPlan version="1.2" properties="2.1"> +<jmeterTestPlan version="1.2" properties="2.5" jmeter="2.10 r1533061"> <hashTree> <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true"> <stringProp name="TestPlan.comments"></stringProp> @@ -63,7 +63,7 @@ <stringProp name="ThreadGroup.delay"></stringProp> </ThreadGroup> <hashTree> - <HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" testname="Home Page" enabled="true"> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Home Page" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> <collectionProp name="Arguments.arguments"/> </elementProp> @@ -79,14 +79,15 @@ <boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> <boolProp name="HTTPSampler.monitor">false</boolProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp> - </HTTPSampler> + </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> <collectionProp name="Asserion.test_strings"> <stringProp name="571386695"><title>Home page</title></stringProp> - <stringProp name="-769309143"><h2>Home Page</h2></stringProp> + <stringProp name="1747020609"><h1 class="title"><span class="base" data-ui-id="page-title" >Home Page</span></h1></stringProp> </collectionProp> <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> <boolProp name="Assertion.assume_success">false</boolProp> 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 09c097335f2..2796e1b0d7f 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 @@ -62,7 +62,6 @@ lib/Magento/App/Module/ResourceResolver.php lib/Magento/Event/Invoker/InvokerDefault.php lib/Magento/Phrase/Renderer/Translate.php lib/Magento/Backup/Snapshot.php -lib/Magento/Outbound/Authentication/Hmac.php lib/Magento/Oauth/Exception.php lib/Magento/App/Helper/AbstractHelper.php diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt index c62d65bccd5..b8dc7df5844 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt @@ -16,8 +16,8 @@ \Magento\Core\Model\Config\FileResolver \Magento\Core\Model\Config\Cache \Magento\Core\Model\Config\Base -\Magento\Core\Model\Translate\String -\Magento\Core\Model\Translate\Inline\Config -\Magento\Core\Model\Translate\Inline\Parser +\Magento\Translation\Model\String +\Magento\Translation\Model\Inline\Config +\Magento\Translation\Model\Inline\Parser \Magento\Translate \Magento\Email\Model\Template diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php index 1ad2e08bf7d..de6e42f208e 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php @@ -332,6 +332,7 @@ return array( 'tax_class' => 'Magento_Tax', 'tax_order_aggregated_created' => 'Magento_Tax', 'tax_order_aggregated_updated' => 'Magento_Tax', + 'translation' => 'Magento_Translation', 'weee_discount' => 'Magento_Weee', 'weee_tax' => 'Magento_Weee', 'widget' => 'Magento_Widget', 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 e8f9d288269..1766f231afb 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 @@ -793,9 +793,26 @@ return array( array('Mage_Core_Model_Config_System'), array('Mage_Core_Model_Design_Source_Apply'), array('Mage_Core_Model_Language'), + array('Magento\Core\Model\Flag', 'Magento\Flag'), + array('Magento\Core\Exception', 'Magento\Model\Exception'), + array('Magento\Core\Model\AbstractModel', 'Magento\Model\AbstractModel'), array('Magento\Core\Model\Email\Info', 'Magento\Mail\MessageInterface'), array('Magento\Core\Model\Email\Sender', 'Magento\Mail\Template\TransportBuilder'), array('Magento\Core\Model\Email\Template\Mailer', 'Magento\Mail\Template\TransportBuilder'), + array('Magento\Core\Model\Resource\AbstractResource', 'Magento\Model\Resource\AbstractResource'), + array('Magento\Core\Model\Resource\Db\AbstractDb', 'Magento\Model\Resource\Db\AbstractDb'), + array('Magento\Core\Model\Resource\Db\Profiler', 'Magento\Model\Resource\Db\Profiler'), + array('Magento\Core\Model\Resource\Entity\AbstractEntity', 'Magento\Model\Resource\Entity\AbstractEntity'), + array('Magento\Core\Model\Resource\Entity\Table', 'Magento\Model\Resource\Entity\Table'), + array('Magento\Core\Model\Resource\Flag', 'Magento\Flag\Resource'), + array('Magento\Core\Model\Resource\Iterator', 'Magento\Model\Resource\Iterator'), + array('Magento\Core\Model\Resource\Type\AbstractType', 'Magento\Model\Resource\Type\AbstractType'), + array('Magento\Core\Model\Resource\Type\Db', 'Magento\Model\Resource\Type\Db'), + array('Magento\Core\Model\Resource\Type\Db\Pdo\Mysql', 'Magento\Model\Resource\Type\Db\Pdo\Mysql'), + array( + 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection', + 'Magento\Model\Resource\Db\Collection\AbstractCollection' + ), array('Magento\Email\Model\Info', 'Magento\Mail\MessageInterface'), array('Magento\Email\Model\Sender', 'Magento\Mail\Template\TransportBuilder'), array('Magento\Email\Model\Template\Mailer', 'Magento\Mail\Template\TransportBuilder'), @@ -1260,7 +1277,12 @@ return array( ), array('Magento\Sales\Model\ResourceFactory'), array('Magento\Sales\Model\Resource\Helper\Mysql4', 'Magento\Sales\Model\Resource\Helper'), - array('Magento\Core\Model\Resource\Helper\Mysql4', 'Magento\Core\Model\Resource\Helper'), + array('Magento\Core\Model\Resource\Helper\Mysql4', 'Magento\DB\Helper'), + array('Magento\Core\Model\Resource\Helper', 'Magento\DB\Helper'), + array('Magento\Core\Model\Resource\Helper\AbstractHelper', 'Magento\DB\Helper\AbstractHelper'), + array('Magento\Core\Model\Resource\HelperFactory'), + array('Magento\Core\Model\Resource\HelperPool'), + array('Magento\Core\Model\Resource\Transaction', 'Magento\DB\Transaction'), array('Magento\Catalog\Model\Resource\Helper\Mysql4', 'Magento\Catalog\Model\Resource\Helper'), array('Magento\Eav\Model\Resource\Helper\Mysql4', 'Magento\Eav\Model\Resource\Helper'), array( @@ -1320,6 +1342,7 @@ return array( array('Magento\Core\Model\ModuleListInterface'), array('Magento\Core\Model\RouterList'), array('Magento\Core\Model\App\State'), + array('Magento\Core\Model\App'), array('Magento\Core\Model\Event\Config\Converter'), array('Magento\Core\Model\Event\Config\Data'), array('Magento\Core\Model\Event\Config\Reader'), @@ -2103,5 +2126,43 @@ return array( array('Magento\Catalog\Helper\Product\Url', 'Magento\Filter\Translit'), array('Magento\Catalog\Model\Product\Indexer\Price'), array('Magento\Catalog\Model\Resource\Product\Indexer\Price'), - array('Magento\Indexer\Model\Processor\CacheInvalidate', 'Magento\Indexer\Model\Processor\InvalidateCache') + ['Magento\PubSub'], // unused library code which was removed + ['Magento\Outbound'], // unused library code which was removed + array('Magento\Indexer\Model\Processor\CacheInvalidate', 'Magento\Indexer\Model\Processor\InvalidateCache'), + array( + 'Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Reviews', + 'Magento\Review\Block\Adminhtml\Product\Edit\Tab\Reviews' + ), + array( + 'Magento\Catalog\Controller\Adminhtml\Product\Review', + 'Magento\Review\Controller\Adminhtml\Product' + ), + array( + 'Magento\Review\Block\Helper', + 'Magento\Review\Block\Product\ReviewRenderer' + ), + array( + 'Magento\LauncherInterface', + 'Magento\AppInterface', + ), + array('Magento\Convert\ConvertException'), + array('Magento\Convert\Container\AbstractContainer'), + array('Magento\Convert\Mapper\Column'), + array('Magento\Convert\Mapper\MapperInterface'), + ['Magento\Core\Controller\Ajax', 'Magento\Translation\Controller\Ajax'], + ['Magento\Core\Helper\Translate', 'Magento\Translation\Helper\Data'], + ['Magento\Core\Model\Translate\Inline\Config', 'Magento\Translation\Model\Inline\Config'], + ['Magento\Core\Model\Translate\Inline\Parser', 'Magento\Translation\Model\Inline\Parser'], + ['Magento\Core\Model\Resource\Translate\String', 'Magento\Translation\Model\Resource\String'], + ['Magento\Core\Model\Resource\Translate', 'Magento\Translation\Model\Resource\Translate'], + ['Magento\Core\Model\Translate\String', 'Magento\Translation\Model\String'], + ['Magento\Translation\Helper\Data'], + ['Magento\Translate\Factory'], + ['Magento\Backend\Model\Translate'], + ['Magento\Backend\Model\Resource\Translate'], + ['Magento\Backend\Model\Resource\Translate\String'], + ['Magento\DesignEditor\Model\Translate\InlineVde', 'Magento\DesignEditor\Model\Translate\Inline'], + ['Magento\Backend\Model\Translate\Inline'], + ['Magento\Backend\Model\Translate\Inline\ConfigFactory'], + ['Magento\Translate\Inline\ConfigFactory'], ); 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 b2fbea66092..bddf1b0120c 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 @@ -34,7 +34,7 @@ return array( array('CACHE_TAG', 'Magento\AppInterface'), array( 'CACHE_TAG', - 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection', + 'Magento\Model\Resource\Db\Collection\AbstractCollection', 'Magento_Core_Model_Cache_Type_Collection::CACHE_TAG' ), array('CACHE_TAG', 'Magento\Translate', 'Magento_Core_Model_Cache_Type_Translate::CACHE_TAG'), @@ -70,7 +70,6 @@ return array( 'Magento_Core_Model_Config_Resource::DEFAULT_WRITE_CONNECTION' ), array('DEFAULT_CURRENCY', 'Magento\Locale', 'Magento_Core_Model_LocaleInterface::DEFAULT_CURRENCY'), - array('DEFAULT_ERROR_HANDLER', 'Magento\Core\Model\App'), array('DEFAULT_READ_CONNECTION', 'Magento\App\Resource\Config'), array('DEFAULT_WRITE_CONNECTION', 'Magento\App\Resource\Config'), array('DEFAULT_ERROR_HANDLER', 'Mage'), @@ -593,5 +592,11 @@ return array( 'XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY', '\Magento\Catalog\Helper\Category\Flat', '\Magento\Catalog\Model\Indexer\Category\Flat\Config::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY' - ) + ), + array('CSV_SEPARATOR', 'Magento\Translate'), + array('SCOPE_SEPARATOR', 'Magento\Translate'), + array('CONFIG_KEY_AREA', 'Magento\Translate'), + array('CONFIG_KEY_LOCALE', 'Magento\Translate'), + array('CONFIG_KEY_SCOPE', 'Magento\Translate'), + array('CONFIG_KEY_DESIGN_THEME', 'Magento\Translate'), ); 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 93d322e683d..762f6fc6c6c 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 @@ -32,7 +32,7 @@ return array( array('_addLink', 'Magento\Customer\Block\Account\Link'), array('_addMinimalPrice', 'Magento\Catalog\Model\Resource\Product\Collection'), array('_addTaxPercents', 'Magento\Catalog\Model\Resource\Product\Collection'), - array('_afterSaveCommit', 'Magento\Core\Model\AbstractModel'), + array('_afterSaveCommit', 'Magento\Model\AbstractModel'), array('_afterSetConfig', 'Magento\Eav\Model\Entity\AbstractEntity'), array('_aggregateByOrderCreatedAt', 'Magento\SalesRule\Model\Resource\Report\Rule'), array('_amountByCookies', 'Magento\Sendfriend\Model\Sendfriend'), @@ -51,8 +51,6 @@ return array( array('_canShowField', 'Magento\Backend\Block\System\Config\Form'), array('_canUseCacheForInit', 'Magento\Core\Model\Config'), array('_canUseLocalModules'), - array('_checkCookieStore', 'Magento\Core\Model\App'), - array('_checkGetStore', 'Magento\Core\Model\App'), array('_checkUrlSettings', 'Magento\Backend\Controller\Adminhtml\Action'), array('_collectOrigData', 'Magento\Catalog\Model\Resource\AbstractResource'), array('_decodeInput', 'Magento\Catalog\Controller\Adminhtml\Product'), @@ -69,10 +67,8 @@ return array( array('_getAttributeFilterBlockName', 'Magento\CatalogSearch\Block\Layer'), array('_getAvailable', 'Magento\GiftMessage\Model\Observer'), array('_getBytesIniValue', 'Magento\Catalog\Model\Product\Option\Type\File'), - array('_getCacheId', 'Magento\Core\Model\App'), array('_getCacheKey', 'Magento\Catalog\Model\Layer\Filter\Price'), array('_getCacheLockId', 'Magento\Core\Model\Config'), - array('_getCacheTags', 'Magento\Core\Model\App'), array('_getCarrier', 'Magento\Shipping\Model\Config', 'Magento\Shipping\Model\CarrierFactory::create||get'), array('_getChildHtml'), array('_getConfig', 'Magento\Theme\Helper\Layout'), @@ -112,24 +108,15 @@ return array( 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'), - array('_getStoreByWebsite', 'Magento\Core\Model\App'), array('_getStoreTaxRequest', 'Magento\Tax\Model\Sales\Total\Quote\Shipping'), array('_getUploadMaxFilesize', 'Magento\Catalog\Model\Product\Option\Type\File'), array('_hookQueries', 'Magento\Core\Model\Resource\Setup'), array('_importAddress', 'Magento\Paypal\Model\Api\Nvp'), array('_inheritDesign', 'Magento\Catalog\Model\Design'), - array('_initBaseConfig', 'Magento\Core\Model\App'), - array('_initCache', 'Magento\Core\Model\App'), - array('_initCurrentStore', 'Magento\Core\Model\App'), - array('_initFileSystem', 'Magento\Core\Model\App'), array('_initLayoutMessages', 'Magento\App\Action\Action'), - array('_initLogger', 'Magento\Core\Model\App'), - array('_initModules', 'Magento\Core\Model\App'), array('_initModulesPreNamespaces', 'Magento\Core\Model\Config'), array('_initOrder', 'Magento\Shipping\Block\Tracking\Popup'), array('_initShipment', 'Magento\Shipping\Block\Tracking\Popup'), - array('_initStores', 'Magento\Core\Model\App'), array('_inludeControllerClass', '', '_includeControllerClass'), array('_isApplyDesign', 'Magento\Catalog\Model\Design'), array('_isApplyFor', 'Magento\Catalog\Model\Design'), @@ -186,7 +173,6 @@ return array( array('isInStore', 'Magento\Customer\Model\Customer'), array('_sendUploadResponse', 'Magento\Newsletter\Controller\Adminhtml\Subscriber'), array('_setAttribteValue'), - array('_shouldSkipProcessUpdates', 'Magento\Core\Model\App'), array('_sort', 'Magento\Backend\Model\Config\Structure\Converter'), array( '_submitRecurringPaymentProfiles', @@ -209,6 +195,7 @@ return array( array('addConstraint', 'Magento\DB\Adapter\Pdo\Mysql'), array('addCss', 'Magento\Theme\Block\Html\Head'), array('addCssIe', 'Magento\Theme\Block\Html\Head'), + array('addCustomerData', 'Magento\Catalog\Model\Product\Item', 'setCustomerId'), array('addCustomersToAlertQueueAction'), array('addCustomerToSegments'), array('addHandle', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), @@ -270,7 +257,6 @@ return array( array('authFailed', '', '\Magento\HTTP\Authentication::setAuthenticationFailed'), array('authFrontend'), array('authValidate', '', '\Magento\HTTP\Authentication::getCredentials'), - array('baseInit', 'Magento\Core\Model\App'), array('bundlesAction', 'Magento\Catalog\Controller\Adminhtml\Product'), array('calcTaxAmount', 'Magento\Sales\Model\Quote\Item\AbstractItem'), array('callbackQueryHook', 'Magento\Core\Model\Resource\Setup'), @@ -306,7 +292,7 @@ return array( array('cloneIndexTable', 'Magento\Index\Model\Resource\AbstractResource'), array('collectRoutes', 'Magento\Backend\App\Router\DefaultRouter'), array('collectRoutes', 'Magento\Core\App\Router\Base'), - array('composeLocaleHierarchy', 'Magento\Core\Helper\Translate'), + array('composeLocaleHierarchy', 'Magento\Translation\Helper\Data'), array('convertOldTaxData', 'Magento\Tax\Model\Resource\Setup'), array('convertOldTreeToNew', 'Magento\Catalog\Model\Resource\Setup'), array('copyFieldset', 'Magento\Core\Helper\Data', 'copyFieldsetToTarget'), @@ -420,7 +406,6 @@ return array( array('getHeaderText', 'Magento_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search'), array('getHelperClassName', 'Magento\Core\Model\Config'), array('getHtmlFormat', 'Magento\Customer\Model\Address\AbstractAddress'), - array('getInitParam', 'Magento\Core\Model\App'), array( 'getInitParams', 'Magento\TestFramework\Bootstrap', @@ -558,6 +543,16 @@ return array( array('getSectionNode', 'Magento\Core\Model\Config'), array('getSecure', 'Magento\Backend\Model\UrlInterface', 'isSecure'), array('getSecure', 'Magento\Url', 'isSecure'), + array('_prepareSessionUrlWithParams', 'Magento\Url'), + array('_getQueryParams', 'Magento\Url'), + array('_setRouteFrontName', 'Magento\Url'), + array('setType', 'Magento\Url'), + array('purgeQueryParams', 'Magento\Url', 'Use setQueryParams([]) instead'), + array('purgeQueryParams', 'Magento\Url\QueryParamsResolver', 'Use setQueryParams([]) instead'), + array('purgeQueryParams', 'Magento\Url\QueryParamsResolverInterface', 'Use setQueryParams([]) instead'), + array('_getDefaultActionName', 'Magento\Url', 'Magento\UrlInterface::DEFAULT_ACTION_NAME'), + array('_getDefaultControllerName', 'Magento\Url', 'Magento\UrlInterface::DEFAULT_CONTROLLER_NAME'), + array('_getDefaultUrlType', 'Magento\Url', 'Magento\UrlInterface::DEFAULT_URL_TYPE'), array('getSelectionFinalPrice', 'Magento\Bundle\Model\Product\Price'), array('getShipId', 'Magento\Shipping\Block\Tracking\Popup'), array('getShippingCarrier', 'Magento\Sales\Model\Order', 'Magento\Shipping\Model\CarrierFactory::create'), @@ -619,7 +614,6 @@ return array( ), array('getUploadMaxSize', 'Magento\Backend\Block\Media\Uploader', 'Magento_File_Size::getUploadMaxSize()'), array('getUrlForReferer', 'Magento\Backend\Block\Page\Footer'), - array('getUseCacheFilename', 'Magento\Core\Model\App'), array('getValidator', 'Magento\SalesRule\Model\Observer'), array('getValidatorData', 'Magento\Core\Model\Session\AbstractSession', 'use _getSessionEnvironment method'), array('getValueTable'), @@ -645,7 +639,6 @@ return array( array('implodeStreetAddress', 'Magento\Customer\Model\Address\AbstractAddress'), array('importFromTextArray'), array('init', 'Magento\App\FrontController'), - array('init', 'Magento\Core\Model\App'), array('init', 'Magento\Core\Model\Config'), array('init', 'Magento\Webapi\Controller\Front'), array('initCache'), @@ -654,7 +647,6 @@ return array( array('initLayoutMessages', 'Magento\App\Action\Action'), 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'), array('isAbsolutePath'), array('isAdmin', 'Magento\Core\Model\Store'), @@ -664,7 +656,6 @@ return array( array('isDirectOutput', 'Magento\Core\Model\Layout'), array('isDirectOutput', 'Magento\View\LayoutInterface'), array('isFulAmountCovered'), - array('isInstalled', 'Magento\Core\Model\App'), array('isLeyeredNavigationAllowed'), array('isLocalConfigLoaded', 'Magento\Core\Model\Config'), array('isModuleEnabled', 'Magento\Core\Model\Config', 'Magento_Core_Model_ModuleManager::isEnabled'), @@ -706,7 +697,6 @@ return array( array('postDispatchSystemImportExportRun'), array('prepareAddressInfo', 'Magento\Sales\Block\Recurring\Profile\View'), array('prepareAttributesForSave', 'Magento\ImportExport\Model\Import\Entity\Product'), - array('prepareCacheId', 'Magento\Core\Model\App'), array('prepareFeesInfo', 'Magento\Sales\Block\Recurring\Profile\View'), array('prepareGoogleOptimizerScripts'), array('prepareRedirect', 'Magento\Core\Controller\Varien\Exception'), @@ -910,12 +900,9 @@ return array( array('_getUsers', 'Magento\User\Block\Role\Grid\User', 'getUsers'), array('_getGridHtml', 'Magento\User\Block\Role\Tab\Users', 'getGridHtml'), array('_getSelectedRoles', 'Magento\User\Block\User\Edit\Tab\Roles', 'getSelectedRoles'), - array('_prepareSelect', 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection'), + array('_prepareSelect', 'Magento\Model\Resource\Db\Collection\AbstractCollection'), array('_prepareSelect', 'Magento\Data\Collection\Db'), array('_createOrderFromAddress', 'Magento\Checkout\Model\Type\AbstractType'), - array('castField', 'Magento\Core\Model\Resource\Helper'), - array('getQueryUsingAnalyticFunction', 'Magento\Core\Model\Resource\Helper'), - array('limitUnion', 'Magento\Core\Model\Resource\Helper'), array('_addLoadAttributesSelectFields', 'Magento\Catalog\Model\Resource\AbstractResource'), array('attributeSelectFields', 'Magento\Catalog\Model\Resource\Helper'), array('_addLoadAttributesSelectFields', 'Magento\Eav\Model\Entity\AbstractEntity'), @@ -955,7 +942,6 @@ return array( array('_helper', 'Magento\Catalog\Model\Product\Type\AbstractType'), 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\Backend\Block\Catalog\Category\Tabs'), array('getStabilityOptions', 'Magento\Connect\Model\Extension'), array('_getSession', 'Magento\Centinel\Model\Service'), @@ -986,10 +972,6 @@ return array( array('turnOnSerializableMode', 'Magento\Backup\Model\Resource\Db', 'prepareTransactionIsolationLevel'), array('_getResourceModel', '\Magento\Webapi\Model\Source\Acl\Role', '$this->_resource'), array('_getSession', '\Magento\GiftMessage\Model\Save', '$this->_session'), - array('_initRequest', '\Magento\Core\Model\App'), - array('run', '\Magento\Core\Model\App'), - array('_initFrontController', '\Magento\Core\Model\App'), - array('_getFrontControllerByCurrentArea', '\Magento\Core\Model\App'), array('run', '\Magento\AppInterface'), array('setModuleDir', 'Magento\Module\Dir\Reader'), array('setModuleDir', 'Magento\Core\Model\Config'), @@ -1069,8 +1051,8 @@ return array( array('validateIpAddr', '\Magento\Core\Helper\Http', '\Zend_Validate_Ip::isValid'), array('getRemoteAddr', '\Magento\Core\Helper\Http', 'Magento\HTTP\PhpEnvironment\RemoteAddress::getRemoteAddress'), array('getServerAddr', '\Magento\Core\Helper\Http', 'Magento\HTTP\PhpEnvironment\ServerAddress::getServerAddress'), - array('formatDate', 'Magento\Core\Model\Resource\AbstractResource', '\Magento\Stdlib\DateTime::formatDate'), - array('mktime', 'Magento\Core\Model\Resource\AbstractResource', '\Magento\Stdlib\DateTime::toTimestamp'), + array('formatDate', 'Magento\Model\Resource\AbstractResource', '\Magento\Stdlib\DateTime::formatDate'), + array('mktime', 'Magento\Model\Resource\AbstractResource', '\Magento\Stdlib\DateTime::toTimestamp'), array('getPlainTemplateMode', '\Magento\Email\Model\Template\Filter'), array('getMessage', '\Magento\Core\Model\Session\Context', 'getMessageFactory'), array('getMessageFactory', '\Magento\Core\Model\Session\Context', 'getMessagesFactory'), @@ -1582,6 +1564,12 @@ return array( array('displayGirthValue', 'Magento\Usa\Helper\Data', 'Magento\Usps\Helper\Data::displayGirthValue'), array('reindexProductPrices', '\Magento\Catalog\Model\Observer'), array('getCustomer', 'Magento\Checkout\Block\Onepage\AbstractOnepage'), + ['_compareSortOrder', 'Magento\Sales\Model\Config\Ordered'], + [ + '_toOptionHashOptimized', + 'Magento\Data\Collection\Db', + 'Magento\Tax\Model\Resource\Calculation\Rate\Collection::toOptionHashOptimized' + ], array('getSwitchCurrencyUrl', 'Magento\Directory\Block\Currency'), array('getPageVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), array('getOrderVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), @@ -1592,5 +1580,32 @@ return array( array('getModeUrl', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), array('getLimitUrl', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), array('_getAvailableLimit', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), - array('getCacheIdTags', 'Magento\Core\Model\AbstractModel') + array('getCacheIdTags', 'Magento\Core\Model\AbstractModel'), + array('addCustomerData', 'Magento\Log\Model\Visitor'), + array('quoteSubmitAfter', 'Magento\Customer\Model\Observer'), + array('loadByCustomer', 'Magento\Wishlist\Model\Wishlist'), + ['_sessionVarCallback', 'Magento\Url', 'Replaced with inlined closure'], + array( + 'reviewsAction', + 'Magento\Catalog\Controller\Adminhtml\Product', + 'Magento\Review\Controller\Adminhtml\Product\Reviews::gridAction' + ), + ['_insertInlineScriptsHtml', 'Magento\DesignEditor\Model\Translate\Inline', 'addInlineScript'], + ['initializeTranslation', 'Magento\Backend\Model\Observer'], + ['getTranslateJson', 'Magento\Core\Helper\Js'], + ['_isEmptyTranslateArg', 'Magento\Translate'], + ['_getTranslatedString', 'Magento\Translate'], + ['initLocale', 'Magento\Translate'], + ['_prepareDataString', 'Magento\Translate'], + ['getInlineObject', 'Magento\Translate'], + ['init', 'Magento\Translate', 'loadData'], + ['disable', 'Magento\Translate\Inline'], + ['_getAjaxUrl', 'Magento\Translate\Inline', 'getAjaxUrl'], + ['_stripInlineTranslations', 'Magento\Translate\Inline', 'stripInlineTranslations'], + ['isAllowed', 'Magento\Translate'], + ['translate', 'Magento\Translate'], + ['_getStoreId', 'Magento\Translation\Model\Resource\Translate', 'getScope'], + ['_getStoreId', 'Magento\Translation\Model\Resource\String', 'getScope'], + ['getAvailableModes', 'Magento\DesignEditor\Helper\Data'], + ['initializeTranslation', 'Magento\DesignEditor\Model\Observer'], ); 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 7cc83fa2325..e0309177413 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 @@ -196,7 +196,7 @@ return array( 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('_dirs', 'Magento\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'), @@ -301,5 +301,36 @@ return array( array('_orderVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), array('_directionVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), array('_modeVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), - array('_limitVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar') + array('_limitVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), + array('_encryptedSessionId', 'Magento\Url'), + ['_tokenRegex', 'Magento\Translate\Inline'], + ['_translator', 'Magento\Translate\Inline'], + ['_appState', 'Magento\Translate\Inline'], + ['_translateInline', 'Magento\Translate'], + ['_inlineInterface', 'Magento\Translate'], + ['_translateFactory', 'Magento\Translate'], + ['_placeholderRender', 'Magento\Translate'], + ['_canUseInline', 'Magento\Translate'], + ['_eventManager', 'Magento\Translate'], + ['_inlineFactory', 'Magento\App\Helper\Context', 'translateInline'], + ['_inlineFactory', 'Magento\App\Helper\AbstractHelper', 'translateInline'], + ['_storeManager', 'Magento\Translation\Model\Resource\Translate'], + ['_storeManager', 'Magento\Translation\Model\Resource\String'], + ['_isVdeRequest', 'Magento\DesignEditor\Helper\Data'], + ['_translator', 'Magento\Phrase\Renderer\Translate', 'translator'], + ['_translator', 'Magento\Core\Model\Validator\Factory'], + ['_configFactory', 'Magento\Core\Model\App\Emulation', 'inlineConfig'], + ['_coreStoreConfig', 'Magento\Translation\Model\Inline\Config', 'config'], + ['_translate', 'Magento\Directory\Model\Observer'], + ['_translate', 'Magento\Newsletter\Model\Subscriber'], + ['_translate', 'Magento\Sendfriend\Model\Sendfriend'], + ['_translateModel', 'Magento\Sitemap\Model\Observer'], + ['_translator', 'Magento\Checkout\Helper\Data'], + ['_translate', 'Magento\GiftRegistry\Model\Entity'], + ['_translate', 'Magento\Log\Model\Cron'], + ['_translate', 'Magento\ProductAlert\Model\Observer'], + ['translate', 'Magento\Reminder\Model\Rule'], + ['_translate', 'Magento\Rma\Model\Rma'], + ['_translate', 'Magento\Rma\Model\Rma\Status\History'], + ['_translate', 'Magento\Sales\Model\Order\Pdf\AbstractPdf'], ); diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt index 2c13d976008..186e9737999 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt @@ -45,9 +45,6 @@ lib/Magento/Cache/Backend/Eaccelerator.php lib/Magento/Cache/Backend/Memcached.php lib/Magento/Cache/Core.php lib/Magento/Connect -lib/Magento/Convert/ConvertException.php -lib/Magento/Convert/Mapper/Column.php -lib/Magento/Convert/Mapper/MapperInterface.php lib/Magento/Data/Collection.php lib/Magento/Data/Collection/Db.php lib/Magento/Data/Collection/Db/FetchStrategy/Cache.php diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt index a468ec09ba3..85dc1e4ba3c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt @@ -40,9 +40,9 @@ lib/Magento/Translate/Adapter.php lib/Magento/Translate/AdapterInterface.php # WrapperInterface methods cannot be camelCase as they follow method naming convention from framework classes lib/Magento/Filesystem/WrapperInterface.php -# Newer version of phpcs does not complain about spacing issue. This appears to be a bug in the phpcs version that is currently run in bamboo. -app/code/Magento/Sales/Model/Order/Payment/Transaction.php - -# Skipped for no reason +# PSR-1 not applied to dev/tests/integration/testsuite/Magento +# PSR-1 not applied to dev/tests/unit/testsuite/Magento +# Newer version of phpcs does not complain about spacing issue. This appears to be a bug in the phpcs version that is currently run in bamboo. +app/code/Magento/Sales/Model/Order/Payment/Transaction.php diff --git a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php index 16f31eec36e..55ae9dfb685 100644 --- a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php +++ b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php @@ -93,34 +93,33 @@ class Adminhtml extends \PHPUnit_Framework_TestCase protected function setUp() { // These mocks are accessed via context - $this->_designMock = $this->_makeMock('Magento\View\DesignInterface'); - $this->_sessionMock = $this->_makeMock('Magento\Core\Model\Session'); - $this->_sidResolver = $this->_makeMock('Magento\Core\Model\Session\SidResolver'); - $this->_translatorMock = $this->_makeMock('Magento\TranslateInterface'); - $this->_layoutMock = $this->_makeMock('Magento\Core\Model\Layout'); - $this->_requestMock = $this->_makeMock('Magento\App\RequestInterface'); - $this->_messagesMock = $this->_makeMock('Magento\View\Element\Messages'); - $this->_urlMock = $this->_makeMock('Magento\UrlInterface'); - $this->_eventManagerMock = $this->_makeMock('Magento\Event\ManagerInterface'); - $this->_controllerMock = $this->_makeMock('Magento\App\FrontController'); - $this->_loggerMock = $this->_makeMock('Magento\Logger'); - $this->_filesystemMock = $this->_makeMock('Magento\App\Filesystem'); - $this->_cacheMock = $this->_makeMock('Magento\App\CacheInterface'); - $this->_storeConfigMock = $this->_makeMock('Magento\Core\Model\Store\Config'); - $this->_storeManagerMock = $this->_makeMock('Magento\Core\Model\StoreManager'); - $viewUrlMock = $this->_makeMock('Magento\View\Url'); - $viewConfigMock = $this->_makeMock('Magento\View\ConfigInterface'); - $viewFileSystemMock = $this->_makeMock('Magento\View\FileSystem'); - $templatePoolMock = $this->_makeMock('Magento\View\TemplateEnginePool'); - $authorizationMock = $this->_makeMock('Magento\AuthorizationInterface'); - $cacheStateMock = $this->_makeMock('Magento\App\Cache\StateInterface'); - $appMock = $this->_makeMock('Magento\Core\Model\App'); - $escaperMock = $this->_makeMock('Magento\Escaper'); - $filterManagerMock = $this->_makeMock('Magento\Filter\FilterManager'); - $backendSessionMock = $this->_makeMock('Magento\Backend\Model\Session'); - $appState = $this->_makeMock('Magento\App\State'); - $this->_mathMock = $this->_makeMock('Magento\Math\Random'); - $this->_formKey = $this->_makeMock('Magento\Data\Form\FormKey'); + $this->_designMock = $this->_makeMock('Magento\View\DesignInterface'); + $this->_sessionMock = $this->_makeMock('Magento\Core\Model\Session'); + $this->_sidResolver = $this->_makeMock('Magento\Core\Model\Session\SidResolver'); + $this->_translatorMock = $this->_makeMock('Magento\TranslateInterface'); + $this->_layoutMock = $this->_makeMock('Magento\Core\Model\Layout'); + $this->_requestMock = $this->_makeMock('Magento\App\RequestInterface'); + $this->_messagesMock = $this->_makeMock('Magento\View\Element\Messages'); + $this->_urlMock = $this->_makeMock('Magento\UrlInterface'); + $this->_eventManagerMock = $this->_makeMock('Magento\Event\ManagerInterface'); + $this->_controllerMock = $this->_makeMock('Magento\App\FrontController'); + $this->_loggerMock = $this->_makeMock('Magento\Logger'); + $this->_filesystemMock = $this->_makeMock('Magento\App\Filesystem'); + $this->_cacheMock = $this->_makeMock('Magento\App\CacheInterface'); + $this->_storeConfigMock = $this->_makeMock('Magento\Core\Model\Store\Config'); + $this->_storeManagerMock = $this->_makeMock('Magento\Core\Model\StoreManager'); + $viewUrlMock = $this->_makeMock('Magento\View\Url'); + $viewConfigMock = $this->_makeMock('Magento\View\ConfigInterface'); + $viewFileSystemMock = $this->_makeMock('Magento\View\FileSystem'); + $templatePoolMock = $this->_makeMock('Magento\View\TemplateEnginePool'); + $authorizationMock = $this->_makeMock('Magento\AuthorizationInterface'); + $cacheStateMock = $this->_makeMock('Magento\App\Cache\StateInterface'); + $escaperMock = $this->_makeMock('Magento\Escaper'); + $filterManagerMock = $this->_makeMock('Magento\Filter\FilterManager'); + $backendSessionMock = $this->_makeMock('Magento\Backend\Model\Session'); + $appState = $this->_makeMock('Magento\App\State'); + $this->_mathMock = $this->_makeMock('Magento\Math\Random'); + $this->_formKey = $this->_makeMock('Magento\Data\Form\FormKey'); $appState->setAreaCode(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); @@ -148,7 +147,6 @@ class Adminhtml extends \PHPUnit_Framework_TestCase $viewConfigMock, $cacheStateMock, $this->_loggerMock, - $appMock, $escaperMock, $filterManagerMock, $this->_filesystemMock, diff --git a/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php b/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php index 41595e761b9..71895ee1070 100644 --- a/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php +++ b/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php @@ -37,8 +37,8 @@ class ObjectManager * @var array */ protected $_specialCases = array( - 'Magento\Core\Model\Resource\AbstractResource' => '_getResourceModelMock', - 'Magento\TranslateInterface' => '_getTranslatorMock' + 'Magento\Model\Resource\AbstractResource' => '_getResourceModelMock', + 'Magento\TranslateInterface' => '_getTranslatorMock', ); /** 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 c314e440bf5..0f48d33875a 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 @@ -50,9 +50,9 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase * @var array */ protected $_modelDependencies = array( - 'eventManager' => 'Magento\Event\ManagerInterface', - 'cacheManager' => 'Magento\App\CacheInterface', - 'resource' => 'Magento\Core\Model\Resource\AbstractResource', + 'eventManager' => 'Magento\Event\ManagerInterface', + 'cacheManager' => 'Magento\App\CacheInterface', + 'resource' => 'Magento\Model\Resource\AbstractResource', 'resourceCollection' => 'Magento\Data\Collection\Db' ); diff --git a/dev/tests/unit/testsuite/Magento/AdminNotification/Model/NotificationServiceTest.php b/dev/tests/unit/testsuite/Magento/AdminNotification/Model/NotificationServiceTest.php index 03771fd42de..140119d4d7d 100644 --- a/dev/tests/unit/testsuite/Magento/AdminNotification/Model/NotificationServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/AdminNotification/Model/NotificationServiceTest.php @@ -79,7 +79,7 @@ class NotificationServiceTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Wrong notification ID specified. */ public function testMarkAsReadThrowsExceptionWhenNotificationIdIsInvalid() diff --git a/dev/tests/unit/testsuite/Magento/App/AreaListTest.php b/dev/tests/unit/testsuite/Magento/App/AreaListTest.php index 0233b72b3c7..1955c8bf559 100644 --- a/dev/tests/unit/testsuite/Magento/App/AreaListTest.php +++ b/dev/tests/unit/testsuite/Magento/App/AreaListTest.php @@ -35,21 +35,23 @@ class AreaListTest extends \PHPUnit_Framework_TestCase */ protected $_resolverFactory; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + protected function setUp() { - $this->_resolverFactory = $this->getMock( - '\Magento\App\Area\FrontNameResolverFactory', - array(), - array(), - '', - false - ); + $this->objectManagerMock = $this->getMock('Magento\ObjectManager'); + $this->_resolverFactory = $this + ->getMock('\Magento\App\Area\FrontNameResolverFactory', array(), array(), '', false); } public function testGetCodeByFrontNameWhenAreaDoesNotContainFrontName() { $expected = 'expectedFrontName'; $this->_model = new \Magento\App\AreaList( + $this->objectManagerMock, $this->_resolverFactory, array('testArea' => array('frontNameResolver' => 'testValue')), $expected @@ -74,8 +76,9 @@ class AreaListTest extends \PHPUnit_Framework_TestCase { $expected = 'testArea'; $this->_model = new \Magento\App\AreaList( + $this->objectManagerMock, $this->_resolverFactory, - array('testArea' => array('frontName' => 'testFrontName')), + array('testArea'=>array('frontName' => 'testFrontName')), $expected ); @@ -87,6 +90,7 @@ class AreaListTest extends \PHPUnit_Framework_TestCase { $expected = 'testFrontName'; $this->_model = new \Magento\App\AreaList( + $this->objectManagerMock, $this->_resolverFactory, array('testAreaCode' => array('frontName' => 'testFrontName')), $expected @@ -98,7 +102,7 @@ class AreaListTest extends \PHPUnit_Framework_TestCase public function testGetFrontNameWhenAreaCodeAndFrontNameArentSet() { - $this->_model = new \Magento\App\AreaList($this->_resolverFactory, array(), ''); + $this->_model = new \Magento\App\AreaList($this->objectManagerMock, $this->_resolverFactory, array(), ''); $actual = $this->_model->getFrontName('testAreaCode'); $this->assertNull($actual); @@ -107,9 +111,7 @@ class AreaListTest extends \PHPUnit_Framework_TestCase public function testGetCodes() { $this->_model = new \Magento\App\AreaList( - $this->_resolverFactory, - array('area1' => 'value1', 'area2' => 'value2'), - '' + $this->objectManagerMock, $this->_resolverFactory, array('area1' => 'value1', 'area2' => 'value2'), '' ); $expected = array(0 => 'area1', 1 => 'area2'); diff --git a/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php b/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php index 68455d27908..cf17a2030a1 100644 --- a/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php +++ b/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php @@ -66,7 +66,7 @@ class EntryPointTest extends \PHPUnit_Framework_TestCase public function testRunExecutesApplication() { $applicationName = '\Magento\App\TestApplication'; - $applicationMock = $this->getMock('\Magento\LauncherInterface'); + $applicationMock = $this->getMock('\Magento\AppInterface'); $applicationMock->expects($this->once())->method('launch')->will($this->returnValue($this->_responseMock)); $this->_objectManagerMock->expects( $this->once() @@ -84,7 +84,7 @@ class EntryPointTest extends \PHPUnit_Framework_TestCase public function testRunCatchesExceptionThrownByApplication() { $applicationName = '\Magento\App\TestApplication'; - $applicationMock = $this->getMock('\Magento\LauncherInterface'); + $applicationMock = $this->getMock('\Magento\AppInterface'); $applicationMock->expects( $this->once() )->method( diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Router/NoRouteHandlerTest.php b/dev/tests/unit/testsuite/Magento/Backend/App/Router/NoRouteHandlerTest.php similarity index 83% rename from dev/tests/unit/testsuite/Magento/Backend/Model/Router/NoRouteHandlerTest.php rename to dev/tests/unit/testsuite/Magento/Backend/App/Router/NoRouteHandlerTest.php index 208f72a8c65..b20448c0468 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Router/NoRouteHandlerTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/App/Router/NoRouteHandlerTest.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backend\Model\Router; +namespace Magento\Backend\App\Router; class NoRouteHandlerTest extends \PHPUnit_Framework_TestCase { @@ -35,6 +35,11 @@ class NoRouteHandlerTest extends \PHPUnit_Framework_TestCase */ protected $_requestMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_routeConfigMock; + /** * @var \Magento\Backend\App\Router\NoRouteHandler */ @@ -43,9 +48,10 @@ class NoRouteHandlerTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $this->_routeConfigMock = $this->getMock('\Magento\App\Route\ConfigInterface'); $this->_helperMock = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false); $this->_helperMock->expects($this->any())->method('getAreaFrontName')->will($this->returnValue('backend')); - $this->_model = new \Magento\Backend\App\Router\NoRouteHandler($this->_helperMock); + $this->_model = new \Magento\Backend\App\Router\NoRouteHandler($this->_helperMock, $this->_routeConfigMock); } /** @@ -53,13 +59,16 @@ class NoRouteHandlerTest extends \PHPUnit_Framework_TestCase */ public function testProcessWithBackendAreaFrontName() { - $this->_requestMock->expects( - $this->once() - )->method( - 'getPathInfo' - )->will( - $this->returnValue('backend/admin/custom') - ); + $this->_routeConfigMock + ->expects($this->once()) + ->method('getRouteFrontName') + ->with('adminhtml') + ->will($this->returnValue('admin')); + + $this->_requestMock + ->expects($this->once()) + ->method('getPathInfo') + ->will($this->returnValue('backend/admin/custom')); $this->_requestMock->expects( $this->once() diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php index 83003db94af..a4c37c6cd56 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php @@ -57,9 +57,6 @@ class GridTest extends \PHPUnit_Framework_TestCase $storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); - $appMock = $this->getMock('Magento\Core\Model\App', array(), array(), '', false); - $appMock->expects($this->any())->method('getStore')->will($this->returnValue($storeMock)); - $appMock->expects($this->any())->method('getDefaultStoreView')->will($this->returnValue($storeMock)); $urlBuilderMock = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false); @@ -67,13 +64,10 @@ class GridTest extends \PHPUnit_Framework_TestCase $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $block = $helper->getObject( - 'Magento\Backend\Block\Widget\Grid', - array( - 'app' => $appMock, - 'storeManager' => $storeManagerMock, - 'urlModel' => $urlMock, - 'urlBuilder' => $urlBuilderMock + $block = $helper->getObject('Magento\Backend\Block\Widget\Grid', array( + 'storeManager' => $storeManagerMock, + 'urlModel' => $urlMock, + 'urlBuilder' => $urlBuilderMock, ) ); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/AuthTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/AuthTest.php index 3f5bbee270e..2e42ecb04f0 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/AuthTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/AuthTest.php @@ -66,26 +66,17 @@ class AuthTest extends \PHPUnit_Framework_TestCase */ public function testLoginFailed() { - $this->_modelFactoryMock->expects( - $this->once() - )->method( - 'create' - )->with( - 'Magento\Backend\Model\Auth\Credential\StorageInterface' - )->will( - $this->returnValue($this->_credentialStorage) - ); - $exceptionMock = new \Magento\Core\Exception(); - $this->_credentialStorage->expects( - $this->once() - )->method( - 'login' - )->with( - 'username', - 'password' - )->will( - $this->throwException($exceptionMock) - ); + $this->_modelFactoryMock + ->expects($this->once()) + ->method('create') + ->with('Magento\Backend\Model\Auth\Credential\StorageInterface') + ->will($this->returnValue($this->_credentialStorage)); + $exceptionMock = new \Magento\Model\Exception; + $this->_credentialStorage + ->expects($this->once()) + ->method('login') + ->with('username', 'password') + ->will($this->throwException($exceptionMock)); $this->_credentialStorage->expects($this->never())->method('getId'); $this->_eventManagerMock->expects($this->once())->method('dispatch')->with('backend_auth_user_login_failed'); $this->_model->login('username', 'password'); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php index 347a6c7ef58..dbee3f484bc 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php @@ -29,10 +29,19 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase { $eventDispatcher = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $appState = $this->getMock('Magento\App\State', array(), array(), '', false); - $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); $cacheManager = $this->getMock('Magento\App\CacheInterface'); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - $context = new \Magento\Model\Context($logger, $eventDispatcher, $cacheManager, $appState, $storeManager); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); + $actionValidatorMock = $this->getMock( + 'Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false + ); + + $context = new \Magento\Model\Context( + $logger, + $eventDispatcher, + $cacheManager, + $appState, + $actionValidatorMock + ); $resource = $this->getMock('Magento\Core\Model\Resource\Config\Data', array(), array(), '', false); $resource->expects($this->any())->method('addCommitCallback')->will($this->returnValue($resource)); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php index 09eec4321d5..08b130b79ad 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php @@ -51,7 +51,7 @@ class EncryptedTest extends \PHPUnit_Framework_TestCase $this->returnValue($eventDispatcherMock) ); $this->_resourceMock = $this->getMock( - 'Magento\Core\Model\Resource\AbstractResource', + 'Magento\Model\Resource\AbstractResource', array( '_construct', '_getReadAdapter', diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php index e4fccbe8a95..0d66f30e247 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php @@ -29,10 +29,18 @@ class SecureTest extends \PHPUnit_Framework_TestCase { $eventDispatcher = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $appState = $this->getMock('Magento\App\State', array(), array(), '', false); - $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); $cacheManager = $this->getMock('Magento\App\CacheInterface'); $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - $context = new \Magento\Model\Context($logger, $eventDispatcher, $cacheManager, $appState, $storeManager); + $actionValidatorMock = $this->getMock( + '\Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false + ); + $context = new \Magento\Model\Context( + $logger, + $eventDispatcher, + $cacheManager, + $appState, + $actionValidatorMock + ); $resource = $this->getMock('Magento\Core\Model\Resource\Config\Data', array(), array(), '', false); $resource->expects($this->any())->method('addCommitCallback')->will($this->returnValue($resource)); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/GroupTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/GroupTest.php index a59914f134a..d2bfcc4d65b 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/GroupTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/GroupTest.php @@ -107,7 +107,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetCloneModelThrowsExceptionIfNoSourceModelIsSet() { diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/ConfigTest.php index 42fb7202ce2..af723b9a82b 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/ConfigTest.php @@ -94,11 +94,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ); $this->_transFactoryMock = $this->getMock( - 'Magento\Core\Model\Resource\TransactionFactory', - array('create'), - array(), - '', - false + 'Magento\DB\TransactionFactory', + array('create'), array(), '', false ); $this->_appConfigMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); $this->_configLoaderMock = $this->getMock( @@ -149,7 +146,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testSaveToCheckAdminSystemConfigChangedSectionEvent() { - $transactionMock = $this->getMock('Magento\Core\Model\Resource\Transaction', array(), array(), '', false); + $transactionMock = $this->getMock( + 'Magento\DB\Transaction', array(), array(), '', false + ); $this->_transFactoryMock->expects($this->any())->method('create')->will($this->returnValue($transactionMock)); 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 deleted file mode 100644 index 144ded3efd8..00000000000 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Translate/Inline/ConfigFactoryTest.php +++ /dev/null @@ -1,44 +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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Backend\Model\Translate\Inline; - -class ConfigFactoryTest extends \PHPUnit_Framework_TestCase -{ - public function testGet() - { - $result = 'result'; - $objectManager = $this->getMockForAbstractClass('Magento\ObjectManager'); - $objectManager->expects( - $this->once() - )->method( - 'get' - )->with( - $this->equalTo('Magento\Backend\Model\Translate\Inline\Config') - )->will( - $this->returnValue($result) - ); - $factory = new ConfigFactory($objectManager); - $this->assertEquals($result, $factory->get()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/TranslateTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/TranslateTest.php deleted file mode 100644 index fd480cefae7..00000000000 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/TranslateTest.php +++ /dev/null @@ -1,82 +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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Backend\Model; - -class TranslateTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider initDataProvider - * - * @param string $area - * @param string $expectedScope - */ - public function testInit($area, $expectedScope) - { - $localeMock = $this->getMock('\Magento\Locale\ResolverInterface'); - $appMock = $this->getMock('\Magento\AppInterface', array(), array(), '', false); - $appStateMock = $this->getMock('\Magento\App\State', array(), array(), '', false); - $appStateMock->expects($this->any())->method('getAreaCode')->will($this->returnValue($area)); - $scopeMock = $this->getMock('\Magento\BaseScopeInterface'); - $scopeResolverMock = $this->getMock('\Magento\BaseScopeResolverInterface'); - $scopeResolverMock->expects($this->once())->method('getScope')->will($this->returnValue($scopeMock)); - $themeMock = $this->getMock('\Magento\View\Design\ThemeInterface', array()); - $themeMock->expects($this->once())->method('getId')->will($this->returnValue(1)); - $designMock = $this->getMock('\Magento\View\DesignInterface'); - $designMock->expects($this->once())->method('getDesignTheme')->will($this->returnValue($themeMock)); - - $inlineMock = $this->getMock('\Magento\Translate\InlineInterface'); - $inlineMock->expects($this->at(0))->method('isAllowed')->with()->will($this->returnValue(false)); - $inlineMock->expects( - $this->at(1) - )->method( - 'isAllowed' - )->with( - $this->equalTo($expectedScope) - )->will( - $this->returnValue(true) - ); - $translateFactoryMock = $this->getMock('\Magento\Translate\Factory', array(), array(), '', false); - $translateFactoryMock->expects($this->any())->method('create')->will($this->returnValue($inlineMock)); - - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - /** @var \Magento\Backend\Model\Translate $translate */ - $translate = $helper->getObject( - 'Magento\Backend\Model\Translate', - array( - 'app' => $appMock, - 'appState' => $appStateMock, - 'scopeResolver' => $scopeResolverMock, - 'viewDesign' => $designMock, - 'translateFactory' => $translateFactoryMock, - 'localeResolver' => $localeMock - ) - ); - $translate->init(); - } - - public function initDataProvider() - { - return array(array('adminhtml', 'admin'), array('frontend', null)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php index d0d4c60e1d3..02864d14eb4 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php @@ -42,7 +42,7 @@ class RowTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Could not rebuild index for undefined product */ public function testEmptyId() diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php index 8799fe97642..37a3a3c3aaa 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php @@ -42,7 +42,7 @@ class RowsTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Bad value was supplied. */ public function testEmptyIds() diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php index 7e54bdacca4..81dba29756a 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php @@ -43,6 +43,11 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase */ protected $_indexerMock; + /** + * @var \Magento\Indexer\Model\IndexerFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_indexerFactoryMock; + /** * @var \Magento\Catalog\Model\Indexer\Product\Flat\State|\PHPUnit_Framework_MockObject_MockObject */ @@ -61,6 +66,15 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase ); $this->_indexerMock->expects($this->any())->method('getId')->will($this->returnValue(1)); + $this->_indexerFactoryMock = $this->getMock( + 'Magento\Indexer\Model\IndexerFactory', array('create'), array(), '', false + ); + + $this->_indexerFactoryMock + ->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->_indexerMock)); + $this->_stateMock = $this->getMock( 'Magento\Catalog\Model\Indexer\Product\Flat\State', array('isFlatEnabled'), @@ -68,10 +82,10 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_model = $this->_objectManager->getObject( - 'Magento\Catalog\Model\Indexer\Product\Flat\Processor', - array('indexer' => $this->_indexerMock, 'state' => $this->_stateMock) - ); + $this->_model = $this->_objectManager->getObject('Magento\Catalog\Model\Indexer\Product\Flat\Processor', array( + 'indexerFactory' => $this->_indexerFactoryMock, + 'state' => $this->_stateMock + )); } /** diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.php new file mode 100644 index 00000000000..c963cc87b30 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.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_Catalog + * @subpackage unit_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Model\Indexer\Product\Price\Plugin; + + +class CatalogRuleTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_objectManager; + + /** + * @var \Magento\Catalog\Model\Indexer\Product\Price\Plugin\CatalogRule + */ + protected $_model; + + /** + * @var \Magento\Catalog\Model\Indexer\Product\Price\Processor|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_priceProcessorMock; + + protected function setUp() + { + $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->_priceProcessorMock = $this->getMock( + 'Magento\Catalog\Model\Indexer\Product\Price\Processor', array(), array(), '', false + ); + + $this->_model = $this->_objectManager->getObject( + '\Magento\Catalog\Model\Indexer\Product\Price\Plugin\CatalogRule', + array( + 'processor' => $this->_priceProcessorMock + ) + ); + } + + public function testAfterApplyAll() + { + $this->_priceProcessorMock->expects($this->once()) + ->method('markIndexerAsInvalid'); + + $ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', array(), array(), '', false); + $this->_model->afterApplyAll($ruleMock); + } + + /** + * @param int|\Magento\Catalog\Model\Product $product + * @param int $expectedIdCall + * @dataProvider affectedProductsDataProvider + */ + public function testAroundApplyToProduct($product, $expectedIdCall) + { + $this->_priceProcessorMock->expects($this->once()) + ->method('reindexRow') + ->with($expectedIdCall); + + $ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', array(), array(), '', false); + $this->_model->aroundApplyToProduct( + $ruleMock, + function () { + + }, + $product + ); + } + + /** + * @param int|\Magento\Catalog\Model\Product $product + * @param int $expectedIdCall + * @dataProvider affectedProductsDataProvider + */ + public function testAroundApplyAllRulesToProduct($product, $expectedIdCall) + { + $this->_priceProcessorMock->expects($this->once()) + ->method('reindexRow') + ->with($expectedIdCall); + + $ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', array(), array(), '', false); + $this->_model->aroundApplyToProduct( + $ruleMock, + function () { + + }, + $product + ); + } + + /** + * @return array + */ + public function affectedProductsDataProvider() + { + $productId = 11; + $productMock = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); + $productMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue($productId)); + + return array( + array($productId, $productId), + array($productMock, $productId) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php index 7c802405dd5..ccc40806f81 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php @@ -39,7 +39,7 @@ class CustomerGroupTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Customer\Model\Resource\Group|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_subjectMock; @@ -47,7 +47,9 @@ class CustomerGroupTest extends \PHPUnit_Framework_TestCase { $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_subjectMock = $this->getMock('Magento\Customer\Model\Resource\Group', array(), array(), '', false); + $this->_subjectMock = $this->getMock( + '\Magento\Customer\Service\V1\CustomerGroupServiceInterface', array(), array(), '', false + ); $indexerMock = $this->getMock( 'Magento\Indexer\Model\Indexer', @@ -67,11 +69,11 @@ class CustomerGroupTest extends \PHPUnit_Framework_TestCase public function testAroundDelete() { - $this->assertEquals('return_value', $this->_model->afterDelete($this->_subjectMock, 'return_value')); + $this->assertEquals('return_value', $this->_model->afterDeleteGroup($this->_subjectMock, 'return_value')); } public function testAroundSave() { - $this->assertEquals('return_value', $this->_model->afterSave($this->_subjectMock, 'return_value')); + $this->assertEquals('return_value', $this->_model->afterSaveGroup($this->_subjectMock, 'return_value')); } } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/FactoryTest.php index b9141664e71..e155bce1878 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/FactoryTest.php @@ -86,7 +86,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage WrongClass doesn't extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ public function testWrongTypeException() diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FactoryTest.php index 33851f12097..65c38b3536e 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FactoryTest.php @@ -86,7 +86,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage WrongClass doesn't extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ public function testWrongTypeException() diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php index 17fb0876343..ec3727b3ce8 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php @@ -94,22 +94,29 @@ class ProductTest extends \PHPUnit_Framework_TestCase $eventManagerMock = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); + $actionValidatorMock = $this->getMock( + '\Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false + ); + $actionValidatorMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); $cacheInterfaceMock = $this->getMock('Magento\App\CacheInterface', array(), array(), '', false); $contextMock = $this->getMock( '\Magento\Model\Context', - array('getEventDispatcher', 'getCacheManager', 'getAppState'), - array(), - '', - false + array('getEventDispatcher', 'getCacheManager', 'getAppState', 'getActionValidator'), array(), '', false ); $contextMock->expects($this->any())->method('getAppState')->will($this->returnValue($stateMock)); $contextMock->expects($this->any())->method('getEventDispatcher')->will($this->returnValue($eventManagerMock)); - $contextMock->expects($this->any())->method('getCacheManager')->will($this->returnValue($cacheInterfaceMock)); + $contextMock->expects($this->any()) + ->method('getCacheManager') + ->will($this->returnValue($cacheInterfaceMock)); + + $contextMock->expects($this->any()) + ->method('getActionValidator') + ->will($this->returnValue($actionValidatorMock)); $this->_model = new \Magento\Catalog\Model\Product( $contextMock, diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php index 506f9577350..a13b5f94896 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php @@ -52,36 +52,30 @@ class AttributeTest extends \PHPUnit_Framework_TestCase $cacheInterfaceMock = $this->getMock('Magento\App\CacheInterface', array(), array(), '', false); + $actionValidatorMock = $this->getMock( + '\Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false + ); + $actionValidatorMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); + $contextMock = $this->getMock( '\Magento\Model\Context', - array('getEventDispatcher', 'getCacheManager'), - array(), - '', - false + array('getEventDispatcher', 'getCacheManager', 'getActionValidator'), array(), '', false ); $contextMock->expects($this->any())->method('getEventDispatcher')->will($this->returnValue($eventManagerMock)); $contextMock->expects($this->any())->method('getCacheManager')->will($this->returnValue($cacheInterfaceMock)); + $contextMock->expects($this->any())->method('getActionValidator') + ->will($this->returnValue($actionValidatorMock)); $dbAdapterMock = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false); $dbAdapterMock->expects($this->any())->method('getTransactionLevel')->will($this->returnValue(1)); $resourceMock = $this->getMock( - 'Magento\Core\Model\Resource\AbstractResource', - array( - '_construct', - '_getReadAdapter', - '_getWriteAdapter', - 'getIdFieldName', - 'save', - 'saveInSetIncluding', - 'isUsedBySuperProducts', - 'delete' - ), - array(), - '', - false + 'Magento\Model\Resource\AbstractResource', + array('_construct', '_getReadAdapter', '_getWriteAdapter', 'getIdFieldName', + 'save', 'saveInSetIncluding', 'isUsedBySuperProducts', 'delete'), + array(), '', false ); $resourceMock->expects($this->any())->method('_getWriteAdapter')->will($this->returnValue($dbAdapterMock)); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/CollectionTest.php new file mode 100644 index 00000000000..b8a5b12baba --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/CollectionTest.php @@ -0,0 +1,135 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Model\Resource\Product\Option; + +class CollectionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Collection + */ + protected $collection; + + /** + * @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject + */ + protected $loggerMock; + + /** + * @var \Magento\Core\Model\EntityFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entityFactoryMock; + + /** + * @var \Magento\Data\Collection\Db\FetchStrategyInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $fetchStrategyMock; + + /** + * @var \Magento\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $eventManagerMock; + + /** + * @var Value\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $optionsFactoryMock; + + /** + * @var \Magento\Core\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; + + /** + * @var \Magento\Catalog\Model\Resource\Product\Option|\PHPUnit_Framework_MockObject_MockObject + */ + protected $resourceMock; + + /** + * @var \Magento\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $adapterMock; + + /** + * @var \Zend_Db_Select|\PHPUnit_Framework_MockObject_MockObject + */ + protected $selectMock; + + protected function setUp() + { + $this->entityFactoryMock = $this->getMock( + 'Magento\Core\Model\EntityFactory', array('create'), array(), '', false + ); + $this->loggerMock = $this->getMock('Magento\Logger', array('log'), array(), '', false); + $this->fetchStrategyMock = $this->getMock( + 'Magento\Data\Collection\Db\FetchStrategy\Query', array('fetchAll'), array(), '', false + ); + $this->eventManagerMock = $this->getMock('Magento\Event\Manager', array(), array(), '', false); + $this->optionsFactoryMock = $this->getMock( + 'Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory', + array('create'), + array(), + '', + false + ); + $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->resourceMock = $this->getMock( + 'Magento\Catalog\Model\Resource\Product\Option', + array('getReadConnection', '__wakeup', 'getMainTable', 'getTable'), + array(), + '', + false + ); + $this->selectMock = $this->getMock('Zend_Db_Select', array('from', 'reset'), array(), '', false); + $this->adapterMock = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', array('select'), array(), '', false); + $this->adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($this->selectMock)); + $this->resourceMock->expects($this->once()) + ->method('getReadConnection') + ->will($this->returnValue($this->adapterMock)); + $this->resourceMock->expects($this->once()) + ->method('getMainTable') + ->will($this->returnValue('test_main_table')); + $this->resourceMock->expects($this->once()) + ->method('getTable') + ->with('test_main_table') + ->will($this->returnValue('test_main_table')); + + $this->collection = new Collection( + $this->entityFactoryMock, + $this->loggerMock, + $this->fetchStrategyMock, + $this->eventManagerMock, + $this->optionsFactoryMock, + $this->storeManagerMock, + null, + $this->resourceMock + ); + } + + public function testReset() + { + $this->collection->reset(); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/Stub.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/Stub.php index 6122b164af8..082910be107 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/Stub.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/Stub.php @@ -26,6 +26,6 @@ */ namespace Magento\Catalog\Model\Resource\Product\Option; -class Stub extends \Magento\Core\Model\AbstractModel +class Stub extends \Magento\Model\AbstractModel { } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueStub.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueStub.php index bfce1a9d175..44b78557f14 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueStub.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueStub.php @@ -39,9 +39,9 @@ class ValueStub extends \Magento\Catalog\Model\Resource\Product\Option\Value /** * Save option value price data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object */ - public function saveValueTitles(\Magento\Core\Model\AbstractModel $object) + public function saveValueTitles(\Magento\Model\AbstractModel $object) { $this->_saveValueTitles($object); } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Template/Filter/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Template/Filter/FactoryTest.php index 96142590fa4..29c7adf6aec 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Template/Filter/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Template/Filter/FactoryTest.php @@ -86,7 +86,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage WrongClass doesn't extends \Magento\Filter\Template */ public function testWrongTypeException() diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Adminhtml/Stock/ItemTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Adminhtml/Stock/ItemTest.php index ea69ef997d9..780eaa6cca0 100644 --- a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Adminhtml/Stock/ItemTest.php +++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Adminhtml/Stock/ItemTest.php @@ -36,7 +36,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase protected function setUp() { $resourceMock = $this->getMock( - 'Magento\Core\Model\Resource\AbstractResource', + 'Magento\Model\Resource\AbstractResource', array('_construct', '_getReadAdapter', '_getWriteAdapter', 'getIdFieldName'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php index e34f04be7b8..937181def82 100644 --- a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php +++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php @@ -244,7 +244,7 @@ class OptionTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage The stock item for Product in option is not valid. */ public function testInitializeWithInvalidOptionQty() diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php index ef19c60743f..f4dce997263 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php @@ -42,7 +42,7 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_translator = $this->getMock('Magento\TranslateInterface', array(), array(), '', false); + $this->_translator = $this->getMock('Magento\Translate\Inline\StateInterface', array(), array(), '', false); $context = $this->getMock('\Magento\App\Helper\Context', array(), array(), '', false); $storeConfig = $this->getMock('\Magento\Core\Model\Store\Config', array(), array(), '', false); @@ -180,8 +180,10 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->getMock('Magento\Mail\TransportInterface')) ); - $this->_translator->expects($this->at(0))->method('setTranslateInline')->with(false); - $this->_translator->expects($this->at(1))->method('setTranslateInline')->with(true); + $this->_translator->expects($this->at(1)) + ->method('suspend'); + $this->_translator->expects($this->at(1)) + ->method('resume'); $productOne = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false); $productOne->expects($this->once())->method('getName')->will($this->returnValue('Product One')); diff --git a/dev/tests/integration/testsuite/Magento/Url/QueryParamsResolverTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/Config/Source/Cart/SummaryTest.php similarity index 56% rename from dev/tests/integration/testsuite/Magento/Url/QueryParamsResolverTest.php rename to dev/tests/unit/testsuite/Magento/Checkout/Model/Config/Source/Cart/SummaryTest.php index 9897113bd21..456c760ec8e 100644 --- a/dev/tests/integration/testsuite/Magento/Url/QueryParamsResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Model/Config/Source/Cart/SummaryTest.php @@ -18,35 +18,35 @@ * 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 integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Url; +namespace Magento\Checkout\Model\Config\Source\Cart; -class QueryParamsResolverTest extends \PHPUnit_Framework_TestCase +use Magento\TestFramework\Helper\ObjectManager; + +class SummaryTest extends \PHPUnit_Framework_TestCase { - /** - * @var \Magento\Url\QueryParamsResolver - */ - protected $_model; + /** @var \Magento\Checkout\Model\Config\Source\Cart\Summary */ + protected $object; + + /** @var ObjectManager */ + protected $objectManager; protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Url\QueryParamsResolver' - ); + $this->objectManager = new ObjectManager($this); + $this->object = $this->objectManager->getObject('Magento\Checkout\Model\Config\Source\Cart\Summary'); } - public function testSetGetPurgeQueryParams() + public function testToOptionArray() { - $params = array('one' => 1, 'two' => 2); - $this->_model->setQueryParams($params); - $this->assertEquals($params, $this->_model->getQueryParams()); - - $this->_model->purgeQueryParams(); - $this->assertEquals(array(), $this->_model->getQueryParams()); + $this->assertEquals( + [ + ['value' => 0, 'label' => 'Display number of items in cart'], + ['value' => 1, 'label' => 'Display item quantities'], + ], + $this->object->toOptionArray() + ); } } diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/ObserverTest.php new file mode 100644 index 00000000000..b5b66f0dc3b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Model/ObserverTest.php @@ -0,0 +1,95 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Model; + +use Magento\TestFramework\Helper\ObjectManager; + +class ObserverTest extends \PHPUnit_Framework_TestCase +{ + /** @var Observer */ + protected $object; + + /** @var ObjectManager */ + protected $objectManager; + + /** @var Session|\PHPUnit_Framework_MockObject_MockObject */ + protected $checkoutSession; + + /** @var Magento\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $messageManager; + + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + $this->checkoutSession = $this->getMock('Magento\Checkout\Model\Session', [], [], '', false); + $this->messageManager = $this->getMock('Magento\Message\ManagerInterface', [], [], '', false); + $this->object = $this->objectManager->getObject('Magento\Checkout\Model\Observer', [ + 'checkoutSession' => $this->checkoutSession, + 'messageManager' => $this->messageManager, + ]); + } + + public function testUnsetAll() + { + $this->checkoutSession->expects($this->once())->method('clearQuote')->will($this->returnSelf()); + $this->checkoutSession->expects($this->once())->method('clearStorage')->will($this->returnSelf()); + + $this->object->unsetAll(); + } + + public function testLoadCustomerQuoteThrowingCoreException() + { + $this->checkoutSession->expects($this->once())->method('loadCustomerQuote')->will( + $this->throwException(new \Magento\Model\Exception('Message')) + ); + $this->messageManager->expects($this->once())->method('addError')->with('Message'); + + $this->object->loadCustomerQuote(); + } + + public function testLoadCustomerQuoteThrowingException() + { + $exception = new \Exception('Message'); + $this->checkoutSession->expects($this->once())->method('loadCustomerQuote')->will( + $this->throwException($exception) + ); + $this->messageManager->expects($this->once())->method('addException') + ->with($exception, 'Load customer quote error'); + + $this->object->loadCustomerQuote(); + } + + public function testSalesQuoteSaveAfter() + { + $observer = $this->getMock('Magento\Event\Observer', [], [], '', false); + $observer->expects($this->once())->method('getEvent')->will( + $this->returnValue(new \Magento\Object( + ['quote' => new \Magento\Object(['is_checkout_cart' => 1, 'id' => 7])] + )) + ); + $this->checkoutSession->expects($this->once())->method('getQuoteId')->with(7); + + $this->object->salesQuoteSaveAfter($observer); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/AbstractTypeTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/AbstractTypeTest.php new file mode 100644 index 00000000000..5b9b754fa29 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/AbstractTypeTest.php @@ -0,0 +1,156 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Checkout\Model\Type; + +/** + * Test class for \Magento\Checkout\Model\Type\AbstractType + */ +class AbstractTypeTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Checkout\Model\Type\AbstractType */ + protected $model; + + /** + * @var \Magento\Checkout\Model\Session|\PHPUnit_Framework_MockObject_MockObject + */ + protected $checkoutSession; + + /** @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject */ + protected $customerSession; + + /** @var \Magento\Sales\Model\OrderFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $orderFactory; + + /** @var \Magento\Customer\Service\V1\CustomerAddressServiceInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $customerAddressService; + + /** @var \Magento\Customer\Service\V1\Data\Customer|\PHPUnit_Framework_MockObject_MockObject */ + protected $customerObject; + + public function setUp() + { + $this->checkoutSession = $this->getMock('Magento\Checkout\Model\Session', [], [], '', false); + $this->customerSession = $this->getMock('Magento\Customer\Model\Session', [], [], '', false); + $this->orderFactory = $this->getMock('Magento\Sales\Model\OrderFactory', [], [], '', false); + $this->customerAddressService = $this->getMock('Magento\Customer\Service\V1\CustomerAddressServiceInterface'); + + $this->customerObject = $this->getMock('Magento\Customer\Service\V1\Data\Customer', [], [], '', false); + $this->model = $this->getMockForAbstractClass( + '\Magento\Checkout\Model\Type\AbstractType', + [ + 'checkoutSession' => $this->checkoutSession, + 'customerSession' => $this->customerSession, + 'orderFactory' => $this->orderFactory, + 'customerAddressService' => $this->customerAddressService + ], + '', + true + ); + } + + public function testGetCheckoutSession() + { + $this->assertSame($this->checkoutSession, $this->model->getCheckoutSession()); + } + + public function testGetCustomerSession() + { + $this->assertSame($this->customerSession, $this->model->getCustomerSession()); + } + + public function testGetCustomer() + { + $this->customerSession->expects($this->once())->method('getCustomerDataObject') + ->will($this->returnValue($this->customerObject)); + $this->assertSame($this->customerObject, $this->model->getCustomer()); + } + + public function testGetQuote() + { + $quoteMock = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false); + $this->checkoutSession->expects($this->once())->method('getQuote')->will($this->returnValue($quoteMock)); + + $this->assertSame($quoteMock, $this->model->getQuote()); + } + + public function testGetQuoteItems() + { + $quoteMock = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false); + $itemMock = $this->getMock('Magento\Sales\Model\Quote\Item', [], [], '', false); + $this->checkoutSession->expects($this->once())->method('getQuote')->will($this->returnValue($quoteMock)); + $quoteMock->expects($this->once())->method('getAllItems')->will($this->returnValue([$itemMock])); + + $this->assertEquals([$itemMock], $this->model->getQuoteItems()); + } + + /** + * @param string $serviceMethod + * @param string $modelMethod + * @dataProvider getDefaultAddressDataProvider + */ + public function testGetCustomerDefaultShippingAddress($serviceMethod, $modelMethod) + { + $address = $this->getMock('Magento\Customer\Service\V1\Data\Address', [], [], '', false); + $customerId = 1; + $this->customerSession->expects($this->once())->method('getCustomerDataObject') + ->will($this->returnValue($this->customerObject)); + $this->customerObject->expects($this->once())->method('getId') + ->will($this->returnValue($customerId)); + $this->customerAddressService->expects($this->once())->method($serviceMethod)->with($customerId) + ->will($this->returnValue($address)); + $this->customerAddressService->expects($this->never())->method('getAddresses'); + + $this->assertSame($address, $this->model->$modelMethod()); + } + + /** + * @param string $serviceMethod + * @param string $modelMethod + * @dataProvider getDefaultAddressDataProvider + */ + public function testGetCustomerDefaultShippingAddressIfDefaultNotAvailable($serviceMethod, $modelMethod) + { + $address = $this->getMock('Magento\Customer\Service\V1\Data\Address', [], [], '', false); + $customerId = 1; + $this->customerSession->expects($this->once())->method('getCustomerDataObject') + ->will($this->returnValue($this->customerObject)); + $this->customerObject->expects($this->once())->method('getId') + ->will($this->returnValue($customerId)); + $this->customerAddressService->expects($this->once())->method($serviceMethod)->with($customerId) + ->will($this->returnValue(null)); + $this->customerAddressService->expects($this->once())->method('getAddresses')->with($customerId) + ->will($this->returnValue([$address])); + + $this->assertSame($address, $this->model->$modelMethod()); + } + + public function getDefaultAddressDataProvider() + { + return [ + ['getDefaultShippingAddress', 'getCustomerDefaultShippingAddress'], + ['getDefaultBillingAddress', 'getCustomerDefaultBillingAddress'], + ]; + } +} 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 c1cfaef73a8..accf4d9860d 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 @@ -240,7 +240,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase public function testDeleteDirectoryOverRoot() { $this->setExpectedException( - '\Magento\Core\Exception', + '\Magento\Model\Exception', sprintf('Directory %s is not under storage root path.', self::INVALID_DIRECTORY_OVER_ROOT) ); $this->_model->deleteDirectory(self::INVALID_DIRECTORY_OVER_ROOT); @@ -252,7 +252,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase public function testDeleteRootDirectory() { $this->setExpectedException( - '\Magento\Core\Exception', + '\Magento\Model\Exception', sprintf('We cannot delete root directory %s.', self::STORAGE_ROOT_DIR) ); $this->_model->deleteDirectory(self::STORAGE_ROOT_DIR); diff --git a/dev/tests/unit/testsuite/Magento/Config/Converter/Dom/FlatTest.php b/dev/tests/unit/testsuite/Magento/Config/Converter/Dom/FlatTest.php index b4975ad8fc3..6285c6fd5b2 100644 --- a/dev/tests/unit/testsuite/Magento/Config/Converter/Dom/FlatTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/Converter/Dom/FlatTest.php @@ -41,8 +41,13 @@ class FlatTest extends \PHPUnit_Framework_TestCase { $arrayNodeConfig = new \Magento\Config\Dom\ArrayNodeConfig( new \Magento\Config\Dom\NodePathMatcher(), - array('/root/multipleNode' => 'id'), - array('/root/node_one/subnode') + array( + '/root/multipleNode' => 'id', + '/root/wrongArray' => 'id', + ), + array( + '/root/node_one/subnode', + ) ); $this->_model = new \Magento\Config\Converter\Dom\Flat($arrayNodeConfig); $this->_fixturePath = realpath(__DIR__ . '/../../') . '/_files/converter/dom/flat/'; @@ -58,4 +63,28 @@ class FlatTest extends \PHPUnit_Framework_TestCase $actual = $this->_model->convert($dom); $this->assertEquals($expected, $actual); } + + /** + * @expectedException \UnexpectedValueException + * @expectedExceptionMessage Node path '/root/someOtherVal' is not unique, but it has not been marked as array. + */ + public function testConvertWithNotUnique() + { + $dom = new \DOMDocument(); + $dom->load($this->_fixturePath . 'source_notuniq.xml'); + + $this->_model->convert($dom); + } + + /** + * @expectedException \UnexpectedValueException + * @expectedExceptionMessage Array is expected to contain value for key 'id'. + */ + public function testConvertWrongArray() + { + $dom = new \DOMDocument(); + $dom->load($this->_fixturePath . 'source_wrongarray.xml'); + + $this->_model->convert($dom); + } } diff --git a/dev/tests/unit/testsuite/Magento/Config/Converter/DomTest.php b/dev/tests/unit/testsuite/Magento/Config/Converter/DomTest.php new file mode 100644 index 00000000000..955869d88a8 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Config/Converter/DomTest.php @@ -0,0 +1,50 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Config\Converter; + +class DomTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param string $sourceFile + * @param string $resultFile + * @dataProvider convertDataProvider + */ + public function testConvert($sourceFile, $resultFile) + { + $dom = new \DOMDocument(); + $dom->loadXML(file_get_contents(__DIR__ . "/../_files/converter/dom/{$sourceFile}")); + $resultFile = include __DIR__ . "/../_files/converter/dom/{$resultFile}"; + + $converterDom = new Dom(); + $this->assertEquals($resultFile, $converterDom->convert($dom)); + } + + public function convertDataProvider() + { + return array( + array('cdata.xml', 'cdata.php',), + array('attributes.xml', 'attributes.php',), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Config/DomTest.php b/dev/tests/unit/testsuite/Magento/Config/DomTest.php index 34f881af3c1..07ef8cdd0ea 100644 --- a/dev/tests/unit/testsuite/Magento/Config/DomTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/DomTest.php @@ -163,4 +163,17 @@ class DomTest extends \PHPUnit_Framework_TestCase $dom = new \Magento\Config\Dom($xml, array(), null, null, $errorFormat); $dom->validate(__DIR__ . '/_files/sample.xsd'); } + + public function testValidateUnknownError() + { + $xml = '<root><node id="id1"/><node id="id2"/></root>'; + $schemaFile = __DIR__ . '/_files/sample.xsd'; + $dom = new \Magento\Config\Dom($xml); + $domMock = $this->getMock('DOMDocument', array('schemaValidate'), array()); + $domMock->expects($this->once()) + ->method('schemaValidate') + ->with($schemaFile) + ->will($this->returnValue(false)); + $this->assertEquals(array('Unknown validation error'), $dom->validateDomDocument($domMock, $schemaFile)); + } } diff --git a/dev/tests/unit/testsuite/Magento/Config/Reader/FilesystemTest.php b/dev/tests/unit/testsuite/Magento/Config/Reader/FilesystemTest.php index d86f529913c..07852ff6154 100644 --- a/dev/tests/unit/testsuite/Magento/Config/Reader/FilesystemTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/Reader/FilesystemTest.php @@ -77,6 +77,22 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase $model->read('scope'); } + public function testReadWithoutFiles() + { + $model = new Filesystem( + $this->_fileResolverMock, + $this->_converterMock, + $this->_schemaLocatorMock, + $this->_validationStateMock, + 'fileName', + array() + ); + $this->_fileResolverMock + ->expects($this->once())->method('get')->will($this->returnValue(array())); + + $this->assertEmpty($model->read('scope')); + } + /** * @expectedException \Magento\Exception * @expectedExceptionMessage Invalid Document diff --git a/app/code/Magento/Backend/Model/Translate/Inline.php b/dev/tests/unit/testsuite/Magento/Config/ScopeTest.php similarity index 50% rename from app/code/Magento/Backend/Model/Translate/Inline.php rename to dev/tests/unit/testsuite/Magento/Config/ScopeTest.php index 777d94c75f5..70db7e09076 100644 --- a/app/code/Magento/Backend/Model/Translate/Inline.php +++ b/dev/tests/unit/testsuite/Magento/Config/ScopeTest.php @@ -17,42 +17,44 @@ * Do not edit or add to this file if you wish to upgrade Magento to 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 + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backend\Model\Translate; -/** - * Inline Translations PHP part - */ -class Inline extends \Magento\Translate\Inline +namespace Magento\Config; + +class ScopeTest extends \PHPUnit_Framework_TestCase { /** - * Return URL for ajax requests - * - * @return string + * @var \Magento\Config\Scope */ - protected function _getAjaxUrl() - { - return $this->_url->getUrl(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE . '/ajax/translate'); - } + protected $model; /** - * Replace translation templates with HTML fragments - * - * @param array|string &$body - * @param bool $isJson - * @return $this + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\AreaList */ - public function processResponseBody(&$body, $isJson = false) + protected $areaListMock; + + protected function setUp() + { + $this->areaListMock = $this->getMock('Magento\App\AreaList', array('getCodes'), array(), '', false); + $this->model = new Scope($this->areaListMock); + } + + public function testScopeSetGet() + { + $scopeName = 'test_scope'; + $this->model->setCurrentScope($scopeName); + $this->assertEquals($scopeName, $this->model->getCurrentScope()); + } + + public function testGetAllScopes() { - if (!$this->isAllowed()) { - $this->_stripInlineTranslations($body); - return $this; - } - return parent::processResponseBody($body, $isJson); + $expectedBalances = array('primary', 'test_scope'); + $this->areaListMock->expects($this->once()) + ->method('getCodes') + ->will($this->returnValue(array('test_scope'))); + $this->assertEquals($expectedBalances, $this->model->getAllScopes()); } } diff --git a/dev/tests/unit/testsuite/Magento/Config/ThemeTest.php b/dev/tests/unit/testsuite/Magento/Config/ThemeTest.php index 6bb89cb6174..f6c83e53fce 100644 --- a/dev/tests/unit/testsuite/Magento/Config/ThemeTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/ThemeTest.php @@ -76,4 +76,50 @@ class ThemeTest extends \PHPUnit_Framework_TestCase array('test_external_package_descendant', array('default_test2')) ); } + + /** + * @param string $themePath + * @param array $expected + * @dataProvider dataGetterDataProvider + */ + public function testDataGetter($themePath, $expected) + { + $expected = reset($expected); + $config = new \Magento\Config\Theme(file_get_contents(__DIR__ . "/_files/area/$themePath/theme.xml")); + $this->assertSame($expected['version'], $config->getThemeVersion()); + $this->assertSame($expected['media'], $config->getMedia()); + } + + /** + * @return array + */ + public function dataGetterDataProvider() + { + return array( + array( + 'default_default', + array(array( + 'version' => '2.0.0.9', + 'media' => array('preview_image' => 'media/default_default.jpg'), + ))), + array( + 'default_test', + array(array( + 'version' => '2.1.0.0', + 'media' => array('preview_image' => ''), + ))), + array( + 'default_test2', + array(array( + 'version' => '2.0.0.0', + 'media' => array('preview_image' => ''), + ))), + array( + 'test_default', + array(array( + 'version' => '2.0.1.0', + 'media' => array('preview_image' => 'media/test_default.jpg'), + ))), + ); + } } diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/area/default_default/theme.xml b/dev/tests/unit/testsuite/Magento/Config/_files/area/default_default/theme.xml index e9252cc20f9..9341a2afe7e 100644 --- a/dev/tests/unit/testsuite/Magento/Config/_files/area/default_default/theme.xml +++ b/dev/tests/unit/testsuite/Magento/Config/_files/area/default_default/theme.xml @@ -28,5 +28,8 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/Magento/Config/etc/theme.xsd"> <title>Default</title> - <version>2.0.0.0</version> + <version>2.0.0.9</version> + <media> + <preview_image>media/default_default.jpg</preview_image> + </media> </theme> diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/area/default_test/theme.xml b/dev/tests/unit/testsuite/Magento/Config/_files/area/default_test/theme.xml index 986333806f5..a3f7dcec656 100644 --- a/dev/tests/unit/testsuite/Magento/Config/_files/area/default_test/theme.xml +++ b/dev/tests/unit/testsuite/Magento/Config/_files/area/default_test/theme.xml @@ -28,6 +28,9 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/Magento/Config/etc/theme.xsd"> <title>Test</title> - <version>2.0.0.0</version> + <version>2.1.0.0</version> <parent>default_default</parent> + <media> + <preview_image /> + </media> </theme> diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/area/test_default/theme.xml b/dev/tests/unit/testsuite/Magento/Config/_files/area/test_default/theme.xml index e9252cc20f9..69d2f7d3462 100644 --- a/dev/tests/unit/testsuite/Magento/Config/_files/area/test_default/theme.xml +++ b/dev/tests/unit/testsuite/Magento/Config/_files/area/test_default/theme.xml @@ -28,5 +28,8 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/Magento/Config/etc/theme.xsd"> <title>Default</title> - <version>2.0.0.0</version> + <version>2.0.1.0</version> + <media> + <preview_image>media/test_default.jpg</preview_image> + </media> </theme> diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.php b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.php new file mode 100644 index 00000000000..0d6d61ae198 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.php @@ -0,0 +1,70 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +return array( + 'root' => array( + array( + 'item' => array( + array( + '__attributes__' => array( + 'id' => 'id1', + 'attrZero' => 'value 0', + ), + '__content__' => 'Item 1.1', + ), + array( + '__attributes__' => array( + 'id' => 'id2', + 'attrOne' => 'value 2', + ), + 'subitem' => array( + array( + '__attributes__' => array( + 'id' => 'id2.1', + 'attrTwo' => 'value 2.1', + ), + '__content__' => 'Item 2.1', + ), + array( + '__attributes__' => array( + 'id' => 'id2.2', + ), + 'value' => array( + array('__content__' => 1), + array('__content__' => 2), + array('__content__' => 'test'), + ), + ), + ), + ), + array( + '__attributes__' => array( + 'id' => 'id3', + 'attrThree' => 'value 3', + ), + '__content__' => 'Item 3.1', + ), + ), + ), + ), +); \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.xml b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.xml new file mode 100644 index 00000000000..d8cbb5a8626 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<root> + <item id="id1" attrZero="value 0">Item 1.1</item> + <item id="id2" attrOne="value 2"> + <subitem id="id2.1" attrTwo="value 2.1">Item 2.1</subitem> + <subitem id="id2.2"> + <value>1</value> + <value>2</value> + <value>test</value> + </subitem> + </item> + <item id="id3" attrThree="value 3">Item 3.1</item> +</root> diff --git a/dev/tests/integration/testsuite/Magento/PubSub/Event/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/cdata.php similarity index 70% rename from dev/tests/integration/testsuite/Magento/PubSub/Event/FactoryTest.php rename to dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/cdata.php index 56fd99a57b7..ca689ddbd7b 100644 --- a/dev/tests/integration/testsuite/Magento/PubSub/Event/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/cdata.php @@ -1,7 +1,5 @@ <?php /** - * \Magento\PubSub\Event\Factory - * * Magento * * NOTICE OF LICENSE @@ -23,15 +21,19 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\PubSub\Event; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $factory = new \Magento\PubSub\Event\Factory(); - $event = $factory->create('topic', array()); - - $this->assertInstanceOf('Magento\PubSub\EventInterface', $event); - } -} +return array( + 'root' => array( + array( + 'cdata' => array( + array( + 'node_one' => array( + array('__content__' => '<valueOne>'), + ), + ), + ), + 'cdata_next' => array( + array('__content__' => '<valueTwo>'), + ), + ), + ), +); \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/PubSub/_files/config.xml b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/cdata.xml similarity index 82% rename from dev/tests/integration/testsuite/Magento/PubSub/_files/config.xml rename to dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/cdata.xml index 0224ee61daf..c1d31ac7264 100644 --- a/dev/tests/integration/testsuite/Magento/PubSub/_files/config.xml +++ b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/cdata.xml @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <!-- /** * Magento @@ -23,5 +23,11 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/config.xsd"> -</config> \ No newline at end of file +<root> + <cdata> + <node_one><![CDATA[<valueOne>]]></node_one> + </cdata> + <cdata_next> + <![CDATA[<valueTwo>]]> + </cdata_next> +</root> diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_notuniq.xml b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_notuniq.xml new file mode 100644 index 00000000000..1bf30dd2fd3 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_notuniq.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<root> + <node_one attributeOne = '10' attributeTwo = '20'> + <subnode attributeThree = '30'></subnode> + <subnode attributeThree = '40' attributeFour = '40' >Value1</subnode> + <books attributeFive = '50' /> + </node_one> + <multipleNode id="one" name="name1"> + <value>1</value> + </multipleNode> + <multipleNode id="two" name="name2"> + <value>2</value> + </multipleNode> + <someOtherVal>1</someOtherVal> + <someOtherVal>2</someOtherVal> + <someDataVal><![CDATA[]]></someDataVal> +</root> diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_wrongarray.xml b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_wrongarray.xml new file mode 100644 index 00000000000..ce692e13db6 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_wrongarray.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<root> + <node_one attributeOne = '10' attributeTwo = '20'> + <subnode attributeThree = '30'></subnode> + <subnode attributeThree = '40' attributeFour = '40' >Value1</subnode> + <books attributeFive = '50' /> + </node_one> + <multipleNode id="one" name="name1"> + <value>1</value> + </multipleNode> + <multipleNode id="two" name="name2"> + <value>2</value> + </multipleNode> + <wrongArray id="1"><value>abcd</value></wrongArray> + <wrongArray id="2"><value>bcde</value></wrongArray> + <wrongArray id="3"><value>cdef</value></wrongArray> + <wrongArray><value>abcd</value></wrongArray> + <someDataVal><![CDATA[]]></someDataVal> +</root> diff --git a/dev/tests/unit/testsuite/Magento/Controller/Router/Route/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Controller/Router/Route/FactoryTest.php new file mode 100644 index 00000000000..aec5d73f057 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Controller/Router/Route/FactoryTest.php @@ -0,0 +1,104 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Framework + * @subpackage unit_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Controller\Router\Route; + +class FactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\ObjectManager + */ + protected $objectManager; + + public function setUp() + { + $this->objectManager = $this->getMockBuilder('Magento\ObjectManager') + ->disableOriginalConstructor() + ->getMock(); + } + + /** + * @test + */ + public function testCreateRoute() + { + $routerClass = 'router'; + + $router = $this->getMockBuilder('Zend_Controller_Router_Route_Interface') + ->setMockClassName($routerClass) + ->getMock(); + + $parameterRoute = 'route'; + $parameterDefaults = 'defaults'; + $parameterRegs = 'regs'; + $parameterLocale = 'locale'; + + $this->objectManager->expects($this->once()) + ->method('create') + ->with( + $this->logicalOr( + $routerClass, + array( + 'route' => $parameterRoute, + 'defaults' => $parameterDefaults, + 'regs' => $parameterRegs, + 'locale' => $parameterLocale, + ) + ) + ) + ->will($this->returnValue($router)); + + $object = new \Magento\Controller\Router\Route\Factory($this->objectManager); + $expectedRouter = $object->createRoute( + $routerClass, + $parameterRoute, + $parameterDefaults, + $parameterRegs, + $parameterLocale + ); + + $this->assertInstanceOf($routerClass, $expectedRouter); + $this->assertInstanceOf('Zend_Controller_Router_Route_Interface', $expectedRouter); + } + + /** + * @test + * @expectedException \LogicException + */ + public function testCreateRouteNegative() + { + $this->objectManager->expects($this->once()) + ->method('create') + ->will($this->returnValue(new \StdClass)); + + $object = new \Magento\Controller\Router\Route\Factory($this->objectManager); + $object->createRoute( + 'routerClass', + 'router' + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Convert/ConvertArrayTest.php b/dev/tests/unit/testsuite/Magento/Convert/ConvertArrayTest.php index 74b46f57faf..47285d9e20e 100644 --- a/dev/tests/unit/testsuite/Magento/Convert/ConvertArrayTest.php +++ b/dev/tests/unit/testsuite/Magento/Convert/ConvertArrayTest.php @@ -25,8 +25,6 @@ */ namespace Magento\Convert; -use Magento\Convert\ConvertArray; - class ConvertArrayTest extends \PHPUnit_Framework_TestCase { /** @@ -52,6 +50,21 @@ XML; $this->assertEquals($expectedResult, $result->asXML()); } + /** + * @expectedException \Exception + * @expectedExceptionMessage Associative and numeric keys must not be mixed at one level. + */ + public function testAssocToXmlExceptionByKey() + { + $data = array( + 'one' => array( + 100, + 'two' => 'three', + ), + ); + $this->_model->assocToXml($data); + } + /** * @param array $array * @param string $rootName diff --git a/dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php b/dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php index 4a5d9f74d2c..4ffbb7a3788 100644 --- a/dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php +++ b/dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php @@ -41,6 +41,16 @@ class ExcelTest extends \PHPUnit_Framework_TestCase array(1, 'Jon Doe', 'jon.doe@magento.com', 'General', '310-111-1111', 90232, 'United States', 'California') ); + protected $_testHeader = array( + 'HeaderID', 'HeaderName', 'HeaderEmail', 'HeaderGroup', 'HeaderPhone', 'HeaderZIP', + 'HeaderCountry', 'HeaderRegion', + ); + + protected $_testFooter = array( + 'FooterID', 'FooterName', 'FooterEmail', 'FooterGroup', 'FooterPhone', 'FooterZIP', + 'FooterCountry', 'FooterRegion', + ); + /** * Path for Sample File * @@ -75,7 +85,9 @@ class ExcelTest extends \PHPUnit_Framework_TestCase public function testConvert() { $convert = new \Magento\Convert\Excel(new \ArrayIterator($this->_testData)); - $isEqual = file_get_contents($this->_getSampleOutputFile()) == $convert->convert(); + $convert->setDataHeader($this->_testHeader); + $convert->setDataFooter($this->_testFooter); + $isEqual = (file_get_contents($this->_getSampleOutputFile()) == $convert->convert()); $this->assertTrue($isEqual, 'Failed asserting that data is the same.'); } @@ -107,6 +119,8 @@ class ExcelTest extends \PHPUnit_Framework_TestCase if (!$callback) { $convert = new \Magento\Convert\Excel(new \ArrayIterator($this->_testData)); + $convert->setDataHeader($this->_testHeader); + $convert->setDataFooter($this->_testFooter); } else { $convert = new \Magento\Convert\Excel( new \ArrayIterator($this->_testData), diff --git a/dev/tests/unit/testsuite/Magento/Convert/ObjectTest.php b/dev/tests/unit/testsuite/Magento/Convert/ObjectTest.php new file mode 100644 index 00000000000..9bf012b2491 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Convert/ObjectTest.php @@ -0,0 +1,145 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Convert; + +class ObjectTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Convert\Object + */ + protected $model; + + protected function setUp() + { + $this->model = new Object(); + } + + public function testToOptionArray() + { + $mockFirst = $this->getMock('Magento\Object', array('getId', 'getCode'), array()); + $mockFirst->expects($this->once()) + ->method('getId') + ->will($this->returnValue(1)); + $mockFirst->expects($this->once()) + ->method('getCode') + ->will($this->returnValue('code1')); + $mockSecond = $this->getMock('Magento\Object', array('getId', 'getCode'), array()); + $mockSecond->expects($this->once()) + ->method('getId') + ->will($this->returnValue(2)); + $mockSecond->expects($this->once()) + ->method('getCode') + ->will($this->returnValue('code2')); + + $callable = function ($item) { + return $item->getCode(); + }; + + $items = array( + $mockFirst, + $mockSecond, + ); + $result = array( + array('value' => 1, 'label' => 'code1'), + array('value' => 2, 'label' => 'code2'), + ); + $this->assertEquals($result, $this->model->toOptionArray($items, 'id', $callable)); + } + + public function testToOptionHash() + { + $mockFirst = $this->getMock('Magento\Object', array('getSome', 'getId'), array()); + $mockFirst->expects($this->once()) + ->method('getId') + ->will($this->returnValue(3)); + $mockFirst->expects($this->once()) + ->method('getSome') + ->will($this->returnValue('code3')); + $mockSecond = $this->getMock('Magento\Object', array('getSome', 'getId'), array()); + $mockSecond->expects($this->once()) + ->method('getId') + ->will($this->returnValue(4)); + $mockSecond->expects($this->once()) + ->method('getSome') + ->will($this->returnValue('code4')); + + $callable = function ($item) { + return $item->getId(); + }; + $items = array( + $mockFirst, + $mockSecond, + ); + $result = array( + 3 => 'code3', + 4 => 'code4', + ); + + $this->assertEquals($result, $this->model->toOptionHash($items, $callable, 'some')); + } + + public function testConvertDataToArray() + { + $object = new \stdClass(); + $object->a = array(array(1)); + $mockFirst = $this->getMock('Magento\Object', array('getData')); + $mockSecond = $this->getMock('Magento\Object', array('getData')); + + $mockFirst->expects($this->any()) + ->method('getData') + ->will($this->returnValue(array( + 'id' => 1, + 'o' => $mockSecond, + ))); + + $mockSecond->expects($this->any()) + ->method('getData') + ->will($this->returnValue(array( + 'id' => 2, + 'o' => $mockFirst, + ))); + + $data = array( + 'object' => $mockFirst, + 'stdClass' => $object, + 'test' => 'test', + ); + $result = array( + 'object' => array( + 'id' => 1, + 'o' => array( + 'id' => 2, + 'o' => '*** CYCLE DETECTED ***', + ), + ), + 'stdClass' => array( + 'a' => array( + array(1), + ), + ), + 'test' => 'test', + ); + $this->assertEquals($result, $this->model->convertDataToArray($data)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Convert/XmlTest.php b/dev/tests/unit/testsuite/Magento/Convert/XmlTest.php index de715732785..81a7fd8c292 100644 --- a/dev/tests/unit/testsuite/Magento/Convert/XmlTest.php +++ b/dev/tests/unit/testsuite/Magento/Convert/XmlTest.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,11 +37,23 @@ class XmlTest extends \PHPUnit_Framework_TestCase public function testXmlToAssoc() { - $xmlstr = <<<XML + $xmlstr = $this->getXml(); + $result = $this->_model->xmlToAssoc(new \SimpleXMLElement($xmlstr)); + $this->assertEquals( + array( + 'one' => '1', + 'two' => array('three' => '3', 'four' => '4'), + 'five' => array(0 => '5', 1 => '6'), + ), + $result + ); + } + + protected function getXml() + { + return <<<XML <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<_><one>1</one><two><three>3</three><four>4</four></two></_> +<_><one>1</one><two><three>3</three><four>4</four></two><five><five>5</five><five>6</five></five></_> XML; - $result = $this->_model->xmlToAssoc(new \SimpleXMLElement($xmlstr)); - $this->assertEquals(array('one' => '1', 'two' => array('three' => '3', 'four' => '4')), $result); } } diff --git a/dev/tests/unit/testsuite/Magento/Convert/_files/output.txt b/dev/tests/unit/testsuite/Magento/Convert/_files/output.txt index a913c5e7807..5f977525d48 100644 --- a/dev/tests/unit/testsuite/Magento/Convert/_files/output.txt +++ b/dev/tests/unit/testsuite/Magento/Convert/_files/output.txt @@ -1 +1 @@ -<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?><Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"><OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"></OfficeDocumentSettings><ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"></ExcelWorkbook><Worksheet ss:Name="Sheet 1"><Table><Row><Cell><Data ss:Type="String">ID</Data></Cell><Cell><Data ss:Type="String">Name</Data></Cell><Cell><Data ss:Type="String">Email</Data></Cell><Cell><Data ss:Type="String">Group</Data></Cell><Cell><Data ss:Type="String">Telephone</Data></Cell><Cell><Data ss:Type="String">ZIP</Data></Cell><Cell><Data ss:Type="String">Country</Data></Cell><Cell><Data ss:Type="String">State/Province</Data></Cell></Row><Row><Cell><Data ss:Type="Number">1</Data></Cell><Cell><Data ss:Type="String">Jon Doe</Data></Cell><Cell><Data ss:Type="String">jon.doe@magento.com</Data></Cell><Cell><Data ss:Type="String">General</Data></Cell><Cell><Data ss:Type="String">310-111-1111</Data></Cell><Cell><Data ss:Type="Number">90232</Data></Cell><Cell><Data ss:Type="String">United States</Data></Cell><Cell><Data ss:Type="String">California</Data></Cell></Row></Table></Worksheet></Workbook> \ No newline at end of file +<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?><Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"><OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"></OfficeDocumentSettings><ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"></ExcelWorkbook><Worksheet ss:Name="Sheet 1"><Table><Row><Cell><Data ss:Type="String">HeaderID</Data></Cell><Cell><Data ss:Type="String">HeaderName</Data></Cell><Cell><Data ss:Type="String">HeaderEmail</Data></Cell><Cell><Data ss:Type="String">HeaderGroup</Data></Cell><Cell><Data ss:Type="String">HeaderPhone</Data></Cell><Cell><Data ss:Type="String">HeaderZIP</Data></Cell><Cell><Data ss:Type="String">HeaderCountry</Data></Cell><Cell><Data ss:Type="String">HeaderRegion</Data></Cell></Row><Row><Cell><Data ss:Type="String">ID</Data></Cell><Cell><Data ss:Type="String">Name</Data></Cell><Cell><Data ss:Type="String">Email</Data></Cell><Cell><Data ss:Type="String">Group</Data></Cell><Cell><Data ss:Type="String">Telephone</Data></Cell><Cell><Data ss:Type="String">ZIP</Data></Cell><Cell><Data ss:Type="String">Country</Data></Cell><Cell><Data ss:Type="String">State/Province</Data></Cell></Row><Row><Cell><Data ss:Type="Number">1</Data></Cell><Cell><Data ss:Type="String">Jon Doe</Data></Cell><Cell><Data ss:Type="String">jon.doe@magento.com</Data></Cell><Cell><Data ss:Type="String">General</Data></Cell><Cell><Data ss:Type="String">310-111-1111</Data></Cell><Cell><Data ss:Type="Number">90232</Data></Cell><Cell><Data ss:Type="String">United States</Data></Cell><Cell><Data ss:Type="String">California</Data></Cell></Row><Row><Cell><Data ss:Type="String">FooterID</Data></Cell><Cell><Data ss:Type="String">FooterName</Data></Cell><Cell><Data ss:Type="String">FooterEmail</Data></Cell><Cell><Data ss:Type="String">FooterGroup</Data></Cell><Cell><Data ss:Type="String">FooterPhone</Data></Cell><Cell><Data ss:Type="String">FooterZIP</Data></Cell><Cell><Data ss:Type="String">FooterCountry</Data></Cell><Cell><Data ss:Type="String">FooterRegion</Data></Cell></Row></Table></Worksheet></Workbook> \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php index 02649b4fe97..0f66de76774 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php @@ -33,7 +33,7 @@ class DesignLoaderTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_appMock; + protected $_areaListMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -47,35 +47,25 @@ class DesignLoaderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_appMock = $this->getMock('\Magento\Core\Model\App', array(), array(), '', false); + $this->_areaListMock = $this->getMock('\Magento\App\AreaList', array(), array(), '', false); $this->_requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); $this->_layoutMock = $this->getMock('Magento\View\LayoutInterface'); - $this->_model = new \Magento\View\DesignLoader($this->_requestMock, $this->_appMock, $this->_layoutMock); + $this->_model = new \Magento\View\DesignLoader( + $this->_requestMock, + $this->_areaListMock, + $this->_layoutMock + ); } public function testLoad() { $area = $this->getMock('Magento\Core\Model\App\Area', array(), array(), '', false); $this->_layoutMock->expects($this->once())->method('getArea')->will($this->returnValue('area')); - $this->_appMock->expects($this->once())->method('getArea')->with('area')->will($this->returnValue($area)); - $area->expects( - $this->at(0) - )->method( - 'load' - )->with( - \Magento\Core\Model\App\Area::PART_DESIGN - )->will( - $this->returnValue($area) - ); - $area->expects( - $this->at(1) - )->method( - 'load' - )->with( - \Magento\Core\Model\App\Area::PART_TRANSLATE - )->will( - $this->returnValue($area) - ); + $this->_areaListMock->expects($this->once())->method('getArea')->with('area')->will($this->returnValue($area)); + $area->expects($this->at(0))->method('load') + ->with(\Magento\Core\Model\App\Area::PART_DESIGN)->will($this->returnValue($area)); + $area->expects($this->at(1))->method('load') + ->with(\Magento\Core\Model\App\Area::PART_TRANSLATE)->will($this->returnValue($area)); $this->_model->load($this->_requestMock); } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php index fd74a015bd2..d23c519243c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php @@ -56,11 +56,6 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase */ protected $dateModelMock; - /** - * @var \Magento\Core\Model\App |\PHPUnit_Framework_MockObject_MockObject - */ - protected $applicationMock; - /** * @var \Magento\Core\Model\File\Storage\Directory\Database |\PHPUnit_Framework_MockObject_MockObject */ @@ -106,7 +101,6 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase false ); $this->dateModelMock = $this->getMock('Magento\Stdlib\DateTime\DateTime', array(), array(), '', false); - $this->applicationMock = $this->getMock('Magento\Core\Model\App', array(), array(), '', false); $this->directoryMock = $this->getMock( 'Magento\Core\Model\File\Storage\Directory\Database', array('setPath', 'setName', '__wakeup', 'save', 'getParentId'), @@ -139,24 +133,10 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->directoryMock) ); - $this->applicationMock->expects( - $this->any() - )->method( - 'getConfig' - )->will( - $this->returnValue($this->configMock) - ); - - $this->configMock->expects( - $this->any() - )->method( - 'getValue' - )->with( - \Magento\Core\Model\File\Storage::XML_PATH_STORAGE_MEDIA_DATABASE, - 'default' - )->will( - $this->returnValue($this->customConnectionName) - ); + $this->configMock->expects($this->any()) + ->method('getValue') + ->with(\Magento\Core\Model\File\Storage::XML_PATH_STORAGE_MEDIA_DATABASE, 'default') + ->will($this->returnValue($this->customConnectionName)); $this->contextMock->expects($this->once())->method('getLogger')->will($this->returnValue($this->loggerMock)); @@ -165,7 +145,7 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase $this->registryMock, $this->helperStorageDatabase, $this->dateModelMock, - $this->applicationMock, + $this->configMock, $this->directoryFactoryMock, $this->resourceDirectoryDatabaseMock, null, diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/LayoutTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/LayoutTest.php index ddedfe21252..ea1ba62a6d8 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/LayoutTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/LayoutTest.php @@ -61,7 +61,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testCreateBlockException() { 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 a76d2e04506..0c84a2e1274 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 @@ -26,14 +26,14 @@ */ /** - * Test class for \Magento\Core\Model\Resource\Db\AbstractDb. + * Test class for \Magento\Model\Resource\Db\AbstractDb. */ namespace Magento\Core\Model\Resource\Db; class AbstractTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Db\AbstractDb|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Model\Resource\Db\AbstractDb|PHPUnit_Framework_MockObject_MockObject */ protected $_model; @@ -46,7 +46,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $this->_resource = $this->getMock('Magento\App\Resource', array('getConnection'), array(), '', false, false); $this->_model = $this->getMock( - 'Magento\Core\Model\Resource\Db\AbstractDb', + 'Magento\Model\Resource\Db\AbstractDb', array('_construct', '_getWriteAdapter'), array($this->_resource) ); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/AbstractTestCase.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/AbstractTestCase.php index 80a2ff151f4..5e5eec5b778 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/AbstractTestCase.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/AbstractTestCase.php @@ -81,7 +81,7 @@ abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase $connection->expects($this->any())->method('quoteIdentifier')->will($this->returnArgument(0)); $resource = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', + 'Magento\Model\Resource\Db\AbstractDb', array(), '', false, @@ -98,7 +98,7 @@ abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase /** * @abstract * @param \Zend_Db_Select $select - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ abstract protected function _getCollection(\Zend_Db_Select $select); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php index b98146d1c28..933a3db8504 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php @@ -212,7 +212,7 @@ class StoreManagerTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetSafeStoreWithExceptionAndWithoutCurrentStore() { diff --git a/dev/tests/unit/testsuite/Magento/Cron/App/Cron/Plugin/ApplicationInitializerTest.php b/dev/tests/unit/testsuite/Magento/Cron/App/Cron/Plugin/ApplicationInitializerTest.php index e542caa7029..822a49b39d0 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/App/Cron/Plugin/ApplicationInitializerTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/App/Cron/Plugin/ApplicationInitializerTest.php @@ -33,7 +33,7 @@ class ApplicationInitializerTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $applicationMock; + protected $appStateMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -47,15 +47,18 @@ class ApplicationInitializerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->applicationMock = $this->getMock('Magento\AppInterface'); + $this->appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); $this->sidResolverMock = $this->getMock('\Magento\Session\SidResolverInterface', array(), array(), '', false); $this->subjectMock = $this->getMock('Magento\App\Cron', array(), array(), '', false); - $this->model = new ApplicationInitializer($this->applicationMock, $this->sidResolverMock); + $this->model = new ApplicationInitializer( + $this->appStateMock, + $this->sidResolverMock + ); } public function testBeforeExecutePerformsRequiredChecks() { - $this->applicationMock->expects($this->once())->method('requireInstalledInstance'); + $this->appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); $this->sidResolverMock->expects($this->once())->method('setUseSessionInUrl')->with(false); $this->model->beforeLaunch($this->subjectMock); } diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php index 46b8eba3ea6..5c1d55219cd 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php @@ -42,9 +42,9 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected $_objectManager; /** - * @var \Magento\Core\Model\App|\PHPUnit_Framework_MockObject_MockObject + * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_app; + protected $_cache; /** * @var \Magento\Cron\Model\Config|\PHPUnit_Framework_MockObject_MockObject @@ -87,7 +87,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_objectManager = $this->getMockBuilder( 'Magento\App\ObjectManager' )->disableOriginalConstructor()->getMock(); - $this->_app = $this->getMockBuilder('Magento\Core\Model\App')->disableOriginalConstructor()->getMock(); + $this->_cache = $this->getMock('Magento\App\CacheInterface'); $this->_config = $this->getMockBuilder('Magento\Cron\Model\Config')->disableOriginalConstructor()->getMock(); $this->_coreStoreConfig = $this->getMockBuilder( 'Magento\Core\Model\Store\Config' @@ -116,7 +116,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_observer = new \Magento\Cron\Model\Observer( $this->_objectManager, $this->_scheduleFactory, - $this->_app, + $this->_cache, $this->_config, $this->_coreStoreConfig, $this->_request, @@ -130,8 +130,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function testDispatchNoPendingJobs() { $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); + $this->_coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue(0)); $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue(array())); @@ -148,8 +152,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function testDispatchNoJobConfig() { $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); + $this->_coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue(0)); $this->_config->expects( $this->once() @@ -179,8 +187,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function testDispatchCanNotLock() { $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); + $this->_coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue(0)); $schedule = $this->getMockBuilder( 'Magento\Cron\Model\Schedule' @@ -216,8 +228,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $exceptionMessage = 'Too late for the schedule'; $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); + $this->_coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue(0)); $schedule = $this->getMockBuilder( 'Magento\Cron\Model\Schedule' @@ -290,7 +306,9 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig)); $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); $this->_coreStoreConfig->expects( $this->any() @@ -345,14 +363,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig)); $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects( - $this->any() - )->method( - 'getConfig' - )->will( - $this->returnValue(strtotime('+1 day')) - ); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); + $this->_coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue(strtotime('+1 day'))); $scheduleMock = $this->getMockBuilder('Magento\Cron\Model\Schedule')->disableOriginalConstructor()->getMock(); $scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_collection)); @@ -433,14 +449,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig)); $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects( - $this->any() - )->method( - 'getConfig' - )->will( - $this->returnValue(strtotime('+1 day')) - ); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); + $this->_coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue(strtotime('+1 day'))); $scheduleMock = $this->getMockBuilder('Magento\Cron\Model\Schedule')->disableOriginalConstructor()->getMock(); $scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_collection)); @@ -478,24 +492,14 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->returnValue(array('test_group' => array())) ); - $this->_app->expects( - $this->at(0) - )->method( - 'loadCache' - )->with( - $this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT) - )->will( - $this->returnValue(time() - 10000000) - ); - $this->_app->expects( - $this->at(2) - )->method( - 'loadCache' - )->with( - $this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_HISTORY_CLEANUP_AT) - )->will( - $this->returnValue(time() + 10000000) - ); + $this->_cache->expects($this->at(0)) + ->method('load') + ->with($this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT)) + ->will($this->returnValue(time() - 10000000)); + $this->_cache->expects($this->at(2)) + ->method('load') + ->with($this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_HISTORY_CLEANUP_AT)) + ->will($this->returnValue(time() + 10000000)); $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); @@ -510,7 +514,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_collection->addItem(new \Magento\Object()); $this->_collection->addItem($schedule); - $this->_app->expects($this->any())->method('saveCache'); + $this->_cache->expects($this->any())->method('save'); $scheduleMock = $this->getMockBuilder('Magento\Cron\Model\Schedule')->disableOriginalConstructor()->getMock(); $scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_collection)); @@ -540,24 +544,14 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ); $this->_config->expects($this->at(1))->method('getJobs')->will($this->returnValue($jobs)); - $this->_app->expects( - $this->at(0) - )->method( - 'loadCache' - )->with( - $this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT) - )->will( - $this->returnValue(time() - 10000000) - ); - $this->_app->expects( - $this->at(2) - )->method( - 'loadCache' - )->with( - $this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_HISTORY_CLEANUP_AT) - )->will( - $this->returnValue(time() + 10000000) - ); + $this->_cache->expects($this->at(0)) + ->method('load') + ->with($this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT)) + ->will($this->returnValue(time() - 10000000)); + $this->_cache->expects($this->at(2)) + ->method('load') + ->with($this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_HISTORY_CLEANUP_AT)) + ->will($this->returnValue(time() + 10000000)); $this->_coreStoreConfig->expects($this->at(0))->method('getConfig')->will($this->returnValue(0)); @@ -575,7 +569,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_collection->addItem(new \Magento\Object()); $this->_collection->addItem($schedule); - $this->_app->expects($this->any())->method('saveCache'); + $this->_cache->expects($this->any())->method('save'); $scheduleMock = $this->getMockBuilder( 'Magento\Cron\Model\Schedule' @@ -611,8 +605,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig)); - $this->_app->expects($this->at(0))->method('loadCache')->will($this->returnValue(time() + 10000000)); - $this->_app->expects($this->at(1))->method('loadCache')->will($this->returnValue(time() - 10000000)); + $this->_cache->expects($this->at(0)) + ->method('load') + ->will($this->returnValue(time() + 10000000)); + $this->_cache->expects($this->at(1)) + ->method('load') + ->will($this->returnValue(time() - 10000000)); $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); 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 459018658c0..baecc1ffaa1 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -285,7 +285,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase ); // Setup a core exception to return - $exception = new \Magento\Core\Exception(); + $exception = new \Magento\Model\Exception(); $error = new \Magento\Message\Error('Something Bad happened'); $exception->addMessage($error); @@ -322,7 +322,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase ); // Setup a core exception to return - $exception = new \Magento\Core\Exception($warningText); + $exception = new \Magento\Model\Exception($warningText); $error = new \Magento\Message\Warning('Something Not So Bad happened'); $exception->addMessage($error); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php index fc1f50bfa7e..704ee5a9d56 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php @@ -35,7 +35,7 @@ namespace Magento\Customer\Model\Layout; class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase { /** - * @var DepersonalizePlugin + * @var \Magento\Customer\Model\Layout\DepersonalizePlugin */ protected $plugin; diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/Form/AbstractDataTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/Form/AbstractDataTest.php index 58c7cb5a374..cf8ec428ec2 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/Form/AbstractDataTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/Form/AbstractDataTest.php @@ -86,7 +86,7 @@ class AbstractDataTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Attribute object is undefined */ public function testGetAttributeException() diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php index 20c0dfd851e..60b5c365d7c 100755 --- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php @@ -118,6 +118,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase */ private $_urlMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Logger + */ + private $_loggerMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Customer\Helper\Data */ @@ -254,7 +259,13 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_customerHelperMock) ); - $this->_urlMock = $this->getMockBuilder('\Magento\UrlInterface')->disableOriginalConstructor()->getMock(); + $this->_urlMock = $this->getMockBuilder('\Magento\UrlInterface') + ->disableOriginalConstructor() + ->getMock(); + + $this->_loggerMock = $this->getMockBuilder('\Magento\Logger') + ->disableOriginalConstructor() + ->getMock(); } public function testActivateAccount() @@ -453,7 +464,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase )->method( 'authenticate' )->will( - $this->throwException(new \Magento\Core\Exception('exception message')) + $this->throwException(new \Magento\Model\Exception('exception message')) ); $this->_customerFactoryMock->expects( @@ -689,7 +700,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Invalid transactional email code: 0 */ public function testSendPasswordResetLinkSendException() @@ -716,7 +727,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase )->method( 'sendPasswordResetConfirmationEmail' )->will( - $this->throwException(new \Magento\Core\Exception(__('Invalid transactional email code: %1', 0))) + $this->throwException(new \Magento\Model\Exception(__('Invalid transactional email code: %1', 0))) ); $customerService = $this->_createService(); @@ -728,6 +739,36 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase ); } + public function testSendPasswordResetLinkSendMailException() + { + $email = 'foo@example.com'; + $this->_mockReturnValue( + $this->_customerModelMock, + array( + 'getId' => self::ID, + 'setWebsiteId' => $this->_customerModelMock, + 'loadByEmail' => $this->_customerModelMock, + ) + ); + $this->_customerFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->_customerModelMock)); + + $exception = new \Magento\Mail\Exception(__('The mail server is down')); + + $this->_customerModelMock->expects($this->once()) + ->method('sendPasswordResetConfirmationEmail') + ->will($this->throwException($exception)); + + $this->_loggerMock->expects($this->once()) + ->method('logException') + ->with($exception); + + $customerService = $this->_createService(); + + $customerService->initiatePasswordReset($email, self::WEBSITE_ID, CustomerAccountServiceInterface::EMAIL_RESET); + } + public function testResetPassword() { $resetToken = 'lsdj579slkj5987slkj595lkj'; @@ -1041,6 +1082,40 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $customerService->resendConfirmation('email@test.com', 2); } + public function testResendConfirmationWithMailException() + { + $this->_customerFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->_customerModelMock)); + $this->_customerModelMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(55)); + $this->_customerModelMock->expects($this->once()) + ->method('setWebsiteId') + ->will($this->returnSelf()); + $this->_customerModelMock->expects($this->any()) + ->method('isConfirmationRequired') + ->will($this->returnValue(true)); + $this->_customerModelMock->expects($this->any()) + ->method('getConfirmation') + ->will($this->returnValue('123abc')); + + $exception = new \Magento\Mail\Exception(__('The mail server is down')); + + $this->_customerModelMock->expects($this->once()) + ->method('sendNewAccountEmail') + ->withAnyParameters() + ->will($this->throwException($exception)); + + $this->_loggerMock->expects($this->once()) + ->method('logException') + ->with($exception); + + $customerService = $this->_createService(); + $customerService->resendConfirmation('email', 1); + // If we call sendNewAccountEmail and no exception is returned, the test succeeds + } + /** * @dataProvider testGetConfirmationStatusDataProvider * @param string $expected The expected confirmation status. @@ -1753,6 +1828,76 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->assertFalse($service->isEmailAvailable('email', 1)); } + public function testCreateAccountMailException() + { + $this->_customerFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->_customerModelMock)); + + // This is to get the customer model through validation + $this->_customerModelMock->expects($this->any()) + ->method('getFirstname') + ->will($this->returnValue('John')); + + $this->_customerModelMock->expects($this->any()) + ->method('getLastname') + ->will($this->returnValue('Doe')); + + $this->_customerModelMock->expects($this->any()) + ->method('getEmail') + ->will($this->returnValue('somebody@example.com')); + + // This is to get the customer model through Converter::getCustomerModel + $this->_customerModelMock->expects($this->once()) + ->method('load') + ->will($this->returnSelf()); + + $this->_customerModelMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(true)); + + $exception = new \Magento\Mail\Exception(__('The mail server is down')); + + $this->_customerModelMock->expects($this->once()) + ->method('sendNewAccountEmail') + ->will($this->throwException($exception)); + + $this->_loggerMock->expects($this->once()) + ->method('logException') + ->with($exception); + + $this->_customerModelMock->expects($this->once()) + ->method('getAttributes') + ->will($this->returnValue([])); + + $mockCustomer = $this->getMockBuilder('Magento\Customer\Service\V1\Data\Customer') + ->disableOriginalConstructor() + ->getMock(); + + $mockCustomer->expects($this->any()) + ->method('getStoreId') + ->will($this->returnValue(true)); + + $mockCustomer->expects($this->once()) + ->method('__toArray') + ->will($this->returnValue(['attributeSetId' => true])); + + /** + * @var \Magento\Customer\Service\V1\Data\CustomerDetails | \PHPUnit_Framework_MockObject_MockObject + */ + $mockCustomerDetail = $this->getMockBuilder('Magento\Customer\Service\V1\Data\CustomerDetails') + ->disableOriginalConstructor() + ->getMock(); + + $mockCustomerDetail->expects($this->once()) + ->method('getCustomer') + ->will($this->returnValue($mockCustomer)); + + $service = $this->_createService(); + $service->createAccount($mockCustomerDetail, 'abc123'); + // If we get no mail exception, the test in considered a success + } + private function _setupStoreMock() { $this->_storeManagerMock = $this->getMockBuilder( @@ -1802,8 +1947,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAddressServiceMock, $this->_customerMetadataService, $this->_urlMock, + $this->_loggerMock, $this->_objectManagerMock ); return $customerService; } + + } diff --git a/dev/tests/unit/testsuite/Magento/Data/Collection/DbTest.php b/dev/tests/unit/testsuite/Magento/Data/Collection/DbTest.php index 5ae0934eedf..3fab3af7641 100644 --- a/dev/tests/unit/testsuite/Magento/Data/Collection/DbTest.php +++ b/dev/tests/unit/testsuite/Magento/Data/Collection/DbTest.php @@ -31,23 +31,46 @@ class DbTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Data\Collection\Db */ - protected $_collection; + protected $collection; + + /** + * @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject + */ + protected $loggerMock; + + /** + * @var \Magento\Core\Model\EntityFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entityFactoryMock; + + /** + * @var \Magento\Data\Collection\Db\FetchStrategyInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $fetchStrategyMock; protected function setUp() { - $fetchStrategy = $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'); - $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - $this->_collection = new \Magento\Data\Collection\Db($entityFactory, $logger, $fetchStrategy); + $this->fetchStrategyMock = $this->getMock( + 'Magento\Data\Collection\Db\FetchStrategy\Query', array('fetchAll'), array(), '', false + ); + $this->entityFactoryMock = $this->getMock( + 'Magento\Core\Model\EntityFactory', array('create'), array(), '', false + ); + $this->loggerMock = $this->getMock('Magento\Logger', array('log'), array(), '', false); + $this->collection = new \Magento\Data\Collection\Db( + $this->entityFactoryMock, + $this->loggerMock, + $this->fetchStrategyMock + ); } protected function tearDown() { - unset($this->_collection); + unset($this->collection); } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Zend_Db_Adapter_Abstract + * @return \PHPUnit_Framework_MockObject_MockObject|\Zend_Db_Adapter_Abstract */ public function testSetAddOrder() { @@ -60,18 +83,18 @@ class DbTest extends \PHPUnit_Framework_TestCase true, array('fetchAll') ); - $this->_collection->setConnection($adapter); + $this->collection->setConnection($adapter); - $select = $this->_collection->getSelect(); + $select = $this->collection->getSelect(); $this->assertEmpty($select->getPart(\Zend_Db_Select::ORDER)); /* Direct access to select object is available and many places are using it for sort order declaration */ $select->order('select_field', \Magento\Data\Collection::SORT_ORDER_ASC); - $this->_collection->addOrder('some_field', \Magento\Data\Collection::SORT_ORDER_ASC); - $this->_collection->setOrder('other_field', \Magento\Data\Collection::SORT_ORDER_ASC); - $this->_collection->addOrder('other_field', \Magento\Data\Collection::SORT_ORDER_DESC); + $this->collection->addOrder('some_field', \Magento\Data\Collection::SORT_ORDER_ASC); + $this->collection->setOrder('other_field', \Magento\Data\Collection::SORT_ORDER_ASC); + $this->collection->addOrder('other_field', \Magento\Data\Collection::SORT_ORDER_DESC); - $this->_collection->load(); + $this->collection->load(); $selectOrders = $select->getPart(\Zend_Db_Select::ORDER); $this->assertEquals(array('select_field', 'ASC'), array_shift($selectOrders)); $this->assertEquals('some_field ASC', (string)array_shift($selectOrders)); @@ -87,12 +110,12 @@ class DbTest extends \PHPUnit_Framework_TestCase */ public function testUnshiftOrder($adapter) { - $this->_collection->setConnection($adapter); - $this->_collection->addOrder('some_field', \Magento\Data\Collection::SORT_ORDER_ASC); - $this->_collection->unshiftOrder('other_field', \Magento\Data\Collection::SORT_ORDER_ASC); + $this->collection->setConnection($adapter); + $this->collection->addOrder('some_field', \Magento\Data\Collection::SORT_ORDER_ASC); + $this->collection->unshiftOrder('other_field', \Magento\Data\Collection::SORT_ORDER_ASC); - $this->_collection->load(); - $selectOrders = $this->_collection->getSelect()->getPart(\Zend_Db_Select::ORDER); + $this->collection->load(); + $selectOrders = $this->collection->getSelect()->getPart(\Zend_Db_Select::ORDER); $this->assertEquals('other_field ASC', (string)array_shift($selectOrders)); $this->assertEquals('some_field ASC', (string)array_shift($selectOrders)); $this->assertEmpty(array_shift($selectOrders)); @@ -114,10 +137,10 @@ class DbTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue('is_imported = 1') ); - $this->_collection->setConnection($adapter); - $select = $this->_collection->getSelect()->from('test'); + $this->collection->setConnection($adapter); + $select = $this->collection->getSelect()->from('test'); - $this->_collection->addFieldToFilter('is_imported', array('eq' => '1')); + $this->collection->addFieldToFilter('is_imported', array('eq' => '1')); $this->assertEquals('SELECT `test`.* FROM `test` WHERE (is_imported = 1)', $select->assemble()); } @@ -148,10 +171,10 @@ class DbTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue("name like 'M%'") ); - $this->_collection->setConnection($adapter); - $select = $this->_collection->getSelect()->from("test"); + $this->collection->setConnection($adapter); + $select = $this->collection->getSelect()->from("test"); - $this->_collection->addFieldToFilter( + $this->collection->addFieldToFilter( array('weight', 'name'), array(array('in' => array(1, 3)), array('like' => 'M%')) ); @@ -172,7 +195,7 @@ class DbTest extends \PHPUnit_Framework_TestCase $this->returnValue('is_imported = 1') ); - $this->_collection->addFieldToFilter('is_imported', array('eq' => '1')); + $this->collection->addFieldToFilter('is_imported', array('eq' => '1')); $this->assertEquals( "SELECT `test`.* FROM `test` WHERE ((weight in (1, 3)) OR (name like 'M%')) AND (is_imported = 1)", $select->assemble() @@ -202,10 +225,10 @@ class DbTest extends \PHPUnit_Framework_TestCase $this->returnValue('email LIKE \'%value?%\'') ); $adapter->expects($this->once())->method('select')->will($this->returnValue(new \Magento\DB\Select($adapter))); - $this->_collection->setConnection($adapter); + $this->collection->setConnection($adapter); - $select = $this->_collection->getSelect()->from('test'); - $this->_collection->addFieldToFilter('email', array('like' => 'value?')); + $select = $this->collection->getSelect()->from('test'); + $this->collection->addFieldToFilter('email', array('like' => 'value?')); $this->assertEquals("SELECT `test`.* FROM `test` WHERE (email LIKE '%value?%')", $select->assemble()); } @@ -240,10 +263,10 @@ class DbTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue('`email` = "foo@example.com"') ); - $this->_collection->setConnection($adapter); - $select = $this->_collection->getSelect()->from('test'); + $this->collection->setConnection($adapter); + $select = $this->collection->getSelect()->from('test'); - $this->_collection->addFieldToFilter('email', array('eq' => 'foo@example.com')); + $this->collection->addFieldToFilter('email', array('eq' => 'foo@example.com')); $this->assertEquals('SELECT `test`.* FROM `test` WHERE (`email` = "foo@example.com")', $select->assemble()); } @@ -256,15 +279,15 @@ class DbTest extends \PHPUnit_Framework_TestCase public function testClone() { $adapter = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', array(), '', false); - $this->_collection->setConnection($adapter); - $this->assertInstanceOf('Zend_Db_Select', $this->_collection->getSelect()); + $this->collection->setConnection($adapter); + $this->assertInstanceOf('Zend_Db_Select', $this->collection->getSelect()); - $clonedCollection = clone $this->_collection; + $clonedCollection = clone $this->collection; $this->assertInstanceOf('Zend_Db_Select', $clonedCollection->getSelect()); $this->assertNotSame( $clonedCollection->getSelect(), - $this->_collection->getSelect(), + $this->collection->getSelect(), 'Collection was cloned but $this->_select in both initial and cloned collections reference the same object' ); } @@ -280,8 +303,8 @@ class DbTest extends \PHPUnit_Framework_TestCase public function testPrintLogQueryPrinting($printQuery, $printFlag, $query, $expected) { $this->expectOutputString($expected); - $this->_collection->setFlag('print_query', $printFlag); - $this->_collection->printLogQuery($printQuery, false, $query); + $this->collection->setFlag('print_query', $printFlag); + $this->collection->printLogQuery($printQuery, false, $query); } public function printLogQueryPrintingDataProvider() @@ -302,21 +325,238 @@ class DbTest extends \PHPUnit_Framework_TestCase */ public function testPrintLogQueryLogging($logQuery, $logFlag, $expectedCalls) { - $fetchStrategy = $this->getMock('Magento\Data\Collection\Db\FetchStrategyInterface'); - $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - $collection = $this->getMock( - 'Magento\Data\Collection\Db', - array('_logQuery'), - array($entityFactory, $logger, $fetchStrategy) - ); - $collection->setFlag('log_query', $logFlag); - $collection->expects($this->exactly($expectedCalls))->method('_logQuery'); - $collection->printLogQuery(false, $logQuery, 'some_query'); + $this->collection->setFlag('log_query', $logFlag); + $this->loggerMock->expects($this->exactly($expectedCalls))->method('log'); + $this->collection->printLogQuery(false, $logQuery, 'some_query'); } public function printLogQueryLoggingDataProvider() { - return array(array(true, false, 1), array(false, true, 1), array(false, false, 0)); + return array( + array(true, false, 1), + array(false, true, 1), + array(false, false, 0), + ); + } + + /** + * @expectedException \Zend_Exception + * @expectedExceptionMessage dbModel read resource does not implement \Zend_Db_Adapter_Abstract + */ + public function testSetConnectionException() + { + $adapter = new \stdClass(); + $this->collection->setConnection($adapter); + } + + public function testFetchItem() + { + $data = array(1 => 'test'); + $counter = 0; + $statementMock = $this->getMock('Zend_Db_Statement_Pdo', array('fetch'), array(), '', false); + $statementMock->expects($this->exactly(2)) + ->method('fetch') + ->will($this->returnCallback(function () use (&$counter, $data) { + return ++$counter % 2 ? array() : $data; + })); + + $adapterMock = $this->getMock('Zend_Db_Adapter_Pdo_Mysql', + array('select', 'query'), array(), '', false); + $selectMock = $this->getMock( + 'Magento\DB\Select', array(), array('adapter' => $adapterMock) + ); + $adapterMock->expects($this->once()) + ->method('query') + ->with($selectMock, $this->anything()) + ->will($this->returnValue($statementMock)); + $adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $this->collection->setConnection($adapterMock); + $this->assertFalse($this->collection->fetchItem()); + + $objectMock = $this->getMock('Magento\Object', array('setData'), array()); + $objectMock->expects($this->once()) + ->method('setData') + ->with($data); + $this->entityFactoryMock->expects($this->once()) + ->method('create') + ->with('Magento\Object') + ->will($this->returnValue($objectMock)); + + $this->assertEquals($objectMock, $this->collection->fetchItem()); + } + + public function testGetSize() + { + $countSql = 500; + $adapterMock = $this->getMock( + 'Zend_Db_Adapter_Pdo_Mysql', + array('select', 'quoteInto', 'prepareSqlCondition', 'fetchOne'), + array(), + '', + false + ); + $selectMock = $this->getMock( + 'Magento\DB\Select', array('orWhere', 'where', 'reset', 'columns'), array('adapter' => $adapterMock) + ); + $selectMock->expects($this->exactly(4)) + ->method('reset'); + $selectMock->expects($this->once()) + ->method('columns') + ->with('COUNT(*)'); + $adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + $adapterMock->expects($this->exactly(2)) + ->method('quoteInto') + ->will($this->returnValueMap(array( + array('testField1=?', 'testValue1', null, null, 'testField1=testValue1'), + array('testField4=?', 'testValue4', null, null, 'testField4=testValue4'), + ))); + $selectMock->expects($this->once()) + ->method('orWhere') + ->with('testField1=testValue1'); + $selectMock->expects($this->exactly(3)) + ->method('where') + ->will($this->returnValueMap(array( + array('testValue2', $this->returnSelf()), + array('testField3 = testValue3', null, \Magento\DB\Select::TYPE_CONDITION, $this->returnSelf()), + array('testField4=testValue4', $this->returnSelf()), + ))); + $adapterMock->expects($this->once()) + ->method('prepareSqlCondition') + ->with('testField3', 'testValue3') + ->will($this->returnValue('testField3 = testValue3')); + $adapterMock->expects($this->once()) + ->method('fetchOne') + ->with($selectMock, array()) + ->will($this->returnValue($countSql)); + + $this->collection->addFilter('testField1', 'testValue1', 'or'); + $this->collection->addFilter('testField2', 'testValue2', 'string'); + $this->collection->addFilter('testField3', 'testValue3', 'public'); + $this->collection->addFilter('testField4', 'testValue4'); + $this->collection->setConnection($adapterMock); + $this->assertEquals($countSql, $this->collection->getSize()); + $this->assertEquals($countSql, $this->collection->getSize()); + } + + public function testGetSelectSql() + { + $adapterMock = $this->getMock('Zend_Db_Adapter_Pdo_Mysql', array('select'), array(), '', false); + $selectMock = $this->getMock( + 'Magento\DB\Select', array('__toString'), array('adapter' => $adapterMock) + ); + $adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $sql = 'query'; + $selectMock->expects($this->once()) + ->method('__toString') + ->will($this->returnValue($sql)); + + $this->collection->setConnection($adapterMock); + $this->assertEquals($sql, $this->collection->getSelectSql(true)); + $this->assertEquals($selectMock, $this->collection->getSelectSql()); + } + + public function testGetData() + { + $adapterMock = $this->getMock( + 'Zend_Db_Adapter_Pdo_Mysql', + array('select', 'quoteInto', 'prepareSqlCondition', 'fetchOne'), + array(), + '', + false + ); + $selectMock = $this->getMock( + 'Magento\DB\Select', array('orWhere', 'where', 'reset', 'columns'), array('adapter' => $adapterMock) + ); + $selectMock->expects($this->once()) + ->method('where') + ->with('aliasField3 = testValue3', null, \Magento\DB\Select::TYPE_CONDITION) + ->will($this->returnSelf()); + + $adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + $adapterMock->expects($this->once()) + ->method('prepareSqlCondition') + ->with('aliasField3', 'testValue3') + ->will($this->returnValue('aliasField3 = testValue3')); + + $this->collection->addFilter('testField3', 'testValue3', 'public'); + $this->collection->addFilterToMap('testFilter', 'testAlias', 'testGroup'); + $this->collection->addFilterToMap('testField3', 'aliasField3'); + + $this->collection->setConnection($adapterMock); + $this->assertNull($this->collection->getData()); + } + + /** + * @dataProvider distinctDataProvider + */ + public function testDistinct($flag, $expectedFlag) + { + $adapterMock = $this->getMock('Zend_Db_Adapter_Pdo_Mysql', array('select'), array(), '', false); + $selectMock = $this->getMock('Magento\DB\Select', array('distinct'), array('adapter' => $adapterMock)); + $adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + $selectMock->expects($this->once()) + ->method('distinct') + ->with($expectedFlag); + + $this->collection->setConnection($adapterMock); + $this->collection->distinct($flag); + } + + public function distinctDataProvider() + { + return array( + array(true, true), + array(false, false), + ); + } + + public function testToOptionHash() + { + $data = array(10 => 'test'); + $adapterMock = $this->getMock('Zend_Db_Adapter_Pdo_Mysql', + array('select', 'query'), array(), '', false); + $selectMock = $this->getMock( + 'Magento\DB\Select', array(), array('adapter' => $adapterMock) + ); + $adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $this->fetchStrategyMock->expects($this->once()) + ->method('fetchAll') + ->with($selectMock, array()) + ->will($this->returnValue(array($data))); + + $objectMock = $this->getMock('Magento\Object', array('addData', 'setIdFieldName', 'getData'), array()); + $objectMock->expects($this->once()) + ->method('addData') + ->with($data); + $objectMock->expects($this->any()) + ->method('getData') + ->will($this->returnValueMap(array( + array(null, null, 10), + array('name', null, 'test'), + ))); + $this->entityFactoryMock->expects($this->once()) + ->method('create') + ->with('Magento\Object') + ->will($this->returnValue($objectMock)); + + $this->collection->setConnection($adapterMock); + $this->collection->loadData(false, false); + $this->collection->loadData(false, false); + $this->assertEquals($data, $this->collection->toOptionHash()); } } diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Helper/DataTest.php index eb7c49c8f19..8cb2d01af1e 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Helper/DataTest.php @@ -100,13 +100,4 @@ class DataTest extends \PHPUnit_Framework_TestCase ); $this->assertEquals($this->_disabledCacheTypes, $this->_model->getDisabledCacheTypes()); } - - public function testGetAvailableModes() - { - $this->_model = new \Magento\DesignEditor\Helper\Data($this->_context, self::TEST_FRONT_NAME); - $this->assertEquals( - array(\Magento\DesignEditor\Model\State::MODE_NAVIGATION), - $this->_model->getAvailableModes() - ); - } } diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php index d21384fa413..099fd826672 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php @@ -102,9 +102,9 @@ class StateTest extends \PHPUnit_Framework_TestCase protected $_objectManager; /** - * @var \Magento\Core\Model\App|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $_application; + protected $_configMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -161,13 +161,8 @@ class StateTest extends \PHPUnit_Framework_TestCase ); $this->_objectManager = $this->getMock('Magento\ObjectManager'); - $this->_application = $this->getMock( - 'Magento\Core\Model\App', - array('getStore', 'getConfig'), - array(), - '', - false - ); + $this->_application = $this->getMock('Magento\Core\Model\App', array('getStore', 'getConfig'), + array(), '', false); $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array('setConfig'), array(), '', false); $storeManager->expects( @@ -181,19 +176,14 @@ class StateTest extends \PHPUnit_Framework_TestCase $this->returnSelf() ); - $configMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); - $configMock->expects( - $this->any() - )->method( - 'setNode' - )->with( - $this->equalTo('default/' . \Magento\View\DesignInterface::XML_PATH_THEME_ID), - $this->equalTo(self::THEME_ID) - )->will( - $this->returnSelf() - ); - - $this->_application->expects($this->any())->method('getConfig')->will($this->returnValue($configMock)); + $this->_configMock = $this->getMock('Magento\App\ConfigInterface'); + $this->_configMock->expects($this->any()) + ->method('setNode') + ->with( + $this->equalTo('default/' . \Magento\View\DesignInterface::XML_PATH_THEME_ID), + $this->equalTo(self::THEME_ID) + ) + ->will($this->returnSelf()); $this->_theme = $this->getMock('Magento\Core\Model\Theme', array('getId', '__wakeup'), array(), '', false); $this->_theme->expects($this->any())->method('getId')->will($this->returnValue(self::THEME_ID)); @@ -220,7 +210,7 @@ class StateTest extends \PHPUnit_Framework_TestCase $this->_cacheStateMock, $this->_dataHelper, $this->_objectManager, - $this->_application, + $this->_configMock, $this->_themeContext, $storeManager ); diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Theme/ContextTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Theme/ContextTest.php index 7ebe277f7b3..5bb4ace7095 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Theme/ContextTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Theme/ContextTest.php @@ -112,7 +112,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Wrong theme type set as editable */ public function testSetEditableThemeByIdWrongType() @@ -141,7 +141,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage We can't find theme "1". */ public function testSetEditableThemeByIdWrongThemeId() @@ -171,7 +171,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Theme has not been set */ public function testGetEditableThemeNotSet() @@ -214,7 +214,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Theme "" is not editable. */ public function testGetStagingThemeWrongType() diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Translate/Inline/ProviderTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Translate/Inline/ProviderTest.php new file mode 100644 index 00000000000..99ba875304b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Translate/Inline/ProviderTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\DesignEditor\Model\Translate\Inline; + +class ProviderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\DesignEditor\Model\Translate\Inline + */ + protected $translateVde; + + /** + * @var \Magento\Translate\Inline + */ + protected $translateInline; + + /** + * @var \Magento\App\RequestInterface + */ + protected $request; + + protected function setUp() + { + $this->translateVde = $this->getMock('Magento\DesignEditor\Model\Translate\Inline', [], [], '', false); + $this->translateInline = $this->getMock('Magento\Translate\Inline', [], [], '', false); + $this->request = $this->getMock('Magento\App\RequestInterface', [], [], '', false); + } + + /** + * @param bool $isVde + * @param string $instanceName + * + * @dataProvider dataProviderGet + */ + public function testGet($isVde, $instanceName) + { + $helper = $this->getMock('Magento\DesignEditor\Helper\Data', [], [], '', false); + $helper->expects($this->once()) + ->method('isVdeRequest') + ->will($this->returnValue($isVde)); + + $provider = new \Magento\DesignEditor\Model\Translate\Inline\Provider( + $this->translateVde, + $this->translateInline, + $helper, + $this->request + ); + + $this->assertInstanceOf($instanceName, $provider->get()); + } + + /** + * @return array + */ + public function dataProviderGet() + { + return [ + [false, 'Magento\Translate\Inline'], + [true, 'Magento\DesignEditor\Model\Translate\Inline'], + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php index f3fd794bbcf..2e072289586 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php @@ -150,7 +150,6 @@ class NavigationModeTest extends \PHPUnit_Framework_TestCase self::ROUTE_PATH; $this->assertEquals($expectedUrl, $this->_model->getRouteUrl($sourceUrl)); - $this->assertEquals($this->_model, $this->_model->setType(null)); $this->assertEquals($expectedUrl, $this->_model->getRouteUrl($expectedUrl)); } } diff --git a/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php b/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php index 3d1ce80c122..4a833874ddf 100644 --- a/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php +++ b/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php @@ -209,7 +209,7 @@ class CarrierTest extends \PHPUnit_Framework_TestCase /** * @dataProvider prepareShippingLabelContentExceptionDataProvider - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Unable to retrieve shipping label */ public function testPrepareShippingLabelContentException(\SimpleXMLElement $xml) diff --git a/dev/tests/unit/testsuite/Magento/Directory/Model/Currency/DefaultLocatorTest.php b/dev/tests/unit/testsuite/Magento/Directory/Model/Currency/DefaultLocatorTest.php index fb015b05dc2..85fec4ab450 100644 --- a/dev/tests/unit/testsuite/Magento/Directory/Model/Currency/DefaultLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Directory/Model/Currency/DefaultLocatorTest.php @@ -36,7 +36,7 @@ class DefaultLocatorTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_appMock; + protected $_configMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -51,32 +51,19 @@ class DefaultLocatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $backendData = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false); - $this->_requestMock = $this->getMockForAbstractClass( - 'Magento\App\RequestInterface', - array($backendData), - '', - false, - false, - true, - array('getParam') - ); - $this->_appMock = $this->getMock('Magento\Core\Model\App', array(), array(), '', false); + $this->_requestMock = $this->getMockForAbstractClass('Magento\App\RequestInterface', + array($backendData), '', false, false, true, array('getParam')); + $this->_configMock = $this->getMock('\Magento\App\ConfigInterface'); $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); $this->_model = new \Magento\Directory\Model\Currency\DefaultLocator( - $this->_appMock, - $this->_storeManagerMock + $this->_configMock, $this->_storeManagerMock ); } public function testGetDefaultCurrencyReturnDefaultStoreDefaultCurrencyIfNoStoreIsSpecified() { - $this->_appMock->expects( - $this->once() - )->method( - 'getBaseCurrencyCode' - )->will( - $this->returnValue('storeCurrency') - ); + $this->_configMock->expects($this->once())->method('getValue') + ->will($this->returnValue('storeCurrency')); $this->assertEquals('storeCurrency', $this->_model->getDefaultCurrency($this->_requestMock)); } diff --git a/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php index 97fbae87205..038e8abd6ef 100644 --- a/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php @@ -39,8 +39,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $select = $this->getMock('Zend_Db_Select', array(), array(), '', false); $connection->expects($this->once())->method('select')->will($this->returnValue($select)); - $resource = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', + $resource = $this->getMockForAbstractClass('Magento\Model\Resource\Db\AbstractDb', array(), '', false, diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php index d946efdb96a..15d2e90b82c 100644 --- a/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php @@ -100,7 +100,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @exectedExceptionMessage Please set resource file and link type. */ public function testGetFileSizeNoResource() @@ -109,7 +109,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Invalid download link type. */ public function testGetFileSizeInvalidLinkType() @@ -131,7 +131,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Invalid download link type. */ public function testGetFileSizeNoFile() diff --git a/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php new file mode 100644 index 00000000000..e0ea91910b9 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php @@ -0,0 +1,79 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Eav\Helper; + +class DataTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Eav\Helper\Data + */ + protected $_helper; + + /** + * @var \Magento\Eav\Model\Config + */ + protected $_eavConfig; + + /** + * Initialize helper + */ + protected function setUp() + { + $context = $this->getMock('\Magento\App\Helper\Context', [], [], '', false); + $attributeConfig = $this->getMock('\Magento\Eav\Model\Entity\Attribute\Config', [], [], '', false); + $coreStoreConfig = $this->getMock('\Magento\Core\Model\Store\Config', [], [], '', false); + $eavConfig = $this->getMock('\Magento\Eav\Model\Config', [], [], '', false); + $this->_helper = new Data($context, $attributeConfig, $coreStoreConfig, $eavConfig); + $this->_eavConfig = $eavConfig; + } + + public function testGetAttributeMetadata() + { + $attribute = new \Magento\Object([ + 'entity_type_id' => '1', + 'attribute_id' => '2', + 'backend' => new \Magento\Object(['table' => 'customer_entity_varchar']), + 'backend_type' => 'varchar' + ]); + $this->_eavConfig->expects($this->once()) + ->method('getAttribute') + ->will($this->returnValue($attribute)); + + $result = $this->_helper->getAttributeMetadata('customer', 'lastname'); + $expected = [ + 'entity_type_id' => '1', + 'attribute_id' => '2', + 'attribute_table' => 'customer_entity_varchar', + 'backend_type' => 'varchar' + ]; + + foreach ($result as $key => $value) { + $this->assertArrayHasKey($key, $expected, 'Attribute metadata with key "' . $key . '" not found.'); + $this->assertEquals($expected[$key], $value, + 'Attribute metadata with key "' . $key . '" has invalid value.' + ); + } + } +} diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/TypeTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/TypeTest.php index 25778858bf1..24c4bf24d25 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/TypeTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/TypeTest.php @@ -98,7 +98,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase false ); $this->resourceMock = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', + 'Magento\Model\Resource\Db\AbstractDb', array(), '', false, diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php index ecbaf5c0d92..a7b7e1753aa 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php @@ -66,7 +66,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase protected $connectionMock; /** - * @var \Magento\Core\Model\Resource\Db\AbstractDb|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Model\Resource\Db\AbstractDb|\PHPUnit_Framework_MockObject_MockObject */ protected $resourceMock; @@ -103,12 +103,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase ); $this->connectionMock = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false); $this->resourceMock = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', - array(), - '', - false, - true, - true, + 'Magento\Model\Resource\Db\AbstractDb', array(), '', false, true, true, array('__wakeup', 'getReadConnection', 'getMainTable', 'getTable') ); $this->selectMock = $this->getMock('Zend_Db_Select', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php index f51a7f48367..a5410faa5f3 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php @@ -53,10 +53,10 @@ class AttributeTest extends \PHPUnit_Framework_TestCase ); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - /** @var $model \Magento\Core\Model\AbstractModel */ - $arguments = $objectManagerHelper->getConstructArguments('Magento\Core\Model\AbstractModel'); + /** @var $model \Magento\Model\AbstractModel */ + $arguments = $objectManagerHelper->getConstructArguments('Magento\Model\AbstractModel'); $arguments['data'] = $attributeData; - $model = $this->getMock('Magento\Core\Model\AbstractModel', null, $arguments); + $model = $this->getMock('Magento\Model\AbstractModel', null, $arguments); $model->setDefault(array('2')); $model->setOption(array('delete' => array(1 => '', 2 => ''))); @@ -122,10 +122,10 @@ class AttributeTest extends \PHPUnit_Framework_TestCase $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - /** @var $model \Magento\Core\Model\AbstractModel */ - $arguments = $objectManagerHelper->getConstructArguments('Magento\Core\Model\AbstractModel'); + /** @var $model \Magento\Model\AbstractModel */ + $arguments = $objectManagerHelper->getConstructArguments('Magento\Model\AbstractModel'); $arguments['data'] = $attributeData; - $model = $this->getMock('Magento\Core\Model\AbstractModel', null, $arguments); + $model = $this->getMock('Magento\Model\AbstractModel', null, $arguments); $model->setOption(array('value' => array('option_1' => array('Backend Label', 'Frontend Label')))); $adapter->expects( @@ -202,9 +202,9 @@ class AttributeTest extends \PHPUnit_Framework_TestCase list($adapter, $resourceModel) = $this->_prepareResourceModel(); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - /** @var $model \Magento\Core\Model\AbstractModel */ - $arguments = $objectManagerHelper->getConstructArguments('Magento\Core\Model\AbstractModel'); - $model = $this->getMock('Magento\Core\Model\AbstractModel', null, $arguments); + /** @var $model \Magento\Model\AbstractModel */ + $arguments = $objectManagerHelper->getConstructArguments('Magento\Model\AbstractModel'); + $model = $this->getMock('Magento\Model\AbstractModel', null, $arguments); $model->setOption('not-an-array'); $adapter->expects($this->once())->method('insert')->with('eav_attribute'); diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php index 25d298ffb37..df07544e90f 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php @@ -453,7 +453,7 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function _getEntityMock() { $entity = $this->getMockBuilder( - 'Magento\Core\Model\AbstractModel' + 'Magento\Model\AbstractModel' )->setMethods( array('getAttribute', 'getResource', 'getEntityType', '__wakeup') )->disableOriginalConstructor()->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Event/ManagerStub.php b/dev/tests/unit/testsuite/Magento/Event/ManagerStub.php index 5ebf59e6e33..ee46156751c 100644 --- a/dev/tests/unit/testsuite/Magento/Event/ManagerStub.php +++ b/dev/tests/unit/testsuite/Magento/Event/ManagerStub.php @@ -27,14 +27,14 @@ */ namespace Magento\Event; -class ManagerStub extends \Magento\Event\ManagerInterface +class ManagerStub implements \Magento\Event\ManagerInterface { /** * Stub dispatch event * * @param string $eventName * @param array $params - * @return \Magento\Core\Model\App|null + * @return null */ public function dispatch($eventName, array $params = array()) { diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php index 5ddbc9c3edc..510695442b7 100644 --- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php @@ -63,6 +63,23 @@ class GroupedTest extends \PHPUnit_Framework_TestCase false ); + $customerMock = $this->getMockBuilder('\Magento\Customer\Service\V1\Data\Customer') + ->disableOriginalConstructor() + ->getMock(); + $customerMock + ->expects($this->any()) + ->method('getId') + ->will($this->returnValue(1)); + + $priceHelperMock = $this->getMockBuilder('Magento\Catalog\Helper\Product\Price') + ->disableOriginalConstructor() + ->getMock(); + + $priceHelperMock + ->expects($this->any()) + ->method('getCustomer') + ->will($this->returnValue($customerMock)); + $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->block = $objectHelper->getObject( 'Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped', @@ -70,6 +87,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase 'registry' => $this->registryMock, 'storeManager' => $this->storeManagerMock, 'coreHelper' => $this->coreHelperMock, + 'priceHelper' => $priceHelperMock, 'data' => array('product' => $this->productMock) ) ); 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 368abf34407..90ca94e4a1c 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 @@ -127,9 +127,9 @@ class AbstractEavTest extends \PHPUnit_Framework_TestCase $this->returnValue($testAttributeOptions) ); - /** @var $item \Magento\Core\Model\AbstractModel|\PHPUnit_Framework_MockObject_MockObject */ + /** @var $item \Magento\Model\AbstractModel|\PHPUnit_Framework_MockObject_MockObject */ $item = $this->getMockForAbstractClass( - 'Magento\Core\Model\AbstractModel', + 'Magento\Model\AbstractModel', array(), '', false, diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php index 644dd5dc505..ea366593f75 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php @@ -292,9 +292,9 @@ class AddressTest extends \PHPUnit_Framework_TestCase $this->_model->setWriter($writer); $this->_model->setParameters(array()); - $arguments = $this->_objectManager->getConstructArguments('Magento\Core\Model\AbstractModel'); + $arguments = $this->_objectManager->getConstructArguments('Magento\Model\AbstractModel'); $arguments['data'] = $this->_addressData; - $item = $this->getMockForAbstractClass('Magento\Core\Model\AbstractModel', $arguments); + $item = $this->getMockForAbstractClass('Magento\Model\AbstractModel', $arguments); $this->_model->exportItem($item); } diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php index d76fb1b559d..bf67facee9e 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php @@ -231,9 +231,9 @@ class CustomerTest extends \PHPUnit_Framework_TestCase $this->_model->setWriter($writer); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $arguments = $objectManagerHelper->getConstructArguments('Magento\Core\Model\AbstractModel'); + $arguments = $objectManagerHelper->getConstructArguments('Magento\Model\AbstractModel'); $arguments['data'] = $this->_customerData; - $item = $this->getMockForAbstractClass('Magento\Core\Model\AbstractModel', $arguments); + $item = $this->getMockForAbstractClass('Magento\Model\AbstractModel', $arguments); $this->_model->exportItem($item); } diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/AbstractTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/AbstractTest.php index 35e4bd98895..e3c867d54e8 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/AbstractTest.php @@ -89,7 +89,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\Entity\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Columns number: "1" have empty headers */ public function testValidateDataEmptyColumnName() @@ -102,7 +102,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\Entity\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Columns number: "1" have empty headers */ public function testValidateDataColumnNameWithWhitespaces() @@ -115,7 +115,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\Entity\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Column names: "_test1" are invalid */ public function testValidateDataAttributeNames() 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 0f35918a39a..764ba955bf4 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 @@ -111,12 +111,11 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $translateInline = $this->getMock('\Magento\Translate\InlineInterface', array(), array(), '', false); $translateInline->expects($this->any())->method('isAllowed')->will($this->returnValue(false)); - $inlineFactory = $this->getMock('\Magento\Translate\InlineFactory', array(), array(), '', false); - $inlineFactory->expects($this->any())->method('get')->will($this->returnValue($translateInline)); - $context = $this->getMock('Magento\App\Helper\Context', array('getInlineFactory'), array(), '', false); - $context->expects($this->any())->method('getInlineFactory')->will($this->returnValue($inlineFactory)); + + $context = $this->getMock('Magento\App\Helper\Context', array('getTranslateInline'), array(), '', false); + $context->expects($this->any())->method('getTranslateInline')->will($this->returnValue($translateInline)); + $data = array( - 'inlineFactory' => $inlineFactory, 'context' => $context, 'locale' => $this->getMock('Magento\Locale', array(), array(), '', false), 'dateModel' => $this->getMock('Magento\Stdlib\DateTime\DateTime', array(), array(), '', false) diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php index 29500ee2d17..ba159e44482 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php @@ -70,7 +70,7 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase protected $_resourceHelper; /** - * @var \Magento\Core\Model\App + * @var \Magento\Core\Model\StoreManagerInterface */ protected $_storeManager; diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php index 263118634b9..5f60c0b1ad5 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php @@ -550,7 +550,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateDataPermanentAttributes() { @@ -569,7 +569,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateDataEmptyColumnName() { @@ -581,7 +581,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateDataColumnNameWithWhitespaces() { @@ -593,7 +593,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateDataAttributeNames() { diff --git a/dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php b/dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php index 5b11219519e..be7f77d8e6d 100644 --- a/dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php +++ b/dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php @@ -119,7 +119,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase ); $resource = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', + 'Magento\Model\Resource\Db\AbstractDb', array(), '', false, diff --git a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php index 8598069d3de..e6332dab15f 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php +++ b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php @@ -42,14 +42,14 @@ class Mysql4Test extends \PHPUnit_Framework_TestCase $connectionMock->expects($this->once())->method('fetchPairs')->will($this->returnValue($supportedEngines)); $adapterFactory = $this->getMock( - 'Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory', + 'Magento\Model\Resource\Type\Db\Pdo\MysqlFactory', array('create'), array(), '', false ); $adapterMock = $this->getMock( - 'Magento\Core\Model\Resource\Type\Db\Pdo\Mysql', + 'Magento\Model\Resource\Type\Db\Pdo\Mysql', array('getConnection'), array(), '', @@ -87,7 +87,7 @@ class Mysql4Test extends \PHPUnit_Framework_TestCase public function testGetRequiredExtensions($config, $dbExtensions, $expectedResult) { $adapterFactory = $this->getMock( - 'Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory', + 'Magento\Model\Resource\Type\Db\Pdo\MysqlFactory', array('create'), array(), '', 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 27974606b70..54e7b92e0b8 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php @@ -44,9 +44,6 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase /** @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; @@ -117,15 +114,9 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase 'Magento\ObjectManager' )->disableOriginalConstructor()->getMock(); // Initialize mocks which are used in several test cases - $this->_appMock = $this->getMockBuilder( - 'Magento\Core\Model\App' - )->setMethods( - array('getConfig') - )->disableOriginalConstructor()->getMock(); $this->_configMock = $this->getMockBuilder( 'Magento\App\ConfigInterface' )->disableOriginalConstructor()->getMock(); - $this->_appMock->expects($this->any())->method('getConfig')->will($this->returnValue($this->_configMock)); $this->_eventManagerMock = $this->getMockBuilder( 'Magento\Event\ManagerInterface' )->disableOriginalConstructor()->getMock(); @@ -336,7 +327,7 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase )->with( self::INTEGRATION_ID )->will( - $this->throwException(new \Magento\Core\Exception($exceptionMessage)) + $this->throwException(new \Magento\Model\Exception($exceptionMessage)) ); // Verify error $this->_messageManager->expects($this->once())->method('addError')->with($this->equalTo($exceptionMessage)); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/AbstractModelTest.php b/dev/tests/unit/testsuite/Magento/Model/AbstractModelTest.php similarity index 75% rename from dev/tests/unit/testsuite/Magento/Core/Model/AbstractModelTest.php rename to dev/tests/unit/testsuite/Magento/Model/AbstractModelTest.php index 4df9a387ac3..509508ae03b 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/AbstractModelTest.php +++ b/dev/tests/unit/testsuite/Magento/Model/AbstractModelTest.php @@ -22,27 +22,27 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Model; class AbstractModelTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\AbstractModel + * @var \Magento\Model\AbstractModel */ protected $model; /** - * @var \Magento\Core\Model\Context|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Model\Context|\PHPUnit_Framework_MockObject_MockObject */ protected $contextMock; /** - * @var \Magento\Core\Model\Registry|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Registry|\PHPUnit_Framework_MockObject_MockObject */ protected $registryMock; /** - * @var \Magento\Core\Model\Resource\Db\AbstractDb|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Model\Resource\Db\AbstractDb|\PHPUnit_Framework_MockObject_MockObject */ protected $resourceMock; @@ -56,18 +56,26 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase */ protected $adapterMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $actionValidatorMock; + protected function setUp() { - + $this->actionValidatorMock = $this->getMock( + '\Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false + ); $this->contextMock = new \Magento\Model\Context( $this->getMock('Magento\Logger', array(), array(), '', false), $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), $this->getMock('Magento\App\CacheInterface', array(), array(), '', false), - $this->getMock('Magento\App\State', array(), array(), '', false) + $this->getMock('Magento\App\State', array(), array(), '', false), + $this->actionValidatorMock ); $this->registryMock = $this->getMock('Magento\Registry', array(), array(), '', false); $this->resourceMock = $this->getMock( - 'Magento\Core\Model\Resource\Db\AbstractDb', + 'Magento\Model\Resource\Db\AbstractDb', array( '_construct', '_getReadAdapter', @@ -84,7 +92,7 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase ); $this->resourceCollectionMock = $this->getMock('Magento\Data\Collection\Db', array(), array(), '', false); $this->model = $this->getMockForAbstractClass( - 'Magento\Core\Model\AbstractModel', + 'Magento\Model\AbstractModel', array($this->contextMock, $this->registryMock, $this->resourceMock, $this->resourceCollectionMock) ); $this->adapterMock = $this->getMock('Magento\DB\Adapter\AdapterInterface', array(), array(), '', false); @@ -98,6 +106,7 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase public function testDelete() { + $this->actionValidatorMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); $this->adapterMock->expects($this->once()) ->method('beginTransaction'); $this->resourceMock->expects($this->once()) @@ -113,6 +122,7 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase */ public function testDeleteRaiseException() { + $this->actionValidatorMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); $this->adapterMock->expects($this->once()) ->method('beginTransaction'); $this->resourceMock->expects($this->once()) @@ -124,5 +134,14 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase ->method('rollBack'); $this->model->delete(); } + + /** + * @expectedException \Magento\Model\Exception + * @expectedExceptionMessage Delete operation is forbidden for current area + */ + public function testDeleteOnModelThatCanNotBeRemoved() + { + $this->actionValidatorMock->expects($this->any())->method('isAllowed')->will($this->returnValue(false)); + $this->model->delete(); + } } - \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Model/ActionValidator/RemoveActionTest.php b/dev/tests/unit/testsuite/Magento/Model/ActionValidator/RemoveActionTest.php new file mode 100644 index 00000000000..31f42b0eb42 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Model/ActionValidator/RemoveActionTest.php @@ -0,0 +1,77 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Model\ActionValidator; + +class RemoveActionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param \PHPUnit_Framework_MockObject_MockObject $modelToCheck + * @param string $protectedModel + * @param bool $secureArea + * @param bool $expectedResult + * + * @dataProvider isAllowedDataProvider + * @covers \Magento\Model\ActionValidator\RemoveAction::isAllowed + * @covers \Magento\Model\ActionValidator\RemoveAction::getBaseClassName + */ + public function testIsAllowed($modelToCheck, $protectedModel, $secureArea, $expectedResult) + { + $registryMock = $this->getMock('\Magento\Registry', array(), array(), '', false); + $registryMock->expects($this->once()) + ->method('registry')->with('isSecureArea')->will($this->returnValue($secureArea)); + + $model = new \Magento\Model\ActionValidator\RemoveAction($registryMock, array('class' => $protectedModel)); + $this->assertEquals($expectedResult, $model->isAllowed($modelToCheck)); + } + + /** + * return array + */ + public function isAllowedDataProvider() + { + $productMock = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false); + $bannerMock = $this->getMock('\Magento\Wishlist\Model\Wishlist', array(), array(), '', false); + + return array( + array( + 'modelToCheck' => $productMock, + 'protectedModel' => 'Model', + 'secureArea' => false, + 'expectedResult' => true + ), + array( + 'modelToCheck' => $bannerMock, + 'protectedModel' => get_class($bannerMock), + 'secureArea' => false, + 'expectedResult' => false + ), + array( + 'modelToCheck' => $bannerMock, + 'protectedModel' => get_class($bannerMock), + 'secureArea' => true, + 'expectedResult' => true + ), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Mview/Config/Data/ProxyTest.php b/dev/tests/unit/testsuite/Magento/Mview/Config/Data/ProxyTest.php new file mode 100644 index 00000000000..f78c37a9cd0 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Mview/Config/Data/ProxyTest.php @@ -0,0 +1,130 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Mview\Config\Data; + +class ProxyTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Mview\Config\Data\Proxy + */ + protected $model; + + /** + * @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + + /** + * @var \Magento\Mview\Config\Data|\PHPUnit_Framework_MockObject_MockObject + */ + protected $dataMock; + + protected function setUp() + { + $this->objectManagerMock = $this->getMock( + 'Magento\ObjectManager', array(), array(), '', false + ); + $this->dataMock = $this->getMock( + 'Magento\Mview\Config\Data', array(), array(), '', false + ); + } + + public function testMergeShared() + { + $this->objectManagerMock->expects($this->once()) + ->method('get') + ->with('Magento\Mview\Config\Data') + ->will($this->returnValue($this->dataMock)); + $this->dataMock->expects($this->once()) + ->method('merge') + ->with(['some_config']); + + $this->model = new Proxy( + $this->objectManagerMock, + 'Magento\Mview\Config\Data', + true + ); + + $this->model->merge(['some_config']); + } + + public function testMergeNonShared() + { + $this->objectManagerMock->expects($this->once()) + ->method('create') + ->with('Magento\Mview\Config\Data') + ->will($this->returnValue($this->dataMock)); + $this->dataMock->expects($this->once()) + ->method('merge') + ->with(['some_config']); + + $this->model = new Proxy( + $this->objectManagerMock, + 'Magento\Mview\Config\Data', + false + ); + + $this->model->merge(['some_config']); + } + + public function testGetShared() + { + $this->objectManagerMock->expects($this->once()) + ->method('get') + ->with('Magento\Mview\Config\Data') + ->will($this->returnValue($this->dataMock)); + $this->dataMock->expects($this->once()) + ->method('get') + ->with('some_path', 'default') + ->will($this->returnValue('some_value')); + + $this->model = new Proxy( + $this->objectManagerMock, + 'Magento\Mview\Config\Data', + true + ); + + $this->assertEquals('some_value', $this->model->get('some_path', 'default')); + } + + public function testGetNonShared() + { + $this->objectManagerMock->expects($this->once()) + ->method('create') + ->with('Magento\Mview\Config\Data') + ->will($this->returnValue($this->dataMock)); + $this->dataMock->expects($this->once()) + ->method('get') + ->with('some_path', 'default') + ->will($this->returnValue('some_value')); + + $this->model = new Proxy( + $this->objectManagerMock, + 'Magento\Mview\Config\Data', + false + ); + + $this->assertEquals('some_value', $this->model->get('some_path', 'default')); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Translate/Inline/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Mview/ConfigTest.php similarity index 50% rename from dev/tests/unit/testsuite/Magento/Core/Model/Translate/Inline/ConfigTest.php rename to dev/tests/unit/testsuite/Magento/Mview/ConfigTest.php index 674afdf6cf8..c84d1aed64a 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Translate/Inline/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Mview/ConfigTest.php @@ -17,37 +17,48 @@ * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @subpackage unit_tests + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Translate\Inline; +namespace Magento\Mview; class ConfigTest extends \PHPUnit_Framework_TestCase { - public function testIsActive() + /** + * @var \Magento\Mview\Config + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Mview\Config\Data + */ + protected $dataMock; + + protected function setUp() { - $store = 'some store'; - $result = 'result'; - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - $coreStoreConfig->expects( - $this->once() - )->method( - 'getConfigFlag' - )->with( - $this->equalTo('dev/translate_inline/active'), - $this->equalTo($store) - )->will( - $this->returnValue($result) + $this->dataMock = $this->getMock( + 'Magento\Mview\Config\Data', array(), array(), '', false ); - $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $config = $objectManager->getObject( - '\Magento\Core\Model\Translate\Inline\Config', - array('coreStoreConfig' => $coreStoreConfig) + $this->model = new Config( + $this->dataMock ); - $this->assertEquals($result, $config->isActive($store)); + } + + public function testGetViews() + { + $this->dataMock->expects($this->once()) + ->method('get') + ->will($this->returnValue(['some_data'])); + $this->assertEquals(['some_data'], $this->model->getViews()); + } + + public function testGetView() + { + $this->dataMock->expects($this->once()) + ->method('get') + ->with('some_view') + ->will($this->returnValue(['some_data'])); + $this->assertEquals(['some_data'], $this->model->getView('some_view')); } } diff --git a/dev/tests/unit/testsuite/Magento/Mview/View/ChangelogTest.php b/dev/tests/unit/testsuite/Magento/Mview/View/ChangelogTest.php index d24dec77bc7..15142e5ffb8 100644 --- a/dev/tests/unit/testsuite/Magento/Mview/View/ChangelogTest.php +++ b/dev/tests/unit/testsuite/Magento/Mview/View/ChangelogTest.php @@ -86,12 +86,59 @@ class ChangelogTest extends \PHPUnit_Framework_TestCase $this->assertEquals('ViewIdTest' . '_' . \Magento\Mview\View\Changelog::NAME_SUFFIX, $this->model->getName()); } + public function testGetViewId() + { + $this->model->setViewId('ViewIdTest'); + $this->assertEquals('ViewIdTest', $this->model->getViewId()); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage View's identifier is not set + */ + public function testGetNameWithException() + { + $this->model->getName(); + } + public function testGetColumnName() { $this->assertEquals(\Magento\Mview\View\Changelog::COLUMN_NAME, $this->model->getColumnName()); } - public function testGetVersionWithException() + public function testGetVersion() + { + $changelogTableName = 'viewIdtest_cl'; + $this->mockIsTableExists($changelogTableName, true); + $this->mockGetTableName(); + + $this->connectionMock->expects($this->once()) + ->method('fetchRow') + ->will($this->returnValue(['Auto_increment' => 11])); + + $this->model->setViewId('viewIdtest'); + $this->assertEquals(10, $this->model->getVersion()); + } + + public function testGetVersionWithExceptionNoAutoincrement() + { + $changelogTableName = 'viewIdtest_cl'; + $this->mockIsTableExists($changelogTableName, true); + $this->mockGetTableName(); + + $this->connectionMock->expects($this->once()) + ->method('fetchRow') + ->will($this->returnValue([])); + + $this->setExpectedException( + 'Exception', + "Table status for `{$changelogTableName}` is incorrect. Can`t fetch version id." + ); + $this->model->setViewId('viewIdtest'); + $this->model->getVersion(); + } + + public function testGetVersionWithExceptionNoTable() { $changelogTableName = 'viewIdtest_cl'; $this->mockIsTableExists($changelogTableName, false); @@ -102,7 +149,7 @@ class ChangelogTest extends \PHPUnit_Framework_TestCase $this->model->getVersion(); } - public function testDropWithException() + public function testDrop() { $changelogTableName = 'viewIdtest_cl'; $this->mockIsTableExists($changelogTableName, false); @@ -113,6 +160,44 @@ class ChangelogTest extends \PHPUnit_Framework_TestCase $this->model->drop(); } + public function testDropWithException() + { + $changelogTableName = 'viewIdtest_cl'; + $this->mockIsTableExists($changelogTableName, true); + $this->mockGetTableName(); + + $this->connectionMock->expects($this->once()) + ->method('dropTable') + ->with($changelogTableName) + ->will($this->returnValue(true)); + + $this->model->setViewId('viewIdtest'); + $this->model->drop(); + } + + public function testCreate() + { + $changelogTableName = 'viewIdtest_cl'; + $this->mockIsTableExists($changelogTableName, false); + $this->mockGetTableName(); + + $tableMock = $this->getMock('Magento\DB\Ddl\Table', array(), array(), '', false, false); + $tableMock->expects($this->exactly(2)) + ->method('addColumn') + ->will($this->returnSelf()); + + $this->connectionMock->expects($this->once()) + ->method('newTable') + ->with($changelogTableName) + ->will($this->returnValue($tableMock)); + $this->connectionMock->expects($this->once()) + ->method('createTable') + ->with($tableMock); + + $this->model->setViewId('viewIdtest'); + $this->model->create(); + } + public function testCreateWithException() { $changelogTableName = 'viewIdtest_cl'; @@ -124,6 +209,37 @@ class ChangelogTest extends \PHPUnit_Framework_TestCase $this->model->create(); } + public function testGetList() + { + $changelogTableName = 'viewIdtest_cl'; + $this->mockIsTableExists($changelogTableName, true); + $this->mockGetTableName(); + + $selectMock = $this->getMock('Magento\DB\Select', array(), array(), '', false, false); + $selectMock->expects($this->once()) + ->method('distinct') + ->with(true) + ->will($this->returnSelf()); + $selectMock->expects($this->once()) + ->method('from') + ->with($changelogTableName, ['entity_id']) + ->will($this->returnSelf()); + $selectMock->expects($this->exactly(2)) + ->method('where') + ->will($this->returnSelf()); + + $this->connectionMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + $this->connectionMock->expects($this->once()) + ->method('fetchCol') + ->with($selectMock) + ->will($this->returnValue(['some_data'])); + + $this->model->setViewId('viewIdtest'); + $this->assertEquals(['some_data'], $this->model->getList(1, 2)); + } + public function testGetListWithException() { $changelogTableName = 'viewIdtest_cl'; diff --git a/dev/tests/unit/testsuite/Magento/Mview/View/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Mview/View/CollectionTest.php index 8a915840b50..861b5d48249 100644 --- a/dev/tests/unit/testsuite/Magento/Mview/View/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Mview/View/CollectionTest.php @@ -25,7 +25,7 @@ namespace Magento\Mview\View; class CollectionTest extends \PHPUnit_Framework_TestCase { - public function testLoadData() + public function testLoadDataAndGetViewsByStateMode() { $indexerIdOne = 'first_indexer_id'; $indexerIdSecond = 'second_indexer_id'; @@ -50,22 +50,29 @@ class CollectionTest extends \PHPUnit_Framework_TestCase array('getItems') )->disableOriginalConstructor()->getMock(); - $state = $this->getMockBuilder( - 'Magento\Mview\View\State' - )->setMethods( - array('getViewId', '__wakeup') - )->disableOriginalConstructor()->getMock(); + $state = $this->getMockForAbstractClass( + 'Magento\Mview\View\StateInterface', [], '', false, false, true, + ['getViewId', 'getMode', '__wakeup'] + ); $state->expects($this->any())->method('getViewId')->will($this->returnValue('second_indexer_id')); - $indexer = $this->getMockBuilder( - 'Magento\Object' - )->setMethods( - array('load', 'setState') - )->disableOriginalConstructor()->getMock(); + $state->expects( + $this->any() + )->method( + 'getMode' + )->will( + $this->returnValue(\Magento\Mview\View\StateInterface::MODE_DISABLED) + ); + + $view = $this->getMockForAbstractClass( + 'Magento\Mview\ViewInterface', [], '', false, false, true, + ['load', 'setState', 'getState', '__wakeup'] + ); - $indexer->expects($this->once())->method('setState')->with($state); - $indexer->expects($this->any())->method('load')->with($this->logicalOr($indexerIdOne, $indexerIdSecond)); + $view->expects($this->once())->method('setState')->with($state); + $view->expects($this->any())->method('getState')->will($this->returnValue($state)); + $view->expects($this->any())->method('load')->with($this->logicalOr($indexerIdOne, $indexerIdSecond)); $entityFactory->expects( $this->any() @@ -74,7 +81,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase )->with( 'Magento\Mview\ViewInterface' )->will( - $this->returnValue($indexer) + $this->returnValue($view) ); $statesFactory->expects($this->once())->method('create')->will($this->returnValue($states)); @@ -91,5 +98,13 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $collection = new \Magento\Mview\View\Collection($entityFactory, $config, $statesFactory); $this->assertInstanceOf('Magento\Mview\View\Collection', $collection->loadData()); + + $views = $collection->getViewsByStateMode(\Magento\Mview\View\StateInterface::MODE_DISABLED); + $this->assertCount(2, $views); + $this->assertInstanceOf('Magento\Mview\ViewInterface', $views[0]); + $this->assertInstanceOf('Magento\Mview\ViewInterface', $views[1]); + + $views = $collection->getViewsByStateMode(\Magento\Mview\View\StateInterface::MODE_ENABLED); + $this->assertCount(0, $views); } } diff --git a/dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionFactoryTest.php b/dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionFactoryTest.php new file mode 100644 index 00000000000..1a4971b8a3a --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionFactoryTest.php @@ -0,0 +1,55 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Mview\View; + +class SubscriptionFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Mview\View\SubscriptionFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $model; + + /** + * @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + + protected function setUp() + { + $this->objectManagerMock = $this->getMock('Magento\ObjectManager', array(), array(), '', false); + $this->model = new SubscriptionFactory($this->objectManagerMock); + } + + public function testCreate() + { + $subscriptionInterfaceMock = $this->getMockForAbstractClass( + 'Magento\Mview\View\SubscriptionInterface', array(), '', false + ); + $this->objectManagerMock->expects($this->once()) + ->method('create') + ->with('Magento\Mview\View\SubscriptionInterface', ['some_data']) + ->will($this->returnValue($subscriptionInterfaceMock)); + $this->assertEquals($subscriptionInterfaceMock, $this->model->create(['some_data'])); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionTest.php b/dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionTest.php new file mode 100644 index 00000000000..3c394e5c777 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionTest.php @@ -0,0 +1,293 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Mview\View; + +class SubscriptionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Mview\View\Subscription + */ + protected $model; + + /** + * Mysql PDO DB adapter mock + * + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\DB\Adapter\Pdo\Mysql + */ + protected $connectionMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Resource + */ + protected $resourceMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\DB\Ddl\TriggerFactory + */ + protected $triggerFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Mview\View\CollectionInterface + */ + protected $viewCollectionMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Mview\ViewInterface + */ + protected $viewMock; + + protected function setUp() + { + $this->connectionMock = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', [], [], '', false); + + $this->resourceMock = $this->getMock( + 'Magento\App\Resource', array('getConnection', 'getTableName'), [], '', false, false + ); + $this->mockGetConnection($this->connectionMock); + $this->triggerFactoryMock = $this->getMock( + 'Magento\DB\Ddl\TriggerFactory', [], [], '', false, false + ); + $this->viewCollectionMock = $this->getMockForAbstractClass( + 'Magento\Mview\View\CollectionInterface', [], '', false, false, true, [] + ); + $this->viewMock = $this->getMockForAbstractClass( + 'Magento\Mview\ViewInterface', [], '', false, false, true, [] + ); + + $this->connectionMock->expects($this->any()) + ->method('quoteIdentifier') + ->will($this->returnArgument(0)); + + $this->model = new Subscription( + $this->resourceMock, + $this->triggerFactoryMock, + $this->viewCollectionMock, + $this->viewMock, + 'tableName', + 'columnName' + ); + } + + + public function testGetView() + { + $this->assertEquals($this->viewMock, $this->model->getView()); + } + + public function testGetTableName() + { + $this->assertEquals('tableName', $this->model->getTableName()); + } + + public function testGetColumnName() + { + $this->assertEquals('columnName', $this->model->getColumnName()); + } + + public function testCreate() + { + $this->mockGetTableName(); + + $triggerMock = $this->getMock('Magento\DB\Ddl\Trigger', [], [], '', false, false); + $triggerMock->expects($this->exactly(3)) + ->method('setName') + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('getName') + ->will($this->returnValue('triggerName')); + $triggerMock->expects($this->exactly(3)) + ->method('setTime') + ->with(\Magento\DB\Ddl\Trigger::TIME_AFTER) + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('setEvent') + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('setTable') + ->with('tableName') + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(6)) + ->method('addStatement') + ->will($this->returnSelf()); + + $changelogMock = $this->getMockForAbstractClass( + 'Magento\Mview\View\ChangelogInterface', [], '', false, false, true, [] + ); + $changelogMock->expects($this->exactly(3)) + ->method('getName') + ->will($this->returnValue('test_view_cl')); + $changelogMock->expects($this->exactly(3)) + ->method('getColumnName') + ->will($this->returnValue('entity_id')); + + $this->viewMock->expects($this->exactly(3)) + ->method('getChangelog') + ->will($this->returnValue($changelogMock)); + + $this->triggerFactoryMock->expects($this->exactly(3)) + ->method('create') + ->will($this->returnValue($triggerMock)); + + $otherChangelogMock = $this->getMockForAbstractClass( + 'Magento\Mview\View\ChangelogInterface', [], '', false, false, true, [] + ); + $otherChangelogMock->expects($this->exactly(3)) + ->method('getName') + ->will($this->returnValue('other_test_view_cl')); + $otherChangelogMock->expects($this->exactly(3)) + ->method('getColumnName') + ->will($this->returnValue('entity_id')); + + $otherViewMock = $this->getMockForAbstractClass( + 'Magento\Mview\ViewInterface', [], '', false, false, true, [] + ); + $otherViewMock->expects($this->exactly(1)) + ->method('getId') + ->will($this->returnValue('other_id')); + $otherViewMock->expects($this->exactly(1)) + ->method('getSubscriptions') + ->will($this->returnValue([['name' => 'tableName'], ['name' => 'otherTableName']])); + $otherViewMock->expects($this->exactly(3)) + ->method('getChangelog') + ->will($this->returnValue($otherChangelogMock)); + + $this->viewMock->expects($this->exactly(3)) + ->method('getId') + ->will($this->returnValue('this_id')); + $this->viewMock->expects($this->never()) + ->method('getSubscriptions'); + + $this->viewCollectionMock->expects($this->exactly(1)) + ->method('getViewsByStateMode') + ->with(\Magento\Mview\View\StateInterface::MODE_ENABLED) + ->will($this->returnValue([$this->viewMock, $otherViewMock])); + + $this->connectionMock->expects($this->exactly(3)) + ->method('dropTrigger') + ->with('triggerName') + ->will($this->returnValue(true)); + $this->connectionMock->expects($this->exactly(3)) + ->method('createTrigger') + ->with($triggerMock); + + $this->model->create(); + } + + public function testRemove() + { + $this->mockGetTableName(); + + $triggerMock = $this->getMock('Magento\DB\Ddl\Trigger', [], [], '', false, false); + $triggerMock->expects($this->exactly(3)) + ->method('setName') + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('getName') + ->will($this->returnValue('triggerName')); + $triggerMock->expects($this->exactly(3)) + ->method('setTime') + ->with(\Magento\DB\Ddl\Trigger::TIME_AFTER) + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('setEvent') + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('setTable') + ->with('tableName') + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('addStatement') + ->will($this->returnSelf()); + + $this->triggerFactoryMock->expects($this->exactly(3)) + ->method('create') + ->will($this->returnValue($triggerMock)); + + $otherChangelogMock = $this->getMockForAbstractClass( + 'Magento\Mview\View\ChangelogInterface', [], '', false, false, true, [] + ); + $otherChangelogMock->expects($this->exactly(3)) + ->method('getName') + ->will($this->returnValue('other_test_view_cl')); + $otherChangelogMock->expects($this->exactly(3)) + ->method('getColumnName') + ->will($this->returnValue('entity_id')); + + $otherViewMock = $this->getMockForAbstractClass( + 'Magento\Mview\ViewInterface', [], '', false, false, true, [] + ); + $otherViewMock->expects($this->exactly(1)) + ->method('getId') + ->will($this->returnValue('other_id')); + $otherViewMock->expects($this->exactly(1)) + ->method('getSubscriptions') + ->will($this->returnValue([['name' => 'tableName'], ['name' => 'otherTableName']])); + $otherViewMock->expects($this->exactly(3)) + ->method('getChangelog') + ->will($this->returnValue($otherChangelogMock)); + + $this->viewMock->expects($this->exactly(3)) + ->method('getId') + ->will($this->returnValue('this_id')); + $this->viewMock->expects($this->never()) + ->method('getSubscriptions'); + + $this->viewCollectionMock->expects($this->exactly(1)) + ->method('getViewsByStateMode') + ->with(\Magento\Mview\View\StateInterface::MODE_ENABLED) + ->will($this->returnValue([$this->viewMock, $otherViewMock])); + + $this->connectionMock->expects($this->exactly(3)) + ->method('dropTrigger') + ->with('triggerName') + ->will($this->returnValue(true)); + + $triggerMock->expects($this->exactly(3)) + ->method('getStatements') + ->will($this->returnValue(true)); + + $this->connectionMock->expects($this->exactly(3)) + ->method('createTrigger') + ->with($triggerMock); + + $this->model->remove(); + } + + /** + * @param $connection + */ + protected function mockGetConnection($connection) + { + $this->resourceMock->expects($this->once()) + ->method('getConnection') + ->will($this->returnValue($connection)); + } + + protected function mockGetTableName() + { + $this->resourceMock->expects($this->any()) + ->method('getTableName') + ->will($this->returnArgument(0)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Mview/ViewTest.php b/dev/tests/unit/testsuite/Magento/Mview/ViewTest.php index e76339216a7..fc85d7fb3bf 100644 --- a/dev/tests/unit/testsuite/Magento/Mview/ViewTest.php +++ b/dev/tests/unit/testsuite/Magento/Mview/ViewTest.php @@ -41,7 +41,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase protected $actionFactoryMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Mview\View\State + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Indexer\Model\Mview\View\State */ protected $stateMock; @@ -68,18 +68,18 @@ class ViewTest extends \PHPUnit_Framework_TestCase ); $this->actionFactoryMock = $this->getMock('Magento\Mview\ActionFactory', array('get'), array(), '', false); $this->stateMock = $this->getMock( - 'Magento\Core\Model\Mview\View\State', - array( - 'getViewId', + 'Magento\Indexer\Model\Mview\View\State', + array('getViewId', 'loadByView', 'getVersionId', 'setVersionId', + 'getUpdated', 'getStatus', 'setStatus', 'getMode', 'setMode', 'save', - '__wakeup' + '__wakeup', ), array(), '', @@ -87,7 +87,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase ); $this->changelogMock = $this->getMock( 'Magento\Mview\View\Changelog', - array('getViewId', 'setViewId', 'create', 'drop', 'getVersion', 'getList'), + array('getViewId', 'setViewId', 'create', 'drop', 'getVersion', 'getList', 'clear'), array(), '', false @@ -108,6 +108,24 @@ class ViewTest extends \PHPUnit_Framework_TestCase ); } + public function testGetActionClass() + { + $this->model->setData('action_class', 'actionClass'); + $this->assertEquals('actionClass', $this->model->getActionClass()); + } + + public function testGetGroup() + { + $this->model->setData('group', 'some_group'); + $this->assertEquals('some_group', $this->model->getGroup()); + } + + public function testGetSubscriptions() + { + $this->model->setData('subscriptions', ['subscription']); + $this->assertEquals(['subscription'], $this->model->getSubscriptions()); + } + public function testLoad() { $viewId = 'view_test'; @@ -144,9 +162,15 @@ class ViewTest extends \PHPUnit_Framework_TestCase public function testSubscribe() { - $this->stateMock->expects($this->once())->method('getMode')->will($this->returnValue('disabled')); - $this->stateMock->expects($this->once())->method('setMode')->with('enabled')->will($this->returnSelf()); - $this->changelogMock->expects($this->once())->method('create'); + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_DISABLED)); + $this->stateMock->expects($this->once()) + ->method('setMode') + ->with(\Magento\Mview\View\StateInterface::MODE_ENABLED) + ->will($this->returnSelf()); + $this->changelogMock->expects($this->once()) + ->method('create'); $subscriptionMock = $this->getMock('Magento\Mview\View\Subscription', array('create'), array(), '', false); $subscriptionMock->expects($this->exactly(1))->method('create'); $this->subscriptionFactoryMock->expects( @@ -160,12 +184,57 @@ class ViewTest extends \PHPUnit_Framework_TestCase $this->model->subscribe(); } + public function testSubscribeEnabled() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + $this->stateMock->expects($this->never()) + ->method('setMode'); + $this->changelogMock->expects($this->never()) + ->method('create'); + $this->subscriptionFactoryMock->expects($this->never()) + ->method('create'); + $this->loadView(); + $this->model->subscribe(); + } + + /** + * @expectedException \Exception + */ + public function testSubscribeWithException() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_DISABLED)); + + $this->changelogMock->expects($this->once()) + ->method('create') + ->will($this->returnCallback( + function () { + throw new \Exception(); + } + )); + + $this->loadView(); + $this->model->subscribe(); + } + public function testUnsubscribe() { - $this->stateMock->expects($this->once())->method('getMode')->will($this->returnValue('enabled')); - $this->stateMock->expects($this->once())->method('setVersionId')->with(null)->will($this->returnSelf()); - $this->stateMock->expects($this->once())->method('setMode')->with('disabled')->will($this->returnSelf()); - $this->changelogMock->expects($this->once())->method('drop'); + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + $this->stateMock->expects($this->once()) + ->method('setVersionId') + ->with(null) + ->will($this->returnSelf()); + $this->stateMock->expects($this->once()) + ->method('setMode') + ->with(\Magento\Mview\View\StateInterface::MODE_DISABLED) + ->will($this->returnSelf()); + $this->changelogMock->expects($this->once()) + ->method('drop'); $subscriptionMock = $this->getMock('Magento\Mview\View\Subscription', array('remove'), array(), '', false); $subscriptionMock->expects($this->exactly(1))->method('remove'); $this->subscriptionFactoryMock->expects( @@ -179,18 +248,74 @@ class ViewTest extends \PHPUnit_Framework_TestCase $this->model->unsubscribe(); } + public function testUnsubscribeDisabled() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_DISABLED)); + $this->stateMock->expects($this->never()) + ->method('setVersionId'); + $this->stateMock->expects($this->never()) + ->method('setMode'); + $this->changelogMock->expects($this->never()) + ->method('drop'); + $this->subscriptionFactoryMock->expects($this->never()) + ->method('create'); + $this->loadView(); + $this->model->unsubscribe(); + } + + /** + * @expectedException \Exception + */ + public function testUnsubscribeWithException() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + + $subscriptionMock = $this->getMock('Magento\Mview\View\Subscription', array('remove'), array(), '', false); + $subscriptionMock->expects($this->exactly(1)) + ->method('remove') + ->will($this->returnCallback( + function () { + throw new \Exception(); + } + )); + $this->subscriptionFactoryMock->expects($this->exactly(1)) + ->method('create') + ->will($this->returnValue($subscriptionMock)); + + $this->loadView(); + $this->model->unsubscribe(); + } + public function testUpdate() { $currentVersionId = 3; $lastVersionId = 1; $listId = array(2, 3); - $this->stateMock->expects($this->any())->method('getViewId')->will($this->returnValue(1)); - $this->stateMock->expects($this->once())->method('getVersionId')->will($this->returnValue($lastVersionId)); - $this->stateMock->expects($this->once())->method('setVersionId')->will($this->returnSelf()); - $this->stateMock->expects($this->once())->method('getMode')->will($this->returnValue('enabled')); - $this->stateMock->expects($this->exactly(2))->method('getStatus')->will($this->returnValue('idle')); - $this->stateMock->expects($this->exactly(2))->method('setStatus')->will($this->returnSelf()); - $this->stateMock->expects($this->exactly(2))->method('save')->will($this->returnSelf()); + $this->stateMock->expects($this->any()) + ->method('getViewId') + ->will($this->returnValue(1)); + $this->stateMock->expects($this->once()) + ->method('getVersionId') + ->will($this->returnValue($lastVersionId)); + $this->stateMock->expects($this->once()) + ->method('setVersionId') + ->will($this->returnSelf()); + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + $this->stateMock->expects($this->exactly(2)) + ->method('getStatus') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::STATUS_IDLE)); + $this->stateMock->expects($this->exactly(2)) + ->method('setStatus') + ->will($this->returnSelf()); + $this->stateMock->expects($this->exactly(2)) + ->method('save') + ->will($this->returnSelf()); $this->changelogMock->expects( $this->once() @@ -235,13 +360,26 @@ class ViewTest extends \PHPUnit_Framework_TestCase $currentVersionId = 3; $lastVersionId = 1; $listId = array(2, 3); - $this->stateMock->expects($this->any())->method('getViewId')->will($this->returnValue(1)); - $this->stateMock->expects($this->once())->method('getVersionId')->will($this->returnValue($lastVersionId)); - $this->stateMock->expects($this->never())->method('setVersionId'); - $this->stateMock->expects($this->once())->method('getMode')->will($this->returnValue('enabled')); - $this->stateMock->expects($this->exactly(2))->method('getStatus')->will($this->returnValue('idle')); - $this->stateMock->expects($this->exactly(2))->method('setStatus')->will($this->returnSelf()); - $this->stateMock->expects($this->exactly(2))->method('save')->will($this->returnSelf()); + $this->stateMock->expects($this->any()) + ->method('getViewId') + ->will($this->returnValue(1)); + $this->stateMock->expects($this->once()) + ->method('getVersionId') + ->will($this->returnValue($lastVersionId)); + $this->stateMock->expects($this->never()) + ->method('setVersionId'); + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + $this->stateMock->expects($this->exactly(2)) + ->method('getStatus') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::STATUS_IDLE)); + $this->stateMock->expects($this->exactly(2)) + ->method('setStatus') + ->will($this->returnSelf()); + $this->stateMock->expects($this->exactly(2)) + ->method('save') + ->will($this->returnSelf()); $this->changelogMock->expects( $this->once() @@ -283,6 +421,223 @@ class ViewTest extends \PHPUnit_Framework_TestCase $this->model->update(); } + public function testSuspend() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + $this->stateMock->expects($this->once()) + ->method('setVersionId') + ->with(11) + ->will($this->returnSelf()); + $this->stateMock->expects($this->once()) + ->method('setStatus') + ->with(\Magento\Mview\View\StateInterface::STATUS_SUSPENDED) + ->will($this->returnSelf()); + $this->stateMock->expects($this->once()) + ->method('save') + ->will($this->returnSelf()); + + $this->changelogMock->expects($this->once()) + ->method('getVersion') + ->will($this->returnValue(11)); + + $this->loadView(); + $this->model->suspend(); + } + + public function testSuspendDisabled() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_DISABLED)); + $this->stateMock->expects($this->never()) + ->method('setVersionId'); + $this->stateMock->expects($this->never()) + ->method('setStatus'); + $this->stateMock->expects($this->never()) + ->method('save'); + + $this->changelogMock->expects($this->never()) + ->method('getVersion'); + + $this->loadView(); + $this->model->suspend(); + } + + public function testResume() + { + $this->stateMock->expects($this->once()) + ->method('getStatus') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::STATUS_SUSPENDED)); + $this->stateMock->expects($this->once()) + ->method('setStatus') + ->with(\Magento\Mview\View\StateInterface::STATUS_IDLE) + ->will($this->returnSelf()); + $this->stateMock->expects($this->once()) + ->method('save') + ->will($this->returnSelf()); + + $this->loadView(); + $this->model->resume(); + } + + /** + * @param string $status + * @dataProvider dataProviderResumeNotSuspended + */ + public function testResumeNotSuspended($status) + { + $this->stateMock->expects($this->once()) + ->method('getStatus') + ->will($this->returnValue($status)); + $this->stateMock->expects($this->never()) + ->method('setStatus'); + $this->stateMock->expects($this->never()) + ->method('save'); + + $this->loadView(); + $this->model->resume(); + } + + public function dataProviderResumeNotSuspended() + { + return [ + [\Magento\Mview\View\StateInterface::STATUS_IDLE], + [\Magento\Mview\View\StateInterface::STATUS_WORKING], + ]; + } + + public function testClearChangelog() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + $this->stateMock->expects($this->once()) + ->method('getVersionId') + ->will($this->returnValue(11)); + $this->changelogMock->expects($this->once()) + ->method('clear') + ->with(11) + ->will($this->returnValue(true)); + $this->loadView(); + $this->model->clearChangelog(); + } + + public function testClearChangelogDisabled() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_DISABLED)); + $this->stateMock->expects($this->never()) + ->method('getVersionId'); + $this->changelogMock->expects($this->never()) + ->method('clear'); + $this->loadView(); + $this->model->clearChangelog(); + } + + public function testSetState() + { + $this->model->setState($this->stateMock); + $this->assertEquals($this->stateMock, $this->model->getState()); + } + + /** + * @param string $mode + * @param bool $result + * @dataProvider dataProviderIsEnabled + */ + public function testIsEnabled($mode, $result) + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue($mode)); + $this->assertEquals($result, $this->model->isEnabled()); + } + + public function dataProviderIsEnabled() + { + return [ + [\Magento\Mview\View\StateInterface::MODE_ENABLED, true], + [\Magento\Mview\View\StateInterface::MODE_DISABLED, false], + ]; + } + + /** + * @param string $status + * @param bool $result + * @dataProvider dataProviderIsIdle + */ + public function testIsIdle($status, $result) + { + $this->stateMock->expects($this->once()) + ->method('getStatus') + ->will($this->returnValue($status)); + $this->assertEquals($result, $this->model->isIdle()); + } + + public function dataProviderIsIdle() + { + return [ + [\Magento\Mview\View\StateInterface::STATUS_IDLE, true], + [\Magento\Mview\View\StateInterface::STATUS_WORKING, false], + [\Magento\Mview\View\StateInterface::STATUS_SUSPENDED, false], + ]; + } + + /** + * @param string $status + * @param bool $result + * @dataProvider dataProviderIsWorking + */ + public function testIsWorking($status, $result) + { + $this->stateMock->expects($this->once()) + ->method('getStatus') + ->will($this->returnValue($status)); + $this->assertEquals($result, $this->model->isWorking()); + } + + public function dataProviderIsWorking() + { + return [ + [\Magento\Mview\View\StateInterface::STATUS_IDLE, false], + [\Magento\Mview\View\StateInterface::STATUS_WORKING, true], + [\Magento\Mview\View\StateInterface::STATUS_SUSPENDED, false], + ]; + } + + /** + * @param string $status + * @param bool $result + * @dataProvider dataProviderIsSuspended + */ + public function testIsSuspended($status, $result) + { + $this->stateMock->expects($this->once()) + ->method('getStatus') + ->will($this->returnValue($status)); + $this->assertEquals($result, $this->model->isSuspended()); + } + + public function dataProviderIsSuspended() + { + return [ + [\Magento\Mview\View\StateInterface::STATUS_IDLE, false], + [\Magento\Mview\View\StateInterface::STATUS_WORKING, false], + [\Magento\Mview\View\StateInterface::STATUS_SUSPENDED, true], + ]; + } + + public function testGetUpdated() + { + $this->stateMock->expects($this->once()) + ->method('getUpdated') + ->will($this->returnValue('some datetime')); + $this->assertEquals('some datetime', $this->model->getUpdated()); + } + protected function loadView() { $viewId = 'view_test'; diff --git a/dev/tests/unit/testsuite/Magento/Mview/_files/mview_config.php b/dev/tests/unit/testsuite/Magento/Mview/_files/mview_config.php index 2defee53d44..b552b267791 100644 --- a/dev/tests/unit/testsuite/Magento/Mview/_files/mview_config.php +++ b/dev/tests/unit/testsuite/Magento/Mview/_files/mview_config.php @@ -22,10 +22,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ return array( - 'inputXML' => '<?xml version="1.0" encoding="UTF-8"?><config>' . - '<view id="view_one" class="Ogogo\Class\One" group="some_view_group">' . - '<subscriptions><table name="some_entity" entity_column="entity_id" />' . - '<table name="some_product_relation" entity_column="product_id" /></subscriptions></view></config>', + 'inputXML' => '<?xml version="1.0" encoding="UTF-8"?><config>' + . '<view id="view_one" class="Ogogo\Class\One" group="some_view_group"><!--comment-->' + . '<subscriptions><table name="some_entity" entity_column="entity_id" />' + . '<table name="some_product_relation" entity_column="product_id" /><nottable/>' + . '<!--comment--></subscriptions></view></config>', 'expected' => array( 'view_one' => array( 'view_id' => 'view_one', diff --git a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/mapped_simple_di_config.php b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/mapped_simple_di_config.php index 7388ed4c274..20cb631c814 100644 --- a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/mapped_simple_di_config.php +++ b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/mapped_simple_di_config.php @@ -24,7 +24,7 @@ return array( 'preferences' => array( 'Magento\Module\UpdaterInterface' => 'Magento\Module\Updaterter', - 'Magento\AppInterface' => 'Magento\Core\Model\App\Proxy' + 'Magento\App\RequestInterface' => 'Magento\App\Request\Http\Proxy', ), 'Magento\App\State' => array('arguments' => array('test name' => 'test value')), 'Magento\Core\Model\Config\Modules' => array( diff --git a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/simple_di_config.xml b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/simple_di_config.xml index 40795af762f..6e89639248b 100644 --- a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/simple_di_config.xml +++ b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/simple_di_config.xml @@ -26,7 +26,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/Magento/ObjectManager/etc/config.xsd"> <!-- Comment within root node --> <preference for="Magento\Module\UpdaterInterface" type="Magento\Module\Updaterter" /> - <preference for="Magento\AppInterface" type="Magento\Core\Model\App\Proxy" /> + <preference for="Magento\App\RequestInterface" type="Magento\App\Request\Http\Proxy" /> <!--Arguments only--> <type name="Magento\App\State"> <arguments> diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Authentication/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Authentication/FactoryTest.php deleted file mode 100644 index f8e9b74f3b9..00000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Authentication/FactoryTest.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php -/** - * \Magento\Outbound\Authentication\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Authentication; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $_mockObjectManager; - - /** - * @var \Magento\Outbound\Authentication\Factory - */ - protected $_authFactory; - - /** - * @var \Magento\Outbound\Authentication\Hmac - */ - protected $_expectedObject; - - protected function setUp() - { - $this->_mockObjectManager = $this->getMockBuilder( - 'Magento\ObjectManager' - )->setMethods( - array('get') - )->disableOriginalConstructor()->getMockForAbstractClass(); - - $this->_authFactory = new \Magento\Outbound\Authentication\Factory( - array('hmac' => 'Test_Authentication_Hmac'), - $this->_mockObjectManager - ); - - $this->_expectedObject = $this->getMockBuilder( - 'Magento\Outbound\Authentication\Hmac' - )->disableOriginalConstructor()->getMock(); - - $this->_formatterFactory = new \Magento\Outbound\Formatter\Factory( - array('json' => 'Test_Formatter_Json'), - $this->_mockObjectManager - ); - } - - public function testGetAuthenticationSuccess() - { - $this->_mockObjectManager->expects( - $this->once() - )->method( - 'get' - )->with( - 'Test_Authentication_Hmac' - )->will( - $this->returnValue($this->_expectedObject) - ); - - $authObject = $this->_authFactory->getAuthentication(\Magento\Outbound\EndpointInterface::AUTH_TYPE_HMAC); - $this->assertInstanceOf('Magento\Outbound\Authentication\Hmac', $authObject); - $this->assertEquals($this->_expectedObject, $authObject); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage There is no authentication for the type given: TEST_AUTH_TYPE_STRING - */ - public function testGetAuthenticationNoType() - { - $this->_authFactory->getAuthentication('TEST_AUTH_TYPE_STRING'); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage Authentication class for hmac does not implement authentication interface - */ - public function testGetAuthenticationNoModel() - { - $this->_mockObjectManager->expects( - $this->once() - )->method( - 'get' - )->with( - 'Test_Authentication_Hmac' - )->will( - $this->returnValue($this->getMock('Magento\Object')) - ); - $this->_authFactory->getAuthentication(\Magento\Outbound\EndpointInterface::AUTH_TYPE_HMAC); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Authentication/HmacTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Authentication/HmacTest.php deleted file mode 100644 index 2cc4ae1b370..00000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Authentication/HmacTest.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php -/** - * \Magento\Outbound\Authentication\Hmac - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Authentication; - -class HmacTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Outbound\Authentication\Hmac - */ - private $_model; - - /** - * A random 32 byte string - */ - const SHARED_SECRET = 'x0lpu8kcmu23l8jcqd7qmyknyl5kx2f9'; - - /** message body */ - const BODY = 'This is a test body and has no semantic value.'; - - /** message head domain */ - const DOMAIN = 'www.fake.magento.com'; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject \Magento\Outbound\MessageInterface - */ - private $_mockMessage; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject \Magento\Outbound\UserInterface - */ - private $_mockUser; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject \Magento\Core\Model\StoreManagerInterface - */ - private $_mockStoreManager; - - protected function setUp() - { - $this->_mockStoreManager = $this->getMockBuilder( - 'Magento\Core\Model\StoreManagerInterface' - )->disableOriginalConstructor()->getMock(); - $this->_model = new \Magento\Outbound\Authentication\Hmac($this->_mockStoreManager); - - $this->_mockMessage = $this->getMockBuilder( - 'Magento\Outbound\MessageInterface' - )->disableOriginalConstructor()->getMock(); - $this->_mockMessage->expects($this->any())->method('getBody')->will($this->returnValue(self::BODY)); - - $this->_mockUser = $this->getMockBuilder( - 'Magento\Outbound\UserInterface' - )->disableOriginalConstructor()->getMock(); - } - - public function testHeaders() - { - $store = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); - $this->_mockStoreManager->expects($this->once())->method('getSafeStore')->will($this->returnValue($store)); - $store->expects($this->once())->method('getBaseUrl')->will($this->returnValue('http://' . self::DOMAIN)); - - $this->_mockUser->expects( - $this->once() - )->method( - 'getSharedSecret' - )->will( - $this->returnValue(self::SHARED_SECRET) - ); - - $hash = (string)hash_hmac( - \Magento\Outbound\Authentication\Hmac::SHA256_ALGORITHM, - self::BODY, - self::SHARED_SECRET - ); - - $headers = $this->_model->getSignatureHeaders($this->_mockMessage->getBody(), $this->_mockUser); - $this->assertArrayHasKey(\Magento\Outbound\Authentication\Hmac::DOMAIN_HEADER, $headers); - $this->assertSame(self::DOMAIN, $headers[\Magento\Outbound\Authentication\Hmac::DOMAIN_HEADER]); - $this->assertArrayHasKey(\Magento\Outbound\Authentication\Hmac::HMAC_HEADER, $headers); - $this->assertSame($hash, $headers[\Magento\Outbound\Authentication\Hmac::HMAC_HEADER]); - } - - /** - * @expectedException \LogicException - * @expectedMessage The shared secret cannot be a empty. - */ - public function testEmptySecret() - { - $this->_mockUser->expects($this->once())->method('getSharedSecret')->will($this->returnValue('')); - - $this->_model->getSignatureHeaders($this->_mockMessage, $this->_mockUser); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php deleted file mode 100644 index 4ebf5af1e8e..00000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php -/** - * \Magento\Outbound\Formatter\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject \Magento\App\ObjectManager - */ - private $_mockObjectManager; - - /** - * @var \Magento\Outbound\Formatter\Factory - */ - protected $_formatterFactory; - - /** - * @var \Magento\Outbound\Formatter\Json - */ - protected $_expectedObject; - - protected function setUp() - { - $this->_mockObjectManager = $this->getMockBuilder( - 'Magento\ObjectManager' - )->setMethods( - array('get') - )->disableOriginalConstructor()->getMockForAbstractClass(); - - $this->_expectedObject = $this->getMockBuilder( - 'Magento\Outbound\Formatter\Json' - )->disableOriginalConstructor()->getMock(); - - $this->_formatterFactory = new \Magento\Outbound\Formatter\Factory( - array('json' => 'Test_Formatter_Json'), - $this->_mockObjectManager - ); - } - - public function testGetFormatter() - { - $this->_mockObjectManager->expects( - $this->once() - )->method( - 'get' - )->with( - 'Test_Formatter_Json' - )->will( - $this->returnValue($this->_expectedObject) - ); - - $formatter = $this->_formatterFactory->getFormatter(\Magento\Outbound\EndpointInterface::FORMAT_JSON); - $this->assertInstanceOf('Magento\Outbound\Formatter\Json', $formatter); - $this->assertEquals($this->_expectedObject, $formatter); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage WrongFormatName - */ - public function testGetFormatterWrongFormatName() - { - $this->_formatterFactory->getFormatter('WrongFormatName'); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage Formatter class for json does not implement FormatterInterface. - */ - public function testGetFormatterWrongFormatterClass() - { - $this->_mockObjectManager->expects( - $this->once() - )->method( - 'get' - )->with( - 'Test_Formatter_Json' - )->will( - $this->returnValue($this->getMock('Magento\Object')) - ); - - $this->_formatterFactory->getFormatter(\Magento\Outbound\EndpointInterface::FORMAT_JSON); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest.php deleted file mode 100644 index 22cba156c06..00000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php -/** - * \Magento\Outbound\Formatter\Json - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter; - - -require_once __DIR__ . '/JsonTest/Data.php'; -class JsonTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Outbound\Formatter\Json - */ - protected $_formatter; - - protected function setUp() - { - $this->_formatter = new \Magento\Outbound\Formatter\Json(); - } - - /** - * @dataProvider encodeDataProvider - * - * @param $input - * @param $expectedOutput - */ - public function testFormat($input, $expectedOutput) - { - $this->assertSame($expectedOutput, $this->_formatter->format($input)); - } - - public function testGetContentType() - { - $this->assertSame(\Magento\Outbound\Formatter\Json::CONTENT_TYPE, $this->_formatter->getContentType()); - } - - /** - * DataProvider for testing the JSON formatter. - * - * @return array - */ - public function encodeDataProvider() - { - return array( - array(array(), "[]"), - array(array('a' => array('b' => 'c', 'd' => 'e'), 'f' => 'g'), '{"a":{"b":"c","d":"e"},"f":"g"}'), - array(array(null), '[null]'), - array(array(true), '[true]'), - array(array(false), '[false]'), - array(array(-1), '[-1]'), - array(array(0), '[0]'), - array(array(1), '[1]'), - array(array(2.4), '[2.4]'), - array(array(2.0), '[2]'), - array(array(new \Magento\Outbound\Formatter\JsonTest\Data('public', 'protected')), '[{"dataA":"public"}]') - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php b/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php deleted file mode 100644 index a1e7ceee986..00000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * Class Data is a simple class to test converting a PHP class into JSON data - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter\JsonTest; - -class Data -{ - public $dataA; - - protected $_dataB; - - public function __construct($first, $second) - { - $this->dataA = $first; - $this->_dataB = $second; - } - - public function getB() - { - return $this->_dataB; - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Message/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Message/FactoryTest.php deleted file mode 100644 index fb45f7b6ac9..00000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Message/FactoryTest.php +++ /dev/null @@ -1,237 +0,0 @@ -<?php -/** - * \Magento\Outbound\Message\Factory - * - * 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_Outbound - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Message; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - const ENDPOINT_URL = 'https://endpoint_url'; - - const TOPIC = 'topic'; - - const CONTENT_TYPE = 'content_type'; - - const AUTH_TYPE = 'auth_type'; - - const FORMATTED_BODY = 'some_formatted_body'; - - const TIMEOUT = 777; - - public static $body = array('some_body'); - - public static $signatureHeaders = array('signature' => 'hash'); - - /** @var \Magento\Outbound\Message\Factory */ - protected $_factory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockObjectManager; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockFormatFactory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockFormatter; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockAuthFactory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockEndpoint; - - /** - * @return void - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - protected function setUp() - { - $this->_mockObjectManager = $this->getMockBuilder( - 'Magento\ObjectManager' - )->setMethods( - array('create') - )->disableOriginalConstructor()->getMockForAbstractClass(); - - $this->_mockFormatFactory = $this->getMockBuilder( - 'Magento\Outbound\Formatter\Factory' - )->disableOriginalConstructor()->getMock(); - - $this->_mockAuthFactory = $this->getMockBuilder( - 'Magento\Outbound\Authentication\Factory' - )->disableOriginalConstructor()->getMock(); - - $this->_factory = new \Magento\Outbound\Message\Factory( - $this->_mockObjectManager, - $this->_mockFormatFactory, - $this->_mockAuthFactory - ); - - $this->_mockFormatter = $this->getMockBuilder( - 'Magento\Outbound\FormatterInterface' - )->disableOriginalConstructor()->getMock(); - - $this->_mockEndpoint = $this->getMockBuilder( - 'Magento\Outbound\EndpointInterface' - )->disableOriginalConstructor()->getMock(); - - $this->_mockEndpoint->expects($this->once())->method('getFormat')->will($this->returnValue('some_format')); - - $this->_mockFormatFactory->expects( - $this->once() - )->method( - 'getFormatter' - )->with( - $this->equalTo('some_format') - )->will( - $this->returnValue($this->_mockFormatter) - ); - - $this->_mockFormatter->expects( - $this->once() - )->method( - 'getContentType' - )->will( - $this->returnValue(self::CONTENT_TYPE) - ); - - $this->_mockFormatter->expects( - $this->once() - )->method( - 'format' - )->with( - $this->equalTo(self::$body) - )->will( - $this->returnValue(self::FORMATTED_BODY) - ); - - $this->_mockEndpoint->expects( - $this->once() - )->method( - 'getAuthenticationType' - )->will( - $this->returnValue(self::AUTH_TYPE) - ); - - $mockAuth = $this->getMockBuilder( - 'Magento\Outbound\AuthenticationInterface' - )->disableOriginalConstructor()->getMock(); - - $this->_mockAuthFactory->expects( - $this->once() - )->method( - 'getAuthentication' - )->with( - $this->equalTo(self::AUTH_TYPE) - )->will( - $this->returnValue($mockAuth) - ); - - $mockUser = $this->getMockBuilder('Magento\Outbound\UserInterface')->disableOriginalConstructor()->getMock(); - - $this->_mockEndpoint->expects($this->once())->method('getUser')->will($this->returnValue($mockUser)); - - $mockAuth->expects( - $this->once() - )->method( - 'getSignatureHeaders' - )->with( - $this->equalTo(self::FORMATTED_BODY), - $this->equalTo($mockUser) - )->will( - $this->returnValue(self::$signatureHeaders) - ); - - $this->_mockEndpoint->expects( - $this->once() - )->method( - 'getEndpointUrl' - )->will( - $this->returnValue(self::ENDPOINT_URL) - ); - - $this->_mockEndpoint->expects( - $this->once() - )->method( - 'getTimeoutInSecs' - )->will( - $this->returnValue(self::TIMEOUT) - ); - - $this->_mockObjectManager->expects( - $this->once() - )->method( - 'create' - )->with( - $this->equalTo('Magento\Outbound\Message'), - $this->anything() - )->will( - $this->returnCallback(array($this, 'verifyManagerCreate')) - ); - } - - public function testCreate() - { - $this->assertEquals('SUCCESS', $this->_factory->create($this->_mockEndpoint, self::TOPIC, self::$body)); - } - - /** - * Used to verify the correct arguments are passed in to \Magento\ObjectManager::create - * - * @param $className - * @param array $arguments - * - * @return string - */ - public function verifyManagerCreate($className, array $arguments) - { - $this->assertSame('Magento\Outbound\Message', $className); - - $this->assertCount(4, $arguments); - - $this->assertArrayHasKey('endpointUrl', $arguments); - $this->assertSame(self::ENDPOINT_URL, $arguments['endpointUrl']); - - $this->assertArrayHasKey('headers', $arguments); - $headers = $arguments['headers']; - $this->assertArrayHasKey(\Magento\Outbound\Message\FactoryInterface::TOPIC_HEADER, $headers); - $this->assertSame(self::TOPIC, $headers[\Magento\Outbound\Message\FactoryInterface::TOPIC_HEADER]); - $this->assertArrayHasKey(\Magento\Outbound\FormatterInterface::CONTENT_TYPE_HEADER, $headers); - $this->assertSame(self::CONTENT_TYPE, $headers[\Magento\Outbound\FormatterInterface::CONTENT_TYPE_HEADER]); - foreach (self::$signatureHeaders as $key => $value) { - $this->assertArrayHasKey($key, $headers); - $this->assertSame($value, $headers[$key]); - } - - $this->assertArrayHasKey('body', $arguments); - $this->assertSame(self::FORMATTED_BODY, $arguments['body']); - - $this->assertArrayHasKey('timeout', $arguments); - $this->assertSame(self::TIMEOUT, $arguments['timeout']); - - return 'SUCCESS'; - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/MessageTest.php b/dev/tests/unit/testsuite/Magento/Outbound/MessageTest.php deleted file mode 100644 index 14b0a62acd4..00000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/MessageTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * \Magento\Outbound\Message - * - * 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_Outbound - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -class MessageTest extends \PHPUnit_Framework_TestCase -{ - public function test() - { - $uut = new \Magento\Outbound\Message('http://localhost', array('key1' => 'val1', 'key2' => 'val2'), "Body"); - // check endpoint url - $this->assertSame('http://localhost', $uut->getEndpointUrl()); - // check headers - $rsltHdr = $uut->getHeaders(); - $this->assertSame('val1', $rsltHdr['key1']); - $this->assertSame('val2', $rsltHdr['key2']); - // check for body - $this->assertSame("Body", $uut->getBody()); - // check for default timeout - $this->assertSame(20, $uut->getTimeout()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Transport/Http/ResponseTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Transport/Http/ResponseTest.php deleted file mode 100644 index 18363f3aae4..00000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Transport/Http/ResponseTest.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * \Magento\Outbound\Transport\Http\Response - * - * 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_Outbound - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Transport\Http; - -class ResponseTest extends \PHPUnit_Framework_TestCase -{ - public function testIsSuccessfulTrue() - { - $uut = new \Magento\Outbound\Transport\Http\Response("HTTP/2.0 299 OK"); - $this->assertTrue($uut->isSuccessful()); - } - - public function testIsSuccessfulFalse() - { - $uut = new \Magento\Outbound\Transport\Http\Response("HTTP/2.0 301 Moved Permanently"); - $this->assertFalse($uut->isSuccessful()); - } - - public function testGetStatusCode() - { - $uut = new \Magento\Outbound\Transport\Http\Response("HTTP/2.0 299 OK"); - $this->assertSame(299, $uut->getStatusCode()); - } - - public function testGetMessage() - { - $uut = new \Magento\Outbound\Transport\Http\Response("HTTP/2.0 299 A-OK"); - $this->assertSame("A-OK", $uut->getMessage()); - } - - public function testGetBody() - { - $uut = new \Magento\Outbound\Transport\Http\Response("HTTP/2.0 200 OK\nHdrkey: Hdrval\n\nRaw Body"); - $this->assertSame("Raw Body", $uut->getBody()); - } - - public function testGetHeaders() - { - $hdrs = array('Key1' => 'val1', 'Key2' => 'val2'); - $uut = new \Magento\Outbound\Transport\Http\Response( - "HTTP/2.0 200 OK\nkey1: val1\nkey2: val2\n\nMessage Body" - ); - $this->assertEquals($hdrs, $uut->getHeaders()); - $this->assertEquals($hdrs['Key1'], $uut->getHeader('Key1')); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Transport/HttpTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Transport/HttpTest.php deleted file mode 100644 index d85c6be71d7..00000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Transport/HttpTest.php +++ /dev/null @@ -1,124 +0,0 @@ -<?php -/** - * \Magento\Outbound\Transport\Http - * - * 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_Outbound - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Transport; - -class HttpTest extends \PHPUnit_Framework_TestCase -{ - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockVrnHttpAdptrCrl; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockMessage; - - protected function setUp() - { - $this->_mockVrnHttpAdptrCrl = $this->getMockBuilder( - 'Magento\HTTP\Adapter\Curl' - )->disableOriginalConstructor()->getMock(); - $this->_mockMessage = $this->getMockBuilder( - 'Magento\Outbound\Message' - )->disableOriginalConstructor()->getMock(); - $this->_mockMessage->expects( - $this->any() - )->method( - 'getHeaders' - )->will( - $this->returnValue(array('header' => 'value')) - ); - } - - /** - * Test case for when http adapter returns null - * - * @expectedException \Zend_Http_Exception - */ - public function testNullResponse() - { - $uut = new \Magento\Outbound\Transport\Http($this->_mockVrnHttpAdptrCrl); - $this->_mockVrnHttpAdptrCrl->expects($this->any())->method('read')->will($this->returnValue(null)); - $uut->dispatch($this->_mockMessage); - } - - public function testPositive() - { - $uut = new \Magento\Outbound\Transport\Http($this->_mockVrnHttpAdptrCrl); - $this->_mockVrnHttpAdptrCrl->expects( - $this->any() - )->method( - 'read' - )->will( - $this->returnValue("HTTP/2.0 200 OK\nHdrkey: Hdrval\n\nMessage Body") - ); - $response = $uut->dispatch($this->_mockMessage); - $this->assertSame(200, $response->getStatusCode()); - $this->assertSame("OK", $response->getMessage()); - $this->assertSame(array("Hdrkey" => "Hdrval"), $response->getHeaders()); - $this->assertSame("Message Body", $response->getBody()); - } - - /** - * @dataProvider timeoutDataProvider - * - * @param $timeout - */ - public function testMessageTimeout($timeout, $expectedTimeout) - { - $uut = new \Magento\Outbound\Transport\Http($this->_mockVrnHttpAdptrCrl); - $this->_mockMessage->expects($this->any())->method('getTimeout')->will($this->returnValue($timeout)); - $config = array('verifypeer' => true, 'verifyhost' => 2, 'timeout' => $expectedTimeout); - $this->_mockVrnHttpAdptrCrl->expects($this->once())->method('setConfig')->with($config); - $this->_mockVrnHttpAdptrCrl->expects( - $this->any() - )->method( - 'read' - )->will( - $this->returnValue("HTTP/2.0 200 OK\nHdrkey: Hdrval\n\nMessage Body") - ); - $response = $uut->dispatch($this->_mockMessage); - $this->assertSame(200, $response->getStatusCode()); - $this->assertSame("OK", $response->getMessage()); - $this->assertSame(array("Hdrkey" => "Hdrval"), $response->getHeaders()); - $this->assertSame("Message Body", $response->getBody()); - } - - /** - * DataProvider for testing dispatch with different message timeout. - * - * @return array - */ - public function timeoutDataProvider() - { - return array( - array(0, \Magento\Outbound\Message::DEFAULT_TIMEOUT), - array(null, \Magento\Outbound\Message::DEFAULT_TIMEOUT), - array(5, 5), - array(\Magento\Outbound\Message::DEFAULT_TIMEOUT, \Magento\Outbound\Message::DEFAULT_TIMEOUT) - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Payment/Model/Method/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Payment/Model/Method/FactoryTest.php index 8ad0bff6f32..3944bfe93d3 100644 --- a/dev/tests/unit/testsuite/Magento/Payment/Model/Method/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Payment/Model/Method/FactoryTest.php @@ -84,7 +84,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage WrongClass class doesn't implement \Magento\Payment\Model\MethodInterface */ public function testWrongTypeException() diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Block/Express/FormTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Block/Express/FormTest.php index fe468190727..66c6ec7698d 100644 --- a/dev/tests/unit/testsuite/Magento/Paypal/Block/Express/FormTest.php +++ b/dev/tests/unit/testsuite/Magento/Paypal/Block/Express/FormTest.php @@ -67,8 +67,6 @@ class FormTest extends \PHPUnit_Framework_TestCase ->getMock(); $localeResolver = $this->getMock('Magento\Locale\ResolverInterface', array(), array(), '', false, false); - $appMock = $this->getMock('\Magento\Core\Model\App', array('getLocaleResolver'), array(), '', false); - $appMock->expects($this->any())->method('getLocaleResolver')->will($this->returnValue($localeResolver)); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_model = $helper->getObject( 'Magento\Paypal\Block\Express\Form', @@ -77,7 +75,7 @@ class FormTest extends \PHPUnit_Framework_TestCase 'paypalConfigFactory' => $paypalConfigFactory, 'currentCustomer' => $this->currentCustomer, 'layout' => $layout, - 'app' => $appMock + 'localeResolver' => $localeResolver ) ); } diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Block/Payflow/Link/IframeTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Block/Payflow/Link/IframeTest.php new file mode 100644 index 00000000000..aefd6a256cb --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Paypal/Block/Payflow/Link/IframeTest.php @@ -0,0 +1,66 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Paypal\Block\Payflow\Link; + +/** + * Test for Iframe block + * + * @package Magento\Paypal\Block\Payflow\Link + */ +class IframeTest extends \PHPUnit_Framework_TestCase +{ + /** + * Check that isScopePrivate is false + */ + public function testCheckIsScopePrivate() + { + $contextMock = $this->getMock('Magento\View\Element\Template\Context', [], [], '', false); + $checkoutSessionMock = $this->getMock('Magento\Checkout\Model\Session', [], [], '', false); + $orderFactoryMock = $this->getMock('Magento\Sales\Model\OrderFactory', ['getQuote'], [], '', false); + $hssHelperMock = $this->getMock('Magento\Paypal\Helper\Hss', [], [], '', false); + $paymentDataMock = $this->getMock('Magento\Payment\Helper\Data', [], [], '', false); + $quoteMock = $this->getMock('Magento\Sales\Model\Quote', ['getPayment', '__wakeup'], [], '', false); + $paymentMock = $this->getMock('Magento\Sales\Model\Quote\Payment', [], [], '', false); + + $checkoutSessionMock->expects($this->any()) + ->method('getQuote') + ->will($this->returnValue($quoteMock)); + $quoteMock->expects($this->any()) + ->method('getPayment') + ->will($this->returnValue($paymentMock)); + $hssHelperMock->expects($this->any()) + ->method('getHssMethods') + ->will($this->returnValue([])); + + $block = new \Magento\Paypal\Block\Payflow\Advanced\Iframe( + $contextMock, + $orderFactoryMock, + $checkoutSessionMock, + $hssHelperMock, + $paymentDataMock + ); + + $this->assertFalse($block->isScopePrivate()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Block/PayflowExpress/FormTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Block/PayflowExpress/FormTest.php index 381ccfcdf58..18df9b8c4a2 100644 --- a/dev/tests/unit/testsuite/Magento/Paypal/Block/PayflowExpress/FormTest.php +++ b/dev/tests/unit/testsuite/Magento/Paypal/Block/PayflowExpress/FormTest.php @@ -61,12 +61,14 @@ class FormTest extends \PHPUnit_Framework_TestCase $this->returnValue($mark) ); $localeResolver = $this->getMock('Magento\Locale\ResolverInterface', array(), array(), '', false, false); - $appMock = $this->getMock('\Magento\Core\Model\App', array('getLocaleResolver'), array(), '', false); - $appMock->expects($this->any())->method('getLocaleResolver')->will($this->returnValue($localeResolver)); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_model = $helper->getObject( 'Magento\Paypal\Block\PayflowExpress\Form', - array('paypalConfigFactory' => $paypalConfigFactory, 'layout' => $layout, 'app' => $appMock) + [ + 'paypalConfigFactory' => $paypalConfigFactory, + 'layout' => $layout, + 'localeResolver' => $localeResolver + ] ); } diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Model/ObserverTest.php index 2b6af881854..c0f2a215abf 100644 --- a/dev/tests/unit/testsuite/Magento/Paypal/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Paypal/Model/ObserverTest.php @@ -212,8 +212,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $agreement = $this->getMock('Magento\Paypal\Model\Billing\Agreement', array(), array(), '', false); $agreement->expects($this->once())->method('isValid')->will($this->returnValue($isValid)); $comment = $this->getMockForAbstractClass( - 'Magento\Core\Model\AbstractModel', - array(), + 'Magento\Model\AbstractModel', + [], '', false, true, diff --git a/dev/tests/unit/testsuite/Magento/Persistent/Model/SessionTest.php b/dev/tests/unit/testsuite/Magento/Persistent/Model/SessionTest.php index 3f2e1f3598f..bdf98a26f30 100644 --- a/dev/tests/unit/testsuite/Magento/Persistent/Model/SessionTest.php +++ b/dev/tests/unit/testsuite/Magento/Persistent/Model/SessionTest.php @@ -40,33 +40,34 @@ class SessionTest extends \PHPUnit_Framework_TestCase */ protected $_cookieMock; - /** - * @var \Magento\Core\Model\Resource\AbstractResource|\PHPUnit_Framework_MockObject_MockObject - */ - protected $_resource; - protected function setUp() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_configMock = $this->getMock('Magento\Session\Config\ConfigInterface'); $this->_cookieMock = $this->getMock('Magento\Stdlib\Cookie', array(), array(), '', false); - $this->_resource = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', - array(), - '', - false, - false, - true, - array('__wakeup', 'getIdFieldName', 'getConnection', 'beginTransaction', 'delete', 'commit', 'rollBack') + $resourceMock = $this->getMockForAbstractClass('Magento\Model\Resource\Db\AbstractDb', + array(), '', false, false, true, + array('__wakeup', 'getIdFieldName', 'getConnection', 'beginTransaction', 'delete', 'commit', 'rollBack')); + + $appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); + $eventDispatcherMock = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false, false); + $cacheManagerMock = $this->getMock('Magento\App\CacheInterface', array(), array(), '', false, false); + $loggerMock = $this->getMock('Magento\Logger', array(), array(), '', false); + $actionValidatorMock = $this->getMock( + '\Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false ); - $this->_model = $helper->getObject( - 'Magento\Persistent\Model\Session', - array( - 'sessionConfig' => $this->_configMock, - 'cookie' => $this->_cookieMock, - 'resource' => $this->_resource - ) + $actionValidatorMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); + + $context = new \Magento\Model\Context( + $loggerMock, $eventDispatcherMock, $cacheManagerMock, $appStateMock, $actionValidatorMock ); + + $this->_model = $helper->getObject('Magento\Persistent\Model\Session', array( + 'sessionConfig' => $this->_configMock, + 'cookie' => $this->_cookieMock, + 'resource' => $resourceMock, + 'context' => $context + )); } /** diff --git a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/CompositeTest.php b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/CompositeTest.php index 26d864ffe66..8a358cac536 100644 --- a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/CompositeTest.php +++ b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/CompositeTest.php @@ -59,32 +59,35 @@ class CompositeTest extends \PHPUnit_Framework_TestCase public function testRender() { $text = 'some text'; - $arguments = array('arg1', 'arg2'); + $arguments = ['arg1', 'arg2']; $resultAfterFirst = 'rendered text first'; $resultAfterSecond = 'rendered text second'; $this->rendererOne->expects( $this->once() )->method( - 'render' - )->with( - $text, - $arguments - )->will( - $this->returnValue($resultAfterFirst) - ); + 'render' + )->with( + [$text], + $arguments + )->will( + $this->returnValue($resultAfterFirst) + ); $this->rendererTwo->expects( $this->once() )->method( - 'render' - )->with( - $resultAfterFirst, - $arguments - )->will( - $this->returnValue($resultAfterSecond) - ); + 'render' + )->with( + [ + $text, + $resultAfterFirst + ], + $arguments + )->will( + $this->returnValue($resultAfterSecond) + ); - $this->assertEquals($resultAfterSecond, $this->object->render($text, $arguments)); + $this->assertEquals($resultAfterSecond, $this->object->render([$text], $arguments)); } } diff --git a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/InlineTest.php b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/InlineTest.php new file mode 100644 index 00000000000..453b1de3b1b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/InlineTest.php @@ -0,0 +1,91 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Phrase\Renderer; + +class InlineTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TranslateInterface + */ + protected $translator; + + /** + * @var \Magento\Phrase\Renderer\Translate + */ + protected $_renderer; + + /** + * @var \Magento\Translate\Inline\ProviderInterface + */ + protected $provider; + + protected function setUp() + { + $this->translator = $this->getMock('Magento\TranslateInterface', [], [], '', false); + $this->provider = $this->getMock('Magento\Translate\Inline\ProviderInterface', [], [], '', false); + + $this->renderer = new \Magento\Phrase\Renderer\Inline( + $this->translator, + $this->provider + ); + } + + public function testRenderIfInlineTranslationIsAllowed() + { + $theme = 'theme'; + $text = 'test'; + $result = sprintf('{{{%s}}{{%s}}}', $text, $theme); + + $this->translator->expects($this->once()) + ->method('getTheme') + ->will($this->returnValue($theme)); + + $inlineTranslate = $this->getMock('Magento\Translate\InlineInterface', [], [], '', []); + $inlineTranslate->expects($this->once()) + ->method('isAllowed') + ->will($this->returnValue(true)); + + $this->provider->expects($this->once()) + ->method('get') + ->will($this->returnValue($inlineTranslate)); + + $this->assertEquals($result, $this->renderer->render([$text], [])); + } + + public function testRenderIfInlineTranslationIsNotAllowed() + { + $text = 'test'; + + $inlineTranslate = $this->getMock('Magento\Translate\InlineInterface', [], [], '', []); + $inlineTranslate->expects($this->once()) + ->method('isAllowed') + ->will($this->returnValue(false)); + + $this->provider->expects($this->once()) + ->method('get') + ->will($this->returnValue($inlineTranslate)); + + $this->assertEquals($text, $this->renderer->render([$text], [])); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/PlaceholderTest.php b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/PlaceholderTest.php index 8db4fed7be6..d011a00e191 100644 --- a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/PlaceholderTest.php +++ b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/PlaceholderTest.php @@ -43,7 +43,7 @@ class PlaceholderTest extends \PHPUnit_Framework_TestCase */ public function testRenderPlaceholder($text, array $arguments, $result) { - $this->assertEquals($result, $this->_renderer->render($text, $arguments)); + $this->assertEquals($result, $this->_renderer->render([$text], $arguments)); } /** diff --git a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/TranslateTest.php b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/TranslateTest.php index 91fd867c990..e3ab5658d6f 100644 --- a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/TranslateTest.php +++ b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/TranslateTest.php @@ -46,20 +46,44 @@ class TranslateTest extends \PHPUnit_Framework_TestCase ); } - public function testTranslate() + public function testRenderByCode() { + $text = 'original text'; $result = 'rendered text'; $this->_translator->expects( $this->once() )->method( - 'translate' - )->with( - array('text', 'param1', 'param2', 'param3') + 'getTheme' )->will( - $this->returnValue($result) + $this->returnValue('theme') ); + $this->_translator->expects( + $this->once() + )->method( + 'getData' + )->will( + $this->returnValue(['theme::' . $text => $result]) + ); + + $this->assertEquals($result, $this->_renderer->render([$text], [])); + } + + public function testRenderByText() + { + $text = 'original text'; + $result = 'rendered text'; + + $this->_translator->expects($this->once()) + ->method('getTheme') + ->will($this->returnValue('theme')); + $this->_translator->expects($this->once()) + ->method('getData') + ->will($this->returnValue([ + 'theme::' . $text => $result, + $text => $result, + ])); - $this->assertEquals($result, $this->_renderer->render('text', array('param1', 'param2', 'param3'))); + $this->assertEquals($result, $this->_renderer->render([$text], [])); } } diff --git a/dev/tests/unit/testsuite/Magento/PhraseTest.php b/dev/tests/unit/testsuite/Magento/PhraseTest.php index b072e616195..4eacdbc290a 100644 --- a/dev/tests/unit/testsuite/Magento/PhraseTest.php +++ b/dev/tests/unit/testsuite/Magento/PhraseTest.php @@ -45,30 +45,31 @@ class PhraseTest extends \PHPUnit_Framework_TestCase public function testRendering() { $text = 'some text'; - $arguments = array('arg1', 'arg2'); + $arguments = ['arg1', 'arg2']; $result = 'rendered text'; - $phrase = new \Magento\Phrase($text, $arguments); $this->_renderer->expects( $this->once() )->method( 'render' )->with( - $text, + [$text], $arguments )->will( $this->returnValue($result) ); + $phrase = new \Magento\Phrase($text, $arguments); $this->assertEquals($result, $phrase->render()); } public function testRenderingWithoutRenderer() { $this->_removeRendererFromPhrase(); + $result = 'some text'; - $phrase = new \Magento\Phrase($result); + $phrase = new \Magento\Phrase($result); $this->assertEquals($result, $phrase->render()); } @@ -82,21 +83,21 @@ class PhraseTest extends \PHPUnit_Framework_TestCase public function testThatToStringIsAliasToRender() { $text = 'some text'; - $arguments = array('arg1', 'arg2'); + $arguments = ['arg1', 'arg2']; $result = 'rendered text'; - $phrase = new \Magento\Phrase($text, $arguments); $this->_renderer->expects( $this->once() )->method( 'render' )->with( - $text, + [$text], $arguments )->will( $this->returnValue($result) ); + $phrase = new \Magento\Phrase($text, $arguments); $this->assertEquals($result, (string)$phrase); } diff --git a/dev/tests/unit/testsuite/Magento/PubSub/Event/FactoryTest.php b/dev/tests/unit/testsuite/Magento/PubSub/Event/FactoryTest.php deleted file mode 100644 index 56fd99a57b7..00000000000 --- a/dev/tests/unit/testsuite/Magento/PubSub/Event/FactoryTest.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * \Magento\PubSub\Event\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $factory = new \Magento\PubSub\Event\Factory(); - $event = $factory->create('topic', array()); - - $this->assertInstanceOf('Magento\PubSub\EventInterface', $event); - } -} diff --git a/dev/tests/unit/testsuite/Magento/PubSub/Event/QueueWriterTest.php b/dev/tests/unit/testsuite/Magento/PubSub/Event/QueueWriterTest.php deleted file mode 100644 index 609c0e4c07a..00000000000 --- a/dev/tests/unit/testsuite/Magento/PubSub/Event/QueueWriterTest.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * \Magento\PubSub\Event\QueueWriter - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -class QueueWriterTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $event = $this->getMockBuilder('Magento\PubSub\EventInterface')->disableOriginalConstructor()->getMock(); - $queue = new \Magento\PubSub\Event\QueueWriter(); - $result = $queue->offer($event); - - $this->assertNull($result); - } -} diff --git a/dev/tests/unit/testsuite/Magento/PubSub/EventTest.php b/dev/tests/unit/testsuite/Magento/PubSub/EventTest.php deleted file mode 100644 index 7ee81b42468..00000000000 --- a/dev/tests/unit/testsuite/Magento/PubSub/EventTest.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/** - * \Magento\PubSub\Event - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub; - -class EventTest extends \PHPUnit_Framework_TestCase -{ - public function testGetters() - { - $bodyData = array('some' => 'body'); - $topic = 'topic'; - - $event = new \Magento\PubSub\Event($topic, $bodyData); - - $this->assertEquals(array(), $event->getHeaders()); - $this->assertEquals($bodyData, $event->getBodyData()); - $this->assertEquals($topic, $event->getTopic()); - $this->assertEquals(\Magento\PubSub\Event::STATUS_READY_TO_SEND, $event->getStatus()); - } - - public function testComplete() - { - $bodyData = array('some' => 'body'); - $topic = 'topic'; - $event = new \Magento\PubSub\Event($topic, $bodyData); - - $event->complete(); - - $this->assertEquals(\Magento\PubSub\Event::STATUS_PROCESSED, $event->getStatus()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/PubSub/Message/DispatcherAsyncTest.php b/dev/tests/unit/testsuite/Magento/PubSub/Message/DispatcherAsyncTest.php deleted file mode 100644 index dcd66a6e724..00000000000 --- a/dev/tests/unit/testsuite/Magento/PubSub/Message/DispatcherAsyncTest.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php -/** - * \Magento\PubSub\Message\DispatcherAsync - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Message; - -class DispatcherAsyncTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\PubSub\Message\DispatcherAsync */ - private $_dispatcher; - - /** \PHPUnit_Framework_MockObject_MockObject */ - private $_eventFactoryMock; - - /** \PHPUnit_Framework_MockObject_MockObject */ - private $_eventMock; - - /** @var string[] Data that gets passed to event factory */ - private $_actualData = array(); - - /** \PHPUnit_Framework_MockObject_MockObject */ - private $_queueWriter; - - protected function setUp() - { - $this->_eventFactoryMock = $this->getMockBuilder( - 'Magento\PubSub\Event\FactoryInterface' - )->disableOriginalConstructor()->getMock(); - - $this->_queueWriter = $this->getMockBuilder( - 'Magento\PubSub\Event\QueueWriterInterface' - )->disableOriginalConstructor()->getMock(); - $this->_queueWriter->expects($this->once())->method('offer'); - - // When the create method is called, program routes to the logEventData callback to log what arguments it - // received. - $this->_eventFactoryMock->expects( - $this->once() - )->method( - 'create' - )->with()->will( - $this->returnCallback(array($this, 'logEventData')) - ); - $this->_eventMock = $this->getMockBuilder( - 'Magento\PubSub\EventInterface' - )->disableOriginalConstructor()->getMock(); - - $this->_dispatcher = new \Magento\PubSub\Message\DispatcherAsync( - $this->_eventFactoryMock, - $this->_queueWriter - ); - } - - public function testDispatch() - { - $expectedData = array('topic' => 'event_topic', 'data' => 'event_data'); - $this->_dispatcher->dispatch($expectedData['topic'], $expectedData['data']); - $this->assertEquals($expectedData, $this->_actualData); - } - - /** - * Log the topic and data that are passed to the event factory's create method. This is to ensure that the - * create method is called as expected. - * - * @param $topic - * @param $data - * @return \PHPUnit_Framework_MockObject_MockObject - */ - public function logEventData($topic, $data) - { - $this->_actualData = array('topic' => $topic, 'data' => $data); - return $this->_eventMock; - } -} diff --git a/dev/tests/unit/testsuite/Magento/Review/Block/Adminhtml/MainTest.php b/dev/tests/unit/testsuite/Magento/Review/Block/Adminhtml/MainTest.php new file mode 100644 index 00000000000..5e8660335d1 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Review/Block/Adminhtml/MainTest.php @@ -0,0 +1,74 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Review\Block\Adminhtml; + +use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper; + +class MainTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Review\Block\Adminhtml\Main + */ + protected $model; + + /** + * @var \Magento\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $request; + + /** + * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $customerAccount; + + public function testConstruct() + { + $this->customerAccount = $this + ->getMockForAbstractClass('Magento\Customer\Service\V1\CustomerAccountServiceInterface'); + $this->customerAccount->expects($this->once()) + ->method('getCustomer') + ->with('customer id') + ->will($this->returnValue(new \Magento\Object())); + $this->request = $this->getMockForAbstractClass('Magento\App\RequestInterface'); + $this->request->expects($this->at(0)) + ->method('getParam') + ->with('customerId', false) + ->will($this->returnValue('customer id')); + $this->request->expects($this->at(1)) + ->method('getParam') + ->with('productId', false) + ->will($this->returnValue(false)); + + + $objectManagerHelper = new ObjectManagerHelper($this); + $this->model = $objectManagerHelper->getObject( + 'Magento\Review\Block\Adminhtml\Main', + [ + 'request' => $this->request, + 'customerAccount' => $this->customerAccount + ] + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Review/Model/Resource/Review/Summary/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Review/Model/Resource/Review/Summary/CollectionTest.php new file mode 100644 index 00000000000..cfd7e6a9abc --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Review/Model/Resource/Review/Summary/CollectionTest.php @@ -0,0 +1,146 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Review\Model\Resource\Review\Summary; + +class CollectionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Collection + */ + protected $collection; + + /** + * @var \Magento\Data\Collection\Db\FetchStrategy\Query|\PHPUnit_Framework_MockObject_MockObject + */ + protected $fetchStrategyMock; + + /** + * @var \Magento\Core\Model\EntityFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entityFactoryMock; + + /** + * @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject + */ + protected $loggerMock; + + /** + * @var \Magento\App\Resource|\PHPUnit_Framework_MockObject_MockObject + */ + protected $resourceMock; + + /** + * @var \Zend_Db_Adapter_Pdo_Mysql|\PHPUnit_Framework_MockObject_MockObject + */ + protected $adapterMock; + + /** + * @var \Magento\DB\Select|\PHPUnit_Framework_MockObject_MockObject + */ + protected $selectMock; + + protected function setUp() + { + $this->fetchStrategyMock = $this->getMock( + 'Magento\Data\Collection\Db\FetchStrategy\Query', array('fetchAll'), array(), '', false + ); + $this->entityFactoryMock = $this->getMock( + 'Magento\Core\Model\EntityFactory', array('create'), array(), '', false + ); + $this->loggerMock = $this->getMock('Magento\Logger', array('log'), array(), '', false); + $this->resourceMock = $this->getMock( + 'Magento\App\Resource', array('getConnection', 'getTableName'), array(), '', false + ); + $this->adapterMock = $this->getMock( + 'Zend_Db_Adapter_Pdo_Mysql', array('select', 'query'), array(), '', false + ); + $this->selectMock = $this->getMock( + 'Magento\DB\Select', array('from'), array('adapter' => $this->adapterMock) + ); + $this->adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($this->selectMock)); + $this->resourceMock->expects($this->once()) + ->method('getConnection') + ->will($this->returnValue($this->adapterMock)); + $this->resourceMock->expects($this->once()) + ->method('getTableName') + ->will($this->returnArgument(0)); + + $this->collection = new Collection( + $this->entityFactoryMock, + $this->loggerMock, + $this->fetchStrategyMock, + $this->resourceMock + ); + } + + public function testFetchItem() + { + $data = array(1 => 'test'); + $statementMock = $this->getMock('Zend_Db_Statement_Pdo', array('fetch'), array(), '', false); + $statementMock->expects($this->once()) + ->method('fetch') + ->will($this->returnValue($data)); + + $this->adapterMock->expects($this->once()) + ->method('query') + ->with($this->selectMock, $this->anything()) + ->will($this->returnValue($statementMock)); + + $objectMock = $this->getMock('Magento\Object', array('setData'), array()); + $objectMock->expects($this->once()) + ->method('setData') + ->with($data); + $this->entityFactoryMock->expects($this->once()) + ->method('create') + ->with('Magento\Review\Model\Review\Summary') + ->will($this->returnValue($objectMock)); + $item = $this->collection->fetchItem(); + + $this->assertEquals($objectMock, $item); + $this->assertEquals('primary_id', $item->getIdFieldName()); + } + + public function testLoad() + { + $data = array(10 => 'test'); + $this->fetchStrategyMock->expects($this->once()) + ->method('fetchAll') + ->with($this->selectMock, array()) + ->will($this->returnValue(array($data))); + + $objectMock = $this->getMock('Magento\Object', array('addData'), array()); + $objectMock->expects($this->once()) + ->method('addData') + ->with($data); + $this->entityFactoryMock->expects($this->once()) + ->method('create') + ->with('Magento\Review\Model\Review\Summary') + ->will($this->returnValue($objectMock)); + + $this->collection->load(); + } +} \ No newline at end of file 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 b852bfb658f..ef51a31fa26 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 @@ -226,7 +226,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase } /** - * Set expectations in case of \Magento\Core\Exception for saveAction method + * Set expectations in case of \Magento\Model\Exception for saveAction method * * @param array $data * @param string $errorMessage diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Config/Source/Order/StatusTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Config/Source/Order/StatusTest.php new file mode 100644 index 00000000000..067d6c06599 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Config/Source/Order/StatusTest.php @@ -0,0 +1,63 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Sales\Model\Config\Source\Order; + +use Magento\TestFramework\Helper\ObjectManager; + +class StatusTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Sales\Model\Config\Source\Order\Status */ + protected $object; + + /** @var ObjectManager */ + protected $objectManager; + + /** @var \Magento\Sales\Model\Order\Config|\PHPUnit_Framework_MockObject_MockObject */ + protected $config; + + protected function setUp() + { + $this->config = $this->getMock('Magento\Sales\Model\Order\Config', [], [], '', false); + + $this->objectManager = new ObjectManager($this); + $this->object = $this->objectManager->getObject('Magento\Sales\Model\Config\Source\Order\Status', [ + 'orderConfig' => $this->config + ]); + } + + public function testToOptionArray() + { + $this->config->expects($this->once())->method('getStateStatuses') + ->will($this->returnValue(['status1', 'status2'])); + + $this->assertEquals( + [ + ['value' => '', 'label' => '-- Please Select --'], + ['value' => 0, 'label' => 'status1'], + ['value' => 1, 'label' => 'status2'], + ], + $this->object->toOptionArray() + ); + } +} 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 cb784de4afb..3b7196b1a54 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 @@ -42,7 +42,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $paymentData = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false); $string = $this->getMock('Magento\Stdlib\String', array(), array(), '', false); $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - $translate = $this->getMock('Magento\TranslateInterface', array(), array(), '', false); + $translate = $this->getMock('Magento\Translate\Inline\StateInterface', array(), array(), '', false); $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $pdfItemsFactory = $this->getMock('Magento\Sales\Model\Order\Pdf\ItemsFactory', array(), array(), '', false); $localeMock = $this->getMock('Magento\Stdlib\DateTime\TimezoneInterface', array(), array(), '', false, false); @@ -98,20 +98,20 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $model = $this->getMockForAbstractClass( 'Magento\Sales\Model\Order\Pdf\AbstractPdf', array( - $paymentData, - $string, - $coreStoreConfig, - $translate, + $paymentData, + $string, + $coreStoreConfig, $filesystem, - $pdfConfig, - $pdfTotalFactory, - $pdfItemsFactory, - $localeMock + $pdfConfig, + $pdfTotalFactory, + $pdfItemsFactory, + $localeMock, + $translate ), - '', - true, - false, - true, + '', + true, + false, + true, array('drawLineBlocks') ); $model->expects($this->once())->method('drawLineBlocks')->will($this->returnValue($page)); 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 3b8add09c86..65e5113b753 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 @@ -40,7 +40,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase $paymentDataMock = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false); $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\TranslateInterface', array(), array(), '', false, false); + $translateMock = $this->getMock('Magento\Translate\Inline\StateInterface', array(), array(), '', false, false); $directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false, false); $directoryMock->expects($this->any())->method('getAbsolutePath')->will( $this->returnCallback( @@ -99,12 +99,12 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase $paymentDataMock, $stringMock, $storeConfigMock, - $translateMock, $filesystemMock, $this->_pdfConfigMock, $totalFactoryMock, $pdfItemsFactoryMock, $localeDateMock, + $translateMock, $storeManagerMock, $localeResolverMock, array() diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Total/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Total/FactoryTest.php index be178a30970..552a2caf3c4 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Total/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Total/FactoryTest.php @@ -87,7 +87,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage The PDF total model TEST must be or extend * \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal. */ diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Total/Config/BaseTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Total/Config/BaseTest.php new file mode 100644 index 00000000000..52e5dc3b1d8 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Total/Config/BaseTest.php @@ -0,0 +1,156 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Sales\Model\Order\Total\Config; + +use Magento\TestFramework\Helper\ObjectManager; + +class BaseTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Sales\Model\Order\Total\Config\Base */ + protected $object; + + /** @var \Magento\App\Cache\Type\Config|\PHPUnit_Framework_MockObject_MockObject */ + protected $configCacheType; + + /** @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject */ + protected $logger; + + /** @var \Magento\Sales\Model\Config|\PHPUnit_Framework_MockObject_MockObject */ + protected $salesConfig; + + /** @var \Magento\Sales\Model\Order\TotalFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $orderTotalFactory; + + protected function setUp() + { + $this->configCacheType = $this->getMock('Magento\App\Cache\Type\Config', [], [], '', false); + $this->logger = $this->getMock('Magento\Logger', [], [], '', false); + $this->salesConfig = $this->getMock('Magento\Sales\Model\Config', [], [], '', false); + $this->orderTotalFactory = $this->getMock('Magento\Sales\Model\Order\TotalFactory', [], [], '', false); + + $objectManager = new ObjectManager($this); + $this->object = $objectManager->getObject('Magento\Sales\Model\Order\Total\Config\Base', [ + 'configCacheType' => $this->configCacheType, + 'logger' => $this->logger, + 'salesConfig' => $this->salesConfig, + 'orderTotalFactory' => $this->orderTotalFactory, + ]); + } + + public function testGetTotalModels() + { + $total = $this->getMockForAbstractClass('Magento\Sales\Model\Order\Total\AbstractTotal'); + $this->salesConfig->expects($this->once())->method('getGroupTotals')->will( + $this->returnValue([ + 'some_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1903], + 'other_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1723], + ]) + ); + + $this->orderTotalFactory->expects($this->any())->method('create') + ->with('Magento\Sales\Model\Order\Total\AbstractTotal') + ->will($this->returnValue($total)); + + $this->configCacheType->expects($this->once())->method('save') + ->with('a:2:{i:0;s:10:"other_code";i:1;s:9:"some_code";}', 'sorted_collectors'); + + $this->assertSame( + ['other_code' => $total, 'some_code' => $total], + $this->object->getTotalModels() + ); + } + + /** + * @expectedException Magento\Model\Exception + * @expectedExceptionMessage The total model should be extended from \Magento\Sales\Model\Order\Total\AbstractTotal. + */ + public function testGetTotalModelsInvalidTotalModel() + { + $this->salesConfig->expects($this->once())->method('getGroupTotals')->will( + $this->returnValue([ + 'some_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1903], + 'other_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1723], + ]) + ); + + $this->orderTotalFactory->expects($this->any())->method('create') + ->with('Magento\Sales\Model\Order\Total\AbstractTotal') + ->will($this->returnValue($this)); + + $this->object->getTotalModels(); + } + + public function testGetTotalUnserializeCachedCollectorCodes() + { + $total = $this->getMockForAbstractClass('Magento\Sales\Model\Order\Total\AbstractTotal'); + $this->salesConfig->expects($this->any())->method('getGroupTotals')->will( + $this->returnValue([ + 'some_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1903], + 'other_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1723], + ]) + ); + + $this->orderTotalFactory->expects($this->any())->method('create') + ->with('Magento\Sales\Model\Order\Total\AbstractTotal') + ->will($this->returnValue($total)); + + $this->configCacheType->expects($this->once())->method('load')->with('sorted_collectors') + ->will($this->returnValue('a:2:{i:0;s:10:"other_code";i:1;s:9:"some_code";}')); + $this->configCacheType->expects($this->never())->method('save'); + + $this->assertSame( + ['other_code' => $total, 'some_code' => $total], + $this->object->getTotalModels() + ); + } + + public function testGetTotalModelsSortingSubroutine() + { + $total = $this->getMockForAbstractClass('Magento\Sales\Model\Order\Total\AbstractTotal'); + $this->salesConfig->expects($this->once())->method('getGroupTotals')->will( + $this->returnValue([ + 'some_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1903], + 'other_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1112], + 'equal_order' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1112], + 'big_order' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 3000], + 'no_order' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal'], + ]) + ); + + $this->orderTotalFactory->expects($this->any())->method('create') + ->with('Magento\Sales\Model\Order\Total\AbstractTotal') + ->will($this->returnValue($total)); + + $this->assertSame( + [ + 'no_order' => $total, + 'equal_order' => $total, + 'other_code' => $total, + 'some_code' => $total, + 'big_order' => $total, + ], + $this->object->getTotalModels() + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php b/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php index 24c6fb96fc5..615893e4b31 100644 --- a/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php +++ b/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php @@ -173,7 +173,7 @@ class SitemapTest extends \PHPUnit_Framework_TestCase /** * Check not allowed sitemap path validation * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Please define a correct path. */ public function testNotAllowedPath() @@ -186,7 +186,7 @@ class SitemapTest extends \PHPUnit_Framework_TestCase /** * Check not exists sitemap path validation * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Please create the specified folder "" before saving the sitemap. */ public function testPathNotExists() @@ -200,7 +200,7 @@ class SitemapTest extends \PHPUnit_Framework_TestCase /** * Check not writable sitemap path validation * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Please make sure that "/" is writable by the web-server. */ public function testPathNotWritable() @@ -216,7 +216,7 @@ class SitemapTest extends \PHPUnit_Framework_TestCase /** * Check invalid chars in sitemap filename validation * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Please use only letters (a-z or A-Z), numbers (0-9) or underscores (_) in the filename. No spaces or other characters are allowed. */ //@codingStandardsIgnoreEnd diff --git a/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/FactoryTest.php index 0b60f8dda9c..21b055cfc42 100644 --- a/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/FactoryTest.php @@ -98,7 +98,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase $taxClassFactory = new \Magento\Tax\Model\TaxClass\Factory($objectManager); $this->setExpectedException( - 'Magento\Core\Exception', + 'Magento\Model\Exception', sprintf('Invalid type of tax class "%s"', $wrongClassType) ); $taxClassFactory->create($classMock); diff --git a/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php index de302bec852..b2d4be0733b 100644 --- a/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php +++ b/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php @@ -31,7 +31,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase public function testGetAssignedObjects() { $collectionMock = $this->getMockBuilder( - 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection' + 'Magento\Model\Resource\Db\Collection\AbstractCollection' )->setMethods( array('addFieldToFilter') )->disableOriginalConstructor()->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/ProductTest.php b/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/ProductTest.php index b1e846dd801..b6a2f3ac5b6 100644 --- a/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/ProductTest.php +++ b/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/ProductTest.php @@ -31,7 +31,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase public function testGetAssignedObjects() { $collectionMock = $this->getMockBuilder( - 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection' + 'Magento\Model\Resource\Db\Collection\AbstractCollection' )->setMethods( array('addAttributeToFilter') )->disableOriginalConstructor()->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/XmlScannerTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/XmlScannerTest.php index 5ed420965b7..bfff47d2609 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/XmlScannerTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/XmlScannerTest.php @@ -89,7 +89,7 @@ class XmlScannerTest extends \PHPUnit_Framework_TestCase 'Invalid proxy class for ' . substr('\Magento\SomeModule\Model\Nested\Element\Proxy', 0, -5) ); $actual = $this->_model->collectEntities($this->_testFiles); - $expected = array('Magento\Core\Model\App\Proxy'); + $expected = array('Magento\App\Request\Http\Proxy'); $this->assertEquals($expected, $actual); } } diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/etc/di.xml b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/etc/di.xml index 5730fc299b5..a2992be9491 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/etc/di.xml +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/etc/di.xml @@ -24,7 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../../../lib/Magento/ObjectManager/etc/config.xsd"> - <preference for="Magento\AppInterface" type="Magento\Core\Model\App\Proxy" /> + <preference for="Magento\App\RequestInterface" type="Magento\App\Request\Http\Proxy" /> <preference for="Magento\Core\Model\Config\InvalidatorInterface" type="Magento\Core\Model\Config\Invalidator\Proxy" /> <preference for="Magento\App\CacheInterface" type="Magento\App\Cache\Proxy" /> <virtualType name="custom_cache_instance" type="Magento\App\Cache"> diff --git a/dev/tests/unit/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/ThemeTest.php b/dev/tests/unit/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/ThemeTest.php index 5b52451ed93..d8d36e878a3 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/ThemeTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/ThemeTest.php @@ -47,11 +47,23 @@ class ThemeTest extends \PHPUnit_Framework_TestCase */ protected $_request; + /** + * @var \Magento\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $eventManager; + + /** + * @var \Magento\App\ViewInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $view; + protected function setUp() { $this->_objectManagerMock = $this->getMock('Magento\ObjectManager', array(), array(), '', false); $this->_request = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $this->eventManager = $this->getMock('\Magento\Event\ManagerInterface', array(), array(), '', false); + $this->view = $this->getMock('\Magento\App\ViewInterface', array(), array(), '', false); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_model = $helper->getObject( @@ -59,7 +71,9 @@ class ThemeTest extends \PHPUnit_Framework_TestCase array( 'request' => $this->_request, 'objectManager' => $this->_objectManagerMock, - 'response' => $this->getMock('Magento\App\Response\Http', array(), array(), '', false) + 'response' => $this->getMock('Magento\App\Response\Http', array(), array(), '', false), + 'eventManager' => $this->eventManager, + 'view' => $this->view, ) ); } @@ -78,50 +92,50 @@ class ThemeTest extends \PHPUnit_Framework_TestCase $this->_request->expects( $this->at(0) )->method( - 'getParam' - )->with( - 'back', - false - )->will( - $this->returnValue(true) - ); + 'getParam' + )->with( + 'back', + false + )->will( + $this->returnValue(true) + ); $this->_request->expects( $this->at(1) )->method( - 'getParam' - )->with( - 'theme' - )->will( - $this->returnValue($themeData) - ); + 'getParam' + )->with( + 'theme' + )->will( + $this->returnValue($themeData) + ); $this->_request->expects( $this->at(2) )->method( - 'getParam' - )->with( - 'custom_css_content' - )->will( - $this->returnValue($customCssContent) - ); + 'getParam' + )->with( + 'custom_css_content' + )->will( + $this->returnValue($customCssContent) + ); $this->_request->expects( $this->at(3) )->method( - 'getParam' - )->with( - 'js_removed_files' - )->will( - $this->returnValue($jsRemovedFiles) - ); + 'getParam' + )->with( + 'js_removed_files' + )->will( + $this->returnValue($jsRemovedFiles) + ); $this->_request->expects( $this->at(4) )->method( - 'getParam' - )->with( - 'js_order' - )->will( - $this->returnValue($jsOrder) - ); + 'getParam' + )->with( + 'js_order' + )->will( + $this->returnValue($jsOrder) + ); $this->_request->expects($this->once(5))->method('getPost')->will($this->returnValue(true)); $themeMock = $this->getMock( @@ -147,33 +161,63 @@ class ThemeTest extends \PHPUnit_Framework_TestCase $this->_objectManagerMock->expects( $this->at(0) )->method( - 'get' - )->with( - 'Magento\View\Design\Theme\FlyweightFactory' - )->will( - $this->returnValue($themeFactory) - ); + 'get' + )->with( + 'Magento\View\Design\Theme\FlyweightFactory' + )->will( + $this->returnValue($themeFactory) + ); $this->_objectManagerMock->expects( $this->at(1) )->method( - 'get' - )->with( - 'Magento\Theme\Model\Theme\Customization\File\CustomCss' - )->will( - $this->returnValue(null) - ); + 'get' + )->with( + 'Magento\Theme\Model\Theme\Customization\File\CustomCss' + )->will( + $this->returnValue(null) + ); $this->_objectManagerMock->expects( $this->at(2) )->method( - 'create' - )->with( - 'Magento\Theme\Model\Theme\SingleFile' - )->will( - $this->returnValue(null) - ); + 'create' + )->with( + 'Magento\Theme\Model\Theme\SingleFile' + )->will( + $this->returnValue(null) + ); $this->_model->saveAction(); } + + public function testIndexAction() + { + $menuModel = $this->getMock('\Magento\Backend\Model\Menu', array(), array(), '', false); + $menuModel->expects($this->once()) + ->method('getParentItems') + ->with($this->equalTo('Magento_Theme::system_design_theme')) + ->will($this->returnValue(array())); + + $menuBlock = $this->getMock('\Magento\Backend\Block\Menu', array(), array(), '', false); + $menuBlock->expects($this->once()) + ->method('getMenuModel') + ->will($this->returnValue($menuModel)); + + $layout = $this->getMock('\Magento\View\LayoutInterface', array(), array(), '', false); + $layout->expects($this->any()) + ->method('getBlock') + ->with($this->equalTo('menu')) + ->will($this->returnValue($menuBlock)); + + $this->view->expects($this->once()) + ->method('getLayout') + ->will($this->returnValue($layout)); + + $this->eventManager->expects($this->once()) + ->method('dispatch') + ->with($this->equalTo('theme_registration_from_filesystem')) + ->will($this->returnValue(null)); + $this->_model->indexAction(); + } } 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 d1acfc769cb..8188053767b 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/Uploader/ServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/Uploader/ServiceTest.php @@ -223,7 +223,7 @@ class ServiceTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testUploadInvalidCssFile() { @@ -302,7 +302,7 @@ class ServiceTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testUploadInvalidJsFile() { 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 0efdc6f31e6..76f3ac2176c 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php @@ -155,7 +155,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase /** * @covers \Magento\Theme\Model\Wysiwyg\Storage::uploadFile - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testUploadInvalidFile() { @@ -253,7 +253,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase /** * @covers \Magento\Theme\Model\Wysiwyg\Storage::createFolder - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testCreateFolderWithInvalidName() { @@ -263,7 +263,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase /** * @covers \Magento\Theme\Model\Wysiwyg\Storage::createFolder - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testCreateFolderDirectoryAlreadyExist() { @@ -319,7 +319,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase /** * @covers \Magento\Theme\Model\Wysiwyg\Storage::getDirsCollection - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetDirsCollectionWrongDirName() { @@ -532,7 +532,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase /** * @covers \Magento\Theme\Model\Wysiwyg\Storage::deleteDirectory - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testDeleteRootDirectory() { diff --git a/dev/tests/unit/testsuite/Magento/Translate/Inline/ConfigFactoryTest.php b/dev/tests/unit/testsuite/Magento/Translate/Inline/ConfigFactoryTest.php deleted file mode 100644 index 60b6068ce48..00000000000 --- a/dev/tests/unit/testsuite/Magento/Translate/Inline/ConfigFactoryTest.php +++ /dev/null @@ -1,44 +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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Translate\Inline; - -class ConfigFactoryTest extends \PHPUnit_Framework_TestCase -{ - public function testGet() - { - $result = 'result'; - $objectManager = $this->getMockForAbstractClass('Magento\ObjectManager'); - $objectManager->expects( - $this->once() - )->method( - 'get' - )->with( - $this->equalTo('Magento\Translate\Inline\ConfigInterface') - )->will( - $this->returnValue($result) - ); - $factory = new \Magento\Translate\Inline\ConfigFactory($objectManager); - $this->assertEquals($result, $factory->get()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Translate/Inline/ProxyTest.php b/dev/tests/unit/testsuite/Magento/Translate/Inline/ProxyTest.php new file mode 100644 index 00000000000..05446a40ec8 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Translate/Inline/ProxyTest.php @@ -0,0 +1,153 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Translate\Inline; + +class ProxyTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + + /** + * @var \Magento\Translate\Inline|\PHPUnit_Framework_MockObject_MockObject + */ + protected $translateMock; + + protected function setUp() + { + $this->objectManagerMock = $this->getMock( + 'Magento\ObjectManager', + array('get', 'create', 'configure'), + array(), + '', + false + ); + $this->translateMock = $this->getMock('Magento\Translate\Inline', array(), array(), '', false); + } + + public function testIsAllowed() + { + $this->objectManagerMock->expects( + $this->once() + )->method( + 'get' + )->with( + 'Magento\Translate\Inline' + )->will( + $this->returnValue($this->translateMock) + ); + $this->objectManagerMock->expects($this->never())->method('create'); + $this->translateMock->expects($this->once())->method('isAllowed')->will($this->returnValue(false)); + + $model = new Proxy( + $this->objectManagerMock, + 'Magento\Translate\Inline', + true + ); + + $this->assertFalse($model->isAllowed()); + } + + public function testGetParser() + { + $parser = new \stdClass(); + $this->objectManagerMock->expects( + $this->once() + )->method( + 'create' + )->with( + 'Magento\Translate\Inline' + )->will( + $this->returnValue($this->translateMock) + ); + $this->objectManagerMock->expects($this->never())->method('get'); + $this->translateMock->expects($this->once())->method('getParser')->will($this->returnValue($parser)); + + + $model = new Proxy( + $this->objectManagerMock, + 'Magento\Translate\Inline', + false + ); + + $this->assertEquals($parser, $model->getParser()); + } + + public function testProcessResponseBody() + { + $isJson = true; + $this->objectManagerMock->expects( + $this->once() + )->method( + 'get' + )->with( + 'Magento\Translate\Inline' + )->will( + $this->returnValue($this->translateMock) + ); + $this->objectManagerMock->expects($this->never())->method('create'); + + $this->translateMock->expects($this->once()) + ->method('processResponseBody') + ->with('', $isJson) + ->will($this->returnSelf()); + + $model = new Proxy( + $this->objectManagerMock, + 'Magento\Translate\Inline', + true + ); + $body = ''; + + $this->assertEquals($this->translateMock, $model->processResponseBody($body, $isJson)); + } + + public function testGetAdditionalHtmlAttribute() + { + $this->objectManagerMock->expects( + $this->once() + )->method( + 'create' + )->with( + 'Magento\Translate\Inline' + )->will( + $this->returnValue($this->translateMock) + ); + $this->objectManagerMock->expects($this->never())->method('get'); + $this->translateMock->expects($this->exactly(2)) + ->method('getAdditionalHtmlAttribute') + ->with($this->logicalOr('some_value', null)) + ->will($this->returnArgument(0)); + + $model = new Proxy( + $this->objectManagerMock, + 'Magento\Translate\Inline', + false + ); + + $this->assertEquals('some_value', $model->getAdditionalHtmlAttribute('some_value')); + $this->assertNull($model->getAdditionalHtmlAttribute()); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Translate/Inline/StateTest.php b/dev/tests/unit/testsuite/Magento/Translate/Inline/StateTest.php new file mode 100644 index 00000000000..639ac538ee9 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Translate/Inline/StateTest.php @@ -0,0 +1,74 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Translate\Inline; + +class StateTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var State + */ + protected $model; + + protected function setUp() + { + $this->model = new State(); + } + + public function testIsEnabled() + { + $this->assertTrue($this->model->isEnabled()); + + $this->model->disable(); + $this->assertFalse($this->model->isEnabled()); + + $this->model->enable(); + $this->assertTrue($this->model->isEnabled()); + } + + public function testSuspend() + { + $this->assertTrue($this->model->isEnabled()); + + $this->model->suspend(); + $this->assertFalse($this->model->isEnabled()); + + $this->model->suspend(true); + $this->assertFalse($this->model->isEnabled()); + } + + public function testResume() + { + $this->assertTrue($this->model->isEnabled()); + + $this->model->resume(null); + $this->assertNull($this->model->isEnabled()); + + $this->model->resume(); + $this->assertNull($this->model->isEnabled()); + + $this->model->resume(false); + $this->assertFalse($this->model->isEnabled()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Translate/InlineTest.php b/dev/tests/unit/testsuite/Magento/Translate/InlineTest.php new file mode 100644 index 00000000000..dbc47938fa9 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Translate/InlineTest.php @@ -0,0 +1,320 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Translate; + +class InlineTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\BaseScopeResolverInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeResolverMock; + + /** + * @var \Magento\UrlInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $urlMock; + + /** + * @var \Magento\View\LayoutInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $layoutMock; + + /** + * @var \Magento\Translate\Inline\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $configMock; + + /** + * @var \Magento\Translate\Inline\ParserFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $parserMock; + + /** + * @var \Magento\Translate\Inline\StateInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $stateMock; + + protected function setUp() + { + $this->scopeResolverMock = $this->getMock('Magento\BaseScopeResolverInterface', array(), array(), '', false); + $this->urlMock = $this->getMock('Magento\UrlInterface', array(), array(), '', false); + $this->layoutMock = $this->getMock('Magento\View\LayoutInterface', array(), array(), '', false); + $this->configMock = $this->getMock('Magento\Translate\Inline\ConfigInterface', array(), array(), '', false); + $this->parserMock = $this->getMock('Magento\Translate\Inline\ParserInterface', array(), array(), '', false); + $this->stateMock = $this->getMock('Magento\Translate\Inline\StateInterface', array(), array(), '', false); + } + + /** + * @param bool $isEnabled + * @param bool $isActive + * @param bool $isDevAllowed + * @param bool $result + * @dataProvider isAllowedDataProvider + */ + public function testIsAllowed($isEnabled, $isActive, $isDevAllowed, $result) + { + $this->prepareIsAllowed($isEnabled, $isActive, $isDevAllowed); + + $model = new Inline( + $this->scopeResolverMock, + $this->urlMock, + $this->layoutMock, + $this->configMock, + $this->parserMock, + $this->stateMock + ); + + $this->assertEquals($result, $model->isAllowed()); + $this->assertEquals($result, $model->isAllowed()); + } + + public function isAllowedDataProvider() + { + return array( + array(true, true, true, true), + array(true, false, true, false), + array(true, true, false, false), + array(true, false, false, false), + array(false, true, true, false), + array(false, false, true, false), + array(false, true, false, false), + array(false, false, false, false), + ); + } + + public function testGetParser() + { + $model = new Inline( + $this->scopeResolverMock, + $this->urlMock, + $this->layoutMock, + $this->configMock, + $this->parserMock, + $this->stateMock + ); + $this->assertEquals($this->parserMock, $model->getParser()); + } + + /** + * @param string|array $body + * @param string $expected + * @dataProvider processResponseBodyStripInlineDataProvider + */ + public function testProcessResponseBodyStripInline($body, $expected) + { + $scope = 'admin'; + $this->prepareIsAllowed(false, true, true, $scope); + + $model = new Inline( + $this->scopeResolverMock, + $this->urlMock, + $this->layoutMock, + $this->configMock, + $this->parserMock, + $this->stateMock, + '', + '', + $scope + ); + $model->processResponseBody($body, true); + $this->assertEquals($body, $expected); + } + + public function processResponseBodyStripInlineDataProvider() + { + return array( + array('test', 'test'), + array('{{{aaaaaa}}{{bbbbb}}{{eeeee}}{{cccccc}}}', 'aaaaaa'), + array(array('test1', 'test2'), array('test1', 'test2'),), + array(array('{{{aaaaaa}}', 'test3'), array('{{{aaaaaa}}', 'test3'),), + array(array('{{{aaaaaa}}{{bbbbb}}', 'test4'), array('{{{aaaaaa}}{{bbbbb}}', 'test4'),), + array(array('{{{aaaaaa}}{{bbbbb}}{{eeeee}}{{cccccc}}}', 'test5'), array('aaaaaa', 'test5'),), + ); + } + + /** + * @param string $scope + * @param array|string $body + * @param array|string $expected + * @dataProvider processResponseBodyDataProvider + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + public function testProcessResponseBody($scope, $body, $expected) + { + $isJson = true; + if ($scope == 'admin') { + $this->prepareIsAllowed(true, true, true, $scope); + } + $jsonCall = is_array($body) ? 2 * (count($body) + 1) : 2; + $this->parserMock->expects( + $this->exactly($jsonCall) + )->method( + 'setIsJson' + )->will( + $this->returnValueMap(array( + array($isJson, $this->returnSelf()), + array(!$isJson, $this->returnSelf()), + )) + ); + $this->parserMock->expects( + $this->exactly(1) + )->method( + 'processResponseBodyString' + )->with( + is_array($body) ? reset($body) : $body + ); + $this->parserMock->expects( + $this->exactly(2) + )->method( + 'getContent' + )->will( + $this->returnValue(is_array($body) ? reset($body) : $body) + ); + + $model = new Inline( + $this->scopeResolverMock, + $this->urlMock, + $this->layoutMock, + $this->configMock, + $this->parserMock, + $this->stateMock, + '', + '', + $scope + ); + + $model->processResponseBody($body, $isJson); + $this->assertEquals($body, $expected); + } + + public function processResponseBodyDataProvider() + { + return array( + array('admin', 'test', 'test'), + array('not_admin', 'test1', 'test1'), + ); + } + + /** + * @param $scope + * @param $body + * @param $expected + * @dataProvider processResponseBodyGetInlineScriptDataProvider + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + public function testProcessResponseBodyGetInlineScript($scope, $body, $expected) + { + $isJson = true; + if ($scope == 'admin') { + $this->prepareIsAllowed(true, true, true, $scope); + } + $jsonCall = is_array($body) ? 2 * (count($body) + 1) : 2; + $this->parserMock->expects( + $this->exactly($jsonCall) + )->method( + 'setIsJson' + )->will( + $this->returnValueMap(array( + array($isJson, $this->returnSelf()), + array(!$isJson, $this->returnSelf()), + )) + ); + $this->parserMock->expects( + $this->exactly(1) + )->method( + 'processResponseBodyString' + )->with( + is_array($body) ? reset($body) : $body + ); + $this->parserMock->expects( + $this->exactly(2) + )->method( + 'getContent' + )->will( + $this->returnValue(is_array($body) ? reset($body) : $body) + ); + + $model = new Inline( + $this->scopeResolverMock, + $this->urlMock, + $this->layoutMock, + $this->configMock, + $this->parserMock, + $this->stateMock, + '', + '', + $scope + ); + + $model->processResponseBody($body, $isJson); + $this->assertEquals($body, $expected); + } + + public function processResponseBodyGetInlineScriptDataProvider() + { + return array( + array('admin', 'test', 'test'), + array('not_admin', 'test1', 'test1'), + ); + } + + /** + * @param bool $isEnabled + * @param bool $isActive + * @param bool $isDevAllowed + * @param null|string $scope + */ + protected function prepareIsAllowed($isEnabled, $isActive, $isDevAllowed, $scope = null) + { + $scopeMock = $this->getMock('Magento\BaseScopeInterface', array(), array(), '', false); + $this->stateMock->expects($this->any())->method('isEnabled')->will($this->returnValue($isEnabled)); + $this->scopeResolverMock->expects( + $this->once() + )->method( + 'getScope' + )->with( + $scope + )->will( + $this->returnValue($scopeMock) + ); + + $this->configMock->expects( + $this->once() + )->method( + 'isActive' + )->with( + $scopeMock + )->will( + $this->returnValue($isActive) + ); + + $this->configMock->expects( + $this->exactly((int)$isActive) + )->method( + 'isDevAllowed' + )->will( + $this->returnValue($isDevAllowed) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Translation/Model/Inline/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Translation/Model/Inline/ConfigTest.php new file mode 100644 index 00000000000..466850e73c4 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Translation/Model/Inline/ConfigTest.php @@ -0,0 +1,95 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Translation\Model\Inline; + +class ConfigTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Config + */ + protected $model; + + /** + * @var \Magento\Core\Model\Store\Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $storeConfigMock; + + /** + * @var \Magento\Core\Helper\Data|\PHPUnit_Framework_MockObject_MockObject + */ + protected $helperMock; + + protected function setUp() + { + $this->storeConfigMock = $this->getMock( + 'Magento\Core\Model\Store\Config', + array('getConfigFlag'), + array(), + '', + false + ); + $this->helperMock = $this->getMock('Magento\Core\Helper\Data', array('isDevAllowed'), array(), '', false); + $this->model = new Config( + $this->storeConfigMock, + $this->helperMock + ); + } + + public function testIsActive() + { + $store = 'some store'; + $result = 'result'; + + $this->storeConfigMock->expects( + $this->once() + )->method( + 'getConfigFlag' + )->with( + $this->equalTo('dev/translate_inline/active'), + $this->equalTo($store) + )->will( + $this->returnValue($result) + ); + + $this->assertEquals($result, $this->model->isActive($store)); + } + + public function testIsDevAllowed() + { + $store = 'some store'; + $result = 'result'; + + $this->helperMock->expects( + $this->once() + )->method( + 'isDevAllowed' + )->with( + $store + )->will( + $this->returnValue($result) + ); + + $this->assertEquals($result, $this->model->isDevAllowed($store)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Url/QueryParamsResolverTest.php b/dev/tests/unit/testsuite/Magento/Url/QueryParamsResolverTest.php new file mode 100644 index 00000000000..a2e8f51db4d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Url/QueryParamsResolverTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Url; + +use Magento\TestFramework\Helper\ObjectManager; + +class QueryParamsResolverTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Url\QueryParamsResolver */ + protected $object; + + protected function setUp() + { + $objectManager = new ObjectManager($this); + $this->object = $objectManager->getObject('Magento\Url\QueryParamsResolver'); + } + + public function testGetQuery() + { + $this->object->addQueryParams(['foo' => 'bar', 'true' => 'false']); + $this->assertEquals('foo=bar&true=false', $this->object->getQuery()); + } + + public function testGetQueryEscaped() + { + $this->object->addQueryParams(['foo' => 'bar', 'true' => 'false']); + $this->assertEquals('foo=bar&true=false', $this->object->getQuery(true)); + } + + public function testSetQuery() + { + $this->object->setQuery('foo=bar&true=false'); + $this->assertEquals(['foo' => 'bar', 'true' => 'false'], $this->object->getQueryParams()); + } + + public function testSetQueryIdempotent() + { + $this->object->setQuery(null); + $this->assertEquals([], $this->object->getQueryParams()); + } + + public function testSetQueryParam() + { + $this->object->setQueryParam('foo', 'bar'); + $this->object->setQueryParam('true', 'false'); + $this->object->setQueryParam('foo', 'bar'); + $this->assertEquals(['foo' => 'bar', 'true' => 'false'], $this->object->getQueryParams()); + } + + public function testSetQueryParams() + { + $this->object->setQueryParams(['foo' => 'bar', 'true' => 'false']); + $this->assertEquals(['foo' => 'bar', 'true' => 'false'], $this->object->getQueryParams()); + } + + public function testAddQueryParamsIdempotent() + { + $this->object->setData('query_params', ['foo' => 'bar', 'true' => 'false']); + $this->object->addQueryParams(['foo' => 'bar', 'true' => 'false']); + $this->assertEquals(['foo' => 'bar', 'true' => 'false'], $this->object->getQueryParams()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Url/RouteParamsResolverFactoryTest.php b/dev/tests/unit/testsuite/Magento/Url/RouteParamsResolverFactoryTest.php new file mode 100644 index 00000000000..a2ba6024047 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Url/RouteParamsResolverFactoryTest.php @@ -0,0 +1,55 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Url; + +use Magento\TestFramework\Helper\ObjectManager; + +class RouteParamsResolverFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Url\RouteParamsResolverFactory */ + protected $object; + + /** @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject */ + protected $objectManager; + + protected function setUp() + { + $this->objectManager = $this->getMock('Magento\ObjectManager'); + + $objectManager = new ObjectManager($this); + $this->object = $objectManager->getObject( + 'Magento\Url\RouteParamsResolverFactory', + ['objectManager' => $this->objectManager] + ); + } + + public function testCreate() + { + $producedInstance = $this->getMock('Magento\Url\RouteParamsResolverInterface'); + $this->objectManager->expects($this->once())->method('create')->with('Magento\Url\RouteParamsResolverInterface') + ->will($this->returnValue($producedInstance)); + + $this->assertSame($producedInstance, $this->object->create([])); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Url/ValidatorTest.php b/dev/tests/unit/testsuite/Magento/Url/ValidatorTest.php new file mode 100644 index 00000000000..e197b477f0a --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Url/ValidatorTest.php @@ -0,0 +1,58 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Url; + +use Magento\TestFramework\Helper\ObjectManager; + +class ValidatorTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Url\Validator */ + protected $object; + + /** @var string[] */ + protected $expectedValidationMessages = ['invalidUrl' => "Invalid URL '%value%'."]; + + protected function setUp() + { + $objectManager = new ObjectManager($this); + $this->object = $objectManager->getObject('Magento\Url\Validator'); + } + + public function testConstruct() + { + $this->assertEquals($this->expectedValidationMessages, $this->object->getMessageTemplates()); + } + + public function testIsValidWhenValid() + { + $this->assertEquals(true, $this->object->isValid('http://example.com')); + $this->assertEquals([], $this->object->getMessages()); + } + + public function testIsValidWhenInvalid() + { + $this->assertEquals(false, $this->object->isValid('%value%')); + $this->assertEquals($this->expectedValidationMessages, $this->object->getMessages()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/UrlTest.php b/dev/tests/unit/testsuite/Magento/UrlTest.php index ac07552b48b..7299071825e 100644 --- a/dev/tests/unit/testsuite/Magento/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/UrlTest.php @@ -18,40 +18,87 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Test class for \Magento\UrlInterface - */ namespace Magento; +/** + * Test class for Magento\Url + */ class UrlTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\UrlInterface + * @var \Magento\Core\Model\Url\RouteParamsResolver|\PHPUnit_Framework_MockObject_MockObject + */ + protected $routeParamsResolverMock; + + /** + * @var \Magento\Url\ScopeResolverInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeResolverMock; + + /** + * @var \Magento\Url\ScopeInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeMock; + + /** + * @var \Magento\Url\QueryParamsResolverInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $queryParamsResolverMock; + + /** + * @var \Magento\Session\SidResolverInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $_model; + protected $sidResolverMock; /** - * @var \Magento\TestFramework\Helper\ObjectManager + * @var \Magento\Session\Generic|\PHPUnit_Framework_MockObject_MockObject */ - protected $_objectManager; + protected $sessionMock; protected function setUp() { - $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $paramsResolverMock = $this->getMock('Magento\Url\RouteParamsResolverFactory', array(), array(), '', false); - $paramsResolver = $this->_objectManager->getObject('\Magento\Core\Model\Url\RouteParamsResolver'); - $paramsResolverMock->expects($this->any())->method('create')->will($this->returnValue($paramsResolver)); - $this->_model = $this->_objectManager->getObject( - '\Magento\Url', - array('routeParamsResolver' => $paramsResolverMock) - ); + $this->routeParamsResolverMock = $this->getMock('Magento\Core\Model\Url\RouteParamsResolver', + ['getType', 'hasData', 'getData', 'getRouteParams'], [], '', false); + $this->scopeResolverMock = $this->getMock('Magento\Url\ScopeResolverInterface'); + $this->scopeMock = $this->getMock('Magento\Url\ScopeInterface'); + $this->queryParamsResolverMock = $this->getMock('Magento\Url\QueryParamsResolverInterface', [], [], '', false); + $this->sidResolverMock = $this->getMock('Magento\Session\SidResolverInterface'); + $this->sessionMock = $this->getMock('Magento\Session\Generic', [], [], '', false); + } + + /** + * @return \Magento\Url\RouteParamsResolverFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected function getRouteParamsResolver() + { + $routeParamsResolverFactoryMock = $this->getMock('Magento\Url\RouteParamsResolverFactory', [], [], '', false); + $routeParamsResolverFactoryMock->expects($this->once())->method('create') + ->will($this->returnValue($this->routeParamsResolverMock)); + return $routeParamsResolverFactoryMock; + } + + /** + * @param array $mockMethods + * @return \Magento\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected function getRequestMock($mockMethods = []) + { + $interfaceMethods = array('getModuleName', 'setModuleName', 'getActionName', 'setActionName', 'getParam'); + return $this->getMock('Magento\App\RequestInterface', array_merge($interfaceMethods, $mockMethods)); + } + + /** + * @param array $arguments + * @return \Magento\Url + */ + protected function getUrlModel($arguments = []) + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + return $objectManager->getObject('Magento\Url', $arguments); } /** @@ -61,32 +108,15 @@ class UrlTest extends \PHPUnit_Framework_TestCase */ public function testGetCurrentUrl($port, $url) { - $methods = array( - 'getServer', - 'getScheme', - 'getHttpHost', - 'getModuleName', - 'setModuleName', - 'getActionName', - 'setActionName', - 'getParam' - ); - $requestMock = $this->getMock('\Magento\App\RequestInterface', $methods); - $requestMock->expects($this->at(0))->method('getServer')->with('SERVER_PORT')->will($this->returnValue($port)); - $requestMock->expects( - $this->at(1) - )->method( - 'getServer' - )->with( - 'REQUEST_URI' - )->will( - $this->returnValue('/fancy_uri') - ); + $requestMock = $this->getRequestMock(['getServer', 'getScheme', 'getHttpHost']); + $requestMock->expects($this->at(0))->method('getServer')->with('SERVER_PORT') + ->will($this->returnValue($port)); + $requestMock->expects($this->at(1))->method('getServer')->with('REQUEST_URI') + ->will($this->returnValue('/fancy_uri')); $requestMock->expects($this->once())->method('getScheme')->will($this->returnValue('http')); $requestMock->expects($this->once())->method('getHttpHost')->will($this->returnValue('example.com')); - /** @var \Magento\UrlInterface $model */ - $model = $this->_objectManager->getObject('Magento\Url', array('request' => $requestMock)); + $model = $this->getUrlModel(['request' => $requestMock]); $this->assertEquals($url, $model->getCurrentUrl()); } @@ -98,4 +128,465 @@ class UrlTest extends \PHPUnit_Framework_TestCase 'custom_port' => array(8080, 'http://example.com:8080/fancy_uri') ); } + + public function testGetUseSession() + { + $model = $this->getUrlModel(); + + $model->setUseSession(false); + $this->assertFalse((bool)$model->getUseSession()); + + $model->setUseSession(true); + $this->assertTrue($model->getUseSession()); + } + + public function testGetBaseUrlNotLinkType() + { + $model = $this->getUrlModel( + ['scopeResolver' => $this->scopeResolverMock, 'routeParamsResolver' => $this->getRouteParamsResolver()] + ); + + $baseUrl = 'base-url'; + $urlType = 'not-link'; + $this->routeParamsResolverMock->expects($this->any())->method('getType')->will($this->returnValue($urlType)); + $this->scopeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue($baseUrl)); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + + $baseUrlParams = ['_scope' => $this->scopeMock, '_type' => $urlType, '_secure' => true]; + $this->assertEquals($baseUrl, $model->getBaseUrl($baseUrlParams)); + } + + public function testGetUrlValidateFilter() + { + $model = $this->getUrlModel(); + $this->assertEquals('http://test.com', $model->getUrl('http://test.com')); + } + + /** + * @param string|array|bool $query + * @param string $queryResult + * @param string $returnUri + * @dataProvider getUrlDataProvider + */ + public function testGetUrl($query, $queryResult, $returnUri) + { + $requestMock = $this->getRequestMock(['isDirectAccessFrontendName', 'getAlias']); + $routeConfigMock = $this->getMock('Magento\App\Route\ConfigInterface'); + $model = $this->getUrlModel( + ['scopeResolver' => $this->scopeResolverMock, 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'queryParamsResolver' => $this->queryParamsResolverMock, + 'request' => $requestMock, 'routeConfig' => $routeConfigMock] + ); + + $baseUrl = 'http://localhost/index.php/'; + $urlType = \Magento\UrlInterface::URL_TYPE_LINK; + + $this->scopeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue($baseUrl)); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->routeParamsResolverMock->expects($this->any())->method('getType')->will($this->returnValue($urlType)); + $this->routeParamsResolverMock->expects($this->any())->method('getRouteParams') + ->will($this->returnValue(['id' => 100])); + $requestMock->expects($this->once())->method('isDirectAccessFrontendName')->will($this->returnValue(true)); + $routeConfigMock->expects($this->once())->method('getRouteFrontName')->will($this->returnValue('catalog')); + $this->queryParamsResolverMock->expects($this->once())->method('getQuery') + ->will($this->returnValue($queryResult)); + + $url = $model->getUrl('catalog/product/view', [ + '_fragment' => 'anchor', + '_escape' => 1, + '_query' => $query, + '_nosid' => 0, + 'id' => 100 + ]); + $this->assertEquals($returnUri, $url); + } + + public function testGetUrlIdempotentSetRoutePath() + { + $model = $this->getUrlModel([ + 'scopeResolver' => $this->scopeResolverMock, + 'routeParamsResolver' => $this->getRouteParamsResolver(), + ]); + $model->setData('route_path', 'catalog/product/view'); + + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + + $this->assertEquals('catalog/product/view', $model->getUrl('catalog/product/view')); + } + + public function testGetUrlIdempotentSetRouteName() + { + $model = $this->getUrlModel([ + 'scopeResolver' => $this->scopeResolverMock, + 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'request' => $this->getRequestMock(['isDirectAccessFrontendName', 'getAlias']), + ]); + $model->setData('route_name', 'catalog'); + + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + + $this->assertEquals('/product/view/', $model->getUrl('catalog/product/view')); + } + + public function testGetUrlRouteHasParams() + { + $this->routeParamsResolverMock->expects($this->any())->method('getRouteParams') + ->will($this->returnValue(['foo' => 'bar', 'true' => false])); + $model = $this->getUrlModel([ + 'scopeResolver' => $this->scopeResolverMock, + 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'request' => $this->getRequestMock(['isDirectAccessFrontendName', 'getAlias']), + ]); + + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + + $this->assertEquals('/index/index/foo/bar/', $model->getUrl('catalog')); + } + + public function testGetUrlRouteUseRewrite() + { + $this->routeParamsResolverMock->expects($this->any())->method('getRouteParams') + ->will($this->returnValue(['foo' => 'bar'])); + $request = $this->getRequestMock(['isDirectAccessFrontendName', 'getAlias']); + $request->expects($this->once())->method('getAlias')->will($this->returnValue('/catalog/product/view/')); + $model = $this->getUrlModel([ + 'scopeResolver' => $this->scopeResolverMock, + 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'request' => $request, + ]); + + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + + $this->assertEquals('/catalog/product/view/', $model->getUrl('catalog', ['_use_rewrite' => 1])); + } + + public function getUrlDataProvider() + { + return [ + 'string query' => [ + 'foo=bar', 'foo=bar', 'http://localhost/index.php/catalog/product/view/id/100/?foo=bar#anchor' + ], + 'array query' => [ + ['foo' => 'bar'], 'foo=bar', 'http://localhost/index.php/catalog/product/view/id/100/?foo=bar#anchor' + ], + 'without query' => [false, '', 'http://localhost/index.php/catalog/product/view/id/100/#anchor'], + ]; + } + + public function testGetUrlWithAsterisksPath() + { + $requestMock = $this->getRequestMock([ + 'isDirectAccessFrontendName', + 'getAlias', + 'getRequestedRouteName', + 'getRequestedControllerName', + 'getRequestedActionName', + ]); + $routeConfigMock = $this->getMock('Magento\App\Route\ConfigInterface'); + $model = $this->getUrlModel( + ['scopeResolver' => $this->scopeResolverMock, 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'queryParamsResolver' => $this->queryParamsResolverMock, + 'request' => $requestMock, 'routeConfig' => $routeConfigMock] + ); + + $baseUrl = 'http://localhost/index.php/'; + $urlType = \Magento\UrlInterface::URL_TYPE_LINK; + + $this->scopeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue($baseUrl)); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->routeParamsResolverMock->expects($this->any())->method('getType')->will($this->returnValue($urlType)); + $this->routeParamsResolverMock->expects($this->any())->method('getRouteParams') + ->will($this->returnValue(['key' => 'value'])); + $requestMock->expects($this->once())->method('isDirectAccessFrontendName')->will($this->returnValue(true)); + + $requestMock->expects($this->once())->method('getRequestedRouteName')->will($this->returnValue('catalog')); + $requestMock->expects($this->once())->method('getRequestedControllerName')->will($this->returnValue('product')); + $requestMock->expects($this->once())->method('getRequestedActionName')->will($this->returnValue('view')); + $routeConfigMock->expects($this->once())->method('getRouteFrontName')->will($this->returnValue('catalog')); + + $url = $model->getUrl('*/*/*/key/value'); + $this->assertEquals('http://localhost/index.php/catalog/product/view/key/value/', $url); + } + + public function testGetDirectUrl() + { + $requestMock = $this->getRequestMock(['isDirectAccessFrontendName', 'getAlias']); + $routeConfigMock = $this->getMock('Magento\App\Route\ConfigInterface'); + $model = $this->getUrlModel( + ['scopeResolver' => $this->scopeResolverMock, 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'queryParamsResolver' => $this->queryParamsResolverMock, + 'request' => $requestMock, 'routeConfig' => $routeConfigMock] + ); + + $baseUrl = 'http://localhost/index.php/'; + $urlType = \Magento\UrlInterface::URL_TYPE_LINK; + + $this->scopeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue($baseUrl)); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->routeParamsResolverMock->expects($this->any())->method('getType')->will($this->returnValue($urlType)); + $requestMock->expects($this->once())->method('isDirectAccessFrontendName')->will($this->returnValue(true)); + + $url = $model->getDirectUrl('direct-url'); + $this->assertEquals('http://localhost/index.php/direct-url', $url); + } + + /** + * @param string $url + * @dataProvider getRebuiltUrlDataProvider + */ + public function testGetRebuiltUrl($url) + { + $requestMock = $this->getRequestMock(['getHttpHost']); + $model = $this->getUrlModel([ + 'session' => $this->sessionMock, + 'request' => $requestMock, + 'sidResolver' => $this->sidResolverMock, + 'scopeResolver' => $this->scopeResolverMock, + 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'queryParamsResolver' => $this->queryParamsResolverMock, + ]); + + $this->queryParamsResolverMock->expects($this->once())->method('getQuery') + ->will($this->returnValue('query=123')); + + $this->assertEquals($url, $model->getRebuiltUrl($url)); + } + + public function testGetRedirectUrl() + { + $model = $this->getUrlModel( + ['routeParamsResolver' => $this->getRouteParamsResolver(), 'session' => $this->sessionMock, + 'sidResolver' => $this->sidResolverMock, 'queryParamsResolver' => $this->queryParamsResolverMock] + ); + + $this->sidResolverMock->expects($this->once())->method('getUseSessionInUrl')->will($this->returnValue(true)); + $this->sessionMock->expects($this->once())->method('getSessionIdForHost')->will($this->returnValue(false)); + $this->sidResolverMock->expects($this->once())->method('getUseSessionVar')->will($this->returnValue(true)); + $this->routeParamsResolverMock->expects($this->once())->method('hasData')->with('secure_is_forced') + ->will($this->returnValue(true)); + $this->sidResolverMock->expects($this->never())->method('getSessionIdQueryParam'); + $this->queryParamsResolverMock->expects($this->once())->method('getQuery')->will($this->returnValue('foo=bar')); + + $this->assertEquals('http://example.com/?foo=bar', $model->getRedirectUrl('http://example.com/')); + } + + public function testGetRedirectUrlWithSessionId() + { + $model = $this->getUrlModel( + ['routeParamsResolver' => $this->getRouteParamsResolver(), 'session' => $this->sessionMock, + 'sidResolver' => $this->sidResolverMock, 'queryParamsResolver' => $this->queryParamsResolverMock] + ); + + $this->sidResolverMock->expects($this->once())->method('getUseSessionInUrl')->will($this->returnValue(true)); + $this->sessionMock->expects($this->once())->method('getSessionIdForHost') + ->will($this->returnValue('session-id')); + $this->sidResolverMock->expects($this->once())->method('getUseSessionVar')->will($this->returnValue(false)); + $this->sidResolverMock->expects($this->once())->method('getSessionIdQueryParam'); + $this->queryParamsResolverMock->expects($this->once())->method('getQuery')->will($this->returnValue('foo=bar')); + + $this->assertEquals('http://example.com/?foo=bar', $model->getRedirectUrl('http://example.com/')); + } + + public function getRebuiltUrlDataProvider() + { + return [ + 'with port' => ['https://example.com:88/index.php/catalog/index/view?query=123#hash'], + 'without port' => ['https://example.com/index.php/catalog/index/view?query=123#hash'], + ]; + } + + public function testGetRouteUrlWithValidUrl() + { + $model = $this->getUrlModel(['routeParamsResolver' => $this->getRouteParamsResolver()]); + + $this->routeParamsResolverMock->expects($this->never())->method('unsetData'); + $this->assertEquals('http://example.com', $model->getRouteUrl('http://example.com')); + } + + public function testAddSessionParam() + { + $model = $this->getUrlModel([ + 'session' => $this->sessionMock, + 'sidResolver' => $this->sidResolverMock, + 'queryParamsResolver' => $this->queryParamsResolverMock, + ]); + + $this->sidResolverMock->expects($this->once())->method('getSessionIdQueryParam')->with($this->sessionMock) + ->will($this->returnValue('sid')); + $this->sessionMock->expects($this->once())->method('getSessionId')->will($this->returnValue('session-id')); + $this->queryParamsResolverMock->expects($this->once())->method('setQueryParam')->with('sid', 'session-id'); + + $model->addSessionParam(); + } + + /** + * @param bool $result + * @param string $baseUrl + * @param string $referrer + * @dataProvider isOwnOriginUrlDataProvider + */ + public function testIsOwnOriginUrl($result, $baseUrl, $referrer) + { + $requestMock = $this->getRequestMock(['setServer', 'getServer']); + $model = $this->getUrlModel(['scopeResolver' => $this->scopeResolverMock, 'request' => $requestMock]); + + $this->scopeMock->expects($this->any())->method('getBaseUrl')->will($this->returnValue($baseUrl)); + $this->scopeResolverMock->expects($this->any())->method('getScopes') + ->will($this->returnValue([$this->scopeMock])); + $requestMock->expects($this->once())->method('getServer')->with('HTTP_REFERER') + ->will($this->returnValue($referrer)); + + $this->assertEquals($result, $model->isOwnOriginUrl()); + } + + public function isOwnOriginUrlDataProvider() + { + return [ + 'is origin url' => [true, 'http://localhost/', 'http://localhost/'], + 'is not origin url' => [false, 'http://localhost/', 'http://example.com/'], + ]; + } + + /** + * @param string $urlType + * @param string $configPath + * @param bool $isSecure + * @param int $isSecureCallCount + * @param string $key + * @dataProvider getConfigDataDataProvider + */ + public function testGetConfigData($urlType, $configPath, $isSecure, $isSecureCallCount, $key) + { + $urlSecurityInfoMock = $this->getMock('Magento\Url\SecurityInfoInterface'); + $model = $this->getUrlModel([ + 'urlSecurityInfo' => $urlSecurityInfoMock, + 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'scopeResolver' => $this->scopeResolverMock, + ]); + + $this->routeParamsResolverMock->expects($this->at(0))->method('hasData')->with('secure_is_forced') + ->will($this->returnValue(false)); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->scopeMock->expects($this->once())->method('isUrlSecure')->will($this->returnValue(true)); + $this->routeParamsResolverMock->expects($this->at(1))->method('hasData')->with('secure') + ->will($this->returnValue(false)); + $this->routeParamsResolverMock->expects($this->any())->method('getType') + ->will($this->returnValue($urlType)); + $this->routeParamsResolverMock->expects($this->once())->method('getData')->will($this->returnValue($isSecure)); + $this->scopeMock->expects($this->once())->method('getConfig')->with($configPath) + ->will($this->returnValue('http://localhost/')); + $urlSecurityInfoMock->expects($this->exactly($isSecureCallCount))->method('isSecure') + ->will($this->returnValue(false)); + + $this->assertEquals('http://localhost/', $model->getConfigData($key)); + } + + public function getConfigDataDataProvider() + { + return [ + 'secure url' => ['some-type', 'web/secure/base_url_secure', true, 0, 'base_url_secure'], + 'unsecure url' => [ + \Magento\UrlInterface::URL_TYPE_LINK, 'web/unsecure/base_url_unsecure', false, 1, 'base_url_unsecure' + ], + ]; + } + + public function testGetConfigDataWithSecureIsForcedParam() + { + $model = $this->getUrlModel([ + 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'scopeResolver' => $this->scopeResolverMock, + ]); + + $this->routeParamsResolverMock->expects($this->once())->method('hasData')->with('secure_is_forced') + ->will($this->returnValue(true)); + $this->routeParamsResolverMock->expects($this->once())->method('getData')->with('secure') + ->will($this->returnValue(true)); + + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->scopeMock->expects($this->once())->method('getConfig')->with('web/secure/base_url_secure_forced') + ->will($this->returnValue('http://localhost/')); + + $this->assertEquals('http://localhost/', $model->getConfigData('base_url_secure_forced')); + } + + /** + * @param string $html + * @param string $result + * @dataProvider sessionUrlVarWithMatchedHostsAndBaseUrlDataProvider + */ + public function testSessionUrlVarWithMatchedHostsAndBaseUrl($html, $result) + { + $requestMock = $this->getRequestMock(['getHttpHost']); + $model = $this->getUrlModel( + ['session' => $this->sessionMock, 'request' => $requestMock, 'sidResolver' => $this->sidResolverMock, + 'scopeResolver' => $this->scopeResolverMock, 'routeParamsResolver' => $this->getRouteParamsResolver()] + ); + + $requestMock->expects($this->once())->method('getHttpHost')->will($this->returnValue('localhost')); + $this->scopeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('http://localhost')); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->sidResolverMock->expects($this->never())->method('getSessionIdQueryParam'); + + $this->assertEquals($result, $model->sessionUrlVar($html)); + } + + public function testSessionUrlVarWithoutMatchedHostsAndBaseUrl() + { + $requestMock = $this->getRequestMock(['getHttpHost']); + $model = $this->getUrlModel( + ['session' => $this->sessionMock, 'request' => $requestMock, 'sidResolver' => $this->sidResolverMock, + 'scopeResolver' => $this->scopeResolverMock, 'routeParamsResolver' => $this->getRouteParamsResolver()] + ); + + $requestMock->expects($this->once())->method('getHttpHost')->will($this->returnValue('localhost')); + $this->scopeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('http://example.com')); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->sidResolverMock->expects($this->once())->method('getSessionIdQueryParam') + ->will($this->returnValue('SID')); + $this->sessionMock->expects($this->once())->method('getSessionId') + ->will($this->returnValue('session-id')); + + $this->assertEquals( + '<a href="http://example.com/?SID=session-id">www.example.com</a>', + $model->sessionUrlVar('<a href="http://example.com/?___SID=U">www.example.com</a>') + ); + } + + public function sessionUrlVarWithMatchedHostsAndBaseUrlDataProvider() + { + return [ + [ + '<a href="http://example.com/?___SID=U?SID=session-id">www.example.com</a>', + '<a href="http://example.com/?SID=session-id">www.example.com</a>', + ], + [ + '<a href="http://example.com/?___SID=U&SID=session-id">www.example.com</a>', + '<a href="http://example.com/?SID=session-id">www.example.com</a>', + ], + [ + '<a href="http://example.com/?foo=bar&___SID=U?SID=session-id">www.example.com</a>', + '<a href="http://example.com/?foo=bar?SID=session-id">www.example.com</a>', + ], + [ + '<a href="http://example.com/?foo=bar&___SID=U&SID=session-id">www.example.com</a>', + '<a href="http://example.com/?foo=bar&SID=session-id">www.example.com</a>', + ], + ]; + } + + public function testSetRequest() + { + $requestMethods = ['getServer', 'getScheme', 'getHttpHost']; + $initRequestMock = $this->getRequestMock($requestMethods); + $requestMock = $this->getRequestMock($requestMethods); + $initRequestMock->expects($this->any())->method('getScheme')->will($this->returnValue('fake')); + $initRequestMock->expects($this->any())->method('getHttpHost')->will($this->returnValue('fake-host')); + $requestMock->expects($this->any())->method('getScheme')->will($this->returnValue('http')); + $requestMock->expects($this->any())->method('getHttpHost')->will($this->returnValue('example.com')); + + $model = $this->getUrlModel(['request' => $initRequestMock]); + $model->setRequest($requestMock); + $this->assertEquals('http://example.com', $model->getCurrentUrl()); + } } diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php index d4c8add6604..caa8a15dd3b 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php @@ -33,8 +33,8 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Core\Helper\Data */ protected $_helperMock; - /** @var \Magento\Core\Model\App */ - protected $_appMock; + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_appStateMock; /** @var \Magento\Logger */ protected $_loggerMock; @@ -46,7 +46,9 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase 'Magento\Core\Helper\Data' )->disableOriginalConstructor()->getMock(); - $this->_appMock = $this->getMockBuilder('Magento\Core\Model\App')->disableOriginalConstructor()->getMock(); + $this->_appStateMock = $this->getMockBuilder('Magento\App\State') + ->disableOriginalConstructor() + ->getMock(); $this->_loggerMock = $this->getMockBuilder('Magento\Logger')->disableOriginalConstructor()->getMock(); @@ -55,7 +57,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase /** Initialize SUT. */ $this->_errorProcessor = new \Magento\Webapi\Controller\ErrorProcessor( $this->_helperMock, - $this->_appMock, + $this->_appStateMock, $this->_loggerMock, $filesystemMock ); @@ -67,7 +69,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase { unset($this->_errorProcessor); unset($this->_helperMock); - unset($this->_appMock); + unset($this->_appStateMock); parent::tearDown(); } @@ -115,7 +117,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase { $_SERVER['HTTP_ACCEPT'] = 'json'; /** Mock app to return enabled developer mode flag. */ - $this->_appMock->expects($this->any())->method('isDeveloperMode')->will($this->returnValue(true)); + $this->_appStateMock->expects($this->any())->method('getMode')->will($this->returnValue('developer')); /** Assert that jsonEncode method will be executed once. */ $this->_helperMock->expects( $this->once() @@ -156,7 +158,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase { $_SERVER['HTTP_ACCEPT'] = 'xml'; /** Mock app to return enabled developer mode flag. */ - $this->_appMock->expects($this->any())->method('isDeveloperMode')->will($this->returnValue(true)); + $this->_appStateMock->expects($this->any())->method('getMode')->will($this->returnValue('developer')); /** Init output buffering to catch output via echo function. */ ob_start(); $this->_errorProcessor->render('Message', 'Trace message.', 401); @@ -187,7 +189,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase public function testMaskExceptionInDeveloperMode() { /** Mock app isDeveloperMode to return true. */ - $this->_appMock->expects($this->once())->method('isDeveloperMode')->will($this->returnValue(true)); + $this->_appStateMock->expects($this->once())->method('getMode')->will($this->returnValue('developer')); /** Init Logical exception. */ $errorMessage = 'Error Message'; $logicalException = new \LogicException($errorMessage); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/JsonTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/JsonTest.php index 2b107f68bcf..66a5c02f57c 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/JsonTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/JsonTest.php @@ -37,23 +37,17 @@ class JsonTest extends \PHPUnit_Framework_TestCase protected $_helperMock; /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_appMock; + protected $_appStateMock; protected function setUp() { /** Prepare mocks for SUT constructor. */ - $this->_helperMock = $this->getMockBuilder( - 'Magento\Core\Helper\Data' - )->disableOriginalConstructor()->getMock(); - $this->_appMock = $this->getMockBuilder( - 'Magento\Core\Model\App' - )->setMethods( - array('isDeveloperMode') - )->disableOriginalConstructor()->getMock(); + $this->_helperMock = $this->getMockBuilder('Magento\Core\Helper\Data')->disableOriginalConstructor()->getMock(); + $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); /** Initialize SUT. */ $this->_jsonDeserializer = new \Magento\Webapi\Controller\Rest\Request\Deserializer\Json( $this->_helperMock, - $this->_appMock + $this->_appStateMock ); parent::setUp(); } @@ -62,7 +56,7 @@ class JsonTest extends \PHPUnit_Framework_TestCase { unset($this->_jsonDeserializer); unset($this->_helperMock); - unset($this->_appMock); + unset($this->_appStateMock); parent::tearDown(); } @@ -99,14 +93,12 @@ class JsonTest extends \PHPUnit_Framework_TestCase public function testDeserializeInvalidEncodedBodyExceptionDeveloperModeOff() { /** Prepare mocks for SUT constructor. */ - $this->_helperMock->expects( - $this->once() - )->method( - 'jsonDecode' - )->will( - $this->throwException(new \Zend_Json_Exception()) - ); - $this->_appMock->expects($this->once())->method('isDeveloperMode')->will($this->returnValue(false)); + $this->_helperMock->expects($this->once()) + ->method('jsonDecode') + ->will($this->throwException(new \Zend_Json_Exception)); + $this->_appStateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue('production')); /** Initialize SUT. */ $inputInvalidJson = '{"key1":"test1"."key2":"test2"}'; try { @@ -135,7 +127,9 @@ class JsonTest extends \PHPUnit_Framework_TestCase new \Zend_Json_Exception('Decoding error:' . PHP_EOL . 'Decoding failed: Syntax error') ) ); - $this->_appMock->expects($this->once())->method('isDeveloperMode')->will($this->returnValue(true)); + $this->_appStateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue('developer')); /** Initialize SUT. */ $inputInvalidJson = '{"key1":"test1"."key2":"test2"}'; try { diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/XmlTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/XmlTest.php index d11c8cc738e..27303edf1a7 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/XmlTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/XmlTest.php @@ -32,21 +32,17 @@ class XmlTest extends \PHPUnit_Framework_TestCase protected $_xmlDeserializer; /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_appMock; + protected $_appStateMock; protected function setUp() { /** Prepare mocks for SUT constructor. */ $this->_xmlParserMock = $this->getMock('Magento\Xml\Parser', array('xmlToArray', 'loadXML')); - $this->_appMock = $this->getMockBuilder( - 'Magento\Core\Model\App' - )->setMethods( - array('isDeveloperMode') - )->disableOriginalConstructor()->getMock(); + $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); /** Initialize SUT. */ $this->_xmlDeserializer = new \Magento\Webapi\Controller\Rest\Request\Deserializer\Xml( $this->_xmlParserMock, - $this->_appMock + $this->_appStateMock ); parent::setUp(); } @@ -55,7 +51,7 @@ class XmlTest extends \PHPUnit_Framework_TestCase { unset($this->_xmlDeserializer); unset($this->_xmlParserMock); - unset($this->_appMock); + unset($this->_appStateMock); parent::tearDown(); } @@ -109,7 +105,9 @@ class XmlTest extends \PHPUnit_Framework_TestCase public function testDeserializeMagentoWebapiExceptionDeveloperModeOn() { /** Prepare mocks for SUT constructor. */ - $this->_appMock->expects($this->once())->method('isDeveloperMode')->will($this->returnValue(true)); + $this->_appStateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue('developer')); $errorMessage = 'End tag for "key1" was omitted.'; $this->_xmlDeserializer->handleErrors(null, $errorMessage, null, null); $this->_xmlParserMock->expects($this->once())->method('loadXML'); @@ -133,7 +131,9 @@ class XmlTest extends \PHPUnit_Framework_TestCase public function testDeserializeMagentoWebapiExceptionDeveloperModeOff() { /** Prepare mocks for SUT constructor. */ - $this->_appMock->expects($this->once())->method('isDeveloperMode')->will($this->returnValue(false)); + $this->_appStateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue('production')); $errorMessage = 'End tag for "key1" was omitted.'; $this->_xmlDeserializer->handleErrors(null, $errorMessage, null, null); $this->_xmlParserMock->expects($this->once())->method('loadXML'); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/ResponseTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/ResponseTest.php index f68b278b499..9794ae8436d 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/ResponseTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/ResponseTest.php @@ -30,8 +30,8 @@ class ResponseTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Webapi\Controller\Rest\Response */ protected $_responseRest; - /** @var \Magento\Core\Model\App */ - protected $_appMock; + /** @var \Magento\App\State */ + protected $_appStateMock; /** @var \Magento\Webapi\Controller\Rest\Response\Renderer\Xml */ protected $_rendererMock; @@ -49,16 +49,15 @@ class ResponseTest extends \PHPUnit_Framework_TestCase 'Magento\Webapi\Controller\Rest\Response\Renderer\Factory' )->disableOriginalConstructor()->getMock(); $rendererFactoryMock->expects($this->any())->method('get')->will($this->returnValue($this->_rendererMock)); - $this->_errorProcessorMock = $this->getMockBuilder( - 'Magento\Webapi\Controller\ErrorProcessor' - )->disableOriginalConstructor()->getMock(); - $this->_appMock = $this->getMockBuilder('Magento\Core\Model\App')->disableOriginalConstructor()->getMock(); + $this->_errorProcessorMock = $this->getMockBuilder('Magento\Webapi\Controller\ErrorProcessor') + ->disableOriginalConstructor()->getMock(); + $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); /** Init SUP. */ $this->_responseRest = new \Magento\Webapi\Controller\Rest\Response( $rendererFactoryMock, $this->_errorProcessorMock, - $this->_appMock + $this->_appStateMock ); $this->_responseRest->headersSentThrowsException = false; parent::setUp(); @@ -67,7 +66,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase protected function tearDown() { unset($this->_responseRest); - unset($this->_appMock); + unset($this->_appStateMock); unset($this->_rendererMock); unset($this->_errorProcessorMock); parent::tearDown(); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php index 46d2a35bfa2..041cf7add6b 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php @@ -54,6 +54,16 @@ class RestTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Authz\Service\AuthorizationV1Interface */ protected $_authzServiceMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $areaListMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $areaMock; + const SERVICE_METHOD = 'testMethod'; const SERVICE_ID = 'Magento\Webapi\Controller\TestService'; @@ -100,16 +110,16 @@ class RestTest extends \PHPUnit_Framework_TestCase 'Magento\Authz\Service\AuthorizationV1Interface' )->disableOriginalConstructor()->getMock(); - /** @var $applicationMock \Magento\AppInterface */ - $applicationMock = $this->getMockBuilder('Magento\AppInterface')->disableOriginalConstructor()->getMock(); $layoutMock = $this->getMockBuilder('Magento\View\LayoutInterface')->disableOriginalConstructor()->getMock(); - $applicationMock->expects($this->once())->method('getLayout')->will($this->returnValue($layoutMock)); $errorProcessorMock = $this->getMock('Magento\Webapi\Controller\ErrorProcessor', array(), array(), '', false); $errorProcessorMock->expects($this->any())->method('maskException')->will($this->returnArgument(0)); $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $serializer = $objectManager->getObject('Magento\Webapi\Controller\ServiceArgsSerializer'); + $this->areaListMock = $this->getMock('\Magento\App\AreaList', array(), array(), '', false); + $this->areaMock = $this->getMock('Magento\App\AreaInterface'); + $this->areaListMock->expects($this->any())->method('getArea')->will($this->returnValue($this->areaMock)); /** Init SUT. */ $this->_restController = $objectManager->getObject( @@ -120,10 +130,11 @@ class RestTest extends \PHPUnit_Framework_TestCase 'router' => $this->_routerMock, 'objectManager' => $this->_objectManagerMock, 'appState' => $this->_appStateMock, - 'application' => $applicationMock, + 'layout' => $layoutMock, 'authorizationService' => $this->_authzServiceMock, 'serializer' => $serializer, - 'errorProcessor' => $errorProcessorMock + 'errorProcessor' => $errorProcessorMock, + 'areaList' => $this->areaListMock ) ); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/SoapTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/SoapTest.php index afb0a746e20..ee910bac71a 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/SoapTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/SoapTest.php @@ -48,9 +48,6 @@ class SoapTest extends \PHPUnit_Framework_TestCase /** @var \Magento\App\State */ protected $_appStateMock; - /** @var \Magento\Core\Model\App */ - protected $_applicationMock; - /** @var \Magento\Oauth\Oauth */ protected $_oauthServiceMock; @@ -66,37 +63,31 @@ class SoapTest extends \PHPUnit_Framework_TestCase { parent::setUp(); - $this->_soapServerMock = $this->getMockBuilder( - 'Magento\Webapi\Model\Soap\Server' - )->disableOriginalConstructor()->setMethods( - array('getApiCharset', 'generateUri', 'handle') - )->getMock(); - $this->_wsdlGeneratorMock = $this->getMockBuilder( - 'Magento\Webapi\Model\Soap\Wsdl\Generator' - )->disableOriginalConstructor()->setMethods( - array('generate') - )->getMock(); - $this->_requestMock = $this->getMockBuilder( - 'Magento\Webapi\Controller\Soap\Request' - )->disableOriginalConstructor()->setMethods( - array('getParam', 'getRequestedServices') - )->getMock(); - $this->_responseMock = $this->getMockBuilder( - 'Magento\Webapi\Controller\Response' - )->disableOriginalConstructor()->setMethods( - array('clearHeaders', 'setHeader', 'sendResponse') - )->getMock(); - $this->_errorProcessorMock = $this->getMockBuilder( - 'Magento\Webapi\Controller\ErrorProcessor' - )->disableOriginalConstructor()->setMethods( - array('maskException') - )->getMock(); - $this->_appStateMock = $this->getMockBuilder('Magento\App\State')->disableOriginalConstructor()->getMock(); - $localeMock = $this->getMockBuilder( - 'Magento\Locale' - )->disableOriginalConstructor()->setMethods( - array('getLanguage') - )->getMock(); + $this->_soapServerMock = $this->getMockBuilder('Magento\Webapi\Model\Soap\Server') + ->disableOriginalConstructor() + ->setMethods(array('getApiCharset', 'generateUri', 'handle')) + ->getMock(); + $this->_wsdlGeneratorMock = $this->getMockBuilder('Magento\Webapi\Model\Soap\Wsdl\Generator') + ->disableOriginalConstructor() + ->setMethods(array('generate')) + ->getMock(); + $this->_requestMock = $this->getMockBuilder('Magento\Webapi\Controller\Soap\Request') + ->disableOriginalConstructor() + ->setMethods(array('getParam', 'getRequestedServices')) + ->getMock(); + $this->_responseMock = $this->getMockBuilder('Magento\Webapi\Controller\Response') + ->disableOriginalConstructor() + ->setMethods(array('clearHeaders', 'setHeader', 'sendResponse')) + ->getMock(); + $this->_errorProcessorMock = $this->getMockBuilder('Magento\Webapi\Controller\ErrorProcessor') + ->disableOriginalConstructor() + ->setMethods(array('maskException')) + ->getMock(); + $this->_appStateMock = $this->getMock('\Magento\App\State', array(), array(), '', false); + $localeMock = $this->getMockBuilder('Magento\Locale') + ->disableOriginalConstructor() + ->setMethods(array('getLanguage')) + ->getMock(); $localeMock->expects($this->any())->method('getLanguage')->will($this->returnValue('en')); $localeResolverMock = $this->getMockBuilder( @@ -106,28 +97,19 @@ class SoapTest extends \PHPUnit_Framework_TestCase )->getMock(); $localeResolverMock->expects($this->any())->method('getLocale')->will($this->returnValue($localeMock)); - $this->_applicationMock = $this->getMockBuilder( - 'Magento\Core\Model\App' - )->disableOriginalConstructor()->setMethods( - array('getLocale', 'isDeveloperMode') - )->getMock(); + $layoutMock = $this->getMock('Magento\View\LayoutInterface'); - $this->_applicationMock = $this->getMockBuilder( - 'Magento\Core\Model\App' - )->disableOriginalConstructor()->getMock(); - $this->_applicationMock->expects($this->any())->method('isDeveloperMode')->will($this->returnValue(false)); - $layoutMock = $this->getMockBuilder('Magento\View\LayoutInterface')->disableOriginalConstructor()->getMock(); - $this->_applicationMock->expects($this->once())->method('getLayout')->will($this->returnValue($layoutMock)); - - $this->_oauthServiceMock = $this->getMockBuilder( - 'Magento\Oauth\Oauth' - )->disableOriginalConstructor()->getMock(); + $this->_oauthServiceMock = $this->getMockBuilder('Magento\Oauth\Oauth') + ->disableOriginalConstructor() + ->getMock(); $this->_responseMock->expects($this->any())->method('clearHeaders')->will($this->returnSelf()); $this->_soapServerMock->expects($this->any())->method('setWSDL')->will($this->returnSelf()); $this->_soapServerMock->expects($this->any())->method('setEncoding')->will($this->returnSelf()); $this->_soapServerMock->expects($this->any())->method('setReturnResponse')->will($this->returnSelf()); - + $areaListMock = $this->getMock('Magento\App\AreaList', array(), array(), '', false); + $areaMock = $this->getMock('Magento\App\AreaInterface'); + $areaListMock->expects($this->any())->method('getArea')->will($this->returnValue($areaMock)); $this->_soapController = new \Magento\Webapi\Controller\Soap( $this->_requestMock, $this->_responseMock, @@ -135,9 +117,10 @@ class SoapTest extends \PHPUnit_Framework_TestCase $this->_soapServerMock, $this->_errorProcessorMock, $this->_appStateMock, - $this->_applicationMock, + $layoutMock, $this->_oauthServiceMock, - $localeResolverMock + $localeResolverMock, + $areaListMock ); } diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php index e176e157e15..2a55c3f49b8 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php @@ -30,8 +30,10 @@ class FaultTest extends \PHPUnit_Framework_TestCase { const WSDL_URL = 'http://host.com/?wsdl&services=customerV1'; - /** @var \Magento\Core\Model\App */ - protected $_appMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_requestMock; /** @var \Magento\Webapi\Model\Soap\Server */ protected $_soapServerMock; @@ -42,9 +44,14 @@ class FaultTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject*/ protected $_localeResolverMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_appStateMock; + protected function setUp() { - $this->_appMock = $this->getMockBuilder('Magento\Core\Model\App')->disableOriginalConstructor()->getMock(); + $this->_requestMock = $this->getMock('\Magento\App\RequestInterface'); /** Initialize SUT. */ $message = "Soap fault reason."; $details = array('param1' => 'value1', 'param2' => 2); @@ -71,11 +78,14 @@ class FaultTest extends \PHPUnit_Framework_TestCase $this->returnValue(new \Zend_Locale('en_US')) ); + $this->_appStateMock = $this->getMock('\Magento\App\State', array(), array(), '', false); + $this->_soapFault = new \Magento\Webapi\Model\Soap\Fault( - $this->_appMock, + $this->_requestMock, $this->_soapServerMock, $webapiException, - $this->_localeResolverMock + $this->_localeResolverMock, + $this->_appStateMock ); parent::setUp(); } @@ -83,13 +93,13 @@ class FaultTest extends \PHPUnit_Framework_TestCase protected function tearDown() { unset($this->_soapFault); - unset($this->_appMock); + unset($this->_requestMock); parent::tearDown(); } public function testToXmlDeveloperModeOff() { - $this->_appMock->expects($this->any())->method('isDeveloperMode')->will($this->returnValue(false)); + $this->_appStateMock->expects($this->any())->method('getMode')->will($this->returnValue('production')); $wsdlUrl = urlencode(self::WSDL_URL); $expectedResult = <<<XML <?xml version="1.0" encoding="utf-8" ?> @@ -132,7 +142,7 @@ XML; public function testToXmlDeveloperModeOn() { - $this->_appMock->expects($this->any())->method('isDeveloperMode')->will($this->returnValue(true)); + $this->_appStateMock->expects($this->any())->method('getMode')->will($this->returnValue('developer')); $actualXml = $this->_soapFault->toXml(true); $this->assertContains('<m:Trace>', $actualXml, 'Exception trace is not found in XML.'); } @@ -225,10 +235,11 @@ XML; $details ); $soapFault = new \Magento\Webapi\Model\Soap\Fault( - $this->_appMock, + $this->_requestMock, $this->_soapServerMock, $webapiException, - $this->_localeResolverMock + $this->_localeResolverMock, + $this->_appStateMock ); $actualXml = $soapFault->toXml(); $wsdlUrl = urlencode(self::WSDL_URL); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ServerTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ServerTest.php index 4a759036495..d1c4c1dcfe3 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ServerTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ServerTest.php @@ -30,9 +30,6 @@ class ServerTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Webapi\Model\Soap\Server */ protected $_soapServer; - /** @var \Magento\Core\Model\App */ - protected $_appMock; - /** @var \Magento\Core\Model\Store */ protected $_storeMock; diff --git a/dev/tests/unit/testsuite/Magento/Wishlist/Block/Customer/SidebarTest.php b/dev/tests/unit/testsuite/Magento/Wishlist/Block/Customer/SidebarTest.php index db97c1b1772..d86b1a604c7 100644 --- a/dev/tests/unit/testsuite/Magento/Wishlist/Block/Customer/SidebarTest.php +++ b/dev/tests/unit/testsuite/Magento/Wishlist/Block/Customer/SidebarTest.php @@ -30,10 +30,19 @@ class SidebarTest extends \PHPUnit_Framework_TestCase */ protected $block; + /** + * @var \Magento\Wishlist\Helper\Data | \PHPUnit_Framework_MockObject_MockObject + */ + protected $wishlistHelper; + protected function setUp() { $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->block = $objectManager->getObject('Magento\Wishlist\Block\Customer\Sidebar'); + $this->wishlistHelper = $this->getMock('Magento\Wishlist\Helper\Data', ['getItemCount'], [], '', false); + $this->block = $objectManager->getObject( + 'Magento\Wishlist\Block\Customer\Sidebar', + ['wishlistHelper' => $this->wishlistHelper] + ); } protected function tearDown() @@ -41,17 +50,19 @@ class SidebarTest extends \PHPUnit_Framework_TestCase $this->block = null; } - public function testGetIdentities() + public function testGetIdentitiesItemsPresent() { - $productTags = array('catalog_product_1'); + $productTags = ['catalog_product_1']; + + $this->wishlistHelper->expects($this->once())->method('getItemCount')->will($this->returnValue(5)); - $product = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); + $product = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $product->expects($this->once())->method('getIdentities')->will($this->returnValue($productTags)); $item = $this->getMock( 'Magento\Sales\Model\Resource\Order\Item', - array('getProduct', '__wakeup'), - array(), + ['getProduct', '__wakeup'], + [], '', false ); @@ -59,7 +70,16 @@ class SidebarTest extends \PHPUnit_Framework_TestCase $collection = new \ReflectionProperty('Magento\Wishlist\Block\Customer\Sidebar', '_collection'); $collection->setAccessible(true); - $collection->setValue($this->block, array($item)); + $collection->setValue($this->block, [$item]); + + $this->assertEquals($productTags, $this->block->getIdentities()); + } + + public function testGetIdentitiesNoItems() + { + $productTags = []; + + $this->wishlistHelper->expects($this->once())->method('getItemCount')->will($this->returnValue(0)); $this->assertEquals($productTags, $this->block->getIdentities()); } diff --git a/downloader/app/Magento/Downloader/Controller.php b/downloader/app/Magento/Downloader/Controller.php index aeebd46d7c8..915385ad150 100644 --- a/downloader/app/Magento/Downloader/Controller.php +++ b/downloader/app/Magento/Downloader/Controller.php @@ -536,7 +536,6 @@ final class Controller \Magento\App\ObjectManager::getInstance()->get('Magento\App\State')->setIsDownloader(); } - \Magento\App\ObjectManager::getInstance()->get('Magento\Core\Model\App'); if (self::isInstalled()) { \Mage::getSingleton('Magento\Backend\Model\UrlInterface')->turnOffSecretKey(); } diff --git a/app/code/Magento/Reports/Model/Resource/HelperFactory.php b/lib/Magento/App/AreaInterface.php similarity index 77% rename from app/code/Magento/Reports/Model/Resource/HelperFactory.php rename to lib/Magento/App/AreaInterface.php index 014f6337318..c766ec39fc7 100644 --- a/app/code/Magento/Reports/Model/Resource/HelperFactory.php +++ b/lib/Magento/App/AreaInterface.php @@ -1,6 +1,5 @@ <?php /** - * Resource helper factory * * Magento * @@ -23,14 +22,19 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Reports\Model\Resource; +namespace Magento\App; -class HelperFactory extends \Magento\Core\Model\Resource\HelperFactory +interface AreaInterface { + const PART_CONFIG = 'config'; + const PART_TRANSLATE = 'translate'; + const PART_DESIGN = 'design'; + /** - * Module Name + * Load area part * - * @var string + * @param string $partName + * @return $this */ - protected $_moduleName = 'Magento_Reports'; + public function load($partName = null); } diff --git a/lib/Magento/App/AreaList.php b/lib/Magento/App/AreaList.php index 4230985672a..26a63f3b69c 100644 --- a/lib/Magento/App/AreaList.php +++ b/lib/Magento/App/AreaList.php @@ -34,6 +34,11 @@ class AreaList */ protected $_areas; + /** + * @var \Magento\App\AreaInterface[] + */ + protected $_areaInstances = array(); + /** * @var string */ @@ -45,12 +50,23 @@ class AreaList protected $_resolverFactory; /** + * @var \Magento\ObjectManager + */ + protected $objectManager; + + /** + * @param \Magento\ObjectManager $objectManager * @param Area\FrontNameResolverFactory $resolverFactory * @param array $areas * @param string $default */ - public function __construct(Area\FrontNameResolverFactory $resolverFactory, array $areas, $default) - { + public function __construct( + \Magento\ObjectManager $objectManager, + Area\FrontNameResolverFactory $resolverFactory, + array $areas, + $default + ) { + $this->objectManager = $objectManager; $this->_resolverFactory = $resolverFactory; $this->_areas = $areas; $this->_defaultAreaCode = $default; @@ -108,4 +124,21 @@ class AreaList { return isset($this->_areas[$areaCode]['router']) ? $this->_areas[$areaCode]['router'] : null; } + + /** + * Retrieve application area + * + * @param string $code + * @return \Magento\Core\Model\App\Area + */ + public function getArea($code) + { + if (!isset($this->_areaInstances[$code])) { + $this->_areaInstances[$code] = $this->objectManager->create( + 'Magento\App\AreaInterface', + array('areaCode' => $code) + ); + } + return $this->_areaInstances[$code]; + } } diff --git a/lib/Magento/App/Cache/Frontend/Factory.php b/lib/Magento/App/Cache/Frontend/Factory.php index 34c7c319b68..5b8e138fa9f 100644 --- a/lib/Magento/App/Cache/Frontend/Factory.php +++ b/lib/Magento/App/Cache/Frontend/Factory.php @@ -33,6 +33,10 @@ class Factory * Default cache entry lifetime */ const DEFAULT_LIFETIME = 7200; + /** + * Caching params, that applied for all cache frontends regardless of type + */ + const PARAM_CACHE_FORCED_OPTIONS = 'cache_options'; /** * @var \Magento\ObjectManager diff --git a/lib/Magento/App/Cache/State.php b/lib/Magento/App/Cache/State.php index e00edbdf6df..795a53c001e 100644 --- a/lib/Magento/App/Cache/State.php +++ b/lib/Magento/App/Cache/State.php @@ -30,7 +30,12 @@ class State implements StateInterface /** * Cache identifier used to store cache type statuses */ - const CACHE_ID = 'core_cache_options'; + const CACHE_ID = 'core_cache_options'; + + /** + * Disallow cache + */ + const PARAM_BAN_CACHE = 'global_ban_use_cache'; /** * Persistent storage of cache type statuses diff --git a/lib/Magento/App/Cron.php b/lib/Magento/App/Cron.php index 7b9281bbea9..9883a71e17f 100644 --- a/lib/Magento/App/Cron.php +++ b/lib/Magento/App/Cron.php @@ -28,7 +28,7 @@ namespace Magento\App; use Magento\App\ObjectManager\ConfigLoader; use Magento\Event\ManagerInterface; -class Cron implements \Magento\LauncherInterface +class Cron implements \Magento\AppInterface { /** * @var \Magento\Event\ManagerInterface diff --git a/lib/Magento/App/Helper/AbstractHelper.php b/lib/Magento/App/Helper/AbstractHelper.php index 90fb579bad2..1404b471136 100644 --- a/lib/Magento/App/Helper/AbstractHelper.php +++ b/lib/Magento/App/Helper/AbstractHelper.php @@ -45,11 +45,9 @@ abstract class AbstractHelper protected $_request; /** - * Translator model - * - * @var \Magento\TranslateInterface + * @var \Magento\Translate\InlineInterface */ - protected $_inlineFactory; + protected $translateInline; /** * @var \Magento\Module\Manager @@ -88,7 +86,7 @@ abstract class AbstractHelper */ public function __construct(Context $context) { - $this->_inlineFactory = $context->getInlineFactory(); + $this->translateInline = $context->getTranslateInline(); $this->_moduleManager = $context->getModuleManager(); $this->_logger = $context->getLogger(); $this->_request = $context->getRequest(); diff --git a/lib/Magento/App/Helper/Context.php b/lib/Magento/App/Helper/Context.php index 3e73af0dd14..4e3a97e2dba 100644 --- a/lib/Magento/App/Helper/Context.php +++ b/lib/Magento/App/Helper/Context.php @@ -28,9 +28,9 @@ namespace Magento\App\Helper; class Context implements \Magento\ObjectManager\ContextInterface { /** - * @var \Magento\TranslateInterface + * @var \Magento\Translate\InlineInterface */ - protected $_inlineFactory; + protected $translateInline; /** * @var \Magento\Module\Manager @@ -74,7 +74,7 @@ class Context implements \Magento\ObjectManager\ContextInterface /** * @param \Magento\Logger $logger - * @param \Magento\Translate\InlineFactory $inlineFactory + * @param \Magento\Translate\InlineInterface $translateInline * @param \Magento\Module\Manager $moduleManager * @param \Magento\App\RequestInterface $httpRequest * @param \Magento\Cache\ConfigInterface $cacheConfig @@ -87,7 +87,7 @@ class Context implements \Magento\ObjectManager\ContextInterface */ public function __construct( \Magento\Logger $logger, - \Magento\Translate\InlineFactory $inlineFactory, + \Magento\Translate\InlineInterface $translateInline, \Magento\Module\Manager $moduleManager, \Magento\App\RequestInterface $httpRequest, \Magento\Cache\ConfigInterface $cacheConfig, @@ -96,7 +96,7 @@ class Context implements \Magento\ObjectManager\ContextInterface \Magento\HTTP\Header $httpHeader, \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress ) { - $this->_inlineFactory = $inlineFactory; + $this->translateInline = $translateInline; $this->_moduleManager = $moduleManager; $this->_httpRequest = $httpRequest; $this->_cacheConfig = $cacheConfig; @@ -108,11 +108,11 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Translate\InlineFactory + * @return \Magento\Translate\InlineInterface */ - public function getInlineFactory() + public function getTranslateInline() { - return $this->_inlineFactory; + return $this->translateInline; } /** diff --git a/lib/Magento/App/Http.php b/lib/Magento/App/Http.php index 9ae9e08fccc..40e9c971504 100644 --- a/lib/Magento/App/Http.php +++ b/lib/Magento/App/Http.php @@ -33,7 +33,7 @@ use Magento\Event; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Http implements \Magento\LauncherInterface +class Http implements \Magento\AppInterface { /** * @var \Magento\ObjectManager diff --git a/lib/Magento/AppInterface.php b/lib/Magento/AppInterface.php index ea9c71c57fa..8bf3f0de293 100644 --- a/lib/Magento/AppInterface.php +++ b/lib/Magento/AppInterface.php @@ -33,163 +33,14 @@ interface AppInterface const DISTRO_LOCALE_CODE = 'en_US'; /** - * Throw an exception, if the application has not been installed yet - * - * @return void - * @throws \Magento\Exception - */ - public function requireInstalledInstance(); - - /** - * Retrieve cookie object - * - * @return \Magento\Stdlib\Cookie - */ - public function getCookie(); - - /** - * Re-declare custom error handler - * - * @param string $handler - * @return \Magento\AppInterface - */ - public function setErrorHandler($handler); - - /** - * Loading part of area data - * - * @param string $area - * @param string $part - * @return \Magento\AppInterface - */ - public function loadAreaPart($area, $part); - - /** - * Retrieve application area - * - * @param string $code - * @return \Magento\Core\Model\App\Area + * Magento version */ - public function getArea($code); + const VERSION = '2.0.0.0-dev71'; /** - * Get distributive locale code - * - * @return string - */ - public function getDistroLocaleCode(); - - /** - * Retrieve layout object - * - * @return \Magento\View\LayoutInterface - */ - public function getLayout(); - - /** - * Retrieve application base currency code - * - * @return string - */ - public function getBaseCurrencyCode(); - - /** - * Retrieve configuration object - * - * @return \Magento\App\ConfigInterface - */ - public function getConfig(); - - /** - * Get core cache model - * - * @return \Magento\App\CacheInterface - */ - public function getCacheInstance(); - - /** - * Retrieve cache object - * - * @return \Zend_Cache_Core - */ - public function getCache(); - - /** - * Loading cache data - * - * @param string $cacheId - * @return mixed - */ - public function loadCache($cacheId); - - /** - * Saving cache data - * - * @param mixed $data - * @param string $cacheId - * @param array $tags - * @param bool $lifeTime - * @return \Magento\AppInterface - */ - public function saveCache($data, $cacheId, $tags = array(), $lifeTime = false); - - /** - * Remove cache - * - * @param string $cacheId - * @return \Magento\AppInterface - */ - public function removeCache($cacheId); - - /** - * Cleaning cache - * - * @param array $tags - * @return \Magento\AppInterface - */ - public function cleanCache($tags = array()); - - /** - * Deletes all session files - * - * @return \Magento\AppInterface - */ - public function cleanAllSessions(); - - /** - * Retrieve request object - * - * @return \Magento\App\RequestInterface - */ - public function getRequest(); - - /** - * Request setter - * - * @param \Magento\App\RequestInterface $request - * @return \Magento\AppInterface - */ - public function setRequest(\Magento\App\RequestInterface $request); - - /** - * Retrieve response object + * Launch application * * @return \Magento\App\ResponseInterface */ - public function getResponse(); - - /** - * Response setter - * - * @param \Magento\App\ResponseInterface $response - * @return \Magento\AppInterface - */ - public function setResponse(\Magento\App\ResponseInterface $response); - - /** - * Check if developer mode is enabled. - * - * @return bool - */ - public function isDeveloperMode(); + public function launch(); } diff --git a/lib/Magento/Convert/Container/AbstractContainer.php b/lib/Magento/Convert/Container/AbstractContainer.php deleted file mode 100644 index 6e32462a681..00000000000 --- a/lib/Magento/Convert/Container/AbstractContainer.php +++ /dev/null @@ -1,190 +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_Convert - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Convert\Container; - -use Magento\Convert\ConvertException; - -/** - * Convert container abstract - * - * @category Magento - * @package Magento_Convert - * @author Magento Core Team <core@magentocommerce.com> - */ -abstract class AbstractContainer -{ - /** - * @var array - */ - protected $_vars; - - /** - * @var array - */ - protected $_data; - - /** - * @var int - */ - protected $_position; - - /** - * @param string $key - * @param string|null $default - * @return string - */ - public function getVar($key, $default = null) - { - if (!isset($this->_vars[$key])) { - return $default; - } - return $this->_vars[$key]; - } - - /** - * @return array - */ - public function getVars() - { - return $this->_vars; - } - - /** - * @param array|string $key - * @param string|null $value - * @return $this - */ - public function setVar($key, $value = null) - { - if (is_array($key) && is_null($value)) { - $this->_vars = $key; - } else { - $this->_vars[$key] = $value; - } - return $this; - } - - /** - * @return array - */ - public function getData() - { - return $this->_data; - } - - /** - * @param array $data - * @return $this - */ - public function setData($data) - { - $this->_data = $data; - return $this; - } - - /** - * @param string|null $data - * @return true - */ - public function validateDataString($data = null) - { - if (is_null($data)) { - $data = $this->getData(); - } - if (!is_string($data)) { - $this->addException("Invalid data type, expecting string.", ConvertException::FATAL); - } - return true; - } - - /** - * @param array|null $data - * @return true - */ - public function validateDataGrid($data = null) - { - if (is_null($data)) { - $data = $this->getData(); - } - if (!is_array($data) || !is_array(current($data))) { - if (count($data) == 0) { - return true; - } - $this->addException("Invalid data type, expecting 2D grid array.", ConvertException::FATAL); - } - return true; - } - - /** - * @param array $grid - * @return array - */ - public function getGridFields($grid) - { - $fields = array(); - foreach ($grid as $row) { - foreach (array_keys($row) as $fieldName) { - if (!in_array($fieldName, $fields)) { - $fields[] = $fieldName; - } - } - } - return $fields; - } - - /** - * @param string $error - * @param string|null $level - * @return ConvertException - */ - public function addException($error, $level = null) - { - $exception = new ConvertException($error); - $exception->setLevel(!is_null($level) ? $level : ConvertException::NOTICE); - $exception->setContainer($this); - $exception->setPosition($this->getPosition()); - - return $exception; - } - - /** - * @return int - */ - public function getPosition() - { - return $this->_position; - } - - /** - * @param int $position - * @return $this - */ - public function setPosition($position) - { - $this->_position = $position; - return $this; - } -} diff --git a/lib/Magento/Convert/ConvertException.php b/lib/Magento/Convert/ConvertException.php deleted file mode 100644 index 4c6a93b3a8c..00000000000 --- a/lib/Magento/Convert/ConvertException.php +++ /dev/null @@ -1,112 +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_Convert - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Convert; - -use Magento\Convert\Container\AbstractContainer; -use Magento\Exception; - -/** - * Convert exception - */ -class ConvertException extends Exception -{ - const NOTICE = 'NOTICE'; - - const WARNING = 'WARNING'; - - const ERROR = 'ERROR'; - - const FATAL = 'FATAL'; - - /** - * @var AbstractContainer - */ - protected $_container; - - /** - * @var string - */ - protected $_level; - - /** - * @var int - */ - protected $_position; - - /** - * @param AbstractContainer $container - * @return $this - */ - public function setContainer($container) - { - $this->_container = $container; - return $this; - } - - /** - * @return AbstractContainer - */ - public function getContainer() - { - return $this->_container; - } - - /** - * @return string - */ - public function getLevel() - { - return $this->_level; - } - - /** - * @param string $level - * @return $this - */ - public function setLevel($level) - { - $this->_level = $level; - return $this; - } - - /** - * @return int - */ - public function getPosition() - { - return $this->_position; - } - - /** - * @param int $position - * @return $this - */ - public function setPosition($position) - { - $this->_position = $position; - return $this; - } -} diff --git a/lib/Magento/Convert/Mapper/Column.php b/lib/Magento/Convert/Mapper/Column.php deleted file mode 100644 index f95122a1362..00000000000 --- a/lib/Magento/Convert/Mapper/Column.php +++ /dev/null @@ -1,67 +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_Convert - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - - -/** - * Convert column mapper - * - * @category Magento - * @package Magento_Convert - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Convert\Mapper; - -use Magento\Convert\Container\AbstractContainer; - -class Column extends AbstractContainer implements MapperInterface -{ - /** - * @return $this - */ - public function map() - { - $data = $this->getData(); - $this->validateDataGrid($data); - if ($this->getVars() && is_array($this->getVars())) { - $attributesToSelect = $this->getVars(); - } else { - $attributesToSelect = array(); - } - $onlySpecified = (bool)$this->getVar('_only_specified') === true; - $mappedData = array(); - foreach ($data as $i => $row) { - $newRow = array(); - foreach ($row as $field => $value) { - if (!$onlySpecified || $onlySpecified && isset($attributesToSelect[$field])) { - $newRow[$this->getVar($field, $field)] = $value; - } - } - $mappedData[$i] = $newRow; - } - $this->setData($mappedData); - return $this; - } -} diff --git a/lib/Magento/Convert/Mapper/MapperInterface.php b/lib/Magento/Convert/Mapper/MapperInterface.php deleted file mode 100644 index 3db75aece8b..00000000000 --- a/lib/Magento/Convert/Mapper/MapperInterface.php +++ /dev/null @@ -1,43 +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_Convert - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - - -/** - * Convert mapper interface - * - * @category Magento - * @package Magento_Convert - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Convert\Mapper; - -interface MapperInterface -{ - /** - * @return $this - */ - public function map(); -} diff --git a/lib/Magento/DB/Adapter/Pdo/Mysql.php b/lib/Magento/DB/Adapter/Pdo/Mysql.php index b6f9a3b5337..198f00ec0d9 100644 --- a/lib/Magento/DB/Adapter/Pdo/Mysql.php +++ b/lib/Magento/DB/Adapter/Pdo/Mysql.php @@ -29,7 +29,7 @@ use Magento\App\Filesystem; use Magento\Cache\FrontendInterface; use Magento\DB\Adapter\AdapterInterface; use Magento\DB\Ddl\Table; -use Magento\DB\Helper; +use Magento\DB\ExpressionConverter; use Magento\DB\Profiler; use Magento\DB\Select; use Magento\DB\Statement\Parameter; @@ -3282,7 +3282,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface { $prefix = 't_'; if (strlen($tableName) > self::LENGTH_TABLE_NAME) { - $shortName = Helper::shortName($tableName); + $shortName = ExpressionConverter::shortName($tableName); if (strlen($shortName) > self::LENGTH_TABLE_NAME) { $hash = md5($tableName); if (strlen($prefix.$hash) > self::LENGTH_TABLE_NAME) { @@ -3331,7 +3331,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface $hash = $tableName . '_' . $fields; if (strlen($hash) + strlen($prefix) > self::LENGTH_INDEX_NAME) { - $short = Helper::shortName($prefix . $hash); + $short = ExpressionConverter::shortName($prefix . $hash); if (strlen($short) > self::LENGTH_INDEX_NAME) { $hash = md5($hash); if (strlen($hash) + strlen($shortPrefix) > self::LENGTH_INDEX_NAME) { @@ -3362,7 +3362,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface $prefix = 'fk_'; $hash = sprintf('%s_%s_%s_%s', $priTableName, $priColumnName, $refTableName, $refColumnName); if (strlen($prefix.$hash) > self::LENGTH_FOREIGN_NAME) { - $short = Helper::shortName($prefix.$hash); + $short = ExpressionConverter::shortName($prefix . $hash); if (strlen($short) > self::LENGTH_FOREIGN_NAME) { $hash = md5($hash); if (strlen($prefix.$hash) > self::LENGTH_FOREIGN_NAME) { diff --git a/lib/Magento/DB/ExpressionConverter.php b/lib/Magento/DB/ExpressionConverter.php new file mode 100644 index 00000000000..9eae8691712 --- /dev/null +++ b/lib/Magento/DB/ExpressionConverter.php @@ -0,0 +1,104 @@ +<?php +/** + * DB expression converter + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\DB; + +class ExpressionConverter +{ + /** + * Dictionary for generate short name + * + * @var array + */ + protected static $_translateMap = array( + 'address' => 'addr', + 'admin' => 'adm', + 'attribute' => 'attr', + 'enterprise' => 'ent', + 'catalog' => 'cat', + 'category' => 'ctgr', + 'customer' => 'cstr', + 'notification' => 'ntfc', + 'product' => 'prd', + 'session' => 'sess', + 'user' => 'usr', + 'entity' => 'entt', + 'datetime' => 'dtime', + 'decimal' => 'dec', + 'varchar' => 'vchr', + 'index' => 'idx', + 'compare' => 'cmp', + 'bundle' => 'bndl', + 'option' => 'opt', + 'gallery' => 'glr', + 'media' => 'mda', + 'value' => 'val', + 'link' => 'lnk', + 'title' => 'ttl', + 'super' => 'spr', + 'label' => 'lbl', + 'website' => 'ws', + 'aggregat' => 'aggr', + 'minimal' => 'min', + 'inventory' => 'inv', + 'status' => 'sts', + 'agreement' => 'agrt', + 'layout' => 'lyt', + 'resource' => 'res', + 'directory' => 'dir', + 'downloadable' => 'dl', + 'element' => 'elm', + 'fieldset' => 'fset', + 'checkout' => 'chkt', + 'newsletter' => 'nlttr', + 'shipping' => 'shpp', + 'calculation' => 'calc', + 'search' => 'srch', + 'query' => 'qr' + ); + + /** + * Convert name using dictionary + * + * @param string $name + * @return string + */ + public static function shortName($name) + { + return strtr($name, self::$_translateMap); + } + + /** + * Add or replace translate to dictionary + * + * @param string $from + * @param string $to + * @return void + */ + public static function addTranslate($from, $to) + { + self::$_translateMap[$from] = $to; + } +} diff --git a/lib/Magento/DB/Helper.php b/lib/Magento/DB/Helper.php index 420e00fe475..acef42054b3 100644 --- a/lib/Magento/DB/Helper.php +++ b/lib/Magento/DB/Helper.php @@ -1,5 +1,7 @@ <?php /** + * DB helper class for MySql Magento DB Adapter + * * Magento * * NOTICE OF LICENSE @@ -18,96 +20,291 @@ * 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_DB * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -/** - * Magento Db Helper - * - * @category Magento - * @package Magento_DB - * @author Magento Core Team <core@magentocommerce.com> - */ namespace Magento\DB; -class Helper +class Helper extends \Magento\DB\Helper\AbstractHelper { /** - * Dictionary for generate short name + * Returns array of quoted orders with direction * - * @var array + * @param \Magento\DB\Select $select + * @param bool $autoReset + * @return array */ - protected static $_translateMap = array( - 'address' => 'addr', - 'admin' => 'adm', - 'attribute' => 'attr', - 'enterprise' => 'ent', - 'catalog' => 'cat', - 'category' => 'ctgr', - 'customer' => 'cstr', - 'notification' => 'ntfc', - 'product' => 'prd', - 'session' => 'sess', - 'user' => 'usr', - 'entity' => 'entt', - 'datetime' => 'dtime', - 'decimal' => 'dec', - 'varchar' => 'vchr', - 'index' => 'idx', - 'compare' => 'cmp', - 'bundle' => 'bndl', - 'option' => 'opt', - 'gallery' => 'glr', - 'media' => 'mda', - 'value' => 'val', - 'link' => 'lnk', - 'title' => 'ttl', - 'super' => 'spr', - 'label' => 'lbl', - 'website' => 'ws', - 'aggregat' => 'aggr', - 'minimal' => 'min', - 'inventory' => 'inv', - 'status' => 'sts', - 'agreement' => 'agrt', - 'layout' => 'lyt', - 'resource' => 'res', - 'directory' => 'dir', - 'downloadable' => 'dl', - 'element' => 'elm', - 'fieldset' => 'fset', - 'checkout' => 'chkt', - 'newsletter' => 'nlttr', - 'shipping' => 'shpp', - 'calculation' => 'calc', - 'search' => 'srch', - 'query' => 'qr' - ); + protected function _prepareOrder(\Magento\DB\Select $select, $autoReset = false) + { + $selectOrders = $select->getPart(\Zend_Db_Select::ORDER); + if (!$selectOrders) { + return array(); + } + + $orders = array(); + foreach ($selectOrders as $term) { + if (is_array($term)) { + if (!is_numeric($term[0])) { + $orders[] = sprintf('%s %s', $this->_getReadAdapter()->quoteIdentifier($term[0], true), $term[1]); + } + } else { + if (!is_numeric($term)) { + $orders[] = $this->_getReadAdapter()->quoteIdentifier($term, true); + } + } + } + + if ($autoReset) { + $select->reset(\Zend_Db_Select::ORDER); + } + + return $orders; + } /** - * Convert name using dictionary + * Truncate alias name from field. * - * @param string $name + * Result string depends from second optional argument $reverse + * which can be true if you need the first part of the field. + * Field can be with 'dot' delimiter. + * + * @param string $field + * @param bool $reverse OPTIONAL * @return string */ - public static function shortName($name) + protected function _truncateAliasName($field, $reverse = false) { - return strtr($name, self::$_translateMap); + $string = $field; + if (!is_numeric($field) && (strpos($field, '.') !== false)) { + $size = strpos($field, '.'); + if ($reverse) { + $string = substr($field, 0, $size); + } else { + $string = substr($field, $size + 1); + } + } + + return $string; } /** - * Add or replace translate to dictionary + * Returns quoted group by fields + * + * @param \Magento\DB\Select $select + * @param bool $autoReset + * @return array + */ + protected function _prepareGroup(\Magento\DB\Select $select, $autoReset = false) + { + $selectGroups = $select->getPart(\Zend_Db_Select::GROUP); + if (!$selectGroups) { + return array(); + } + + $groups = array(); + foreach ($selectGroups as $term) { + $groups[] = $this->_getReadAdapter()->quoteIdentifier($term, true); + } + + if ($autoReset) { + $select->reset(\Zend_Db_Select::GROUP); + } + + return $groups; + } + + /** + * Prepare and returns having array + * + * @param \Magento\DB\Select $select + * @param bool $autoReset + * @return array + * @throws \Zend_Db_Exception + */ + protected function _prepareHaving(\Magento\DB\Select $select, $autoReset = false) + { + $selectHavings = $select->getPart(\Zend_Db_Select::HAVING); + if (!$selectHavings) { + return array(); + } + + $havings = array(); + $columns = $select->getPart(\Zend_Db_Select::COLUMNS); + foreach ($columns as $columnEntry) { + $correlationName = (string)$columnEntry[1]; + $column = $columnEntry[2]; + foreach ($selectHavings as $having) { + /** + * Looking for column expression in the having clause + */ + if (strpos($having, $correlationName) !== false) { + if (is_string($column)) { + /** + * Replace column expression to column alias in having clause + */ + $havings[] = str_replace($correlationName, $column, $having); + } else { + throw new \Zend_Db_Exception( + sprintf("Can't prepare expression without column alias: '%s'", $correlationName) + ); + } + } + } + } + + if ($autoReset) { + $select->reset(\Zend_Db_Select::HAVING); + } + + return $havings; + } + + /** + * + * @param string $query + * @param int $limitCount + * @param int $limitOffset + * @param array $columnList + * @return string + */ + protected function _assembleLimit($query, $limitCount, $limitOffset, $columnList = array()) + { + if ($limitCount !== null) { + $limitCount = intval($limitCount); + if ($limitCount <= 0) { + //throw new \Exception("LIMIT argument count={$limitCount} is not valid"); + } + + $limitOffset = intval($limitOffset); + if ($limitOffset < 0) { + //throw new \Exception("LIMIT argument offset={$limitOffset} is not valid"); + } + + if ($limitOffset + $limitCount != $limitOffset + 1) { + $columns = array(); + foreach ($columnList as $columnEntry) { + $columns[] = $columnEntry[2] ? $columnEntry[2] : $columnEntry[1]; + } + $query = sprintf('%s LIMIT %s, %s', $query, $limitCount, $limitOffset); + } + } + + return $query; + } + + /** + * Prepare select column list + * + * @param \Magento\DB\Select $select + * @param string|null $groupByCondition OPTIONAL + * @return mixed|array + * @throws \Zend_Db_Exception + */ + public function prepareColumnsList(\Magento\DB\Select $select, $groupByCondition = null) + { + if (!count($select->getPart(\Zend_Db_Select::FROM))) { + return $select->getPart(\Zend_Db_Select::COLUMNS); + } + + $columns = $select->getPart(\Zend_Db_Select::COLUMNS); + $tables = $select->getPart(\Zend_Db_Select::FROM); + $preparedColumns = array(); + + foreach ($columns as $columnEntry) { + list($correlationName, $column, $alias) = $columnEntry; + if ($column instanceof \Zend_Db_Expr) { + if ($alias !== null) { + if (preg_match('/(^|[^a-zA-Z_])^(SELECT)?(SUM|MIN|MAX|AVG|COUNT)\s*\(/i', $column)) { + $column = new \Zend_Db_Expr($column); + } + $preparedColumns[strtoupper($alias)] = array(null, $column, $alias); + } else { + throw new \Zend_Db_Exception("Can't prepare expression without alias"); + } + } else { + if ($column == \Zend_Db_Select::SQL_WILDCARD) { + if ($tables[$correlationName]['tableName'] instanceof \Zend_Db_Expr) { + throw new \Zend_Db_Exception( + "Can't prepare expression when tableName is instance of \Zend_Db_Expr" + ); + } + $tableColumns = $this->_getReadAdapter()->describeTable($tables[$correlationName]['tableName']); + foreach (array_keys($tableColumns) as $col) { + $preparedColumns[strtoupper($col)] = array($correlationName, $col, null); + } + } else { + $columnKey = is_null($alias) ? $column : $alias; + $preparedColumns[strtoupper($columnKey)] = array($correlationName, $column, $alias); + } + } + } + + return $preparedColumns; + } + + /** + * Add prepared column group_concat expression + * + * @param \Magento\DB\Select $select + * @param string $fieldAlias Field alias which will be added with column group_concat expression + * @param string $fields + * @param string $groupConcatDelimiter + * @param string $fieldsDelimiter + * @param string $additionalWhere + * @return \Magento\DB\Select + */ + public function addGroupConcatColumn( + $select, + $fieldAlias, + $fields, + $groupConcatDelimiter = ',', + $fieldsDelimiter = '', + $additionalWhere = '' + ) { + if (is_array($fields)) { + $fieldExpr = $this->_getReadAdapter()->getConcatSql($fields, $fieldsDelimiter); + } else { + $fieldExpr = $fields; + } + if ($additionalWhere) { + $fieldExpr = $this->_getReadAdapter()->getCheckSql($additionalWhere, $fieldExpr, "''"); + } + $separator = ''; + if ($groupConcatDelimiter) { + $separator = sprintf(" SEPARATOR '%s'", $groupConcatDelimiter); + } + $select->columns(array($fieldAlias => new \Zend_Db_Expr(sprintf('GROUP_CONCAT(%s%s)', $fieldExpr, $separator)))); + return $select; + } + + /** + * Returns expression of days passed from $startDate to $endDate + * + * @param string|\Zend_Db_Expr $startDate + * @param string|\Zend_Db_Expr $endDate + * @return \Zend_Db_Expr + */ + public function getDateDiff($startDate, $endDate) + { + $dateDiff = '(TO_DAYS(' . $endDate . ') - TO_DAYS(' . $startDate . '))'; + return new \Zend_Db_Expr($dateDiff); + } + + /** + * Escapes and quotes LIKE value. + * Stating escape symbol in expression is not required, because we use standard MySQL escape symbol. + * For options and escaping see escapeLikeValue(). + * + * @param string $value + * @param array $options + * @return \Zend_Db_Expr * - * @param string $from - * @param string $to - * @return void + * @see escapeLikeValue() */ - public static function addTranslate($from, $to) + public function addLikeEscape($value, $options = array()) { - self::$_translateMap[$from] = $to; + $value = $this->escapeLikeValue($value, $options); + return new \Zend_Db_Expr($this->_getReadAdapter()->quote($value)); } } diff --git a/app/code/Magento/Core/Model/Resource/Helper/AbstractHelper.php b/lib/Magento/DB/Helper/AbstractHelper.php similarity index 96% rename from app/code/Magento/Core/Model/Resource/Helper/AbstractHelper.php rename to lib/Magento/DB/Helper/AbstractHelper.php index b77b8f2baba..5c1da9937fc 100644 --- a/app/code/Magento/Core/Model/Resource/Helper/AbstractHelper.php +++ b/lib/Magento/DB/Helper/AbstractHelper.php @@ -1,5 +1,7 @@ <?php /** + * Abstract DB helper class + * * Magento * * NOTICE OF LICENSE @@ -18,16 +20,11 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Helper; +namespace Magento\DB\Helper; -/** - * Abstract resource helper class - */ abstract class AbstractHelper { /** @@ -201,7 +198,7 @@ abstract class AbstractHelper * * @param array $column * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function convertOldColumnDefinition($column) { @@ -209,7 +206,7 @@ abstract class AbstractHelper $matches = array(); $definition = trim($column['type']); if (!preg_match('/([^(]*)(\\((.*)\\))?/', $definition, $matches)) { - throw new \Magento\Core\Exception(__("Wrong old style column type definition: {$definition}.")); + throw new \Magento\Model\Exception(__("Wrong old style column type definition: {$definition}.")); } $length = null; @@ -300,7 +297,7 @@ abstract class AbstractHelper $type = \Magento\DB\Ddl\Table::TYPE_DATE; break; default: - throw new \Magento\Core\Exception(__("Unknown old style column type definition: {$definition}.")); + throw new \Magento\Model\Exception(__("Unknown old style column type definition: {$definition}.")); } $result = array( diff --git a/app/code/Magento/Core/Model/Resource/Transaction.php b/lib/Magento/DB/Transaction.php similarity index 92% rename from app/code/Magento/Core/Model/Resource/Transaction.php rename to lib/Magento/DB/Transaction.php index ef500d5d9bf..00d72630fca 100644 --- a/app/code/Magento/Core/Model/Resource/Transaction.php +++ b/lib/Magento/DB/Transaction.php @@ -1,5 +1,7 @@ <?php /** + * DB transaction model + * * Magento * * NOTICE OF LICENSE @@ -18,20 +20,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\DB; /** - * Resource transaction model - * * @todo need collect connection by name - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ class Transaction { @@ -111,11 +106,11 @@ class Transaction /** * Adding object for using in transaction * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $alias * @return $this */ - public function addObject(\Magento\Core\Model\AbstractModel $object, $alias = '') + public function addObject(\Magento\Model\AbstractModel $object, $alias = '') { $this->_objects[] = $object; if (!empty($alias)) { diff --git a/lib/Magento/Data/Collection/Db.php b/lib/Magento/Data/Collection/Db.php index aa69184f461..91e38b5e406 100644 --- a/lib/Magento/Data/Collection/Db.php +++ b/lib/Magento/Data/Collection/Db.php @@ -635,33 +635,6 @@ class Db extends \Magento\Data\Collection return parent::_toOptionHash($valueField, $labelField); } - /** - * Convert items array to hash for select options - * using fetchItem method - * - * The difference between _toOptionHash() and this one is that this - * method fetch items one by one and does not load all collection items at once - * return items hash - * array($value => $label) - * - * @see fetchItem() - * - * @param string $valueField - * @param string $labelField - * @return array - */ - protected function _toOptionHashOptimized($valueField = null, $labelField = 'name') - { - if ($valueField === null) { - $valueField = $this->getIdFieldName(); - } - $result = array(); - while ($item = $this->fetchItem()) { - $result[$item->getData($valueField)] = $item->getData($labelField); - } - return $result; - } - /** * Get all data array for collection * @@ -790,7 +763,7 @@ class Db extends \Magento\Data\Collection { if (is_null($this->_map)) { $this->_map = array($group => array()); - } elseif (is_null($this->_map[$group])) { + } elseif (empty($this->_map[$group])) { $this->_map[$group] = array(); } $this->_map[$group][$filter] = $alias; diff --git a/lib/Magento/Filesystem/Driver/Http.php b/lib/Magento/Filesystem/Driver/Http.php index 3d1032ab9af..1e58a58f171 100644 --- a/lib/Magento/Filesystem/Driver/Http.php +++ b/lib/Magento/Filesystem/Driver/Http.php @@ -180,7 +180,7 @@ class Http extends File $hostname . "\r\n" . 'User-Agent: Magento ver/' . - \Magento\Core\Model\App::VERSION . + \Magento\AppInterface::VERSION . "\r\n" . 'Connection: close' . "\r\n" . diff --git a/app/code/Magento/Core/Model/Flag.php b/lib/Magento/Flag.php similarity index 74% rename from app/code/Magento/Core/Model/Flag.php rename to lib/Magento/Flag.php index 52672980b03..aedaab5ef80 100644 --- a/app/code/Magento/Core/Model/Flag.php +++ b/lib/Magento/Flag.php @@ -18,30 +18,24 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento; /** - * Core Flag model + * Flag model * - * @method \Magento\Core\Model\Resource\Flag _getResource() - * @method \Magento\Core\Model\Resource\Flag getResource() + * @method \Magento\Flag\Resource _getResource() + * @method \Magento\Flag\Resource getResource() * @method string getFlagCode() - * @method \Magento\Core\Model\Flag setFlagCode(string $value) + * @method \Magento\Flag setFlagCode(string $value) * @method int getState() - * @method \Magento\Core\Model\Flag setState(int $value) + * @method \Magento\Flag setState(int $value) * @method string getLastUpdate() - * @method \Magento\Core\Model\Flag setLastUpdate(string $value) - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * @method \Magento\Flag setLastUpdate(string $value) */ -class Flag extends AbstractModel +class Flag extends \Magento\Model\AbstractModel { /** * Flag code @@ -61,19 +55,19 @@ class Flag extends AbstractModel if ($this->hasData('flag_code')) { $this->_flagCode = $this->getData('flag_code'); } - $this->_init('Magento\Core\Model\Resource\Flag'); + $this->_init('Magento\Flag\Resource'); } /** * Processing object before save data * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ protected function _beforeSave() { if (is_null($this->_flagCode)) { - throw new \Magento\Core\Exception(__('Please define flag code.')); + throw new \Magento\Model\Exception(__('Please define flag code.')); } $this->setFlagCode($this->_flagCode); @@ -110,13 +104,13 @@ class Flag extends AbstractModel /** * load self (load by flag code) * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function loadSelf() { if (is_null($this->_flagCode)) { - throw new \Magento\Core\Exception(__('Please define flag code.')); + throw new \Magento\Model\Exception(__('Please define flag code.')); } return $this->load($this->_flagCode, 'flag_code'); diff --git a/app/code/Magento/Core/Model/Resource/Flag.php b/lib/Magento/Flag/Resource.php similarity index 79% rename from app/code/Magento/Core/Model/Resource/Flag.php rename to lib/Magento/Flag/Resource.php index de91ae9b59a..ded104d288e 100644 --- a/app/code/Magento/Core/Model/Resource/Flag.php +++ b/lib/Magento/Flag/Resource.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_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Flag; /** - * Flag model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Flag Resource model */ -class Flag extends \Magento\Core\Model\Resource\Db\AbstractDb +class Resource extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/lib/Magento/Translate/InlineFactory.php b/lib/Magento/FlagFactory.php similarity index 66% rename from lib/Magento/Translate/InlineFactory.php rename to lib/Magento/FlagFactory.php index 37a9e911c0d..4f56f7db294 100644 --- a/lib/Magento/Translate/InlineFactory.php +++ b/lib/Magento/FlagFactory.php @@ -1,7 +1,5 @@ <?php /** - * Inline translation factory - * * Magento * * NOTICE OF LICENSE @@ -23,36 +21,47 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Translate; +namespace Magento; -class InlineFactory +/** + * Factory class for \Magento\Flag + */ +class FlagFactory { /** - * Object Manager + * Object Manager instance * * @var \Magento\ObjectManager */ - protected $_objectManager; + protected $_objectManager = null; + + /** + * Instance name to create + * + * @var string + */ + protected $_instanceName = null; /** - * Object constructor + * Factory constructor + * * @param \Magento\ObjectManager $objectManager + * @param string $instanceName */ - public function __construct(\Magento\ObjectManager $objectManager) + public function __construct(\Magento\ObjectManager $objectManager, $instanceName = 'Magento\Flag') { $this->_objectManager = $objectManager; + $this->_instanceName = $instanceName; } /** - * Return instance of inline translate parser object + * Create class instance with specified parameters * * @param array $data - * @throws \InvalidArgumentException - * @return \Magento\Translate\InlineInterface + * @return \Magento\Flag */ - public function get(array $data = null) + public function create(array $data = array()) { - $model = $this->_objectManager->get('Magento\Translate\InlineInterface', $data); - return $model; + return $this->_objectManager->create($this->_instanceName, $data); } } diff --git a/lib/Magento/Json/Encoder.php b/lib/Magento/Json/Encoder.php index 60bbd075b7b..1e5b9bf1d25 100644 --- a/lib/Magento/Json/Encoder.php +++ b/lib/Magento/Json/Encoder.php @@ -49,10 +49,7 @@ class Encoder implements EncoderInterface public function encode($data) { $json = \Zend_Json::encode($data); - if ($this->translateInline->isAllowed()) { - $this->translateInline->processResponseBody($json, true); - } - + $this->translateInline->processResponseBody($json, true); return $json; } } diff --git a/lib/Magento/Locale/Lists.php b/lib/Magento/Locale/Lists.php index 9006ab99352..f41e56b38b7 100644 --- a/lib/Magento/Locale/Lists.php +++ b/lib/Magento/Locale/Lists.php @@ -40,11 +40,6 @@ class Lists implements \Magento\Locale\ListsInterface */ protected $_config; - /** - * @var \Magento\AppInterface - */ - protected $_app; - /** * @var \Magento\Locale\ResolverInterface */ @@ -59,7 +54,6 @@ class Lists implements \Magento\Locale\ListsInterface * @param \Magento\App\State $appState * @param \Magento\BaseScopeResolverInterface $scopeResolver * @param \Magento\Locale\ConfigInterface $config - * @param \Magento\AppInterface $app * @param \Magento\Locale\ResolverInterface $localeResolver * @param string $currencyInstalled * @param string $locale @@ -68,7 +62,6 @@ class Lists implements \Magento\Locale\ListsInterface \Magento\App\State $appState, \Magento\BaseScopeResolverInterface $scopeResolver, \Magento\Locale\ConfigInterface $config, - \Magento\AppInterface $app, \Magento\Locale\ResolverInterface $localeResolver, $currencyInstalled, $locale = null @@ -76,7 +69,6 @@ class Lists implements \Magento\Locale\ListsInterface $this->_appState = $appState; $this->_scopeResolver = $scopeResolver; $this->_config = $config; - $this->_app = $app; $this->_localeResolver = $localeResolver; if ($locale !== null) { $this->_localeResolver->setLocale($locale); diff --git a/lib/Magento/Locale/Resolver.php b/lib/Magento/Locale/Resolver.php index fb3ac3e3203..793d4fc1dd7 100644 --- a/lib/Magento/Locale/Resolver.php +++ b/lib/Magento/Locale/Resolver.php @@ -52,9 +52,9 @@ class Resolver implements \Magento\Locale\ResolverInterface protected $_scopeConfig; /** - * @var \Magento\AppInterface + * @var \Magento\App\CacheInterface */ - protected $_app; + protected $_cache; /** * Emulated locales stack @@ -69,20 +69,20 @@ class Resolver implements \Magento\Locale\ResolverInterface protected $_localeFactory; /** - * @param \Magento\Locale\ScopeConfigInterface $scopeConfig - * @param \Magento\AppInterface $app + * @param ScopeConfigInterface $scopeConfig + * @param \Magento\App\CacheInterface $cache * @param \Magento\LocaleFactory $localeFactory * @param string $defaultLocalePath - * @param mixed $locale + * @param null $locale */ public function __construct( \Magento\Locale\ScopeConfigInterface $scopeConfig, - \Magento\AppInterface $app, + \Magento\App\CacheInterface $cache, \Magento\LocaleFactory $localeFactory, $defaultLocalePath, $locale = null ) { - $this->_app = $app; + $this->_cache = $cache; $this->_scopeConfig = $scopeConfig; $this->_localeFactory = $localeFactory; $this->_defaultLocalePath = $defaultLocalePath; @@ -140,7 +140,7 @@ class Resolver implements \Magento\Locale\ResolverInterface public function getLocale() { if (!$this->_locale) { - \Zend_Locale_Data::setCache($this->_app->getCache()->getLowLevelFrontend()); + \Zend_Locale_Data::setCache($this->_cache->getFrontend()->getLowLevelFrontend()); $this->_locale = $this->_localeFactory->create(array('locale' => $this->getLocaleCode())); } elseif ($this->_locale->__toString() != $this->_localeCode) { $this->setLocale($this->_localeCode); diff --git a/app/code/Magento/Core/Model/AbstractModel.php b/lib/Magento/Model/AbstractModel.php similarity index 91% rename from app/code/Magento/Core/Model/AbstractModel.php rename to lib/Magento/Model/AbstractModel.php index 5ba4e082099..0b38933e505 100644 --- a/app/code/Magento/Core/Model/AbstractModel.php +++ b/lib/Magento/Model/AbstractModel.php @@ -18,12 +18,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Model; /** * Abstract model class @@ -52,14 +50,14 @@ abstract class AbstractModel extends \Magento\Object /** * Resource model instance * - * @var \Magento\Core\Model\Resource\Db\AbstractDb + * @var \Magento\Model\Resource\Db\AbstractDb */ protected $_resource; /** * Resource collection * - * @var \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @var \Magento\Model\Resource\Db\Collection\AbstractCollection */ protected $_resourceCollection; @@ -126,7 +124,7 @@ abstract class AbstractModel extends \Magento\Object /** * @var \Magento\Registry */ - protected $_coreRegistry; + protected $_registry; /** * @var \Magento\Logger @@ -139,26 +137,32 @@ abstract class AbstractModel extends \Magento\Object protected $_appState; /** - * @param \Magento\Model\Context $context + * @var \Magento\Model\ActionValidator\RemoveAction + */ + protected $_actionValidator; + + /** + * @param Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreRegistry = $registry; + $this->_registry = $registry; $this->_appState = $context->getAppState(); $this->_eventManager = $context->getEventDispatcher(); $this->_cacheManager = $context->getCacheManager(); $this->_resource = $resource; $this->_resourceCollection = $resourceCollection; $this->_logger = $context->getLogger(); + $this->_actionValidator = $context->getActionValidator(); if (method_exists($this->_resource, 'getIdFieldName') || $this->_resource instanceof \Magento\Object) { $this->_idFieldName = $this->_getResource()->getIdFieldName(); @@ -195,7 +199,7 @@ abstract class AbstractModel extends \Magento\Object public function __sleep() { $properties = array_keys(get_object_vars($this)); - $properties = array_diff($properties, array('_eventManager', '_cacheManager', '_coreRegistry', '_appState')); + $properties = array_diff($properties, array('_eventManager', '_cacheManager', '_registry', '_appState')); return $properties; } @@ -209,7 +213,7 @@ abstract class AbstractModel extends \Magento\Object $objectManager = \Magento\App\ObjectManager::getInstance(); $this->_eventManager = $objectManager->get('Magento\Event\ManagerInterface'); $this->_cacheManager = $objectManager->get('Magento\App\CacheInterface'); - $this->_coreRegistry = $objectManager->get('Magento\Registry'); + $this->_registry = $objectManager->get('Magento\Registry'); $context = $objectManager->get('Magento\Model\Context'); if ($context instanceof \Magento\Model\Context) { $this->_appState = $context->getAppState(); @@ -237,13 +241,13 @@ abstract class AbstractModel extends \Magento\Object /** * Get resource instance * - * @throws \Magento\Core\Exception - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @throws \Magento\Model\Exception + * @return \Magento\Model\Resource\Db\AbstractDb */ protected function _getResource() { if (empty($this->_resourceName) && empty($this->_resource)) { - throw new \Magento\Core\Exception(__('Resource is not set.')); + throw new \Magento\Model\Exception(__('Resource is not set.')); } return $this->_resource ?: \Magento\App\ObjectManager::getInstance()->get($this->_resourceName); @@ -263,13 +267,13 @@ abstract class AbstractModel extends \Magento\Object * Get collection instance * * @deplacated - * @throws \Magento\Core\Exception - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @throws \Magento\Model\Exception + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getResourceCollection() { if (empty($this->_resourceCollection) && empty($this->_collectionName)) { - throw new \Magento\Core\Exception(__('Model collection resource name is not defined.')); + throw new \Magento\Model\Exception(__('Model collection resource name is not defined.')); } return $this->_resourceCollection ? clone $this ->_resourceCollection : \Magento\App\ObjectManager::getInstance() @@ -281,7 +285,7 @@ abstract class AbstractModel extends \Magento\Object /** * Retrieve collection instance * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getCollection() { @@ -453,14 +457,14 @@ abstract class AbstractModel extends \Magento\Object * Validate model before saving it * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validateBeforeSave() { $validator = $this->_getValidatorBeforeSave(); if ($validator && !$validator->isValid($this)) { $errors = $validator->getMessages(); - $exception = new \Magento\Core\Exception(implode(PHP_EOL, $errors)); + $exception = new \Magento\Model\Exception(implode(PHP_EOL, $errors)); foreach ($errors as $errorMessage) { $exception->addMessage(new \Magento\Message\Error($errorMessage)); } @@ -599,31 +603,20 @@ abstract class AbstractModel extends \Magento\Object * Processing object before delete data * * @return $this + * @throws Exception */ protected function _beforeDelete() { + if (!$this->_actionValidator->isAllowed($this)) { + throw new Exception(__('Delete operation is forbidden for current area')); + } + $this->_eventManager->dispatch('model_delete_before', array('object' => $this)); $this->_eventManager->dispatch($this->_eventPrefix . '_delete_before', $this->_getEventData()); $this->cleanModelCache(); return $this; } - /** - * Safeguard func that will check, if we are in admin area - * - * @return void - * @throws \Magento\Core\Exception - */ - protected function _protectFromNonAdmin() - { - if ($this->_coreRegistry->registry('isSecureArea')) { - return; - } - if ($this->_appState->getAreaCode() !== \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { - throw new \Magento\Core\Exception(__('Cannot complete this operation from non-admin area.')); - } - } - /** * Processing object after delete data * @@ -652,7 +645,7 @@ abstract class AbstractModel extends \Magento\Object /** * Retrieve model resource * - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @return \Magento\Model\Resource\Db\AbstractDb */ public function getResource() { diff --git a/lib/Magento/Model/ActionValidator/RemoveAction.php b/lib/Magento/Model/ActionValidator/RemoveAction.php new file mode 100644 index 00000000000..b862218c7be --- /dev/null +++ b/lib/Magento/Model/ActionValidator/RemoveAction.php @@ -0,0 +1,84 @@ +<?php +/** + * Action validator, remove action + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Model\ActionValidator; + +use Magento\Model\AbstractModel; + +class RemoveAction +{ + /** + * @var \Magento\Registry + */ + protected $registry; + + /** + * @var array + */ + protected $protectedModels; + + /** + * @param \Magento\Registry $registry + * @param array $protectedModels + */ + public function __construct(\Magento\Registry $registry, array $protectedModels = array()) + { + $this->registry = $registry; + $this->protectedModels = $protectedModels; + } + + /** + * Safeguard function that checks if item can be removed + * + * @param AbstractModel $model + * @return bool + */ + public function isAllowed(AbstractModel $model) + { + $isAllowed = true; + + if ($this->registry->registry('isSecureArea')) { + $isAllowed = true; + } elseif (in_array($this->getBaseClassName($model), $this->protectedModels)) { + $isAllowed = false; + } + + return $isAllowed; + } + + /** + * Get clean model name without Interceptor and Proxy part and slashes + * @param object $object + * @return mixed + */ + protected function getBaseClassName($object) + { + $className = ltrim(get_class($object), "\\"); + $className = str_replace(array('\Interceptor', '\Proxy'), array(''), $className); + + return $className; + } +} diff --git a/lib/Magento/Model/ActionValidator/RemoveAction/Allowed.php b/lib/Magento/Model/ActionValidator/RemoveAction/Allowed.php new file mode 100644 index 00000000000..5ebb78f9c41 --- /dev/null +++ b/lib/Magento/Model/ActionValidator/RemoveAction/Allowed.php @@ -0,0 +1,42 @@ +<?php +/** + * Action validator for remove action + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Model\ActionValidator\RemoveAction; + +class Allowed extends \Magento\Model\ActionValidator\RemoveAction +{ + /** + * Safeguard function that checks if item can be removed + * + * @param \Magento\Model\AbstractModel $model + * @return bool + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function isAllowed(\Magento\Model\AbstractModel $model) + { + return true; + } +} diff --git a/lib/Magento/Model/Context.php b/lib/Magento/Model/Context.php index 6fda9df5430..1d3b1c594b0 100644 --- a/lib/Magento/Model/Context.php +++ b/lib/Magento/Model/Context.php @@ -47,22 +47,30 @@ class Context implements \Magento\ObjectManager\ContextInterface */ protected $_appState; + /** + * @var \Magento\Model\ActionValidator\RemoveAction + */ + protected $_actionValidator; + /** * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventDispatcher * @param \Magento\App\CacheInterface $cacheManager * @param \Magento\App\State $appState + * @param ActionValidator\RemoveAction $actionValidator */ public function __construct( \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventDispatcher, \Magento\App\CacheInterface $cacheManager, - \Magento\App\State $appState + \Magento\App\State $appState, + \Magento\Model\ActionValidator\RemoveAction $actionValidator ) { $this->_eventDispatcher = $eventDispatcher; $this->_cacheManager = $cacheManager; $this->_appState = $appState; $this->_logger = $logger; + $this->_actionValidator = $actionValidator; } /** @@ -96,4 +104,12 @@ class Context implements \Magento\ObjectManager\ContextInterface { return $this->_appState; } + + /** + * @return \Magento\Model\ActionValidator\RemoveAction + */ + public function getActionValidator() + { + return $this->_actionValidator; + } } diff --git a/app/code/Magento/Core/Exception.php b/lib/Magento/Model/Exception.php similarity index 92% rename from app/code/Magento/Core/Exception.php rename to lib/Magento/Model/Exception.php index 83138306912..3361c6d7e4c 100644 --- a/app/code/Magento/Core/Exception.php +++ b/lib/Magento/Model/Exception.php @@ -18,20 +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_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core; +namespace Magento\Model; /** - * Magento Core \Exception + * Magento Model Exception * * This class will be extended by other modules - * - * @category Magento - * @package Magento_Core */ class Exception extends \Exception { @@ -74,7 +69,7 @@ class Exception extends \Exception * * @param string $message * @param bool $append - * @return \Magento\Core\Exception + * @return \Magento\Model\Exception */ public function setMessage($message, $append = false) { diff --git a/app/code/Magento/Core/Model/Resource/AbstractResource.php b/lib/Magento/Model/Resource/AbstractResource.php similarity index 94% rename from app/code/Magento/Core/Model/Resource/AbstractResource.php rename to lib/Magento/Model/Resource/AbstractResource.php index 7fcfccd555f..22feb833c54 100644 --- a/app/code/Magento/Core/Model/Resource/AbstractResource.php +++ b/lib/Magento/Model/Resource/AbstractResource.php @@ -18,19 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Model\Resource; /** * Abstract resource model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ abstract class AbstractResource { @@ -168,7 +162,7 @@ abstract class AbstractResource /** * Unserialize \Magento\Object field in an object * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $field * @param mixed $defaultValue * @return void @@ -245,11 +239,11 @@ abstract class AbstractResource /** * Prepare the list of entity fields that should be selected from DB. Apply filtration based on active fieldset. * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $tableName * @return array|string */ - protected function _getColumnsForEntityLoad(\Magento\Core\Model\AbstractModel $object, $tableName) + protected function _getColumnsForEntityLoad(\Magento\Model\AbstractModel $object, $tableName) { $fieldsetColumns = $object->getFieldset(); if (!empty($fieldsetColumns)) { diff --git a/app/code/Magento/Core/Model/Resource/Db/AbstractDb.php b/lib/Magento/Model/Resource/Db/AbstractDb.php similarity index 87% rename from app/code/Magento/Core/Model/Resource/Db/AbstractDb.php rename to lib/Magento/Model/Resource/Db/AbstractDb.php index c116be27c4f..743220e65a8 100644 --- a/app/code/Magento/Core/Model/Resource/Db/AbstractDb.php +++ b/lib/Magento/Model/Resource/Db/AbstractDb.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_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Db; +namespace Magento\Model\Resource\Db; /** * Abstract resource model class - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource +abstract class AbstractDb extends \Magento\Model\Resource\AbstractResource { /** * Cached resources singleton @@ -233,13 +227,13 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Get primary key field name * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return string */ public function getIdFieldName() { if (empty($this->_idFieldName)) { - throw new \Magento\Core\Exception(__('Empty identifier field name')); + throw new \Magento\Model\Exception(__('Empty identifier field name')); } return $this->_idFieldName; } @@ -248,13 +242,13 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource * Returns main table name - extracted from "module/table" style and * validated by db adapter * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return string */ public function getMainTable() { if (empty($this->_mainTable)) { - throw new \Magento\Core\Exception(__('Empty main table name')); + throw new \Magento\Model\Exception(__('Empty main table name')); } return $this->getTable($this->_mainTable); } @@ -343,12 +337,12 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Load an object * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param mixed $value * @param string $field field to load by (defaults to model id) * @return $this */ - public function load(\Magento\Core\Model\AbstractModel $object, $value, $field = null) + public function load(\Magento\Model\AbstractModel $object, $value, $field = null) { if (is_null($field)) { $field = $this->getIdFieldName(); @@ -375,7 +369,7 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Zend_Db_Select */ protected function _getLoadSelect($field, $value, $object) @@ -388,10 +382,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Save object object data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function save(\Magento\Core\Model\AbstractModel $object) + public function save(\Magento\Model\AbstractModel $object) { if ($object->isDeleted()) { return $this->delete($object); @@ -449,10 +443,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Delete the object * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function delete(\Magento\Core\Model\AbstractModel $object) + public function delete(\Magento\Model\AbstractModel $object) { $this->_beforeDelete($object); $this->_getWriteAdapter()->delete( @@ -494,10 +488,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Unserialize serializeable object fields * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return void */ - public function unserializeFields(\Magento\Core\Model\AbstractModel $object) + public function unserializeFields(\Magento\Model\AbstractModel $object) { foreach ($this->_serializableFields as $field => $parameters) { list($serializeDefault, $unserializeDefault) = $parameters; @@ -532,10 +526,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Prepare data for save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return array */ - protected function _prepareDataForSave(\Magento\Core\Model\AbstractModel $object) + protected function _prepareDataForSave(\Magento\Model\AbstractModel $object) { return $this->_prepareDataForTable($object, $this->getMainTable()); } @@ -544,7 +538,7 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource * Check that model data fields that can be saved * has really changed comparing with origData * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return bool */ public function hasDataChanged($object) @@ -578,11 +572,11 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Check for unique values existence * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _checkUnique(\Magento\Core\Model\AbstractModel $object) + protected function _checkUnique(\Magento\Model\AbstractModel $object) { $existent = array(); $fields = $this->getUniqueFields(); @@ -622,7 +616,7 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource } else { $error = __('%1 already exist.', implode(', ', $existent)); } - throw new \Magento\Core\Exception($error); + throw new \Magento\Model\Exception($error); } return $this; } @@ -630,10 +624,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * After load * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return void */ - public function afterLoad(\Magento\Core\Model\AbstractModel $object) + public function afterLoad(\Magento\Model\AbstractModel $object) { $this->_afterLoad($object); } @@ -641,10 +635,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Perform actions after object load * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object + * @param \Magento\Model\AbstractModel|\Magento\Object $object * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { return $this; } @@ -652,10 +646,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object + * @param \Magento\Model\AbstractModel|\Magento\Object $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { return $this; } @@ -663,10 +657,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object + * @param \Magento\Model\AbstractModel|\Magento\Object $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { return $this; } @@ -674,10 +668,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Perform actions before object delete * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object + * @param \Magento\Model\AbstractModel|\Magento\Object $object * @return $this */ - protected function _beforeDelete(\Magento\Core\Model\AbstractModel $object) + protected function _beforeDelete(\Magento\Model\AbstractModel $object) { return $this; } @@ -685,10 +679,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Perform actions after object delete * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object + * @param \Magento\Model\AbstractModel|\Magento\Object $object * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $object) + protected function _afterDelete(\Magento\Model\AbstractModel $object) { return $this; } @@ -696,10 +690,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Serialize serializable fields of the object * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return void */ - protected function _serializeFields(\Magento\Core\Model\AbstractModel $object) + protected function _serializeFields(\Magento\Model\AbstractModel $object) { foreach ($this->_serializableFields as $field => $parameters) { list($serializeDefault, $unserializeDefault) = $parameters; diff --git a/app/code/Magento/Core/Model/Resource/Db/Collection/AbstractCollection.php b/lib/Magento/Model/Resource/Db/Collection/AbstractCollection.php similarity index 95% rename from app/code/Magento/Core/Model/Resource/Db/Collection/AbstractCollection.php rename to lib/Magento/Model/Resource/Db/Collection/AbstractCollection.php index 76ca676c9c1..55a49e34b9a 100644 --- a/app/code/Magento/Core/Model/Resource/Db/Collection/AbstractCollection.php +++ b/lib/Magento/Model/Resource/Db/Collection/AbstractCollection.php @@ -18,19 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Db\Collection; +namespace Magento\Model\Resource\Db\Collection; /** - * Abstract Core Resource Collection - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Abstract Resource Collection */ abstract class AbstractCollection extends \Magento\Data\Collection\Db { @@ -51,7 +45,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db /** * Resource instance * - * @var \Magento\Core\Model\Resource\Db\AbstractDb + * @var \Magento\Model\Resource\Db\AbstractDb */ protected $_resource; @@ -112,27 +106,27 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db protected $_eventObject = ''; /** - * Core event manager proxy + * Event manager proxy * * @var \Magento\Event\ManagerInterface */ protected $_eventManager = null; /** - * @param \Magento\Core\Model\EntityFactory $entityFactory + * @param \Magento\Data\Collection\EntityFactoryInterface $entityFactory * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( - \Magento\Core\Model\EntityFactory $entityFactory, + \Magento\Data\Collection\EntityFactoryInterface $entityFactory, \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_eventManager = $eventManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $connection); @@ -471,7 +465,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db /** * Get resource instance * - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @return \Magento\Model\Resource\Db\AbstractDb */ public function getResource() { diff --git a/app/code/Magento/Core/Model/Resource/Db/Profiler.php b/lib/Magento/Model/Resource/Db/Profiler.php similarity index 93% rename from app/code/Magento/Core/Model/Resource/Db/Profiler.php rename to lib/Magento/Model/Resource/Db/Profiler.php index c6c31c786e6..d32255cc980 100644 --- a/app/code/Magento/Core/Model/Resource/Db/Profiler.php +++ b/lib/Magento/Model/Resource/Db/Profiler.php @@ -1,6 +1,6 @@ <?php /** - * Magento Core profiler for requests to database + * Magento profiler for requests to database * * Magento * @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Db; +namespace Magento\Model\Resource\Db; class Profiler extends \Magento\DB\Profiler { @@ -51,7 +51,7 @@ class Profiler extends \Magento\DB\Profiler protected function _getTimerName($operation) { // default name of connection type - $timerName = \Magento\Core\Model\Resource\Db\Profiler::DEFAULT_CONNECTION_TYPE; + $timerName = \Magento\Model\Resource\Db\Profiler::DEFAULT_CONNECTION_TYPE; // connection type to database if (!empty($this->_type)) { @@ -66,7 +66,7 @@ class Profiler extends \Magento\DB\Profiler $timerName .= '_' . $this->_host; } - return \Magento\Core\Model\Resource\Db\Profiler::TIMER_PREFIX . ':' . $timerName; + return \Magento\Model\Resource\Db\Profiler::TIMER_PREFIX . ':' . $timerName; } /** diff --git a/app/code/Magento/Core/Model/Resource/Entity/AbstractEntity.php b/lib/Magento/Model/Resource/Entity/AbstractEntity.php similarity index 94% rename from app/code/Magento/Core/Model/Resource/Entity/AbstractEntity.php rename to lib/Magento/Model/Resource/Entity/AbstractEntity.php index 906df00a685..340c6167489 100644 --- a/app/code/Magento/Core/Model/Resource/Entity/AbstractEntity.php +++ b/lib/Magento/Model/Resource/Entity/AbstractEntity.php @@ -18,12 +18,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Entity; +namespace Magento\Model\Resource\Entity; abstract class AbstractEntity { diff --git a/app/code/Magento/Core/Model/Resource/Entity/Table.php b/lib/Magento/Model/Resource/Entity/Table.php similarity index 86% rename from app/code/Magento/Core/Model/Resource/Entity/Table.php rename to lib/Magento/Model/Resource/Entity/Table.php index 983f15bd9bc..bbfc72d9bf7 100644 --- a/app/code/Magento/Core/Model/Resource/Entity/Table.php +++ b/lib/Magento/Model/Resource/Entity/Table.php @@ -18,18 +18,16 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Entity; +namespace Magento\Model\Resource\Entity; /** * Class describing db table resource entity * */ -class Table extends \Magento\Core\Model\Resource\Entity\AbstractEntity +class Table extends \Magento\Model\Resource\Entity\AbstractEntity { /** * Get table diff --git a/app/code/Magento/Core/Model/Resource/Iterator.php b/lib/Magento/Model/Resource/Iterator.php similarity index 86% rename from app/code/Magento/Core/Model/Resource/Iterator.php rename to lib/Magento/Model/Resource/Iterator.php index 841099b3b60..d59c1463fb8 100644 --- a/app/code/Magento/Core/Model/Resource/Iterator.php +++ b/lib/Magento/Model/Resource/Iterator.php @@ -18,18 +18,14 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Active record implementation - * - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Model\Resource; +namespace Magento\Model\Resource; class Iterator extends \Magento\Object { @@ -40,7 +36,7 @@ class Iterator extends \Magento\Object * @param array|string $callbacks * @param array $args * @param \Magento\DB\Adapter\AdapterInterface $adapter - * @return \Magento\Core\Model\Resource\Iterator + * @return \Magento\Model\Resource\Iterator */ public function walk($query, array $callbacks, array $args = array(), $adapter = null) { @@ -66,7 +62,7 @@ class Iterator extends \Magento\Object * @param \Zend_Db_Statement_Interface|Zend_Db_Select|string $query * @param \Zend_Db_Adapter_Abstract $conn * @return \Zend_Db_Statement_Interface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getStatement($query, $conn = null) { @@ -80,11 +76,11 @@ class Iterator extends \Magento\Object if (is_string($query)) { if (!$conn instanceof \Zend_Db_Adapter_Abstract) { - throw new \Magento\Core\Exception(__('Invalid connection')); + throw new \Magento\Model\Exception(__('Invalid connection')); } return $conn->query($query); } - throw new \Magento\Core\Exception(__('Invalid query')); + throw new \Magento\Model\Exception(__('Invalid query')); } } diff --git a/app/code/Magento/Core/Model/Resource/Type/AbstractType.php b/lib/Magento/Model/Resource/Type/AbstractType.php similarity index 89% rename from app/code/Magento/Core/Model/Resource/Type/AbstractType.php rename to lib/Magento/Model/Resource/Type/AbstractType.php index 095b349949f..e7c006c937e 100644 --- a/app/code/Magento/Core/Model/Resource/Type/AbstractType.php +++ b/lib/Magento/Model/Resource/Type/AbstractType.php @@ -18,12 +18,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Type; +namespace Magento\Model\Resource\Type; abstract class AbstractType { @@ -39,7 +37,7 @@ abstract class AbstractType * * @var String */ - protected $_entityClass = 'Magento\Core\Model\Resource\Entity\AbstractEntity'; + protected $_entityClass = 'Magento\Model\Resource\Entity\AbstractEntity'; /** * Retrieve entity type diff --git a/app/code/Magento/Core/Model/Resource/Type/Db.php b/lib/Magento/Model/Resource/Type/Db.php similarity index 80% rename from app/code/Magento/Core/Model/Resource/Type/Db.php rename to lib/Magento/Model/Resource/Type/Db.php index 68df0a5500c..189b8115851 100644 --- a/app/code/Magento/Core/Model/Resource/Type/Db.php +++ b/lib/Magento/Model/Resource/Type/Db.php @@ -18,20 +18,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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Type; +namespace Magento\Model\Resource\Type; -abstract class Db extends \Magento\Core\Model\Resource\Type\AbstractType +abstract class Db extends \Magento\Model\Resource\Type\AbstractType { /** * Constructor */ public function __construct() { - $this->_entityClass = 'Magento\Core\Model\Resource\Entity\Table'; + $this->_entityClass = 'Magento\Model\Resource\Entity\Table'; } } diff --git a/app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php b/lib/Magento/Model/Resource/Type/Db/Pdo/Mysql.php similarity index 95% rename from app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php rename to lib/Magento/Model/Resource/Type/Db/Pdo/Mysql.php index 82b0d8b3623..c8d7a0884d4 100644 --- a/app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php +++ b/lib/Magento/Model/Resource/Type/Db/Pdo/Mysql.php @@ -21,9 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Type\Db\Pdo; +namespace Magento\Model\Resource\Type\Db\Pdo; -class Mysql extends \Magento\Core\Model\Resource\Type\Db implements \Magento\App\Resource\ConnectionAdapterInterface +class Mysql extends \Magento\Model\Resource\Type\Db implements \Magento\App\Resource\ConnectionAdapterInterface { /** * Filesystem class diff --git a/lib/Magento/Module/Declaration/Reader/Filesystem.php b/lib/Magento/Module/Declaration/Reader/Filesystem.php index af33aa21431..4a9fa5a8f77 100644 --- a/lib/Magento/Module/Declaration/Reader/Filesystem.php +++ b/lib/Magento/Module/Declaration/Reader/Filesystem.php @@ -34,6 +34,10 @@ use Magento\App\State; class Filesystem extends \Magento\Config\Reader\Filesystem { + /** + * Allowed modules + */ + const PARAM_ALLOWED_MODULES = 'allowed_modules'; /** * The list of allowed modules * diff --git a/lib/Magento/Mview/View/Subscription.php b/lib/Magento/Mview/View/Subscription.php index ef8396f9746..d9f23edb5c3 100644 --- a/lib/Magento/Mview/View/Subscription.php +++ b/lib/Magento/Mview/View/Subscription.php @@ -86,7 +86,7 @@ class Subscription implements SubscriptionInterface \Magento\App\Resource $resource, \Magento\DB\Ddl\TriggerFactory $triggerFactory, \Magento\Mview\View\CollectionInterface $viewCollection, - $view, + \Magento\Mview\ViewInterface $view, $tableName, $columnName ) { @@ -97,9 +97,6 @@ class Subscription implements SubscriptionInterface $this->tableName = $tableName; $this->columnName = $columnName; $this->resource = $resource; - - // Force collection clear - $this->viewCollection->clear(); } /** diff --git a/lib/Magento/Outbound/Authentication/Factory.php b/lib/Magento/Outbound/Authentication/Factory.php deleted file mode 100644 index 22541b23d84..00000000000 --- a/lib/Magento/Outbound/Authentication/Factory.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Factory or authentication objects - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - */ -namespace Magento\Outbound\Authentication; - -use Magento\ObjectManager; -use Magento\Outbound\AuthenticationInterface; - -class Factory -{ - /** - * @var ObjectManager - */ - private $_objectManager; - - /** - * @var array representing the map for authentications and authentication classes - */ - protected $_authenticationMap = array(); - - /** - * @param array $authenticationMap - * @param ObjectManager $objectManager - */ - public function __construct(array $authenticationMap, ObjectManager $objectManager) - { - $this->_authenticationMap = $authenticationMap; - $this->_objectManager = $objectManager; - } - - /** - * Returns an Authentication that matches the type specified within Endpoint - * - * @param string $authenticationType - * @return AuthenticationInterface - * @throws \LogicException - */ - public function getAuthentication($authenticationType) - { - if (!isset($this->_authenticationMap[$authenticationType])) { - throw new \LogicException("There is no authentication for the type given: {$authenticationType}"); - } - - $authentication = $this->_objectManager->get($this->_authenticationMap[$authenticationType]); - if (!$authentication instanceof AuthenticationInterface) { - throw new \LogicException( - "Authentication class for {$authenticationType} does not implement authentication interface" - ); - } - return $authentication; - } -} diff --git a/lib/Magento/Outbound/Authentication/Hmac.php b/lib/Magento/Outbound/Authentication/Hmac.php deleted file mode 100644 index 067c1551d4a..00000000000 --- a/lib/Magento/Outbound/Authentication/Hmac.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/** - * This class is capable of creating HMAC signature headers. - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Authentication; - -use Magento\Core\Model\StoreManagerInterface; -use Magento\Outbound\AuthenticationInterface; -use Magento\Outbound\UserInterface; -use Magento\UrlInterface; - -class Hmac implements AuthenticationInterface -{ - /** - * The name of the header which stores the HMAC signature for client verification - */ - const HMAC_HEADER = 'Magento-HMAC-Signature'; - - /** - * The name of the header which identifies the domain of the sender to the client - */ - const DOMAIN_HEADER = 'Magento-Sender-Domain'; - - /** - * 256 bit Secure Hash Algorithm is used by default - */ - const SHA256_ALGORITHM = 'sha256'; - - /** - * @var StoreManagerInterface - */ - private $_storeManager; - - /** - * @param StoreManagerInterface $storeManager - */ - public function __construct(StoreManagerInterface $storeManager) - { - $this->_storeManager = $storeManager; - } - - /** - * Get authentication signature to add to the headers - * - * @param string $body - * @param UserInterface $user - * @return array Headers to add to message - * @throws \LogicException - */ - public function getSignatureHeaders($body, UserInterface $user) - { - $secret = $user->getSharedSecret(); - if ('' === $secret || is_null($secret)) { - throw new \LogicException('The shared secret cannot be empty.'); - } - - // Add HMAC Signature - $signature = hash_hmac(self::SHA256_ALGORITHM, $body, $secret); - return array(self::DOMAIN_HEADER => $this->_getDomain(), self::HMAC_HEADER => $signature); - } - - /** - * An overridable method to get the domain name - * - * @return array|bool - */ - protected function _getDomain() - { - return parse_url($this->_storeManager->getSafeStore()->getBaseUrl(UrlInterface::URL_TYPE_WEB), PHP_URL_HOST); - } -} diff --git a/lib/Magento/Outbound/AuthenticationInterface.php b/lib/Magento/Outbound/AuthenticationInterface.php deleted file mode 100644 index 06af4943d08..00000000000 --- a/lib/Magento/Outbound/AuthenticationInterface.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -/** - * Authentication is used for signing messages so that the subscriber can authenticate their validity. - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -interface AuthenticationInterface -{ - /** - * Get authentication signature to add to the headers - * - * @param string $body - * @param \Magento\Outbound\UserInterface $user - * - * @return array Headers to add to message - */ - public function getSignatureHeaders($body, \Magento\Outbound\UserInterface $user); -} diff --git a/lib/Magento/Outbound/EndpointInterface.php b/lib/Magento/Outbound/EndpointInterface.php deleted file mode 100644 index e0a86c6e2b3..00000000000 --- a/lib/Magento/Outbound/EndpointInterface.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php -/** - * Represents an endpoint to which messages can be sent - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -interface EndpointInterface -{ - /** - * Data formats - */ - const FORMAT_JSON = 'json'; - - const FORMAT_XML = 'xml'; - - /** Authentication types */ - const AUTH_TYPE_HMAC = 'hmac'; - - const AUTH_TYPE_NONE = 'none'; - - /** - * Returns the endpoint URL of this subscription - * - * @return string - */ - public function getEndpointUrl(); - - /** - * Returns the maximum time in seconds that this subscription is willing to wait before a retry should be attempted - * - * @return int - */ - public function getTimeoutInSecs(); - - /** - * Returns the format this message should be sent in (JSON, XML, etc.) - * - * @return string - */ - public function getFormat(); - - /** - * Returns the user abstraction associated with this subscription or null if no user has been associated yet. - * - * @return \Magento\Outbound\UserInterface|null - */ - public function getUser(); - - /** - * Returns the type of authentication to use when attaching authentication to a message - * - * @return string - */ - public function getAuthenticationType(); -} diff --git a/lib/Magento/Outbound/Formatter/Factory.php b/lib/Magento/Outbound/Formatter/Factory.php deleted file mode 100644 index 2522b4e6b31..00000000000 --- a/lib/Magento/Outbound/Formatter/Factory.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Factory implementation for the PubSub_FormatterInterface - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter; - -use Magento\ObjectManager; -use Magento\Outbound\FormatterInterface; - -class Factory -{ - /** - * @var ObjectManager - */ - protected $_objectManager; - - /** - * @var array representing the map for formats and formatter classes - */ - protected $_formatterMap = array(); - - /** - * @param array $formatterMap - * @param ObjectManager $objectManager - */ - public function __construct(array $formatterMap, ObjectManager $objectManager) - { - $this->_formatterMap = $formatterMap; - $this->_objectManager = $objectManager; - } - - /** - * Get formatter for specified format - * - * @param string $format - * @return FormatterInterface - * @throws \LogicException - */ - public function getFormatter($format) - { - if (!isset($this->_formatterMap[$format])) { - throw new \LogicException("There is no formatter for the format given: {$format}"); - } - $formatterClassName = $this->_formatterMap[$format]; - - $formatter = $this->_objectManager->get($formatterClassName); - if (!$formatter instanceof FormatterInterface) { - throw new \LogicException("Formatter class for {$format} does not implement FormatterInterface."); - } - return $formatter; - } -} diff --git a/lib/Magento/Outbound/Formatter/Json.php b/lib/Magento/Outbound/Formatter/Json.php deleted file mode 100644 index 7ead0bd109a..00000000000 --- a/lib/Magento/Outbound/Formatter/Json.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** - * Formatter that converts an array into JSON string. - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter; - -class Json implements \Magento\Outbound\FormatterInterface -{ - /** - * The value for the Content-Type header for messages containing a JSON body - */ - const CONTENT_TYPE = 'application/json'; - - /** - * Format the body of a message into JSON - * - * @param array $body - * @throws \LogicException - * @return string formatted body - */ - public function format(array $body) - { - $formattedData = json_encode($body); - if (false === $formattedData) { - throw new \LogicException('The data provided cannot be converted to JSON.'); - } - return $formattedData; - } - - /** - * Returns the content type for JSON formatting - * - * @return string 'application/json' - */ - public function getContentType() - { - return self::CONTENT_TYPE; - } -} diff --git a/lib/Magento/Outbound/FormatterInterface.php b/lib/Magento/Outbound/FormatterInterface.php deleted file mode 100644 index 18b68893c2b..00000000000 --- a/lib/Magento/Outbound/FormatterInterface.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * Formats the body of a message - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -interface FormatterInterface -{ - /** content type header */ - const CONTENT_TYPE_HEADER = 'Content-Type'; - - /** - * Format the body of a message - * - * @param array $body - * @return string formatted body - */ - public function format(array $body); - - /** - * Returns the content type for the specific formatter - * - * @return string A valid MIME-Type - */ - public function getContentType(); -} diff --git a/lib/Magento/Outbound/Message.php b/lib/Magento/Outbound/Message.php deleted file mode 100644 index ecbe680b4e8..00000000000 --- a/lib/Magento/Outbound/Message.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php -/** - * Message that can be sent to endpoints. - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -class Message implements MessageInterface -{ - /** default timeout value in seconds */ - const DEFAULT_TIMEOUT = 20; - - /** - * @var array - */ - protected $_headers = array(); - - /** - * @var string|null - */ - protected $_body; - - /** - * @var int - */ - protected $_timeout; - - /** - * @var string - */ - protected $_endpointUrl; - - /** - * @param string $endpointUrl - * @param array $headers - * @param string|null $body - * @param int $timeout in seconds - */ - public function __construct($endpointUrl, $headers = array(), $body = null, $timeout = self::DEFAULT_TIMEOUT) - { - $this->_endpointUrl = $endpointUrl; - $this->_headers = $headers; - $this->_body = $body; - $this->_timeout = $timeout; - } - - /** - * return endpoint url - * - * @return string - */ - public function getEndpointUrl() - { - return $this->_endpointUrl; - } - - /** - * Return headers array - * - * @return array - */ - public function getHeaders() - { - return $this->_headers; - } - - /** - * return body - * - * @return string|null - */ - public function getBody() - { - return $this->_body; - } - - /** - * return timeout in seconds - * - * @return int - */ - public function getTimeout() - { - return $this->_timeout; - } -} diff --git a/lib/Magento/Outbound/Message/Factory.php b/lib/Magento/Outbound/Message/Factory.php deleted file mode 100644 index 20c43be8881..00000000000 --- a/lib/Magento/Outbound/Message/Factory.php +++ /dev/null @@ -1,109 +0,0 @@ -<?php -/** - * Creates new messages - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Message; - -use Magento\ObjectManager; -use Magento\Outbound\EndpointInterface; -use Magento\Outbound\FormatterInterface; -use Magento\Outbound\Message; -use Magento\Outbound\Authentication\Factory as AuthenticationFactory; -use Magento\Outbound\Formatter\Factory as FormatterFactory; - -class Factory implements FactoryInterface -{ - /** - * @var ObjectManager - */ - protected $_objectManager; - - /** - * @var FormatterFactory - */ - private $_formatterFactory; - - /** - * @var AuthenticationFactory - */ - private $_authFactory; - - /** - * initialize the class - * - * @param ObjectManager $objectManager - * @param FormatterFactory $formatterFactory - * @param AuthenticationFactory $authFactory - */ - public function __construct( - ObjectManager $objectManager, - FormatterFactory $formatterFactory, - AuthenticationFactory $authFactory - ) { - $this->_objectManager = $objectManager; - $this->_formatterFactory = $formatterFactory; - $this->_authFactory = $authFactory; - } - - /** - * Create a message for a given endpoint, topic and message data - * - * @param EndpointInterface $endpoint - * @param string $topic topic of the message - * @param array $bodyData body of the message - * @return Message - */ - public function create(EndpointInterface $endpoint, $topic, array $bodyData) - { - // Format first since that should turn the body from an array into a string - $formatter = $this->_formatterFactory->getFormatter($endpoint->getFormat()); - $headers = array( - FactoryInterface::TOPIC_HEADER => $topic, - FormatterInterface::CONTENT_TYPE_HEADER => $formatter->getContentType() - ); - $formattedBody = $formatter->format($bodyData); - - $headers = array_merge( - $headers, - $this->_authFactory->getAuthentication( - $endpoint->getAuthenticationType() - )->getSignatureHeaders( - $formattedBody, - $endpoint->getUser() - ) - ); - - return $this->_objectManager->create( - 'Magento\Outbound\Message', - array( - 'endpointUrl' => $endpoint->getEndpointUrl(), - 'headers' => $headers, - 'body' => $formattedBody, - 'timeout' => $endpoint->getTimeoutInSecs() - ) - ); - } -} diff --git a/lib/Magento/Outbound/Message/FactoryInterface.php b/lib/Magento/Outbound/Message/FactoryInterface.php deleted file mode 100644 index baaef67d6b9..00000000000 --- a/lib/Magento/Outbound/Message/FactoryInterface.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Creates new messages - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Message; - -interface FactoryInterface -{ - /** Topic header */ - const TOPIC_HEADER = 'Magento-Topic'; - - /** - * Create a message for a given endpoint, topic and message data - * - * @param \Magento\Outbound\EndpointInterface $endpoint - * @param string $topic topic of the message - * @param array $bodyData body of the message - * @return \Magento\Outbound\Message - */ - public function create(\Magento\Outbound\EndpointInterface $endpoint, $topic, array $bodyData); -} diff --git a/lib/Magento/Outbound/Transport/Http.php b/lib/Magento/Outbound/Transport/Http.php deleted file mode 100644 index d681f9e064d..00000000000 --- a/lib/Magento/Outbound/Transport/Http.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * Dispatches messages over HTTP - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Transport; - -use Magento\HTTP\Adapter\Curl; -use Magento\Outbound\Message; -use Magento\Outbound\MessageInterface; -use Magento\Outbound\TransportInterface; -use Magento\Outbound\Transport\Http\Response; - -class Http implements TransportInterface -{ - /** - * Http version used by Magento - */ - const HTTP_VERSION = '1.1'; - - /** - * @var Curl - */ - protected $_curl; - - /** - * @param Curl $curl - */ - public function __construct(Curl $curl) - { - $this->_curl = $curl; - } - - /** - * Dispatch message and return response - * - * @param MessageInterface $message - * @return Response - */ - public function dispatch(MessageInterface $message) - { - $config = array('verifypeer' => true, 'verifyhost' => 2); - - $timeout = $message->getTimeout(); - if (!is_null($timeout) && $timeout > 0) { - $config['timeout'] = $timeout; - } else { - $config['timeout'] = Message::DEFAULT_TIMEOUT; - } - $this->_curl->setConfig($config); - - $this->_curl->write( - \Zend_Http_Client::POST, - $message->getEndpointUrl(), - self::HTTP_VERSION, - $this->_prepareHeaders($message->getHeaders()), - $message->getBody() - ); - - return new Response($this->_curl->read()); - } - - /** - * Prepare headers for dispatch - * - * @param string[] $headers - * @return string[] - */ - protected function _prepareHeaders($headers) - { - $result = array(); - foreach ($headers as $headerName => $headerValue) { - $result[] = sprintf('%s: %s', $headerName, $headerValue); - } - return $result; - } -} diff --git a/lib/Magento/Outbound/Transport/Http/Response.php b/lib/Magento/Outbound/Transport/Http/Response.php deleted file mode 100644 index f93615b0cdb..00000000000 --- a/lib/Magento/Outbound/Transport/Http/Response.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php -/** - * Wrapper for \Zend_Http_Response class, provides isSuccessful() method - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Transport\Http; - -class Response -{ - /** - * @var \Zend_Http_Response $_response - */ - protected $_response; - - /** - * @param string $string response from an http request - */ - public function __construct($string) - { - $this->_response = \Zend_Http_Response::fromString($string); - } - - /** - * Describes whether response code indicates success - * - * @return bool - */ - public function isSuccessful() - { - return $this->_response->isSuccessful(); - } - - /** - * Gets response status - * - * @return int - */ - public function getStatusCode() - { - return $this->_response->getStatus(); - } - - /** - * Gets response header - * - * @return string - */ - public function getMessage() - { - return $this->_response->getMessage(); - } - - /** - * Gets response body - * - * This class is just hiding the 'getBody' function since calling that after our curl library has already decoded - * the body, could cause an error. A perfect example is if the response for our curl call was gzip'ed, curl would - * have gunzipped it but left the header indicating it was compressed, then \Zend_Http_Response::getBody() would - * attempt to decompress the raw body, which was already decompressed, causing an error/corruption. - * - * @return string - */ - public function getBody() - { - // CURL Doesn't give us access to a truly RAW body, so calling getBody() will fail if Transfer-Encoding is set - return $this->_response->getRawBody(); - } - - /** - * Gets response headers - * - * @return array - */ - public function getHeaders() - { - return $this->_response->getHeaders(); - } - - /** - * Gets a given response header - * - * @param string $headerName - * @return array|null|string - */ - public function getHeader($headerName) - { - return $this->_response->getHeader($headerName); - } -} diff --git a/lib/Magento/Outbound/TransportInterface.php b/lib/Magento/Outbound/TransportInterface.php deleted file mode 100644 index db0f97a48a8..00000000000 --- a/lib/Magento/Outbound/TransportInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Interface for dispatching messages to subscribers - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -interface TransportInterface -{ - /** - * Dispatch message and return response - * - * @param \Magento\Outbound\MessageInterface $message - * @return \Magento\Outbound\Transport\Http\Response - */ - public function dispatch(\Magento\Outbound\MessageInterface $message); -} diff --git a/lib/Magento/Outbound/UserInterface.php b/lib/Magento/Outbound/UserInterface.php deleted file mode 100644 index 5d202d9a212..00000000000 --- a/lib/Magento/Outbound/UserInterface.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * The user is an abstraction for retrieving credentials for Authentication and validating Authorization - * - * 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_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -interface UserInterface -{ - /** - * Returns a shared secret known only by Magento and this user - * - * @return string a shared secret that both the user and Magento know about - */ - public function getSharedSecret(); - - /** - * Checks whether this user has permission for the given topic - * - * @param string $topic topic to check - * @return bool TRUE if permissions exist - */ - public function hasPermission($topic); -} diff --git a/lib/Magento/Phrase.php b/lib/Magento/Phrase.php index ffe027566ab..5be59e5df78 100644 --- a/lib/Magento/Phrase.php +++ b/lib/Magento/Phrase.php @@ -80,7 +80,7 @@ class Phrase */ public function render() { - return self::$_renderer ? self::$_renderer->render($this->_text, $this->_arguments) : $this->_text; + return self::$_renderer ? self::$_renderer->render([$this->_text], $this->_arguments) : $this->_text; } /** diff --git a/lib/Magento/Phrase/Renderer/Composite.php b/lib/Magento/Phrase/Renderer/Composite.php index 0cd02bf2adb..621f03d83bd 100644 --- a/lib/Magento/Phrase/Renderer/Composite.php +++ b/lib/Magento/Phrase/Renderer/Composite.php @@ -51,17 +51,18 @@ class Composite implements RendererInterface } /** - * Render result text + * Render source text * - * @param string $text - * @param array $arguments + * @param [] $source + * @param [] $arguments * @return string */ - public function render($text, array $arguments = array()) + public function render(array $source, array $arguments = array()) { + $result = $source; foreach ($this->_renderers as $render) { - $text = $render->render($text, $arguments); + $result[] = $render->render($result, $arguments); } - return $text; + return end($result); } } diff --git a/lib/Magento/Phrase/Renderer/Inline.php b/lib/Magento/Phrase/Renderer/Inline.php new file mode 100644 index 00000000000..4d7d9fa8087 --- /dev/null +++ b/lib/Magento/Phrase/Renderer/Inline.php @@ -0,0 +1,78 @@ +<?php +/** + * Translate Inline Phrase renderer + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Phrase\Renderer; + +class Inline implements \Magento\Phrase\RendererInterface +{ + /** + * @var \Magento\TranslateInterface + */ + protected $translator; + + /** + * @var \Magento\Translate\Inline\ProviderInterface + */ + protected $inlineProvider; + + /** + * @param \Magento\TranslateInterface $translator + * @param \Magento\Translate\Inline\ProviderInterface $inlineProvider + */ + public function __construct( + \Magento\TranslateInterface $translator, + \Magento\Translate\Inline\ProviderInterface $inlineProvider + ) { + $this->translator = $translator; + $this->inlineProvider = $inlineProvider; + } + + /** + * Render source text + * + * @param [] $source + * @param [] $arguments + * @return string + */ + public function render(array $source, array $arguments) + { + $text = end($source); + + if (!$this->inlineProvider->get()->isAllowed()) { + return $text; + } + + if (strpos($text, '{{{') === false + || strpos($text, '}}}') === false + || strpos($text, '}}{{') === false + ) { + $text = '{{{' + . implode('}}{{', array_reverse($source)) + . '}}{{' . $this->translator->getTheme() . '}}}'; + } + + return $text; + } +} diff --git a/lib/Magento/Phrase/Renderer/Placeholder.php b/lib/Magento/Phrase/Renderer/Placeholder.php index 80c38da33ed..e2cda7057c9 100644 --- a/lib/Magento/Phrase/Renderer/Placeholder.php +++ b/lib/Magento/Phrase/Renderer/Placeholder.php @@ -28,14 +28,16 @@ namespace Magento\Phrase\Renderer; class Placeholder implements \Magento\Phrase\RendererInterface { /** - * {@inheritdoc} + * Render source text * - * @param string $text - * @param array $arguments + * @param [] $source + * @param [] $arguments * @return string */ - public function render($text, array $arguments) + public function render(array $source, array $arguments) { + $text = end($source); + if ($arguments) { $placeholders = array(); foreach (array_keys($arguments) as $key) { @@ -43,6 +45,7 @@ class Placeholder implements \Magento\Phrase\RendererInterface } $text = str_replace($placeholders, $arguments, $text); } + return $text; } } diff --git a/lib/Magento/Phrase/Renderer/Translate.php b/lib/Magento/Phrase/Renderer/Translate.php index 97d6027c7a5..89b990cc4a9 100644 --- a/lib/Magento/Phrase/Renderer/Translate.php +++ b/lib/Magento/Phrase/Renderer/Translate.php @@ -28,11 +28,9 @@ namespace Magento\Phrase\Renderer; class Translate implements \Magento\Phrase\RendererInterface { /** - * Basic object for translation - * * @var \Magento\TranslateInterface */ - protected $_translator; + protected $translator; /** * Renderer construct @@ -41,20 +39,33 @@ class Translate implements \Magento\Phrase\RendererInterface */ public function __construct(\Magento\TranslateInterface $translator) { - $this->_translator = $translator; + $this->translator = $translator; } /** - * {@inheritdoc} + * Render source text * - * @param string $text - * @param array $arguments + * @param [] $source + * @param [] $arguments * @return string */ - public function render($text, array $arguments) + public function render(array $source, array $arguments) { - array_unshift($arguments, $text); + $text = end($source); + + $code = $this->translator->getTheme() + . \Magento\View\Service::SCOPE_SEPARATOR + . $text; + + $data = $this->translator->getData(); + + if (array_key_exists($code, $data)) { + return $data[$code]; + } + if (array_key_exists($text, $data)) { + return $data[$text]; + } - return call_user_func(array($this->_translator, 'translate'), $arguments); + return $text; } } diff --git a/lib/Magento/Phrase/RendererInterface.php b/lib/Magento/Phrase/RendererInterface.php index aa9b6526926..7540d233ac6 100644 --- a/lib/Magento/Phrase/RendererInterface.php +++ b/lib/Magento/Phrase/RendererInterface.php @@ -28,11 +28,11 @@ namespace Magento\Phrase; interface RendererInterface { /** - * Render result text + * Render source text * - * @param string $text - * @param array $arguments + * @param [] $source + * @param [] $arguments * @return string */ - public function render($text, array $arguments); + public function render(array $source, array $arguments); } diff --git a/lib/Magento/PubSub/Event.php b/lib/Magento/PubSub/Event.php deleted file mode 100644 index fd1a7cc44c3..00000000000 --- a/lib/Magento/PubSub/Event.php +++ /dev/null @@ -1,124 +0,0 @@ -<?php -/** - * Represents a PubSub event to be dispatched - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub; - -class Event implements EventInterface -{ - /** - * @var int - */ - protected $_status = EventInterface::STATUS_READY_TO_SEND; - - /** - * @var array - */ - protected $_bodyData; - - /** - * @var array - */ - protected $_headers = array(); - - /** - * @var string - */ - protected $_topic; - - /** - * @param string $topic - * @param array $bodyData - */ - public function __construct($topic, $bodyData) - { - $this->_topic = $topic; - $this->_bodyData = $bodyData; - } - - /** - * Returns the status code of the event. Status indicates if the event has been processed - * or not. - * - * @return int - */ - public function getStatus() - { - return $this->_status; - } - - /** - * Returns a PHP array of data that represents what should be included in the message body. - * - * @return array - */ - public function getBodyData() - { - return $this->_bodyData; - } - - /** - * Prepare headers before return - * - * @return array - */ - public function getHeaders() - { - return $this->_headers; - } - - /** - * Returns a PHP string representing the topic of WebHook - * - * @return string - */ - public function getTopic() - { - return $this->_topic; - } - - /** - * Mark event as processed - * - * @return $this - */ - public function complete() - { - $this->_status = EventInterface::STATUS_PROCESSED; - return $this; - } - - /** - * Mark event as processed - * - * @return $this - */ - public function markAsInProgress() - { - $this->_status = EventInterface::STATUS_IN_PROGRESS; - return $this; - } -} diff --git a/lib/Magento/PubSub/Event/Factory.php b/lib/Magento/PubSub/Event/Factory.php deleted file mode 100644 index 4f313807912..00000000000 --- a/lib/Magento/PubSub/Event/Factory.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * Stub factory to avoid DI issues. - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -class Factory implements \Magento\PubSub\Event\FactoryInterface -{ - /** - * Stub won't create an event - * - * @param string $topic Topic on which to publish data - * @param array $data Data to be published. Should only contain primitives - * @return \Magento\PubSub\EventInterface - */ - public function create($topic, $data) - { - return new \Magento\PubSub\Event($topic, $data); - } -} diff --git a/lib/Magento/PubSub/Event/FactoryInterface.php b/lib/Magento/PubSub/Event/FactoryInterface.php deleted file mode 100644 index a7b8d973d80..00000000000 --- a/lib/Magento/PubSub/Event/FactoryInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Factory for classes that implement \Magento\PubSub\EventInterface - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -interface FactoryInterface -{ - /** - * Create new event - * - * @param string $topic Topic on which to publish data - * @param array $data Data to be published. Should only contain primitives - * @return \Magento\PubSub\EventInterface - */ - public function create($topic, $data); -} diff --git a/lib/Magento/PubSub/Event/QueueHandler.php b/lib/Magento/PubSub/Event/QueueHandler.php deleted file mode 100644 index a9d5a25a62b..00000000000 --- a/lib/Magento/PubSub/Event/QueueHandler.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php -/** - * Handles event queue, uses it to build job queue - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -use Magento\PubSub\Job\FactoryInterface as JobFactoryInterface; -use Magento\PubSub\Job\QueueWriterInterface as JobQueueWriterInterface; -use Magento\PubSub\Subscription\CollectionInterface; - -class QueueHandler -{ - /** - * @var QueueReaderInterface - */ - protected $_eventQueue; - - /** - * @var JobQueueWriterInterface - */ - protected $_jobQueue; - - /** - * @var JobFactoryInterface - */ - protected $_jobFactory; - - /** - * @var CollectionInterface - */ - protected $_subscriptionSet; - - /** - * Initialize the class - * - * @param QueueReaderInterface $eventQueue - * @param JobQueueWriterInterface $jobQueue - * @param JobFactoryInterface $jobFactory - * @param CollectionInterface $subscriptionSet - */ - public function __construct( - QueueReaderInterface $eventQueue, - JobQueueWriterInterface $jobQueue, - JobFactoryInterface $jobFactory, - CollectionInterface $subscriptionSet - ) { - $this->_eventQueue = $eventQueue; - $this->_jobQueue = $jobQueue; - $this->_jobFactory = $jobFactory; - $this->_subscriptionSet = $subscriptionSet; - } - - /** - * Build job queue from event queue - * - * @return void - */ - public function handle() - { - $event = $this->_eventQueue->poll(); - while (!is_null($event)) { - $subscriptions = $this->_subscriptionSet->getSubscriptionsByTopic($event->getTopic()); - foreach ($subscriptions as $subscription) { - /** @var $job \Magento\PubSub\JobInterface */ - $job = $this->_jobFactory->create($subscription, $event); - $this->_jobQueue->offer($job); - } - $event->complete(); - $event = $this->_eventQueue->poll(); - } - } -} diff --git a/lib/Magento/PubSub/Event/QueueReaderInterface.php b/lib/Magento/PubSub/Event/QueueReaderInterface.php deleted file mode 100644 index 7f230bcb5cd..00000000000 --- a/lib/Magento/PubSub/Event/QueueReaderInterface.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * Represents Event queue for events that still need to be handled - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -interface QueueReaderInterface -{ - /** - * Return the top event from the queue. - * - * @return \Magento\PubSub\EventInterface|null - */ - public function poll(); -} diff --git a/lib/Magento/PubSub/Event/QueueWriterInterface.php b/lib/Magento/PubSub/Event/QueueWriterInterface.php deleted file mode 100644 index 4ef43a0096b..00000000000 --- a/lib/Magento/PubSub/Event/QueueWriterInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Represents Event queue writer for events - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -interface QueueWriterInterface -{ - /** - * Adds the event to the queue. - * - * @param \Magento\PubSub\EventInterface $event - * @return null - */ - public function offer(\Magento\PubSub\EventInterface $event); -} diff --git a/lib/Magento/PubSub/EventInterface.php b/lib/Magento/PubSub/EventInterface.php deleted file mode 100644 index 75631405c93..00000000000 --- a/lib/Magento/PubSub/EventInterface.php +++ /dev/null @@ -1,89 +0,0 @@ -<?php -/** - * Represents a PubSub event to be dispatched - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub; - -interface EventInterface -{ - /** - * Status is assigned to newly created Event, identify that it is good to be sent to subscribers - */ - const STATUS_READY_TO_SEND = 0; - - /** - * Status is assigned to event when queue handler pick it up for processing - */ - const STATUS_IN_PROGRESS = 1; - - /** - * Status is assigned to event when queue handler successfully processed the event - */ - const STATUS_PROCESSED = 2; - - /** - * Returns the status code of the event. Status indicates if the event has been processed - * or not. - * - * @return int - */ - public function getStatus(); - - /** - * Returns a PHP array of data that represents what should be included in the message body. - * - * @return array - */ - public function getBodyData(); - - /** - * Prepare headers before return - * - * @return array - */ - public function getHeaders(); - - /** - * Returns a PHP string representing the topic of WebHook - * - * @return string - */ - public function getTopic(); - - /** - * Mark event as processed - * - * @return \Magento\PubSub\EventInterface - */ - public function complete(); - - /** - * Mark event as In Progress - * - * @return \Magento\PubSub\Event - */ - public function markAsInProgress(); -} diff --git a/lib/Magento/PubSub/Job/FactoryInterface.php b/lib/Magento/PubSub/Job/FactoryInterface.php deleted file mode 100644 index 057186a7977..00000000000 --- a/lib/Magento/PubSub/Job/FactoryInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Factory for classes that implement \Magento\PubSub\SubscriptionInterface - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Job; - -interface FactoryInterface -{ - /** - * Create Job - * - * @param \Magento\PubSub\SubscriptionInterface $subscription - * @param \Magento\PubSub\EventInterface $event - * @return \Magento\PubSub\JobInterface|null - */ - public function create(\Magento\PubSub\SubscriptionInterface $subscription, \Magento\PubSub\EventInterface $event); -} diff --git a/lib/Magento/PubSub/Job/QueueHandler.php b/lib/Magento/PubSub/Job/QueueHandler.php deleted file mode 100644 index 6056fc16637..00000000000 --- a/lib/Magento/PubSub/Job/QueueHandler.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/** - * Dispatches HTTP messages derived from job queue and handles the responses - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Job; - -class QueueHandler -{ - /** - * @var \Magento\PubSub\Job\QueueReaderInterface - */ - protected $_jobQueueReader; - - /** - * @var \Magento\PubSub\Job\QueueWriterInterface - */ - protected $_jobQueueWriter; - - /** - * @var \Magento\Outbound\TransportInterface - */ - protected $_transport; - - /** - * @var \Magento\Outbound\Message\FactoryInterface - */ - protected $_messageFactory; - - /** - * @param \Magento\PubSub\Job\QueueReaderInterface $jobQueueReader - * @param \Magento\PubSub\Job\QueueWriterInterface $jobQueueWriter - * @param \Magento\Outbound\TransportInterface $transport - * @param \Magento\Outbound\Message\FactoryInterface $messageFactory - */ - public function __construct( - \Magento\PubSub\Job\QueueReaderInterface $jobQueueReader, - \Magento\PubSub\Job\QueueWriterInterface $jobQueueWriter, - \Magento\Outbound\TransportInterface $transport, - \Magento\Outbound\Message\FactoryInterface $messageFactory - ) { - $this->_jobQueueReader = $jobQueueReader; - $this->_jobQueueWriter = $jobQueueWriter; - $this->_transport = $transport; - $this->_messageFactory = $messageFactory; - } - - /** - * Process the queue of jobs - * @return null - */ - public function handle() - { - $job = $this->_jobQueueReader->poll(); - while (!is_null($job)) { - $event = $job->getEvent(); - $message = $this->_messageFactory->create( - $job->getSubscription()->getEndpoint(), - $event->getTopic(), - $event->getBodyData() - ); - $response = $this->_transport->dispatch($message); - if ($response->isSuccessful()) { - $job->complete(); - } else { - $job->handleFailure(); - $this->_jobQueueWriter->offer($job); - } - $job = $this->_jobQueueReader->poll(); - } - } -} diff --git a/lib/Magento/PubSub/Job/QueueReaderInterface.php b/lib/Magento/PubSub/Job/QueueReaderInterface.php deleted file mode 100644 index d1e40e40a69..00000000000 --- a/lib/Magento/PubSub/Job/QueueReaderInterface.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * Represents Job Queue for jobs that still need to be run - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Job; - -interface QueueReaderInterface -{ - /** - * Return the top job from the queue. - * - * @return \Magento\PubSub\JobInterface|null - */ - public function poll(); -} diff --git a/lib/Magento/PubSub/Job/QueueWriterInterface.php b/lib/Magento/PubSub/Job/QueueWriterInterface.php deleted file mode 100644 index a4d7da301cc..00000000000 --- a/lib/Magento/PubSub/Job/QueueWriterInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Represents Job queue writer for the jobs - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Job; - -interface QueueWriterInterface -{ - /** - * Adds the job to the queue. - * - * @param \Magento\PubSub\JobInterface $job - * @return null - */ - public function offer(\Magento\PubSub\JobInterface $job); -} diff --git a/lib/Magento/PubSub/JobInterface.php b/lib/Magento/PubSub/JobInterface.php deleted file mode 100644 index 2fb6e51e1a8..00000000000 --- a/lib/Magento/PubSub/JobInterface.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * Represents a Job that is used to process events and send messages asynchronously - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub; - -interface JobInterface -{ - /** - * Status is assigned to newly created Job, identify that it is good to be sent to subscriber - */ - const STATUS_READY_TO_SEND = 0; - - /** - * Status is assigned to the Job when queue handler pick it up for processing - */ - const STATUS_IN_PROGRESS = 1; - - /** - * Status is assigned to the Job when queue handler successfully delivered the job to subscriber - */ - const STATUS_SUCCEEDED = 2; - - /** - * Status is assigned to the Job when queue handler failed to delivered the job after N retries - */ - const STATUS_FAILED = 3; - - /** - * Status is assigned to the Job when queue handler failed to delivered the job but will retry more - */ - const STATUS_RETRY = 4; - - /** - * Get the event this job is responsible for processing - * - * @return \Magento\PubSub\EventInterface|null - */ - public function getEvent(); - - /** - * Return the subscription to send a message to - * - * @return \Magento\PubSub\SubscriptionInterface|null - */ - public function getSubscription(); - - /** - * Update the Job status to indicate it has completed successfully - * - * @return \Magento\PubSub\JobInterface - */ - public function complete(); - - /** - * Handle retry on failure logic and update job status accordingly. - * - * @return \Magento\PubSub\JobInterface - */ - public function handleFailure(); - - /** - * Retrieve the status of the Job - * - * @return int - */ - public function getStatus(); - - /** - * Set the status of the Job - * - * @param int $status - * @return \Magento\PubSub\JobInterface - */ - public function setStatus($status); -} diff --git a/lib/Magento/PubSub/Message/DispatcherAsync.php b/lib/Magento/PubSub/Message/DispatcherAsync.php deleted file mode 100644 index b08d84dd07a..00000000000 --- a/lib/Magento/PubSub/Message/DispatcherAsync.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/** - * Entry point to the dispatch event functionality for the cases in which the queueing is needed - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Message; - -use Magento\PubSub\Event\FactoryInterface; -use Magento\PubSub\Event\QueueWriterInterface; - -class DispatcherAsync implements DispatcherAsyncInterface -{ - /** @var FactoryInterface */ - protected $_eventFactory; - - /** @var QueueWriterInterface */ - protected $_eventQueue; - - /** - * @param FactoryInterface $eventFactory - * @param QueueWriterInterface $eventQueue - */ - public function __construct(FactoryInterface $eventFactory, QueueWriterInterface $eventQueue) - { - $this->_eventFactory = $eventFactory; - $this->_eventQueue = $eventQueue; - } - - /** - * Dispatch event with given topic and data - * - * @param string $topic - * @param array $data should only contain primitives, no objects. - * @return void - */ - public function dispatch($topic, $data) - { - $event = $this->_eventFactory->create($topic, $data); - $this->_eventQueue->offer($event); - } -} diff --git a/lib/Magento/PubSub/Message/DispatcherAsyncInterface.php b/lib/Magento/PubSub/Message/DispatcherAsyncInterface.php deleted file mode 100644 index 5dfaff943eb..00000000000 --- a/lib/Magento/PubSub/Message/DispatcherAsyncInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Guarantees asynchronous delivery of messages being dispatched. - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Message; - -interface DispatcherAsyncInterface -{ - /** - * Dispatch some data on a given topic - * - * @param string $topic - * @param array $data should only contain primitives, no objects. - * @return void - */ - public function dispatch($topic, $data); -} diff --git a/lib/Magento/PubSub/Subscription/CollectionInterface.php b/lib/Magento/PubSub/Subscription/CollectionInterface.php deleted file mode 100644 index a85f336e06a..00000000000 --- a/lib/Magento/PubSub/Subscription/CollectionInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Service for querying Subscriptions - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Subscription; - -interface CollectionInterface -{ - /** - * Return all subscriptions by topic - * - * @param string $topic - * @return \Magento\PubSub\SubscriptionInterface[] - */ - public function getSubscriptionsByTopic($topic); -} diff --git a/lib/Magento/PubSub/SubscriptionInterface.php b/lib/Magento/PubSub/SubscriptionInterface.php deleted file mode 100644 index 3860c9f2055..00000000000 --- a/lib/Magento/PubSub/SubscriptionInterface.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php -/** - * Represents a subscription to one or more topics - * - * 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_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub; - -interface SubscriptionInterface extends \Magento\Outbound\EndpointInterface -{ - const STATUS_INACTIVE = 0; - - const STATUS_ACTIVE = 1; - - const STATUS_REVOKED = 2; - - /** - * Returns a list of topics that this Subscription is subscribed to - * - * @return string[] - */ - public function getTopics(); - - /** - * Determines if the subscription is subscribed to a topic. - * - * @param string $topic The topic to check - * @return boolean True if subscribed, false otherwise - */ - public function hasTopic($topic); - - /** - * Get the status of this endpoint - * - * @return int Should match one of the status constants in \Magento\PubSub\SubscriptionInterface - */ - public function getStatus(); - - /** - * Mark this subscription status as deactivated - * - * @return \Magento\PubSub\SubscriptionInterface The deactivated subscription - */ - public function deactivate(); - - /** - * Mark this subscription status to activated - * - * @return \Magento\PubSub\SubscriptionInterface The activated subscription - */ - public function activate(); - - /** - * Mark this subscription status to revoked - * - * @return \Magento\PubSub\SubscriptionInterface The revoked subscription - */ - public function revoke(); - - /** - * Return endpoint with the subscription - * - * @return \Magento\Outbound\EndpointInterface - */ - public function getEndpoint(); -} diff --git a/lib/Magento/Translate.php b/lib/Magento/Translate.php index c8abd348b31..4299bba58dd 100644 --- a/lib/Magento/Translate.php +++ b/lib/Magento/Translate.php @@ -31,36 +31,6 @@ namespace Magento; */ class Translate implements \Magento\TranslateInterface { - /** - * CSV separator - */ - const CSV_SEPARATOR = ','; - - /** - * Scope separator - */ - const SCOPE_SEPARATOR = '::'; - - /** - * Configuration area key - */ - const CONFIG_KEY_AREA = 'area'; - - /** - * Configuration locale key - */ - const CONFIG_KEY_LOCALE = 'locale'; - - /** - * Configuration scope key - */ - const CONFIG_KEY_SCOPE = 'scope'; - - /** - * Configuration theme key - */ - const CONFIG_KEY_DESIGN_THEME = 'theme'; - /** * Locale code * @@ -85,9 +55,9 @@ class Translate implements \Magento\TranslateInterface /** * Translation data * - * @var array + * @var [] */ - protected $_data = array(); + protected $_data = []; /** * Translation data for data scope (per module) @@ -96,42 +66,18 @@ class Translate implements \Magento\TranslateInterface */ protected $_dataScope; - /** - * Configuration flag to enable inline translations - * - * @var boolean - */ - protected $_translateInline; - - /** - * @var \Magento\Translate\InlineInterface - */ - protected $_inlineInterface; - - /** - * Configuration flag to local enable inline translations - * - * @var boolean - */ - protected $_canUseInline = true; - /** * Locale hierarchy (empty by default) * * @var array */ - protected $_localeHierarchy = array(); + protected $_localeHierarchy = []; /** * @var \Magento\View\DesignInterface */ protected $_viewDesign; - /** - * @var \Magento\Translate\Factory - */ - protected $_translateFactory; - /** * @var \Magento\Cache\FrontendInterface $cache */ @@ -142,11 +88,6 @@ class Translate implements \Magento\TranslateInterface */ protected $_viewFileSystem; - /** - * @var \Magento\Phrase\Renderer\Placeholder - */ - protected $_placeholderRender; - /** * @var \Magento\Module\ModuleList */ @@ -177,30 +118,21 @@ class Translate implements \Magento\TranslateInterface */ protected $_appState; - /** - * @var \Magento\App\Filesystem - */ - protected $filesystem; - /** * @var \Magento\Filesystem\Directory\Read */ protected $directory; /** - * Event manager - * - * @var \Magento\Event\ManagerInterface + * @var App\RequestInterface */ - protected $_eventManager; + protected $request; /** * @param \Magento\View\DesignInterface $viewDesign * @param \Magento\Locale\Hierarchy\Config $config - * @param \Magento\Translate\Factory $translateFactory * @param \Magento\Cache\FrontendInterface $cache * @param \Magento\View\FileSystem $viewFileSystem - * @param \Magento\Phrase\Renderer\Placeholder $placeholderRender * @param \Magento\Module\ModuleList $moduleList * @param \Magento\Module\Dir\Reader $modulesReader * @param \Magento\BaseScopeResolverInterface $scopeResolver @@ -208,17 +140,15 @@ class Translate implements \Magento\TranslateInterface * @param \Magento\Locale\ResolverInterface $locale * @param \Magento\App\State $appState * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Event\ManagerInterface $eventManager + * @param App\RequestInterface $request * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\DesignInterface $viewDesign, \Magento\Locale\Hierarchy\Config $config, - \Magento\Translate\Factory $translateFactory, \Magento\Cache\FrontendInterface $cache, \Magento\View\FileSystem $viewFileSystem, - \Magento\Phrase\Renderer\Placeholder $placeholderRender, \Magento\Module\ModuleList $moduleList, \Magento\Module\Dir\Reader $modulesReader, \Magento\BaseScopeResolverInterface $scopeResolver, @@ -226,39 +156,34 @@ class Translate implements \Magento\TranslateInterface \Magento\Locale\ResolverInterface $locale, \Magento\App\State $appState, \Magento\App\Filesystem $filesystem, - \Magento\Event\ManagerInterface $eventManager + \Magento\App\RequestInterface $request ) { $this->_viewDesign = $viewDesign; - $this->_localeHierarchy = $config->getHierarchy(); - $this->_translateFactory = $translateFactory; $this->_cache = $cache; $this->_viewFileSystem = $viewFileSystem; - $this->_placeholderRender = $placeholderRender; $this->_moduleList = $moduleList; $this->_modulesReader = $modulesReader; $this->_scopeResolver = $scopeResolver; $this->_translateResource = $translate; $this->_locale = $locale; $this->_appState = $appState; - $this->filesystem = $filesystem; + $this->request = $request; $this->directory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); - $this->_eventManager = $eventManager; + $this->_localeHierarchy = $config->getHierarchy(); } /** - * Initialization translation data + * Initialize translation data * - * @param string $area - * @param \Magento\Object $initParams + * @param string|null $area * @param bool $forceReload * @return $this */ - public function init($area = null, $initParams = null, $forceReload = false) + public function loadData($area = null, $forceReload = false) { - $area = isset($area) ? $area : $this->_appState->getAreaCode(); - $this->setConfig(array(self::CONFIG_KEY_AREA => $area)); - - $this->_translateInline = $this->getInlineObject($initParams)->isAllowed(); + $this->setConfig( + ['area' => isset($area) ? $area : $this->_appState->getAreaCode()] + ); if (!$forceReload) { $this->_data = $this->_loadCache(); @@ -266,14 +191,12 @@ class Translate implements \Magento\TranslateInterface return $this; } } - - $this->_data = array(); + $this->_data = []; foreach ($this->_moduleList->getModules() as $module) { $this->_loadModuleTranslation($module['name']); } - - $this->_loadThemeTranslation($forceReload, $area); + $this->_loadThemeTranslation($forceReload); $this->_loadDbTranslation($forceReload); if (!$forceReload) { @@ -292,18 +215,29 @@ class Translate implements \Magento\TranslateInterface protected function setConfig($config) { $this->_config = $config; - if (!isset($this->_config[self::CONFIG_KEY_LOCALE])) { - $this->_config[self::CONFIG_KEY_LOCALE] = $this->getLocale(); + if (!isset($this->_config['locale'])) { + $this->_config['locale'] = $this->getLocale(); } - if (!isset($this->_config[self::CONFIG_KEY_SCOPE])) { - $this->_config[self::CONFIG_KEY_SCOPE] = $this->_scopeResolver->getScope()->getCode(); + if (!isset($this->_config['scope'])) { + $this->_config['scope'] = $this->getScope(); } - if (!isset($this->_config[self::CONFIG_KEY_DESIGN_THEME])) { - $this->_config[self::CONFIG_KEY_DESIGN_THEME] = $this->_viewDesign->getDesignTheme()->getId(); + if (!isset($this->_config['theme'])) { + $this->_config['theme'] = $this->_viewDesign->getDesignTheme()->getId(); } return $this; } + /** + * Retrieve scope code + * + * @return string + */ + protected function getScope() + { + $scope = ($this->getConfig('area') == 'adminhtml') ? 'admin' : null; + return $this->_scopeResolver->getScope($scope)->getCode(); + } + /** * Retrieve config value by key * @@ -318,17 +252,6 @@ class Translate implements \Magento\TranslateInterface return null; } - /** - * Determine if translation is enabled and allowed. - * - * @param mixed $scope - * @return bool - */ - public function isAllowed($scope = null) - { - return $this->getInlineObject()->isAllowed($scope); - } - /** * Load data from module translation files * @@ -374,20 +297,22 @@ class Translate implements \Magento\TranslateInterface if ($key === $value) { continue; } - $key = $this->_prepareDataString($key); - $value = $this->_prepareDataString($value); + + $key = str_replace('""', '"', $key); + $value = str_replace('""', '"', $value); + if ($scope && isset($this->_dataScope[$key]) && !$forceReload) { /** * Checking previous value */ - $scopeKey = $this->_dataScope[$key] . self::SCOPE_SEPARATOR . $key; + $scopeKey = $this->_dataScope[$key] . \Magento\View\Service::SCOPE_SEPARATOR . $key; if (!isset($this->_data[$scopeKey])) { if (isset($this->_data[$key])) { $this->_data[$scopeKey] = $this->_data[$key]; unset($this->_data[$key]); } } - $scopeKey = $scope . self::SCOPE_SEPARATOR . $key; + $scopeKey = $scope . \Magento\View\Service::SCOPE_SEPARATOR . $key; $this->_data[$scopeKey] = $value; } else { $this->_data[$key] = $value; @@ -397,38 +322,22 @@ class Translate implements \Magento\TranslateInterface return $this; } - /** - * Prepare data string - * - * @param string $string - * @return string - */ - protected function _prepareDataString($string) - { - return str_replace('""', '"', $string); - } - /** * Load current theme translation * * @param bool $forceReload - * @param string|null $area * @return $this */ - protected function _loadThemeTranslation($forceReload = false, $area = null) + protected function _loadThemeTranslation($forceReload = false) { - if (!$this->_config[self::CONFIG_KEY_DESIGN_THEME]) { + if (!$this->_config['theme']) { return $this; } $requiredLocaleList = $this->_composeRequiredLocaleList($this->getLocale()); foreach ($requiredLocaleList as $locale) { - $file = $this->_getThemeTranslationFile($locale, $area); - $this->_addData( - $this->_getFileData($file), - self::CONFIG_KEY_DESIGN_THEME . $this->_config[self::CONFIG_KEY_DESIGN_THEME], - $forceReload - ); + $file = $this->_getThemeTranslationFile($locale); + $this->_addData($this->_getFileData($file), 'theme' . $this->_config['theme'], $forceReload); } return $this; } @@ -444,7 +353,7 @@ class Translate implements \Magento\TranslateInterface $requiredLocaleList = $this->_composeRequiredLocaleList($this->getLocale()); foreach ($requiredLocaleList as $locale) { $arr = $this->_translateResource->getTranslationArray(null, $locale); - $this->_addData($arr, $this->getConfig(self::CONFIG_KEY_SCOPE), $forceReload); + $this->_addData($arr, $this->getConfig('scope'), $forceReload); } return $this; } @@ -467,15 +376,13 @@ class Translate implements \Magento\TranslateInterface * Retrieve translation file for theme * * @param string $locale - * @param string|null $area * @return string */ - protected function _getThemeTranslationFile($locale, $area = null) + protected function _getThemeTranslationFile($locale) { - $area = isset($area) ? $area : $this->_appState->getAreaCode(); return $this->_viewFileSystem->getFilename( \Magento\App\Filesystem::LOCALE_DIR . '/' . $locale . '.csv', - array('area' => $area) + ['area' => $this->getConfig('area')] ); } @@ -490,7 +397,7 @@ class Translate implements \Magento\TranslateInterface $data = array(); if ($this->directory->isExist($this->directory->getRelativePath($file))) { $parser = new \Magento\File\Csv(); - $parser->setDelimiter(self::CSV_SEPARATOR); + $parser->setDelimiter(','); $data = $parser->getDataPairs($file); } return $data; @@ -501,7 +408,7 @@ class Translate implements \Magento\TranslateInterface * * @return array */ - protected function getData() + public function getData() { if (is_null($this->_data)) { return array(); @@ -514,7 +421,7 @@ class Translate implements \Magento\TranslateInterface * * @return string */ - protected function getLocale() + public function getLocale() { if (null === $this->_localeCode) { $this->_localeCode = $this->_locale->getLocaleCode(); @@ -526,7 +433,7 @@ class Translate implements \Magento\TranslateInterface * Set locale * * @param string $locale - * @return $this + * @return \Magento\TranslateInterface */ public function setLocale($locale) { @@ -535,83 +442,17 @@ class Translate implements \Magento\TranslateInterface } /** - * Translate + * Retrieve theme code * - * @param array $args * @return string - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - public function translate($args) - { - $text = array_shift($args); - - if ($this->_isEmptyTranslateArg($text)) { - return ''; - } - - if (!empty($_REQUEST['theme'])) { - $module = self::CONFIG_KEY_DESIGN_THEME . $_REQUEST['theme']['theme_title']; - } else { - $module = self::CONFIG_KEY_DESIGN_THEME . $this->_config[self::CONFIG_KEY_DESIGN_THEME]; - } - $code = $module . self::SCOPE_SEPARATOR . $text; - $translated = $this->_getTranslatedString($text, $code); - $result = $this->_placeholderRender->render($translated, $args); - - if ($this->_translateInline && $this->getTranslateInline()) { - if (strpos( - $result, - '{{{' - ) === false || strpos( - $result, - '}}}' - ) === false || strpos( - $result, - '}}{{' - ) === false - ) { - $result = '{{{' . $result . '}}{{' . $translated . '}}{{' . $text . '}}{{' . $module . '}}}'; - } - } - return $result; - } - - /** - * Check is empty translate argument - * - * @param mixed $text - * @return bool */ - protected function _isEmptyTranslateArg($text) + public function getTheme() { - if (is_object($text) && is_callable(array($text, 'getText'))) { - $text = $text->getText(); + $theme = $this->request->getParam('theme'); + if (empty($theme)) { + return 'theme' . $this->getConfig('theme'); } - return empty($text); - } - - /** - * Set Translate inline mode - * - * @param bool $flag - * @return $this - */ - public function setTranslateInline($flag = false) - { - $this->_canUseInline = $flag; - return $this; - } - - /** - * Retrieve active translate mode - * - * @return bool - * @SuppressWarnings(PHPMD.BooleanGetMethodName) - */ - public function getTranslateInline() - { - return $this->_canUseInline; + return 'theme' . $theme['theme_title']; } /** @@ -621,19 +462,19 @@ class Translate implements \Magento\TranslateInterface */ protected function getCacheId() { - if (is_null($this->_cacheId)) { + if ($this->_cacheId === null) { $this->_cacheId = \Magento\App\Cache\Type\Translate::TYPE_IDENTIFIER; - if (isset($this->_config[self::CONFIG_KEY_LOCALE])) { - $this->_cacheId .= '_' . $this->_config[self::CONFIG_KEY_LOCALE]; + if (isset($this->_config['locale'])) { + $this->_cacheId .= '_' . $this->_config['locale']; } - if (isset($this->_config[self::CONFIG_KEY_AREA])) { - $this->_cacheId .= '_' . $this->_config[self::CONFIG_KEY_AREA]; + if (isset($this->_config['area'])) { + $this->_cacheId .= '_' . $this->_config['area']; } - if (isset($this->_config[self::CONFIG_KEY_SCOPE])) { - $this->_cacheId .= '_' . $this->_config[self::CONFIG_KEY_SCOPE]; + if (isset($this->_config['scope'])) { + $this->_cacheId .= '_' . $this->_config['scope']; } - if (isset($this->_config[self::CONFIG_KEY_DESIGN_THEME])) { - $this->_cacheId .= '_' . $this->_config[self::CONFIG_KEY_DESIGN_THEME]; + if (isset($this->_config['theme'])) { + $this->_cacheId .= '_' . $this->_config['theme']; } } return $this->_cacheId; @@ -663,64 +504,4 @@ class Translate implements \Magento\TranslateInterface $this->_cache->save(serialize($this->getData()), $this->getCacheId(), array(), false); return $this; } - - /** - * Return translated string from text. - * - * @param string $text - * @param string $code - * @return string - */ - protected function _getTranslatedString($text, $code) - { - if (array_key_exists($code, $this->getData())) { - $translated = $this->_data[$code]; - } elseif (array_key_exists($text, $this->getData())) { - $translated = $this->_data[$text]; - } else { - $translated = $text; - } - return $translated; - } - - /** - * Returns the translate interface object. - * - * @param \Magento\Object $initParams - * @return \Magento\Translate\InlineInterface - */ - protected function getInlineObject($initParams = null) - { - if (null === $this->_inlineInterface) { - if ($initParams === null) { - $this->_inlineInterface = $this->_translateFactory->create(); - } else { - $this->_inlineInterface = $this->_translateFactory->create( - $initParams->getParams(), - $initParams->getInlineType() - ); - } - } - return $this->_inlineInterface; - } - - /** - * This method initializes the Translate object for this instance. - * - * @param string $localeCode - * @param string|null $area - * @return \Magento\TranslateInterface - */ - public function initLocale($localeCode, $area = null) - { - $this->setLocale($localeCode); - - $dispatchResult = new \Magento\Object(array('inline_type' => null)); - $this->_eventManager->dispatch( - 'translate_initialization_before', - array('translate_object' => $this, 'result' => $dispatchResult) - ); - $this->init($area, $dispatchResult, true); - return $this; - } } diff --git a/lib/Magento/Translate/Factory.php b/lib/Magento/Translate/Factory.php deleted file mode 100644 index d776e49a9b2..00000000000 --- a/lib/Magento/Translate/Factory.php +++ /dev/null @@ -1,72 +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) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Translate factory - */ -namespace Magento\Translate; - -class Factory -{ - /** - * Default translate inline class name - */ - const DEFAULT_CLASS_NAME = 'Magento\Translate\InlineInterface'; - - /** - * Object Manager - * - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * Object constructor - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Return instance of inline translate object based on passed in class name. - * - * @param array $data - * @param string $className - * @throws \InvalidArgumentException - * @return \Magento\Translate\InlineInterface - */ - public function create(array $data = null, $className = null) - { - if ($className === null) { - $className = self::DEFAULT_CLASS_NAME; - } - $model = $this->_objectManager->get($className, $data); - if (!$model instanceof \Magento\Translate\InlineInterface) { - throw new \InvalidArgumentException('Invalid inline translate model: ' . $className); - } - return $model; - } -} diff --git a/lib/Magento/Translate/Inline.php b/lib/Magento/Translate/Inline.php index 3645abf2c92..c40e588b49c 100644 --- a/lib/Magento/Translate/Inline.php +++ b/lib/Magento/Translate/Inline.php @@ -29,134 +29,123 @@ use Magento\BaseScopeInterface; class Inline implements \Magento\Translate\InlineInterface { - /** - * Regular Expression for detected and replace translate - * - * @var string - */ - protected $_tokenRegex = '\{\{\{(.*?)\}\}\{\{(.*?)\}\}\{\{(.*?)\}\}\{\{(.*?)\}\}\}'; - - /** - * @var \Magento\TranslateInterface - */ - protected $_translator; - /** * Indicator to hold state of whether inline translation is allowed * * @var bool */ - protected $_isAllowed; + protected $isAllowed; /** - * @var \Magento\Translate\Inline\ParserFactory + * @var \Magento\Translate\Inline\ParserInterface */ - protected $_parserFactory; + protected $parser; /** * Flag about inserted styles and scripts for inline translates * * @var bool */ - protected $_isScriptInserted = false; + protected $isScriptInserted = false; /** * @var \Magento\UrlInterface */ - protected $_url; + protected $url; /** * @var \Magento\View\LayoutInterface */ - protected $_layout; + protected $layout; /** - * @var \Magento\App\State + * @var \Magento\Translate\Inline\ConfigInterface */ - protected $_appState; + protected $config; /** - * @var \Magento\Translate\Inline\ConfigFactory + * @var \Magento\BaseScopeResolverInterface */ - protected $_configFactory; + protected $scopeResolver; /** - * @var \Magento\BaseScopeResolverInterface + * @var string */ - protected $_scopeResolver; + protected $templateFileName; /** * @var string */ - protected $_templateFileName = ''; + protected $translatorRoute; /** - * @var string + * @var null|string */ - protected $_translatorRoute = ''; + protected $scope; + + /** + * @var Inline\StateInterface + */ + protected $state; /** - * Initialize inline translation model - * * @param \Magento\BaseScopeResolverInterface $scopeResolver - * @param \Magento\Translate\Inline\ParserFactory $parserFactory - * @param \Magento\TranslateInterface $translate * @param \Magento\UrlInterface $url * @param \Magento\View\LayoutInterface $layout - * @param \Magento\Translate\Inline\ConfigFactory $configFactory - * @param \Magento\App\State $appState + * @param Inline\ConfigInterface $config + * @param Inline\ParserInterface $parser + * @param Inline\StateInterface $state * @param string $templateFileName * @param string $translatorRoute + * @param null $scope */ public function __construct( \Magento\BaseScopeResolverInterface $scopeResolver, - \Magento\Translate\Inline\ParserFactory $parserFactory, - \Magento\TranslateInterface $translate, \Magento\UrlInterface $url, \Magento\View\LayoutInterface $layout, - \Magento\Translate\Inline\ConfigFactory $configFactory, - \Magento\App\State $appState, + \Magento\Translate\Inline\ConfigInterface $config, + \Magento\Translate\Inline\ParserInterface $parser, + \Magento\Translate\Inline\StateInterface $state, $templateFileName = '', - $translatorRoute = '' + $translatorRoute = '', + $scope = null ) { - $this->_scopeResolver = $scopeResolver; - $this->_configFactory = $configFactory; - $this->_parserFactory = $parserFactory; - $this->_translator = $translate; - $this->_url = $url; - $this->_layout = $layout; - $this->_appState = $appState; - $this->_templateFileName = $templateFileName; - $this->_translatorRoute = $translatorRoute; + $this->scopeResolver = $scopeResolver; + $this->url = $url; + $this->layout = $layout; + $this->config = $config; + $this->parser = $parser; + $this->state = $state; + $this->templateFileName = $templateFileName; + $this->translatorRoute = $translatorRoute; + $this->scope = $scope; } /** - * Is enabled and allowed Inline Translates + * Check if Inline Translates is allowed * - * @param BaseScopeInterface|int|null $scope * @return bool */ - public function isAllowed($scope = null) + public function isAllowed() { - if (is_null($this->_isAllowed)) { - if (!$scope instanceof BaseScopeInterface) { - $scope = $this->_scopeResolver->getScope($scope); + if ($this->isAllowed === null) { + if (!$this->scope instanceof BaseScopeInterface) { + $scope = $this->scopeResolver->getScope($this->scope); } - - $config = $this->_configFactory->get(); - $this->_isAllowed = $config->isActive($scope) && $config->isDevAllowed($scope); + $this->isAllowed = $this->config->isActive($scope) + && $this->config->isDevAllowed($scope); } - return $this->_translator->getTranslateInline() && $this->_isAllowed; + return $this->state->isEnabled() && $this->isAllowed; } /** - * Disable inline translation functionality + * Retrieve Inline Parser instance * - * @return void + * @return Inline\ParserInterface */ - public function disable() + public function getParser() { - $this->_isAllowed = false; + return $this->parser; } /** @@ -168,22 +157,25 @@ class Inline implements \Magento\Translate\InlineInterface */ public function processResponseBody(&$body, $isJson = false) { - $parser = $this->_parserFactory->get(); - $parser->setIsJson($isJson); - if (!$this->isAllowed()) { + if ($this->scope == 'admin' && !$this->isAllowed()) { + $this->stripInlineTranslations($body); return $this; } + $this->getParser()->setIsJson($isJson); + if (is_array($body)) { foreach ($body as &$part) { $this->processResponseBody($part, $isJson); } } elseif (is_string($body)) { - $content = $parser->processResponseBodyString($body, $this); - $this->_insertInlineScriptsHtml($content); - $body = $parser->getContent(); + $this->getParser()->processResponseBodyString($body); + $this->addInlineScript(); + $body = $this->getParser()->getContent(); } - $parser->setIsJson(\Magento\Translate\Inline\ParserInterface::JSON_FLAG_DEFAULT_STATE); + + $this->getParser()->setIsJson(false); + return $this; } @@ -199,29 +191,42 @@ class Inline implements \Magento\Translate\InlineInterface } /** - * Create block to render script and html with added inline translation content. + * Add inline script code + * + * Insert script and html with + * added inline translation content. * - * @param string $content * @return void */ - protected function _insertInlineScriptsHtml($content) + protected function addInlineScript() { - if ($this->_isScriptInserted || stripos($content, '</body>') === false) { + $content = $this->getParser()->getContent(); + if (stripos($content, '</body>') === false) { return; } + if (!$this->isScriptInserted) { + $this->getParser()->setContent(str_ireplace('</body>', $this->getInlineScript() . '</body>', $content)); + $this->isScriptInserted = true; + } + } + /** + * Retrieve inline script code + * + * Create block to render script and html with + * added inline translation content. + * + * @return string + */ + protected function getInlineScript() + { /** @var $block \Magento\View\Element\Template */ - $block = $this->_layout->createBlock('Magento\View\Element\Template'); - - $block->setAjaxUrl($this->_getAjaxUrl()); - - $block->setTemplate($this->_templateFileName); - - $html = $block->toHtml(); + $block = $this->layout->createBlock('Magento\View\Element\Template'); - $this->_parserFactory->get()->setContent(str_ireplace('</body>', $html . '</body>', $content)); + $block->setAjaxUrl($this->getAjaxUrl()); + $block->setTemplate($this->templateFileName); - $this->_isScriptInserted = true; + return $block->toHtml(); } /** @@ -229,10 +234,12 @@ class Inline implements \Magento\Translate\InlineInterface * * @return string */ - protected function _getAjaxUrl() + protected function getAjaxUrl() { - $scope = $this->_scopeResolver->getScope(); - return $this->_url->getUrl($this->_translatorRoute, array('_secure' => $scope->isCurrentlySecure())); + return $this->url->getUrl( + $this->translatorRoute, + ['_secure' => $this->scopeResolver->getScope()->isCurrentlySecure()] + ); } /** @@ -241,14 +248,14 @@ class Inline implements \Magento\Translate\InlineInterface * @param array|string &$body * @return $this */ - protected function _stripInlineTranslations(&$body) + protected function stripInlineTranslations(&$body) { if (is_array($body)) { foreach ($body as &$part) { - $this->_stripInlineTranslations($part); + $this->stripInlineTranslations($part); } } else if (is_string($body)) { - $body = preg_replace('#' . $this->_tokenRegex . '#', '$1', $body); + $body = preg_replace('#' . \Magento\Translate\Inline\ParserInterface::REGEXP_TOKEN . '#', '$1', $body); } return $this; } diff --git a/lib/Magento/Translate/Inline/ConfigInterface.php b/lib/Magento/Translate/Inline/ConfigInterface.php index 602795dff47..e11b50272a6 100644 --- a/lib/Magento/Translate/Inline/ConfigInterface.php +++ b/lib/Magento/Translate/Inline/ConfigInterface.php @@ -30,7 +30,7 @@ interface ConfigInterface /** * Check whether inline translation is enabled * - * @param int|null $scope + * @param null|string|bool|int|\Magento\Core\Model\Store $scope * @return bool */ public function isActive($scope = null); @@ -38,7 +38,7 @@ interface ConfigInterface /** * Check whether allowed client ip for inline translation * - * @param mixed $scope + * @param null|string|bool|int|\Magento\Core\Model\Store $scope * @return bool */ public function isDevAllowed($scope = null); diff --git a/lib/Magento/Translate/Inline/ParserFactory.php b/lib/Magento/Translate/Inline/ParserFactory.php index 22f3cb38db8..5b61f797c10 100644 --- a/lib/Magento/Translate/Inline/ParserFactory.php +++ b/lib/Magento/Translate/Inline/ParserFactory.php @@ -27,6 +27,11 @@ namespace Magento\Translate\Inline; class ParserFactory { + /** + * Default instance type + */ + const DEFAULT_INSTANCE_TYPE = 'Magento\Translate\Inline\ParserInterface'; + /** * Object Manager * @@ -50,15 +55,15 @@ class ParserFactory */ public function get() { - return $this->_objectManager->get('Magento\Translate\Inline\ParserInterface'); + return $this->_objectManager->get(self::DEFAULT_INSTANCE_TYPE); } /** - * @param array $data + * @param array $arguments * @return \Magento\Translate\Inline\ParserInterface */ - public function create(array $data = null) + public function create(array $arguments = array()) { - return $this->_objectManager->create('Magento\Translate\Inline\ParserInterface', $data); + return $this->_objectManager->create(self::DEFAULT_INSTANCE_TYPE, $arguments); } } diff --git a/lib/Magento/Translate/Inline/ParserInterface.php b/lib/Magento/Translate/Inline/ParserInterface.php index b9265c685f7..fe20466db70 100644 --- a/lib/Magento/Translate/Inline/ParserInterface.php +++ b/lib/Magento/Translate/Inline/ParserInterface.php @@ -26,9 +26,9 @@ namespace Magento\Translate\Inline; interface ParserInterface { /** - * Default state for jason flag + * Regular Expression for detected and replace translate */ - const JSON_FLAG_DEFAULT_STATE = false; + const REGEXP_TOKEN = '\{\{\{(.*?)\}\}\{\{(.*?)\}\}\{\{(.*?)\}\}\{\{(.*?)\}\}\}'; /** * Parse and save edited translation diff --git a/lib/Magento/Translate/Inline/ConfigFactory.php b/lib/Magento/Translate/Inline/Provider.php similarity index 68% rename from lib/Magento/Translate/Inline/ConfigFactory.php rename to lib/Magento/Translate/Inline/Provider.php index 503f602662a..44911077b6d 100644 --- a/lib/Magento/Translate/Inline/ConfigFactory.php +++ b/lib/Magento/Translate/Inline/Provider.php @@ -1,7 +1,5 @@ <?php /** - * Inline Translation config factory - * * Magento * * NOTICE OF LICENSE @@ -23,30 +21,31 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Translate\Inline; -class ConfigFactory +class Provider implements ProviderInterface { /** - * @var \Magento\ObjectManager + * @var \Magento\Translate\InlineInterface */ - protected $_objectManager; + protected $inlineTranslate; /** - * @param \Magento\ObjectManager $objectManager + * @param \Magento\Translate\InlineInterface $inlineTranslate */ - public function __construct(\Magento\ObjectManager $objectManager) + public function __construct(\Magento\Translate\InlineInterface $inlineTranslate) { - $this->_objectManager = $objectManager; + $this->inlineTranslate = $inlineTranslate; } /** - * Get instance of inline translate config + * Return instance of inline translate class * - * @return \Magento\Translate\Inline\ConfigInterface + * @return \Magento\Translate\InlineInterface */ public function get() { - return $this->_objectManager->get('Magento\Translate\Inline\ConfigInterface'); + return $this->inlineTranslate; } } diff --git a/lib/Magento/LauncherInterface.php b/lib/Magento/Translate/Inline/ProviderInterface.php similarity index 67% rename from lib/Magento/LauncherInterface.php rename to lib/Magento/Translate/Inline/ProviderInterface.php index 52c70a45f86..0e644613cc6 100644 --- a/lib/Magento/LauncherInterface.php +++ b/lib/Magento/Translate/Inline/ProviderInterface.php @@ -1,7 +1,5 @@ <?php /** - * Application. Performs user requested actions. - * * Magento * * NOTICE OF LICENSE @@ -20,15 +18,18 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento; -interface LauncherInterface +namespace Magento\Translate\Inline; + +interface ProviderInterface { /** - * @return \Magento\App\ResponseInterface + * Return instance of inline translate class + * + * @return \Magento\Translate\InlineInterface */ - public function launch(); + public function get(); } diff --git a/lib/Magento/Translate/Inline/Proxy.php b/lib/Magento/Translate/Inline/Proxy.php new file mode 100644 index 00000000000..c4401226565 --- /dev/null +++ b/lib/Magento/Translate/Inline/Proxy.php @@ -0,0 +1,160 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Translate\Inline; + +/** + * Proxy class for \Magento\Translate\Inline + */ +class Proxy extends \Magento\Translate\Inline +{ + /** + * Object Manager instance + * + * @var \Magento\ObjectManager + */ + protected $objectManager; + + /** + * Proxied instance name + * + * @var string + */ + protected $instanceName; + + /** + * Proxied instance + * + * @var \Magento\DesignEditor\Model\Translate\Inline + */ + protected $subject; + + /** + * Instance shareability flag + * + * @var bool + */ + protected $isShared; + + /** + * @param \Magento\ObjectManager $objectManager + * @param string $instanceName + * @param bool $shared + */ + public function __construct( + \Magento\ObjectManager $objectManager, + $instanceName = 'Magento\Translate\Inline', + $shared = true + ) { + $this->objectManager = $objectManager; + $this->instanceName = $instanceName; + $this->isShared = $shared; + } + + /** + * @return array + */ + public function __sleep() + { + return array('_subject', '_isShared'); + } + + /** + * Retrieve ObjectManager from global scope + * + * @return void + */ + public function __wakeup() + { + $this->objectManager = \Magento\App\ObjectManager::getInstance(); + } + + /** + * Clone proxied instance + * + * @return void + */ + public function __clone() + { + $this->subject = clone $this->_getSubject(); + } + + /** + * Get proxied instance + * + * @return \Magento\DesignEditor\Model\Translate\Inline + */ + protected function _getSubject() + { + if (!$this->subject) { + $this->subject = true === $this->isShared + ? $this->objectManager->get($this->instanceName) + : $this->objectManager->create($this->instanceName); + } + return $this->subject; + } + + /** + * Check if Inline Translates is allowed + * + * @return bool + */ + public function isAllowed() + { + return $this->_getSubject()->isAllowed(); + } + + /** + * Retrieve Inline Parser instance + * + * @return \Magento\Translate\Inline\ParserInterface + */ + public function getParser() + { + return $this->_getSubject()->getParser(); + } + + /** + * Replace translation templates with HTML fragments + * + * @param array|string &$body + * @param bool $isJson + * @return $this + */ + public function processResponseBody(&$body, $isJson = false) + { + return $this->_getSubject()->processResponseBody($body, $isJson); + } + + /** + * Additional translation mode html attribute is not needed for base inline translation. + * + * @param mixed|string|null $tagName + * @return mixed + */ + public function getAdditionalHtmlAttribute($tagName = null) + { + return $this->_getSubject()->getAdditionalHtmlAttribute($tagName); + } +} diff --git a/lib/Magento/Translate/Inline/State.php b/lib/Magento/Translate/Inline/State.php new file mode 100644 index 00000000000..c25dc615382 --- /dev/null +++ b/lib/Magento/Translate/Inline/State.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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Translate\Inline; + +class State implements StateInterface +{ + /** + * Flag to enable/disable inine translation + * + * @var bool + */ + protected $isEnabled = true; + + /** + * @var bool + */ + protected $storedStatus; + + /** + * Disable inline translation + * + * @return void + */ + public function disable() + { + $this->isEnabled = false; + } + + /** + * Enable inline translation + * + * @return void + */ + public function enable() + { + $this->isEnabled = true; + } + + /** + * Check if inline translation enabled/disabled + * + * @return bool + */ + public function isEnabled() + { + return $this->isEnabled; + } + + /** + * Suspend inline translation + * + * Store current inline translation status + * and apply new status or disable inline translation. + * + * @param bool $status + * @return void + */ + public function suspend($status = false) + { + if ($this->storedStatus === null) { + $this->storedStatus = $this->isEnabled; + $this->isEnabled = $status; + } + } + + /** + * Disable inline translation + * + * Restore inline translation status + * or apply new status. + * + * @param bool $status + * @return void + */ + public function resume($status = true) + { + $this->isEnabled = !$status ? $status : $this->storedStatus; + $this->storedStatus = null; + } +} diff --git a/lib/Magento/Translate/Inline/StateInterface.php b/lib/Magento/Translate/Inline/StateInterface.php new file mode 100644 index 00000000000..b5879eb6dde --- /dev/null +++ b/lib/Magento/Translate/Inline/StateInterface.php @@ -0,0 +1,71 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Translate\Inline; + +interface StateInterface +{ + /** + * Disable inline translation + * + * @return void + */ + public function disable(); + + /** + * Enable inline translation + * + * @return void + */ + public function enable(); + + /** + * Check if inline translation enabled/disabled + * + * @return bool + */ + public function isEnabled(); + + /** + * Suspend inline translation + * + * Store current inline translation status + * and apply new status or disable inline translation. + * + * @param bool $status + * @return void + */ + public function suspend($status = false); + + /** + * Disable inline translation + * + * Restore inline translation status + * or apply new status. + * + * @param bool $status + * @return void + */ + public function resume($status = true); +} diff --git a/lib/Magento/Translate/InlineInterface.php b/lib/Magento/Translate/InlineInterface.php index 95a82a8a6f7..09ebc223e0f 100644 --- a/lib/Magento/Translate/InlineInterface.php +++ b/lib/Magento/Translate/InlineInterface.php @@ -36,7 +36,7 @@ interface InlineInterface public function getAdditionalHtmlAttribute($tagName = null); /** - * Is enabled and allowed Inline Translates + * Check if inline translates is allowed * * @return bool */ @@ -50,4 +50,11 @@ interface InlineInterface * @return \Magento\Translate\InlineInterface */ public function processResponseBody(&$body, $isJson = false); + + /** + * Retrieve Inline Parser instance + * + * @return Inline\ParserInterface + */ + public function getParser(); } diff --git a/lib/Magento/Translate/Locale/Resolver/Plugin.php b/lib/Magento/Translate/Locale/Resolver/Plugin.php index 900af82df98..5d395ed1d60 100644 --- a/lib/Magento/Translate/Locale/Resolver/Plugin.php +++ b/lib/Magento/Translate/Locale/Resolver/Plugin.php @@ -71,7 +71,8 @@ class Plugin protected function _init($localeCode) { if (!is_null($localeCode)) { - $this->_translate->initLocale($localeCode); + $this->_translate->setLocale($localeCode) + ->loadData(null, true); } } } diff --git a/lib/Magento/TranslateInterface.php b/lib/Magento/TranslateInterface.php index 308558a629a..ac94cec7d5c 100644 --- a/lib/Magento/TranslateInterface.php +++ b/lib/Magento/TranslateInterface.php @@ -1,7 +1,5 @@ <?php /** - * Translator interface - * * Magento * * NOTICE OF LICENSE @@ -36,37 +34,27 @@ interface TranslateInterface const DEFAULT_STRING = 'Translate String'; /** - * Determine if translation is enabled and allowed. + * Initialize translation data * - * @param mixed $scope - * @return bool - */ - public function isAllowed($scope = null); - - /** - * Initialization translation data - * - * @param string $area - * @param \Magento\Object $initParams + * @param string|null $area * @param bool $forceReload * @return \Magento\TranslateInterface */ - public function init($area = null, $initParams = null, $forceReload = false); + public function loadData($area = null, $forceReload = false); /** - * Retrieve active translate mode + * Retrieve translation data * - * @return bool + * @return array */ - public function getTranslateInline(); + public function getData(); /** - * Set Translate inline mode + * Retrieve locale * - * @param bool $flag - * @return \Magento\TranslateInterface + * @return string */ - public function setTranslateInline($flag); + public function getLocale(); /** * Set locale @@ -77,19 +65,9 @@ interface TranslateInterface public function setLocale($locale); /** - * Translate + * Retrieve theme code * - * @param array $args * @return string */ - public function translate($args); - - /** - * This method initializes the Translate object for this instance. - * - * @param string $localeCode - * @param string|null $area - * @return \Magento\TranslateInterface - */ - public function initLocale($localeCode, $area = null); + public function getTheme(); } diff --git a/lib/Magento/Url.php b/lib/Magento/Url.php index 88b79f6cb34..4398515df5c 100644 --- a/lib/Magento/Url.php +++ b/lib/Magento/Url.php @@ -85,13 +85,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface */ protected static $_configDataCache; - /** - * Encrypted session identifier - * - * @var string|null - */ - protected static $_encryptedSessionId; - /** * Reserved Route parameter keys * @@ -199,16 +192,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface parent::__construct($data); } - /** - * Get default url type - * - * @return string - */ - protected function _getDefaultUrlType() - { - return \Magento\UrlInterface::URL_TYPE_LINK; - } - /** * Initialize object data from retrieved url * @@ -237,16 +220,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface return $this; } - /** - * Retrieve default controller name - * - * @return string - */ - protected function _getDefaultControllerName() - { - return self::DEFAULT_CONTROLLER_NAME; - } - /** * Set use session rule * @@ -259,18 +232,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface return $this; } - /** - * Set route front name - * - * @param string $name - * @return \Magento\UrlInterface - */ - protected function _setRouteFrontName($name) - { - $this->setData('route_front_name', $name); - return $this; - } - /** * Retrieve use session rule * @@ -284,16 +245,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface return $this->_useSession; } - /** - * Retrieve default action name - * - * @return string - */ - protected function _getDefaultActionName() - { - return self::DEFAULT_ACTION_NAME; - } - /** * Retrieve configuration data * @@ -369,21 +320,11 @@ class Url extends \Magento\Object implements \Magento\UrlInterface protected function _getType() { if (!$this->_routeParamsResolver->hasData('type')) { - $this->_routeParamsResolver->setData('type', $this->_getDefaultUrlType()); + $this->_routeParamsResolver->setData('type', self::DEFAULT_URL_TYPE); } return $this->_routeParamsResolver->getType(); } - /** - * @param string $type - * @return mixed - */ - public function setType($type) - { - $this->_routeParamsResolver->setType($type); - return $this; - } - /** * Retrieve is secure mode URL * @@ -467,8 +408,8 @@ class Url extends \Magento\Object implements \Magento\UrlInterface $this->_routeParamsResolver->setType(\Magento\UrlInterface::URL_TYPE_DIRECT_LINK); } - $result = $this->_getScope()->getBaseUrl($this->_getType(), $this->_isSecure()); - $this->_routeParamsResolver->setType($this->_getDefaultUrlType()); + $result = $this->_getScope()->getBaseUrl($this->_getType(), $this->_isSecure()); + $this->_routeParamsResolver->setType(self::DEFAULT_URL_TYPE); return $result; } @@ -541,12 +482,12 @@ class Url extends \Magento\Object implements \Magento\UrlInterface if ($this->_getControllerName()) { $path .= $this->_getControllerName() . '/'; } elseif ($hasParams) { - $path .= $this->_getDefaultControllerName() . '/'; + $path .= self::DEFAULT_CONTROLLER_NAME . '/'; } if ($this->_getActionName()) { $path .= $this->_getActionName() . '/'; } elseif ($hasParams) { - $path .= $this->_getDefaultActionName() . '/'; + $path .= self::DEFAULT_ACTION_NAME . '/'; } return $path; @@ -575,9 +516,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface $routePath .= $key . '/' . $value . '/'; } } - if ($routePath != '' && substr($routePath, -1, 1) !== '/') { - $routePath .= '/'; - } $this->setData('route_path', $routePath); } return $this->_getData('route_path'); @@ -620,9 +558,8 @@ class Url extends \Magento\Object implements \Magento\UrlInterface $this->_getRouteName(), $this->_scopeResolver->getAreaCode() ); - $this->_setRouteFrontName($frontName); + $this->setData('route_front_name', $frontName); } - return $this->_getData('route_front_name'); } @@ -657,11 +594,12 @@ class Url extends \Magento\Object implements \Magento\UrlInterface /** * Retrieve controller name * + * @param mixed $default * @return string|null */ - protected function _getControllerName() + protected function _getControllerName($default = null) { - return $this->_getData('controller_name') ? $this->_getData('controller_name') : null; + return $this->_getData('controller_name') ? $this->_getData('controller_name') : $default; } /** @@ -751,10 +689,10 @@ class Url extends \Magento\Object implements \Magento\UrlInterface */ public function addSessionParam() { - if (!self::$_encryptedSessionId) { - self::$_encryptedSessionId = $this->_session->getSessionId(); - } - $this->setQueryParam($this->_sidResolver->getSessionIdQueryParam($this->_session), self::$_encryptedSessionId); + $this->setQueryParam( + $this->_sidResolver->getSessionIdQueryParam($this->_session), + $this->_session->getSessionId() + ); return $this; } @@ -781,37 +719,17 @@ class Url extends \Magento\Object implements \Magento\UrlInterface } /** - * Set query Params as array + * Add query Params as array * * @param array $data * @return \Magento\UrlInterface */ - public function setQueryParams(array $data) + public function addQueryParams(array $data) { - $this->_queryParamsResolver->setQueryParams($data); + $this->_queryParamsResolver->addQueryParams($data); return $this; } - /** - * Purge Query params array - * - * @return \Magento\UrlInterface - */ - public function purgeQueryParams() - { - return $this->_queryParamsResolver->purgeQueryParams(); - } - - /** - * Return Query Params - * - * @return array - */ - protected function _getQueryParams() - { - return $this->_queryParamsResolver->getQueryParams(); - } - /** * Set query param * @@ -867,7 +785,7 @@ class Url extends \Magento\Object implements \Magento\UrlInterface $query = null; if (isset($routeParams['_query'])) { - $this->purgeQueryParams(); + $this->_queryParamsResolver->setQueryParams([]); $query = $routeParams['_query']; unset($routeParams['_query']); } @@ -885,10 +803,10 @@ class Url extends \Magento\Object implements \Magento\UrlInterface if (is_string($query)) { $this->_setQuery($query); } elseif (is_array($query)) { - $this->setQueryParams($query, !empty($routeParams['_current'])); + $this->addQueryParams($query, !empty($routeParams['_current'])); } if ($query === false) { - $this->setQueryParams(array()); + $this->addQueryParams(array()); } } @@ -919,19 +837,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface * @return \Magento\UrlInterface */ protected function _prepareSessionUrl($url) - { - return $this->_prepareSessionUrlWithParams($url, array()); - } - - /** - * Check and add session id to URL, session is obtained with parameters - * - * @param string $url - * @param array $params - * - * @return \Magento\UrlInterface - */ - protected function _prepareSessionUrlWithParams($url, array $params) { if (!$this->getUseSession()) { return $this; @@ -1015,7 +920,28 @@ class Url extends \Magento\Object implements \Magento\UrlInterface { return preg_replace_callback( '#(\?|&|&)___SID=([SU])(&|&)?#', - array($this, "_sessionVarCallback"), + // @codingStandardsIgnoreStart + /** + * Callback function for session replace + * + * @param array $match + * @return string + */ + // @codingStandardsIgnoreEnd + function ($match) { + if ($this->useSessionIdForUrl($match[2] == 'S' ? true : false)) { + return $match[1] + . $this->_sidResolver->getSessionIdQueryParam($this->_session) + . '=' . $this->_session->getSessionId() + . (isset($match[3]) ? $match[3] : ''); + } else { + if ($match[1] == '?') { + return isset($match[3]) ? '?' : ''; + } elseif ($match[1] == '&' || $match[1] == '&') { + return isset($match[3]) ? $match[3] : ''; + } + } + }, $html ); } @@ -1045,34 +971,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface return $this->getData($key); } - /** - * Callback function for session replace - * - * @param array $match - * @return string - */ - protected function _sessionVarCallback($match) - { - if ($this->useSessionIdForUrl($match[2] == 'S' ? true : false)) { - return $match[1] . $this->_sidResolver->getSessionIdQueryParam( - $this->_session - ) . '=' . $this->_session->getSessionId() . (isset( - $match[3] - ) ? $match[3] : ''); - } else { - if ($match[1] == '?' && isset($match[3])) { - return '?'; - } elseif ($match[1] == '?' && !isset($match[3])) { - return ''; - } elseif (($match[1] == '&' || $match[1] == '&') && !isset($match[3])) { - return ''; - } elseif (($match[1] == '&' || $match[1] == '&') && isset($match[3])) { - return $match[3]; - } - } - return ''; - } - /** * Check if users originated URL is one of the domain URLs assigned to scopes * @@ -1102,8 +1000,7 @@ class Url extends \Magento\Object implements \Magento\UrlInterface */ public function getRedirectUrl($url) { - $this->_prepareSessionUrlWithParams($url, array('name' => self::SESSION_NAMESPACE)); - + $this->_prepareSessionUrl($url); $query = $this->_getQuery(false); if ($query) { $url .= (strpos($url, '?') === false ? '?' : '&') . $query; diff --git a/lib/Magento/Url/QueryParamsResolver.php b/lib/Magento/Url/QueryParamsResolver.php index 9f5ee5dff3f..06beda4db67 100644 --- a/lib/Magento/Url/QueryParamsResolver.php +++ b/lib/Magento/Url/QueryParamsResolver.php @@ -47,11 +47,10 @@ class QueryParamsResolver extends \Magento\Object implements QueryParamsResolver */ public function setQuery($data) { - if ($this->_getData('query') == $data) { - return $this; + if ($this->_getData('query') != $data) { + $this->unsetData('query_params'); + $this->setData('query', $data); } - $this->unsetData('query_params'); - $this->setData('query', $data); return $this; } @@ -91,16 +90,15 @@ class QueryParamsResolver extends \Magento\Object implements QueryParamsResolver /** * {@inheritdoc} */ - public function purgeQueryParams() + public function setQueryParams(array $data) { - $this->setData('query_params', array()); - return $this; + return $this->setData('query_params', $data); } /** * {@inheritdoc} */ - public function setQueryParams(array $data) + public function addQueryParams(array $data) { $this->unsetData('query'); diff --git a/lib/Magento/Url/QueryParamsResolverInterface.php b/lib/Magento/Url/QueryParamsResolverInterface.php index 3bfcbf5c648..4c3382043e8 100644 --- a/lib/Magento/Url/QueryParamsResolverInterface.php +++ b/lib/Magento/Url/QueryParamsResolverInterface.php @@ -58,19 +58,20 @@ interface QueryParamsResolverInterface public function getQueryParams(); /** - * Purge Query params array + * Set query parameters * + * @param array $data * @return \Magento\Url\QueryParamsResolverInterface */ - public function purgeQueryParams(); + public function setQueryParams(array $data); /** - * Set query Params as array + * Add query parameters * * @param array $data * @return \Magento\Url\QueryParamsResolverInterface */ - public function setQueryParams(array $data); + public function addQueryParams(array $data); /** * Unset data from the object. diff --git a/lib/Magento/Url/Validator.php b/lib/Magento/Url/Validator.php index c7c8e6041c3..8ec85cc803c 100644 --- a/lib/Magento/Url/Validator.php +++ b/lib/Magento/Url/Validator.php @@ -39,7 +39,6 @@ class Validator extends \Zend_Validate_Abstract * Error keys */ const INVALID_URL = 'invalidUrl'; - /**#@-*/ /** @@ -68,7 +67,6 @@ class Validator extends \Zend_Validate_Abstract { $this->_setValue($value); - //check valid URL if (!\Zend_Uri::check($value)) { $this->_error(self::INVALID_URL); return false; diff --git a/lib/Magento/UrlInterface.php b/lib/Magento/UrlInterface.php index d6dece6783d..b98e807fbba 100644 --- a/lib/Magento/UrlInterface.php +++ b/lib/Magento/UrlInterface.php @@ -44,6 +44,13 @@ interface UrlInterface const URL_TYPE_JS = 'js'; + /** + * Default url type + * + * Equals to self::URL_TYPE_LINK + */ + const DEFAULT_URL_TYPE = 'link'; + /** * Default controller name */ @@ -103,12 +110,12 @@ interface UrlInterface public function addSessionParam(); /** - * Set query Params as array + * Add query parameters * * @param array $data * @return \Magento\UrlInterface */ - public function setQueryParams(array $data); + public function addQueryParams(array $data); /** * Set query param diff --git a/lib/Magento/View/Context.php b/lib/Magento/View/Context.php index 046e91dbb3a..e1899993d53 100644 --- a/lib/Magento/View/Context.php +++ b/lib/Magento/View/Context.php @@ -30,8 +30,8 @@ use Magento\Core\Model\Store\Config as StoreConfig; 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\View\LayoutInterface; use Magento\Session\SessionManager; use Magento\App\CacheInterface as Cache; use Magento\App\Cache\StateInterface as CacheState; @@ -146,13 +146,6 @@ class Context */ protected $logger; - /** - * Application - * - * @var \Magento\Core\Model\App - */ - protected $app; - /** * Application state * @@ -176,8 +169,8 @@ class Context * @param ViewConfig $viewConfig * @param CacheState $cacheState * @param Logger $logger - * @param App $app * @param AppState $appState + * @param LayoutInterface $layout * * @todo reduce parameter number * @@ -197,8 +190,8 @@ class Context ViewConfig $viewConfig, CacheState $cacheState, Logger $logger, - App $app, - AppState $appState + AppState $appState, + LayoutInterface $layout ) { $this->request = $request; $this->eventManager = $eventManager; @@ -209,12 +202,12 @@ class Context $this->session = $session; $this->storeConfig = $storeConfig; $this->frontController = $frontController; - $this->viewUrl = $viewUrl; - $this->viewConfig = $viewConfig; - $this->cacheState = $cacheState; - $this->logger = $logger; - $this->app = $app; - $this->appState = $appState; + $this->viewUrl = $viewUrl; + $this->viewConfig = $viewConfig; + $this->cacheState = $cacheState; + $this->logger = $logger; + $this->appState = $appState; + $this->layout = $layout; } /** @@ -357,16 +350,6 @@ class Context return $this->logger; } - /** - * Retrieve application - * - * @return \Magento\Core\Model\App - */ - public function getApp() - { - return $this->app; - } - /** * Retrieve layout area * @@ -374,7 +357,7 @@ class Context */ public function getArea() { - return $this->app->getLayout()->getArea(); + return $this->layout->getArea(); } /** diff --git a/lib/Magento/View/Design/ThemeInterface.php b/lib/Magento/View/Design/ThemeInterface.php index 3f42b9f4f0c..f93136a0dfb 100644 --- a/lib/Magento/View/Design/ThemeInterface.php +++ b/lib/Magento/View/Design/ThemeInterface.php @@ -25,8 +25,6 @@ namespace Magento\View\Design; /** * Interface ThemeInterface - * - * @method int|null getId() */ interface ThemeInterface { diff --git a/lib/Magento/View/DesignLoader.php b/lib/Magento/View/DesignLoader.php index 0e72228f853..6f2180296b4 100644 --- a/lib/Magento/View/DesignLoader.php +++ b/lib/Magento/View/DesignLoader.php @@ -35,9 +35,9 @@ class DesignLoader /** * Application * - * @var \Magento\Core\Model\App + * @var \Magento\App\AreaList */ - protected $_app; + protected $_areaList; /** * Layout @@ -47,19 +47,17 @@ class DesignLoader protected $_layout; /** - * Constructor - * * @param \Magento\App\RequestInterface $request - * @param \Magento\Core\Model\App $app - * @param \Magento\View\LayoutInterface $layout + * @param \Magento\App\AreaList $areaList + * @param LayoutInterface $layout */ public function __construct( \Magento\App\RequestInterface $request, - \Magento\Core\Model\App $app, + \Magento\App\AreaList $areaList, \Magento\View\LayoutInterface $layout ) { $this->_request = $request; - $this->_app = $app; + $this->_areaList = $areaList; $this->_layout = $layout; } @@ -70,7 +68,7 @@ class DesignLoader */ public function load() { - $area = $this->_app->getArea($this->_layout->getArea()); + $area = $this->_areaList->getArea($this->_layout->getArea()); $area->load(\Magento\Core\Model\App\Area::PART_DESIGN); $area->load(\Magento\Core\Model\App\Area::PART_TRANSLATE); $area->detectDesign($this->_request); diff --git a/lib/Magento/View/Element/AbstractBlock.php b/lib/Magento/View/Element/AbstractBlock.php index 99b21c76513..40886401533 100644 --- a/lib/Magento/View/Element/AbstractBlock.php +++ b/lib/Magento/View/Element/AbstractBlock.php @@ -140,13 +140,6 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface */ protected $_logger; - /** - * Application - * - * @var \Magento\Core\Model\App - */ - protected $_app; - /** * Escaper * @@ -166,6 +159,11 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface */ protected $_localeDate; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * The property is used to define content-scope of block. Can be private or public. * If it isn't defined then application considers it as false. @@ -199,6 +197,8 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface $this->_escaper = $context->getEscaper(); $this->filterManager = $context->getFilterManager(); $this->_localeDate = $context->getLocaleDate(); + $this->inlineTranslation = $context->getInlineTranslation(); + $this->_isScopePrivate = false; parent::__construct($data); $this->_construct(); } @@ -635,7 +635,7 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface $html = $this->_loadCache(); if ($html === false) { if ($this->hasData('translate_inline')) { - $this->_translator->setTranslateInline($this->getData('translate_inline')); + $this->inlineTranslation->suspend($this->getData('translate_inline')); } $this->_beforeToHtml(); @@ -643,7 +643,7 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface $this->_saveCache($html); if ($this->hasData('translate_inline')) { - $this->_translator->setTranslateInline(true); + $this->inlineTranslation->resume(); } } $html = $this->_afterToHtml($html); diff --git a/lib/Magento/View/Element/Context.php b/lib/Magento/View/Element/Context.php index 58b9e614ab6..e2f2579bc2c 100644 --- a/lib/Magento/View/Element/Context.php +++ b/lib/Magento/View/Element/Context.php @@ -152,8 +152,11 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_localeDate; /** - * Constructor - * + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + + /** * @param \Magento\App\RequestInterface $request * @param \Magento\View\LayoutInterface $layout * @param \Magento\Event\ManagerInterface $eventManager @@ -171,10 +174,9 @@ class Context implements \Magento\ObjectManager\ContextInterface * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate - * @param array $data + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * * @SuppressWarnings(PHPMD.ExcessiveParameterList) - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( \Magento\App\RequestInterface $request, @@ -194,7 +196,7 @@ class Context implements \Magento\ObjectManager\ContextInterface \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, - array $data = array() + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_request = $request; $this->_layout = $layout; @@ -213,6 +215,7 @@ class Context implements \Magento\ObjectManager\ContextInterface $this->_escaper = $escaper; $this->_filterManager = $filterManager; $this->_localeDate = $localeDate; + $this->inlineTranslation = $inlineTranslation; } /** @@ -305,6 +308,16 @@ class Context implements \Magento\ObjectManager\ContextInterface return $this->_translator; } + /** + * Get inline translation status object + * + * @return \Magento\Translate\Inline\StateInterface + */ + public function getInlineTranslation() + { + return $this->inlineTranslation; + } + /** * Get URL builder * diff --git a/lib/Magento/View/Element/Template/Context.php b/lib/Magento/View/Element/Template/Context.php index 1cc1eaf77e1..8b910c79a90 100644 --- a/lib/Magento/View/Element/Template/Context.php +++ b/lib/Magento/View/Element/Template/Context.php @@ -59,8 +59,6 @@ class Context extends \Magento\View\Element\Context protected $_storeManager; /** - * Constructor - * * @param \Magento\App\RequestInterface $request * @param \Magento\View\LayoutInterface $layout * @param \Magento\Event\ManagerInterface $eventManager @@ -78,12 +76,12 @@ class Context extends \Magento\View\Element\Context * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEnginePool $enginePool * @param \Magento\App\State $appState * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -105,12 +103,12 @@ class Context extends \Magento\View\Element\Context \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\App\Filesystem $filesystem, \Magento\View\FileSystem $viewFileSystem, \Magento\View\TemplateEnginePool $enginePool, \Magento\App\State $appState, - \Magento\Core\Model\StoreManagerInterface $storeManager, - array $data = array() + \Magento\Core\Model\StoreManagerInterface $storeManager ) { parent::__construct( $request, @@ -130,7 +128,7 @@ class Context extends \Magento\View\Element\Context $escaper, $filterManager, $localeDate, - $data + $inlineTranslation ); $this->_storeManager = $storeManager; diff --git a/pub/cron.php b/pub/cron.php index 7e00cc661c1..3ac4fa68e37 100644 --- a/pub/cron.php +++ b/pub/cron.php @@ -26,10 +26,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +use Magento\Core\Model\StoreManager; + require dirname(__DIR__) . '/app/bootstrap.php'; umask(0); $params = array( - \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', + StoreManager::PARAM_RUN_CODE => 'admin', \Magento\Core\Model\Store::CUSTOM_ENTRY_POINT_PARAM => true ); $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); diff --git a/pub/get.php b/pub/get.php index e23bae7b7e6..bf2e09045ba 100644 --- a/pub/get.php +++ b/pub/get.php @@ -26,6 +26,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +use Magento\App\Cache\Frontend\Factory; +use Magento\Module\Declaration\Reader\Filesystem; + require dirname(__DIR__) . '/app/bootstrap.php'; $mediaDirectory = null; @@ -76,8 +79,8 @@ if ($mediaDirectory) { // Materialize file in application $params = $_SERVER; if (empty($mediaDirectory)) { - $params[\Magento\Core\Model\App::PARAM_ALLOWED_MODULES] = array('Magento_Core'); - $params[\Magento\Core\Model\App::PARAM_CACHE_FORCED_OPTIONS]['frontend_options']['disable_save'] = true; + $params[Filesystem::PARAM_ALLOWED_MODULES] = array('Magento_Core'); + $params[Factory::PARAM_CACHE_FORCED_OPTIONS]['frontend_options']['disable_save'] = true; } $entryPoint = new \Magento\App\EntryPoint\EntryPoint(dirname(__DIR__), $params); -- GitLab