From 58aa4466a23ed46e9f33c0fd9fe1a0bc4b5dac7b Mon Sep 17 00:00:00 2001 From: mage2-team <mage2-team@magento.com> Date: Fri, 11 Oct 2013 11:06:35 -0700 Subject: [PATCH] 2.0.0.0-dev47 * Fixed bugs: * Fixed compilation of DI definitions * Fixed direct injection of auto-generated proxy classes * Fixed usages of auto-generated factories on the library level * Fixed fatal error after saving customer address with VAT number * Fixed fatal error caused by USPS shipping method with debug * Fixed url to Tax Class controller * Fixed incorrect subtotal displayed on the Order page * Fixed incorrect arguments for shipping xml elements factory * Fixed theme editing in developer mode (PHP 5.4) * Fixed absent conditions during New Shopping Cart Price Rule creation * Fixed fatal error while try to edit created configurable product while Dev Mode enabled (PHP 5.4) * Fixed frontend error when persistent shopping cart functionality is enabled * Fixed Tax tab * Fixed broken link "Orders and returns" on frontend * Fixed placing order within OnePageCheckout using online payment methods * Fixed error when product is being added to order from backend if Gift Messages are enabled * Fixed error when product is being added to cart if MAP is enabled * Fixed error when product attribute template is being edited * Fixed error when setting configuration for Google API * Fixed backend issue when Stores>Configuration>System>Advanced page was not displayed and did not allow to save changes * Fixed not executable button "Continue shopping" on Multi-shipping process * Fixed error on adding product to shopping cart from cross-sells block * Fixed fatal error on Recurring Billing Profiles page * Fixed error on setting configuration for Catalog * Fixed error on placing order with Configurable product * Fixed issue with downloadable product creation * Fixed error on update configuration for payment methods * Fixed blank page on shopping cart if FedEx shipping method is enabled * Fixed fatal error when SID presents in URL * Fixed absence of selection of a role assigned to an admin user --- CHANGELOG.markdown => CHANGELOG.md | 110 ++++++++----- .../Magento/AdminNotification/etc/module.xml | 1 + .../Catalog/Product/Attribute/Set/Main.php | 6 +- .../Block/Promo/Quote/Edit/Tab/Actions.php | 2 +- .../Block/Promo/Quote/Edit/Tab/Conditions.php | 2 +- .../Adminhtml/Block/Tax/Rule/Edit/Form.php | 6 +- .../Adminhtml/Controller/System/Backup.php | 14 +- .../Catalog/Product/Edit/Action/Attribute.php | 12 +- .../Adminhtml/Model/Giftmessage/Save.php | 11 +- .../layout/adminhtml_system_backup_block.xml | 4 +- app/code/Magento/Authorizenet/etc/module.xml | 1 + .../Widget/Grid/Column/Renderer/Radio.php | 4 +- app/code/Magento/Backend/Helper/Data.php | 18 +-- .../Model/Config/Backend/Encrypted.php | 10 -- .../Config/Source/Storage/Media/Database.php | 8 +- app/code/Magento/Backend/Model/Url.php | 4 +- .../Model/Widget/Grid/Row/UrlGenerator.php | 7 +- app/code/Magento/Backend/etc/di.xml | 15 +- app/code/Magento/Backend/etc/module.xml | 2 +- app/code/Magento/Backup/Model/Backup.php | 39 ++++- app/code/Magento/Backup/Model/Db.php | 6 +- app/code/Magento/Backup/Model/Observer.php | 14 +- app/code/Magento/Backup/Model/Resource/Db.php | 7 +- .../Magento/Backup/Model/Resource/Helper.php | 12 +- app/code/Magento/Backup/etc/di.xml | 35 ++++ app/code/Magento/Bundle/etc/module.xml | 1 + app/code/Magento/Captcha/etc/module.xml | 1 + .../Magento/Captcha/view/frontend/onepage.js | 3 +- .../Backend/Grid/ColumnSet.php | 2 +- app/code/Magento/Catalog/Helper/Data.php | 4 +- .../Catalog/view/frontend/js/price-option.js | 7 +- .../CatalogInventory/etc/product_types.xml | 4 +- .../CatalogSearch/Controller/Advanced.php | 6 +- .../Model/Config/Backend/Search/Type.php | 2 +- .../CatalogSearch/Model/Resource/Fulltext.php | 50 +++--- app/code/Magento/CatalogSearch/etc/module.xml | 3 +- app/code/Magento/Centinel/etc/module.xml | 1 + app/code/Magento/Checkout/Helper/Data.php | 2 +- .../view/frontend/cart/crosssell.phtml | 2 +- .../view/frontend/multishipping/success.phtml | 2 +- app/code/Magento/Contacts/etc/module.xml | 1 + app/code/Magento/Core/Model/AbstractModel.php | 3 +- app/code/Magento/Core/Model/App.php | 4 +- app/code/Magento/Core/Model/Config/Data.php | 16 ++ .../Magento/Core/Model/Config/Resource.php | 2 - .../Model/Config/Section/Reader/Store.php | 4 +- .../Model/Config/Section/Reader/Website.php | 2 +- app/code/Magento/Core/Model/Db/Updater.php | 10 -- .../Magento/Core/Model/File/Storage/File.php | 11 +- app/code/Magento/Core/Model/Layout.php | 2 +- app/code/Magento/Core/Model/Resource.php | 6 +- .../Core/Model/Resource/File/Storage/File.php | 26 ++- .../Core/Model/Resource/Setup/Context.php | 2 +- .../Core/Model/Resource/Setup/Migration.php | 4 +- app/code/Magento/Core/Model/Translate.php | 2 +- app/code/Magento/Core/Model/Url.php | 24 ++- .../Magento/Core/Model/Url/SecurityInfo.php | 2 +- app/code/Magento/Core/etc/layouts.xsd | 1 + app/code/Magento/Core/etc/resources.xml | 2 - .../Cron/Model/Config/Converter/Xml.php | 11 +- .../Customer/Block/Account/Customer.php | 70 ++++++++ app/code/Magento/Customer/Helper/Address.php | 4 +- app/code/Magento/Customer/Helper/Data.php | 2 +- .../Magento/Customer/Model/Config/Share.php | 4 +- app/code/Magento/Customer/Model/Observer.php | 2 +- app/code/Magento/Customer/Model/Session.php | 8 +- app/code/Magento/Customer/etc/di.xml | 16 ++ .../DesignEditor/Model/Url/NavigationMode.php | 4 +- app/code/Magento/DesignEditor/etc/module.xml | 1 + .../Adminhtml/Downloadable/File.php | 2 +- app/code/Magento/Downloadable/etc/module.xml | 1 + .../Eav/Model/Entity/Attribute/Config.php | 7 +- .../Magento/GiftMessage/Model/Message.php | 2 +- .../Magento/GiftMessage/Model/TypeFactory.php | 2 +- app/code/Magento/GiftMessage/etc/module.xml | 1 + .../Magento/GoogleCheckout/Model/Observer.php | 4 +- .../GoogleCheckout/etc/adminhtml/system.xml | 2 +- .../Magento/GoogleShopping/etc/module.xml | 1 + .../Model/Installer/AbstractInstaller.php | 7 +- .../Install/Model/Installer/Config.php | 4 +- .../Install/Model/Installer/Console.php | 4 +- .../Magento/Install/Model/Installer/Db.php | 4 +- .../Install/Model/Installer/Filesystem.php | 4 +- .../Magento/Install/Model/Installer/Pear.php | 4 +- app/code/Magento/Install/etc/di.xml | 5 + .../Visitor/Online/Grid/Row/UrlGenerator.php | 4 +- app/code/Magento/Newsletter/etc/module.xml | 3 +- app/code/Magento/Ogone/Controller/Api.php | 4 +- app/code/Magento/Page/Block/Link.php | 15 +- .../PageCache/Model/CacheControlFactory.php | 2 +- app/code/Magento/Paypal/etc/module.xml | 1 + app/code/Magento/PaypalUk/etc/module.xml | 2 + app/code/Magento/Persistent/Helper/Data.php | 2 +- app/code/Magento/Reports/etc/module.xml | 1 + app/code/Magento/Review/etc/module.xml | 1 + app/code/Magento/Rss/etc/module.xml | 1 + .../Adminhtml/Recurring/Profile/Grid.php | 4 +- .../Model/Order/Grid/Row/UrlGenerator.php | 4 +- .../Order/Attribute/Backend/Parent.php | 66 -------- .../Creditmemo/Attribute/Backend/Parent.php | 63 -------- .../Invoice/Attribute/Backend/Parent.php | 64 -------- .../Shipment/Attribute/Backend/Parent.php | 69 -------- .../Address/Attribute/Backend/Parent.php | 55 ------- .../Sales/Model/Resource/Sale/Collection.php | 2 +- .../Model/Carrier/AbstractCarrier.php | 2 +- app/code/Magento/Sitemap/etc/module.xml | 2 + .../Model/Config/Source/TaxClass/Customer.php | 5 + .../Tax/Model/Resource/Calculation.php | 8 +- app/code/Magento/Tax/etc/di.xml | 5 + app/code/Magento/Theme/etc/module.xml | 1 + .../Usa/Model/Shipping/Carrier/Dhl.php | 4 +- .../Shipping/Carrier/Dhl/International.php | 6 +- .../Usa/Model/Shipping/Carrier/Fedex.php | 4 +- .../Usa/Model/Shipping/Carrier/Ups.php | 8 +- .../Shipping/Carrier/Ups/Source/Mode.php | 5 +- app/code/Magento/Usa/etc/adminhtml/system.xml | 12 +- app/code/Magento/User/Model/User.php | 1 - app/code/Magento/Webapi/etc/di.xml | 8 +- app/code/Magento/Webhook/etc/module.xml | 2 + app/code/Magento/Weee/etc/module.xml | 1 + app/code/Magento/Widget/etc/module.xml | 1 + app/code/Magento/Wishlist/Model/Item.php | 2 +- app/code/Magento/Wishlist/etc/module.xml | 1 + .../CatalogSearch/Controller/ResultTest.php | 5 +- .../Magento/Checkout/Controller/CartTest.php | 12 +- .../Magento/Core/Model/LayoutTest.php | 4 +- .../Adminhtml/Downloadable/FileTest.php | 49 ++++++ .../Controller/Adminhtml/_files/sample.txt | 0 .../Magento/Install/Model/InstallerTest.php | 64 +++----- .../Magento/Test/Integrity/LayoutTest.php | 3 +- .../Integrity/Modular/UsaConfigFilesTest.php | 67 ++++++++ .../CodingStandard/Tool/CodeSniffer.php | 10 ++ .../Tool/CodeSniffer/Wrapper.php | 15 ++ .../TestFramework/Dependency/LayoutRule.php | 4 +- .../Magento/TestFramework/Utility/Files.php | 16 +- .../Magento/Test/Legacy/ObsoleteCodeTest.php | 20 ++- .../obsolete_mage.php} | 19 +-- .../Test/Legacy/_files/obsolete_classes.php | 6 + .../Test/Legacy/_files/obsolete_constants.php | 4 + .../Test/Legacy/_files/obsolete_methods.php | 14 +- .../Legacy/_files/obsolete_properties.php | 1 + .../Magento/Test/Legacy/_files/words_ce.xml | 2 +- .../Test/Php/Exemplar/CodeStyleTest.php | 2 +- .../Magento/Test/Php/LiveCodeTest.php | 71 +++++++-- .../Test/Php/_files/blacklist/common.txt | 14 +- .../Php/_files/phpcs/blacklist/common.txt | 40 +++++ .../Php/_files/phpcs/whitelist/common.txt | 9 ++ .../Test/Php/_files/whitelist/common.txt | 4 +- .../Column/Renderer/Radio/ExtendedTest.php | 88 +++++++++++ .../Widget/Grid/Column/Renderer/RadioTest.php | 96 +++++++++++ .../Magento/Backend/Helper/DataTest.php | 12 +- .../Model/Config/Backend/EncryptedTest.php | 79 ++++++++-- .../Magento/Backend/Model/UrlTest.php | 6 +- .../testsuite/Magento/Backup/FactoryTest.php | 81 ++++++++++ .../testsuite/Magento/Backup/MediaTest.php | 23 ++- .../testsuite/Magento/Backup/NomediaTest.php | 3 +- .../testsuite/Magento/Backup/SnapshotTest.php | 5 +- .../Model/Config/Section/Reader/StoreTest.php | 5 +- .../Config/Section/Reader/WebsiteTest.php | 11 +- .../Magento/Core/Model/Db/UpdaterTest.php | 149 ++++++++++++++++++ .../Model/Resource/Setup/MigrationTest.php | 1 - .../testsuite/Magento/Core/Model/UrlTest.php | 2 +- .../Cron/Model/Config/Converter/XmlTest.php | 7 +- .../Model/Config/_files/crontab_valid.xml | 3 + .../Model/Url/NavigationModeTest.php | 2 +- .../Eav/Model/Entity/Attribute/ConfigTest.php | 147 +++++++++++++++++ .../Install/Model/Installer/ConfigTest.php | 2 +- .../Magento/Persistent/Helper/DataTest.php | 55 +++++++ .../Tools/I18n/Code/Parser/Adapter/JsTest.php | 16 +- .../Tools/Di/Code/Scanner/PhpScanner.php | 2 +- dev/tools/Magento/Tools/Di/compiler.php | 4 +- .../Tools/I18n/Zend/Console/Getopt.php | 8 +- .../I18n/Zend/Console/Getopt/Exception.php | 4 +- .../Magento/Tools/I18n/Zend/Exception.php | 4 +- lib/Magento/Backup/AbstractBackup.php | 2 +- lib/Magento/Backup/Db.php | 22 +-- .../Magento/Backup/Db/BackupDbInterface.php | 23 ++- lib/Magento/Backup/Db/BackupFactory.php | 81 ++++++++++ lib/Magento/Backup/Db/BackupInterface.php | 82 ++++++++++ .../{Backup.php => Backup/Factory.php} | 52 +++--- lib/Magento/Backup/Snapshot.php | 12 +- lib/Magento/DB/Tree.php | 2 +- pub/cron.php | 4 +- pub/get.php | 4 +- pub/index.php | 4 +- pub/lib/mage/validation/dob-rule.js | 15 +- 186 files changed, 1932 insertions(+), 822 deletions(-) rename CHANGELOG.markdown => CHANGELOG.md (96%) create mode 100644 app/code/Magento/Backup/etc/di.xml create mode 100644 app/code/Magento/Customer/Block/Account/Customer.php delete mode 100644 app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Parent.php delete mode 100644 app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Attribute/Backend/Parent.php delete mode 100644 app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Parent.php delete mode 100644 app/code/Magento/Sales/Model/Resource/Order/Shipment/Attribute/Backend/Parent.php delete mode 100644 app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Parent.php create mode 100644 dev/tests/integration/testsuite/Magento/Downloadable/Controller/Adminhtml/Downloadable/FileTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Downloadable/Controller/Adminhtml/_files/sample.txt create mode 100644 dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/UsaConfigFilesTest.php rename dev/tests/static/testsuite/Magento/Test/Legacy/_files/{mage_cleaned_modules.php => blacklist/obsolete_mage.php} (66%) create mode 100644 dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt create mode 100644 dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/whitelist/common.txt create mode 100644 dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/RadioTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Backup/FactoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/Db/UpdaterTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/ConfigTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Persistent/Helper/DataTest.php rename app/code/Magento/Customer/Model/Attribute/Data.php => lib/Magento/Backup/Db/BackupDbInterface.php (72%) create mode 100644 lib/Magento/Backup/Db/BackupFactory.php create mode 100644 lib/Magento/Backup/Db/BackupInterface.php rename lib/Magento/{Backup.php => Backup/Factory.php} (52%) diff --git a/CHANGELOG.markdown b/CHANGELOG.md similarity index 96% rename from CHANGELOG.markdown rename to CHANGELOG.md index a6a069b1ccb..1ac4b53c083 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.md @@ -1,3 +1,37 @@ +2.0.0.0-dev47 +============= +* Fixed bugs: + * Fixed compilation of DI definitions + * Fixed direct injection of auto-generated proxy classes + * Fixed usages of auto-generated factories on the library level + * Fixed fatal error after saving customer address with VAT number + * Fixed fatal error caused by USPS shipping method with debug + * Fixed url to Tax Class controller + * Fixed incorrect subtotal displayed on the Order page + * Fixed incorrect arguments for shipping xml elements factory + * Fixed theme editing in developer mode (PHP 5.4) + * Fixed absent conditions during New Shopping Cart Price Rule creation + * Fixed fatal error while try to edit created configurable product while Dev Mode enabled (PHP 5.4) + * Fixed frontend error when persistent shopping cart functionality is enabled + * Fixed Tax tab + * Fixed broken link "Orders and returns" on frontend + * Fixed placing order within OnePageCheckout using online payment methods + * Fixed error when product is being added to order from backend if Gift Messages are enabled + * Fixed error when product is being added to cart if MAP is enabled + * Fixed error when product attribute template is being edited + * Fixed error when setting configuration for Google API + * Fixed backend issue when Stores>Configuration>System>Advanced page was not displayed and did not allow to save changes + * Fixed not executable button "Continue shopping" on Multi-shipping process + * Fixed error on adding product to shopping cart from cross-sells block + * Fixed fatal error on Recurring Billing Profiles page + * Fixed error on setting configuration for Catalog + * Fixed error on placing order with Configurable product + * Fixed issue with downloadable product creation + * Fixed error on update configuration for payment methods + * Fixed blank page on shopping cart if FedEx shipping method is enabled + * Fixed fatal error when SID presents in URL + * Fixed absence of selection of a role assigned to an admin user + 2.0.0.0-dev46 ============= * Translation mechanism improvements: @@ -24,53 +58,53 @@ * Deprecated prototype.js based method removed from app/code/Magento/Weee/view/frontend/tax-toggle.js * Removed deprecated prototype.js based file: app/code/Magento/Checkout/view/frontend/opcheckout.js * Updated to use jQuery redirectUrl widget vs prototype based solution: - * app/code/Magento/Oauth/view/adminhtml/authorize/form/login.phtml - * app/code/Magento/Oauth/view/frontend/authorize/form/login.phtml - * app/code/Magento/Catalog/view/frontend/product/list.phtml + * app/code/Magento/Oauth/view/adminhtml/authorize/form/login.phtml + * app/code/Magento/Oauth/view/frontend/authorize/form/login.phtml + * app/code/Magento/Catalog/view/frontend/product/list.phtml * Removed file containing jQuery that did not meet the Magento 2 coding standard. Replaced with redirect-url widget * app/code/Magento/Catalog/view/frontend/js/mage-attributes-processing.js * Updated to meet Magento 2 coding standard: app/code/Magento/Checkout/view/frontend/cart/item/default.phtml * Added jQuery widgets: - * mage.deletableItem - Widget to tag DOM element as deletable, by default on click - * mage.fieldsetControls & mage.fieldsetResetControl - Widget to easily reset a subset of form fields with a reset ui control - * mage.itemTable - Widget to easily add a data template block dynamically on an event, by default click. - * mage.redirectUrl - Simple widget to allow for consistent javascript based redirects that meet the Magento 2 coding standard - * Added new validation rules for validation widget: 'required-if-not-specified', 'required-if-specified', and 'validate-item-quantity' + * mage.deletableItem - Widget to tag DOM element as deletable, by default on click + * mage.fieldsetControls & mage.fieldsetResetControl - Widget to easily reset a subset of form fields with a reset ui control + * mage.itemTable - Widget to easily add a data template block dynamically on an event, by default click. + * mage.redirectUrl - Simple widget to allow for consistent javascript based redirects that meet the Magento 2 coding standard + * Added new validation rules for validation widget: 'required-if-not-specified', 'required-if-specified', and 'validate-item-quantity' * Various improvements: * Changed VendorName from Mage to Magento * Implemented PSR-0 and PSR-1 Coding Standards - * All Magento source code has been converted. - * Tests have been written to enforce PSR-0 and PSR-1 coding standards. + * All Magento source code has been converted. + * Tests have been written to enforce PSR-0 and PSR-1 coding standards. * Removed empty module setup models. Core resource setup model is used as a default setup model now. Custom setup model must be injected via DI configuration * Removed some events (plugins must be used instead): - * adminhtml_widget_container_html_before - * admin_session_user_logout - * model_config_data_save_before - * admin_system_config_section_save_after - * backend_menu_load_after - * catalog_controller_category_init_before - * catalog_helper_output_construct - * catalog_controller_product_init - * catalog_category_tree_move_before - * catalog_category_tree_move_after - * catalog_product_website_update_before - * catalog_product_website_update - * catalog_product_media_save_before - * catalog_product_media_add_image - * catalog_product_type_grouped_price - * catalog_product_collection_load_before - * catalogsearch_index_process_start - * catalogsearch_index_process_complete - * cms_page_get_available_statuses - * cms_wysiwyg_config_prepare - * application_clean_cache - * theme_copy_after - * customer_registration_is_allowed - * log_log_clean_before - * log_log_clean_after - * sales_convert_quote_payment_to_order_payment - * sales_convert_quote_item_to_order_item - * sales_quote_config_get_product_attributes + * adminhtml_widget_container_html_before + * admin_session_user_logout + * model_config_data_save_before + * admin_system_config_section_save_after + * backend_menu_load_after + * catalog_controller_category_init_before + * catalog_helper_output_construct + * catalog_controller_product_init + * catalog_category_tree_move_before + * catalog_category_tree_move_after + * catalog_product_website_update_before + * catalog_product_website_update + * catalog_product_media_save_before + * catalog_product_media_add_image + * catalog_product_type_grouped_price + * catalog_product_collection_load_before + * catalogsearch_index_process_start + * catalogsearch_index_process_complete + * cms_page_get_available_statuses + * cms_wysiwyg_config_prepare + * application_clean_cache + * theme_copy_after + * customer_registration_is_allowed + * log_log_clean_before + * log_log_clean_after + * sales_convert_quote_payment_to_order_payment + * sales_convert_quote_item_to_order_item + * sales_quote_config_get_product_attributes * Removed the Poll module including references and dependencies to/on it. * Redesign and reimplementation of web services framework * Removed the Api module and all existing SOAP V1, SOAP V2, and XML-RPC web services code diff --git a/app/code/Magento/AdminNotification/etc/module.xml b/app/code/Magento/AdminNotification/etc/module.xml index 8d82da5135e..8181e408161 100755 --- a/app/code/Magento/AdminNotification/etc/module.xml +++ b/app/code/Magento/AdminNotification/etc/module.xml @@ -33,6 +33,7 @@ <module name="Magento_Core"/> <module name="Magento_Adminhtml"/> <module name="Magento_Backend"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php b/app/code/Magento/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php index 0fe333da43f..d3dd2838452 100644 --- a/app/code/Magento/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php +++ b/app/code/Magento/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php @@ -57,7 +57,7 @@ class Main extends \Magento\Backend\Block\Template protected $_collectionFactory; /** - * @var \Magento\Eav\Model\Entity\Type + * @var \Magento\Eav\Model\Entity\TypeFactory */ protected $_typeFactory; @@ -72,7 +72,7 @@ class Main extends \Magento\Backend\Block\Template protected $_attributeFactory; /** - * @param \Magento\Eav\Model\Entity\Type $typeFactory + * @param \Magento\Eav\Model\Entity\TypeFactory $typeFactory * @param \Magento\Eav\Model\Entity\Attribute\GroupFactory $groupFactory * @param \Magento\Catalog\Model\Resource\Product\Type\Configurable\AttributeFactory $attributeFactory * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory @@ -83,7 +83,7 @@ class Main extends \Magento\Backend\Block\Template * @param array $data */ public function __construct( - \Magento\Eav\Model\Entity\Type $typeFactory, + \Magento\Eav\Model\Entity\TypeFactory $typeFactory, \Magento\Eav\Model\Entity\Attribute\GroupFactory $groupFactory, \Magento\Catalog\Model\Resource\Product\Type\Configurable\AttributeFactory $attributeFactory, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory, diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php b/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php index e6aaf44c1bc..c5a65cf9cb2 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php +++ b/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php @@ -183,7 +183,7 @@ class Actions )); $renderer = $this->_rendererFieldset - ->setTemplate('promo/fieldset.phtml') + ->setTemplate('Magento_Adminhtml::promo/fieldset.phtml') ->setNewChildUrl($this->getUrl('*/promo_quote/newActionHtml/form/rule_actions_fieldset')); $fieldset = $form->addFieldset('actions_fieldset', array( diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php b/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php index ddb31497dbe..c169b45f54d 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php +++ b/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php @@ -114,7 +114,7 @@ class Conditions $form->setHtmlIdPrefix('rule_'); $renderer = $this->_rendererFieldset - ->setTemplate('promo/fieldset.phtml') + ->setTemplate('Magento_Adminhtml::promo/fieldset.phtml') ->setNewChildUrl($this->getUrl('*/promo_quote/newConditionHtml/form/rule_conditions_fieldset')); $fieldset = $form->addFieldset('conditions_fieldset', array( diff --git a/app/code/Magento/Adminhtml/Block/Tax/Rule/Edit/Form.php b/app/code/Magento/Adminhtml/Block/Tax/Rule/Edit/Form.php index 3188d10bb60..5e23ffab589 100644 --- a/app/code/Magento/Adminhtml/Block/Tax/Rule/Edit/Form.php +++ b/app/code/Magento/Adminhtml/Block/Tax/Rule/Edit/Form.php @@ -217,9 +217,9 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic public function getTaxClassSelectConfig($classType) { $config = array( - 'new_url' => $this->getUrl('adminhtml/tax_class/ajaxSave/'), - 'save_url' => $this->getUrl('adminhtml/tax_class/ajaxSave/'), - 'delete_url' => $this->getUrl('adminhtml/tax_class/ajaxDelete/'), + 'new_url' => $this->getUrl('adminhtml/tax_tax/ajaxSave/'), + 'save_url' => $this->getUrl('adminhtml/tax_tax/ajaxSave/'), + 'delete_url' => $this->getUrl('adminhtml/tax_tax/ajaxDelete/'), 'delete_confirm_message' => __('Do you really want to delete this tax class?'), 'target_select_id' => $this->getTaxClassSelectHtmlId($classType), 'add_button_caption' => __('Add New Tax Class'), diff --git a/app/code/Magento/Adminhtml/Controller/System/Backup.php b/app/code/Magento/Adminhtml/Controller/System/Backup.php index 369f527d5d5..4a9e2a02465 100644 --- a/app/code/Magento/Adminhtml/Controller/System/Backup.php +++ b/app/code/Magento/Adminhtml/Controller/System/Backup.php @@ -42,15 +42,23 @@ class Backup extends \Magento\Adminhtml\Controller\Action */ protected $_coreRegistry = null; + /** + * @var \Magento\Backup\Factory + */ + protected $_backupFactory; + /** * @param \Magento\Backend\Controller\Context $context * @param \Magento\Core\Model\Registry $coreRegistry + * @param \Magento\Backup\Factory $backupFactory */ public function __construct( \Magento\Backend\Controller\Context $context, - \Magento\Core\Model\Registry $coreRegistry + \Magento\Core\Model\Registry $coreRegistry, + \Magento\Backup\Factory $backupFactory ) { $this->_coreRegistry = $coreRegistry; + $this->_backupFactory = $backupFactory; parent::__construct($context); } @@ -111,7 +119,7 @@ class Backup extends \Magento\Adminhtml\Controller\Action $type = \Magento\Backup\Helper\Data::TYPE_SNAPSHOT_WITHOUT_MEDIA; } - $backupManager = \Magento\Backup::getBackupInstance($type) + $backupManager = $this->_backupFactory->create($type) ->setBackupExtension($helper->getExtensionByType($type)) ->setTime(time()) ->setBackupsDir($helper->getBackupsDir()); @@ -231,7 +239,7 @@ class Backup extends \Magento\Adminhtml\Controller\Action $type = $backup->getType(); - $backupManager = \Magento\Backup::getBackupInstance($type) + $backupManager = $this->_backupFactory->create($type) ->setBackupExtension($helper->getExtensionByType($type)) ->setTime($backup->getTime()) ->setBackupsDir($helper->getBackupsDir()) diff --git a/app/code/Magento/Adminhtml/Helper/Catalog/Product/Edit/Action/Attribute.php b/app/code/Magento/Adminhtml/Helper/Catalog/Product/Edit/Action/Attribute.php index d6a5c6306f5..a3a4cb0b83a 100644 --- a/app/code/Magento/Adminhtml/Helper/Catalog/Product/Edit/Action/Attribute.php +++ b/app/code/Magento/Adminhtml/Helper/Catalog/Product/Edit/Action/Attribute.php @@ -76,9 +76,9 @@ class Attribute extends \Magento\Backend\Helper\Data * @param \Magento\Core\Model\ConfigInterface $applicationConfig * @param \Magento\Core\Model\Config\Primary $primaryConfig * @param \Magento\Core\Model\RouterList $routerList - * @param \Magento\Core\Model\AppProxy $app - * @param \Magento\Backend\Model\UrlProxy $backendUrl - * @param \Magento\Backend\Model\AuthProxy $auth + * @param \Magento\Core\Model\App $app + * @param \Magento\Backend\Model\Url $backendUrl + * @param \Magento\Backend\Model\Auth $auth * @param string $defaultAreaFrontName * @param string $backendFrontName */ @@ -91,9 +91,9 @@ class Attribute extends \Magento\Backend\Helper\Data \Magento\Core\Model\ConfigInterface $applicationConfig, \Magento\Core\Model\Config\Primary $primaryConfig, \Magento\Core\Model\RouterList $routerList, - \Magento\Core\Model\AppProxy $app, - \Magento\Backend\Model\UrlProxy $backendUrl, - \Magento\Backend\Model\AuthProxy $auth, + \Magento\Core\Model\App $app, + \Magento\Backend\Model\Url $backendUrl, + \Magento\Backend\Model\Auth $auth, $defaultAreaFrontName, $backendFrontName ) { diff --git a/app/code/Magento/Adminhtml/Model/Giftmessage/Save.php b/app/code/Magento/Adminhtml/Model/Giftmessage/Save.php index 9c66bee94d1..22a9bfe8aa9 100644 --- a/app/code/Magento/Adminhtml/Model/Giftmessage/Save.php +++ b/app/code/Magento/Adminhtml/Model/Giftmessage/Save.php @@ -141,9 +141,6 @@ class Save extends \Magento\Object break; default: - /** - * @todo fix required parameter for `load` method - */ $entityModel = $giftmessageModel->getEntityModelByType($entityType) ->load($entityId); break; @@ -202,7 +199,7 @@ class Save extends \Magento\Object */ public function setAllowQuoteItems($items) { - $this->_getSession()->setAllowQuoteItemsGiftMessage($items); + $this->_session->setAllowQuoteItemsGiftMessage($items); return $this; } @@ -230,11 +227,11 @@ class Save extends \Magento\Object */ public function getAllowQuoteItems() { - if (!is_array($this->_getSession()->getAllowQuoteItemsGiftMessage())) { + if (!is_array($this->_session->getAllowQuoteItemsGiftMessage())) { $this->setAllowQuoteItems(array()); } - return $this->_getSession()->getAllowQuoteItemsGiftMessage(); + return $this->_session->getAllowQuoteItemsGiftMessage(); } /** @@ -297,7 +294,7 @@ class Save extends \Magento\Object $deleteAllowedItems = array(); foreach ($products as $productId=>$data) { $product = $this->_productFactory->create() - ->setStore($this->_getSession()->getStore()) + ->setStore($this->_session->getStore()) ->load($productId); $item = $this->_getQuote()->getItemByProduct($product); diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_backup_block.xml b/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_backup_block.xml index 78f2e2ad023..09bb5eb8c15 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_backup_block.xml +++ b/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_backup_block.xml @@ -106,9 +106,7 @@ <argument name="actions" xsi:type="array"> <item name="rollback_action" xsi:type="array"> <item name="caption" xsi:type="string" translate="true">Rollback</item> - <item name="url" xsi:type="array"> - <item name="base" xsi:type="string">#</item> - </item> + <item name="href" xsi:type="string">#</item> <item name="onclick" xsi:type="string">return backup.rollback('$type', '$time')</item> </item> </argument> diff --git a/app/code/Magento/Authorizenet/etc/module.xml b/app/code/Magento/Authorizenet/etc/module.xml index 1b4c255aceb..2258e1dbfd3 100755 --- a/app/code/Magento/Authorizenet/etc/module.xml +++ b/app/code/Magento/Authorizenet/etc/module.xml @@ -38,6 +38,7 @@ <module name="Magento_Backend"/> <module name="Magento_Core"/> <module name="Magento_Payment"/> + <module name="Magento_Page"/> <module name="Magento_Centinel"/> </depends> </module> diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Radio.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Radio.php index 14ec531fddb..f75ecedd424 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Radio.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Radio.php @@ -63,7 +63,7 @@ class Radio * * @return array */ - protected function _getSimpleValue() + protected function _getValues() { $values = $this->getColumn()->getValues(); return $this->_converter->toFlatArray($values); @@ -89,7 +89,7 @@ class Radio */ public function render(\Magento\Object $row) { - $values = $this->_getSimpleValue(); + $values = $this->_getValues(); $value = $row->getData($this->getColumn()->getIndex()); if (is_array($values)) { $checked = in_array($value, $values) ? ' checked="checked"' : ''; diff --git a/app/code/Magento/Backend/Helper/Data.php b/app/code/Magento/Backend/Helper/Data.php index 345f4ec5840..49c592ab83a 100644 --- a/app/code/Magento/Backend/Helper/Data.php +++ b/app/code/Magento/Backend/Helper/Data.php @@ -75,17 +75,17 @@ class Data extends \Magento\Core\Helper\AbstractHelper protected $_coreData = null; /** - * @var \Magento\Core\Model\AppProxy + * @var \Magento\Core\Model\App */ protected $_app; /** - * @var \Magento\Backend\Model\UrlProxy + * @var \Magento\Backend\Model\Url */ protected $_backendUrl; /** - * @var \Magento\Backend\Model\AuthProxy + * @var \Magento\Backend\Model\Auth */ protected $_auth; @@ -102,9 +102,9 @@ class Data extends \Magento\Core\Helper\AbstractHelper * @param \Magento\Core\Model\ConfigInterface $applicationConfig * @param \Magento\Core\Model\Config\Primary $primaryConfig * @param \Magento\Core\Model\RouterList $routerList - * @param \Magento\Core\Model\AppProxy $app - * @param \Magento\Backend\Model\UrlProxy $backendUrl - * @param \Magento\Backend\Model\AuthProxy $auth + * @param \Magento\Core\Model\App $app + * @param \Magento\Backend\Model\Url $backendUrl + * @param \Magento\Backend\Model\Auth $auth * @param string $defaultAreaFrontName * @param string $backendFrontName * @@ -116,9 +116,9 @@ class Data extends \Magento\Core\Helper\AbstractHelper \Magento\Core\Model\ConfigInterface $applicationConfig, \Magento\Core\Model\Config\Primary $primaryConfig, \Magento\Core\Model\RouterList $routerList, - \Magento\Core\Model\AppProxy $app, - \Magento\Backend\Model\UrlProxy $backendUrl, - \Magento\Backend\Model\AuthProxy $auth, + \Magento\Core\Model\App $app, + \Magento\Backend\Model\Url $backendUrl, + \Magento\Backend\Model\Auth $auth, $defaultAreaFrontName, $backendFrontName ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php index 7aa0643b323..0b3ff65473d 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php @@ -102,16 +102,6 @@ class Encrypted } } - /** - * Get & decrypt old value from configuration - * - * @return string - */ - public function getOldValue() - { - return $this->_coreData->decrypt(parent::getOldValue()); - } - /** * Process config value * diff --git a/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php b/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php index e1eb8bfd9e6..811b888c7c2 100644 --- a/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php +++ b/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php @@ -32,18 +32,18 @@ namespace Magento\Backend\Model\Config\Source\Storage\Media; class Database implements \Magento\Core\Model\Option\ArrayInterface { /** - * @var \Magento\Core\Model\ConfigInterface + * @var \Magento\Core\Model\Config\Local */ protected $_config; /** - * @param \Magento\Core\Model\ConfigInterface $config + * @param \Magento\Core\Model\Config\Local */ - public function __construct(\Magento\Core\Model\ConfigInterface $config) + public function __construct(\Magento\Core\Model\Config\Local $config) { $this->_config = $config; } - + /** * Options getter * diff --git a/app/code/Magento/Backend/Model/Url.php b/app/code/Magento/Backend/Model/Url.php index f4a38f7b98c..418429b123f 100644 --- a/app/code/Magento/Backend/Model/Url.php +++ b/app/code/Magento/Backend/Model/Url.php @@ -92,7 +92,7 @@ class Url extends \Magento\Core\Model\Url * @param \Magento\Core\Model\Url\SecurityInfoInterface $securityInfo * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Backend\Helper\Data $backendHelper - * @param \Magento\Core\Model\Session $coreSession + * @param \Magento\Core\Model\SessionProxy $coreSession * @param \Magento\Backend\Model\Menu\Config $menuConfig * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\App $app @@ -107,7 +107,7 @@ class Url extends \Magento\Core\Model\Url \Magento\Core\Model\Url\SecurityInfoInterface $securityInfo, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Backend\Helper\Data $backendHelper, - \Magento\Core\Model\Session $coreSession, + \Magento\Core\Model\SessionProxy $coreSession, \Magento\Backend\Model\Menu\Config $menuConfig, \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\App $app, diff --git a/app/code/Magento/Backend/Model/Widget/Grid/Row/UrlGenerator.php b/app/code/Magento/Backend/Model/Widget/Grid/Row/UrlGenerator.php index 237bf8cb0f7..bfdd5717455 100644 --- a/app/code/Magento/Backend/Model/Widget/Grid/Row/UrlGenerator.php +++ b/app/code/Magento/Backend/Model/Widget/Grid/Row/UrlGenerator.php @@ -29,8 +29,7 @@ */ namespace Magento\Backend\Model\Widget\Grid\Row; -class UrlGenerator - implements \Magento\Backend\Model\Widget\Grid\Row\GeneratorInterface +class UrlGenerator implements \Magento\Backend\Model\Widget\Grid\Row\GeneratorInterface { /** * @var \Magento\Backend\Model\Url @@ -53,11 +52,11 @@ class UrlGenerator protected $_extraParamsTemplate = array(); /** - * @param \Magento\Backend\Model\UrlProxy $backendUrl + * @param \Magento\Backend\Model\Url $backendUrl * @param array $args * @throws \InvalidArgumentException */ - public function __construct(\Magento\Backend\Model\UrlProxy $backendUrl, array $args = array()) + public function __construct(\Magento\Backend\Model\Url $backendUrl, array $args = array()) { if (!isset($args['path'])) { throw new \InvalidArgumentException('Not all required parameters passed'); diff --git a/app/code/Magento/Backend/etc/di.xml b/app/code/Magento/Backend/etc/di.xml index b205bd558e6..8dce71cd371 100644 --- a/app/code/Magento/Backend/etc/di.xml +++ b/app/code/Magento/Backend/etc/di.xml @@ -66,7 +66,6 @@ </value> </param> </type> - <type name="Magento\Backend\Helper\Data"> <param name="defaultAreaFrontName"> <value>backend</value> @@ -74,6 +73,15 @@ <param name="backendFrontName"> <value type="argument">Magento\Backend\Helper\Data::PARAM_BACKEND_FRONT_NAME</value> </param> + <param name="app"> + <instance type="Magento\Core\Model\App\Proxy" /> + </param> + <param name="backendUrl"> + <instance type="Magento\Backend\Model\Url\Proxy" /> + </param> + <param name="auth"> + <instance type="Magento\Backend\Model\Auth\Proxy" /> + </param> </type> <type name="Magento\Core\Model\NoRouteHandlerList"> <param name="handlerClassesList"> @@ -85,4 +93,9 @@ </value> </param> </type> + <type name="Magento\Backend\Model\Widget\Grid\Row\UrlGenerator"> + <param name="backendUrl"> + <instance type="Magento\Backend\Model\Url\Proxy" /> + </param> + </type> </config> diff --git a/app/code/Magento/Backend/etc/module.xml b/app/code/Magento/Backend/etc/module.xml index 844e040ac75..aef7d360109 100755 --- a/app/code/Magento/Backend/etc/module.xml +++ b/app/code/Magento/Backend/etc/module.xml @@ -36,7 +36,7 @@ <module name="Magento_AdminNotification"/> <module name="Magento_Cron"/> <module name="Magento_Sendfriend"/> - <module name="Magento_Page" type="soft"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Backup/Model/Backup.php b/app/code/Magento/Backup/Model/Backup.php index e88e26f1b34..cb54b420254 100644 --- a/app/code/Magento/Backup/Model/Backup.php +++ b/app/code/Magento/Backup/Model/Backup.php @@ -34,7 +34,7 @@ */ namespace Magento\Backup\Model; -class Backup extends \Magento\Object +class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterface { /* internal constants */ const COMPRESS_RATE = 9; @@ -111,6 +111,43 @@ class Backup extends \Magento\Object $this->_backendAuthSession = $authSession; } + /** + * Set backup time + * + * @param int $time + * @return \Magento\Backup\Db\BackupInterface + */ + public function setTime($time) + { + $this->setData('time', $time); + return $this; + } + + /** + * Set backup path + * + * @param string $path + * @return \Magento\Backup\Db\BackupInterface + */ + public function setPath($path) + { + $this->setData('path', $path); + return $this; + } + + /** + * Set backup name + * + * @param string $name + * @return \Magento\Backup\Db\BackupInterface + */ + public function setName($name) + { + $this->setData('name', $name); + return $this; + } + + /** * Load backup file info * diff --git a/app/code/Magento/Backup/Model/Db.php b/app/code/Magento/Backup/Model/Db.php index 459fe40340d..1c5a9ac85f7 100644 --- a/app/code/Magento/Backup/Model/Db.php +++ b/app/code/Magento/Backup/Model/Db.php @@ -34,7 +34,7 @@ */ namespace Magento\Backup\Model; -class Db +class Db implements \Magento\Backup\Db\BackupDbInterface { /** @@ -130,10 +130,10 @@ class Db /** * Create backup and stream write to adapter * - * @param \Magento\Backup\Model\Backup $backup + * @param \Magento\Backup\Db\BackupInterface $backup * @return \Magento\Backup\Model\Db */ - public function createBackup(\Magento\Backup\Model\Backup $backup) + public function createBackup(\Magento\Backup\Db\BackupInterface $backup) { $backup->open(true); diff --git a/app/code/Magento/Backup/Model/Observer.php b/app/code/Magento/Backup/Model/Observer.php index 8d8f3105618..cb865b6d935 100644 --- a/app/code/Magento/Backup/Model/Observer.php +++ b/app/code/Magento/Backup/Model/Observer.php @@ -80,26 +80,32 @@ class Observer protected $_dir; /** - * Construct - * + * @var \Magento\Backup\Factory + */ + protected $_backupFactory; + + /** * @param \Magento\Backup\Helper\Data $backupData * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Core\Model\Logger $logger * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Dir $dir + * @param \Magento\Backup\Factory $backupFactory */ public function __construct( \Magento\Backup\Helper\Data $backupData, \Magento\Core\Model\Registry $coreRegistry, \Magento\Core\Model\Logger $logger, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Dir $dir + \Magento\Core\Model\Dir $dir, + \Magento\Backup\Factory $backupFactory ) { $this->_backupData = $backupData; $this->_coreRegistry = $coreRegistry; $this->_logger = $logger; $this->_coreStoreConfig = $coreStoreConfig; $this->_dir = $dir; + $this->_backupFactory = $backupFactory; } /** @@ -121,7 +127,7 @@ class Observer $this->_errors = array(); try { - $backupManager = \Magento\Backup::getBackupInstance($type) + $backupManager = $this->_backupFactory->create($type) ->setBackupExtension($this->_backupData->getExtensionByType($type)) ->setTime(time()) ->setBackupsDir($this->_backupData->getBackupsDir()); diff --git a/app/code/Magento/Backup/Model/Resource/Db.php b/app/code/Magento/Backup/Model/Resource/Db.php index 28a3c35089e..86129fda318 100644 --- a/app/code/Magento/Backup/Model/Resource/Db.php +++ b/app/code/Magento/Backup/Model/Resource/Db.php @@ -47,7 +47,7 @@ class Db /** * Backup resource helper * - * @var \Magento\Backup\Model\Resource\HelperFactory + * @var \Magento\Backup\Model\Resource\Helper */ protected $_resourceHelper; @@ -257,7 +257,7 @@ class Db */ public function beginTransaction() { - $this->_resourceHelper->turnOnSerializableMode(); + $this->_resourceHelper->prepareTransactionIsolationLevel(); $this->_write->beginTransaction(); return $this; } @@ -270,7 +270,7 @@ class Db public function commitTransaction() { $this->_write->commit(); - $this->_resourceHelper->turnOnReadCommittedMode(); + $this->_resourceHelper->restoreTransactionIsolationLevel(); return $this; } @@ -282,6 +282,7 @@ class Db public function rollBackTransaction() { $this->_write->rollBack(); + $this->_resourceHelper->restoreTransactionIsolationLevel(); return $this; } diff --git a/app/code/Magento/Backup/Model/Resource/Helper.php b/app/code/Magento/Backup/Model/Resource/Helper.php index 82d4a6f4f50..edf243edd90 100644 --- a/app/code/Magento/Backup/Model/Resource/Helper.php +++ b/app/code/Magento/Backup/Model/Resource/Helper.php @@ -330,18 +330,18 @@ class Helper extends \Magento\Core\Model\Resource\Helper } /** - * Turn on serializable mode + * Prepare transaction isolation level for backup process */ - public function turnOnSerializableMode() + public function prepareTransactionIsolationLevel() { - $this->_getReadAdapter()->query("SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE"); + $this->_getWriteAdapter()->query('SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE'); } /** - * Turn on read committed mode + * Restore transaction isolation level after backup */ - public function turnOnReadCommittedMode() + public function restoreTransactionIsolationLevel() { - $this->_getReadAdapter()->query("SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED"); + $this->_getWriteAdapter()->query('SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ'); } } diff --git a/app/code/Magento/Backup/etc/di.xml b/app/code/Magento/Backup/etc/di.xml new file mode 100644 index 00000000000..559ece9be75 --- /dev/null +++ b/app/code/Magento/Backup/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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <type name="Magento\Backup\Db\BackupFactory"> + <param name="backupInstanceName"> + <value>\Magento\Backup\Model\Backup</value> + </param> + <param name="backupDbInstanceName"> + <value>\Magento\Backup\Model\Db</value> + </param> + </type> +</config> \ No newline at end of file diff --git a/app/code/Magento/Bundle/etc/module.xml b/app/code/Magento/Bundle/etc/module.xml index dce9ef270fe..47d84bbd3e2 100755 --- a/app/code/Magento/Bundle/etc/module.xml +++ b/app/code/Magento/Bundle/etc/module.xml @@ -42,6 +42,7 @@ <module name="Magento_Eav"/> <module name="Magento_Weee"/> <module name="Magento_GiftMessage"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Captcha/etc/module.xml b/app/code/Magento/Captcha/etc/module.xml index add1716478c..1e83a3261de 100755 --- a/app/code/Magento/Captcha/etc/module.xml +++ b/app/code/Magento/Captcha/etc/module.xml @@ -36,6 +36,7 @@ <module name="Magento_Adminhtml"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Captcha/view/frontend/onepage.js b/app/code/Magento/Captcha/view/frontend/onepage.js index 885de30031c..a771c1e248d 100644 --- a/app/code/Magento/Captcha/view/frontend/onepage.js +++ b/app/code/Magento/Captcha/view/frontend/onepage.js @@ -27,8 +27,9 @@ "use strict"; $(document).on("login",function() { $("[data-captcha='guest_checkout'], [data-captcha='register_during_checkout']").hide(); + $("[role='guest_checkout'], [role='register_during_checkout']").hide(); var type = ($("#login\\:guest").is(':checked')) ? 'guest_checkout' : 'register_during_checkout'; - $("[role='" + type + "']").show(); + $("[role='" + type + "'], [data-captcha='" + type + "']").show(); }).on('billingSave', function() { $(".captcha-reload:visible").trigger("click"); }); diff --git a/app/code/Magento/Catalog/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSet.php b/app/code/Magento/Catalog/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSet.php index 5d7dc2b8655..c2dbc46494e 100644 --- a/app/code/Magento/Catalog/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSet.php +++ b/app/code/Magento/Catalog/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSet.php @@ -131,7 +131,7 @@ class ColumnSet $result = array(); foreach ($sourceModel->getAllOptions() as $option) { if ($option['value'] != '') { - $result[$option['value']] = $option['label']; + $result[] = $option; } } return $result; diff --git a/app/code/Magento/Catalog/Helper/Data.php b/app/code/Magento/Catalog/Helper/Data.php index 349369950b2..ecadc54f73e 100644 --- a/app/code/Magento/Catalog/Helper/Data.php +++ b/app/code/Magento/Catalog/Helper/Data.php @@ -485,8 +485,8 @@ class Data extends \Magento\Core\Helper\AbstractHelper if (is_numeric($product)) { /** @var \Magento\Catalog\Model\Product $product */ - $product = $this->_productFactory->create(); - $product->setStoreId($this->_storeManager->getStore()->getId()) + $product = $this->_productFactory->create() + ->setStoreId($this->_storeManager->getStore()->getId()) ->load($product); } diff --git a/app/code/Magento/Catalog/view/frontend/js/price-option.js b/app/code/Magento/Catalog/view/frontend/js/price-option.js index 96d1045061f..2fb28b82177 100644 --- a/app/code/Magento/Catalog/view/frontend/js/price-option.js +++ b/app/code/Magento/Catalog/view/frontend/js/price-option.js @@ -31,7 +31,8 @@ productCustomSelector: '.product-custom-option', mapPopupPrice: '#map-popup-price', prices: {}, - priceTemplate: '<span class="price">${formattedPrice}</span>' + priceTemplate: '<span class="price">${formattedPrice}</span>', + controlContainer: 'dd' }, _create: function() { @@ -167,7 +168,9 @@ configOptions.includeTax, configOptions.oldPrice); } } else if (element.is(":file")) { - if (element.val() || element.parent('div').siblings().length > 0) { + var controlContainer = element.closest(this.options.controlContainer); + + if (element.val() || controlContainer.find('[id*="change-"]').length > 0) { optionPrice.update(configOptions.price, configOptions.excludeTax, configOptions.includeTax, configOptions.oldPrice); } diff --git a/app/code/Magento/CatalogInventory/etc/product_types.xml b/app/code/Magento/CatalogInventory/etc/product_types.xml index eec6f1811f7..b49825cf0bf 100644 --- a/app/code/Magento/CatalogInventory/etc/product_types.xml +++ b/app/code/Magento/CatalogInventory/etc/product_types.xml @@ -26,10 +26,10 @@ <config> <type name="simple" isQty="true" /> <type name="virtual" isQty="true" /> - <type name="configurable" isQty="true"> + <type name="configurable"> <stockIndexerModel instance="Magento\CatalogInventory\Model\Resource\Indexer\Stock\Configurable" /> </type> - <type name="grouped" isQty="true"> + <type name="grouped"> <stockIndexerModel instance="Magento\CatalogInventory\Model\Resource\Indexer\Stock\Grouped" /> </type> </config> diff --git a/app/code/Magento/CatalogSearch/Controller/Advanced.php b/app/code/Magento/CatalogSearch/Controller/Advanced.php index 1c903503e97..2885540a810 100644 --- a/app/code/Magento/CatalogSearch/Controller/Advanced.php +++ b/app/code/Magento/CatalogSearch/Controller/Advanced.php @@ -53,7 +53,7 @@ class Advanced extends \Magento\Core\Controller\Front\Action /** * Catalog search session * - * @var \Magento\CatalogSearch\Model\Session + * @var \Magento\Core\Model\Session\Generic */ protected $_catalogSearchSession; @@ -61,13 +61,13 @@ class Advanced extends \Magento\Core\Controller\Front\Action * Construct * * @param \Magento\Core\Controller\Varien\Action\Context $context - * @param \Magento\CatalogSearch\Model\Session $catalogSearchSession + * @param \Magento\Core\Model\Session\Generic $catalogSearchSession * @param \Magento\CatalogSearch\Model\Advanced $catalogSearchAdvanced * @param \Magento\Core\Model\UrlFactory $urlFactory */ public function __construct( \Magento\Core\Controller\Varien\Action\Context $context, - \Magento\CatalogSearch\Model\Session $catalogSearchSession, + \Magento\Core\Model\Session\Generic $catalogSearchSession, \Magento\CatalogSearch\Model\Advanced $catalogSearchAdvanced, \Magento\Core\Model\UrlFactory $urlFactory ) { 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 5e4b85f94cd..c029880c65d 100644 --- a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php +++ b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php @@ -56,13 +56,13 @@ class Type extends \Magento\Core\Model\Config\Value * @param array $data */ public function __construct( + \Magento\CatalogSearch\Model\Fulltext $catalogSearchFulltext, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Config $config, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, - \Magento\CatalogSearch\Model\Fulltext $catalogSearchFulltext, array $data = array() ) { $this->_catalogSearchFulltext = $catalogSearchFulltext; diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php index 2b3ca31854a..715a44feda9 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php @@ -71,13 +71,6 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected $_productEmulators = array(); - /** - * Store search engine instance - * - * @var \Magento\CatalogSearch\Model\Resource\EngineInterface - */ - protected $_engine; - /** * @var \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory */ @@ -146,6 +139,11 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected $_resourceHelper; + /** + * @var \Magento\CatalogSearch\Model\Resource\EngineProvider + */ + protected $_engineProvider; + /** * Construct * @@ -180,13 +178,13 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb $this->_eavConfig = $eavConfig; $this->_catalogProductStatus = $catalogProductStatus; $this->_productAttributeCollFactory = $productAttributeCollFactory; - $this->_engine = $engineProvider->get(); $this->_eventManager = $eventManager; $this->_coreString = $coreString; $this->_catalogSearchData = $catalogSearchData; $this->_coreStoreConfig = $coreStoreConfig; $this->_storeManager = $storeManager; $this->_resourceHelper = $resourceHelper; + $this->_engineProvider = $engineProvider; parent::__construct($resource); } @@ -258,7 +256,7 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb $visibility = $this->_getSearchableAttribute('visibility'); $status = $this->_getSearchableAttribute('status'); $statusVals = $this->_catalogProductStatus->getVisibleStatusIds(); - $allowedVisibility = $this->_engine->getAllowedVisibility(); + $allowedVisibility = $this->_engineProvider->get()->getAllowedVisibility(); $lastProductId = 0; while (true) { @@ -442,8 +440,8 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb */ public function cleanIndex($storeId = null, $productId = null) { - if ($this->_engine) { - $this->_engine->cleanIndex($storeId, $productId); + if ($this->_engineProvider->get()) { + $this->_engineProvider->get()->cleanIndex($storeId, $productId); } return $this; @@ -545,7 +543,7 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb $productAttributes = $this->_productAttributeCollFactory->create(); - if ($this->_engine && $this->_engine->allowAdvancedIndex()) { + if ($this->_engineProvider->get() && $this->_engineProvider->get()->allowAdvancedIndex()) { $productAttributes->addToIndexFilter(true); } else { $productAttributes->addSearchableAttributeFilter(); @@ -553,7 +551,7 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb $attributes = $productAttributes->getItems(); $this->_eventManager->dispatch('catelogsearch_searchable_attributes_load_after', array( - 'engine' => $this->_engine, + 'engine' => $this->_engineProvider->get(), 'attributes' => $attributes )); @@ -778,7 +776,7 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb } } - if (!$this->_engine->allowAdvancedIndex()) { + if (!$this->_engineProvider->get()->allowAdvancedIndex()) { $product = $this->_getProductEmulator($productData['type_id']) ->setId($productData['entity_id']) ->setStoreId($storeId); @@ -793,8 +791,8 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb $index['in_stock'] = $productData['in_stock']; } - if ($this->_engine) { - return $this->_engine->prepareEntityIndex($index, $this->_separator); + if ($this->_engineProvider->get()) { + return $this->_engineProvider->get()->prepareEntityIndex($index, $this->_separator); } return $this->_catalogSearchData->prepareIndexdata($index, $this->_separator); @@ -812,7 +810,7 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb { $attribute = $this->_getSearchableAttribute($attributeId); if (!$attribute->getIsSearchable()) { - if ($this->_engine->allowAdvancedIndex()) { + if ($this->_engineProvider->get()->allowAdvancedIndex()) { if ($attribute->getAttributeCode() == 'visibility') { return $value; } elseif (!($attribute->getIsVisibleInAdvancedSearch() @@ -828,7 +826,7 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb } if ($attribute->usesSource()) { - if ($this->_engine->allowAdvancedIndex()) { + if ($this->_engineProvider->get()->allowAdvancedIndex()) { return $value; } @@ -867,8 +865,8 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected function _saveProductIndex($productId, $storeId, $index) { - if ($this->_engine) { - $this->_engine->saveEntityIndex($productId, $storeId, $index); + if ($this->_engineProvider->get()) { + $this->_engineProvider->get()->saveEntityIndex($productId, $storeId, $index); } return $this; @@ -883,8 +881,8 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected function _saveProductIndexes($storeId, $productIndexes) { - if ($this->_engine) { - $this->_engine->saveEntityIndexes($storeId, $productIndexes); + if ($this->_engineProvider->get()) { + $this->_engineProvider->get()->saveEntityIndexes($storeId, $productIndexes); } return $this; @@ -900,8 +898,12 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb protected function _getStoreDate($storeId, $date = null) { if (!isset($this->_dates[$storeId])) { - $timezone = $this->_coreStoreConfig->getConfig(\Magento\Core\Model\LocaleInterface::XML_PATH_DEFAULT_TIMEZONE, $storeId); - $locale = $this->_coreStoreConfig->getConfig(\Magento\Core\Model\LocaleInterface::XML_PATH_DEFAULT_LOCALE, $storeId); + $timezone = $this->_coreStoreConfig->getConfig( + \Magento\Core\Model\LocaleInterface::XML_PATH_DEFAULT_TIMEZONE, $storeId + ); + $locale = $this->_coreStoreConfig->getConfig( + \Magento\Core\Model\LocaleInterface::XML_PATH_DEFAULT_LOCALE, $storeId + ); $locale = new \Zend_Locale($locale); $dateObj = new \Zend_Date(null, null, $locale); diff --git a/app/code/Magento/CatalogSearch/etc/module.xml b/app/code/Magento/CatalogSearch/etc/module.xml index bd6e7aff447..d34272a4587 100755 --- a/app/code/Magento/CatalogSearch/etc/module.xml +++ b/app/code/Magento/CatalogSearch/etc/module.xml @@ -37,7 +37,8 @@ <module name="Magento_Index"/> <module name="Magento_Eav"/> <module name="Magento_Backend"/> - <module name="Magento_Page" type="soft"/> + <module name="Magento_Adminhtml"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Centinel/etc/module.xml b/app/code/Magento/Centinel/etc/module.xml index 8fc99843afb..191c9d3f22b 100755 --- a/app/code/Magento/Centinel/etc/module.xml +++ b/app/code/Magento/Centinel/etc/module.xml @@ -34,6 +34,7 @@ <module name="Magento_Core"/> <module name="Magento_Adminhtml"/> <module name="Magento_Backend"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php index c17e2d07cc0..25f70cec378 100644 --- a/app/code/Magento/Checkout/Helper/Data.php +++ b/app/code/Magento/Checkout/Helper/Data.php @@ -295,7 +295,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper ); } - $translate->setTranslateInline(true); + $this->_translator->setTranslateInline(true); return $this; } diff --git a/app/code/Magento/Checkout/view/frontend/cart/crosssell.phtml b/app/code/Magento/Checkout/view/frontend/cart/crosssell.phtml index 4ffda5ac21c..18ca99909fb 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/crosssell.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/crosssell.phtml @@ -41,7 +41,7 @@ <div class="product-details"> <h3 class="product-name"><a href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h3> <?php echo $this->getPriceHtml($_item, true) ?> - <button type="button" title="<?php echo __('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_item) ?>')"><span><span><?php echo __('Add to Cart') ?></span></span></button> + <button type="button" title="<?php echo __('Add to Cart') ?>" class="button btn-cart" onclick="window.location.href='<?php echo $this->getAddToCartUrl($_item) ?>'"><span><span><?php echo __('Add to Cart') ?></span></span></button> <ul class="add-to-links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> <li><a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist" data-action="add-to-wishlist"><?php echo __('Add to Wish List') ?></a></li> diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/success.phtml b/app/code/Magento/Checkout/view/frontend/multishipping/success.phtml index f639629172f..d666ec7ca0a 100644 --- a/app/code/Magento/Checkout/view/frontend/multishipping/success.phtml +++ b/app/code/Magento/Checkout/view/frontend/multishipping/success.phtml @@ -45,6 +45,6 @@ <?php endif; ?> <?php echo $this->getChildHtml() ?> <div class="buttons-set"> - <button type="button" title="<?php echo __('Continue Shopping') ?>" class="button" onclick="setLocation('<?php echo $this->getContinueUrl() ?>')"><span><span><?php echo __('Continue Shopping') ?></span></span></button> + <button type="button" title="<?php echo __('Continue Shopping') ?>" class="button" onclick="window.location = '<?php echo $this->getContinueUrl() ?>';"><span><span><?php echo __('Continue Shopping') ?></span></span></button> </div> </div> diff --git a/app/code/Magento/Contacts/etc/module.xml b/app/code/Magento/Contacts/etc/module.xml index 4604f1c853b..4a8b8e7c1c6 100755 --- a/app/code/Magento/Contacts/etc/module.xml +++ b/app/code/Magento/Contacts/etc/module.xml @@ -33,6 +33,7 @@ <module name="Magento_Customer"/> <module name="Magento_Backend"/> <module name="Magento_Cms"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Core/Model/AbstractModel.php b/app/code/Magento/Core/Model/AbstractModel.php index 173069338fb..6674a3be097 100644 --- a/app/code/Magento/Core/Model/AbstractModel.php +++ b/app/code/Magento/Core/Model/AbstractModel.php @@ -153,7 +153,8 @@ abstract class AbstractModel extends \Magento\Object $this->_resource = $resource; $this->_resourceCollection = $resourceCollection; $this->_logger = $context->getLogger(); - if ($this->_resource) { + + if (method_exists($this->_resource, 'getIdFieldName') || $this->_resource instanceof \Magento\Object) { $this->_idFieldName = $this->_getResource()->getIdFieldName(); } diff --git a/app/code/Magento/Core/Model/App.php b/app/code/Magento/Core/Model/App.php index f3f5de5e465..39c028e3389 100644 --- a/app/code/Magento/Core/Model/App.php +++ b/app/code/Magento/Core/Model/App.php @@ -51,7 +51,7 @@ class App implements \Magento\Core\Model\AppInterface /** * Magento version */ - const VERSION = '2.0.0.0-dev46'; + const VERSION = '2.0.0.0-dev47'; /** * Custom application dirs @@ -921,7 +921,7 @@ class App implements \Magento\Core\Model\AppInterface 'revision' => '0', 'patch' => '0', 'stability' => 'dev', - 'number' => '46', + 'number' => '47', ); } } diff --git a/app/code/Magento/Core/Model/Config/Data.php b/app/code/Magento/Core/Model/Config/Data.php index 48badb1d838..86949fda009 100644 --- a/app/code/Magento/Core/Model/Config/Data.php +++ b/app/code/Magento/Core/Model/Config/Data.php @@ -34,6 +34,13 @@ class Data implements \Magento\Core\Model\Config\DataInterface */ protected $_data = array(); + /** + * Config source data + * + * @var array + */ + protected $_source = array(); + /** * @param \Magento\Core\Model\Config\MetadataProcessor $processor * @param array $data @@ -41,6 +48,15 @@ class Data implements \Magento\Core\Model\Config\DataInterface public function __construct(\Magento\Core\Model\Config\MetadataProcessor $processor, array $data) { $this->_data = $processor->process($data); + $this->_source = $data; + } + + /** + * @return array + */ + public function getSource() + { + return $this->_source; } /** diff --git a/app/code/Magento/Core/Model/Config/Resource.php b/app/code/Magento/Core/Model/Config/Resource.php index e2bdd97669f..3cc04e5fe67 100644 --- a/app/code/Magento/Core/Model/Config/Resource.php +++ b/app/code/Magento/Core/Model/Config/Resource.php @@ -28,8 +28,6 @@ namespace Magento\Core\Model\Config; class Resource extends \Magento\Config\Data\Scoped implements \Magento\Core\Model\Config\ResourceInterface { - const DEFAULT_READ_CONNECTION = 'read'; - const DEFAULT_WRITE_CONNECTION = 'write'; const DEFAULT_SETUP_CONNECTION = 'default'; /** diff --git a/app/code/Magento/Core/Model/Config/Section/Reader/Store.php b/app/code/Magento/Core/Model/Config/Section/Reader/Store.php index f274c2a6d1c..c8cb7551283 100644 --- a/app/code/Magento/Core/Model/Config/Section/Reader/Store.php +++ b/app/code/Magento/Core/Model/Config/Section/Reader/Store.php @@ -90,7 +90,7 @@ class Store if ($this->_appState->isInstalled()) { $store = $this->_storeFactory->create(); $store->load($code); - $websiteConfig = $this->_sectionPool->getSection('website', $store->getWebsite()->getCode())->getValue(); + $websiteConfig = $this->_sectionPool->getSection('website', $store->getWebsite()->getCode())->getSource(); $config = array_replace_recursive($websiteConfig, $this->_initialConfig->getStore($code)); $collection = $this->_collectionFactory->create(array('scope' => 'stores', 'scopeId' => $store->getId())); @@ -100,7 +100,7 @@ class Store } $config = $this->_converter->convert($dbStoreConfig, $config); } else { - $websiteConfig = $this->_sectionPool->getSection('website', 'default')->getValue(); + $websiteConfig = $this->_sectionPool->getSection('website', 'default')->getSource(); $config = $this->_converter->convert($websiteConfig, $this->_initialConfig->getStore($code)); } return $config; diff --git a/app/code/Magento/Core/Model/Config/Section/Reader/Website.php b/app/code/Magento/Core/Model/Config/Section/Reader/Website.php index d79364035c0..3680d3387d0 100644 --- a/app/code/Magento/Core/Model/Config/Section/Reader/Website.php +++ b/app/code/Magento/Core/Model/Config/Section/Reader/Website.php @@ -88,7 +88,7 @@ class Website public function read($code) { $config = array_replace_recursive( - $this->_sectionPool->getSection('default')->getValue(), $this->_initialConfig->getWebsite($code) + $this->_sectionPool->getSection('default')->getSource(), $this->_initialConfig->getWebsite($code) ); if ($this->_appState->isInstalled()) { diff --git a/app/code/Magento/Core/Model/Db/Updater.php b/app/code/Magento/Core/Model/Db/Updater.php index 9d057a8f0bd..909ae75faea 100644 --- a/app/code/Magento/Core/Model/Db/Updater.php +++ b/app/code/Magento/Core/Model/Db/Updater.php @@ -26,13 +26,6 @@ namespace Magento\Core\Model\Db; class Updater implements \Magento\Core\Model\Db\UpdaterInterface { - /** - * Modules configuration - * - * @var \Magento\Core\Model\Config - */ - protected $_config; - /** * Default setup class name * @@ -86,7 +79,6 @@ class Updater implements \Magento\Core\Model\Db\UpdaterInterface protected $_resourceResolver; /** - * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Resource\SetupFactory $factory * @param \Magento\Core\Model\App\State $appState * @param \Magento\Core\Model\ModuleListInterface $moduleList @@ -95,7 +87,6 @@ class Updater implements \Magento\Core\Model\Db\UpdaterInterface * @param bool $skipModuleUpdate */ public function __construct( - \Magento\Core\Model\Config $config, \Magento\Core\Model\Resource\SetupFactory $factory, \Magento\Core\Model\App\State $appState, \Magento\Core\Model\ModuleListInterface $moduleList, @@ -103,7 +94,6 @@ class Updater implements \Magento\Core\Model\Db\UpdaterInterface array $resourceList, $skipModuleUpdate = false ) { - $this->_config = $config; $this->_factory = $factory; $this->_appState = $appState; $this->_moduleList = $moduleList; diff --git a/app/code/Magento/Core/Model/File/Storage/File.php b/app/code/Magento/Core/Model/File/Storage/File.php index d88e979c822..eea5d0782f4 100644 --- a/app/code/Magento/Core/Model/File/Storage/File.php +++ b/app/code/Magento/Core/Model/File/Storage/File.php @@ -69,9 +69,7 @@ class File extends \Magento\Core\Model\File\Storage\AbstractStorage * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Core\Model\Date $dateModel - * @param \Magento\Core\Model\Resource\AbstractResource|\Magento\Core\Model\Resource\File\Storage\File $resource - * @param \Magento\Core\Model\Resource\File\Storage\File $fileResource + * @param \Magento\Core\Model\Resource\File\Storage\File $resource * @param \Magento\Data\Collection\Db|null $resourceCollection * @param array $data */ @@ -80,14 +78,11 @@ class File extends \Magento\Core\Model\File\Storage\AbstractStorage \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\Core\Model\Date $dateModel, - \Magento\Core\Model\Resource\AbstractResource $resource, - \Magento\Core\Model\Resource\File\Storage\File $fileResource, + \Magento\Core\Model\Resource\File\Storage\File $resource, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - parent::__construct($coreFileStorageDb, $context, $registry, $dateModel, $resource, - $fileResource, $resourceCollection, $data); + parent::__construct($coreFileStorageDb, $context, $registry, $resource, $resourceCollection, $data); $this->_setResourceModel('Magento\Core\Model\Resource\File\Storage\File'); $this->_logger = $logger; } diff --git a/app/code/Magento/Core/Model/Layout.php b/app/code/Magento/Core/Model/Layout.php index d9022ea9433..392352d6a01 100644 --- a/app/code/Magento/Core/Model/Layout.php +++ b/app/code/Magento/Core/Model/Layout.php @@ -949,7 +949,7 @@ class Layout extends \Magento\Simplexml\Config unset($options[self::CONTAINER_OPT_LABEL]); unset($options['type']); $allowedTags = array( - 'dd', 'div', 'dl', 'fieldset', 'header', 'hgroup', 'ol', 'p', 'section','table', 'tfoot', 'ul' + 'dd', 'div', 'dl', 'fieldset', 'header', 'footer', 'hgroup', 'ol', 'p', 'section','table', 'tfoot', 'ul' ); if (!empty($options[self::CONTAINER_OPT_HTML_TAG]) && !in_array($options[self::CONTAINER_OPT_HTML_TAG], $allowedTags) diff --git a/app/code/Magento/Core/Model/Resource.php b/app/code/Magento/Core/Model/Resource.php index 843b935495a..00484ecb40d 100644 --- a/app/code/Magento/Core/Model/Resource.php +++ b/app/code/Magento/Core/Model/Resource.php @@ -181,7 +181,7 @@ class Resource if ($tableSuffix) { $tableName .= '_' . $tableSuffix; } - return $this->getConnection(\Magento\Core\Model\Config\Resource::DEFAULT_READ_CONNECTION) + return $this->getConnection('core_read') ->getTableName($tableName); } @@ -237,7 +237,7 @@ class Resource */ public function getIdxName($tableName, $fields, $indexType = \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX) { - return $this->getConnection(\Magento\Core\Model\Config\Resource::DEFAULT_READ_CONNECTION) + return $this->getConnection('core_read') ->getIndexName($this->getTableName($tableName), $fields, $indexType); } @@ -252,7 +252,7 @@ class Resource */ public function getFkName($priTableName, $priColumnName, $refTableName, $refColumnName) { - return $this->getConnection(\Magento\Core\Model\Config\Resource::DEFAULT_READ_CONNECTION) + return $this->getConnection('core_read') ->getForeignKeyName($this->getTableName($priTableName), $priColumnName, $this->getTableName($refTableName), $refColumnName); } 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 a4407ee9884..ee13ca750ad 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/File.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/File.php @@ -34,7 +34,7 @@ */ namespace Magento\Core\Model\Resource\File\Storage; -class File +class File extends \Magento\Core\Model\Resource\AbstractResource { /** * Prefix of model events names @@ -202,6 +202,30 @@ class File return false; } + /** + * @inheritDoc + */ + protected function _construct() + { + return $this; + } + + /** + * @inheritDoc + */ + protected function _getReadAdapter() + { + return false; + } + + /** + * @inheritDoc + */ + protected function _getWriteAdapter() + { + return false; + } + /** * Get path relative to media base directory * diff --git a/app/code/Magento/Core/Model/Resource/Setup/Context.php b/app/code/Magento/Core/Model/Resource/Setup/Context.php index 7b9e43ca281..c839388a5ff 100644 --- a/app/code/Magento/Core/Model/Resource/Setup/Context.php +++ b/app/code/Magento/Core/Model/Resource/Setup/Context.php @@ -23,7 +23,7 @@ */ namespace Magento\Core\Model\Resource\Setup; -class Context +class Context implements \Magento\ObjectManager\ContextInterface { /** * @var \Magento\Core\Model\Logger diff --git a/app/code/Magento/Core/Model/Resource/Setup/Migration.php b/app/code/Magento/Core/Model/Resource/Setup/Migration.php index ef8810a8a22..5da16eb9e80 100644 --- a/app/code/Magento/Core/Model/Resource/Setup/Migration.php +++ b/app/code/Magento/Core/Model/Resource/Setup/Migration.php @@ -159,8 +159,8 @@ class Migration extends \Magento\Core\Model\Resource\Setup * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Helper\Data $helper * @param \Magento\Core\Model\Dir $dir - * @param $resourceName - * @param $confPathToMapFile + * @param string $resourceName + * @param string $confPathToMapFile * @param string $moduleName * @param string $connectionName */ diff --git a/app/code/Magento/Core/Model/Translate.php b/app/code/Magento/Core/Model/Translate.php index e1056fce84b..30338a4be86 100644 --- a/app/code/Magento/Core/Model/Translate.php +++ b/app/code/Magento/Core/Model/Translate.php @@ -585,7 +585,7 @@ class Translate } if (!empty($_REQUEST['theme'])) { - $module = self::CONFIG_KEY_DESIGN_THEME . $_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]; } diff --git a/app/code/Magento/Core/Model/Url.php b/app/code/Magento/Core/Model/Url.php index a2ded0ca1fc..de7b1f6b73d 100644 --- a/app/code/Magento/Core/Model/Url.php +++ b/app/code/Magento/Core/Model/Url.php @@ -133,6 +133,26 @@ class Url extends \Magento\Object implements \Magento\Core\Model\UrlInterface */ protected $_coreData = null; + /** + * @var \Magento\Core\Model\Store\Config + */ + protected $_coreStoreConfig; + + /** + * @var \Magento\Core\Model\App + */ + protected $_app; + + /** + * @var \Magento\Core\Model\StoreManager + */ + protected $_storeManager; + + /** + * @var \Magento\Core\Model\SessionProxy + */ + protected $_session; + /** * Constructor * @@ -144,7 +164,7 @@ class Url extends \Magento\Object implements \Magento\Core\Model\UrlInterface * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\App $app * @param \Magento\Core\Model\StoreManager $storeManager - * @param \Magento\Core\Model\Session $session + * @param \Magento\Core\Model\SessionProxy $session * @param array $data */ public function __construct( @@ -153,7 +173,7 @@ class Url extends \Magento\Object implements \Magento\Core\Model\UrlInterface \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\App $app, \Magento\Core\Model\StoreManager $storeManager, - \Magento\Core\Model\Session $session, + \Magento\Core\Model\SessionProxy $session, array $data = array() ) { $this->_urlSecurityInfo = $urlSecurityInfo; diff --git a/app/code/Magento/Core/Model/Url/SecurityInfo.php b/app/code/Magento/Core/Model/Url/SecurityInfo.php index 0f2b2a356b2..dcebcf8d26f 100644 --- a/app/code/Magento/Core/Model/Url/SecurityInfo.php +++ b/app/code/Magento/Core/Model/Url/SecurityInfo.php @@ -25,7 +25,7 @@ */ namespace Magento\Core\Model\Url; -class SecurityInfo implements \Magento\Core\model\Url\SecurityInfoInterface +class SecurityInfo implements \Magento\Core\Model\Url\SecurityInfoInterface { /** * Store manager diff --git a/app/code/Magento/Core/etc/layouts.xsd b/app/code/Magento/Core/etc/layouts.xsd index 08c8c6cde22..420274c0494 100644 --- a/app/code/Magento/Core/etc/layouts.xsd +++ b/app/code/Magento/Core/etc/layouts.xsd @@ -324,6 +324,7 @@ <xs:enumeration value="dl"/> <xs:enumeration value="fieldset"/> <xs:enumeration value="header"/> + <xs:enumeration value="footer"/> <xs:enumeration value="hgroup"/> <xs:enumeration value="ol"/> <xs:enumeration value="p"/> diff --git a/app/code/Magento/Core/etc/resources.xml b/app/code/Magento/Core/etc/resources.xml index b03be61aec7..dc94c91292b 100644 --- a/app/code/Magento/Core/etc/resources.xml +++ b/app/code/Magento/Core/etc/resources.xml @@ -24,7 +24,5 @@ */ --> <config> - <resource name="core_read" extends="default_read" /> - <resource name="core_write" extends="default_write" /> <resource name="core_setup" extends="default_setup" /> </config> diff --git a/app/code/Magento/Cron/Model/Config/Converter/Xml.php b/app/code/Magento/Cron/Model/Config/Converter/Xml.php index 8b7b65c9bfa..4803c133895 100644 --- a/app/code/Magento/Cron/Model/Config/Converter/Xml.php +++ b/app/code/Magento/Cron/Model/Config/Converter/Xml.php @@ -36,7 +36,7 @@ class Xml implements \Magento\Config\ConverterInterface * * @param mixed $source * @return array - * @throws LogicException + * @throws \InvalidArgumentException */ public function convert($source) { @@ -46,19 +46,20 @@ class Xml implements \Magento\Config\ConverterInterface return $output; } - /** @var DOMNodeList $jobs */ + /** @var \DOMNodeList $jobs */ $jobs = $source->getElementsByTagName('job'); - /** @var DOMElement $jobConfig */ + /** @var \DOMElement $jobConfig */ foreach ($jobs as $jobConfig) { $jobName = $jobConfig->getAttribute('name'); if (!$jobName) { throw new \InvalidArgumentException('Attribute "name" does not exist'); } + $config = array(); $config['name'] = $jobName; $config += $this->_convertCronConfig($jobConfig); - /** @var DOMText $schedules */ + /** @var \DOMText $schedules */ foreach ($jobConfig->childNodes as $schedules) { if ($schedules->nodeName == 'schedule') { if (!empty($schedules->nodeValue)) { @@ -76,7 +77,7 @@ class Xml implements \Magento\Config\ConverterInterface /** * Convert specific cron configurations * - * @param DOMElement $jobConfig + * @param \DOMElement $jobConfig * @return array * @throws \InvalidArgumentException */ diff --git a/app/code/Magento/Customer/Block/Account/Customer.php b/app/code/Magento/Customer/Block/Account/Customer.php new file mode 100644 index 00000000000..779950799c0 --- /dev/null +++ b/app/code/Magento/Customer/Block/Account/Customer.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Customer\Block\Account; + +class Customer extends \Magento\Core\Block\Template +{ + /** + * Customer session + * + * @var \Magento\Customer\Model\Session + */ + protected $_customerSession; + + /** + * @param \Magento\Core\Block\Template\Context $context + * @param \Magento\Customer\Model\Session $session + * @param \Magento\Core\Helper\Data $coreData + * @param array $data + */ + public function __construct( + \Magento\Core\Block\Template\Context $context, + \Magento\Customer\Model\Session $session, + \Magento\Core\Helper\Data $coreData, + array $data = array() + ) { + parent::__construct($coreData, $context, $data); + $this->_customerSession = $session; + } + + /** + * Checking customer login status + * + * @return bool + */ + + public function customerLoggedIn() + { + return (bool)$this->_customerSession->isLoggedIn(); + } + + /** + * @return string + */ + public function getCustomerName() + { + return $this->_helperFactory->get('Magento_Customer_Helper_Data')->getCustomerName(); + } +} diff --git a/app/code/Magento/Customer/Helper/Address.php b/app/code/Magento/Customer/Helper/Address.php index 6d6350c09dd..a35462a3158 100644 --- a/app/code/Magento/Customer/Helper/Address.php +++ b/app/code/Magento/Customer/Helper/Address.php @@ -98,7 +98,7 @@ class Address extends \Magento\Core\Helper\AbstractHelper * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Customer\Model\Address\Config|\Magento\Customer\Model\Address\ConfigProxy $addressConfig + * @param \Magento\Customer\Model\Address\Config|\Magento\Customer\Model\Address\Config $addressConfig */ public function __construct( \Magento\Core\Helper\Context $context, @@ -106,7 +106,7 @@ class Address extends \Magento\Core\Helper\AbstractHelper \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Eav\Model\Config $eavConfig, - \Magento\Customer\Model\Address\ConfigProxy $addressConfig + \Magento\Customer\Model\Address\Config $addressConfig ) { $this->_coreStoreConfig = $coreStoreConfig; $this->_blockFactory = $blockFactory; diff --git a/app/code/Magento/Customer/Helper/Data.php b/app/code/Magento/Customer/Helper/Data.php index 204255f6a42..5fd02ca5c25 100644 --- a/app/code/Magento/Customer/Helper/Data.php +++ b/app/code/Magento/Customer/Helper/Data.php @@ -698,7 +698,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ protected function _createVatNumberValidationSoapClient($trace = false) { - return new SoapClient(self::VAT_VALIDATION_WSDL_URL, array('trace' => $trace)); + return new \SoapClient(self::VAT_VALIDATION_WSDL_URL, array('trace' => $trace)); } /** diff --git a/app/code/Magento/Customer/Model/Config/Share.php b/app/code/Magento/Customer/Model/Config/Share.php index b32b46b524f..18736ccf383 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 * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Customer\Model\Resource\CustomerProxy $customerResource + * @param \Magento\Customer\Model\Resource\Customer $customerResource * @param \Magento\Core\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 \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Config $config, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Customer\Model\Resource\CustomerProxy $customerResource, + \Magento\Customer\Model\Resource\Customer $customerResource, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() diff --git a/app/code/Magento/Customer/Model/Observer.php b/app/code/Magento/Customer/Model/Observer.php index 18868ca3f75..e02831d4ebe 100644 --- a/app/code/Magento/Customer/Model/Observer.php +++ b/app/code/Magento/Customer/Model/Observer.php @@ -262,7 +262,7 @@ class Observer } $customer->setGroupId( - $customer->getOrigData('group_id') + (int)$customer->getOrigData('group_id') ); $customer->save(); } diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php index 6bc0da9033e..e7dda583082 100644 --- a/app/code/Magento/Customer/Model/Session.php +++ b/app/code/Magento/Customer/Model/Session.php @@ -94,9 +94,9 @@ class Session extends \Magento\Core\Model\Session\AbstractSession * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Config\Share $configShare * @param \Magento\Core\Helper\Url $coreUrl - * @param \Magento\Customer\Helper\DataProxy $customerData + * @param \Magento\Customer\Helper\Data $customerData * @param \Magento\Core\Model\Session $session - * @param \Magento\Customer\Model\Resource\CustomerProxy $customerResource + * @param \Magento\Customer\Model\Resource\Customer $customerResource * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Core\Model\UrlFactory $urlFactory * @param array $data @@ -107,9 +107,9 @@ class Session extends \Magento\Core\Model\Session\AbstractSession \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Config\Share $configShare, \Magento\Core\Helper\Url $coreUrl, - \Magento\Customer\Helper\DataProxy $customerData, + \Magento\Customer\Helper\Data $customerData, \Magento\Core\Model\Session $session, - \Magento\Customer\Model\Resource\CustomerProxy $customerResource, + \Magento\Customer\Model\Resource\Customer $customerResource, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Core\Model\UrlFactory $urlFactory, array $data = array(), diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index 178e810d3f9..b369f18220f 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -46,6 +46,12 @@ <param name="configShare"> <instance type="Magento\Customer\Model\Config\Share\Proxy" /> </param> + <param name="customerData"> + <instance type="Magento\Customer\Helper\Data\Proxy" /> + </param> + <param name="customerResource"> + <instance type="Magento\Customer\Model\Resource\Customer\Proxy" /> + </param> </type> <type name="Magento\Core\Model\Db\Updater"> <param name="resourceList"> @@ -54,4 +60,14 @@ </value> </param> </type> + <type name="Magento\Customer\Helper\Address"> + <param name="addressConfig"> + <instance type="Magento\Customer\Model\Address\Config\Proxy" /> + </param> + </type> + <type name="Magento\Customer\Model\Config\Share"> + <param name="customerResource"> + <instance type="Magento\Customer\Model\Resource\Customer\Proxy" /> + </param> + </type> </config> diff --git a/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php b/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php index d00a0222100..c4017c29eb9 100644 --- a/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php +++ b/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php @@ -61,7 +61,7 @@ class NavigationMode extends \Magento\Core\Model\Url * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\App $app * @param \Magento\Core\Model\StoreManager $storeManager - * @param \Magento\Core\Model\Session $session + * @param \Magento\Core\Model\SessionProxy $session * @param array $data */ public function __construct( @@ -71,7 +71,7 @@ class NavigationMode extends \Magento\Core\Model\Url \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\App $app, \Magento\Core\Model\StoreManager $storeManager, - \Magento\Core\Model\Session $session, + \Magento\Core\Model\SessionProxy $session, array $data = array() ) { $this->_helper = $helper; diff --git a/app/code/Magento/DesignEditor/etc/module.xml b/app/code/Magento/DesignEditor/etc/module.xml index d85093c186b..64a58d4fb19 100755 --- a/app/code/Magento/DesignEditor/etc/module.xml +++ b/app/code/Magento/DesignEditor/etc/module.xml @@ -36,6 +36,7 @@ <module name="Magento_Backend"/> <module name="Magento_Core"/> <module name="Magento_Eav"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/File.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/File.php index 1648598afb7..39dbcda120b 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/File.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/File.php @@ -76,7 +76,7 @@ class File extends \Magento\Adminhtml\Controller\Action } $result = array(); try { - $uploader = $this->_objectManager->create('Magento\Core\Model\File\Uploader', array('type' => $type)); + $uploader = $this->_objectManager->create('Magento\Core\Model\File\Uploader', array('fileId' => $type)); $uploader->setAllowRenameFiles(true); $uploader->setFilesDispersion(true); $result = $uploader->save($tmpPath); diff --git a/app/code/Magento/Downloadable/etc/module.xml b/app/code/Magento/Downloadable/etc/module.xml index da6509a12fb..46791af9868 100755 --- a/app/code/Magento/Downloadable/etc/module.xml +++ b/app/code/Magento/Downloadable/etc/module.xml @@ -43,6 +43,7 @@ <module name="Magento_Weee"/> <module name="Magento_Wishlist"/> <module name="Magento_GiftMessage"/> + <module name="Magento_CatalogInventory"/> </depends> </module> </config> diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Config.php b/app/code/Magento/Eav/Model/Entity/Attribute/Config.php index 4293502fdca..51c51c5ba64 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Config.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Config.php @@ -41,15 +41,18 @@ class Config extends \Magento\Config\Data /** * Retrieve list of locked fields for attribute * - * @param \Magento\Catalog\Model\Resource\Eav\Attribute $attribute + * @param AbstractAttribute $attribute * @return array */ - public function getLockedFields(\Magento\Catalog\Model\Resource\Eav\Attribute $attribute) + public function getLockedFields(AbstractAttribute $attribute) { $allFields = $this->get( $attribute->getEntityType()->getEntityTypeCode() . '/attributes/' . $attribute->getAttributeCode() ); + if (!is_array($allFields)) { + return array(); + } $lockedFields = array(); foreach (array_keys($allFields) as $fieldCode) { $lockedFields[$fieldCode] = $fieldCode; diff --git a/app/code/Magento/GiftMessage/Model/Message.php b/app/code/Magento/GiftMessage/Model/Message.php index ba5280100cb..865a0fea847 100644 --- a/app/code/Magento/GiftMessage/Model/Message.php +++ b/app/code/Magento/GiftMessage/Model/Message.php @@ -82,7 +82,7 @@ class Message extends \Magento\Core\Model\AbstractModel * * @param string $type * - * @return \Magento\Eav\Model\Entity\AbstractEntity + * @return \Magento\Eav\Model\Entity\AbstractModel */ public function getEntityModelByType($type) { diff --git a/app/code/Magento/GiftMessage/Model/TypeFactory.php b/app/code/Magento/GiftMessage/Model/TypeFactory.php index 52baae74f34..ca8e6fd4eb4 100644 --- a/app/code/Magento/GiftMessage/Model/TypeFactory.php +++ b/app/code/Magento/GiftMessage/Model/TypeFactory.php @@ -39,7 +39,7 @@ class TypeFactory protected $_allowedEntityTypes = array( 'order' => 'Magento\Sales\Model\Order', 'order_item' => 'Magento\Sales\Model\Order\Item', - 'order_address' => 'Magento\Sales\Model\Order_Address', + 'order_address' => 'Magento\Sales\Model\Order\Address', 'quote' => 'Magento\Sales\Model\Quote', 'quote_item' => 'Magento\Sales\Model\Quote\Item', 'quote_address' => 'Magento\Sales\Model\Quote\Address', diff --git a/app/code/Magento/GiftMessage/etc/module.xml b/app/code/Magento/GiftMessage/etc/module.xml index 2aff0b92f07..4118d75e804 100644 --- a/app/code/Magento/GiftMessage/etc/module.xml +++ b/app/code/Magento/GiftMessage/etc/module.xml @@ -37,6 +37,7 @@ <module name="Magento_Core"/> <module name="Magento_Customer"/> <module name="Magento_Eav"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/GoogleCheckout/Model/Observer.php b/app/code/Magento/GoogleCheckout/Model/Observer.php index 25485b30664..a1e25444c71 100644 --- a/app/code/Magento/GoogleCheckout/Model/Observer.php +++ b/app/code/Magento/GoogleCheckout/Model/Observer.php @@ -50,8 +50,8 @@ class Observer * @param ApiFactory $apiFactory */ public function __construct( - ShippingFactory $shippingFactory, - ApiFactory $apiFactory + \Magento\GoogleCheckout\Model\ShippingFactory $shippingFactory, + \Magento\GoogleCheckout\Model\ApiFactory $apiFactory ) { $this->shippingFactory = $shippingFactory; $this->apiFactory = $apiFactory; diff --git a/app/code/Magento/GoogleCheckout/etc/adminhtml/system.xml b/app/code/Magento/GoogleCheckout/etc/adminhtml/system.xml index 04cd3c1238c..0be88909ac2 100644 --- a/app/code/Magento/GoogleCheckout/etc/adminhtml/system.xml +++ b/app/code/Magento/GoogleCheckout/etc/adminhtml/system.xml @@ -74,7 +74,7 @@ </field> <field id="order_status" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0"> <label>New Order Status</label> - <source_model>Magento\Sales\Model\Config\Source\Order\Status\New</source_model> + <source_model>Magento\Sales\Model\Config\Source\Order\Status\NewStatus</source_model> </field> <field id="continue_shopping_url" translate="label comment" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Continue Shopping URL</label> diff --git a/app/code/Magento/GoogleShopping/etc/module.xml b/app/code/Magento/GoogleShopping/etc/module.xml index 2d5f3552356..e3e84bdf229 100755 --- a/app/code/Magento/GoogleShopping/etc/module.xml +++ b/app/code/Magento/GoogleShopping/etc/module.xml @@ -37,6 +37,7 @@ <module name="Magento_Customer"/> <module name="Magento_Eav"/> <module name="Magento_Tax"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Install/Model/Installer/AbstractInstaller.php b/app/code/Magento/Install/Model/Installer/AbstractInstaller.php index 5e5be4455cd..eea3caef4f7 100644 --- a/app/code/Magento/Install/Model/Installer/AbstractInstaller.php +++ b/app/code/Magento/Install/Model/Installer/AbstractInstaller.php @@ -44,11 +44,10 @@ class AbstractInstaller protected $installer; /** - * @param \Magento\Install\Model\InstallerProxy $installer + * @param \Magento\Install\Model\Installer $installer */ - public function __construct( - \Magento\Install\Model\InstallerProxy $installer - ) { + public function __construct(\Magento\Install\Model\Installer $installer) + { $this->_installer = $installer; } diff --git a/app/code/Magento/Install/Model/Installer/Config.php b/app/code/Magento/Install/Model/Installer/Config.php index 20652fbd6d8..afcd2ab5d62 100644 --- a/app/code/Magento/Install/Model/Installer/Config.php +++ b/app/code/Magento/Install/Model/Installer/Config.php @@ -69,14 +69,14 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller protected $_storeManager; /** - * @param \Magento\Install\Model\InstallerProxy $installer + * @param \Magento\Install\Model\Installer $installer * @param \Magento\Core\Controller\Request\Http $request * @param \Magento\Core\Model\Dir $dirs * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( - \Magento\Install\Model\InstallerProxy $installer, + \Magento\Install\Model\Installer $installer, \Magento\Core\Controller\Request\Http $request, \Magento\Core\Model\Dir $dirs, \Magento\Filesystem $filesystem, diff --git a/app/code/Magento/Install/Model/Installer/Console.php b/app/code/Magento/Install/Model/Installer/Console.php index 7010894886c..fb0d59ee3d9 100644 --- a/app/code/Magento/Install/Model/Installer/Console.php +++ b/app/code/Magento/Install/Model/Installer/Console.php @@ -136,7 +136,7 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller protected $_objectManager; /** - * @param \Magento\Install\Model\InstallerProxy $installer + * @param \Magento\Install\Model\Installer $installer * @param \Magento\Core\Model\Config\Resource $resourceConfig * @param \Magento\Core\Model\Db\UpdaterInterface $dbUpdater * @param \Magento\Filesystem $filesystem @@ -147,7 +147,7 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller * @param \Magento\ObjectManager $objectManager */ public function __construct( - \Magento\Install\Model\InstallerProxy $installer, + \Magento\Install\Model\Installer $installer, \Magento\Core\Model\Config\Resource $resourceConfig, \Magento\Core\Model\Db\UpdaterInterface $dbUpdater, \Magento\Filesystem $filesystem, diff --git a/app/code/Magento/Install/Model/Installer/Db.php b/app/code/Magento/Install/Model/Installer/Db.php index dc7207759e1..07d32156e2a 100644 --- a/app/code/Magento/Install/Model/Installer/Db.php +++ b/app/code/Magento/Install/Model/Installer/Db.php @@ -58,13 +58,13 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller protected $_dbConfig; /** - * @param \Magento\Install\Model\InstallerProxy $installer + * @param \Magento\Install\Model\Installer $installer * @param \Magento\Core\Model\Logger $logger * @param \Magento\Install\Model\Installer\Db\Factory $dbFactory * @param array $dbConfig */ public function __construct( - \Magento\Install\Model\InstallerProxy $installer, + \Magento\Install\Model\Installer $installer, \Magento\Core\Model\Logger $logger, \Magento\Install\Model\Installer\Db\Factory $dbFactory, array $dbConfig diff --git a/app/code/Magento/Install/Model/Installer/Filesystem.php b/app/code/Magento/Install/Model/Installer/Filesystem.php index 56a43c04754..a8554112e43 100644 --- a/app/code/Magento/Install/Model/Installer/Filesystem.php +++ b/app/code/Magento/Install/Model/Installer/Filesystem.php @@ -67,13 +67,13 @@ class Filesystem extends \Magento\Install\Model\Installer\AbstractInstaller protected $_appRootDir; /** - * @param \Magento\Install\Model\InstallerProxy $installer + * @param \Magento\Install\Model\Installer $installer * @param \Magento\Filesystem $filesystem * @param \Magento\Install\Model\Config $installConfig * @param \Magento\Core\Model\Dir $dir */ public function __construct( - \Magento\Install\Model\InstallerProxy $installer, + \Magento\Install\Model\Installer $installer, \Magento\Filesystem $filesystem, \Magento\Install\Model\Config $installConfig, \Magento\Core\Model\Dir $dir diff --git a/app/code/Magento/Install/Model/Installer/Pear.php b/app/code/Magento/Install/Model/Installer/Pear.php index 43f5d78659d..d57b3672da0 100644 --- a/app/code/Magento/Install/Model/Installer/Pear.php +++ b/app/code/Magento/Install/Model/Installer/Pear.php @@ -39,11 +39,11 @@ class Pear extends \Magento\Install\Model\Installer\AbstractInstaller protected $_session; /** - * @param \Magento\Install\Model\InstallerProxy $installer + * @param \Magento\Install\Model\Installer $installer * @param \Magento\Core\Model\Session\Generic $session */ public function __construct( - \Magento\Install\Model\InstallerProxy $installer, + \Magento\Install\Model\Installer $installer, \Magento\Core\Model\Session\Generic $session ) { parent::__construct($installer); diff --git a/app/code/Magento/Install/etc/di.xml b/app/code/Magento/Install/etc/di.xml index 98b1a2f16a1..aeb6d1ac7f5 100644 --- a/app/code/Magento/Install/etc/di.xml +++ b/app/code/Magento/Install/etc/di.xml @@ -129,4 +129,9 @@ <instance type="Magento\Install\Model\Session" /> </param> </type> + <type name="Magento\Install\Model\Installer\AbstractInstaller"> + <param name="installer"> + <instance type="Magento\Install\Model\Installer\Proxy" /> + </param> + </type> </config> diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Row/UrlGenerator.php b/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Row/UrlGenerator.php index a742e146213..5ccaf96508b 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Row/UrlGenerator.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Row/UrlGenerator.php @@ -35,12 +35,12 @@ class UrlGenerator protected $_authorization; /** - * @param \Magento\Backend\Model\UrlProxy $backendUrl + * @param \Magento\Backend\Model\Url $backendUrl * @param \Magento\AuthorizationInterface $authorization * @param array $args */ public function __construct( - \Magento\Backend\Model\UrlProxy $backendUrl, + \Magento\Backend\Model\Url $backendUrl, \Magento\AuthorizationInterface $authorization, array $args = array() ) { diff --git a/app/code/Magento/Newsletter/etc/module.xml b/app/code/Magento/Newsletter/etc/module.xml index 9022042c133..9e3e41fdad1 100755 --- a/app/code/Magento/Newsletter/etc/module.xml +++ b/app/code/Magento/Newsletter/etc/module.xml @@ -32,11 +32,12 @@ <module name="Magento_Widget"/> </sequence> <depends> - <module name="Magento_Backend" type="soft"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> <module name="Magento_Widget"/> <module name="Magento_Catalog"/> + <module name="Magento_Backend"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Ogone/Controller/Api.php b/app/code/Magento/Ogone/Controller/Api.php index cdfb49c0125..499170d62eb 100644 --- a/app/code/Magento/Ogone/Controller/Api.php +++ b/app/code/Magento/Ogone/Controller/Api.php @@ -49,12 +49,12 @@ class Api extends \Magento\Core\Controller\Front\Action /** * @param \Magento\Core\Model\Resource\TransactionFactory $transactionFactory * @param \Magento\Sales\Model\OrderFactory $salesOrderFactory - * @param \Magento\Core\Controller\Varien\Action_Context $context + * @param \Magento\Core\Controller\Varien\Action\Context $context */ public function __construct( \Magento\Core\Model\Resource\TransactionFactory $transactionFactory, \Magento\Sales\Model\OrderFactory $salesOrderFactory, - \Magento\Core\Controller\Varien\Action_Context $context + \Magento\Core\Controller\Varien\Action\Context $context ) { parent::__construct($context); $this->_transactionFactory = $transactionFactory; diff --git a/app/code/Magento/Page/Block/Link.php b/app/code/Magento/Page/Block/Link.php index e7f64a34610..eb93641abab 100644 --- a/app/code/Magento/Page/Block/Link.php +++ b/app/code/Magento/Page/Block/Link.php @@ -21,17 +21,26 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + +namespace Magento\Page\Block; + /** * Block representing link * - * @method string getHref() * @method string getLabel() + * @method string getPath() * @method string getTitle() */ -namespace Magento\Page\Block; - class Link extends \Magento\Core\Block\Template { /** @var string */ protected $_template = 'Magento_Page::link.phtml'; + + /** + * @return string + */ + public function getHref() + { + return $this->getUrl($this->getPath()); + } } diff --git a/app/code/Magento/PageCache/Model/CacheControlFactory.php b/app/code/Magento/PageCache/Model/CacheControlFactory.php index 103ad1ad5d3..756bd2fbf67 100644 --- a/app/code/Magento/PageCache/Model/CacheControlFactory.php +++ b/app/code/Magento/PageCache/Model/CacheControlFactory.php @@ -85,7 +85,7 @@ class CacheControlFactory public function getCacheControls() { $controls = $this->_config->getNode(self::XML_PATH_EXTERNAL_CACHE_CONTROLS); - return $controls->asCanonicalArray(); + return $controls instanceof \Magento\Simplexml\Element ? $controls->asCanonicalArray() : array(); } /** diff --git a/app/code/Magento/Paypal/etc/module.xml b/app/code/Magento/Paypal/etc/module.xml index 8aeb9bb0176..ddab4ebe5d1 100755 --- a/app/code/Magento/Paypal/etc/module.xml +++ b/app/code/Magento/Paypal/etc/module.xml @@ -40,6 +40,7 @@ <module name="Magento_Backend"/> <module name="Magento_Tax"/> <module name="Magento_Directory"/> + <module name="Magento_Page"/> <module name="Magento_Centinel"/> </depends> </module> diff --git a/app/code/Magento/PaypalUk/etc/module.xml b/app/code/Magento/PaypalUk/etc/module.xml index ebd04dece59..0ae08138881 100755 --- a/app/code/Magento/PaypalUk/etc/module.xml +++ b/app/code/Magento/PaypalUk/etc/module.xml @@ -32,11 +32,13 @@ <module name="Magento_Paypal"/> </sequence> <depends> + <module name="Magento_Checkout"/> <module name="Magento_Directory"/> <module name="Magento_Paypal"/> <module name="Magento_Payment"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Persistent/Helper/Data.php b/app/code/Magento/Persistent/Helper/Data.php index 84a1e6c8086..1d5dd26675f 100644 --- a/app/code/Magento/Persistent/Helper/Data.php +++ b/app/code/Magento/Persistent/Helper/Data.php @@ -200,7 +200,7 @@ class Data extends \Magento\Core\Helper\Data */ public function getPersistentConfigFilePath() { - return $this->_coreConfig->getModuleDir('etc', $this->_getModuleName()) . DS . $this->_configFileName; + return $this->_config->getModuleDir('etc', $this->_getModuleName()) . DS . $this->_configFileName; } /** diff --git a/app/code/Magento/Reports/etc/module.xml b/app/code/Magento/Reports/etc/module.xml index 22077d21838..efac5888452 100755 --- a/app/code/Magento/Reports/etc/module.xml +++ b/app/code/Magento/Reports/etc/module.xml @@ -46,6 +46,7 @@ <module name="Magento_Review"/> <module name="Magento_Adminhtml"/> <module name="Magento_CatalogInventory"/> + <module name="Magento_Page"/> <module name="Magento_Tax"/> <module name="Magento_Rating"/> </depends> diff --git a/app/code/Magento/Review/etc/module.xml b/app/code/Magento/Review/etc/module.xml index 20fe49545c8..3a3d42c9552 100755 --- a/app/code/Magento/Review/etc/module.xml +++ b/app/code/Magento/Review/etc/module.xml @@ -37,6 +37,7 @@ <module name="Magento_Rating"/> <module name="Magento_Page"/> <module name="Magento_Backend"/> + <module name="Magento_Paypal"/> <module name="Magento_Tax"/> <module name="Magento_Newsletter"/> </depends> diff --git a/app/code/Magento/Rss/etc/module.xml b/app/code/Magento/Rss/etc/module.xml index d23b1856edc..72869146b27 100755 --- a/app/code/Magento/Rss/etc/module.xml +++ b/app/code/Magento/Rss/etc/module.xml @@ -44,6 +44,7 @@ <module name="Magento_Customer"/> <module name="Magento_Backend"/> <module name="Magento_GiftMessage"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Grid.php index a3f84d9f1b2..48cbd32b0b8 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Grid.php @@ -29,7 +29,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Recurring\Profile; -class Grid extends \Magento\Backend\Block\Widget\Grid\Extended +class Grid extends \Magento\Adminhtml\Block\Widget\Grid { /** * Set ajax/session parameters @@ -88,7 +88,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended /** * Prepare grid collection object * - * @return \Magento\Sales\Block\Adminhtml\Recurring\Profile\Grid + * @return \Magento\Backend\Block\Widget\Grid */ protected function _prepareCollection() { diff --git a/app/code/Magento/Sales/Model/Order/Grid/Row/UrlGenerator.php b/app/code/Magento/Sales/Model/Order/Grid/Row/UrlGenerator.php index d84e559668c..a7f3dd6c5b9 100644 --- a/app/code/Magento/Sales/Model/Order/Grid/Row/UrlGenerator.php +++ b/app/code/Magento/Sales/Model/Order/Grid/Row/UrlGenerator.php @@ -37,12 +37,12 @@ class UrlGenerator extends \Magento\Backend\Model\Widget\Grid\Row\UrlGenerator protected $_authorization; /** - * @param \Magento\Backend\Model\UrlProxy $backendUrl + * @param \Magento\Backend\Model\Url $backendUrl * @param \Magento\AuthorizationInterface $authorization * @param array $args */ public function __construct( - \Magento\Backend\Model\UrlProxy $backendUrl, + \Magento\Backend\Model\Url $backendUrl, \Magento\AuthorizationInterface $authorization, array $args = array() ) { diff --git a/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Parent.php b/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Parent.php deleted file mode 100644 index 1be0049c012..00000000000 --- a/app/code/Magento/Sales/Model/Resource/Order/Attribute/Backend/Parent.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Sales - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - - -/** - * Invoice backend model for parent attribute - * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Sales\Model\Resource\Order\Attribute\Backend; - -class Parent extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend -{ - /** - * Perform operation after save - * - * @param \Magento\Object $object - * @return \Magento\Sales\Model\Resource\Order\Attribute\Backend\Parent - */ - public function afterSave($object) - { - parent::afterSave($object); - - foreach ($object->getAddressesCollection() as $item) { - $item->save(); - } - foreach ($object->getItemsCollection() as $item) { - $item->save(); - } - foreach ($object->getPaymentsCollection() as $item) { - $item->save(); - } - foreach ($object->getStatusHistoryCollection() as $item) { - $item->save(); - } - foreach ($object->getRelatedObjects() as $object) { - $object->save(); - } - return $this; - } -} diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Attribute/Backend/Parent.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Attribute/Backend/Parent.php deleted file mode 100644 index 5dc10c87f2a..00000000000 --- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Attribute/Backend/Parent.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Sales - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - - -/** - * Invoice backend model for parent attribute - * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Sales\Model\Resource\Order\Creditmemo\Attribute\Backend; - -class Parent - extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend -{ - /** - * Method is invoked after save - * - * @param \Magento\Object $object - * @return \Magento\Sales\Model\Resource\Order\Creditmemo\Attribute\Backend\Parent - */ - public function afterSave($object) - { - parent::afterSave($object); - - /** - * Save creditmemo items - */ - foreach ($object->getAllItems() as $item) { - $item->save(); - } - - foreach ($object->getCommentsCollection() as $comment) { - $comment->save(); - } - - return $this; - } -} diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Parent.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Parent.php deleted file mode 100644 index 78477883200..00000000000 --- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Attribute/Backend/Parent.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Sales - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - - -/** - * Invoice backend model for parent attribute - * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Sales\Model\Resource\Order\Invoice\Attribute\Backend; - -class Parent - extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend -{ - /** - * Method is invoked after save - * - * @param \Magento\Object $object - * @return \Magento\Sales\Model\Resource\Order\Invoice\Attribute\Backend\Parent - */ - public function afterSave($object) - { - parent::afterSave($object); - - /** - * Save invoice items - */ - foreach ($object->getAllItems() as $item) { - $item->setOrderItem($item->getOrderItem()); - $item->save(); - } - - foreach ($object->getCommentsCollection() as $comment) { - $comment->save(); - } - - return $this; - } -} diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Attribute/Backend/Parent.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Attribute/Backend/Parent.php deleted file mode 100644 index 7a5c93b3f5f..00000000000 --- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Attribute/Backend/Parent.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Sales - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - - -/** - * Invoice backend model for parent attribute - * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Sales\Model\Resource\Order\Shipment\Attribute\Backend; - -class Parent - extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend -{ - /** - * Performed after data is saved - * - * @param \Magento\Object $object - * @return \Magento\Sales\Model\Resource\Order\Shipment\Attribute\Backend\Parent - */ - public function afterSave($object) - { - parent::afterSave($object); - - /** - * Save Shipment items - */ - foreach ($object->getAllItems() as $item) { - $item->save(); - } - - /** - * Save Shipment tracks - */ - foreach ($object->getAllTracks() as $track) { - $track->save(); - } - - foreach ($object->getCommentsCollection() as $comment) { - $comment->save(); - } - return $this; - } -} diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Parent.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Parent.php deleted file mode 100644 index 974364a519e..00000000000 --- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Parent.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Sales - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - - -/** - *Quote address attribute backend parent resource model - * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Sales\Model\Resource\Quote\Address\Attribute\Backend; - -class Parent - extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend -{ - /** - * Save items collection and shipping rates collection - * - * @param \Magento\Object $object - * @return \Magento\Sales\Model\Resource\Quote\Address\Attribute\Backend\Parent - */ - public function afterSave($object) - { - parent::afterSave($object); - - $object->getItemsCollection()->save(); - $object->getShippingRatesCollection()->save(); - - return $this; - } -} diff --git a/app/code/Magento/Sales/Model/Resource/Sale/Collection.php b/app/code/Magento/Sales/Model/Resource/Sale/Collection.php index d80cf699f64..3663ec9150f 100644 --- a/app/code/Magento/Sales/Model/Resource/Sale/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Sale/Collection.php @@ -96,7 +96,6 @@ class Collection extends \Magento\Data\Collection\Db * @param \Magento\Sales\Model\Resource\Order $resource * @param \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @todo: incorrect constructor */ public function __construct( \Magento\Core\Model\Event\Manager $eventManager, @@ -105,6 +104,7 @@ class Collection extends \Magento\Data\Collection\Db \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Order $resource, \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollFactory, + \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\StoreManagerInterface $storeManager ) { $this->_eventManager = $eventManager; diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php index ca0de298087..fc07e467495 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php @@ -578,7 +578,7 @@ abstract class AbstractCarrier extends \Magento\Object protected function _debug($debugData) { if ($this->getDebugFlag()) { - $this->_logAdapterFactory->creaye(array('fileName' => 'shipping_' . $this->getCarrierCode() . '.log')) + $this->_logAdapterFactory->create(array('fileName' => 'shipping_' . $this->getCarrierCode() . '.log')) ->setFilterDataKeys($this->_debugReplacePrivateDataKeys) ->log($debugData); } diff --git a/app/code/Magento/Sitemap/etc/module.xml b/app/code/Magento/Sitemap/etc/module.xml index f5a5fb01d2e..82b24e7ad4e 100755 --- a/app/code/Magento/Sitemap/etc/module.xml +++ b/app/code/Magento/Sitemap/etc/module.xml @@ -33,6 +33,8 @@ <module name="Magento_Core"/> <module name="Magento_Eav"/> <module name="Magento_Cms"/> + <module name="Magento_Adminhtml"/> + <module name="Magento_Backend"/> </depends> </module> </config> diff --git a/app/code/Magento/Tax/Model/Config/Source/TaxClass/Customer.php b/app/code/Magento/Tax/Model/Config/Source/TaxClass/Customer.php index 5c2de68e174..dd9643b19a1 100644 --- a/app/code/Magento/Tax/Model/Config/Source/TaxClass/Customer.php +++ b/app/code/Magento/Tax/Model/Config/Source/TaxClass/Customer.php @@ -28,6 +28,11 @@ namespace Magento\Tax\Model\Config\Source\TaxClass; class Customer implements \Magento\Core\Model\Option\ArrayInterface { + /** + * @var \Magento\Tax\Model\TaxClass\Source\CustomerFactory + */ + protected $_taxCustomerFactory; + /** * @param \Magento\Tax\Model\TaxClass\Source\CustomerFactory $taxCustomerFactory */ diff --git a/app/code/Magento/Tax/Model/Resource/Calculation.php b/app/code/Magento/Tax/Model/Resource/Calculation.php index 583e55c4afe..9569ab79a6e 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation.php @@ -35,12 +35,12 @@ class Calculation extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Rates cache * - * @var unknown + * @var array */ protected $_ratesCache = array(); /** - * Primery key auto increment flag + * Primary key auto increment flag * * @var bool */ @@ -61,12 +61,12 @@ class Calculation extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Class constructor * - * @param \Magento\Tax\Helper\DataProxy $taxData + * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Resource $resource */ public function __construct( - \Magento\Tax\Helper\DataProxy $taxData, + \Magento\Tax\Helper\Data $taxData, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Resource $resource ) { diff --git a/app/code/Magento/Tax/etc/di.xml b/app/code/Magento/Tax/etc/di.xml index b8255580f38..6d801af8a74 100644 --- a/app/code/Magento/Tax/etc/di.xml +++ b/app/code/Magento/Tax/etc/di.xml @@ -46,4 +46,9 @@ </value> </param> </type> + <type name="Magento\Tax\Model\Resource\Calculation"> + <param name="taxData"> + <instance type="Magento\Tax\Helper\Data\Proxy" /> + </param> + </type> </config> diff --git a/app/code/Magento/Theme/etc/module.xml b/app/code/Magento/Theme/etc/module.xml index 9bdb5676bb4..1078e7550e8 100755 --- a/app/code/Magento/Theme/etc/module.xml +++ b/app/code/Magento/Theme/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Adminhtml"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php index b5d156e0a96..be0ce2b8ee4 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php @@ -537,7 +537,7 @@ class Dhl { $r = $this->_rawRequest; - $xml = $this->_xmlElFactory->create(array('<?xml version = "1.0" encoding = "UTF-8"?><eCommerce/>')); + $xml = $this->_xmlElFactory->create(array('data' => '<?xml version = "1.0" encoding = "UTF-8"?><eCommerce/>')); $xml->addAttribute('action', 'Request'); $xml->addAttribute('version', '1.1'); @@ -1105,7 +1105,7 @@ class Dhl { $r = $this->_rawTrackRequest; - $xml = $this->_xmlElFactory->create(array('<?xml version = "1.0" encoding = "UTF-8"?><eCommerce/>')); + $xml = $this->_xmlElFactory->create(array('data' => '<?xml version = "1.0" encoding = "UTF-8"?><eCommerce/>')); $xml->addAttribute('action', 'Request'); $xml->addAttribute('version', '1.1'); diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php index cc3b7dd7a40..2b3e4bbeb9f 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php @@ -889,7 +889,7 @@ class International . 'xmlns:p2="http://www.dhl.com/DCTRequestdatatypes" ' . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' . 'xsi:schemaLocation="http://www.dhl.com DCT-req.xsd "/>'; - $xml = $this->_xmlElFactory->create(array($xmlStr)); + $xml = $this->_xmlElFactory->create(array('data' => $xmlStr)); $nodeGetQuote = $xml->addChild('GetQuote', '', ''); $nodeRequest = $nodeGetQuote->addChild('Request'); @@ -1332,7 +1332,7 @@ class International . ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . ' xsi:schemaLocation="http://www.dhl.com ship-val-req' . ($originRegion ? '_' . $originRegion : '') . '.xsd" />'; - $xml = $this->_xmlElFactory->create(array($xmlStr)); + $xml = $this->_xmlElFactory->create(array('data' => $xmlStr)); $nodeRequest = $xml->addChild('Request', '', ''); $nodeServiceHeader = $nodeRequest->addChild('ServiceHeader'); @@ -1615,7 +1615,7 @@ class International . ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . ' xsi:schemaLocation="http://www.dhl.com TrackingRequestKnown.xsd" />'; - $xml = $this->_xmlElFactory->create(array($xmlStr)); + $xml = $this->_xmlElFactory->create(array('data' => $xmlStr)); $requestNode = $xml->addChild('Request', '', ''); $serviceHeaderNode = $requestNode->addChild('ServiceHeader', '', ''); diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php index d5ce02e9899..99311e7cf46 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php @@ -194,7 +194,7 @@ class Fedex */ protected function _createSoapClient($wsdl, $trace = false) { - $client = new SoapClient($wsdl, array('trace' => $trace)); + $client = new \SoapClient($wsdl, array('trace' => $trace)); $client->__setLocation($this->getConfigFlag('sandbox_mode') ? 'https://wsbeta.fedex.com:443/web-services/rate' : 'https://ws.fedex.com:443/web-services/rate' @@ -632,7 +632,7 @@ class Fedex { $r = $this->_rawRequest; $xml = $this->_xmlElFactory->create( - array('<?xml version = "1.0" encoding = "UTF-8"?><FDXRateAvailableServicesRequest/>') + array('data' => '<?xml version = "1.0" encoding = "UTF-8"?><FDXRateAvailableServicesRequest/>') ); $xml->addAttribute('xmlns:api', 'http://www.fedex.com/fsmapi'); diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php index eb1d0bb17ac..d2d6c912936 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php @@ -1440,7 +1440,7 @@ XMLAuth; } $xmlRequest = $this->_xmlElFactory->create( - array('<?xml version = "1.0" ?><ShipmentConfirmRequest xml:lang="en-US"/>') + array('data' => '<?xml version = "1.0" ?><ShipmentConfirmRequest xml:lang="en-US"/>') ); $requestPart = $xmlRequest->addChild('Request'); $requestPart->addChild('RequestAction', 'ShipConfirm'); @@ -1627,7 +1627,7 @@ XMLAuth; protected function _sendShipmentAcceptRequest(\Magento\Usa\Model\Simplexml\Element $shipmentConfirmResponse) { $xmlRequest = $this->_xmlElFactory->create( - array('<?xml version = "1.0" ?><ShipmentAcceptRequest/>') + array('data' => '<?xml version = "1.0" ?><ShipmentAcceptRequest/>') ); $request = $xmlRequest->addChild('Request'); $request->addChild('RequestAction', 'ShipAccept'); @@ -1652,7 +1652,7 @@ XMLAuth; } try { - $response = $this->_xmlElFactory->create(array($xmlResponse)); + $response = $this->_xmlElFactory->create(array('data' => $xmlResponse)); } catch (\Exception $e) { $debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode()); } @@ -1723,7 +1723,7 @@ XMLAuth; } try { - $response = $this->_xmlElFactory->create(array($xmlResponse)); + $response = $this->_xmlElFactory->create(array('data' => $xmlResponse)); } catch (\Exception $e) { $debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode()); $result->setErrors($e->getMessage()); diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Mode.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Mode.php index 7227bbb88e3..b943623f688 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Mode.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups/Source/Mode.php @@ -34,8 +34,11 @@ */ namespace Magento\Usa\Model\Shipping\Carrier\Ups\Source; -class Mode extends \Magento\Core\Model\Option\ArrayInterface +class Mode implements \Magento\Core\Model\Option\ArrayInterface { + /** + * @return array + */ public function toOptionArray() { return array( diff --git a/app/code/Magento/Usa/etc/adminhtml/system.xml b/app/code/Magento/Usa/etc/adminhtml/system.xml index ebb11831a4e..5819375f473 100644 --- a/app/code/Magento/Usa/etc/adminhtml/system.xml +++ b/app/code/Magento/Usa/etc/adminhtml/system.xml @@ -95,7 +95,7 @@ </field> <field id="shipment_requesttype" translate="label" type="select" sortOrder="85" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Packages Request Type</label> - <source_model>Magento\Usa\Model\Shipping\Carrier\CarrierAbstract\Source\Requesttype</source_model> + <source_model>Magento\Usa\Model\Shipping\Carrier\AbstractCarrier\Source\Requesttype</source_model> </field> <field id="shipment_type" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Shipment Type</label> @@ -213,7 +213,7 @@ </field> <field id="shipment_requesttype" translate="label" type="select" sortOrder="77" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Packages Request Type</label> - <source_model>Magento\Usa\Model\Shipping\Carrier\CarrierAbstract\Source\Requesttype</source_model> + <source_model>Magento\Usa\Model\Shipping\Carrier\AbstractCarrier\Source\Requesttype</source_model> </field> <field id="packaging" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Packaging</label> @@ -308,7 +308,7 @@ </field> <field id="shipment_requesttype" translate="label" type="select" sortOrder="47" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Packages Request Type</label> - <source_model>Magento\Usa\Model\Shipping\Carrier\CarrierAbstract\Source\Requesttype</source_model> + <source_model>Magento\Usa\Model\Shipping\Carrier\AbstractCarrier\Source\Requesttype</source_model> </field> <field id="container" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Container</label> @@ -423,7 +423,7 @@ <field id="mode_xml" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Mode</label> <comment>This enables or disables SSL verification of the Magento server by UPS.</comment> - <source_model>Magento\Usa\Model\Shipping\Carrier\CarrierAbstract\Source\Mode</source_model> + <source_model>Magento\Usa\Model\Shipping\Carrier\AbstractCarrier\Source\Mode</source_model> </field> <field id="debug" translate="label" type="select" sortOrder="920" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Debug</label> @@ -455,11 +455,11 @@ </field> <field id="mode" translate="label" type="select" sortOrder="54" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Mode</label> - <source_model>Magento\Usa\Model\Shipping\Carrier\CarrierAbstract\Source\Mode</source_model> + <source_model>Magento\Usa\Model\Shipping\Carrier\AbstractCarrier\Source\Mode</source_model> </field> <field id="shipment_requesttype" translate="label" type="select" sortOrder="55" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Packages Request Type</label> - <source_model>Magento\Usa\Model\Shipping\Carrier\CarrierAbstract\Source\Requesttype</source_model> + <source_model>Magento\Usa\Model\Shipping\Carrier\AbstractCarrier\Source\Requesttype</source_model> </field> <field id="container" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Container</label> diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php index a57564aa8d1..04ce6a8df50 100644 --- a/app/code/Magento/User/Model/User.php +++ b/app/code/Magento/User/Model/User.php @@ -226,7 +226,6 @@ class User '_emailInfoFactory', '_mailer', )); - return $properties; } public function __wakeup() diff --git a/app/code/Magento/Webapi/etc/di.xml b/app/code/Magento/Webapi/etc/di.xml index 9613f5019e8..6272d448a15 100644 --- a/app/code/Magento/Webapi/etc/di.xml +++ b/app/code/Magento/Webapi/etc/di.xml @@ -140,13 +140,13 @@ <value> <webapi_rest> <frontName>rest</frontName> - <front_controller>Mage_Webapi_Controller_Rest</front_controller> - <request_object>Mage_Webapi_Controller_Rest_Request</request_object> + <front_controller>Magento\Webapi\Controller\Rest</front_controller> + <request_object>Magento\Webapi\Controller\Rest\Request</request_object> </webapi_rest> <webapi_soap> <frontName>soap</frontName> - <front_controller>Mage_Webapi_Controller_Soap</front_controller> - <request_object>Mage_Webapi_Controller_Soap_Request</request_object> + <front_controller>Magento\Webapi\Controller\Soap</front_controller> + <request_object>Magento\Webapi\Controller\Soap\Request</request_object> </webapi_soap> </value> </param> diff --git a/app/code/Magento/Webhook/etc/module.xml b/app/code/Magento/Webhook/etc/module.xml index 4c84ad215b8..d935fd4b674 100755 --- a/app/code/Magento/Webhook/etc/module.xml +++ b/app/code/Magento/Webhook/etc/module.xml @@ -33,6 +33,8 @@ <module name="Magento_Core"/> <module name="Magento_Webapi"/> <module name="Magento_Backend"/> + <module name="Magento_Page"/> + <module name="Magento_Adminhtml"/> </depends> </module> </config> diff --git a/app/code/Magento/Weee/etc/module.xml b/app/code/Magento/Weee/etc/module.xml index 4df44d2becb..1d8ed69830e 100644 --- a/app/code/Magento/Weee/etc/module.xml +++ b/app/code/Magento/Weee/etc/module.xml @@ -41,6 +41,7 @@ <module name="Magento_Eav"/> <module name="Magento_Customer"/> <module name="Magento_Bundle"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Widget/etc/module.xml b/app/code/Magento/Widget/etc/module.xml index c0d25775770..9122cc76028 100755 --- a/app/code/Magento/Widget/etc/module.xml +++ b/app/code/Magento/Widget/etc/module.xml @@ -34,6 +34,7 @@ <module name="Magento_Core"/> <module name="Magento_Backend"/> <module name="Magento_Catalog"/> + <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/Wishlist/Model/Item.php b/app/code/Magento/Wishlist/Model/Item.php index 02fda5e05c2..e38005e80c8 100644 --- a/app/code/Magento/Wishlist/Model/Item.php +++ b/app/code/Magento/Wishlist/Model/Item.php @@ -775,7 +775,7 @@ class Item extends \Magento\Core\Model\AbstractModel return $this; } - $options = $this->_wishlOptCollFactory->addItemFilter($this); + $options = $this->_wishlOptCollFactory->create()->addItemFilter($this); if ($optionsFilter) { $options->addFieldToFilter('code', $optionsFilter); } diff --git a/app/code/Magento/Wishlist/etc/module.xml b/app/code/Magento/Wishlist/etc/module.xml index 480e39c67c9..f4ad413aaea 100755 --- a/app/code/Magento/Wishlist/etc/module.xml +++ b/app/code/Magento/Wishlist/etc/module.xml @@ -38,6 +38,7 @@ <module name="Magento_Adminhtml"/> <module name="Magento_CatalogInventory"/> <module name="Magento_Tax"/> + <module name="Magento_Backend"/> <module name="Magento_Bundle" type="soft"/> </depends> </module> diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/ResultTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/ResultTest.php index 38874635082..9990ef1a187 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/ResultTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/ResultTest.php @@ -40,9 +40,8 @@ class ResultTest extends \Magento\TestFramework\TestCase\AbstractController $this->dispatch('catalogsearch/result'); $responseBody = $this->getResponse()->getBody(); - - $this->assertNotContains('Search:', $responseBody); - $this->assertStringMatchesFormat('%aSuche%S:%a', $responseBody); + $this->assertNotContains('for="search">Search', $responseBody); + $this->assertStringMatchesFormat('%aSuche%S%a', $responseBody); $this->assertNotContains('Search entire store here...', $responseBody); $this->assertContains('Den gesamten Shop durchsuchen...', $responseBody); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php index dd328427aac..25af4cba213 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php @@ -55,7 +55,7 @@ class CartTest extends \Magento\TestFramework\TestCase\AbstractController 'Magento\Checkout\Model\Session' ); - $this->assertSelectCount('button.button.btn-cart[type="button"][title="Update Cart"]', 1, $response->getBody(), + $this->assertSelectCount('button[type="button"][title="Update Cart"]', 1, $response->getBody(), 'Response for simple product doesn\'t contain "Update Cart" button'); } @@ -82,7 +82,7 @@ class CartTest extends \Magento\TestFramework\TestCase\AbstractController 'Magento\Checkout\Model\Session' ); - $this->assertSelectCount('button.button.btn-cart[type="button"][title="Update Cart"]', 1, $response->getBody(), + $this->assertSelectCount('button[type="button"][title="Update Cart"]', 1, $response->getBody(), 'Response for simple product with custom option doesn\'t contain "Update Cart" button'); $this->assertSelectCount('input.product-custom-option[type="text"]', 1, $response->getBody(), @@ -112,7 +112,7 @@ class CartTest extends \Magento\TestFramework\TestCase\AbstractController 'Magento\Checkout\Model\Session' ); - $this->assertSelectCount('button.button.btn-cart[type="button"][title="Update Cart"]', 1, $response->getBody(), + $this->assertSelectCount('button[type="button"][title="Update Cart"]', 1, $response->getBody(), 'Response for bundle product doesn\'t contain "Update Cart" button'); } @@ -139,10 +139,10 @@ class CartTest extends \Magento\TestFramework\TestCase\AbstractController 'Magento\Checkout\Model\Session' ); - $this->assertSelectCount('button.button.btn-cart[type="button"][title="Update Cart"]', 1, $response->getBody(), + $this->assertSelectCount('button[type="button"][title="Update Cart"]', 1, $response->getBody(), 'Response for downloadable product doesn\'t contain "Update Cart" button'); - $this->assertSelectCount('ul#downloadable-links-list.options-list', 1, $response->getBody(), + $this->assertSelectCount('#downloadable-links-list', 1, $response->getBody(), 'Response for downloadable product doesn\'t contain links for download'); } @@ -169,7 +169,7 @@ class CartTest extends \Magento\TestFramework\TestCase\AbstractController 'Magento\Checkout\Model\Session' ); - $this->assertSelectCount('button.button.btn-cart[type="button"][title="Update Cart"]', 1, $response->getBody(), + $this->assertSelectCount('button[type="button"][title="Update Cart"]', 1, $response->getBody(), 'Response for configurable product doesn\'t contain "Update Cart" button'); $this->assertSelectCount('select.super-attribute-select', 1, $response->getBody(), diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php index 2b5ef3710d2..cca25c92aee 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php @@ -295,8 +295,8 @@ class LayoutTest extends \PHPUnit_Framework_TestCase public function testAddContainerInvalidHtmlTag() { $msg = 'Html tag "span" is forbidden for usage in containers. ' . - 'Consider to use one of the allowed: dd, div, dl, fieldset, header, hgroup, ol, p, section, table, ' . - 'tfoot, ul.'; + 'Consider to use one of the allowed: dd, div, dl, fieldset, header, ' . + 'footer, hgroup, ol, p, section, table, tfoot, ul.'; $this->setExpectedException('Magento\Exception', $msg); $this->_layout->addContainer('container', 'Container', array('htmlTag' => 'span')); } diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Controller/Adminhtml/Downloadable/FileTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Controller/Adminhtml/Downloadable/FileTest.php new file mode 100644 index 00000000000..1cd8c927bbb --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Downloadable/Controller/Adminhtml/Downloadable/FileTest.php @@ -0,0 +1,49 @@ +<?php +namespace Magento\Downloadable\Controller\Adminhtml\Downloadable; +/** + * Magento\Downloadable\Controller\Adminhtml\Downloadable\File + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @magentoAppArea adminhtml + */ +class FileTest extends \Magento\Backend\Utility\Controller +{ + public function testUploadAction() + { + copy(dirname(__DIR__) . '/_files/sample.txt', dirname(__DIR__) . '/_files/sample.tmp'); + $_FILES = array( + 'samples' => array( + 'name' => 'sample.txt', + 'type' => 'text/plain', + 'tmp_name' => dirname(__DIR__) . '/_files/sample.tmp', + 'error' => 0, + 'size' => 0 + ) + ); + + $this->dispatch('backend/admin/downloadable_file/upload/type/samples'); + $body = $this->getResponse()->getBody(); + $result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Helper\Data') + ->jsonDecode($body); + $this->assertEquals(0, $result['error']); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Controller/Adminhtml/_files/sample.txt b/dev/tests/integration/testsuite/Magento/Downloadable/Controller/Adminhtml/_files/sample.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php b/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php index 2801e0dbdb6..5eaa00a677e 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php @@ -39,15 +39,10 @@ class InstallerTest extends \PHPUnit_Framework_TestCase */ protected static $_tmpConfigFile = ''; - /** - * @var \Magento\Install\Model\Installer - */ - protected $_model; - public static function setUpBeforeClass() { self::$_tmpDir = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Dir') - ->getDir(\Magento\Core\Model\Dir::VAR_DIR) . DIRECTORY_SEPARATOR . __CLASS__; + ->getDir(\Magento\Core\Model\Dir::VAR_DIR) . DIRECTORY_SEPARATOR . 'InstallerTest'; self::$_tmpConfigFile = self::$_tmpDir . DIRECTORY_SEPARATOR . 'local.xml'; mkdir(self::$_tmpDir); } @@ -57,30 +52,27 @@ class InstallerTest extends \PHPUnit_Framework_TestCase \Magento\Io\File::rmdirRecursive(self::$_tmpDir); } - protected function setUp() - { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Install\Model\Installer'); - } - /** * Emulate configuration directory for the installer config model. * Method usage should be accompanied with '@magentoAppIsolation enabled' because of the object manager pollution. * - * @param string $dir + * @param bool $emulateConfig + * @return \Magento\Install\Model\Installer */ - protected function _emulateInstallerConfigDir($dir) + protected function _getModel($emulateConfig = false) { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $installerConfig = new \Magento\Install\Model\Installer\Config( - $objectManager->get('Magento\Install\Model\InstallerProxy'), - $objectManager->get('Magento\Core\Controller\Request\Http'), - new \Magento\Core\Model\Dir(__DIR__, array(), array(\Magento\Core\Model\Dir::CONFIG => $dir)), - $objectManager->get('Magento\Core\Model\Config\Resource'), - new \Magento\Filesystem(new \Magento\Filesystem\Adapter\Local()), - $objectManager->get('Magento\Core\Model\StoreManager') - ); - $objectManager->addSharedInstance($installerConfig, 'Magento\Install\Model\Installer\Config'); + if ($emulateConfig) { + $installerConfig = new \Magento\Install\Model\Installer\Config( + $objectManager->get('Magento\Install\Model\InstallerProxy'), + $objectManager->get('Magento\Core\Controller\Request\Http'), + new \Magento\Core\Model\Dir(__DIR__, array(), array(\Magento\Core\Model\Dir::CONFIG => self::$_tmpDir)), + new \Magento\Filesystem(new \Magento\Filesystem\Adapter\Local()), + $objectManager->get('Magento\Core\Model\StoreManager') + ); + $objectManager->addSharedInstance($installerConfig, 'Magento\Install\Model\Installer\Config'); + } + return $objectManager->create('Magento\Install\Model\Installer'); } /** @@ -103,7 +95,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase $user->loadByUsername($userName); $this->assertEmpty($user->getId()); - $this->_model->createAdministrator($userData + array('password' => $userPassword)); + $this->_getModel()->createAdministrator($userData + array('password' => $userPassword)); $user->loadByUsername($userName); $this->assertNotEmpty($user->getId()); @@ -122,16 +114,13 @@ class InstallerTest extends \PHPUnit_Framework_TestCase */ public function testInstallEncryptionKey() { - $this->_emulateInstallerConfigDir(self::$_tmpDir); - $keyPlaceholder = \Magento\Install\Model\Installer\Config::TMP_ENCRYPT_KEY_VALUE; $fixtureConfigData = "<key>$keyPlaceholder</key>"; $expectedConfigData = '<key>d41d8cd98f00b204e9800998ecf8427e</key>'; file_put_contents(self::$_tmpConfigFile, $fixtureConfigData); $this->assertEquals($fixtureConfigData, file_get_contents(self::$_tmpConfigFile)); - $this->markTestIncomplete('MAGETWO-13717'); - $this->_model->installEncryptionKey('d41d8cd98f00b204e9800998ecf8427e'); + $this->_getModel(true)->installEncryptionKey('d41d8cd98f00b204e9800998ecf8427e'); $this->assertEquals($expectedConfigData, file_get_contents(self::$_tmpConfigFile)); } @@ -142,11 +131,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase */ public function testInstallEncryptionKeySizeViolation() { - $this->markTestIncomplete('MAGETWO-13717'); - // isolate the application from the configuration pollution, if the test fails - $this->_emulateInstallerConfigDir(self::$_tmpDir); - - $this->_model->installEncryptionKey(str_repeat('a', 57)); + $this->_getModel(true)->installEncryptionKey(str_repeat('a', 57)); } /** @@ -155,7 +140,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase public function testGetValidEncryptionKey() { $validKey = 'abcdef1234567890'; - $this->assertEquals($validKey, $this->_model->getValidEncryptionKey($validKey)); + $this->assertEquals($validKey, $this->_getModel()->getValidEncryptionKey($validKey)); } /** @@ -165,8 +150,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase */ public function testGetValidEncryptionKeySizeViolation() { - $this->markTestIncomplete('MAGETWO-13717'); - $this->_model->getValidEncryptionKey(str_repeat('1', 57)); + $this->_getModel()->getValidEncryptionKey(str_repeat('1', 57)); } /** @@ -174,9 +158,10 @@ class InstallerTest extends \PHPUnit_Framework_TestCase */ public function testGetValidEncryptionKeyRandom() { - $actualKey = $this->_model->getValidEncryptionKey(); + $model = $this->_getModel(); + $actualKey = $model->getValidEncryptionKey(); $this->assertRegExp('/^[a-f0-9]{32}$/', $actualKey); - $this->assertNotEquals($actualKey, $this->_model->getValidEncryptionKey()); + $this->assertNotEquals($actualKey, $model->getValidEncryptionKey()); } /** @@ -185,11 +170,10 @@ class InstallerTest extends \PHPUnit_Framework_TestCase */ public function testFinish() { - $this->_emulateInstallerConfigDir(self::$_tmpDir); $configFile = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir() . '/etc/local.xml'; copy($configFile, self::$_tmpConfigFile); - $this->_model->finish(); + $this->_getModel(true)->finish(); /** @var $cacheState \Magento\Core\Model\Cache\StateInterface */ $cacheState = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php index f5fcd15bc89..f6a360bd8ac 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php @@ -163,7 +163,8 @@ class LayoutTest extends \PHPUnit_Framework_TestCase $errors = array(); foreach ($handles as $node) { if (!$node->xpath('@label')) { - $errors[] = $node->getName(); + $nodeId = $node->getAttribute('id') ? ' id=' . $node->getAttribute('id') : ''; + $errors[] = $node->getName() . $nodeId; } } if ($errors) { diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/UsaConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/UsaConfigFilesTest.php new file mode 100644 index 00000000000..6a40895fee7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/UsaConfigFilesTest.php @@ -0,0 +1,67 @@ +<?php +namespace Magento\Test\Integrity\Modular; + +/** + * Test configuration of Usa shipping carriers + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +class UsaConfigFilesTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Backend\Model\Config\Structure\Reader + */ + protected $_reader; + + protected function setUp() + { + $moduleReader = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Core\Model\Config\Modules\Reader'); + $schemaFile = $moduleReader->getModuleDir('etc', 'Magento_Backend') . '/system.xsd'; + $this->_reader = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create( + 'Magento\Backend\Model\Config\Structure\Reader', + array( + 'perFileSchema' => $schemaFile, + 'isValidated' => true, + ) + ); + } + + /** + * Tests that all source_models used in shipping are valid + */ + public function testValidateShippingSourceModels() + { + $config = $this->_reader->read('adminhtml'); + + $carriers = $config['config']['system']['sections']['carriers']['children']; + foreach ($carriers as $carrier) { + foreach ($carrier['children'] as $field) { + if (isset($field['source_model'])) { + $model = $field['source_model']; + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create($model); + } + } + } + } +} diff --git a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php index 1f631b58430..beb8d5f0a17 100644 --- a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php +++ b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php @@ -79,6 +79,16 @@ class CodeSniffer return class_exists('PHP_CodeSniffer_CLI'); } + /** + * Return the version of code sniffer found + * + * @return string + */ + public function version() + { + return $this->_wrapper->version(); + } + /** * Run tool for files cpecified * diff --git a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer/Wrapper.php b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer/Wrapper.php index ccca152f91f..9d56d361541 100644 --- a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer/Wrapper.php +++ b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer/Wrapper.php @@ -43,4 +43,19 @@ class Wrapper extends \PHP_CodeSniffer_CLI $this->values = $values; return $this; } + + /** + * Return the current version of php code sniffer + * + * @return string + */ + public function version() + { + $version = '0.0.0'; + if (defined('\PHP_CodeSniffer::VERSION')) { + $phpcs = new \PHP_CodeSniffer(); + $version = $phpcs::VERSION; + } + return $version; + } } diff --git a/dev/tests/static/framework/Magento/TestFramework/Dependency/LayoutRule.php b/dev/tests/static/framework/Magento/TestFramework/Dependency/LayoutRule.php index 5cbf0f19a63..06b09396f00 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Dependency/LayoutRule.php +++ b/dev/tests/static/framework/Magento/TestFramework/Dependency/LayoutRule.php @@ -232,7 +232,7 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface /** * Check dependencies for <block> element * - * Ex.: <block type="{name}"> + * Ex.: <block class="{name}"> * <block template="{path}"> * * @param $currentModule @@ -247,7 +247,7 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface { $patterns = array( \Magento\Test\Integrity\DependencyTest::TYPE_HARD => - '/(?<source><block.*type\s*=\s*[\'"](?<namespace>' . $this->_namespaces . ')[_\\\\]' + '/(?<source><block.*class\s*=\s*[\'"](?<namespace>' . $this->_namespaces . ')[_\\\\]' . '(?<module>[A-Z][a-zA-Z]+)[_\\\\](?:[A-Z][a-zA-Z]+[_\\\\]?){1,}[\'"].*>)/', \Magento\Test\Integrity\DependencyTest::TYPE_SOFT => '/(?<source><block.*template\s*=\s*[\'"](?<namespace>' . $this->_namespaces . ')[_\\\\]' diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php b/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php index cf6ecae8fce..7b216e89a8b 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php @@ -153,15 +153,15 @@ class Files /** * Returns list of files, where expected to have class declarations * + * @param bool $asDataSet * @return array */ - public function getClassFiles() + public function getClassFiles($asDataSet = true) { $key = __METHOD__ . $this->_path; if (isset(self::$_cache[$key])) { - return self::$_cache[$key]; - } - if (!isset(self::$_cache[$key])) { + $files = self::$_cache[$key]; + } elseif (!isset(self::$_cache[$key])) { $files = array_merge( self::_getFiles(array("{$this->_path}/app/code/Magento"), '*.php'), self::_getFiles(array("{$this->_path}/dev/tests"), '*.php'), @@ -170,10 +170,12 @@ class Files self::_getFiles(array("{$this->_path}/downloader/lib/Magento"), '*.php'), self::_getFiles(array("{$this->_path}/lib/Magento"), '*.php') ); + self::$_cache[$key] = $files; } - $result = self::composeDataSets($files); - self::$_cache[$key] = $result; - return $result; + if ($asDataSet) { + return self::composeDataSets($files); + } + return $files; } /** diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php index 9359200e15b..c1809ec194f 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php @@ -530,13 +530,19 @@ class ObsoleteCodeTest extends \PHPUnit_Framework_TestCase */ public function mageObsoleteDataProvider() { - $modules = include(__DIR__ . '/_files/' . 'mage_cleaned_modules.php'); - $result = array(); - foreach ($modules as $module) { - $result = array_merge_recursive( - $result, \Magento\TestFramework\Utility\Files::init()->getModulePhpFiles($module) - ); + $blackList = include( + __DIR__ . DIRECTORY_SEPARATOR .'_files' + . DIRECTORY_SEPARATOR . 'blacklist' + . DIRECTORY_SEPARATOR . 'obsolete_mage.php' + ); + $ignored = array(); + $appPath = \Magento\TestFramework\Utility\Files::init()->getPathToSource(); + foreach ($blackList as $file) { + $ignored[] = realpath($appPath . DIRECTORY_SEPARATOR . $file); } - return $result; + $files = \Magento\TestFramework\Utility\Files::init()->getClassFiles(false); + $files = array_map('realpath', $files); + $files = array_diff($files, $ignored); + return \Magento\TestFramework\Utility\Files::composeDataSets($files); } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/mage_cleaned_modules.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/blacklist/obsolete_mage.php similarity index 66% rename from dev/tests/static/testsuite/Magento/Test/Legacy/_files/mage_cleaned_modules.php rename to dev/tests/static/testsuite/Magento/Test/Legacy/_files/blacklist/obsolete_mage.php index ad0e9b1b414..fbaf6c66240 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/mage_cleaned_modules.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/blacklist/obsolete_mage.php @@ -22,15 +22,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ return array( - 'Invitation', - 'GiftCardAccount', - 'FullPageCache', - 'Authorizenet', - 'Backup', - //'Banner', Banner is commented because of ResourceHelper usage, which would be delivered later - 'GiftRegistry', - 'Reports', - 'Invitation', - //'Reminder' commented because of ResourceHelper usage, which would be delivered later - 'Install', + 'downloader/app/Magento/Downloader/Controller.php', + 'dev/tools/Magento/Tools/Translate/TranslateTool.php', + 'dev/tools/Magento/Tools/Translate/generate.php', + 'dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php', + 'dev/tests/static/framework/Magento/TestFramework/Dependency/TemplateRule.php', + 'downloader/app/Magento/Downloader/Model/Session.php', + 'downloader/lib/Magento/Backup/Db.php', + 'downloader/lib/Magento/Backup/Snapshot.php', ); 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 c5c94243904..d77cc99e43a 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 @@ -1006,4 +1006,10 @@ return array( array('Magento\Poll\Model\Resource\Poll\Collection'), array('Magento\Poll\Model\Resource\Poll\Vote'), array('Mage:'), + array('Magento\Backup', 'Magento\Backup\Factory'), + array('Magento\Sales\Model\Resource\Order\Attribute\Backend\Parent'), + array('Magento\Sales\Model\Resource\Order\Creditmemo\Attribute\Backend\Parent'), + array('Magento\Sales\Model\Resource\Order\Invoice\Attribute\Backend\Parent'), + array('Magento\Sales\Model\Resource\Order\Shipment\Attribute\Backend\Parent'), + array('Magento\Sales\Model\Resource\Quote\Address\Attribute\Backend\Parent'), ); 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 1f9d85db7a1..8932969888c 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 @@ -61,6 +61,9 @@ return array( ), array('DEFAULT_CURRENCY', 'Magento\Core\Model\Locale', 'Magento_Core_Model_LocaleInterface::DEFAULT_CURRENCY'), array('DEFAULT_ERROR_HANDLER', 'Magento\Core\Model\App'), + array('DEFAULT_READ_CONNECTION', 'Magento\Core\Model\Config\Resource'), + array('DEFAULT_WRITE_CONNECTION', 'Magento\Core\Model\Config\Resource'), + array('DEFAULT_ERROR_HANDLER', 'Mage'), array('DEFAULT_LOCALE', 'Magento\Core\Model\Locale', 'Magento_Core_Model_LocaleInterface::DEFAULT_LOCALE'), array('DEFAULT_THEME_NAME', 'Magento\Core\Model\Design\PackageInterface'), array('DEFAULT_THEME_NAME', 'Magento\Core\Model\Design\Package'), @@ -136,6 +139,7 @@ return array( array('XML_PATH_BACKEND_FRONTNAME', 'Mage_Backend_Helper_Data'), array('XML_PATH_CACHE_BETA_TYPES'), array('XML_PATH_CHECK_EXTENSIONS', 'Magento\Install\Model\Config'), + array('XML_PATH_CONNECTION_TYPE', 'Magento\Core\Model\Config\Resource'), array('XML_PATH_CONTEXT_MENU_LAYOUTS', 'Magento\VersionsCms\Model\Hierarchy\Config'), array('XML_PATH_COUNTRY_DEFAULT', 'Magento\Paypal\Model\System\Config\Backend\MerchantCountry'), array('XML_PATH_DEFAULT_COUNTRY', 'Magento\Core\Model\Locale'), 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 a1430b77bee..51568924024 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 @@ -739,7 +739,10 @@ return array( array('_prepareOptionValues', 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions'), array('_getOptionValuesCollection', 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions'), array(' _prepareSystemAttributeOptionValues', 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions'), - array('_prepareUserDefinedAttributeOptionValues', 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions'), + array( + '_prepareUserDefinedAttributeOptionValues', + 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions' + ), array('getLabelValues', 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions'), array('getStoreOptionValues', 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions'), array('getAttributeObject', 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions'), @@ -781,7 +784,11 @@ return array( array('_getProduct', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Crosssell', 'getProduct'), array('_getProduct', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Related', 'getProduct'), array('_getProduct', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Upsell', 'getProduct'), - array('_renderCellTemplate', 'Magento\Backend\Block\System\Config\Form\Field\Array\AbstractArray', 'renderCellTemplate'), + array( + '_renderCellTemplate', + 'Magento\Backend\Block\System\Config\Form\Field\Array\AbstractArray', + 'renderCellTemplate' + ), array('_showSingle', 'Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option', 'showSingle'), array('_getDefaultValues', 'Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option', 'getDefaultValues'), array('_isSelected', 'Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option', 'isSelected'), @@ -864,5 +871,8 @@ return array( array('getIsSerializable', 'Magento\Core\Model\App\State'), array('_getInventoryItemResource', 'Magento\Reports\Model\Resource\Product\Lowstock\Collection'), array('getMigrationInstance', 'Magento\Customer\Model\Resource\Setup', '$this->_migrationFactory->create()'), + array('turnOnReadCommittedMode', 'Magento\Backup\Model\Resource\Db'), + array('turnOnSerializableMode', 'Magento\Backup\Model\Resource\Db', 'prepareTransactionIsolationLevel'), array('_getResourceModel', '\Magento\Webapi\Model\Source\Acl\Role', '$this->_resource'), + array('_getSession', '\Magento\Adminhtml\Model\Giftmessage\Save', '$this->_session'), ); 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 ae22674417b..e2a46c7a088 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 @@ -100,4 +100,5 @@ return array( array('static', 'Magento\Core\Model\Email\Template\Filter'), array('_useAnalyticFunction'), array('_defaultIndexer', 'Magento\CatalogInventory\Model\Resource\Indexer\Stock'), + array('_engine', 'Magento\CatalogSearch\Model\Resource\Fulltext'), ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml index ee195ccf54c..b62dfb5e8c8 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml @@ -46,7 +46,7 @@ </words> <whitelist> <item> - <path>CHANGELOG.markdown</path> + <path>CHANGELOG.md</path> </item> <item> <path>app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.1-1.6.1.2.php</path> diff --git a/dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeStyleTest.php b/dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeStyleTest.php index d98fb38e74a..62a0318f787 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeStyleTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeStyleTest.php @@ -48,7 +48,7 @@ class CodeStyleTest extends \PHPUnit_Framework_TestCase self::$_reportFile = __DIR__ . '/../../../tmp/phpcs_report.xml'; $wrapper = new \Magento\TestFramework\CodingStandard\Tool\CodeSniffer\Wrapper(); self::$_cmd = new \Magento\TestFramework\CodingStandard\Tool\CodeSniffer( - realpath(__DIR__ . '/../CodeStyleTest/phpcs'), self::$_reportFile, $wrapper + realpath(__DIR__ . '/../_files/phpcs'), self::$_reportFile, $wrapper ); } diff --git a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php index 72733fd91ad..250a4e00101 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php @@ -46,28 +46,74 @@ class LiveCodeTest extends \PHPUnit_Framework_TestCase */ protected static $_blackList = array(); - public static function setUpBeforeClass() + public static function setUpBeforeClass() { self::$_reportDir = \Magento\TestFramework\Utility\Files::init()->getPathToSource() . '/dev/tests/static/report'; if (!is_dir(self::$_reportDir)) { mkdir(self::$_reportDir, 0777); } - self::$_whiteList = self::_readLists(__DIR__ . '/_files/whitelist/*.txt'); - self::$_blackList = self::_readLists(__DIR__ . '/_files/blacklist/*.txt'); + self::setupFileLists(); + } + + public static function setupFileLists($type = '') + { + if ($type != '' && !preg_match('/\/$/', $type)) { + $type = $type . '/'; + } + self::$_whiteList = self::_readLists(__DIR__ . '/_files/'.$type.'whitelist/*.txt'); + self::$_blackList = self::_readLists(__DIR__ . '/_files/'.$type.'blacklist/*.txt'); + } + + public function testCodeStylePsr2() + { + $this->markTestSkipped('Skipped'); + $reportFile = self::$_reportDir . '/phpcs_psr2_report.xml'; + $wrapper = new \Magento\TestFramework\CodingStandard\Tool\CodeSniffer\Wrapper(); + $codeSniffer = new \Magento\TestFramework\CodingStandard\Tool\CodeSniffer( + 'PSR2', + $reportFile, + $wrapper + ); + if (!$codeSniffer->canRun()) { + $this->markTestSkipped('PHP Code Sniffer is not installed.'); + } + if (version_compare($codeSniffer->version(), '1.4.7') === -1) { + $this->markTestSkipped('PHP Code Sniffer Build Too Old.'); + } + self::setupFileLists('phpcs'); + $result = $codeSniffer->run(self::$_whiteList, self::$_blackList, array('php')); + $this->assertFileExists($reportFile, 'Expected '.$reportFile.' to be created by phpcs run with PSR2 standard'); + // disabling the assertEquals below to allow the test to not fail but just report PSR2 violations to everyone. + // It should be uncommented once compliance is required. + /* + $this->assertEquals( + 0, + $result, + "PHP Code Sniffer has found $result error(s): See detailed report in $reportFile" + ); + */ + // Remove this echo when the assert can be uncommented out. + echo "PHP Code Sniffer has found $result error(s): See detailed report in $reportFile"; } public function testCodeStyle() { $reportFile = self::$_reportDir . '/phpcs_report.xml'; $wrapper = new \Magento\TestFramework\CodingStandard\Tool\CodeSniffer\Wrapper(); - $codeSniffer = new \Magento\TestFramework\CodingStandard\Tool\CodeSniffer(realpath(__DIR__ . '/_files/phpcs'), - $reportFile, $wrapper); + $codeSniffer = new \Magento\TestFramework\CodingStandard\Tool\CodeSniffer( + realpath(__DIR__ . '/_files/phpcs'), + $reportFile, + $wrapper + ); if (!$codeSniffer->canRun()) { $this->markTestSkipped('PHP Code Sniffer is not installed.'); } - $result = $codeSniffer->run(self::$_whiteList, self::$_blackList, array('php', 'phtml')); - $this->assertEquals(0, $result, + self::setupFileLists(); + $result = $codeSniffer->run(self::$_whiteList, self::$_blackList, array('php','phtml')); + $this->assertEquals( + 0, + $result, "PHP Code Sniffer has found $result error(s): See detailed report in $reportFile" ); } @@ -76,15 +122,18 @@ class LiveCodeTest extends \PHPUnit_Framework_TestCase { $reportFile = self::$_reportDir . '/phpmd_report.xml'; $codeMessDetector = new \Magento\TestFramework\CodingStandard\Tool\CodeMessDetector( - realpath(__DIR__ . '/_files/phpmd/ruleset.xml'), $reportFile + realpath(__DIR__ . '/_files/phpmd/ruleset.xml'), + $reportFile ); if (!$codeMessDetector->canRun()) { $this->markTestSkipped('PHP Mess Detector is not available.'); } + self::setupFileLists(); $this->assertEquals( - \PHP_PMD_TextUI_Command::EXIT_SUCCESS, $codeMessDetector->run(self::$_whiteList, self::$_blackList), + \PHP_PMD_TextUI_Command::EXIT_SUCCESS, + $codeMessDetector->run(self::$_whiteList, self::$_blackList), "PHP Code Mess has found error(s): See detailed report in $reportFile" ); } @@ -99,12 +148,14 @@ class LiveCodeTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('PHP Copy/Paste Detector is not available.'); } + self::setupFileLists(); $blackList = array(); foreach (glob(__DIR__ . '/_files/phpcpd/blacklist/*.txt') as $list) { $blackList = array_merge($blackList, file($list, FILE_IGNORE_NEW_LINES)); } - $this->assertTrue($copyPasteDetector->run(array(), $blackList), + $this->assertTrue( + $copyPasteDetector->run(array(), $blackList), "PHP Copy/Paste Detector has found error(s): See detailed report in $reportFile" ); } 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 81ec9c9c993..fa947c421f3 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 @@ -31,13 +31,18 @@ dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php dev/tests/unit/testsuite/Magento/Core/Model/TemplateEngine/_files lib/Magento/Archive lib/Magento/Autoload/Simple.php -lib/Magento/Backup.php lib/Magento/Backup lib/Magento/Cache/Backend/Database.php lib/Magento/Cache/Backend/Eaccelerator.php lib/Magento/Cache/Backend/Memcached.php lib/Magento/Cache/Core.php +lib/Magento/Code/Generator.php +lib/Magento/Code/Generator/EntityAbstract.php +lib/Magento/Code/Generator/Io.php lib/Magento/Connect +lib/Magento/Convert/ConvertException.php +lib/Magento/Convert/Mapper/Column.php +lib/Magento/Convert/Mapper/MapperInterface.php lib/Magento/DB lib/Magento/Data/Collection.php lib/Magento/Data/Collection/Db.php @@ -89,7 +94,6 @@ lib/Magento/Data/Tree/Node.php lib/Magento/Data/Tree/Node/Collection.php lib/Magento/Date.php lib/Magento/Debug.php -lib/Magento/Event.php lib/Magento/Event lib/Magento/File/Csv.php lib/Magento/File/CsvMulty.php @@ -105,16 +109,14 @@ lib/Magento/HTTP/Handler/Composite.php lib/Magento/HTTP/HandlerFactory.php lib/Magento/HTTP/HandlerInterface.php lib/Magento/HTTP/IClient.php -lib/Magento/Image.php lib/Magento/Image lib/Magento/Io -lib/Magento/Object.php lib/Magento/Object -lib/Magento/Pear.php lib/Magento/Pear lib/Magento/Simplexml lib/Magento/System lib/Magento/Util.php lib/Magento/Validator lib/Magento/Xml -dev/tools/Magento/Tools/I18n/Zend \ No newline at end of file +dev/tests/unit/testsuite/Magento/Code/Plugin/GeneratorTest/SimpleObjectManager.php +dev/tools/Magento/Tools/I18n/Zend 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 new file mode 100644 index 00000000000..b08b6286eb5 --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt @@ -0,0 +1,40 @@ +# Files or directories that are excluded from static code analysis for any reason +# Glob patterns are supported +# Overrides the white list +# +# Formatter intorduces long line +app/bootstrap.php +# Formatter intorduces long line +app/code/Magento/Adminhtml/Block/Catalog/Product/Edit/NewCategory.php +# Formatter intorduces long line +app/code/Magento/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Search.php +# Formatter intorduces long line +app/code/Magento/Adminhtml/Block/Catalog/Product/Helper/Form/Category.php +# Formatter intorduces long line +app/code/Magento/Adminhtml/Block/Catalog/Product/Helper/Form/Weight.php +# Formatter intorduces long line +app/code/Magento/Adminhtml/Block/Catalog/Product/Options/Ajax.php +# Formatter intorduces long line +app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php +# Formatter intorduces long line +app/code/Magento/Adminhtml/Block/Page/System/Config/Robots/Reset.php +# Formatter intorduces long line +app/code/Magento/Adminhtml/Block/System/Store/Edit.php +# Not magento code +app/code/Zend +# Not magento code +dev/tools/Magento/Tools/I18n/Zend +# Not required to scan build director +dev/build +# Not magento code +dev/tools/layout +# Not magento code +dev/tools/xml +# PSR-1 not applied to +dev/tests/functional +# PSR-1 not applied to +dev/tests/js +# Example files that are expected to fail code sniffer +dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeStyleTest/phpcs/input +# Example files that are expected to fail code mess detector +dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/whitelist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/whitelist/common.txt new file mode 100644 index 00000000000..899db1d4099 --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/whitelist/common.txt @@ -0,0 +1,9 @@ +# Files or directories that are included into php code sniffer analysis +# Glob patterns are supported +# +app/ +dev/ +index.php +lib/Magento +downloader/lib/Magento +downloader/app/Magento diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt index bf5beb02090..b3699045d21 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt @@ -158,7 +158,9 @@ dev/tests/performance dev/tests/static dev/tests/unit dev/tools +lib/Magento/Backup/Db +lib/Magento/Backup/Factory.php +lib/Magento/Cache/Core.php lib/Magento/Convert lib/Magento/Date.php lib/Magento/Object.php -lib/Magento/Cache/Core.php \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.php new file mode 100644 index 00000000000..7e109704e46 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Backend\Block\Widget\Grid\Column\Renderer\Radio; + +class ExtendedTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Extended + */ + protected $_object; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_converter; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_column; + + protected function setUp() + { + $context = $this->getMock('\Magento\Backend\Block\Context', array(), array(), '', false); + $this->_converter = $this->getMock( + '\Magento\Backend\Block\Widget\Grid\Column\Renderer\Options\Converter', + array('toFlatArray'), array(), '', false + ); + $this->_column = $this->getMock( + 'Magento\Backend\Block\Widget\Grid\Column', + array('getValues', 'getIndex', 'getHtmlName'), array(), '', false + ); + $this->_object = new Extended($context, $this->_converter); + $this->_object->setColumn($this->_column); + } + + /** + * @param array $rowData + * @param string $expectedResult + * @dataProvider renderDataProvider + */ + public function testRender(array $rowData, $expectedResult) + { + $selectedFlatArray = array( + 1 => 'One', + ); + $this->_column->expects($this->once())->method('getValues')->will($this->returnValue($selectedFlatArray)); + $this->_column->expects($this->once())->method('getIndex')->will($this->returnValue('label')); + $this->_column->expects($this->once())->method('getHtmlName')->will($this->returnValue('test[]')); + $this->_converter->expects($this->never())->method('toFlatArray'); + $this->assertEquals($expectedResult, $this->_object->render(new \Magento\Object($rowData))); + } + + public function renderDataProvider() + { + return array( + 'checked' => array( + array('id' => 1, 'label' => 'One'), + '<input type="radio" name="test[]" value="1" class="radio" checked="checked"/>' + ), + 'not checked' => array( + array('id' => 2, 'label' => 'Two'), + '<input type="radio" name="test[]" value="2" class="radio"/>' + ), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/RadioTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/RadioTest.php new file mode 100644 index 00000000000..d0830ac8379 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/RadioTest.php @@ -0,0 +1,96 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Backend\Block\Widget\Grid\Column\Renderer; + +class RadioTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Radio + */ + protected $_object; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_converter; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_column; + + protected function setUp() + { + $context = $this->getMock('\Magento\Backend\Block\Context', array(), array(), '', false); + $this->_converter = $this->getMock( + '\Magento\Backend\Block\Widget\Grid\Column\Renderer\Options\Converter', + array('toFlatArray'), array(), '', false + ); + $this->_column = $this->getMock( + 'Magento\Backend\Block\Widget\Grid\Column', + array('getValues', 'getIndex', 'getHtmlName'), array(), '', false + ); + $this->_object = new Radio($context, $this->_converter); + $this->_object->setColumn($this->_column); + } + + /** + * @param array $rowData + * @param string $expectedResult + * @dataProvider renderDataProvider + */ + public function testRender(array $rowData, $expectedResult) + { + $selectedTreeArray = array( + array('value' => 1, 'label' => 'One') + ); + $selectedFlatArray = array( + 1 => 'One', + ); + $this->_column->expects($this->once())->method('getValues')->will($this->returnValue($selectedTreeArray)); + $this->_column->expects($this->once())->method('getIndex')->will($this->returnValue('label')); + $this->_column->expects($this->once())->method('getHtmlName')->will($this->returnValue('test[]')); + $this->_converter + ->expects($this->once()) + ->method('toFlatArray') + ->with($selectedTreeArray) + ->will($this->returnValue($selectedFlatArray)) + ; + $this->assertEquals($expectedResult, $this->_object->render(new \Magento\Object($rowData))); + } + + public function renderDataProvider() + { + return array( + 'checked' => array( + array('id' => 1, 'label' => 'One'), + '<input type="radio" name="test[]" value="1" class="radio" checked="checked"/>' + ), + 'not checked' => array( + array('id' => 2, 'label' => 'Two'), + '<input type="radio" name="test[]" value="2" class="radio"/>' + ), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Backend/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Backend/Helper/DataTest.php index 1ea2e63b040..4090b7091b8 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Helper/DataTest.php @@ -56,9 +56,9 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->_configMock, $this->_primaryConfigMock, $this->getMock('Magento\Core\Model\RouterList', array(), array(), '', false), - $this->getMock('Magento\Core\Model\AppProxy', array(), array(), '', false), - $this->getMock('Magento\Backend\Model\UrlProxy', array(), array(), '', false), - $this->getMock('Magento\Backend\Model\AuthProxy', array(), array(), '', false), + $this->getMock('Magento\Core\Model\App', array(), array(), '', false), + $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false), + $this->getMock('Magento\Backend\Model\Auth', array(), array(), '', false), 'backend', 'custom_backend' ); @@ -72,9 +72,9 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->_configMock, $this->_primaryConfigMock, $this->getMock('Magento\Core\Model\RouterList', array(), array(), '', false), - $this->getMock('Magento\Core\Model\AppProxy', array(), array(), '', false), - $this->getMock('Magento\Backend\Model\UrlProxy', array(), array(), '', false), - $this->getMock('Magento\Backend\Model\AuthProxy', array(), array(), '', false), + $this->getMock('Magento\Core\Model\App', array(), array(), '', false), + $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false), + $this->getMock('Magento\Backend\Model\Auth', array(), array(), '', false), 'backend', '' ); 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 8ad86f23b72..52424a4e5b5 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 @@ -28,23 +28,40 @@ class EncryptedTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $_helperMock; + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_configMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_resourceMock; + /** @var \Magento\Backend\Model\Config\Backend\Encrypted */ protected $_model; protected function setUp() { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + + $eventDispatcherMock = $this->getMock('Magento\Core\Model\Event\Manager', array(), array(), '', false); $contextMock = $this->getMock('Magento\Core\Model\Context', array(), array(), '', false); - $this->_helperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $resourceMock = $this->getMock('Magento\Core\Model\Resource\AbstractResource', - array('_construct', '_getReadAdapter', '_getWriteAdapter', 'getIdFieldName'), - array(), '', false); - $collectionMock = $this->getMock('Magento\Data\Collection\Db', array(), array(), '', false); - $registry = $this->getMock('Magento\Core\Model\Registry'); - $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); - $coreConfig = $this->getMock('Magento\Core\Model\Config', array(), array(), '', false); - $this->_model = new \Magento\Backend\Model\Config\Backend\Encrypted( - $this->_helperMock, $contextMock, $registry, $storeManager, $coreConfig, $resourceMock, $collectionMock + $contextMock->expects($this->any()) + ->method('getEventDispatcher') + ->will($this->returnValue($eventDispatcherMock)); + $this->_resourceMock = $this->getMock( + 'Magento\Core\Model\Resource\AbstractResource', + array( + '_construct', '_getReadAdapter', '_getWriteAdapter', 'getIdFieldName', + 'beginTransaction', 'save', 'commit', 'addCommitCallback' + ), + array(), '', false ); + $this->_configMock = $this->getMock('Magento\Core\Model\Config', array(), array(), '', false); + $this->_helperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); + $this->_model = $helper->getObject('Magento\Backend\Model\Config\Backend\Encrypted', array( + 'coreData' => $this->_helperMock, + 'config' => $this->_configMock, + 'context' => $contextMock, + 'resource' => $this->_resourceMock, + )); } @@ -55,4 +72,46 @@ class EncryptedTest extends \PHPUnit_Framework_TestCase $this->_helperMock->expects($this->once())->method('decrypt')->with($value)->will($this->returnValue($result)); $this->assertEquals($result, $this->_model->processValue($value)); } + + /** + * @covers \Magento\Backend\Model\Config\Backend\Encrypted::_beforeSave + * @dataProvider beforeSaveDataProvider + * + * @param $value + * @param $valueToSave + */ + public function testBeforeSave($value, $valueToSave) + { + $this->_resourceMock->expects($this->any()) + ->method('addCommitCallback') + ->will($this->returnSelf()); + $this->_resourceMock->expects($this->any()) + ->method('commit') + ->will($this->returnSelf()); + + $this->_configMock->expects($this->any()) + ->method('getValue') + ->with('some/path') + ->will($this->returnValue('oldValue')); + $this->_helperMock->expects($this->once()) + ->method('encrypt') + ->with($valueToSave) + ->will($this->returnValue('encrypted')); + + $this->_model->setValue($value); + $this->_model->setPath('some/path'); + $this->_model->save(); + $this->assertEquals($this->_model->getValue(), 'encrypted'); + } + + /** + * @return array + */ + public function beforeSaveDataProvider() + { + return array( + array('****', 'oldValue'), + array('newValue', 'newValue'), + ); + } } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php index 105d03eb15d..a40d54bcd84 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php @@ -46,7 +46,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase protected $_areaFrontName = 'backendArea'; /** - * @var \Magento\Core\Model\Session|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Core\Model\SessionProxy|\PHPUnit_Framework_MockObject_MockObject */ protected $_coreSessionMock; @@ -87,7 +87,9 @@ class UrlTest extends \PHPUnit_Framework_TestCase $this->_menuConfigMock = $this->getMock('Magento\Backend\Model\Menu\Config', array(), array(), '', false); $this->_menuConfigMock->expects($this->any())->method('getMenu')->will($this->returnValue($this->_menuMock)); - $this->_coreSessionMock = $this->getMock('Magento\Core\Model\Session', array('getFormKey'), array(), '', false); + $this->_coreSessionMock = $this->getMock( + 'Magento\Core\Model\SessionProxy', array('getFormKey'), array(), '', false + ); $this->_coreSessionMock->expects($this->any())->method('getFormKey')->will($this->returnValue('salt')); $mockItem = $this->getMock('Magento\Backend\Model\Menu\Item', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Backup/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Backup/FactoryTest.php new file mode 100644 index 00000000000..17b87ef5bb3 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Backup/FactoryTest.php @@ -0,0 +1,81 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Backup + * @subpackage unit_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Backup; + +class FactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Backup\Factory + */ + protected $_model; + + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + protected function setUp() + { + $this->_objectManager = $this->getMock('Magento\ObjectManager'); + $this->_model = new \Magento\Backup\Factory($this->_objectManager); + } + + /** + * @expectedException \Magento\Exception + */ + public function testCreateWrongType() + { + $this->_model->create('WRONG_TYPE'); + } + + /** + * @param string $type + * @dataProvider allowedTypesDataProvider + */ + public function testCreate($type) + { + $this->_objectManager->expects($this->once()) + ->method('create') + ->will($this->returnValue('ModelInstance')); + + $this->assertEquals('ModelInstance', $this->_model->create($type)); + } + + /** + * @return array + */ + public function allowedTypesDataProvider() + { + return array( + array('db'), + array('snapshot'), + array('filesystem'), + array('media'), + array('nomedia'), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Backup/MediaTest.php b/dev/tests/unit/testsuite/Magento/Backup/MediaTest.php index 7e5cbbfca06..311c7cfb4aa 100644 --- a/dev/tests/unit/testsuite/Magento/Backup/MediaTest.php +++ b/dev/tests/unit/testsuite/Magento/Backup/MediaTest.php @@ -29,17 +29,31 @@ namespace Magento\Backup; class MediaTest extends \PHPUnit_Framework_TestCase { + /** + * @var \Magento\Core\Model\Dir + */ + protected $_dirMock; + + /** + * @var \Magento\Backup\Factory + */ + protected $_backupFactoryMock; + + protected function setUp() + { + $this->_dirMock = $this->getMock('Magento\Core\Model\Dir', array(), array(), '', false); + $this->_backupFactoryMock = $this->getMock('Magento\Backup\Factory', array(), array(), '', false); + } /** * @param string $action * @dataProvider actionProvider */ public function testAction($action) { - $dir = $this->getMock('Magento\Core\Model\Dir', array(), array(), '', false); $snapshot = $this->getMock( 'Magento\Backup\Snapshot', array('create', 'rollback', 'getDbBackupFilename'), - array($dir) + array($this->_dirMock, $this->_backupFactoryMock) ); $snapshot->expects($this->any()) ->method('create') @@ -85,8 +99,9 @@ class MediaTest extends \PHPUnit_Framework_TestCase */ public function testProxyMethod($method, $parameter) { - $dir = $this->getMock('Magento\Core\Model\Dir', array(), array(), '', false); - $snapshot = $this->getMock('Magento\Backup\Snapshot', array($method), array($dir)); + $snapshot = $this->getMock('Magento\Backup\Snapshot', + array($method), + array($this->_dirMock, $this->_backupFactoryMock)); $snapshot->expects($this->once()) ->method($method) ->with($parameter) diff --git a/dev/tests/unit/testsuite/Magento/Backup/NomediaTest.php b/dev/tests/unit/testsuite/Magento/Backup/NomediaTest.php index 3d08bdfdfdc..a4cdfd888d9 100644 --- a/dev/tests/unit/testsuite/Magento/Backup/NomediaTest.php +++ b/dev/tests/unit/testsuite/Magento/Backup/NomediaTest.php @@ -32,7 +32,8 @@ class NomediaTest extends \PHPUnit_Framework_TestCase public function testCreate() { $dir = $this->getMock('Magento\Core\Model\Dir', array(), array(), '', false); - $snapshot = $this->getMock('Magento\Backup\Snapshot', array('create'), array($dir)); + $backupFactory = $this->getMock('Magento\Backup\Factory', array(), array(), '', false); + $snapshot = $this->getMock('Magento\Backup\Snapshot', array('create'), array($dir, $backupFactory)); $snapshot->expects($this->any()) ->method('create') ->will($this->returnValue(true)); diff --git a/dev/tests/unit/testsuite/Magento/Backup/SnapshotTest.php b/dev/tests/unit/testsuite/Magento/Backup/SnapshotTest.php index 808ce0d2d2b..b7a2074e93f 100644 --- a/dev/tests/unit/testsuite/Magento/Backup/SnapshotTest.php +++ b/dev/tests/unit/testsuite/Magento/Backup/SnapshotTest.php @@ -32,14 +32,15 @@ class SnapshotTest extends \PHPUnit_Framework_TestCase public function testGetDbBackupFilename() { $dir = $this->getMock('Magento\Core\Model\Dir', array(), array(), '', false); - $manager = $this->getMock('Magento\Backup\Snapshot', array('getBackupFilename'), array($dir)); + $backupFactory = $this->getMock('Magento\Backup\Factory', array(), array(), '', false); + $manager = $this->getMock('Magento\Backup\Snapshot', array('getBackupFilename'), array($dir, $backupFactory)); $file = 'var/backup/2.gz'; $manager->expects($this->once()) ->method('getBackupFilename') ->will($this->returnValue($file)); - $model = new \Magento\Backup\Snapshot($dir); + $model = new \Magento\Backup\Snapshot($dir, $backupFactory); $model->setDbBackupManager($manager); $this->assertEquals($file, $model->getDbBackupFilename()); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Section/Reader/StoreTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Section/Reader/StoreTest.php index 49627f537e5..470e0c3b884 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Section/Reader/StoreTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Section/Reader/StoreTest.php @@ -113,7 +113,10 @@ class StoreTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($storeId)); $sectionMock = $this->getMock('Magento\Core\Model\Config\Data', array(), array(), '', false); - $sectionMock->expects($this->once())->method('getValue')->will($this->returnValue(array( + $sectionMock->expects($this->any())->method('getValue')->will($this->returnValue(array( + 'config' => array('key0' => 'website_value0', 'key1' => 'website_value1'), + ))); + $sectionMock->expects($this->once())->method('getSource')->will($this->returnValue(array( 'config' => array('key0' => 'website_value0', 'key1' => 'website_value1'), ))); $this->_sectionPullMock->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Section/Reader/WebsiteTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Section/Reader/WebsiteTest.php index 6c22a122418..2c89033c158 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Section/Reader/WebsiteTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Section/Reader/WebsiteTest.php @@ -93,11 +93,16 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase $websiteId = 1; $sectionMock = $this->getMock('Magento\Core\Model\Config\Data', array(), array(), '', false); - $sectionMock->expects($this->once()) + $sectionMock->expects($this->any()) ->method('getValue') ->will($this->returnValue(array( - 'config' => array('key0' => 'default_value0', 'key1' => 'default_value1'), - ))); + 'config' => array('key0' => 'default_value0', 'key1' => 'default_value1'), + ))); + $sectionMock->expects($this->once()) + ->method('getSource') + ->will($this->returnValue(array( + 'config' => array('key0' => 'default_value0', 'key1' => 'default_value1'), + ))); $this->_sectionPullMock->expects($this->once()) ->method('getSection') ->with('default', null) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Db/UpdaterTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Db/UpdaterTest.php new file mode 100644 index 00000000000..e15a7b6fedc --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Db/UpdaterTest.php @@ -0,0 +1,149 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Core\Model\Db; + +class UpdaterTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var PHPUnit_Framework_MockObject_MockObject + */ + protected $_factoryMock; + + /** + * @var PHPUnit_Framework_MockObject_MockObject + */ + protected $_appStateMock; + + /** + * @var PHPUnit_Framework_MockObject_MockObject + */ + protected $_resourceResolver; + + /** + * @var PHPUnit_Framework_MockObject_MockObject + */ + protected $_moduleListMock; + + /** + * @var PHPUnit_Framework_MockObject_MockObject + */ + protected $_resourceSetupMock; + + /** + * @var \Magento\Core\Model\Db\Updater + */ + protected $_model; + + protected function setUp() + { + $this->_factoryMock = $this->getMock('Magento\Core\Model\Resource\SetupFactory', array(), array(), '', false); + $this->_appStateMock = $this->getMock('Magento\Core\Model\App\State', array(), array(), '', false); + $this->_resourceResolver = $this->getMock('Magento\Core\Model\Module\ResourceResolverInterface'); + $this->_moduleListMock = $this->getMock('Magento\Core\Model\ModuleListInterface'); + $this->_resourceSetupMock = $this->getMock('Magento\Catalog\Model\Resource\Setup', array(), array(), '', false); + + $moduleList = array('Test_Module' => array()); + $this->_moduleListMock->expects($this->any()) + ->method('getModules') + ->will($this->returnValue($moduleList)); + + $resourceList = array('catalog_setup'); + $this->_resourceResolver->expects($this->any()) + ->method('getResourceList') + ->with('Test_Module') + ->will($this->returnValue($resourceList)); + + $createData = array( + 'resourceName' => 'catalog_setup', + 'moduleName' => 'Test_Module', + ); + $this->_factoryMock->expects($this->any()) + ->method('create') + ->with('Magento\Catalog\Model\Resource\Setup', $createData) + ->will($this->returnValue($this->_resourceSetupMock)); + + $this->_model = new \Magento\Core\Model\Db\Updater( + $this->_factoryMock, + $this->_appStateMock, + $this->_moduleListMock, + $this->_resourceResolver, + array('catalog_setup' => 'Magento\Catalog\Model\Resource\Setup'), + true + ); + } + + /** + * @covers \Magento\Core\Model\Db\Updater::updateScheme + */ + public function testUpdateSchemeWithUpdateSkip() + { + $this->_appStateMock->expects($this->once()) + ->method('isInstalled') + ->will($this->returnValue(true)); + + $this->_appStateMock->expects($this->never()) + ->method('setUpdateMode'); + + $this->_model->updateScheme(); + } + + /** + * @covers \Magento\Core\Model\Db\Updater::updateScheme + */ + public function testUpdateScheme() + { + $this->_appStateMock->expects($this->once()) + ->method('isInstalled') + ->will($this->returnValue(false)); + + $this->_appStateMock->expects($this->at(1)) + ->method('setUpdateMode') + ->with(true); + + $this->_appStateMock->expects($this->at(2)) + ->method('setUpdateMode') + ->with(false); + + $this->_resourceSetupMock->expects($this->once()) + ->method('applyUpdates'); + $this->_resourceSetupMock->expects($this->once()) + ->method('getCallAfterApplyAllUpdates') + ->will($this->returnValue(true)); + $this->_resourceSetupMock->expects($this->once()) + ->method('afterApplyAllUpdates'); + + $this->_model->updateScheme(); + } + + /** + * @covers \Magento\Core\Model\Db\Updater::updateData + */ + public function testUpdateData() + { + $this->_resourceSetupMock->expects($this->never()) + ->method('applyDataUpdates'); + + $this->_model->updateData(); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php index 97db444089f..f5c467a8271 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php @@ -151,7 +151,6 @@ class MigrationTest extends \PHPUnit_Framework_TestCase */ public function testAppendClassAliasReplace() { - $this->markTestIncomplete('Not merged'); $moduleListMock = $this->getMock('Magento\Core\Model\ModuleListInterface'); $moduleListMock->expects($this->once()) ->method('getModule') diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/UrlTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/UrlTest.php index 510805f8c92..4a1d9da6a78 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/UrlTest.php @@ -53,7 +53,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false, false), $this->getMock('Magento\Core\Model\App', array(), array(), '', false, false), $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false, false), - $this->getMock('Magento\Core\Model\Session', array(), array(), '', false, false) + $this->getMock('Magento\Core\Model\SessionProxy', array(), array(), '', false, false) ); } diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/XmlTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/XmlTest.php index 01e4d448f24..d04cf25080b 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/XmlTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/XmlTest.php @@ -76,7 +76,7 @@ class XmlTest extends \PHPUnit_Framework_TestCase 'schedule' => '* * * * *', 'instance' => 'Model2', 'method' => 'method2' - ) + ), ); $xmlFile = __DIR__ . '/../_files/crontab_valid.xml'; @@ -84,10 +84,7 @@ class XmlTest extends \PHPUnit_Framework_TestCase $dom->loadXML(file_get_contents($xmlFile)); $result = $this->_converter->convert($dom); - $this->assertEquals($expected['job1']['schedule'], $result['job1']['schedule']); - $this->assertEquals($expected['job1']['name'], $result['job1']['name']); - $this->assertEquals($expected['job1']['instance'], $result['job1']['instance']); - $this->assertEquals($expected['job1']['method'], $result['job1']['method']); + $this->assertEquals($expected, $result); } /** diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/_files/crontab_valid.xml b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/_files/crontab_valid.xml index 56c2ce7ae47..59cc71074e5 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/_files/crontab_valid.xml +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/_files/crontab_valid.xml @@ -27,4 +27,7 @@ <job name="job1" instance="Model1" method="method1"> <schedule>30 2 * * *</schedule> </job> + <job name="job2" instance="Model2" method="method2"> + <schedule>* * * * *</schedule> + </job> </config> 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 ca652ac5f2c..665afcf89e4 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php @@ -70,7 +70,7 @@ class NavigationModeTest extends \PHPUnit_Framework_TestCase $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); $app = $this->getMock('Magento\Core\Model\App', array(), array(), '', false); $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); - $session = $this->getMock('Magento\Core\Model\Session', array(), array(), '', false); + $session = $this->getMock('Magento\Core\Model\SessionProxy', array(), array(), '', false); $this->_model = new \Magento\DesignEditor\Model\Url\NavigationMode( $this->getMock('Magento\Core\Model\Url\SecurityInfoInterface'), diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/ConfigTest.php new file mode 100644 index 00000000000..773943fd472 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/ConfigTest.php @@ -0,0 +1,147 @@ +<?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_Eav + * @subpackage unit_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Test class for \Magento\Eav\Model\Entity\Attribute\Config + */ +namespace Magento\Eav\Model\Entity\Attribute; + +class ConfigTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Eav\Model\Entity\Attribute\Config + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_readerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_cacheMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_cacheId; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_attribute; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_entityType; + + protected function setUp() + { + $this->_attribute = $this->getMock('Magento\Eav\Model\Entity\Attribute', array(), array(), '', false); + $this->_entityType = $this->getMock('Magento\Eav\Model\Entity\Type', array(), array(), '', false); + $this->_readerMock = + $this->getMock('Magento\Eav\Model\Entity\Attribute\Config\Reader', array(), array(), '', false); + $this->_cacheMock = $this->getMock('Magento\Core\Model\Cache\Type\Config', array(), array(), '', false); + $this->_cacheId = 'eav_attributes'; + $this->_cacheMock->expects($this->once()) + ->method('load') + ->with($this->equalTo($this->_cacheId)) + ->will($this->returnValue(serialize(array()))); + + $this->_model = new \Magento\Eav\Model\Entity\Attribute\Config( + $this->_readerMock, + $this->_cacheMock, + $this->_cacheId + ); + } + + public function testGetLockedFieldsEmpty() + { + $this->_entityType->expects($this->once()) + ->method('getEntityTypeCode') + ->will($this->returnValue('test_code')); + $this->_attribute->expects($this->once()) + ->method('getEntityType') + ->will($this->returnValue($this->_entityType)); + + $this->_attribute->expects($this->once()) + ->method('getAttributeCode') + ->will($this->returnValue('attribute_code')); + $result = $this->_model->getLockedFields($this->_attribute); + $this->assertEquals(array(), $result); + } + + public function testGetLockedFields() + { + $this->_entityType->expects($this->once()) + ->method('getEntityTypeCode') + ->will($this->returnValue('test_code1/test_code2')); + $this->_attribute->expects($this->once()) + ->method('getEntityType') + ->will($this->returnValue($this->_entityType)); + + $this->_attribute->expects($this->once()) + ->method('getAttributeCode') + ->will($this->returnValue('test_code')); + $data = array( + 'test_code1' => array( + 'test_code2' => array( + 'attributes' => array( + 'test_code' => array( + 'test_code1' => 'test_code1' + ) + ) + ) + ) + ); + $this->_model->merge($data); + $result = $this->_model->getLockedFields($this->_attribute); + $this->assertEquals(array('test_code1' => 'test_code1'), $result); + } + + public function testGetEntityAttributesLockedFields() + { + $data = array( + 'entity_code' => array( + 'attributes' => array( + 'attribute_code' => array( + 'attribute_data' => array( + 'locked' => 'locked_field', + 'code' => 'code_test' + ) + ) + ) + ) + ); + $this->_model->merge($data); + $result = $this->_model->getEntityAttributesLockedFields('entity_code'); + $this->assertEquals(array('attribute_code' => array('code_test')), $result); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php index 135031d24e3..8b191267460 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php @@ -49,7 +49,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_tmpConfigFile = TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . 'local.xml'; $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); $this->_model = new \Magento\Install\Model\Installer\Config( - $this->getMock('Magento\Install\Model\InstallerProxy', array(), array(), + $this->getMock('Magento\Install\Model\Installer', array(), array(), '', false), $this->getMock('Magento\Core\Controller\Request\Http', array(), array(), '', false), new \Magento\Core\Model\Dir(__DIR__, array(), array(\Magento\Core\Model\Dir::CONFIG => TESTS_TEMP_DIR)), diff --git a/dev/tests/unit/testsuite/Magento/Persistent/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Persistent/Helper/DataTest.php new file mode 100644 index 00000000000..37934711f36 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Persistent/Helper/DataTest.php @@ -0,0 +1,55 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Persistent\Helper; + +class DataTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Core\Model\Config|PHPUnit_Framework_MockObject_MockObject + */ + protected $_configMock; + + /** + * @var \Magento\Persistent\Helper\Data + */ + protected $_helper; + + protected function setUp() + { + $this->_configMock = $this->getMock('\Magento\Core\Model\Config', array(), array(), '', false); + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_helper = $objectManager->getObject('\Magento\Persistent\Helper\Data', array( + 'config' => $this->_configMock, + )); + } + + public function testGetPersistentConfigFilePath() + { + $this->_configMock->expects($this->once())->method('getModuleDir') + ->with('etc', 'Magento_Persistent') + ->will($this->returnValue('path123')); + $this->assertEquals('path123'. DS . 'persistent.xml', $this->_helper->getPersistentConfigFilePath()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/JsTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/JsTest.php index 458fa6c5b8d..e929c30263c 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/JsTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/I18n/Code/Parser/Adapter/JsTest.php @@ -24,6 +24,8 @@ namespace Magento\Test\Tools\I18n\Code\Parser\Adapter; +use Magento\TestFramework\Helper\ObjectManager; + class JsTest extends \PHPUnit_Framework_TestCase { /** @@ -31,6 +33,11 @@ class JsTest extends \PHPUnit_Framework_TestCase */ protected $_testFile; + /** + * @var int + */ + protected $_stringsCount; + /** * @var \Magento\Tools\I18n\Code\Parser\Adapter\Js */ @@ -40,24 +47,23 @@ class JsTest extends \PHPUnit_Framework_TestCase { // dev/tests/unit/testsuite/tools/I18n/Parser/Adapter/_files/file.js $this->_testFile = str_replace('\\', '/', realpath(dirname(__FILE__))) . '/_files/file.js'; + $this->_stringsCount = count(file($this->_testFile)); - $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_adapter = $objectManagerHelper->getObject('Magento\Tools\I18n\Code\Parser\Adapter\Js'); + $this->_adapter = (new ObjectManager($this))->getObject('Magento\Tools\I18n\Code\Parser\Adapter\Js'); } public function testParse() { - $this->markTestSkipped('Lines move depending on license size in JS file'); $expectedResult = array( array( 'phrase' => 'Phrase 1', 'file' => $this->_testFile, - 'line' => 10, + 'line' => $this->_stringsCount - 2, ), array( 'phrase' => 'Phrase 2 %1', 'file' => $this->_testFile, - 'line' => 11, + 'line' => $this->_stringsCount - 1, ), ); diff --git a/dev/tools/Magento/Tools/Di/Code/Scanner/PhpScanner.php b/dev/tools/Magento/Tools/Di/Code/Scanner/PhpScanner.php index b7aad0f4387..ec6bc166fda 100644 --- a/dev/tools/Magento/Tools/Di/Code/Scanner/PhpScanner.php +++ b/dev/tools/Magento/Tools/Di/Code/Scanner/PhpScanner.php @@ -34,7 +34,7 @@ class PhpScanner extends FileScanner * @var string */ protected $_pattern = - '/[ \\b\n\'"\(\\\\]{1}([A-Z]{1}[a-zA-Z0-9]*\\\\[A-Z]{1}[a-zA-Z0-9\\\\]*(Factory))[ \\b\n\'"]{1}/'; + '/[ \\b\n\'"\(\\\\]{1}([A-Z]{1}[a-zA-Z0-9]*(\\\\|_)[A-Z]{1}[a-zA-Z0-9\\\\_]*(Factory))[ \\b\n\'"]{1}/'; /** * Prepare file content diff --git a/dev/tools/Magento/Tools/Di/compiler.php b/dev/tools/Magento/Tools/Di/compiler.php index 6ef22bf1d58..7d5aa886024 100644 --- a/dev/tools/Magento/Tools/Di/compiler.php +++ b/dev/tools/Magento/Tools/Di/compiler.php @@ -35,8 +35,7 @@ use Magento\Tools\Di\Compiler\Log\Log, $filePatterns = array( 'php' => '/.*\.php$/', 'etc' => '/\/app\/etc\/[a-z0-9\.]*\.xml$/', - 'config' => '/\/etc\/(config([a-z0-9\.]*)?|adminhtml\/system)\.xml$/', - 'di' => '/\/etc\/(di\/.*|adminhtml\/di|frontend\/di|di)\.xml$/', + 'di' => '/\/etc\/([a-zA-Z_]*\/di|di)\.xml$/', 'view' => '/\/view\/[a-z0-9A-Z\/\.]*\.xml$/', 'design' => '/\/app\/design\/[a-z0-9A-Z\/\._]*\.xml$/', ); @@ -79,7 +78,6 @@ try { $scanner = new Scanner\CompositeScanner(); $scanner->addChild(new Scanner\PhpScanner(), 'php'); $scanner->addChild(new Scanner\XmlScanner(), 'etc'); - $scanner->addChild(new Scanner\XmlScanner(), 'config'); $scanner->addChild(new Scanner\XmlScanner(), 'di'); $scanner->addChild(new Scanner\XmlScanner(), 'view'); $scanner->addChild(new Scanner\XmlScanner(), 'design'); diff --git a/dev/tools/Magento/Tools/I18n/Zend/Console/Getopt.php b/dev/tools/Magento/Tools/I18n/Zend/Console/Getopt.php index 0871abc7119..db10f86e6dd 100644 --- a/dev/tools/Magento/Tools/I18n/Zend/Console/Getopt.php +++ b/dev/tools/Magento/Tools/I18n/Zend/Console/Getopt.php @@ -1,6 +1,6 @@ <?php /** - * Zend\Console\Getopt is a class to parse options for command-line + * Zend_Console_Getopt is a class to parse options for command-line * applications. * * LICENSE @@ -21,7 +21,7 @@ */ /** - * Zend\Console\Getopt is a class to parse options for command-line + * Zend_Console_Getopt is a class to parse options for command-line * applications. * * Terminology: @@ -124,9 +124,7 @@ * @todo Feature request to implement callbacks. * e.g. if -a is specified, run function 'handleOptionA'(). */ -namespace Magento\Tools\I18n\Zend\Console; - -class Getopt +class Zend_Console_Getopt { /** diff --git a/dev/tools/Magento/Tools/I18n/Zend/Console/Getopt/Exception.php b/dev/tools/Magento/Tools/I18n/Zend/Console/Getopt/Exception.php index b0cd96a4323..84904318692 100644 --- a/dev/tools/Magento/Tools/I18n/Zend/Console/Getopt/Exception.php +++ b/dev/tools/Magento/Tools/I18n/Zend/Console/Getopt/Exception.php @@ -32,9 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -namespace Magento\Tools\I18n\Zend\Console\GetOpt; - -class Exception extends \Zend_Exception +class Zend_Console_Getopt_Exception extends Zend_Exception { /** * Usage diff --git a/dev/tools/Magento/Tools/I18n/Zend/Exception.php b/dev/tools/Magento/Tools/I18n/Zend/Exception.php index b5b8ea3420b..b5f648158ae 100644 --- a/dev/tools/Magento/Tools/I18n/Zend/Exception.php +++ b/dev/tools/Magento/Tools/I18n/Zend/Exception.php @@ -25,9 +25,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -namespace Magento\Tools\I18n\Zend; - -class Exception extends \Exception +class Zend_Exception extends Exception { /** * @var null|Exception diff --git a/lib/Magento/Backup/AbstractBackup.php b/lib/Magento/Backup/AbstractBackup.php index cae25a70114..43455adea38 100644 --- a/lib/Magento/Backup/AbstractBackup.php +++ b/lib/Magento/Backup/AbstractBackup.php @@ -32,7 +32,7 @@ */ namespace Magento\Backup; -abstract class AbstractBackup implements \Magento\Backup\BackupInterface +abstract class AbstractBackup implements \Magento\Backup\BackupInterface { /** * Backup name diff --git a/lib/Magento/Backup/Db.php b/lib/Magento/Backup/Db.php index 4d9ac6e05dc..879d9e01e8a 100644 --- a/lib/Magento/Backup/Db.php +++ b/lib/Magento/Backup/Db.php @@ -36,25 +36,16 @@ namespace Magento\Backup; class Db extends \Magento\Backup\AbstractBackup { /** - * @var \Magento\Backup\Model\BackupFactory + * @var \Magento\Backup\Db\BackupFactory */ protected $_backupFactory; /** - * @var \Magento\Backup\Model\DbFactory + * @param \Magento\Backup\Db\BackupFactory $backupFactory */ - protected $_backupDbFactory; - - /** - * @param \Magento\Backup\Model\BackupFactory $backupFactory - * @param \Magento\Backup\Model\DbFactory $backupDbFactory - */ - public function __construct( - \Magento\Backup\Model\BackupFactory $backupFactory, - \Magento\Backup\Model\DbFactory $backupDbFactory - ) { + public function __construct(\Magento\Backup\Db\BackupFactory $backupFactory) + { $this->_backupFactory = $backupFactory; - $this->_backupDbFactory = $backupDbFactory; } /** @@ -117,14 +108,13 @@ class Db extends \Magento\Backup\AbstractBackup $this->_lastOperationSucceed = false; - $backup = $this->_backupFactory - ->create() + $backup = $this->_backupFactory->createBackupModel() ->setTime($this->getTime()) ->setType($this->getType()) ->setPath($this->getBackupsDir()) ->setName($this->getName()); - $backupDb = $this->_backupDbFactory->create(); + $backupDb = $this->_backupFactory->createBackupDbModel(); $backupDb->createBackup($backup); $this->_lastOperationSucceed = true; diff --git a/app/code/Magento/Customer/Model/Attribute/Data.php b/lib/Magento/Backup/Db/BackupDbInterface.php similarity index 72% rename from app/code/Magento/Customer/Model/Attribute/Data.php rename to lib/Magento/Backup/Db/BackupDbInterface.php index 0b032f8a61d..fd18033fa6e 100644 --- a/app/code/Magento/Customer/Model/Attribute/Data.php +++ b/lib/Magento/Backup/Db/BackupDbInterface.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_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Backup\Db; - -/** - * Customer Attribute Data Factory - * Left for compatibility issues - * - * @category Magento - * @package Magento_Customer - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Customer\Model\Attribute; - -class Data extends \Magento\Eav\Model\Attribute\Data +interface BackupDbInterface { + /** + * Create DB backup + * + * @param BackupInterface $backup + * @return void + */ + public function createBackup(\Magento\Backup\Db\BackupInterface $backup); } diff --git a/lib/Magento/Backup/Db/BackupFactory.php b/lib/Magento/Backup/Db/BackupFactory.php new file mode 100644 index 00000000000..b2ebaf3cf07 --- /dev/null +++ b/lib/Magento/Backup/Db/BackupFactory.php @@ -0,0 +1,81 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Backup\Db; + +class BackupFactory +{ + /** + * Object manager + * + * @var \Magento\ObjectManager + */ + private $_objectManager; + + /** + * @var string + */ + private $_backupInstanceName; + + /** + * @var string + */ + private $_backupDbInstanceName; + + /** + * @param \Magento\ObjectManager $objectManager + * @param string $backupInstanceName + * @param string $backupDbInstanceName + */ + public function __construct( + \Magento\ObjectManager $objectManager, + $backupInstanceName, + $backupDbInstanceName + ) { + $this->_objectManager = $objectManager; + $this->_backupInstanceName = $backupInstanceName; + $this->_backupDbInstanceName = $backupDbInstanceName; + } + + /** + * Create backup model + * + * @param array $arguments + * @return \Magento\Backup\Db\BackupInterface + */ + public function createBackupModel(array $arguments = array()) + { + return $this->_objectManager->create($this->_backupInstanceName, $arguments); + } + + /** + * Create backup Db model + * + * @param array $arguments + * @return \Magento\Backup\Db\BackupDbInterface + */ + public function createBackupDbModel(array $arguments = array()) + { + return $this->_objectManager->create($this->_backupDbInstanceName, $arguments); + } +} diff --git a/lib/Magento/Backup/Db/BackupInterface.php b/lib/Magento/Backup/Db/BackupInterface.php new file mode 100644 index 00000000000..4c1e0ba5f2a --- /dev/null +++ b/lib/Magento/Backup/Db/BackupInterface.php @@ -0,0 +1,82 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Backup\Db; + +interface BackupInterface +{ + /** + * Set backup time + * + * @param int $time + * @return \Magento\Backup\Db\BackupInterface + */ + public function setTime($time); + + /** + * Set backup type + * + * @param string $type + * @return \Magento\Backup\Db\BackupInterface + */ + public function setType($type); + + /** + * Set backup path + * + * @param string $path + * @return \Magento\Backup\Db\BackupInterface + */ + public function setPath($path); + + /** + * Set backup name + * + * @param string $name + * @return \Magento\Backup\Db\BackupInterface + */ + public function setName($name); + + /** + * Open backup file (write or read mode) + * + * @param bool $write + * @return \Magento\Backup\Db\BackupInterface + */ + public function open($write = false); + + /** + * Write to backup file + * + * @param string $data + * @return \Magento\Backup\Db\BackupInterface + */ + public function write($data); + + /** + * Close open backup file + * + * @return \Magento\Backup\Db\BackupInterface + */ + public function close(); +} diff --git a/lib/Magento/Backup.php b/lib/Magento/Backup/Factory.php similarity index 52% rename from lib/Magento/Backup.php rename to lib/Magento/Backup/Factory.php index 6eb90f1ff81..4001ecf1d80 100644 --- a/lib/Magento/Backup.php +++ b/lib/Magento/Backup/Factory.php @@ -1,5 +1,7 @@ <?php /** + * Backup object factory. + * * Magento * * NOTICE OF LICENSE @@ -18,44 +20,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\Backup - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Class to work with backups - * - * @category Magento - * @package \Magento\Backup - * @author Magento Core Team <core@magentocommerce.com> + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento; +namespace Magento\Backup; -class Backup +class Factory { + /** + * Object manager + * + * @var \Magento\ObjectManager + */ + private $_objectManager; + /** * List of supported a backup types * * @var array */ - static protected $_allowedBackupTypes = array('db', 'snapshot', 'filesystem', 'media', 'nomedia'); + private $_allowedTypes = array('db', 'snapshot', 'filesystem', 'media', 'nomedia'); + + /** + * @param \Magento\ObjectManager $objectManager + */ + public function __construct(\Magento\ObjectManager $objectManager) + { + $this->_objectManager = $objectManager; + } /** - * get Backup Instance By File Name + * Create new backup instance * - * @param string $type + * @param string $type * @return \Magento\Backup\BackupInterface + * @throws \Magento\Exception */ - static public function getBackupInstance($type) + public function create($type) { - $class = '\\Magento\Backup_' . ucfirst($type); - - if (!in_array($type, self::$_allowedBackupTypes) || !class_exists($class, true)){ + if (!in_array($type, $this->_allowedTypes)) { throw new \Magento\Exception('Current implementation not supported this type (' . $type . ') of backup.'); } - - return new $class(); + $class = 'Magento\Backup\\' . ucfirst($type); + return $this->_objectManager->create($class); } } diff --git a/lib/Magento/Backup/Snapshot.php b/lib/Magento/Backup/Snapshot.php index 9f8403e88a5..33dc089bd3a 100644 --- a/lib/Magento/Backup/Snapshot.php +++ b/lib/Magento/Backup/Snapshot.php @@ -49,13 +49,21 @@ class Snapshot extends \Magento\Backup\Filesystem */ protected $_dirs; + /** + * @var \Magento\Backup\Factory + */ + protected $_backupFactory; + /** * @param \Magento\Core\Model\Dir $dirs + * @param \Magento\Backup\Factory $backupFactory */ public function __construct( - \Magento\Core\Model\Dir $dirs + \Magento\Core\Model\Dir $dirs, + \Magento\Backup\Factory $backupFactory ) { $this->_dirs = $dirs; + $this->_backupFactory = $backupFactory; } /** @@ -125,7 +133,7 @@ class Snapshot extends \Magento\Backup\Filesystem */ protected function _createDbBackupInstance() { - return \Magento\Backup::getBackupInstance(\Magento\Backup\Helper\Data::TYPE_DB) + return $this->_backupFactory->create(\Magento\Backup\Helper\Data::TYPE_DB) ->setBackupExtension('gz') ->setTime($this->getTime()) ->setBackupsDir($this->_dirs->getDir('var')) diff --git a/lib/Magento/DB/Tree.php b/lib/Magento/DB/Tree.php index 2a951ef5992..02ce4f3b87a 100644 --- a/lib/Magento/DB/Tree.php +++ b/lib/Magento/DB/Tree.php @@ -30,7 +30,7 @@ namespace Magento\DB; /** * Magento Library */ -require_once 'Magento/Db/Tree/Exception.php'; +require_once 'Magento/DB/Tree/TreeException.php'; class Tree { private $_id; diff --git a/pub/cron.php b/pub/cron.php index 5d40a46e991..93925197fa0 100644 --- a/pub/cron.php +++ b/pub/cron.php @@ -27,7 +27,7 @@ */ require dirname(__DIR__) . '/app/bootstrap.php'; -Magento_Profiler::start('magento'); +\Magento\Profiler::start('magento'); umask(0); try { @@ -42,4 +42,4 @@ try { print $e->getMessage() . "\n\n"; print $e->getTraceAsString(); } -Magento_Profiler::stop('magento'); +\Magento\Profiler::stop('magento'); diff --git a/pub/get.php b/pub/get.php index f195304f07b..e38e5587ded 100644 --- a/pub/get.php +++ b/pub/get.php @@ -76,8 +76,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_OPTIONS]['frontend_options']['disable_save'] = true; + $params[\Magento\Core\Model\App::PARAM_ALLOWED_MODULES] = array('Magento_Core'); + $params[\Magento\Core\Model\App::PARAM_CACHE_OPTIONS]['frontend_options']['disable_save'] = true; } $config = new \Magento\Core\Model\Config\Primary(dirname(__DIR__), $params); diff --git a/pub/index.php b/pub/index.php index 7501a91e369..056fd41c018 100644 --- a/pub/index.php +++ b/pub/index.php @@ -24,9 +24,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require __DIR__ . '/../app/bootstrap.php'; -Magento_Profiler::start('magento'); +\Magento\Profiler::start('magento'); $params = $_SERVER; $params[\Magento\Core\Model\App::PARAM_APP_URIS][\Magento\Core\Model\Dir::PUB] = ''; $entryPoint = new \Magento\Core\Model\EntryPoint\Http(new \Magento\Core\Model\Config\Primary(BP, $params)); $entryPoint->processRequest(); -Magento_Profiler::stop('magento'); +\Magento\Profiler::stop('magento'); diff --git a/pub/lib/mage/validation/dob-rule.js b/pub/lib/mage/validation/dob-rule.js index a7b1898b83a..6e8fe43ea74 100644 --- a/pub/lib/mage/validation/dob-rule.js +++ b/pub/lib/mage/validation/dob-rule.js @@ -28,10 +28,11 @@ $.validator.addMethod( 'validate-dob', function (val, element, params) { - $('.customer-dob').find('.' + this.settings.errorClass).removeClass(this.settings.errorClass); - var dayVal = $(params[0]).find('input:text').val(), - monthVal = $(params[1]).find('input:text').val(), - yearVal = $(params[2]).find('input:text').val(), + var dob = $(element).parents('.customer-dob'); + $(dob).find('.' + this.settings.errorClass).removeClass(this.settings.errorClass); + var dayVal = $(dob).find(params[0]).find('input:text').val(), + monthVal = $(dob).find(params[1]).find('input:text').val(), + yearVal = $(dob).find(params[2]).find('input:text').val(), dobLength = dayVal.length + monthVal.length + yearVal.length; if (params[3] && dobLength === 0) { this.dobErrorMessage = 'This is a required field.'; @@ -53,12 +54,14 @@ return false; } if (year < 1900 || year > curYear) { - this.dobErrorMessage = $.mage.__('Please enter a valid year (1900-%d).').replace('%d', curYear); + this.dobErrorMessage = + $.mage.__('Please enter a valid year (1900-%d).').replace('%d', curYear.toString()); return false; } var validateDayInMonth = new Date(year, month, 0).getDate(); if (day < 1 || day > validateDayInMonth) { - this.dobErrorMessage = $.mage.__('Please enter a valid day (1-%d).').replace('%d', validateDayInMonth); + this.dobErrorMessage = + $.mage.__('Please enter a valid day (1-%d).').replace('%d', validateDayInMonth.toString()); return false; } var today = new Date(), -- GitLab