From 3c0ab0523495cfdedc701e897f92bec1fec82836 Mon Sep 17 00:00:00 2001 From: mage2-team <mage2-team@magento.com> Date: Fri, 18 Oct 2013 06:55:48 -0700 Subject: [PATCH] 2.0.0.0-dev48 * Various improvements: * Added static integrity test for compilation of DI definitions * Lightweight replacement for PhpUnit data providers is implemented and involved in static and integrity tests with big data providers (primarily file lists) * Fixed bugs: * Fixed broken styles on front-end due to usage of nonexistent stylesheet * Fixed plugins configuration inheritance for proxy classes * Fixed OAuth consumer credentials expiry not being correctly calculated and added credentials HTTP post to the consumer endpoint * Fixed Namespace class references * Fixed error on creating shipment with bundle products * Fixed uninstallation via console installer * Fixed JavaScript error in bootstrap in IE8/9 * Fixed placing order within PayPal Payments Advanced and Payflow link * Fixed fatal error on placing order with Billing Agreement --- CHANGELOG.md | 16 + .../Adminhtml/Block/Report/Grid/Shopcart.php | 2 +- .../Block/Sales/Items/AbstractItems.php | 2 +- .../Sales/Order/Creditmemo/Create/Form.php | 2 +- .../Sales/Order/Creditmemo/Create/Items.php | 2 +- .../Block/Sales/Order/Invoice/Create.php | 2 +- .../View/Items/Renderer/DefaultRenderer.php | 2 +- .../Catalog/Product/Edit/Action/Attribute.php | 4 +- .../sales/order/create/giftmessage.js | 2 +- app/code/Magento/Backend/Helper/Data.php | 6 +- app/code/Magento/Backend/Model/Url.php | 14 +- app/code/Magento/Backend/etc/di.xml | 5 + .../Edit/Tab/Bundle/Option/Selection.php | 2 +- .../Adminhtml/Sales/Order/Items/Renderer.php | 2 +- .../Sales/Order/Pdf/Items/AbstractItems.php | 8 +- .../Magento/Captcha/Model/DefaultModel.php | 2 +- app/code/Magento/Catalog/Model/Layer.php | 2 +- .../Magento/CatalogSearch/Block/Result.php | 2 +- .../CatalogSearch/Model/Indexer/Fulltext.php | 4 +- .../Magento/CatalogSearch/Model/Layer.php | 8 +- .../layout/checkout_onepage_index.xml | 2 +- .../Checkout/Block/Multishipping/Overview.php | 2 +- .../Cms/view/frontend/layout/print.xml | 4 +- .../Core/Model/Config/Initial/Reader.php | 4 +- app/code/Magento/Core/Model/EntityFactory.php | 4 +- .../Core/Model/Resource/HelperPool.php | 2 - app/code/Magento/Core/Model/Url.php | 6 +- app/code/Magento/Cron/Model/Observer.php | 2 +- .../Address/Renderer/DefaultRenderer.php | 2 +- app/code/Magento/Customer/Helper/Data.php | 2 +- .../DesignEditor/Model/Url/NavigationMode.php | 4 +- .../Adminhtml/Sales/Order/View/Items.php | 2 +- .../Magento/GiftMessage/Model/Message.php | 2 +- .../Magento/GiftMessage/Model/TypeFactory.php | 2 +- .../Model/Api/Xml/AbstractXml.php | 8 +- .../GoogleCheckout/Model/Api/Xml/Callback.php | 10 +- .../GoogleCheckout/Model/Api/Xml/Order.php | 2 +- .../GoogleShopping/Model/MassOperations.php | 2 +- .../Model/Resource/Import/Data.php | 4 +- .../Install/Model/Installer/Db/AbstractDb.php | 31 +- .../Block/Adminhtml/Oauth/Consumer/Grid.php | 2 +- app/code/Magento/Oauth/Helper/Service.php | 21 - app/code/Magento/Oauth/Service/OauthV1.php | 101 ++-- .../Oauth/Service/OauthV1Interface.php | 1 - .../Magento/Oauth/etc/adminhtml/system.xml | 8 + app/code/Magento/Oauth/etc/config.xml | 2 + .../Paygate/Model/Authorizenet/Cards.php | 2 +- .../Payment/Model/Method/AbstractMethod.php | 20 +- app/code/Magento/Payment/Model/Method/Cc.php | 4 +- app/code/Magento/Paypal/Block/Iframe.php | 7 +- app/code/Magento/Paypal/Model/Hostedpro.php | 2 +- app/code/Magento/Paypal/Model/Standard.php | 2 +- .../Magento/Persistent/Model/Observer.php | 2 +- .../Reports/view/frontend/layout/print.xml | 2 +- .../Magento/Sales/Model/Billing/Agreement.php | 6 +- .../Model/Billing/Agreement/OrdersUpdater.php | 2 +- .../Magento/Sales/Model/Order/Payment.php | 2 +- .../Sales/Model/Order/Pdf/AbstractPdf.php | 2 +- .../Model/Resource/Rule/Quote/Collection.php | 2 +- .../Usa/Model/Shipping/Carrier/Fedex.php | 8 +- .../Webapi/Model/Soap/Server/Factory.php | 2 +- .../Widget/Instance/Edit/Tab/Main.php | 2 +- .../Widget/view/frontend/layout/default.xml | 4 +- .../Magento/Wishlist/Controller/Index.php | 2 +- app/code/Magento/Wishlist/Helper/Data.php | 4 +- app/code/Magento/Wishlist/etc/di.xml | 3 + app/etc/di.xml | 5 + dev/tests/integration/framework/bootstrap.php | 1 + .../Magento/Cache/Backend/MongoDbTest.php | 2 +- .../Config/_files/partialFieldsetFirst.xml | 4 +- .../Config/_files/partialFieldsetSecond.xml | 4 +- .../Model/LayoutArgumentObjectUpdater.php | 4 +- .../Magento/Install/Model/ConfigTest.php | 2 +- .../Magento/Test/Integrity/LayoutTest.php | 251 +++++----- .../Modular/BlockInstantiationTest.php | 43 +- .../Modular/LoggingConfigFilesTest.php | 61 --- .../Integrity/Modular/TemplateFilesTest.php | 47 +- .../Test/Integrity/Modular/ViewFilesTest.php | 70 +-- .../Test/Integrity/Theme/ViewFilesTest.php | 90 ++-- .../Dependency/_files/tables_ee.php | 108 ----- .../Integrity/AbstractConfig.php | 39 +- .../Utility/AggregateInvoker.php | 133 ++++++ .../Magento/TestFramework/Utility/Files.php | 78 ++- .../Magento/Test/Integrity/ClassesTest.php | 443 ++++++++++++------ .../Test/Integrity/Compiler/CompilerTest.php | 86 ++++ .../Magento/Test/Integrity/ConfigTest.php | 35 +- .../Magento/Test/Integrity/DependencyTest.php | 74 +-- .../Test/Integrity/Layout/BlocksTest.php | 57 ++- .../Test/Integrity/Layout/FilesTest.php | 29 +- .../Test/Integrity/Layout/HandlesTest.php | 159 ++++--- .../Integrity/Layout/ThemeHandlesTest.php | 27 +- .../Magento/Backend/SystemConfigTest.php | 39 +- .../Model/DataService/LayoutConfigTest.php | 60 +-- .../Model/DataService/SystemConfigTest.php | 46 +- .../Model/Fieldset/FieldsetConfigTest.php | 42 +- .../Integrity/Magento/Reward/LayoutTest.php | 61 --- .../Magento/Widget/WidgetConfigTest.php | 37 +- .../{Blacklist.php => NamespaceBlacklist.php} | 2 +- .../Test/Integrity/ReferenceBlacklist.php | 65 +++ .../Magento/Test/Js/LiveCodeTest.php | 34 +- .../Magento/Test/Legacy/ClassesTest.php | 111 ++--- .../Magento/Test/Legacy/ConfigTest.php | 47 +- .../Magento/Test/Legacy/EmailTemplateTest.php | 28 +- .../Magento/Test/Legacy/LayoutTest.php | 126 ++--- .../Magento/Test/Legacy/LicenseTest.php | 37 +- .../Magento/Bundle/Model/Product/TypeTest.php | 42 -- .../Model/Product/AbstractTypeTest.php | 70 --- .../Catalog/Model/Product/TypeTest.php | 47 -- .../Magento/Core/Block/AbstractBlockTest.php | 54 +-- .../Downloadable/Model/Product/TypeTest.php | 42 -- .../Legacy/Magento/Install/ConfigTest.php | 33 +- .../Test/Legacy/Magento/Widget/XmlTest.php | 64 +-- .../Magento/Test/Legacy/ObsoleteAclTest.php | 33 +- .../Magento/Test/Legacy/ObsoleteCodeTest.php | 159 +++---- .../Legacy/ObsoleteLayoutLocationTest.php | 31 +- .../Magento/Test/Legacy/ObsoleteMenuTest.php | 33 +- .../Magento/Test/Legacy/PhtmlTemplateTest.php | 47 +- .../Magento/Test/Legacy/TableTest.php | 46 +- .../Magento/Test/Legacy/WordsTest.php | 31 +- .../Test/Legacy/_files/obsolete_classes.php | 4 - .../Test/Legacy/_files/obsolete_constants.php | 1 - .../Test/Legacy/_files/obsolete_methods.php | 19 +- .../Test/Php/Exemplar/CodeMessTest.php | 46 +- .../Test/Php/Exemplar/CodeStyleTest.php | 59 ++- .../Magento/Test/Php/LiveCodeTest.php | 15 +- .../Php/_files/phpcpd/blacklist/common.txt | 4 - .../Magento/Test/Twig/TwigExtensionTest.php | 25 +- .../Config/Structure/AbstractElementTest.php | 4 +- .../Element/AbstractCompositeTest.php | 2 +- .../Model/Menu/Config/_files/valid_menu.xml | 2 +- .../Magento/Backend/Model/UrlTest.php | 6 +- .../Magento/Checkout/Block/Cart/LinkTest.php | 4 +- .../Magento/Checkout/Block/LinkTest.php | 2 +- .../Layout/Argument/Handler/ArrayTest.php | 2 +- .../Argument/Handler/_files/arguments.xml | 2 +- .../testsuite/Magento/Core/Model/UrlTest.php | 2 +- .../Form/Element/EditablemultiselectTest.php | 2 +- .../Model/Url/NavigationModeTest.php | 2 +- .../Install/Model/Installer/Db/Mysql4Test.php | 10 +- .../Magento/Oauth/Helper/ServiceTest.php | 17 - .../Magento/Oauth/Service/OauthV1Test.php | 53 ++- .../Magento/Tools/Di/Compiler/Log/Log.php | 17 +- dev/tools/Magento/Tools/Di/compiler.php | 6 +- dev/tools/xml/logging.xslt | 135 ------ dev/tools/xml/transform_logging.php | 40 -- downloader/lib/Magento/Archive.php | 4 +- .../lib/Magento/Backup/AbstractBackup.php | 4 +- .../Magento/Backup/Filesystem/Rollback/Fs.php | 2 +- .../Backup/Filesystem/Rollback/Ftp.php | 2 +- downloader/lib/Magento/Connect/Command.php | 2 +- lib/Magento/Archive.php | 4 +- lib/Magento/Cache/Backend/MongoDb.php | 8 +- lib/Magento/Connect/Command.php | 2 +- lib/Magento/DB/Adapter/Pdo/Mysql.php | 2 +- lib/Magento/DB/Tree.php | 4 +- lib/Magento/Data/Collection/Filesystem.php | 6 +- lib/Magento/Interception/Config/Config.php | 2 +- pub/lib/mage/backend/bootstrap.js | 4 +- pub/lib/mage/loader.js | 5 +- 159 files changed, 2130 insertions(+), 2122 deletions(-) delete mode 100644 dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LoggingConfigFilesTest.php delete mode 100644 dev/tests/static/framework/Magento/TestFramework/Dependency/_files/tables_ee.php create mode 100644 dev/tests/static/framework/Magento/TestFramework/Utility/AggregateInvoker.php create mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/Compiler/CompilerTest.php delete mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Reward/LayoutTest.php rename dev/tests/static/testsuite/Magento/Test/Integrity/{Blacklist.php => NamespaceBlacklist.php} (98%) create mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/ReferenceBlacklist.php delete mode 100644 dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Bundle/Model/Product/TypeTest.php delete mode 100644 dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Catalog/Model/Product/AbstractTypeTest.php delete mode 100644 dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Catalog/Model/Product/TypeTest.php delete mode 100644 dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Downloadable/Model/Product/TypeTest.php delete mode 100644 dev/tools/xml/logging.xslt delete mode 100644 dev/tools/xml/transform_logging.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ac4b53c083..b7f7f622f7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +2.0.0.0-dev48 +============= +* Various improvements: + * Added static integrity test for compilation of DI definitions + * Lightweight replacement for PhpUnit data providers is implemented and involved in static and integrity tests with big data providers (primarily file lists) +* Fixed bugs: + * Fixed broken styles on front-end due to usage of nonexistent stylesheet + * Fixed plugins configuration inheritance for proxy classes + * Fixed OAuth consumer credentials expiry not being correctly calculated and added credentials HTTP post to the consumer endpoint + * Fixed Namespace class references + * Fixed error on creating shipment with bundle products + * Fixed uninstallation via console installer + * Fixed JavaScript error in bootstrap in IE8/9 + * Fixed placing order within PayPal Payments Advanced and Payflow link + * Fixed fatal error on placing order with Billing Agreement + 2.0.0.0-dev47 ============= * Fixed bugs: diff --git a/app/code/Magento/Adminhtml/Block/Report/Grid/Shopcart.php b/app/code/Magento/Adminhtml/Block/Report/Grid/Shopcart.php index 5b11098881e..51b4fbd42d4 100644 --- a/app/code/Magento/Adminhtml/Block/Report/Grid/Shopcart.php +++ b/app/code/Magento/Adminhtml/Block/Report/Grid/Shopcart.php @@ -49,7 +49,7 @@ class Shopcart extends \Magento\Backend\Block\Widget\Grid\Extended * storeIds setter * * @param array $storeIds - * @return \Magento\Adminhtml\Block\Report\Grid\Shopcart\AbstractShopcart + * @return \Magento\Adminhtml\Block\Report\Grid\Shopcart */ public function setStoreIds($storeIds) { diff --git a/app/code/Magento/Adminhtml/Block/Sales/Items/AbstractItems.php b/app/code/Magento/Adminhtml/Block/Sales/Items/AbstractItems.php index b89df29da01..56f57a862b4 100644 --- a/app/code/Magento/Adminhtml/Block/Sales/Items/AbstractItems.php +++ b/app/code/Magento/Adminhtml/Block/Sales/Items/AbstractItems.php @@ -522,7 +522,7 @@ class AbstractItems extends \Magento\Backend\Block\Template /** * Retrieve invoice model instance * - * @return \Magento\Sales\Model\Invoice + * @return \Magento\Sales\Model\Order\Invoice */ public function getInvoice() { diff --git a/app/code/Magento/Adminhtml/Block/Sales/Order/Creditmemo/Create/Form.php b/app/code/Magento/Adminhtml/Block/Sales/Order/Creditmemo/Create/Form.php index e5636f2ecf2..40fc88025f7 100644 --- a/app/code/Magento/Adminhtml/Block/Sales/Order/Creditmemo/Create/Form.php +++ b/app/code/Magento/Adminhtml/Block/Sales/Order/Creditmemo/Create/Form.php @@ -55,7 +55,7 @@ class Form extends \Magento\Adminhtml\Block\Sales\Order\AbstractOrder /** * Retrieve creditmemo model instance * - * @return \Magento\Sales\Model\Creditmemo + * @return \Magento\Sales\Model\Order\Creditmemo */ public function getCreditmemo() { diff --git a/app/code/Magento/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php b/app/code/Magento/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php index 309c36a77e2..3895f7c714e 100644 --- a/app/code/Magento/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php +++ b/app/code/Magento/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php @@ -150,7 +150,7 @@ class Items extends \Magento\Adminhtml\Block\Sales\Items\AbstractItems /** * Retrieve creditmemo model instance * - * @return \Magento\Sales\Model\Creditmemo + * @return \Magento\Sales\Model\Order\Creditmemo */ public function getCreditmemo() { diff --git a/app/code/Magento/Adminhtml/Block/Sales/Order/Invoice/Create.php b/app/code/Magento/Adminhtml/Block/Sales/Order/Invoice/Create.php index 9534b31d64a..5643e2ba1d7 100644 --- a/app/code/Magento/Adminhtml/Block/Sales/Order/Invoice/Create.php +++ b/app/code/Magento/Adminhtml/Block/Sales/Order/Invoice/Create.php @@ -70,7 +70,7 @@ class Create extends \Magento\Adminhtml\Block\Widget\Form\Container /** * Retrieve invoice model instance * - * @return \Magento\Sales\Model\Invoice + * @return \Magento\Sales\Model\Order\Invoice */ public function getInvoice() { diff --git a/app/code/Magento/Adminhtml/Block/Sales/Order/View/Items/Renderer/DefaultRenderer.php b/app/code/Magento/Adminhtml/Block/Sales/Order/View/Items/Renderer/DefaultRenderer.php index d96c0f590ea..54411ea36fb 100644 --- a/app/code/Magento/Adminhtml/Block/Sales/Order/View/Items/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Adminhtml/Block/Sales/Order/View/Items/Renderer/DefaultRenderer.php @@ -138,7 +138,7 @@ class DefaultRenderer extends \Magento\Adminhtml\Block\Sales\Items\AbstractItems /** * Initialize gift message for entity * - * @return \Magento\Adminhtml\Block\Sales\Order_Edit_Items_Grid_Renderer_Name_Giftmessage + * @return \Magento\Adminhtml\Block\Sales\Order\View\Giftmessage */ protected function _initMessage() { 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 a3a4cb0b83a..a0c32c8a951 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,7 +76,7 @@ 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\App $app + * @param \Magento\Core\Model\AppInterface $app * @param \Magento\Backend\Model\Url $backendUrl * @param \Magento\Backend\Model\Auth $auth * @param string $defaultAreaFrontName @@ -91,7 +91,7 @@ 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\App $app, + \Magento\Core\Model\AppInterface $app, \Magento\Backend\Model\Url $backendUrl, \Magento\Backend\Model\Auth $auth, $defaultAreaFrontName, diff --git a/app/code/Magento/Adminhtml/view/adminhtml/sales/order/create/giftmessage.js b/app/code/Magento/Adminhtml/view/adminhtml/sales/order/create/giftmessage.js index 68e4b696d8b..c6495714b57 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/sales/order/create/giftmessage.js +++ b/app/code/Magento/Adminhtml/view/adminhtml/sales/order/create/giftmessage.js @@ -146,7 +146,7 @@ GiftOptionsPopup.prototype = { Event.observe(el, 'click', this.showItemGiftOptions.bind(this)); }, this); - // Move giftcard popup to start of body, because soon it will contain FORM tag that can break DOM layout if within other FORM + // Move gift options popup to start of body, because soon it will contain FORM tag that can break DOM layout if within other FORM var oldPopupContainer = $('gift_options_configure'); if (oldPopupContainer) { oldPopupContainer.remove(); diff --git a/app/code/Magento/Backend/Helper/Data.php b/app/code/Magento/Backend/Helper/Data.php index 49c592ab83a..b15851ab5ac 100644 --- a/app/code/Magento/Backend/Helper/Data.php +++ b/app/code/Magento/Backend/Helper/Data.php @@ -75,7 +75,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper protected $_coreData = null; /** - * @var \Magento\Core\Model\App + * @var \Magento\Core\Model\AppInterface */ protected $_app; @@ -102,7 +102,7 @@ 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\App $app + * @param \Magento\Core\Model\AppInterface $app * @param \Magento\Backend\Model\Url $backendUrl * @param \Magento\Backend\Model\Auth $auth * @param string $defaultAreaFrontName @@ -116,7 +116,7 @@ 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\App $app, + \Magento\Core\Model\AppInterface $app, \Magento\Backend\Model\Url $backendUrl, \Magento\Backend\Model\Auth $auth, $defaultAreaFrontName, diff --git a/app/code/Magento/Backend/Model/Url.php b/app/code/Magento/Backend/Model/Url.php index 418429b123f..f3f8cd929ff 100644 --- a/app/code/Magento/Backend/Model/Url.php +++ b/app/code/Magento/Backend/Model/Url.php @@ -46,7 +46,7 @@ class Url extends \Magento\Core\Model\Url /** * Authentication session * - * @var \Magento\Backend\Model\Auth\SessionProxy + * @var \Magento\Backend\Model\Auth\Session */ protected $_session; @@ -92,13 +92,13 @@ 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\SessionProxy $coreSession + * @param \Magento\Core\Model\Session $session * @param \Magento\Backend\Model\Menu\Config $menuConfig * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\App $app * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\CacheInterface $cache - * @param \Magento\Backend\Model\Auth\SessionProxy $authSession + * @param \Magento\Backend\Model\Auth\Session $authSession * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -107,19 +107,19 @@ 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\SessionProxy $coreSession, + \Magento\Core\Model\Session $session, \Magento\Backend\Model\Menu\Config $menuConfig, \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\App $app, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\CacheInterface $cache, - \Magento\Backend\Model\Auth\SessionProxy $authSession, + \Magento\Backend\Model\Auth\Session $authSession, array $data = array() ) { - parent::__construct($securityInfo, $coreStoreConfig, $coreData, $app, $storeManager, $coreSession, $data); + parent::__construct($securityInfo, $coreStoreConfig, $coreData, $app, $storeManager, $session, $data); $this->_startupMenuItemId = $coreStoreConfig->getConfig(self::XML_PATH_STARTUP_MENU_ITEM); $this->_backendHelper = $backendHelper; - $this->_coreSession = $coreSession; + $this->_coreSession = $session; $this->_menuConfig = $menuConfig; $this->_cache = $cache; $this->_session = $authSession; diff --git a/app/code/Magento/Backend/etc/di.xml b/app/code/Magento/Backend/etc/di.xml index 8dce71cd371..7e5f09bf18f 100644 --- a/app/code/Magento/Backend/etc/di.xml +++ b/app/code/Magento/Backend/etc/di.xml @@ -98,4 +98,9 @@ <instance type="Magento\Backend\Model\Url\Proxy" /> </param> </type> + <type name="Magento\Backend\Model\Url"> + <param name="authSession"> + <instance type="Magento\Backend\Model\Auth\Session\Proxy" /> + </param> + </type> </config> diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php index 5571f1461f0..79089972258 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php @@ -120,7 +120,7 @@ class Selection /** * Prepare block layout * - * @return \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle_Option_Selection + * @return \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option\Selection */ protected function _prepareLayout() { diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php b/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php index 7dca4dd4fe5..433b86b84b7 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php @@ -181,7 +181,7 @@ class Renderer extends \Magento\Adminhtml\Block\Sales\Items\Renderer\DefaultRend public function getOrderItem() { - if ($this->getItem() instanceof \Magento\Sales\Order\Item) { + if ($this->getItem() instanceof \Magento\Sales\Model\Order\Item) { return $this->getItem(); } else { return $this->getItem()->getOrderItem(); diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php index 47c858ce090..a1f5c6d7400 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php @@ -231,11 +231,11 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra /** * Retrieve Order Item * - * @return \Magento\Sales\Order\Item + * @return \Magento\Sales\Model\Order\Item */ public function getOrderItem() { - if ($this->getItem() instanceof \Magento\Sales\Order\Item) { + if ($this->getItem() instanceof \Magento\Sales\Model\Order\Item) { return $this->getItem(); } else { return $this->getItem()->getOrderItem(); @@ -245,7 +245,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra /** * Retrieve Value HTML * - * @param \Magento\Sales\Order\Item $item + * @param \Magento\Sales\Model\Order\Item $item * @return string */ public function getValueHtml($item) @@ -269,7 +269,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra /** * Can show price info for item * - * @param \Magento\Sales\Order\Item $item + * @param \Magento\Sales\Model\Order\Item $item * @return bool */ public function canShowPriceInfo($item) diff --git a/app/code/Magento/Captcha/Model/DefaultModel.php b/app/code/Magento/Captcha/Model/DefaultModel.php index a9ab13af730..41dd3076133 100644 --- a/app/code/Magento/Captcha/Model/DefaultModel.php +++ b/app/code/Magento/Captcha/Model/DefaultModel.php @@ -497,7 +497,7 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model /** * Set captcha word * - * @return \Magento\Captcha\Model\Zend + * @return \Magento\Captcha\Model\DefaultModel */ protected function _clearWord() { diff --git a/app/code/Magento/Catalog/Model/Layer.php b/app/code/Magento/Catalog/Model/Layer.php index fb305ec9b45..9d2ebb18491 100644 --- a/app/code/Magento/Catalog/Model/Layer.php +++ b/app/code/Magento/Catalog/Model/Layer.php @@ -301,7 +301,7 @@ class Layer extends \Magento\Object /** * Get collection of all filterable attributes for layer products set * - * @return \Magento\Catalog\Model\Resource\Attribute\Collection + * @return \Magento\Catalog\Model\Resource\Product\Attribute\Collection */ public function getFilterableAttributes() { diff --git a/app/code/Magento/CatalogSearch/Block/Result.php b/app/code/Magento/CatalogSearch/Block/Result.php index 596334785a6..b6559296ef6 100644 --- a/app/code/Magento/CatalogSearch/Block/Result.php +++ b/app/code/Magento/CatalogSearch/Block/Result.php @@ -140,7 +140,7 @@ class Result extends \Magento\Core\Block\Template /** * Retrieve search list toolbar block * - * @return \Magento\Catalog\Block\Product\ProductList + * @return \Magento\Catalog\Block\Product\ListProduct */ public function getListBlock() { diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php index d9504c457ca..79f21f23770 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php @@ -290,7 +290,7 @@ class Fulltext extends \Magento\Index\Model\Indexer\AbstractIndexer * Get data required for category'es products reindex * * @param \Magento\Index\Model\Event $event - * @return \Magento\CatalogSearch\Model\Indexer\Search + * @return \Magento\CatalogSearch\Model\Indexer\Fulltext */ protected function _registerCatalogCategoryEvent(\Magento\Index\Model\Event $event) { @@ -321,7 +321,7 @@ class Fulltext extends \Magento\Index\Model\Indexer\AbstractIndexer * Register data required by catatalog product process in event object * * @param \Magento\Index\Model\Event $event - * @return \Magento\CatalogSearch\Model\Indexer\Search + * @return \Magento\CatalogSearch\Model\Indexer\Fulltext */ protected function _registerCatalogProductEvent(\Magento\Index\Model\Event $event) { diff --git a/app/code/Magento/CatalogSearch/Model/Layer.php b/app/code/Magento/CatalogSearch/Model/Layer.php index b33f0d1f990..1657e93cd1f 100644 --- a/app/code/Magento/CatalogSearch/Model/Layer.php +++ b/app/code/Magento/CatalogSearch/Model/Layer.php @@ -107,7 +107,7 @@ class Layer extends \Magento\Catalog\Model\Layer /** * Get current layer product collection * - * @return \Magento\Catalog\Model\Resource\Eav\Resource\Product\Collection + * @return \Magento\Catalog\Model\Resource\Product\Attribute\Collection */ public function getProductCollection() { @@ -124,7 +124,7 @@ class Layer extends \Magento\Catalog\Model\Layer /** * Prepare product collection * - * @param \Magento\Catalog\Model\Resource\Eav\Resource\Product\Collection $collection + * @param \Magento\Catalog\Model\Resource\Product\Attribute\Collection $collection * @return \Magento\Catalog\Model\Layer */ public function prepareProductCollection($collection) @@ -173,8 +173,8 @@ class Layer extends \Magento\Catalog\Model\Layer /** * Add filters to attribute collection * - * @param \Magento\Catalog\Model\Resource\Eav\Resource\Product\Attribute\Collection $collection - * @return \Magento\Catalog\Model\Resource\Eav\Resource\Product\Attribute\Collection + * @param \Magento\Catalog\Model\Resource\Product\Attribute\Collection $collection + * @return \Magento\Catalog\Model\Resource\Product\Attribute\Collection */ protected function _prepareAttributeCollection($collection) { diff --git a/app/code/Magento/Centinel/view/frontend/layout/checkout_onepage_index.xml b/app/code/Magento/Centinel/view/frontend/layout/checkout_onepage_index.xml index 6f9a38b060e..e628bff7868 100644 --- a/app/code/Magento/Centinel/view/frontend/layout/checkout_onepage_index.xml +++ b/app/code/Magento/Centinel/view/frontend/layout/checkout_onepage_index.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceBlock name="head"> - <block class="Magento\Page\Block\Html\Head\Script" name="magento-pbridge-js-pbridge-js"> + <block class="Magento\Page\Block\Html\Head\Script" name="magento-centinel-centinel-authenticate-js"> <arguments> <argument name="file" xsi:type="string">Magento_Centinel::centinel-authenticate.js</argument> </arguments> diff --git a/app/code/Magento/Checkout/Block/Multishipping/Overview.php b/app/code/Magento/Checkout/Block/Multishipping/Overview.php index 85874e1cbbb..8cdda3870d5 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Overview.php +++ b/app/code/Magento/Checkout/Block/Multishipping/Overview.php @@ -313,7 +313,7 @@ class Overview extends \Magento\Sales\Block\Items\AbstractItems /** * Retrieve quote * - * @return \Magento\Sales\Model\Qoute + * @return \Magento\Sales\Model\Quote */ public function getQuote() { diff --git a/app/code/Magento/Cms/view/frontend/layout/print.xml b/app/code/Magento/Cms/view/frontend/layout/print.xml index dcadb80030b..ba0a322322b 100644 --- a/app/code/Magento/Cms/view/frontend/layout/print.xml +++ b/app/code/Magento/Cms/view/frontend/layout/print.xml @@ -25,9 +25,9 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceBlock name="head"> - <block class="Magento\Page\Block\Html\Head\Css" name="magento-catalogevent-widgets-css"> + <block class="Magento\Page\Block\Html\Head\Css" name="magento-cms-widgets-css"> <arguments> - <argument name="file" xsi:type="string">Magento_CatalogEvent::widgets.css</argument> + <argument name="file" xsi:type="string">Magento_Cms::widgets.css</argument> </arguments> </block> </referenceBlock> diff --git a/app/code/Magento/Core/Model/Config/Initial/Reader.php b/app/code/Magento/Core/Model/Config/Initial/Reader.php index c6142e05a78..caa81da9985 100644 --- a/app/code/Magento/Core/Model/Config/Initial/Reader.php +++ b/app/code/Magento/Core/Model/Config/Initial/Reader.php @@ -85,7 +85,7 @@ class Reader * * @return array * - * @throws \Magento\MagentoException + * @throws \Magento\Exception */ public function read() { @@ -109,7 +109,7 @@ class Reader $domDocument->merge(file_get_contents($file)); } } catch (\Magento\Config\Dom\ValidationException $e) { - throw new \Magento\MagentoException("Invalid XML in file " . $file . ":\n" . $e->getMessage()); + throw new \Magento\Exception("Invalid XML in file " . $file . ":\n" . $e->getMessage()); } } diff --git a/app/code/Magento/Core/Model/EntityFactory.php b/app/code/Magento/Core/Model/EntityFactory.php index 5be26f04e16..0a2d1c3542c 100644 --- a/app/code/Magento/Core/Model/EntityFactory.php +++ b/app/code/Magento/Core/Model/EntityFactory.php @@ -48,7 +48,7 @@ class EntityFactory * * @param $className * @param array $data - * @throws LogicException + * @throws \LogicException * @return \Magento\Object */ public function create($className, array $data = array()) @@ -56,7 +56,7 @@ class EntityFactory $model = $this->_objectManager->create($className, $data); //TODO: fix that when this factory used only for \Magento\Core\Model\Abstract //if (!$model instanceof \Magento\Core\Model\Abstract) { - // throw new LogicException($className . ' doesn\'t implement \Magento\Core\Model\Abstract'); + // throw new \LogicException($className . ' doesn\'t implement \Magento\Core\Model\Abstract'); //} return $model; } diff --git a/app/code/Magento/Core/Model/Resource/HelperPool.php b/app/code/Magento/Core/Model/Resource/HelperPool.php index bfc6bf372d7..fb71e0b301b 100644 --- a/app/code/Magento/Core/Model/Resource/HelperPool.php +++ b/app/code/Magento/Core/Model/Resource/HelperPool.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_TargetRule * @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) */ diff --git a/app/code/Magento/Core/Model/Url.php b/app/code/Magento/Core/Model/Url.php index de7b1f6b73d..207c27abb87 100644 --- a/app/code/Magento/Core/Model/Url.php +++ b/app/code/Magento/Core/Model/Url.php @@ -149,7 +149,7 @@ class Url extends \Magento\Object implements \Magento\Core\Model\UrlInterface protected $_storeManager; /** - * @var \Magento\Core\Model\SessionProxy + * @var \Magento\Core\Model\Session */ protected $_session; @@ -164,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\SessionProxy $session + * @param \Magento\Core\Model\Session $session * @param array $data */ public function __construct( @@ -173,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\SessionProxy $session, + \Magento\Core\Model\Session $session, array $data = array() ) { $this->_urlSecurityInfo = $urlSecurityInfo; diff --git a/app/code/Magento/Cron/Model/Observer.php b/app/code/Magento/Cron/Model/Observer.php index bd37fec9dbf..fbea8b797fa 100644 --- a/app/code/Magento/Cron/Model/Observer.php +++ b/app/code/Magento/Cron/Model/Observer.php @@ -134,7 +134,7 @@ class Observer * @param $jobConfig * @param \Magento\Cron\Model\Schedule $schedule * - * @throws Exception + * @throws \Exception */ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule) { diff --git a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php index ef7e49fa856..caaf308db85 100644 --- a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php @@ -88,7 +88,7 @@ class DefaultRenderer * Retrive format type object * * @param \Magento\Object $type - * @return \Magento\Customer\Model\Address\Renderer\DefaultRenderer + * @return \Magento\Customer\Block\Address\Renderer\DefaultRenderer */ public function setType(\Magento\Object $type) { diff --git a/app/code/Magento/Customer/Helper/Data.php b/app/code/Magento/Customer/Helper/Data.php index 5fd02ca5c25..b5eb6ecc2c5 100644 --- a/app/code/Magento/Customer/Helper/Data.php +++ b/app/code/Magento/Customer/Helper/Data.php @@ -694,7 +694,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper * Create SOAP client based on VAT validation service WSDL * * @param boolean $trace - * @return SoapClient + * @return \SoapClient */ protected function _createVatNumberValidationSoapClient($trace = false) { diff --git a/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php b/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php index c4017c29eb9..d00a0222100 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\SessionProxy $session + * @param \Magento\Core\Model\Session $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\SessionProxy $session, + \Magento\Core\Model\Session $session, array $data = array() ) { $this->_helper = $helper; diff --git a/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Items.php b/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Items.php index 0388c0c5244..d4a162e7ab3 100644 --- a/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Items.php +++ b/app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Items.php @@ -133,7 +133,7 @@ class Items extends \Magento\Adminhtml\Block\Template /** * Initialize gift message for entity * - * @return \Magento\Adminhtml\Block\Sales\Order_Edit_Items_Grid_Renderer_Name_Giftmessage + * @return \Magento\GiftMessage\Block\Adminhtml\Sales\Order\View\Items */ protected function _initMessage() { diff --git a/app/code/Magento/GiftMessage/Model/Message.php b/app/code/Magento/GiftMessage/Model/Message.php index 865a0fea847..a8cd97b7120 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\AbstractModel + * @return mixed */ public function getEntityModelByType($type) { diff --git a/app/code/Magento/GiftMessage/Model/TypeFactory.php b/app/code/Magento/GiftMessage/Model/TypeFactory.php index ca8e6fd4eb4..f5303582885 100644 --- a/app/code/Magento/GiftMessage/Model/TypeFactory.php +++ b/app/code/Magento/GiftMessage/Model/TypeFactory.php @@ -66,7 +66,7 @@ class TypeFactory * * @param $eavType * - * @return \Magento\Eav\Model\Entity\Abstract + * @return mixed * @throws \Magento\Core\Exception */ public function createType($eavType) diff --git a/app/code/Magento/GoogleCheckout/Model/Api/Xml/AbstractXml.php b/app/code/Magento/GoogleCheckout/Model/Api/Xml/AbstractXml.php index c802e206b80..d3e874d55c3 100644 --- a/app/code/Magento/GoogleCheckout/Model/Api/Xml/AbstractXml.php +++ b/app/code/Magento/GoogleCheckout/Model/Api/Xml/AbstractXml.php @@ -123,12 +123,12 @@ abstract class AbstractXml extends \Magento\Object /** * Google Checkout Request instance * - * @return GoogleRequest + * @return \GoogleRequest */ public function getGRequest() { if (!$this->hasData('g_request')) { - $this->setData('g_request', new GoogleRequest( + $this->setData('g_request', new \GoogleRequest( $this->getMerchantId(), $this->getMerchantKey(), $this->getServerType(), @@ -150,7 +150,7 @@ abstract class AbstractXml extends \Magento\Object * Google Checkout Response instance * * @throws \Magento\Core\Exception - * @return GoogleResponse + * @return \GoogleResponse */ public function getGResponse() { @@ -160,7 +160,7 @@ abstract class AbstractXml extends \Magento\Object throw new \Magento\Core\Exception(__('GoogleCheckout is not configured')); } if (!$this->hasData('g_response')) { - $this->setData('g_response', new GoogleResponse( + $this->setData('g_response', new \GoogleResponse( $this->getMerchantId(), $this->getMerchantKey() )); diff --git a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php index 1aa72675e99..889d734a6dd 100644 --- a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php +++ b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php @@ -212,7 +212,7 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml */ protected function _responseMerchantCalculationCallback() { - $merchantCalculations = new GoogleMerchantCalculations($this->getCurrency()); + $merchantCalculations = new \GoogleMerchantCalculations($this->getCurrency()); $quote = $this->_loadQuote(); @@ -282,7 +282,7 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml } foreach ($gRequestMethods as $method) { - $result = new GoogleResult($addressId); + $result = new \GoogleResult($addressId); $methodName = $method['name']; if (isset($rates[$methodName])) { @@ -345,7 +345,7 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml $taxAmount = $address->getBaseTaxAmount(); $taxAmount += $billingAddress->getBaseTaxAmount(); - $result = new GoogleResult($addressId); + $result = new \GoogleResult($addressId); $result->setTaxDetails($taxAmount); $merchantCalculations->addResult($result); } @@ -527,7 +527,7 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml * apply Google tax and recollect quote * * @param \Magento\Object $qAddress - * @return string | false + * @return string | boolean false */ protected function _applyCustomTax($qAddress) { @@ -679,7 +679,7 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml * * @param string $name * @param int|string|\Magento\Core\Model\Store $storeId - * @return string|false + * @return string| boolean false */ protected function _getShippingMethodByName($name, $storeId = null) { diff --git a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Order.php b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Order.php index f0eb25e9118..22c03408703 100644 --- a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Order.php +++ b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Order.php @@ -114,7 +114,7 @@ class Order extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml { $googleShipItems = array(); foreach ($items as $item) { - $googleShipItems[] = new GoogleShipItem($item); + $googleShipItems[] = new \GoogleShipItem($item); } $response = $this->getGRequest() diff --git a/app/code/Magento/GoogleShopping/Model/MassOperations.php b/app/code/Magento/GoogleShopping/Model/MassOperations.php index 4080bdc24a8..1ed6d0c469a 100644 --- a/app/code/Magento/GoogleShopping/Model/MassOperations.php +++ b/app/code/Magento/GoogleShopping/Model/MassOperations.php @@ -374,7 +374,7 @@ class MassOperations /** * Retrieve admin notifier * - * @return \Magento\Adminhtml\Model\Inbox + * @return \Magento\AdminNotification\Model\Inbox */ protected function _getNotifier() { diff --git a/app/code/Magento/ImportExport/Model/Resource/Import/Data.php b/app/code/Magento/ImportExport/Model/Resource/Import/Data.php index e0dd163d287..4039df5fb58 100644 --- a/app/code/Magento/ImportExport/Model/Resource/Import/Data.php +++ b/app/code/Magento/ImportExport/Model/Resource/Import/Data.php @@ -38,7 +38,7 @@ class Data implements \IteratorAggregate { /** - * @var IteratorIterator + * @var \Iterator */ protected $_iterator = null; @@ -75,7 +75,7 @@ class Data /** * Retrieve an external iterator * - * @return IteratorIterator + * @return \Iterator */ public function getIterator() { diff --git a/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php b/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php index 761ce117d96..ee21049b23f 100644 --- a/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php +++ b/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php @@ -73,13 +73,17 @@ abstract class AbstractDb /** * @param \Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory + * @param \Magento\Core\Model\Config\Local $localConfig * @param array $dbExtensions */ public function __construct( - \Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory, array $dbExtensions = array() + \Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory, + \Magento\Core\Model\Config\Local $localConfig, + array $dbExtensions = array() ) { $this->_adapterFactory = $adapterFactory; $this->_dbExtensions = $dbExtensions; + $this->_localConfig = $localConfig; } /** @@ -121,13 +125,24 @@ abstract class AbstractDb public function getConnectionData() { if (!$this->_connectionData) { - $connectionData = array( - 'host' => $this->_configData['db_host'], - 'username' => $this->_configData['db_user'], - 'password' => $this->_configData['db_pass'], - 'dbName' => $this->_configData['db_name'], - 'pdoType' => $this->getPdoType() - ); + if ($this->_configData) { + $connectionData = array( + 'host' => $this->_configData['db_host'], + 'username' => $this->_configData['db_user'], + 'password' => $this->_configData['db_pass'], + 'dbName' => $this->_configData['db_name'], + 'pdoType' => $this->getPdoType() + ); + } else { + $default = $this->_localConfig->getConnection('default'); + $connectionData = array( + 'host' => $default['host'], + 'username' => $default['username'], + 'password' => $default['password'], + 'dbName' => $default['dbName'], + 'pdoType' => $this->getPdoType() + ); + } $this->_connectionData = $connectionData; } return $this->_connectionData; diff --git a/app/code/Magento/Oauth/Block/Adminhtml/Oauth/Consumer/Grid.php b/app/code/Magento/Oauth/Block/Adminhtml/Oauth/Consumer/Grid.php index c96e3d2cc46..f783936b62a 100644 --- a/app/code/Magento/Oauth/Block/Adminhtml/Oauth/Consumer/Grid.php +++ b/app/code/Magento/Oauth/Block/Adminhtml/Oauth/Consumer/Grid.php @@ -71,7 +71,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended parent::_construct(); $this->setId('consumerGrid'); $this->setSaveParametersInSession(true); - $this->setDefaultSort('entity_id')->setDefaultDir(\Magento\Db\Select::SQL_DESC); + $this->setDefaultSort('entity_id')->setDefaultDir(\Magento\DB\Select::SQL_DESC); $this->_editAllow = $this->_authorization->isAllowed('Magento_Oauth::consumer_edit'); } diff --git a/app/code/Magento/Oauth/Helper/Service.php b/app/code/Magento/Oauth/Helper/Service.php index 75b2047a2bb..a51069f917e 100644 --- a/app/code/Magento/Oauth/Helper/Service.php +++ b/app/code/Magento/Oauth/Helper/Service.php @@ -36,21 +36,11 @@ class Service extends \Magento\Core\Helper\AbstractHelper const XML_PATH_CLEANUP_EXPIRATION_PERIOD = 'oauth/cleanup/expiration_period'; /**#@-*/ - /** - * Consumer xpath settings - */ - const XML_PATH_CONSUMER_EXPIRATION_PERIOD = 'oauth/consumer/expiration_period'; - /** * Cleanup expiration period in minutes */ const CLEANUP_EXPIRATION_PERIOD_DEFAULT = 120; - /** - * Consumer expiration period in seconds - */ - const CONSUMER_EXPIRATION_PERIOD_DEFAULT = 300; - /** * Query parameter as a sign that user rejects */ @@ -184,15 +174,4 @@ class Service extends \Magento\Core\Helper\AbstractHelper $minutes = (int) $this->_storeConfig->getConfig(self::XML_PATH_CLEANUP_EXPIRATION_PERIOD); return $minutes > 0 ? $minutes : self::CLEANUP_EXPIRATION_PERIOD_DEFAULT; } - - /** - * Get consumer expiration period value from system configuration in seconds - * - * @return int - */ - public function getConsumerExpirationPeriod() - { - $seconds = (int)$this->_storeConfig->getConfig(self::XML_PATH_CONSUMER_EXPIRATION_PERIOD); - return $seconds > 0 ? $seconds : self::CONSUMER_EXPIRATION_PERIOD_DEFAULT; - } } diff --git a/app/code/Magento/Oauth/Service/OauthV1.php b/app/code/Magento/Oauth/Service/OauthV1.php index 0479cc3b16b..ccf67ae46aa 100644 --- a/app/code/Magento/Oauth/Service/OauthV1.php +++ b/app/code/Magento/Oauth/Service/OauthV1.php @@ -35,6 +35,36 @@ class OauthV1 implements \Magento\Oauth\Service\OauthV1Interface */ const TIME_DEVIATION = 600; + /** + * Consumer xpath settings + */ + const XML_PATH_CONSUMER_EXPIRATION_PERIOD = 'oauth/consumer/expiration_period'; + + /** + * Consumer expiration period in seconds + */ + const CONSUMER_EXPIRATION_PERIOD_DEFAULT = 300; + + /** + * Consumer HTTP POST maxredirects xpath + */ + const XML_PATH_CONSUMER_POST_MAXREDIRECTS = 'oauth/consumer/post_maxredirects'; + + /** + * Consumer HTTPS POST maxredirects default + */ + const CONSUMER_POST_MAXREDIRECTS = 0; + + /** + * Consumer HTTP TIMEOUT xpath + */ + const XML_PATH_CONSUMER_POST_TIMEOUT = 'oauth/consumer/post_timeout'; + + /** + * Consumer HTTP TIMEOUT default + */ + const CONSUMER_POST_TIMEOUT = 5; + /** @var \Magento\Oauth\Model\Consumer\Factory */ private $_consumerFactory; @@ -44,9 +74,6 @@ class OauthV1 implements \Magento\Oauth\Service\OauthV1Interface /** @var \Magento\Oauth\Model\Token\Factory */ private $_tokenFactory; - /** @var \Magento\Oauth\Helper\Service */ - protected $_serviceHelper; - /** @var \Magento\Core\Model\StoreManagerInterface */ protected $_storeManager; @@ -56,31 +83,34 @@ class OauthV1 implements \Magento\Oauth\Service\OauthV1Interface /** @var \Zend_Oauth_Http_Utility */ protected $_httpUtility; + /** @var \Magento\Core\Model\Date */ + protected $_date; + /** * @param \Magento\Oauth\Model\Consumer\Factory $consumerFactory * @param \Magento\Oauth\Model\Nonce\Factory $nonceFactory * @param \Magento\Oauth\Model\Token\Factory $tokenFactory - * @param \Magento\Oauth\Helper\Service $serviceHelper * @param \Magento\Core\Model\StoreManagerInterface * @param \Magento\HTTP\ZendClient * @param \Zend_Oauth_Http_Utility $httpUtility + * @param \Magento\Core\Model\Date $date */ public function __construct( \Magento\Oauth\Model\Consumer\Factory $consumerFactory, \Magento\Oauth\Model\Nonce\Factory $nonceFactory, \Magento\Oauth\Model\Token\Factory $tokenFactory, - \Magento\Oauth\Helper\Service $serviceHelper, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\HTTP\ZendClient $httpClient, - \Zend_Oauth_Http_Utility $httpUtility + \Zend_Oauth_Http_Utility $httpUtility, + \Magento\Core\Model\Date $date ) { $this->_consumerFactory = $consumerFactory; $this->_nonceFactory = $nonceFactory; $this->_tokenFactory = $tokenFactory; $this->_storeManager = $storeManager; - $this->_serviceHelper = $serviceHelper; $this->_httpClient = $httpClient; $this->_httpUtility = $httpUtility; + $this->_date = $date; } /** @@ -117,17 +147,26 @@ class OauthV1 implements \Magento\Oauth\Service\OauthV1Interface try { $consumerData = $this->_getConsumer($request['consumer_id'])->getData(); $storeBaseUrl = $this->_storeManager->getStore()->getBaseUrl(); - - $this->_httpClient->setUri($consumerData['http_post_url']); - $this->_httpClient->setParameterPost(array( - 'oauth_consumer_key' => $consumerData['key'], - 'oauth_consumer_secret' => $consumerData['secret'], - 'store_base_url' => $storeBaseUrl - )); - // TODO: Uncomment this when there is a live http_post_url that we can actually post to. - //$this->_httpClient->request(\Magento\HTTP\ZendClient::POST); - $verifier = $this->_tokenFactory->create()->createVerifierToken($request['consumer_id']); + $this->_httpClient->setUri($consumerData['http_post_url']); + $this->_httpClient->setParameterPost( + array( + 'oauth_consumer_key' => $consumerData['key'], + 'oauth_consumer_secret' => $consumerData['secret'], + 'store_base_url' => $storeBaseUrl, + 'oauth_verifier' => $verifier->getVerifier() + ) + ); + $maxredirects = $this->_getConfigValue( + self::XML_PATH_CONSUMER_POST_MAXREDIRECTS, + self::CONSUMER_POST_MAXREDIRECTS + ); + $timeout = $this->_getConfigValue( + self::XML_PATH_CONSUMER_POST_TIMEOUT, + self::CONSUMER_POST_TIMEOUT + ); + $this->_httpClient->setConfig(array('maxredirects' => $maxredirects, 'timeout' => $timeout)); + $this->_httpClient->request(\Magento\HTTP\ZendClient::POST); return array('oauth_verifier' => $verifier->getVerifier()); } catch (\Magento\Core\Exception $exception) { throw $exception; @@ -142,34 +181,27 @@ class OauthV1 implements \Magento\Oauth\Service\OauthV1Interface public function getRequestToken($signedRequest) { $this->_validateVersionParam($signedRequest['oauth_version']); - $consumer = $this->_getConsumerByKey($signedRequest['oauth_consumer_key']); - // must use consumer within expiration period - $consumerTS = strtotime($consumer->getCreatedAt()); - if (time() - $consumerTS > $this->_serviceHelper->getConsumerExpirationPeriod()) { + $expiry = $this->_getConfigValue( + self::XML_PATH_CONSUMER_EXPIRATION_PERIOD, + self::CONSUMER_EXPIRATION_PERIOD_DEFAULT + ); + if ($this->_date->timestamp() - $consumerTS > $expiry) { throw new \Magento\Oauth\Exception('', self::ERR_CONSUMER_KEY_INVALID); } - $this->_validateNonce($signedRequest['oauth_nonce'], $consumer->getId(), $signedRequest['oauth_timestamp']); - $token = $this->_getTokenByConsumer($consumer->getId()); - if ($token->getType() != \Magento\Oauth\Model\Token::TYPE_VERIFIER) { throw new \Magento\Oauth\Exception('', self::ERR_TOKEN_REJECTED); } - - //OAuth clients are not sending the verifier param for requestToken requests - //$this->_validateVerifierParam($signedRequest['oauth_verifier'], $token->getVerifier()); - $this->_validateSignature( $signedRequest, $consumer->getSecret(), $signedRequest['http_method'], $signedRequest['request_url'] ); - $requestToken = $token->createRequestToken($token->getId(), $consumer->getCallBackUrl()); return array('oauth_token' => $requestToken->getToken(), 'oauth_token_secret' => $requestToken->getSecret()); } @@ -580,4 +612,15 @@ class OauthV1 implements \Magento\Oauth\Service\OauthV1Interface } } } + + /** + * Get value from store configuration + * + * @return int + */ + protected function _getConfigValue($xpath, $default) + { + $value = (int)$this->_storeManager->getStore()->getConfig($xpath); + return $value > 0 ? $value : $default; + } } diff --git a/app/code/Magento/Oauth/Service/OauthV1Interface.php b/app/code/Magento/Oauth/Service/OauthV1Interface.php index 3fe13944261..6cbc387bc34 100644 --- a/app/code/Magento/Oauth/Service/OauthV1Interface.php +++ b/app/code/Magento/Oauth/Service/OauthV1Interface.php @@ -58,7 +58,6 @@ interface OauthV1Interface const SIGNATURE_SHA256 = 'HMAC-SHA256'; /**#@-*/ - /** * Create a new consumer account when an Add-On is installed. * diff --git a/app/code/Magento/Oauth/etc/adminhtml/system.xml b/app/code/Magento/Oauth/etc/adminhtml/system.xml index 361d7bb628f..747cae31516 100644 --- a/app/code/Magento/Oauth/etc/adminhtml/system.xml +++ b/app/code/Magento/Oauth/etc/adminhtml/system.xml @@ -46,6 +46,14 @@ <label>Expiration Period</label> <comment>Disable consumer key/secret credentials if not used within X seconds.</comment> </field> + <field id="post_maxredirects" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0"> + <label>OAuth consumer credentials HTTP Post maxredirects</label> + <comment>Number of maximum redirects for OAuth consumer credentials Post request.</comment> + </field> + <field id="post_timeout" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0"> + <label>OAuth consumer credentials HTTP Post timeout</label> + <comment>Timeout for OAuth consumer credentials Post request within X seconds.</comment> + </field> </group> </section> </system> diff --git a/app/code/Magento/Oauth/etc/config.xml b/app/code/Magento/Oauth/etc/config.xml index 154dca72f57..bd080e724dc 100644 --- a/app/code/Magento/Oauth/etc/config.xml +++ b/app/code/Magento/Oauth/etc/config.xml @@ -36,6 +36,8 @@ </cleanup> <consumer> <expiration_period>300</expiration_period> + <post_maxredirects>0</post_maxredirects> + <post_timeout>5</post_timeout> </consumer> </oauth> </default> diff --git a/app/code/Magento/Paygate/Model/Authorizenet/Cards.php b/app/code/Magento/Paygate/Model/Authorizenet/Cards.php index aa08d151930..ecfefbea1fe 100644 --- a/app/code/Magento/Paygate/Model/Authorizenet/Cards.php +++ b/app/code/Magento/Paygate/Model/Authorizenet/Cards.php @@ -171,7 +171,7 @@ class Cards /** * Remove all cards from payment instance * - * @return \Magento\Paygate\Model\Authorizenet_Cart + * @return \Magento\Paygate\Model\Authorizenet\Cards */ public function flushCards() { diff --git a/app/code/Magento/Payment/Model/Method/AbstractMethod.php b/app/code/Magento/Payment/Model/Method/AbstractMethod.php index d515de40e7f..e32b415b960 100644 --- a/app/code/Magento/Payment/Model/Method/AbstractMethod.php +++ b/app/code/Magento/Payment/Model/Method/AbstractMethod.php @@ -425,7 +425,7 @@ abstract class AbstractMethod extends \Magento\Object /** * Validate payment method information object * - * @return \Magento\Payment\Model\AbstractModel + * @return \Magento\Payment\Model\Method\AbstractMethod * @throws \Magento\Core\Exception */ public function validate() @@ -453,7 +453,7 @@ abstract class AbstractMethod extends \Magento\Object * @param \Magento\Object $payment * @param float $amount * - * @return \Magento\Payment\Model\AbstractModel + * @return \Magento\Payment\Model\Method\AbstractMethod * @throws \Magento\Core\Exception */ public function order(\Magento\Object $payment, $amount) @@ -470,7 +470,7 @@ abstract class AbstractMethod extends \Magento\Object * @param \Magento\Object $payment * @param float $amount * - * @return \Magento\Payment\Model\AbstractModel + * @return \Magento\Payment\Model\Method\AbstractMethod * @throws \Magento\Core\Exception */ public function authorize(\Magento\Object $payment, $amount) @@ -487,13 +487,13 @@ abstract class AbstractMethod extends \Magento\Object * @param \Magento\Object $payment * @param float $amount * - * @return \Magento\Payment\Model\AbstractModel + * @return \Magento\Payment\Model\Method\AbstractMethod * @throws \Magento\Core\Exception */ public function capture(\Magento\Object $payment, $amount) { if (!$this->canCapture()) { - throw new \Magento\Core\Exception(__('Th capture action is not available.')); + throw new \Magento\Core\Exception(__('The capture action is not available.')); } return $this; @@ -535,7 +535,7 @@ abstract class AbstractMethod extends \Magento\Object * @param \Magento\Object $payment * @param float $amount * - * @return \Magento\Payment\Model\AbstractModel + * @return \Magento\Payment\Model\Method\AbstractMethod * @throws \Magento\Core\Exception */ public function refund(\Magento\Object $payment, $amount) @@ -563,7 +563,7 @@ abstract class AbstractMethod extends \Magento\Object * * @param \Magento\Object $payment * - * @return \Magento\Payment\Model\AbstractModel + * @return \Magento\Payment\Model\Method\AbstractMethod */ public function cancel(\Magento\Object $payment) { @@ -575,7 +575,7 @@ abstract class AbstractMethod extends \Magento\Object * * @param \Magento\Object $payment * - * @return \Magento\Payment\Model\AbstractModel + * @return \Magento\Payment\Model\Method\AbstractMethod * @throws \Magento\Core\Exception */ public function void(\Magento\Object $payment) @@ -675,7 +675,7 @@ abstract class AbstractMethod extends \Magento\Object /** * Prepare info instance for save * - * @return \Magento\Payment\Model\AbstractModel + * @return \Magento\Payment\Model\Method\AbstractMethod */ public function prepareSave() { @@ -774,7 +774,7 @@ abstract class AbstractMethod extends \Magento\Object * @param string $paymentAction * @param object $stateObject * - * @return \Magento\Payment\Model\AbstractModel + * @return \Magento\Payment\Model\Method\AbstractMethod */ public function initialize($paymentAction, $stateObject) { diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index e3e5e692f50..3925b4065c8 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -118,7 +118,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * Prepare info instance for save * - * @return \Magento\Payment\Model\AbstractModel + * @return \Magento\Payment\Model\Method\Cc */ public function prepareSave() { @@ -135,7 +135,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * Validate payment method information object * - * @return \Magento\Payment\Model\AbstractModel + * @return \Magento\Payment\Model\Method\Cc * @throws \Magento\Core\Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) diff --git a/app/code/Magento/Paypal/Block/Iframe.php b/app/code/Magento/Paypal/Block/Iframe.php index f10a066f6cb..b3f13149320 100644 --- a/app/code/Magento/Paypal/Block/Iframe.php +++ b/app/code/Magento/Paypal/Block/Iframe.php @@ -107,7 +107,7 @@ class Iframe extends \Magento\Payment\Block\Form $this->_paymentMethodCode = $paymentCode; $templatePath = str_replace('_', '', $paymentCode); $templateFile = "{$templatePath}/iframe.phtml"; - if (file_exists($this->_viewFileSystem->getFilename($templateFile))) { + if (file_exists($this->_viewFileSystem->getFilename($templateFile, array('module' => 'Magento_Paypal')))) { $this->setTemplate($templateFile); } else { $this->setTemplate('hss/iframe.phtml'); @@ -127,9 +127,8 @@ class Iframe extends \Magento\Payment\Block\Form $this->_block = $this->getLayout() ->createBlock('Magento\\Paypal\\Block\\' . str_replace(' ', \Magento\Autoload\IncludePath::NS_SEPARATOR, - ucwords(str_replace(\Magento\Autoload\IncludePath::NS_SEPARATOR, ' ', $this - ->_paymentMethodCode))) - . '_Iframe'); + ucwords(str_replace('_', ' ', $this->_paymentMethodCode))) + . '\\Iframe'); if (!$this->_block instanceof \Magento\Paypal\Block\Iframe) { throw new \Magento\Core\Exception('Invalid block type'); } diff --git a/app/code/Magento/Paypal/Model/Hostedpro.php b/app/code/Magento/Paypal/Model/Hostedpro.php index bdb5fb25f47..324b76e18db 100644 --- a/app/code/Magento/Paypal/Model/Hostedpro.php +++ b/app/code/Magento/Paypal/Model/Hostedpro.php @@ -169,7 +169,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct * * @param string $paymentAction * @param \Magento\Object $stateObject - * @return \Magento\Payment\Model\AbstractModel|null + * @return \Magento\Payment\Model\Method\AbstractMethod|void */ public function initialize($paymentAction, $stateObject) { diff --git a/app/code/Magento/Paypal/Model/Standard.php b/app/code/Magento/Paypal/Model/Standard.php index 495bafd91f8..cead16f362b 100644 --- a/app/code/Magento/Paypal/Model/Standard.php +++ b/app/code/Magento/Paypal/Model/Standard.php @@ -248,7 +248,7 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod * * @param string $paymentAction * @param object $stateObject - * @return \Magento\Payment\Model\AbstractModel|null + * @return \Magento\Payment\Model\Method\AbstractMethod|void */ public function initialize($paymentAction, $stateObject) { diff --git a/app/code/Magento/Persistent/Model/Observer.php b/app/code/Magento/Persistent/Model/Observer.php index 0be088a1383..ad2fe4cd08e 100644 --- a/app/code/Magento/Persistent/Model/Observer.php +++ b/app/code/Magento/Persistent/Model/Observer.php @@ -637,7 +637,7 @@ class Observer * Clear expired persistent sessions * * @param \Magento\Cron\Model\Schedule $schedule - * @return \Magento\Persistent\Model\Observer\Cron + * @return \Magento\Persistent\Model\Observer */ public function clearExpiredCronJob(\Magento\Cron\Model\Schedule $schedule) { diff --git a/app/code/Magento/Reports/view/frontend/layout/print.xml b/app/code/Magento/Reports/view/frontend/layout/print.xml index a7e102e5831..01eec5d1b81 100644 --- a/app/code/Magento/Reports/view/frontend/layout/print.xml +++ b/app/code/Magento/Reports/view/frontend/layout/print.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceBlock name="head"> - <block class="Magento\Page\Block\Html\Head\Css" name="magento-banner-widgets-css"> + <block class="Magento\Page\Block\Html\Head\Css" name="magento-reports-widgets-css"> <arguments> <argument name="file" xsi:type="string">Magento_Reports::widgets.css</argument> </arguments> diff --git a/app/code/Magento/Sales/Model/Billing/Agreement.php b/app/code/Magento/Sales/Model/Billing/Agreement.php index 5f0744f8616..e965f6259fc 100644 --- a/app/code/Magento/Sales/Model/Billing/Agreement.php +++ b/app/code/Magento/Sales/Model/Billing/Agreement.php @@ -66,7 +66,7 @@ class Agreement extends \Magento\Payment\Model\Billing\AbstractAgreement protected $_billingAgreementFactory; /** - * @var \Magento\Core\Model\Date + * @var \Magento\Core\Model\DateFactory */ protected $_dateFactory; @@ -75,7 +75,7 @@ class Agreement extends \Magento\Payment\Model\Billing\AbstractAgreement * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Sales\Model\Resource\Billing\Agreement\CollectionFactory $billingAgreementFactory - * @param \Magento\Core\Model\Date $dateFactory + * @param \Magento\Core\Model\DateFactory $dateFactory * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -85,7 +85,7 @@ class Agreement extends \Magento\Payment\Model\Billing\AbstractAgreement \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Sales\Model\Resource\Billing\Agreement\CollectionFactory $billingAgreementFactory, - \Magento\Core\Model\Date $dateFactory, + \Magento\Core\Model\DateFactory $dateFactory, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() diff --git a/app/code/Magento/Sales/Model/Billing/Agreement/OrdersUpdater.php b/app/code/Magento/Sales/Model/Billing/Agreement/OrdersUpdater.php index ee0663beb54..cac92c4eebd 100644 --- a/app/code/Magento/Sales/Model/Billing/Agreement/OrdersUpdater.php +++ b/app/code/Magento/Sales/Model/Billing/Agreement/OrdersUpdater.php @@ -56,7 +56,7 @@ class OrdersUpdater implements \Magento\Core\Model\Layout\Argument\UpdaterInterf * @param mixed $argument * @throws \DomainException * @return mixed - * @throws DomainException + * @throws \DomainException */ public function update($argument) { diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php index 5d17c5fa277..9f306716556 100644 --- a/app/code/Magento/Sales/Model/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Order/Payment.php @@ -673,7 +673,7 @@ class Payment extends \Magento\Payment\Model\Info * * @see self::_void() * @param float $amount - * @return \Magento\Sales\Model\Payment + * @return \Magento\Sales\Model\Order\Payment */ public function registerVoidNotification($amount = null) { diff --git a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php index 1cab1a4bd84..c0df016f7ec 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php @@ -629,7 +629,7 @@ abstract class AbstractPdf extends \Magento\Object /** * Return total list * - * @return \Magento\Sales\Model\Order\Pdf\Total\Default[] + * @return \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal */ protected function _getTotalsList() { diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule/Quote/Collection.php b/app/code/Magento/SalesRule/Model/Resource/Rule/Quote/Collection.php index 8f8668835e0..618d284ae41 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule/Quote/Collection.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule/Quote/Collection.php @@ -30,7 +30,7 @@ class Collection extends \Magento\SalesRule\Model\Resource\Rule\Collection /** * Add websites for load * - * @return \Magento\SalesRule\Model\Resource\Rule_Quote_GridCollection + * @return \Magento\SalesRule\Model\Resource\Rule\Quote\Collection */ public function _initSelect() diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php index 99311e7cf46..18a8665a6fd 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php @@ -190,7 +190,7 @@ class Fedex * * @param string $wsdl * @param bool|int $trace - * @return SoapClient + * @return \SoapClient */ protected function _createSoapClient($wsdl, $trace = false) { @@ -206,7 +206,7 @@ class Fedex /** * Create rate soap client * - * @return SoapClient + * @return \SoapClient */ protected function _createRateSoapClient() { @@ -216,7 +216,7 @@ class Fedex /** * Create ship soap client * - * @return SoapClient + * @return \SoapClient */ protected function _createShipSoapClient() { @@ -226,7 +226,7 @@ class Fedex /** * Create track soap client * - * @return SoapClient + * @return \SoapClient */ protected function _createTrackSoapClient() { diff --git a/app/code/Magento/Webapi/Model/Soap/Server/Factory.php b/app/code/Magento/Webapi/Model/Soap/Server/Factory.php index ec7b6ce7c20..06256030c59 100644 --- a/app/code/Magento/Webapi/Model/Soap/Server/Factory.php +++ b/app/code/Magento/Webapi/Model/Soap/Server/Factory.php @@ -56,7 +56,7 @@ class Factory * * @param string $url URL of a WSDL file * @param array $options Options including encoding, soap_version etc - * @return SoapServer + * @return \SoapServer */ public function create($url, $options) { diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php index 716e1d36c7f..c1a3c30bc68 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php @@ -133,7 +133,7 @@ class Main /** * Getter * - * @return Widget_Model_Widget_Instance + * @return \Magento\Widget\Model\Widget\Instance */ public function getWidgetInstance() { diff --git a/app/code/Magento/Widget/view/frontend/layout/default.xml b/app/code/Magento/Widget/view/frontend/layout/default.xml index c25a2098dd5..d58625467f0 100644 --- a/app/code/Magento/Widget/view/frontend/layout/default.xml +++ b/app/code/Magento/Widget/view/frontend/layout/default.xml @@ -25,9 +25,9 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceBlock name="head"> - <block class="Magento\Page\Block\Html\Head\Css" name="magento-cms-widgets-css"> + <block class="Magento\Page\Block\Html\Head\Css" name="magento-widget-widgets-css"> <arguments> - <argument name="file" xsi:type="string">Magento_VersionsCms::widgets.css</argument> + <argument name="file" xsi:type="string">Magento_Widget::widgets.css</argument> </arguments> </block> </referenceBlock> diff --git a/app/code/Magento/Wishlist/Controller/Index.php b/app/code/Magento/Wishlist/Controller/Index.php index 759b6303943..0a7f1caa95b 100644 --- a/app/code/Magento/Wishlist/Controller/Index.php +++ b/app/code/Magento/Wishlist/Controller/Index.php @@ -146,7 +146,7 @@ class Index if (!$wishlist->getId() || $wishlist->getCustomerId() != $customerId) { $wishlist = null; throw new \Magento\Core\Exception( - __("The requested wish list doesn\'t exist.") + __("The requested wish list doesn't exist.") ); } diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php index d30120963b4..15f0f10e748 100644 --- a/app/code/Magento/Wishlist/Helper/Data.php +++ b/app/code/Magento/Wishlist/Helper/Data.php @@ -123,7 +123,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper * @param \Magento\Core\Helper\Context $context * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Customer\Model\SessionProxy $customerSession + * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Wishlist\Model\WishlistFactory $wishlistFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ @@ -133,7 +133,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper \Magento\Core\Helper\Context $context, \Magento\Core\Model\Registry $coreRegistry, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Customer\Model\SessionProxy $customerSession, + \Magento\Customer\Model\Session $customerSession, \Magento\Wishlist\Model\WishlistFactory $wishlistFactory, \Magento\Core\Model\StoreManagerInterface $storeManager ) { diff --git a/app/code/Magento/Wishlist/etc/di.xml b/app/code/Magento/Wishlist/etc/di.xml index 6350f3f15b1..3994db0f01f 100644 --- a/app/code/Magento/Wishlist/etc/di.xml +++ b/app/code/Magento/Wishlist/etc/di.xml @@ -33,6 +33,9 @@ <param name="eventManager"> <instance type="Magento\Core\Model\Event\Manager\Proxy" /> </param> + <param name="customerSession"> + <instance type="Magento\Customer\Model\Session\Proxy" /> + </param> </type> <type name="Magento\Wishlist\Model\Wishlist"> <param name="eventManager"> diff --git a/app/etc/di.xml b/app/etc/di.xml index c8528b3001a..1546dee34ea 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -241,4 +241,9 @@ <value type="argument">Magento\Core\Model\Resource::PARAM_TABLE_PREFIX</value> </param> </type> + <type name="Magento\Core\Model\Url"> + <param name="session"> + <instance type="Magento\Core\Model\Session\Proxy" /> + </param> + </type> </config> diff --git a/dev/tests/integration/framework/bootstrap.php b/dev/tests/integration/framework/bootstrap.php index dfa2710d4d9..b8c0026298a 100644 --- a/dev/tests/integration/framework/bootstrap.php +++ b/dev/tests/integration/framework/bootstrap.php @@ -27,6 +27,7 @@ require_once __DIR__ . '/../../../../app/bootstrap.php'; require_once __DIR__ . '/../../static/framework/Magento/TestFramework/Utility/Classes.php'; +require_once __DIR__ . '/../../static/framework/Magento/TestFramework/Utility/AggregateInvoker.php'; $testsBaseDir = dirname(__DIR__); $testsTmpDir = "$testsBaseDir/tmp"; diff --git a/dev/tests/integration/testsuite/Magento/Cache/Backend/MongoDbTest.php b/dev/tests/integration/testsuite/Magento/Cache/Backend/MongoDbTest.php index 4e51c003dc7..7e372939d27 100644 --- a/dev/tests/integration/testsuite/Magento/Cache/Backend/MongoDbTest.php +++ b/dev/tests/integration/testsuite/Magento/Cache/Backend/MongoDbTest.php @@ -56,7 +56,7 @@ class MongoDbTest extends \PHPUnit_Framework_TestCase { if (!empty($this->_connectionString) && extension_loaded('mongo')) { $this->_model = null; - $connection = new Mongo($this->_connectionString); + $connection = new \Mongo($this->_connectionString); $connection->dropDB($this->_dbName); } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Fieldset/Config/_files/partialFieldsetFirst.xml b/dev/tests/integration/testsuite/Magento/Core/Model/Fieldset/Config/_files/partialFieldsetFirst.xml index 3dd9ddb74ef..4dfb3c9db80 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Fieldset/Config/_files/partialFieldsetFirst.xml +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Fieldset/Config/_files/partialFieldsetFirst.xml @@ -19,8 +19,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_CatalogEvent * @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) */ @@ -38,4 +36,4 @@ </field> </fieldset> </scope> -</config> \ No newline at end of file +</config> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Fieldset/Config/_files/partialFieldsetSecond.xml b/dev/tests/integration/testsuite/Magento/Core/Model/Fieldset/Config/_files/partialFieldsetSecond.xml index 9884f97aaf3..6ec52d663b6 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Fieldset/Config/_files/partialFieldsetSecond.xml +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Fieldset/Config/_files/partialFieldsetSecond.xml @@ -19,8 +19,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_CatalogEvent * @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) */ @@ -39,4 +37,4 @@ </field> </fieldset> </scope> -</config> \ No newline at end of file +</config> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutArgumentObjectUpdater.php b/dev/tests/integration/testsuite/Magento/Core/Model/LayoutArgumentObjectUpdater.php index 7c2dcea872e..a9ed1c1ad3f 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutArgumentObjectUpdater.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/LayoutArgumentObjectUpdater.php @@ -35,8 +35,8 @@ class LayoutArgumentObjectUpdater implements \Magento\Core\Model\Layout\Argument /** * Update specified argument * - * @param Magento\Data\Collection $argument - * @return Magento\Data\Collection + * @param \Magento\Data\Collection $argument + * @return \Magento\Data\Collection */ public function update($argument) { diff --git a/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php index 3e8acd83617..ba5c041a5b8 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php @@ -101,7 +101,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ) ); - /** @var \Magento\Logging\Model\Config\Reader $configReader */ + /** @var \Magento\Install\Model\Config\Reader $configReader */ $configReader = $this->_objectManager->create( 'Magento\Install\Model\Config\Reader', array( 'fileResolver' => $fileResolver, diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php index f6a360bd8ac..63f77a3b378 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php @@ -31,8 +31,6 @@ namespace Magento\Test\Integrity; class LayoutTest extends \PHPUnit_Framework_TestCase { - const NO_OVERRIDDEN_THEMES_MARKER = 'no-overriden-themes'; - /** * Cached lists of files * @@ -45,39 +43,44 @@ class LayoutTest extends \PHPUnit_Framework_TestCase self::$_cachedFiles = array(); // Free memory } - /** - * @param \Magento\Core\Model\Theme $theme - * @dataProvider areasAndThemesDataProvider - */ - public function testHandlesHierarchy(\Magento\Core\Model\Theme $theme) + public function testHandlesHierarchy() { - $xml = $this->_composeXml($theme); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param \Magento\Core\Model\Theme $theme + */ + function (\Magento\Core\Model\Theme $theme) { + $xml = $this->_composeXml($theme); - /** - * There could be used an xpath "/layouts/*[@type or @owner or @parent]", but it randomly produced bugs, by - * selecting all nodes in depth. Thus it was refactored into manual nodes extraction. - */ - $handles = array(); - foreach ($xml->children() as $handleNode) { - if ($handleNode->getAttribute('type') - || $handleNode->getAttribute('owner') - || $handleNode->getAttribute('parent') - ) { - $handles[] = $handleNode; - } - } + /** + * There could be used an xpath "/layouts/*[@type or @owner or @parent]", but it randomly produced bugs, + * by selecting all nodes in depth. Thus it was refactored into manual nodes extraction. + */ + $handles = array(); + foreach ($xml->children() as $handleNode) { + if ($handleNode->getAttribute('type') + || $handleNode->getAttribute('owner') + || $handleNode->getAttribute('parent') + ) { + $handles[] = $handleNode; + } + } - /** @var \Magento\Core\Model\Layout\Element $node */ - $errors = array(); - foreach ($handles as $node) { - $this->_collectHierarchyErrors($node, $xml, $errors); - } + /** @var \Magento\Core\Model\Layout\Element $node */ + $errors = array(); + foreach ($handles as $node) { + $this->_collectHierarchyErrors($node, $xml, $errors); + } - if ($errors) { - $this->fail("There are errors while checking the page type and fragment types hierarchy at:\n" - . var_export($errors, 1) - ); - } + if ($errors) { + $this->fail("There are errors while checking the page type and fragment types hierarchy at:\n" + . var_export($errors, 1) + ); + } + }, + $this->areasAndThemesDataProvider() + ); } /** @@ -146,43 +149,55 @@ class LayoutTest extends \PHPUnit_Framework_TestCase return $result; } - /** - * @param \Magento\Core\Model\Theme $theme - * @dataProvider areasAndThemesDataProvider - */ - public function testHandleLabels(\Magento\Core\Model\Theme $theme) + public function testHandleLabels() { - $xml = $this->_composeXml($theme); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param \Magento\Core\Model\Theme $theme + */ + function (\Magento\Core\Model\Theme $theme) { + $xml = $this->_composeXml($theme); - $xpath = '/layouts/*[' - . '@type="' . \Magento\Core\Model\Layout\Merge::TYPE_PAGE . '"' - . ' or @type="' . \Magento\Core\Model\Layout\Merge::TYPE_FRAGMENT . '"]'; - $handles = $xml->xpath($xpath) ?: array(); + $xpath = '/layouts/*[' + . '@type="' . \Magento\Core\Model\Layout\Merge::TYPE_PAGE . '"' + . ' or @type="' . \Magento\Core\Model\Layout\Merge::TYPE_FRAGMENT . '"]'; + $handles = $xml->xpath($xpath) ?: array(); - /** @var \Magento\Core\Model\Layout\Element $node */ - $errors = array(); - foreach ($handles as $node) { - if (!$node->xpath('@label')) { - $nodeId = $node->getAttribute('id') ? ' id=' . $node->getAttribute('id') : ''; - $errors[] = $node->getName() . $nodeId; - } - } - if ($errors) { - $this->fail("The following handles must have label, but they don't have it:\n" . var_export($errors, 1)); - } + /** @var \Magento\Core\Model\Layout\Element $node */ + $errors = array(); + foreach ($handles as $node) { + if (!$node->xpath('@label')) { + $nodeId = $node->getAttribute('id') ? ' id=' . $node->getAttribute('id') : ''; + $errors[] = $node->getName() . $nodeId; + } + } + if ($errors) { + $this->fail( + 'The following handles must have label, but they don\'t have it:' . PHP_EOL + . var_export($errors, true) + ); + } + }, + $this->areasAndThemesDataProvider() + ); } - /** - * Check whether page types are declared only in layout update files allowed for it - base ones - * - * @dataProvider pageTypesDeclarationDataProvider - */ - public function testPageTypesDeclaration(\Magento\Core\Model\Layout\File $layout) + public function testPageTypesDeclaration() { - $content = simplexml_load_file($layout->getFilename()); - $this->assertEmpty( - $content->xpath(\Magento\Core\Model\Layout\Merge::XPATH_HANDLE_DECLARATION), - "Theme layout update '" . $layout->getFilename() . "' contains page type declaration(s)" + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Check whether page types are declared only in layout update files allowed for it - base ones + */ + function (\Magento\Core\Model\Layout\File $layout) { + $content = simplexml_load_file($layout->getFilename()); + $this->assertEmpty( + $content->xpath(\Magento\Core\Model\Layout\Merge::XPATH_HANDLE_DECLARATION), + "Theme layout update '" . $layout->getFilename() . "' contains page type declaration(s)" + ); + }, + $this->pageTypesDeclarationDataProvider() ); } @@ -217,58 +232,70 @@ class LayoutTest extends \PHPUnit_Framework_TestCase return $result; } - /** - * Check, that for an overriding file ($themeFile) in a theme ($theme), there is a corresponding base file - * - * @param \Magento\Core\Model\Layout\File $themeFile - * @param \Magento\Core\Model\Theme $theme - * @dataProvider overrideBaseFilesDataProvider - */ - public function testOverrideBaseFiles($themeFile, $theme) + public function testOverrideBaseFiles() { - if ($themeFile === self::NO_OVERRIDDEN_THEMES_MARKER) { - $this->markTestSkipped('No overriden themes.'); - } - $baseFiles = self::_getCachedFiles($theme->getArea(), 'Magento\Core\Model\Layout\File\Source\Base', $theme); - $fileKey = $themeFile->getModule() . '/' . $themeFile->getName(); - $this->assertArrayHasKey($fileKey, $baseFiles, - sprintf("Could not find base file, overridden by theme file '%s'.", $themeFile->getFilename()) + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Check, that for an overriding file ($themeFile) in a theme ($theme), there is a corresponding base file + * + * @param \Magento\Core\Model\Layout\File $themeFile + * @param \Magento\Core\Model\Theme $theme + */ + function ($themeFile, $theme) { + $baseFiles = self::_getCachedFiles( + $theme->getArea(), + 'Magento\Core\Model\Layout\File\Source\Base', + $theme + ); + $fileKey = $themeFile->getModule() . '/' . $themeFile->getName(); + $this->assertArrayHasKey($fileKey, $baseFiles, + sprintf("Could not find base file, overridden by theme file '%s'.", $themeFile->getFilename()) + ); + }, + $this->overrideBaseFilesDataProvider() ); } - /** - * Check, that for an ancestor-overriding file ($themeFile) in a theme ($theme), there is a corresponding file - * in that ancestor theme - * - * @param \Magento\Core\Model\Layout\File $themeFile - * @param \Magento\Core\Model\Theme $theme - * @dataProvider overrideThemeFilesDataProvider - */ - public function testOverrideThemeFiles($themeFile, $theme) + public function testOverrideThemeFiles() { - if ($themeFile === self::NO_OVERRIDDEN_THEMES_MARKER) { - $this->markTestSkipped('No overridden themes.'); - } - // Find an ancestor theme, where a file is to be overridden - $ancestorTheme = $theme; - while ($ancestorTheme = $ancestorTheme->getParentTheme()) { - if ($ancestorTheme == $themeFile->getTheme()) { - break; - } - } - $this->assertNotNull( - $ancestorTheme, - sprintf("Could not find ancestor theme '%s', its layout file is supposed to be overridden by file '%s'.", - $themeFile->getTheme()->getCode(), $themeFile->getFilename()) - ); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Check, that for an ancestor-overriding file ($themeFile) in a theme ($theme), + * there is a corresponding file in that ancestor theme + * + * @param \Magento\Core\Model\Layout\File $themeFile + * @param \Magento\Core\Model\Theme $theme + */ + function ($themeFile, $theme) { + // Find an ancestor theme, where a file is to be overridden + $ancestorTheme = $theme; + while ($ancestorTheme = $ancestorTheme->getParentTheme()) { + if ($ancestorTheme == $themeFile->getTheme()) { + break; + } + } + $this->assertNotNull( + $ancestorTheme, + sprintf( + 'Could not find ancestor theme "%s", ' + . 'its layout file is supposed to be overridden by file "%s".', + $themeFile->getTheme()->getCode(), + $themeFile->getFilename() + ) + ); - // Search for the overridden file in the ancestor theme - $ancestorFiles = self::_getCachedFiles($ancestorTheme->getFullPath(), - 'Magento\Core\Model\Layout\File\Source\Theme', $ancestorTheme); - $fileKey = $themeFile->getModule() . '/' . $themeFile->getName(); - $this->assertArrayHasKey($fileKey, $ancestorFiles, - sprintf("Could not find original file in '%s' theme, overridden by file '%s'.", - $themeFile->getTheme()->getCode(), $themeFile->getFilename()) + // Search for the overridden file in the ancestor theme + $ancestorFiles = self::_getCachedFiles($ancestorTheme->getFullPath(), + 'Magento\Core\Model\Layout\File\Source\Theme', $ancestorTheme); + $fileKey = $themeFile->getModule() . '/' . $themeFile->getName(); + $this->assertArrayHasKey($fileKey, $ancestorFiles, + sprintf("Could not find original file in '%s' theme, overridden by file '%s'.", + $themeFile->getTheme()->getCode(), $themeFile->getFilename()) + ); + }, + $this->overrideThemeFilesDataProvider() ); } @@ -285,7 +312,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase if (!isset(self::$_cachedFiles[$cacheKey])) { /* @var $fileList \Magento\Core\Model\Layout\File[] */ $fileList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create($sourceClass)->getFiles($theme); + ->create($sourceClass)->getFiles($theme); $files = array(); foreach ($fileList as $file) { $files[$file->getModule() . '/' . $file->getName()] = true; @@ -302,7 +329,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase { return $this->_retrieveFilesForEveryTheme( \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Layout\File\Source\Override\Base') + ->create('Magento\Core\Model\Layout\File\Source\Override\Base') ); } @@ -313,7 +340,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase { return $this->_retrieveFilesForEveryTheme( \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Layout\File\Source\Override\Theme') + ->create('Magento\Core\Model\Layout\File\Source\Override\Theme') ); } @@ -337,6 +364,6 @@ class LayoutTest extends \PHPUnit_Framework_TestCase $result[] = array($file, $theme); } } - return $result === array() ? array(array(self::NO_OVERRIDDEN_THEMES_MARKER, '')) : $result; + return $result; } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php index dc36e1587ff..97b53df03c8 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php @@ -35,27 +35,32 @@ namespace Magento\Test\Integrity\Modular; */ class BlockInstantiationTest extends \Magento\TestFramework\TestCase\AbstractIntegrity { - /** - * @param string $module - * @param string $class - * @param string $area - * @dataProvider allBlocksDataProvider - */ - public function testBlockInstantiation($module, $class, $area) + public function testBlockInstantiation() { - $this->assertNotEmpty($module); - $this->assertTrue(class_exists($class), "Block class: {$class}"); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\Config\Scope') - ->setCurrentScope($area); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $module + * @param string $class + * @param string $area + */ + function ($module, $class, $area) { + $this->assertNotEmpty($module); + $this->assertTrue(class_exists($class), "Block class: {$class}"); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Core\Model\Config\Scope') + ->setCurrentScope($area); - /** @var \Magento\Core\Model\App $app */ - $app = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App'); - $app->loadArea($area); + /** @var \Magento\Core\Model\App $app */ + $app = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App'); + $app->loadArea($area); - $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create($class); - $this->assertNotNull($block); + $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create($class); + $this->assertNotNull($block); + }, + $this->allBlocksDataProvider() + ); } /** @@ -86,7 +91,7 @@ class BlockInstantiationTest extends \Magento\TestFramework\TestCase\AbstractInt return $templateBlocks; } catch (\Exception $e) { trigger_error("Corrupted data provider. Last known block instantiation attempt: '{$blockClass}'." - . " \Exception: {$e}", E_USER_ERROR); + . " Exception: {$e}", E_USER_ERROR); } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LoggingConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LoggingConfigFilesTest.php deleted file mode 100644 index 52835cd450f..00000000000 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LoggingConfigFilesTest.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * Tests that existing logging.xml files are valid to schema individually and merged. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in 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\Test\Integrity\Modular; - -class LoggingConfigFilesTest extends \Magento\TestFramework\TestCase\AbstractConfigFiles -{ - /** - * Returns the reader class name that will be instantiated via ObjectManager - * - * @return string reader class name - */ - protected function _getReaderClassName() - { - return 'Magento\Logging\Model\Config\Reader'; - } - - /** - * Returns a string that represents the path to the config file, starting in the app directory. - * - * Format is glob, so * is allowed. - * - * @return string - */ - protected function _getConfigFilePathGlob() - { - return '/*/*/*/etc/logging.xml'; - } - - /** - * Returns a path to the per file XSD file, relative to the modules directory. - * - * @return string - */ - protected function _getXsdPath() - { - return '/Magento/Logging/etc/logging_file.xsd'; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php index baee1eff5ce..deee3cbb341 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php @@ -32,28 +32,33 @@ namespace Magento\Test\Integrity\Modular; */ class TemplateFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity { - /** - * @param string $module - * @param string $template - * @param string $class - * @param string $area - * @dataProvider allTemplatesDataProvider - */ - public function testAllTemplates($module, $template, $class, $area) + public function testAllTemplates() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\View\DesignInterface') - ->setDefaultDesignTheme(); - // intentionally to make sure the module files will be requested - $params = array( - 'area' => $area, - 'themeModel' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Theme'), - 'module' => $module + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $module + * @param string $template + * @param string $class + * @param string $area + */ + function ($module, $template, $class, $area) { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\View\DesignInterface') + ->setDefaultDesignTheme(); + // intentionally to make sure the module files will be requested + $params = array( + 'area' => $area, + 'themeModel' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Core\Model\Theme'), + 'module' => $module + ); + $file = \Magento\TestFramework\Helper\Bootstrap::getObjectmanager() + ->get('Magento\Core\Model\View\FileSystem') + ->getFilename($template, $params); + $this->assertFileExists($file, "Block class: {$class}"); + }, + $this->allTemplatesDataProvider() ); - $file = \Magento\TestFramework\Helper\Bootstrap::getObjectmanager() - ->get('Magento\Core\Model\View\FileSystem') - ->getFilename($template, $params); - $this->assertFileExists($file, "Block class: {$class}"); } /** @@ -106,7 +111,7 @@ class TemplateFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrit return $templates; } catch (\Exception $e) { trigger_error("Corrupted data provider. Last known block instantiation attempt: '{$blockClass}'." - . " \Exception: {$e}", E_USER_ERROR); + . " Exception: {$e}", E_USER_ERROR); } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php index d63234058ab..12bcd790fb8 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php @@ -29,20 +29,26 @@ namespace Magento\Test\Integrity\Modular; class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity { - /** - * @param string $application - * @param string $file - * @dataProvider viewFilesFromModulesViewDataProvider - */ - public function testViewFilesFromModulesView($application, $file) + public function testViewFilesFromModulesView() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\View\DesignInterface') - ->setArea($application) - ->setDefaultDesignTheme(); - $result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\View\FileSystem') - ->getViewFile($file); - $this->assertFileExists($result); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $application + * @param string $file + */ + function ($application, $file) { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Core\Model\View\DesignInterface') + ->setArea($application) + ->setDefaultDesignTheme(); + $result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Core\Model\View\FileSystem') + ->getViewFile($file); + $this->assertFileExists($result); + }, + $this->viewFilesFromModulesViewDataProvider() + ); } /** @@ -86,8 +92,8 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity continue; } foreach (new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($viewAppDir->getRealPath())) as $fileInfo - ) { + new \RecursiveDirectoryIterator($viewAppDir->getRealPath()) + ) as $fileInfo) { $references = $this->_findReferencesToViewFile($fileInfo); if (!isset($files[$area])) { $files[$area] = $references; @@ -124,21 +130,27 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity return $result; } - /** - * getViewUrl() hard-coded in the php-files - * - * @param string $application - * @param string $file - * @dataProvider viewFilesFromModulesCodeDataProvider - */ - public function testViewFilesFromModulesCode($application, $file) + public function testViewFilesFromModulesCode() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\View\DesignInterface') - ->setArea($application) - ->setDefaultDesignTheme(); - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\View\FileSystem'); - $this->assertFileExists($filesystem->getViewFile($file)); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * getViewUrl() hard-coded in the php-files + * + * @param string $application + * @param string $file + */ + function ($application, $file) { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Core\Model\View\DesignInterface') + ->setArea($application) + ->setDefaultDesignTheme(); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Core\Model\View\FileSystem'); + $this->assertFileExists($filesystem->getViewFile($file)); + }, + $this->viewFilesFromModulesCodeDataProvider() + ); } /** diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php index b283e8f651b..34bc16aa894 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php @@ -29,49 +29,54 @@ namespace Magento\Test\Integrity\Theme; class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity { - /** - * @param string $area - * @param string $themeId - * @param string $file - * @dataProvider viewFilesFromThemesDataProvider - * @throws \PHPUnit_Framework_AssertionFailedError|Exception - */ - public function testViewFilesFromThemes($area, $themeId, $file) + public function testViewFilesFromThemes() { - $this->_markTestIncompleteDueToBug($area, $file); - try { - $params = array('area' => $area, 'themeId' => $themeId); - $viewFile = \Magento\TestFramework\Helper\Bootstrap::getObjectmanager() - ->get('Magento\Core\Model\View\FileSystem') - ->getViewFile($file, $params); - $this->assertFileExists($viewFile); - - $fileParts = explode(\Magento\Core\Model\View\Service::SCOPE_SEPARATOR, $file); - if (count($fileParts) > 1) { - $params['module'] = $fileParts[0]; - } - if (pathinfo($file, PATHINFO_EXTENSION) == 'css') { - $errors = array(); - $content = file_get_contents($viewFile); - preg_match_all(\Magento\Core\Helper\Css::REGEX_CSS_RELATIVE_URLS, $content, $matches); - foreach ($matches[1] as $relativePath) { - $path = $this->_addCssDirectory($relativePath, $file); - $pathFile = \Magento\TestFramework\Helper\Bootstrap::getObjectmanager() + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $area + * @param string $themeId + * @param string $file + * @throws \PHPUnit_Framework_AssertionFailedError|Exception + */ + function ($area, $themeId, $file) { + $this->_markTestIncompleteDueToBug($area, $file); + try { + $params = array('area' => $area, 'themeId' => $themeId); + $viewFile = \Magento\TestFramework\Helper\Bootstrap::getObjectmanager() ->get('Magento\Core\Model\View\FileSystem') - ->getViewFile($path, $params); - if (!is_file($pathFile)) { - $errors[] = $relativePath; + ->getViewFile($file, $params); + $this->assertFileExists($viewFile); + + $fileParts = explode(\Magento\Core\Model\View\Service::SCOPE_SEPARATOR, $file); + if (count($fileParts) > 1) { + $params['module'] = $fileParts[0]; } + if (pathinfo($file, PATHINFO_EXTENSION) == 'css') { + $errors = array(); + $content = file_get_contents($viewFile); + preg_match_all(\Magento\Core\Helper\Css::REGEX_CSS_RELATIVE_URLS, $content, $matches); + foreach ($matches[1] as $relativePath) { + $path = $this->_addCssDirectory($relativePath, $file); + $pathFile = \Magento\TestFramework\Helper\Bootstrap::getObjectmanager() + ->get('Magento\Core\Model\View\FileSystem') + ->getViewFile($path, $params); + if (!is_file($pathFile)) { + $errors[] = $relativePath; + } + } + if (!empty($errors)) { + $this->fail('Cannot find file(s): ' . implode(', ', $errors)); + } + } + } catch (\PHPUnit_Framework_AssertionFailedError $e) { + throw $e; + } catch (\Exception $e) { + $this->fail($e->getMessage()); } - if (!empty($errors)) { - $this->fail('Cannot find file(s): ' . implode(', ', $errors)); - } - } - } catch (\PHPUnit_Framework_AssertionFailedError $e) { - throw $e; - } catch (\Exception $e) { - $this->fail($e->getMessage()); - } + }, + $this->viewFilesFromThemesDataProvider() + ); } /** @@ -82,10 +87,9 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity */ protected function _markTestIncompleteDueToBug($area, $file) { - if (($area === 'frontend' && in_array($file, array( - 'css/styles.css', 'js/head.js', 'mui/reset.css', 'js/jquery.dropdowns.js', 'js/tabs.js', - 'js/selectivizr-min.js', - ))) || ($area === 'adminhtml' && in_array($file, array('mui/reset.css')))) { + if ($area === 'frontend' && in_array($file, array('js/selectivizr-min.js', 'css/styles.css')) + || $area === 'adminhtml' && in_array($file, array('mui/reset.css')) + ) { $this->markTestIncomplete('MAGETWO-9806, MAGETWO-12325'); } } diff --git a/dev/tests/static/framework/Magento/TestFramework/Dependency/_files/tables_ee.php b/dev/tests/static/framework/Magento/TestFramework/Dependency/_files/tables_ee.php deleted file mode 100644 index 5326f6ae2f3..00000000000 --- a/dev/tests/static/framework/Magento/TestFramework/Dependency/_files/tables_ee.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -return array ( - 'magento_rma_item_entity_datetime' => 'Magento_Rma', - 'magento_rma_item_entity_decimal' => 'Magento_Rma', - 'magento_rma_item_entity_int' => 'Magento_Rma', - 'magento_rma_item_entity_text' => 'Magento_Rma', - 'magento_rma_item_entity_varchar' => 'Magento_Rma', - 'magento_banner' => 'Magento_Banner', - 'magento_banner_catalogrule' => 'Magento_Banner', - 'magento_banner_content' => 'Magento_Banner', - 'magento_banner_customersegment' => 'Magento_Banner', - 'magento_banner_salesrule' => 'Magento_Banner', - 'magento_catalogevent_event' => 'Magento_CatalogEvent', - 'magento_catalogevent_event_image' => 'Magento_CatalogEvent', - 'magento_catalogpermissions' => 'Magento_CatalogPermissions', - 'magento_catalogpermissions_index' => 'Magento_CatalogPermissions', - 'magento_catalogpermissions_index_product' => 'Magento_CatalogPermissions', - 'magento_versionscms_hierarchy_lock' => 'Magento_VersionsCms', - 'magento_versionscms_hierarchy_metadata' => 'Magento_VersionsCms', - 'magento_versionscms_hierarchy_node' => 'Magento_VersionsCms', - 'magento_versionscms_increment' => 'Magento_VersionsCms', - 'magento_versionscms_page_revision' => 'Magento_VersionsCms', - 'magento_versionscms_page_version' => 'Magento_VersionsCms', - 'magento_customercustomattributes_sales_flat_order' => 'Magento_CustomerCustomAttributes', - 'magento_customercustomattributes_sales_flat_order_address' => 'Magento_CustomerCustomAttributes', - 'magento_customercustomattributes_sales_flat_quote' => 'Magento_CustomerCustomAttributes', - 'magento_customercustomattributes_sales_flat_quote_address' => 'Magento_CustomerCustomAttributes', - 'magento_customerbalance' => 'Magento_CustomerBalance', - 'magento_customerbalance_history' => 'Magento_CustomerBalance', - 'magento_customersegment_customer' => 'Magento_CustomerSegment', - 'magento_customersegment_event' => 'Magento_CustomerSegment', - 'magento_customersegment_segment' => 'Magento_CustomerSegment', - 'magento_customersegment_website' => 'Magento_CustomerSegment', - 'magento_giftcard_amount' => 'Magento_GiftCard', - 'magento_giftcardaccount' => 'Magento_GiftcardAccount', - 'magento_giftcardaccount_history' => 'Magento_GiftcardAccount', - 'magento_giftcardaccount_pool' => 'Magento_GiftcardAccount', - 'magento_giftregistry_data' => 'Magento_GiftRegistry', - 'magento_giftregistry_entity' => 'Magento_GiftRegistry', - 'magento_giftregistry_type_info' => 'Magento_GiftRegistry', - 'magento_giftregistry_item' => 'Magento_GiftRegistry', - 'magento_giftregistry_item_option' => 'Magento_GiftRegistry', - 'magento_giftregistry_label' => 'Magento_GiftRegistry', - 'magento_giftregistry_person' => 'Magento_GiftRegistry', - 'magento_giftregistry_type' => 'Magento_GiftRegistry', - 'magento_giftwrapping_store_attributes' => 'Magento_GiftWrapping', - 'magento_giftwrapping_website' => 'Magento_GiftWrapping', - 'magento_giftwrapping' => 'Magento_GiftWrapping', - 'magento_scheduled_operations' => 'Magento_ScheduledImportExport', - 'magento_invitation' => 'Magento_Invitation', - 'magento_invitation_status_history' => 'Magento_Invitation', - 'magento_invitation_track' => 'Magento_Invitation', - 'magento_logging_event' => 'Magento_Logging', - 'magento_logging_event_changes' => 'Magento_Logging', - 'enterprise_admin_passwords' => 'Magento_Pci', - 'magento_reminder_rule_coupon' => 'Magento_Reminder', - 'magento_reminder_rule_log' => 'Magento_Reminder', - 'magento_reminder_rule' => 'Magento_Reminder', - 'magento_reminder_template' => 'Magento_Reminder', - 'magento_reminder_rule_website' => 'Magento_Reminder', - 'magento_reward' => 'Magento_Reward', - 'magento_reward_history' => 'Magento_Reward', - 'magento_reward_rate' => 'Magento_Reward', - 'magento_reward_salesrule' => 'Magento_Reward', - 'magento_rma_item_eav_attribute' => 'Magento_Rma', - 'magento_rma_item_eav_attribute_website' => 'Magento_Rma', - 'magento_rma_item_entity' => 'Magento_Rma', - 'magento_rma_item_form_attribute' => 'Magento_Rma', - 'magento_rma' => 'Magento_Rma', - 'magento_rma_grid' => 'Magento_Rma', - 'magento_rma_shipping_label' => 'Magento_Rma', - 'magento_rma_status_history' => 'Magento_Rma', - 'magento_sales_creditmemo_grid_archive' => 'Magento_SalesArchive', - 'magento_sales_invoice_grid_archive' => 'Magento_SalesArchive', - 'magento_sales_order_grid_archive' => 'Magento_SalesArchive', - 'magento_sales_shipment_grid_archive' => 'Magento_SalesArchive', - 'catalogsearch_recommendations' => 'Magento_Search', - 'magento_targetrule_customersegment' => 'Magento_TargetRule', - 'magento_targetrule_index' => 'Magento_TargetRule', - 'magento_targetrule_index_crosssell' => 'Magento_TargetRule', - 'magento_targetrule_index_related' => 'Magento_TargetRule', - 'magento_targetrule_index_upsell' => 'Magento_TargetRule', - 'magento_targetrule_product' => 'Magento_TargetRule', - 'magento_targetrule' => 'Magento_TargetRule', - 'job_queue' => 'Magento_Queue', -); diff --git a/dev/tests/static/framework/Magento/TestFramework/Integrity/AbstractConfig.php b/dev/tests/static/framework/Magento/TestFramework/Integrity/AbstractConfig.php index 9c3926746a5..10c7cc43635 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Integrity/AbstractConfig.php +++ b/dev/tests/static/framework/Magento/TestFramework/Integrity/AbstractConfig.php @@ -27,33 +27,20 @@ namespace Magento\TestFramework\Integrity; abstract class AbstractConfig extends \PHPUnit_Framework_TestCase { - /** indicator no config file found */ - const NO_CONFIG_FILE = 'no config file'; - - /** - * @param string $configFile - * - * @dataProvider configFilesDataProvider - */ - public function testXml($configFile) - { - if ($configFile == self::NO_CONFIG_FILE) { - $this->markTestSkipped( - 'There is no config file to test.' - ); - } - $schema = \Magento\TestFramework\Utility\Files::init()->getPathToSource() . $this->_getXsd(); - $fileSchema = \Magento\TestFramework\Utility\Files::init()->getPathToSource() . $this->_getFileXsd(); - $this->_validateFileExpectSuccess($configFile, $schema, $fileSchema); - } - - /** - * @return array - */ - public function configFilesDataProvider() + public function testXmlFiles() { - $fileList = \Magento\TestFramework\Utility\Files::init()->getConfigFiles($this->_getXmlName()); - return empty($fileList) ? array(self::NO_CONFIG_FILE => array(self::NO_CONFIG_FILE)) : $fileList; + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $configFile + */ + function ($configFile) { + $schema = \Magento\TestFramework\Utility\Files::init()->getPathToSource() . $this->_getXsd(); + $fileSchema = \Magento\TestFramework\Utility\Files::init()->getPathToSource() . $this->_getFileXsd(); + $this->_validateFileExpectSuccess($configFile, $schema, $fileSchema); + }, + \Magento\TestFramework\Utility\Files::init()->getConfigFiles($this->_getXmlName()) + ); } public function testSchemaUsingValidXml() diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/AggregateInvoker.php b/dev/tests/static/framework/Magento/TestFramework/Utility/AggregateInvoker.php new file mode 100644 index 00000000000..3e0dc8e6dbd --- /dev/null +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/AggregateInvoker.php @@ -0,0 +1,133 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\TestFramework\Utility; + +/** + * Runs given callback across given array of data and collects all PhpUnit assertion results. + * Should be used in case data provider is huge to minimize overhead. + */ +class AggregateInvoker +{ + /** + * @var PHPUnit_Framework_TestCase + */ + protected $_testCase; + + /** + * There is no PHPUnit internal API to determine whether --verbose or --debug options are passed. + * When verbose is true, data sets are gathered for any result, includind incomplete and skipped test. + * Only data sets for failed assertions are gathered otherwise. + * + * @var array + */ + protected $_options = array( + 'verbose' => false, + ); + + /** + * @param \PHPUnit_Framework_TestCase $testCase + * @param array $options + */ + public function __construct( + \PHPUnit_Framework_TestCase $testCase, + array $options = array() + ) { + $this->_testCase = $testCase; + $this->_options = $options + $this->_options; + } + + /** + * Collect all failed assertions and fail test in case such list is not empty. + * Incomplete and skipped test results are aggregated as well. + * + * @param callable $callback + * @param array[] $dataSource + */ + public function __invoke(callable $callback, array $dataSource) + { + $exceptionDumper = function (\Exception $exception, $dataSet) { + $dataSet = $exception instanceof \PHPUnit_Framework_AssertionFailedError + && !$exception instanceof \PHPUnit_Framework_IncompleteTestError + && !$exception instanceof \PHPUnit_Framework_SkippedTestError + || $this->_options['verbose'] + ? 'Data set: ' . var_export($dataSet, true) . PHP_EOL : ''; + return $dataSet . $exception->getMessage() . PHP_EOL + . \PHPUnit_Util_Filter::getFilteredStacktrace($exception); + }; + $results = [ + 'PHPUnit_Framework_IncompleteTestError' => [], + 'PHPUnit_Framework_SkippedTestError' => [], + 'PHPUnit_Framework_AssertionFailedError' => [], + ]; + $passed = 0; + foreach ($dataSource as $dataSet) { + try { + call_user_func_array($callback, $dataSet); + $passed++; + } catch (\PHPUnit_Framework_IncompleteTestError $exception) { + $results[get_class($exception)][] = $exceptionDumper($exception, $dataSet); + } catch (\PHPUnit_Framework_SkippedTestError $exception) { + $results[get_class($exception)][] = $exceptionDumper($exception, $dataSet); + } catch (\PHPUnit_Framework_AssertionFailedError $exception) { + $results[get_class($exception)][] = $exceptionDumper($exception, $dataSet); + } + } + $this->processResults($results, $passed); + } + + /** + * Analyze results of aggregated tests execution and complete test case appropriately + * + * @param array $results + * @param int $passed + */ + protected function processResults(array $results, $passed) + { + $totalCountsMessage = sprintf( + 'Passed: %d, Failed: %d, Incomplete: %d, Skipped: %d.', + $passed, + count($results['PHPUnit_Framework_AssertionFailedError']), + count($results['PHPUnit_Framework_IncompleteTestError']), + count($results['PHPUnit_Framework_SkippedTestError']) + ); + if ($results['PHPUnit_Framework_AssertionFailedError']) { + $this->_testCase->fail( + $totalCountsMessage . PHP_EOL + . implode(PHP_EOL, $results['PHPUnit_Framework_AssertionFailedError']) + ); + } + if (!$results['PHPUnit_Framework_IncompleteTestError'] && !$results['PHPUnit_Framework_SkippedTestError']) { + return; + } + $message = $totalCountsMessage . PHP_EOL + . implode(PHP_EOL, $results['PHPUnit_Framework_IncompleteTestError']) . PHP_EOL + . implode(PHP_EOL, $results['PHPUnit_Framework_SkippedTestError']); + if ($results['PHPUnit_Framework_IncompleteTestError']) { + $this->_testCase->markTestIncomplete($message); + } elseif ($results['PHPUnit_Framework_SkippedTestError']) { + $this->_testCase->markTestSkipped($message); + } + } +} diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php b/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php index 7b216e89a8b..d7348a51128 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php @@ -153,29 +153,65 @@ class Files /** * Returns list of files, where expected to have class declarations * + * @param bool $appCode application PHP-code + * @param bool $devTests + * @param bool $devTools + * @param bool $downloaderApp + * @param bool $downloaderLib + * @param bool $lib * @param bool $asDataSet * @return array */ - public function getClassFiles($asDataSet = true) - { - $key = __METHOD__ . $this->_path; - 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'), - self::_getFiles(array("{$this->_path}/dev/tools/Magento"), '*.php'), - self::_getFiles(array("{$this->_path}/downloader/app/Magento"), '*.php'), - self::_getFiles(array("{$this->_path}/downloader/lib/Magento"), '*.php'), - self::_getFiles(array("{$this->_path}/lib/Magento"), '*.php') - ); + public function getClassFiles( + $appCode = true, $devTests = true, $devTools = true, + $downloaderApp = true, $downloaderLib = true, $lib = true, $asDataSet = true + ) { + $key = __METHOD__ . + "/{$this->_path}/{$appCode}/{$devTests}/{$devTools}/{$downloaderApp}/{$downloaderLib}/{$lib}"; + if (!isset(self::$_cache[$key])) { + $files = array(); + if ($appCode) { + $files = array_merge( + $files, + self::_getFiles(array("{$this->_path}/app/code/Magento"), '*.php') + ); + } + if ($devTests) { + $files = array_merge( + $files, + self::_getFiles(array("{$this->_path}/dev/tests"), '*.php') + ); + } + if ($devTools) { + $files = array_merge( + $files, + self::_getFiles(array("{$this->_path}/dev/tools/Magento"), '*.php') + ); + } + if ($downloaderApp) { + $files = array_merge( + $files, + self::_getFiles(array("{$this->_path}/downloader/app/Magento"), '*.php') + ); + } + if ($downloaderLib) { + $files = array_merge( + $files, + self::_getFiles(array("{$this->_path}/downloader/lib/Magento"), '*.php') + ); + } + if ($lib) { + $files = array_merge( + $files, + self::_getFiles(array("{$this->_path}/lib/Magento"), '*.php') + ); + } self::$_cache[$key] = $files; } if ($asDataSet) { - return self::composeDataSets($files); + return self::composeDataSets(self::$_cache[$key]); } - return $files; + return self::$_cache[$key]; } /** @@ -534,7 +570,15 @@ class Files $className = array_pop($classParts); $namespace = implode('\\', $classParts); $path = implode(DIRECTORY_SEPARATOR, explode('\\', $class)) . '.php'; - $directories = array('/app/code/', '/lib/'); + $directories = array( + '/app/code/', '/lib/', '/downloader/app/', '/downloader/lib/', '/dev/tools/', + '/dev/tests/api-functional/framework/', '/dev/tests/integration/framework/', + '/dev/tests/integration/framework/tests/unit/testsuite/', '/dev/tests/integration/testsuite/', + '/dev/tests/integration/testsuite/Magento/Test/Integrity/', '/dev/tests/performance/framework/', + '/dev/tests/static/framework/', '/dev/tests/static/testsuite/', + '/dev/tests/unit/framework/', '/dev/tests/unit/testsuite/', + ); + foreach ($directories as $dir) { $fullPath = str_replace('/', DIRECTORY_SEPARATOR, $this->_path . $dir . $path); /** diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php index c3ac90d843a..512ea7ece34 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php @@ -37,54 +37,55 @@ class ClassesTest extends \PHPUnit_Framework_TestCase */ protected static $_existingClasses = array(); - /** - * @param string $file - * @dataProvider phpFileDataProvider - */ - public function testPhpFile($file) + protected static $_keywordsBlacklist = array("String", "Array", "Boolean", "Element"); + + public function testPhpFiles() { - $contents = file_get_contents($file); - $classes = \Magento\TestFramework\Utility\Classes::getAllMatches($contents, '/ - # ::getResourceModel ::getBlockSingleton ::getModel ::getSingleton - \:\:get(?:ResourceModel | BlockSingleton | Model | Singleton)?\(\s*[\'"]([a-z\d\\\\]+)[\'"]\s*[\),] - - # various methods, first argument - | \->(?:initReport | addBlock | createBlock | setDataHelperName | _?initLayoutMessages - | setAttributeModel | setBackendModel | setFrontendModel | setSourceModel | setModel - )\(\s*\'([a-z\d\\\\]+)\'\s*[\),] - - # various methods, second argument - | \->add(?:ProductConfigurationHelper | OptionsRenderCfg)\(.+?,\s*\'([a-z\d\\\\]+)\'\s*[\),] - - # \Mage::helper ->helper - | (?:Mage\:\:|\->)helper\(\s*\'([a-z\d\\\\]+)\'\s*\) - - # misc - | function\s_getCollectionClass\(\)\s+{\s+return\s+[\'"]([a-z\d\\\\]+)[\'"] - | \'resource_model\'\s*=>\s*[\'"]([a-z\d\\\\]+)[\'"] - | (?:_parentResourceModelName | _checkoutType | _apiType)\s*=\s*\'([a-z\d\\\\]+)\' - | \'renderer\'\s*=>\s*\'([a-z\d\\\\]+)\' - /ix' - ); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $contents = file_get_contents($file); + $classes = \Magento\TestFramework\Utility\Classes::getAllMatches($contents, '/ + # ::getResourceModel ::getBlockSingleton ::getModel ::getSingleton + \:\:get(?:ResourceModel | BlockSingleton | Model | Singleton)?\(\s*[\'"]([a-z\d\\\\]+)[\'"]\s*[\),] - // without modifier "i". Starting from capital letter is a significant characteristic of a class name - \Magento\TestFramework\Utility\Classes::getAllMatches($contents, '/(?:\-> | parent\:\:)(?:_init | setType)\(\s* - \'([A-Z][a-z\d][A-Za-z\d\\\\]+)\'(?:,\s*\'([A-Z][a-z\d][A-Za-z\d\\\\]+)\') - \s*\)/x', - $classes - ); + # various methods, first argument + | \->(?:initReport | addBlock | createBlock | setDataHelperName | _?initLayoutMessages + | setAttributeModel | setBackendModel | setFrontendModel | setSourceModel | setModel + )\(\s*\'([a-z\d\\\\]+)\'\s*[\),] - $this->_collectResourceHelpersPhp($contents, $classes); + # various methods, second argument + | \->add(?:ProductConfigurationHelper | OptionsRenderCfg)\(.+?,\s*\'([a-z\d\\\\]+)\'\s*[\),] - $this->_assertClassesExist($classes, $file); - } + # \Mage::helper ->helper + | (?:Mage\:\:|\->)helper\(\s*\'([a-z\d\\\\]+)\'\s*\) - /** - * @return array - */ - public function phpFileDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getPhpFiles(); + # misc + | function\s_getCollectionClass\(\)\s+{\s+return\s+[\'"]([a-z\d\\\\]+)[\'"] + | \'resource_model\'\s*=>\s*[\'"]([a-z\d\\\\]+)[\'"] + | (?:_parentResourceModelName | _checkoutType | _apiType)\s*=\s*\'([a-z\d\\\\]+)\' + | \'renderer\'\s*=>\s*\'([a-z\d\\\\]+)\' + /ix' + ); + + // without modifier "i". Starting from capital letter is a significant characteristic of a class name + \Magento\TestFramework\Utility\Classes::getAllMatches( + $contents, + '/(?:\-> | parent\:\:)(?:_init | setType)\(\s* + \'([A-Z][a-z\d][A-Za-z\d\\\\]+)\'(?:,\s*\'([A-Z][a-z\d][A-Za-z\d\\\\]+)\') + \s*\)/x', + $classes + ); + + $this->_collectResourceHelpersPhp($contents, $classes); + + $this->_assertClassesExist($classes, $file); + }, + \Magento\TestFramework\Utility\Files::init()->getPhpFiles() + ); } /** @@ -102,55 +103,49 @@ class ClassesTest extends \PHPUnit_Framework_TestCase } } - /** - * @param string $path - * @dataProvider configFileDataProvider - */ - public function testConfigFile($path) + public function testConfigFiles() { - $classes = \Magento\TestFramework\Utility\Classes::collectClassesInConfig(simplexml_load_file($path)); - $this->_assertClassesExist($classes); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $path + */ + function ($path) { + $classes = \Magento\TestFramework\Utility\Classes::collectClassesInConfig(simplexml_load_file($path)); + $this->_assertClassesExist($classes, $path); + }, + \Magento\TestFramework\Utility\Files::init()->getMainConfigFiles() + ); } - /** - * @return array - */ - public function configFileDataProvider() + public function testLayoutFiles() { - return \Magento\TestFramework\Utility\Files::init()->getMainConfigFiles(); - } + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $path + */ + function ($path) { + $xml = simplexml_load_file($path); - /** - * @param string $path - * @dataProvider layoutFileDataProvider - */ - public function testLayoutFile($path) - { - $xml = simplexml_load_file($path); + $classes = \Magento\TestFramework\Utility\Classes::getXmlNodeValues($xml, + '/layout//*[contains(text(), "\\\\Block\\\\") or contains(text(), + "\\\\Model\\\\") or contains(text(), "\\\\Helper\\\\")]' + ); + foreach (\Magento\TestFramework\Utility\Classes::getXmlAttributeValues($xml, + '/layout//@helper', 'helper') as $class) { + $classes[] = \Magento\TestFramework\Utility\Classes::getCallbackClass($class); + } + foreach (\Magento\TestFramework\Utility\Classes::getXmlAttributeValues($xml, + '/layout//@module', 'module') as $module) { + $classes[] = str_replace('_', '\\', "{$module}_Helper_Data"); + } + $classes = array_merge($classes, \Magento\TestFramework\Utility\Classes::collectLayoutClasses($xml)); - $classes = \Magento\TestFramework\Utility\Classes::getXmlNodeValues($xml, - '/layout//*[contains(text(), "\\\\Block\\\\") or contains(text(), - "\\\\Model\\\\") or contains(text(), "\\\\Helper\\\\")]' + $this->_assertClassesExist(array_unique($classes), $path); + }, + \Magento\TestFramework\Utility\Files::init()->getLayoutFiles() ); - foreach (\Magento\TestFramework\Utility\Classes::getXmlAttributeValues($xml, - '/layout//@helper', 'helper') as $class) { - $classes[] = \Magento\TestFramework\Utility\Classes::getCallbackClass($class); - } - foreach (\Magento\TestFramework\Utility\Classes::getXmlAttributeValues($xml, - '/layout//@module', 'module') as $module) { - $classes[] = str_replace('_', '\\', "{$module}_Helper_Data"); - } - $classes = array_merge($classes, \Magento\TestFramework\Utility\Classes::collectLayoutClasses($xml)); - - $this->_assertClassesExist(array_unique($classes), $path); - } - - /** - * @return array - */ - public function layoutFileDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getLayoutFiles(); } /** @@ -163,12 +158,13 @@ class ClassesTest extends \PHPUnit_Framework_TestCase * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ - protected function _assertClassesExist($classes) + protected function _assertClassesExist($classes, $path) { if (!$classes) { return; } $badClasses = array(); + $badUsages = array(); $isBug = false; foreach ($classes as $class) { try { @@ -176,58 +172,74 @@ class ClassesTest extends \PHPUnit_Framework_TestCase $isBug = true; continue; } - $this->assertTrue(isset(self::$_existingClasses[$class]) - || \Magento\TestFramework\Utility\Files::init()->classFileExists($class) - || \Magento\TestFramework\Utility\Classes::isVirtual($class) - || \Magento\TestFramework\Utility\Classes::isAutogenerated($class) - ); + if (strrchr($class, '\\') == false) { + $badUsages[] = $class; + continue; + } else { + $this->assertTrue(isset(self::$_existingClasses[$class]) + || \Magento\TestFramework\Utility\Files::init()->classFileExists($class) + || \Magento\TestFramework\Utility\Classes::isVirtual($class) + || \Magento\TestFramework\Utility\Classes::isAutogenerated($class) + ); + } self::$_existingClasses[$class] = 1; } catch (\PHPUnit_Framework_AssertionFailedError $e) { $badClasses[] = $class; } } if ($badClasses) { - $this->fail("Missing files with declaration of classes:\n" . implode("\n", $badClasses)); + $this->fail( + "Files not found for following usages in $path:\n" . implode("\n", $badClasses) + ); + } + if ($badUsages) { + $this->fail("Bad usages of classes in $path: \n" . implode("\n", $badUsages)); } if ($isBug) { $this->markTestIncomplete('Bug MAGE-4763'); } } - /** - * Assert PHP classes have valid pseudo-namespaces according to file locations - * - * - * @param array $file - * @dataProvider phpClassDataProvider - */ - public function testClassNamespace($file) + public function testClassNamespaces() { - $contents = file_get_contents($file); - $relativePath = str_replace(\Magento\TestFramework\Utility\Files::init()->getPathToSource(), "", $file); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Assert PHP classes have valid formal namespaces according to file locations + * + * @param array $file + */ + function ($file) { + $relativePath = str_replace(\Magento\TestFramework\Utility\Files::init()->getPathToSource(), "", $file); + // exceptions made for the files from the blacklist + $blacklist = require __DIR__ . '/NamespaceBlacklist.php'; + if (in_array($relativePath, $blacklist)) { + return; + } - $classPattern = '/^class\s[A-Z][^\s\/]+/m'; + $contents = file_get_contents($file); - $classNameMatch = array(); - $className = null; + $classPattern = '/^(abstract\s)?class\s[A-Z][^\s\/]+/m'; - // exceptions made for the files from the blacklist - $blacklist = require __DIR__ . '/Blacklist.php'; - if (in_array($relativePath, $blacklist)) { - return; - } + $classNameMatch = array(); + $className = null; - // if no class declaration found for $file, then skip this file - if (!preg_match($classPattern, $contents, $classNameMatch) != 0) { - return; - } + // if no class declaration found for $file, then skip this file + if (preg_match($classPattern, $contents, $classNameMatch) == 0) { + return; + } - $className = substr($classNameMatch[0], 6); - $this->_assertClassNamespace($file, $relativePath, $contents, $className); + $classParts = explode(' ', $classNameMatch[0]); + $className = array_pop($classParts); + $this->_assertClassNamespace($file, $relativePath, $contents, $className); + }, + \Magento\TestFramework\Utility\Files::init()->getClassFiles() + ); } + /** - * Assert PHP classes have valid pseudo-namespaces according to file locations + * Assert PHP classes have valid formal namespaces according to file locations * * * @param string $file @@ -237,40 +249,203 @@ class ClassesTest extends \PHPUnit_Framework_TestCase */ protected function _assertClassNamespace($file, $relativePath, $contents, $className) { - $namespacePattern = '/(Maged|Magento|Zend)\/[a-zA-Z]+[^\.]+/'; - $formalPattern = '/^namespace\s[\\\\a-zA-Z\d]+/m'; + $namespacePattern = '/(Magento|Zend)\/[a-zA-Z]+[^\.]+/'; + $formalPattern = '/^namespace\s[a-zA-Z]+(\\\\[a-zA-Z0-9]+)*/m'; $namespaceMatch = array(); $formalNamespaceArray = array(); - $namespace = null; $namespaceFolders = null; - if (preg_match($namespacePattern, $relativePath, $namespaceMatch) != 0) { - $namespace = str_replace('/', '_', $namespaceMatch[0]); - $namespaceFolders = $namespaceMatch[0]; + // if no namespace pattern found according to the path of the file, skip the file + if (preg_match($namespacePattern, $relativePath, $namespaceMatch) == 0) { + return; } + $namespaceFolders = $namespaceMatch[0]; + $classParts = explode('/', $namespaceFolders); + array_pop($classParts); + $expectedNamespace = implode('\\', $classParts); + if (preg_match($formalPattern, $contents, $formalNamespaceArray) != 0) { - $formalNamespace = substr($formalNamespaceArray[0], 10); - $formalNamespace = str_replace('\\', '/', $formalNamespace); - $formalNamespace .= '/'. $className; - if ($namespaceFolders != null && $formalNamespace != null) { - $this->assertEquals($formalNamespace, $namespaceFolders, - "Location of $file does not match formal namespace: $formalNamespace\n"); + $foundNamespace = substr($formalNamespaceArray[0], 10); + $foundNamespace = str_replace('\\', '/', $foundNamespace); + $foundNamespace .= '/'. $className; + if ($namespaceFolders != null && $foundNamespace != null) { + $this->assertEquals($namespaceFolders, $foundNamespace, + "Location of $file does not match formal namespace: $expectedNamespace\n"); } } else { - if ($className != null && $namespace != null) { - $this->assertEquals($className, $namespace, - "Declaration of $file does not match namespace: $namespace\n"); + $this->fail("Missing expected namespace \"$expectedNamespace\" for file: $file"); + } + } + + public function testClassReferences() + { + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $relativePath = str_replace(\Magento\TestFramework\Utility\Files::init()->getPathToSource(), "", $file); + // Due to the examples given with the regex patterns, we skip this test file itself + if ($relativePath == "/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php") { + return; + } + $contents = file_get_contents($file); + $formalPattern = '/^namespace\s[a-zA-Z]+(\\\\[a-zA-Z0-9]+)*/m'; + $formalNamespaceArray = array(); + + // Skip the file if the class is not defined using formal namespace + if (preg_match($formalPattern, $contents, $formalNamespaceArray) == 0) { + return; + } + $namespacePath = str_replace('\\', '/', substr($formalNamespaceArray[0], 10)); + + // Instantiation of new object, for example: "return new Foo();" + $newObjectPattern = '/^' + . '.*new\s(?<venderClass>\\\\Magento(?:\\\\[a-zA-Z0-9_]+)+)\(.*\)' + . '|.*new\s(?<badClass>[A-Z][a-zA-Z0-9]+[a-zA-Z0-9_\\\\]*)\(.*\)\;' + . '/m'; + $result1 = array(); + preg_match_all($newObjectPattern, $contents, $result1); + + // Static function/variable, for example: "Foo::someStaticFunction();" + $staticCallPattern = '/^' + . '((?!Magento).)*(?<venderClass>\\\\Magento(?:\\\\[a-zA-Z0-9_]+)+)\:\:.*\;' + . '|[^\\\\^a-z^A-Z^0-9^_^:](?<badClass>[A-Z][a-zA-Z0-9_]+)\:\:.*\;' + . '/m'; + $result2 = array(); + preg_match_all($staticCallPattern, $contents, $result2); + + // Annotation, for example: "* @return \Magento\Foo\Bar" or "* @throws Exception" or "* @return Foo" + $annotationPattern = '/^' + . '[\s]*\*\s\@(?:return|throws)\s(?<venderClass>\\\\Magento(?:\\\\[a-zA-Z0-9_]+)+)' + . '|[\s]*\*\s\@return\s(?<badClass>[A-Z][a-zA-Z0-9_\\\\]+)' + . '|[\s]*\*\s\@throws\s(?<exception>[A-Z][a-zA-Z0-9_\\\\]+)' + . '/m'; + $result3 = array(); + preg_match_all($annotationPattern, $contents, $result3); + + $vendorClasses = array_unique( + array_merge_recursive($result1['venderClass'], $result2['venderClass'], $result3['venderClass']) + ); + + $badClasses = array_unique( + array_merge_recursive($result1['badClass'], $result2['badClass'], $result3['badClass']) + ); + + $vendorClasses = array_filter($vendorClasses, 'strlen'); + $vendorClasses = $this->referenceBlacklistFilter($vendorClasses); + if (!empty($vendorClasses)) { + $this->_assertClassesExist($vendorClasses, $file); + } + + if (!empty($result3['exception']) && $result3['exception'][0] != "") { + $badClasses = array_merge($badClasses, array_filter($result3['exception'], 'strlen')); + } + + $badClasses = array_filter($badClasses, 'strlen'); + if (empty($badClasses)) { + return; + } + $badClasses = $this->referenceBlacklistFilter($badClasses); + $badClasses = $this->removeSpecialCases($badClasses, $file, $contents, $namespacePath); + $this->_assertClassReferences($badClasses, $file); + }, + \Magento\TestFramework\Utility\Files::init()->getClassFiles() + ); + } + + /** + * This function is to remove legacy code usages according to ReferenceBlacklist.php + * @param $classes + * @return array + */ + protected function referenceBlacklistFilter($classes) + { + // exceptions made for the files from the blacklist + $blacklist = require __DIR__ . '/ReferenceBlacklist.php'; + foreach ($classes as $class) { + if (in_array($class, $blacklist)) { + unset($classes[array_search($class, $classes)]); } } + return $classes; } /** + * This function is to remove special cases (if any) from the list of found bad classes + * @param array $badClasses + * @param string $file + * @param string $contents * @return array */ - public function phpClassDataProvider() + protected function removeSpecialCases($badClasses, $file, $contents, $namespacePath) { - return \Magento\TestFramework\Utility\Files::init()->getClassFiles(); + foreach ($badClasses as $badClass) { + // Remove valid usages of Magento modules from the list + // for example: 'Magento_Sales::actions_edit' + if (preg_match('/Magento_[A-Z0-9][a-z0-9]*/', $badClass)) { + unset($badClasses[array_search($badClass, $badClasses)]); + } + + // Remove usage of key words such as "Array", "String", and "Boolean" + if (in_array($badClass, self::$_keywordsBlacklist)) { + unset($badClasses[array_search($badClass, $badClasses)]); + } + + $classParts = explode('/', $file); + $className = array_pop($classParts); + // Remove usage of the class itself from the list + if ($badClass . '.php' == $className) { + unset($badClasses[array_search($badClass, $badClasses)]); + } + + // Remove usage of classes that do NOT using fully-qualified class names (possibly under same namespace) + $directories = array( + '/app/code/', '/lib/', '/downloader/app/', '/downloader/lib/', '/dev/tools/', + '/dev/tests/api-functional/framework/', '/dev/tests/integration/framework/', + '/dev/tests/integration/framework/tests/unit/testsuite/', '/dev/tests/integration/testsuite/', + '/dev/tests/integration/testsuite/Magento/Test/Integrity/', '/dev/tests/performance/framework/', + '/dev/tests/static/framework/', '/dev/tests/static/testsuite/', + '/dev/tests/unit/framework/', '/dev/tests/unit/testsuite/', + ); // Full list of directories where there may be namespace classes + foreach ($directories as $directory) { + $fullPath = \Magento\TestFramework\Utility\Files::init()->getPathToSource() + . $directory . $namespacePath. '/' . str_replace('\\', '/', $badClass) . '.php'; + if (file_exists($fullPath)) { + unset($badClasses[array_search($badClass, $badClasses)]); + break; + } + } + $referenceFile = implode('/', $classParts) . '/' . str_replace('\\', '/', $badClass) . '.php'; + if (file_exists($referenceFile)) { + unset($badClasses[array_search($badClass, $badClasses)]); + } + + // Remove usage of classes that have been declared as "use" or "include" + // Also deals with case like: "use \Zend\Code\Scanner\FileScanner, Magento\Tools\Di\Compiler\Log\Log;" + if (preg_match('/use\s.*[\\n]?.*' . str_replace('\\', '\\\\', $badClass) . '[\,\;]/', $contents)) { + unset($badClasses[array_search($badClass, $badClasses)]); + } + } + return $badClasses; + } + + /** + * Assert any found class name resolves into a file name and corresponds to an existing file + * + * @param array $badClasses + * @param string $file + */ + protected function _assertClassReferences($badClasses, $file) + { + if (empty($badClasses)) { + return; + } + $this->fail( + "Incorrect namespace usage(s) found in file $file:\n" . implode("\n", $badClasses) + ); } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Compiler/CompilerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Compiler/CompilerTest.php new file mode 100644 index 00000000000..7aa4a3d3e9c --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Compiler/CompilerTest.php @@ -0,0 +1,86 @@ +<?php +/** + * Compiler test. Check compilation of DI definitions and code generation + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in 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\Test\Integrity\Compiler; + +class CompilerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var string + */ + protected $_command; + + /** + * @var \Magento\Shell + */ + protected $_shell; + + /** + * @var string + */ + protected $_generationDir; + + /** + * @var string + */ + protected $_compilationDir; + + /** + * @var string + */ + protected $_tmpDir; + + protected function setUp() + { + $this->_shell = new \Magento\Shell(); + $basePath = \Magento\TestFramework\Utility\Files::init()->getPathToSource(); + $basePath = str_replace(DIRECTORY_SEPARATOR, '/', $basePath); + $this->_tmpDir = realpath(__DIR__) . '/tmp'; + $this->_generationDir = $this->_tmpDir . '/generation'; + $this->_compilationDir = $this->_tmpDir . '/di'; + $this->_command = 'php ' . $basePath + . '/dev/tools/Magento/Tools/Di/compiler.php --l=%s --generation=%s --di=%s --v'; + } + + protected function tearDown() + { + $filesystem = new \Magento\Filesystem\Adapter\Local(); + $filesystem->delete($this->_tmpDir); + } + + public function testCompiler() + { + try { + $output = $this->_shell->execute( + $this->_command, + array('error', $this->_generationDir, $this->_compilationDir) + ); + $this->assertEmpty($output, $output); + } catch (\Magento\Exception $exception) { + $this->fail($exception->getPrevious()->getMessage()); + } + } +} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ConfigTest.php index a199121a3b2..3b2dd2e65d8 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ConfigTest.php @@ -50,21 +50,28 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'Translation files exist, but not declared in configuration:' . "\n" . var_export($failures, 1)); } - /** - * Verify whether all payment methods are declared in appropriate modules - * - * @dataProvider paymentMethodsDataProvider - */ - public function testPaymentMethods($configFile, $moduleName) + public function testPaymentMethods() { - $config = simplexml_load_file($configFile); - $nodes = $config->xpath('/config/default/payment/*/model') ?: array(); - $formalModuleName = str_replace('_', '\\', $moduleName); - foreach ($nodes as $node) { - $this->assertStringStartsWith($formalModuleName . '\Model\\', (string)$node, - "'$node' payment method is declared in '$configFile' module, but doesn't belong to '$moduleName' module" - ); - } + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Verify whether all payment methods are declared in appropriate modules + */ + function ($configFile, $moduleName) { + $config = simplexml_load_file($configFile); + $nodes = $config->xpath('/config/default/payment/*/model') ?: array(); + $formalModuleName = str_replace('_', '\\', $moduleName); + foreach ($nodes as $node) { + $this->assertStringStartsWith( + $formalModuleName . '\Model\\', + (string)$node, + "'$node' payment method is declared in '$configFile' module, " + . "but doesn't belong to '$moduleName' module" + ); + } + }, + $this->paymentMethodsDataProvider() + ); } public function paymentMethodsDataProvider() diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php index a04cd2cde98..4ac19e45cc4 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php @@ -263,46 +263,50 @@ class DependencyTest extends \PHPUnit_Framework_TestCase return $contents; } - /** - * Check undeclared modules dependencies for specified file - * - * @param string $fileType - * @param string $file - * - * @dataProvider getAllFiles - */ - public function testUndeclared($fileType, $file) + public function testUndeclared() { - if (strpos($file, 'app/code') === false && !$this->_isThemeFile($file)) { - return; - } + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Check undeclared modules dependencies for specified file + * + * @param string $fileType + * @param string $file + */ + function ($fileType, $file) { + if (strpos($file, 'app/code') === false && !$this->_isThemeFile($file)) { + return; + } - $module = $this->_getModuleName($file); - $contents = $this->_getCleanedFileContents($fileType, $file); + $module = $this->_getModuleName($file); + $contents = $this->_getCleanedFileContents($fileType, $file); - // Apply rules - $dependencies = array(); - foreach (self::$_rulesInstances as $rule) { - /** @var \Magento\TestFramework\Dependency\RuleInterface $rule */ - $dependencies = array_merge($dependencies, - $rule->getDependencyInfo($module, $fileType, $file, $contents)); - } + // Apply rules + $dependencies = array(); + foreach (self::$_rulesInstances as $rule) { + /** @var \Magento\TestFramework\Dependency\RuleInterface $rule */ + $dependencies = array_merge($dependencies, + $rule->getDependencyInfo($module, $fileType, $file, $contents)); + } - // Collect dependencies - $undeclared = $this->_collectDependencies($module, $dependencies); + // Collect dependencies + $undeclared = $this->_collectDependencies($module, $dependencies); - // Prepare output message - $result = array(); - foreach ($undeclared as $type => $modules) { - $modules = array_unique($modules); - if (!count($modules)) { - continue; - } - $result[] = sprintf("%s [%s]", $type, implode(', ', $modules)); - } - if (count($result)) { - $this->fail('Module ' . $module . ' has undeclared module dependencies found: ' . implode(', ', $result)); - } + // Prepare output message + $result = array(); + foreach ($undeclared as $type => $modules) { + $modules = array_unique($modules); + if (!count($modules)) { + continue; + } + $result[] = sprintf("%s [%s]", $type, implode(', ', $modules)); + } + if (count($result)) { + $this->fail('Module ' . $module . ' has undeclared dependencies: ' . implode(', ', $result)); + } + }, + $this->getAllFiles() + ); } /** diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php index 06dfe016c57..98b1582b765 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php @@ -62,33 +62,38 @@ class BlocksTest extends \PHPUnit_Framework_TestCase } } - /** - * Check that containers are not used as blocks in templates - * - * @param string $alias - * @param string $file - * @throws \Exception|PHPUnit_Framework_ExpectationFailedException - * @dataProvider getChildBlockDataProvider - */ - public function testBlocksNotContainers($alias, $file) + public function testBlocksNotContainers() { - if (isset(self::$_containerAliases[$alias])) { - if (!isset(self::$_blockAliases[$alias])) { - $this->fail( - "Element with alias '$alias' is used as a block in file '$file' via getChildBlock() method, " - . "while '$alias' alias is declared as a container in file(s): " - . join(', ', self::$_containerAliases[$alias]['files']) - ); - } else { - $this->markTestIncomplete( - "Element with alias '$alias' is used as a block in file '$file' via getChildBlock() method. " - . "It's impossible to determine explicitly whether the element is a block or a container, " - . "as it is declared as a container in file(s): " - . join(', ', self::$_containerAliases[$alias]['files']) . " and as a block in file(s): " - . join(', ', self::$_blockAliases[$alias]['files']) - ); - } - } + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Check that containers are not used as blocks in templates + * + * @param string $alias + * @param string $file + * @throws \Exception|PHPUnit_Framework_ExpectationFailedException + */ + function ($alias, $file) { + if (isset(self::$_containerAliases[$alias])) { + if (!isset(self::$_blockAliases[$alias])) { + $this->fail( + "Element with alias '$alias' is used as a block in file '$file' via getChildBlock() method," + . " while '$alias' alias is declared as a container in file(s): " + . join(', ', self::$_containerAliases[$alias]['files']) + ); + } else { + $this->markTestIncomplete( + "Element with alias '$alias' is used as a block in file '$file' via getChildBlock() method." + . " It's impossible to determine explicitly whether the element is a block or a container, " + . "as it is declared as a container in file(s): " + . join(', ', self::$_containerAliases[$alias]['files']) . " and as a block in file(s): " + . join(', ', self::$_blockAliases[$alias]['files']) + ); + } + } + }, + $this->getChildBlockDataProvider() + ); } /** diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/FilesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/FilesTest.php index f8cb80f3324..a5f22aa37f2 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/FilesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/FilesTest.php @@ -41,25 +41,18 @@ class FilesTest extends \PHPUnit_Framework_TestCase ); } - /** - * @dataProvider validateDataProvider - */ - public function testLayouts($layout) + public function testLayouts() { - $dom = new \DOMDocument(); - $dom->loadXML(file_get_contents($layout)); - $errors = $this->_validateDomDocument($dom, $this->_schemaFile); - $this->assertTrue(empty($errors), print_r($errors, true)); - } - - /** - * @see self::testValidateLayouts - * @return array - * @throws \Exception - */ - public function validateDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getLayoutFiles(); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + function ($layout) { + $dom = new \DOMDocument(); + $dom->loadXML(file_get_contents($layout)); + $errors = $this->_validateDomDocument($dom, $this->_schemaFile); + $this->assertTrue(empty($errors), print_r($errors, true)); + }, + \Magento\TestFramework\Utility\Files::init()->getLayoutFiles() + ); } /** diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/HandlesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/HandlesTest.php index 5cb070ad151..2c8e1bd43b0 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/HandlesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/HandlesTest.php @@ -28,91 +28,102 @@ namespace Magento\Test\Integrity\Layout; class HandlesTest extends \PHPUnit_Framework_TestCase { /** - * Test dependencies between handle attributes that is out of coverage by XSD - * - * @param string $layoutFile - * @dataProvider layoutFilesDataProvider * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function testHandleDeclaration($layoutFile) + public function testHandleDeclarations() { - $issues = array(); - $node = simplexml_load_file($layoutFile); - $type = $node['type']; - $parent = $node['parent']; - $owner = $node['owner']; - $label = $node['label']; - if ($type) { - switch ($type) { - case 'page': - if ($owner) { - $issues[] = 'Attribute "owner" is inappropriate for page types'; + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Test dependencies between handle attributes that is out of coverage by XSD + * + * @param string $layoutFile + */ + function ($layoutFile) { + $issues = array(); + $node = simplexml_load_file($layoutFile); + $type = $node['type']; + $parent = $node['parent']; + $owner = $node['owner']; + $label = $node['label']; + if ($type) { + switch ($type) { + case 'page': + if ($owner) { + $issues[] = 'Attribute "owner" is inappropriate for page types'; + } + break; + case 'fragment': + if ($parent) { + $issues[] = 'Attribute "parent" is inappropriate for page fragment types'; + } + if (!$owner) { + $issues[] = 'No attribute "owner" is specified for page fragment type'; + } + break; } - break; - case 'fragment': - if ($parent) { - $issues[] = 'Attribute "parent" is inappropriate for page fragment types'; + } else { + if ($label) { + $issues[] = 'Attribute "label" is defined, but "type" is not'; } - if (!$owner) { - $issues[] = 'No attribute "owner" is specified for page fragment type'; + if ($parent || $owner) { + $issues[] = 'Attribute "parent" and/or "owner" is defined, but "type" is not'; } - break; - } - } else { - if ($label) { - $issues[] = 'Attribute "label" is defined, but "type" is not'; - } - if ($parent || $owner) { - $issues[] = 'Attribute "parent" and/or "owner" is defined, but "type" is not'; - } - } - if ($issues) { - $this->fail("Issues found in handle declaration:\n" . implode("\n", $issues) . "\n"); - } + } + if ($issues) { + $this->fail("Issues found in handle declaration:\n" . implode("\n", $issues) . "\n"); + } + }, + \Magento\TestFramework\Utility\Files::init()->getLayoutFiles() + ); } - /** - * Test dependencies between container attributes that is out of coverage by XSD - * - * @param string $layoutFile - * @dataProvider layoutFilesDataProvider - */ - public function testContainerDeclaration($layoutFile) - { - $issues = array(); - $xml = simplexml_load_file($layoutFile); - $containers = $xml->xpath('/layout//container') ?: array(); - /** @var SimpleXMLElement $node */ - foreach ($containers as $node) { - if (!isset($node['htmlTag']) && (isset($node['htmlId']) || isset($node['htmlClass']))) { - $issues[] = $node->asXML(); - } - } - if ($issues) { - $message = 'The following containers declare attribute "htmlId" and/or "htmlClass", but not "htmlTag":'; - $this->fail($message . "\n" . implode("\n", $issues) . "\n"); - } - } - - /** - * Test format of a layout file using XSD - * - * @param string $layoutFile - * @dataProvider layoutFilesDataProvider - */ - public function testLayoutFormat($layoutFile) + public function testContainerDeclarations() { - $schemaFile = BP . '/app/code/Magento/Core/etc/layout_single.xsd'; - $domLayout = new \Magento\Config\Dom(file_get_contents($layoutFile)); - $result = $domLayout->validate($schemaFile, $errors); - $this->assertTrue($result, print_r($errors, true)); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Test dependencies between container attributes that is out of coverage by XSD + * + * @param string $layoutFile + */ + function ($layoutFile) { + $issues = array(); + $xml = simplexml_load_file($layoutFile); + $containers = $xml->xpath('/layout//container') ?: array(); + /** @var SimpleXMLElement $node */ + foreach ($containers as $node) { + if (!isset($node['htmlTag']) && (isset($node['htmlId']) || isset($node['htmlClass']))) { + $issues[] = $node->asXML(); + } + } + if ($issues) { + $this->fail( + 'The following containers declare attribute "htmlId" and/or "htmlClass", but not "htmlTag":' + . "\n" . implode("\n", $issues) . "\n" + ); + } + }, + \Magento\TestFramework\Utility\Files::init()->getLayoutFiles() + ); } - /** - * @return array - */ - public function layoutFilesDataProvider() + public function testLayoutFormat() { - return \Magento\TestFramework\Utility\Files::init()->getLayoutFiles(); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Test format of a layout file using XSD + * + * @param string $layoutFile + */ + function ($layoutFile) { + $schemaFile = BP . '/app/code/Magento/Core/etc/layout_single.xsd'; + $domLayout = new \Magento\Config\Dom(file_get_contents($layoutFile)); + $result = $domLayout->validate($schemaFile, $errors); + $this->assertTrue($result, print_r($errors, true)); + }, + \Magento\TestFramework\Utility\Files::init()->getLayoutFiles() + ); } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/ThemeHandlesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/ThemeHandlesTest.php index 70cd073bf05..f9dc2e0289e 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/ThemeHandlesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/ThemeHandlesTest.php @@ -32,18 +32,23 @@ class ThemeHandlesTest extends \PHPUnit_Framework_TestCase */ protected $_baseFrontendHandles = null; - /** - * Check that all handles declared in a theme layout are declared in base layouts - * - * @param string $handleName - * @dataProvider designHandlesDataProvider - */ - public function testIsDesignHandleDeclaredInCode($handleName) + public function testIsDesignHandleDeclaredInCode() { - $this->assertContains( - $handleName, - $this->_getBaseFrontendHandles(), - "Handle '{$handleName}' is not declared in any module.'" + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Check that all handles declared in a theme layout are declared in base layouts + * + * @param string $handleName + */ + function ($handleName) { + $this->assertContains( + $handleName, + $this->_getBaseFrontendHandles(), + "Handle '{$handleName}' is not declared in any module.'" + ); + }, + $this->designHandlesDataProvider() ); } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/SystemConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/SystemConfigTest.php index 5e3c725f127..c9c95e4097f 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/SystemConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/SystemConfigTest.php @@ -27,27 +27,24 @@ namespace Magento\Test\Integrity\Magento\Backend; class SystemConfigTest extends \PHPUnit_Framework_TestCase { - /** - * @param string $configFile - * @dataProvider schemaDataProvider - */ - public function testSchema($configFile) + public function testSchema() { - $dom = new \DOMDocument(); - $dom->loadXML(file_get_contents($configFile)); - $schema = \Magento\TestFramework\Utility\Files::init()->getPathToSource() . - '/app/code/Magento/Backend/etc/system_file.xsd'; - $errors = \Magento\Config\Dom::validateDomDocument($dom, $schema); - if ($errors) { - $this->fail('XML-file has validation errors:' . PHP_EOL . implode(PHP_EOL . PHP_EOL, $errors)); - } - } - - /** - * @return array - */ - public function schemaDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getConfigFiles('adminhtml/system.xml', array()); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $configFile + */ + function ($configFile) { + $dom = new \DOMDocument(); + $dom->loadXML(file_get_contents($configFile)); + $schema = \Magento\TestFramework\Utility\Files::init()->getPathToSource() . + '/app/code/Magento/Backend/etc/system_file.xsd'; + $errors = \Magento\Config\Dom::validateDomDocument($dom, $schema); + if ($errors) { + $this->fail('XML-file has validation errors:' . PHP_EOL . implode(PHP_EOL . PHP_EOL, $errors)); + } + }, + \Magento\TestFramework\Utility\Files::init()->getConfigFiles('adminhtml/system.xml', array()) + ); } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/LayoutConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/LayoutConfigTest.php index 862af72b49e..8d893b9e0ae 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/LayoutConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/LayoutConfigTest.php @@ -70,37 +70,37 @@ class LayoutConfigTest extends \PHPUnit_Framework_TestCase } } - /** - * Given a layout file, test whether all of its service calls are valid - * - * @param $layoutFile - * - * @dataProvider xmlFileDataProvider - */ - public function testXmlFile($layoutFile) + public function testXmlFiles() { - $dom = new \DOMDocument(); - $dom->loadXML(file_get_contents($layoutFile)); - $dataList = $dom->getElementsByTagName('data'); - /** @var \DOMNode $data */ - foreach ($dataList as $data) { - if ($data->hasAttributes()) { - /** @var \DOMNode $serviceCallAttribute */ - $serviceCallAttribute = $data->attributes->getNamedItem('service_call'); - if ($serviceCallAttribute) { - /** @var string $serviceCall */ - $serviceCall = $serviceCallAttribute->nodeValue; - $this->assertContains($serviceCall, self::$_serviceCalls, "Unknown service call: $serviceCall"); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Given a layout file, test whether all of its service calls are valid + * + * @param $layoutFile + */ + function ($layoutFile) { + $dom = new \DOMDocument(); + $dom->loadXML(file_get_contents($layoutFile)); + $dataList = $dom->getElementsByTagName('data'); + /** @var \DOMNode $data */ + foreach ($dataList as $data) { + if ($data->hasAttributes()) { + /** @var \DOMNode $serviceCallAttribute */ + $serviceCallAttribute = $data->attributes->getNamedItem('service_call'); + if ($serviceCallAttribute) { + /** @var string $serviceCall */ + $serviceCall = $serviceCallAttribute->nodeValue; + $this->assertContains( + $serviceCall, + self::$_serviceCalls, + "Unknown service call: $serviceCall" + ); + } + } } - } - } - } - - /** - * @return array - */ - public function xmlFileDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getLayoutFiles(); + }, + \Magento\TestFramework\Utility\Files::init()->getLayoutFiles() + ); } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/SystemConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/SystemConfigTest.php index e8a6b6d8ff9..aad64f71b6c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/SystemConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/SystemConfigTest.php @@ -49,31 +49,29 @@ class SystemConfigTest extends \PHPUnit_Framework_TestCase } } - /** - * @dataProvider xmlDataProvider - */ - public function testXmlFile($configFile) + public function testXmlFiles() { - $dom = new \DOMDocument(); - $dom->loadXML(file_get_contents($configFile)); - $this->assertNotNull($dom); - $optionsList = $dom->getElementsByTagName('options'); - foreach ($optionsList as $options) { - /** @var $options \DOMNode */ - if ($options->hasAttributes()) { - $serviceCallAttribute = $options->attributes->getNamedItem('service_call'); - if (null != $serviceCallAttribute) { - $serviceCall = $serviceCallAttribute->nodeValue; - $this->assertTrue( - in_array($serviceCall, self::$_serviceCalls), "Unknown service call: $serviceCall" - ); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + function ($configFile) { + $dom = new \DOMDocument(); + $dom->loadXML(file_get_contents($configFile)); + $this->assertNotNull($dom); + $optionsList = $dom->getElementsByTagName('options'); + foreach ($optionsList as $options) { + /** @var $options \DOMNode */ + if ($options->hasAttributes()) { + $serviceCallAttribute = $options->attributes->getNamedItem('service_call'); + if (null != $serviceCallAttribute) { + $serviceCall = $serviceCallAttribute->nodeValue; + $this->assertTrue( + in_array($serviceCall, self::$_serviceCalls), "Unknown service call: $serviceCall" + ); + } + } } - } - } - } - - public function xmlDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getConfigFiles('adminhtml/system.xml', array()); + }, + \Magento\TestFramework\Utility\Files::init()->getConfigFiles('adminhtml/system.xml', array()) + ); } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/FieldsetConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/FieldsetConfigTest.php index dc967cde6a3..4a2e51e013d 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/FieldsetConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/FieldsetConfigTest.php @@ -27,22 +27,26 @@ namespace Magento\Test\Integrity\Magento\Core\Model\Fieldset; class FieldsetConfigTest extends \PHPUnit_Framework_TestCase { - /** - * @param string $configFile - * - * @dataProvider xmlDataProvider - */ - public function testXml($configFile) + public function testXmlFiles() { - $dom = new \DOMDocument(); - $dom->loadXML(file_get_contents($configFile)); - $schema = \Magento\TestFramework\Utility\Files::init()->getPathToSource() - . '/app/code/Magento/Core/etc/fieldset_file.xsd'; - $errors = \Magento\Config\Dom::validateDomDocument($dom, $schema); - if ($errors) { - $this->fail('XML-file ' . $configFile . ' has validation errors:' - . PHP_EOL . implode(PHP_EOL . PHP_EOL, $errors)); - } + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $configFile + */ + function ($configFile) { + $dom = new \DOMDocument(); + $dom->loadXML(file_get_contents($configFile)); + $schema = \Magento\TestFramework\Utility\Files::init()->getPathToSource() + . '/app/code/Magento/Core/etc/fieldset_file.xsd'; + $errors = \Magento\Config\Dom::validateDomDocument($dom, $schema); + if ($errors) { + $this->fail('XML-file ' . $configFile . ' has validation errors:' + . PHP_EOL . implode(PHP_EOL . PHP_EOL, $errors)); + } + }, + \Magento\TestFramework\Utility\Files::init()->getConfigFiles('fieldset.xml', array(), true) + ); } public function testSchemaUsingValidXml() @@ -98,12 +102,4 @@ class FieldsetConfigTest extends \PHPUnit_Framework_TestCase $this->fail('There is a problem with the schema. A known bad XML file passed validation'); } } - - /** - * @return array - */ - public function xmlDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getConfigFiles('fieldset.xml', array(), true); - } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Reward/LayoutTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Reward/LayoutTest.php deleted file mode 100644 index bd9699be0bc..00000000000 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Reward/LayoutTest.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * Validator of class names in Reward nodes - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in 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\Test\Integrity\Magento\Reward; - -class LayoutTest extends \PHPUnit_Framework_TestCase -{ - /** - * @param string $file - * @dataProvider layoutFileDataProvider - */ - public function testInitRewardTypeClasses($file) - { - $xml = simplexml_load_file($file); - $nodes = $xml->xpath('//argument[@name="reward_type"]') ? : array(); - $errors = array(); - /** @var \SimpleXMLElement $node */ - foreach ($nodes as $node) { - $class = (string)$node; - if (!\Magento\TestFramework\Utility\Files::init()->classFileExists($class, $path)) { - $errors[] = "'{$class}' => '{$path}'"; - } - } - if ($errors) { - $this->fail("Invalid class declarations in {$file}. Files are not found in code pools:\n" - . implode(PHP_EOL, $errors) . PHP_EOL - ); - } - } - - /** - * @return array - */ - public function layoutFileDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getLayoutFiles(); - } -} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/WidgetConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/WidgetConfigTest.php index a09fc732389..92218b30c29 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/WidgetConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/WidgetConfigTest.php @@ -27,29 +27,22 @@ namespace Magento\Test\Integrity\Magento\Widget; class WidgetConfigTest extends \PHPUnit_Framework_TestCase { - /** - * @param string $configFile - * - * @dataProvider xmlDataProvider - */ - public function testXml($configFile) - { - $schema = \Magento\TestFramework\Utility\Files::init()->getPathToSource() - . '/app/code/Magento/Widget/etc/widget.xsd'; - $this->_validateFileExpectSuccess($configFile, $schema); - } - - /** - * Find all widget.xml files in Magento - * - * @return array of widget.xml file paths - */ - public function xmlDataProvider() + public function testXmlFiles() { - $utilityFiles = \Magento\TestFramework\Utility\Files::init(); - return array_merge( - $utilityFiles->getConfigFiles('widget.xml'), - $utilityFiles->getLayoutConfigFiles('widget.xml') + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $configFile + */ + function ($configFile) { + $schema = \Magento\TestFramework\Utility\Files::init()->getPathToSource() + . '/app/code/Magento/Widget/etc/widget.xsd'; + $this->_validateFileExpectSuccess($configFile, $schema); + }, + array_merge( + \Magento\TestFramework\Utility\Files::init()->getConfigFiles('widget.xml'), + \Magento\TestFramework\Utility\Files::init()->getLayoutConfigFiles('widget.xml') + ) ); } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Blacklist.php b/dev/tests/static/testsuite/Magento/Test/Integrity/NamespaceBlacklist.php similarity index 98% rename from dev/tests/static/testsuite/Magento/Test/Integrity/Blacklist.php rename to dev/tests/static/testsuite/Magento/Test/Integrity/NamespaceBlacklist.php index e045d6ad614..2b0e29cbf76 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Blacklist.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/NamespaceBlacklist.php @@ -1,6 +1,6 @@ <?php /** - * Files excluded from the integrity test for PSR-X standards + * Files excluded from the ClassesTest->testClassNamespace() for PSR-X standards * * Magento * diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ReferenceBlacklist.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ReferenceBlacklist.php new file mode 100644 index 00000000000..69ede68cd49 --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ReferenceBlacklist.php @@ -0,0 +1,65 @@ +<?php +/** + * Legacy class usages excluded from the ClassesTest->testClassReferences for PSR-X standards + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category tests + * @package static + * @subpackage Integrity + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +return array( + 'PEAR_PackageFile', + 'Simple_Xml', + 'PersistentCustomerSegmentation', + 'SolrClient', + 'SolrQuery', + 'RegionUpdater', // JavaScript usage + 'Fixture_Module', // JavaScript usage + 'TheCompoundNamespace_TheCompoundModule', + 'Some_Module', + 'Not_Existed_Class', + 'CustomSelect', + + // found in /dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/Model/Test.php + '\Magento\SomeModule\Model\Element\Proxy', + + 'Map_Module', + 'Module_One', + 'Module_Two', + 'Module_Name', + 'Test', + 'Local_Module', + + // found in /dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/HandlerTest.php + '\Magento\Webapi\Controller\Soap\Security', + + 'Mage', + 'Pear_Package_Parser_v2', + 'PEAR_Config', + 'PEAR_DependencyDB', + 'PEAR_Frontend', + 'PEAR_Command', + 'Zend', + 'PEAR_PackageFileManager2', + 'PEAR', +); diff --git a/dev/tests/static/testsuite/Magento/Test/Js/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Js/LiveCodeTest.php index 94424b7ec0d..dee51e035cc 100644 --- a/dev/tests/static/testsuite/Magento/Test/Js/LiveCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Js/LiveCodeTest.php @@ -93,21 +93,27 @@ class LiveCodeTest extends \PHPUnit_Framework_TestCase self::$_whiteListJsFiles = array_filter(self::$_whiteListJsFiles, $filter); } - /** - * @dataProvider codeJsHintDataProvider - */ - public function testCodeJsHint($filename) + public function testCodeJsHint() { - $cmd = new \Magento\TestFramework\Inspection\JsHint\Command($filename, self::$_reportFile); - $result = false; - try { - $result = $cmd->canRun(); - } catch (\Exception $e) { - $this->markTestSkipped($e->getMessage()); - } - if ($result) { - $this->assertTrue($cmd->run(array()), $cmd->getLastRunMessage()); - } + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $filename + */ + function ($filename) { + $cmd = new \Magento\TestFramework\Inspection\JsHint\Command($filename, self::$_reportFile); + $result = false; + try { + $result = $cmd->canRun(); + } catch (\Exception $e) { + $this->markTestSkipped($e->getMessage()); + } + if ($result) { + $this->assertTrue($cmd->run(array()), $cmd->getLastRunMessage()); + } + }, + $this->codeJsHintDataProvider() + ); } /** diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php index 906c7925739..081cb9e19f5 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php @@ -32,75 +32,68 @@ namespace Magento\Test\Legacy; class ClassesTest extends \PHPUnit_Framework_TestCase { - /** - * @param string $file - * @dataProvider phpCodeDataProvider - */ - public function testPhpCode($file) - { - $classes = \Magento\TestFramework\Utility\Classes::collectPhpCodeClasses(file_get_contents($file)); - $this->_assertNonFactoryName($classes, $file); - } - - /** - * @return array - */ - public function phpCodeDataProvider() + public function testPhpCode() { - return \Magento\TestFramework\Utility\Files::init()->getPhpFiles(); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $classes = \Magento\TestFramework\Utility\Classes::collectPhpCodeClasses(file_get_contents($file)); + $this->_assertNonFactoryName($classes, $file); + }, + \Magento\TestFramework\Utility\Files::init()->getPhpFiles() + ); } - /** - * @param string $path - * @dataProvider configFileDataProvider - */ - public function testConfiguration($path) + public function testConfiguration() { - $xml = simplexml_load_file($path); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $path + */ + function ($path) { + $xml = simplexml_load_file($path); - $classes = \Magento\TestFramework\Utility\Classes::collectClassesInConfig($xml); - $this->_assertNonFactoryName($classes, $path); + $classes = \Magento\TestFramework\Utility\Classes::collectClassesInConfig($xml); + $this->_assertNonFactoryName($classes, $path); - $modules = \Magento\TestFramework\Utility\Classes::getXmlAttributeValues($xml, '//@module', 'module'); - $this->_assertNonFactoryName(array_unique($modules), $path, false, true); + $modules = \Magento\TestFramework\Utility\Classes::getXmlAttributeValues($xml, '//@module', 'module'); + $this->_assertNonFactoryName(array_unique($modules), $path, false, true); + }, + \Magento\TestFramework\Utility\Files::init()->getConfigFiles() + ); } - /** - * @return array - */ - public function configFileDataProvider() + public function testLayouts() { - return \Magento\TestFramework\Utility\Files::init()->getConfigFiles(); - } - - /** - * @param string $path - * @dataProvider layoutFileDataProvider - */ - public function testLayouts($path) - { - $xml = simplexml_load_file($path); - $classes = \Magento\TestFramework\Utility\Classes::collectLayoutClasses($xml); - foreach (\Magento\TestFramework\Utility\Classes::getXmlAttributeValues($xml, - '/layout//@helper', 'helper') as $class) { - $classes[] = \Magento\TestFramework\Utility\Classes::getCallbackClass($class); - } - $classes = - array_merge($classes, \Magento\TestFramework\Utility\Classes::getXmlAttributeValues($xml, - '/layout//@module', 'module')); - $this->_assertNonFactoryName(array_unique($classes), $path); - - $tabs = - \Magento\TestFramework\Utility\Classes::getXmlNodeValues($xml, '/layout//action[@method="addTab"]/block'); - $this->_assertNonFactoryName(array_unique($tabs), $path, true); - } + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $path + */ + function ($path) { + $xml = simplexml_load_file($path); + $classes = \Magento\TestFramework\Utility\Classes::collectLayoutClasses($xml); + foreach (\Magento\TestFramework\Utility\Classes::getXmlAttributeValues($xml, + '/layout//@helper', 'helper') as $class) { + $classes[] = \Magento\TestFramework\Utility\Classes::getCallbackClass($class); + } + $classes = + array_merge($classes, \Magento\TestFramework\Utility\Classes::getXmlAttributeValues($xml, + '/layout//@module', 'module')); + $this->_assertNonFactoryName(array_unique($classes), $path); - /** - * @return array - */ - public function layoutFileDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getLayoutFiles(); + $tabs = \Magento\TestFramework\Utility\Classes::getXmlNodeValues( + $xml, + '/layout//action[@method="addTab"]/block' + ); + $this->_assertNonFactoryName(array_unique($tabs), $path, true); + }, + \Magento\TestFramework\Utility\Files::init()->getLayoutFiles() + ); } /** diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ConfigTest.php index c2b46dedc3e..d2b63f3d8b6 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ConfigTest.php @@ -32,32 +32,29 @@ namespace Magento\Test\Legacy; class ConfigTest extends \PHPUnit_Framework_TestCase { - /** - * @param string $file - * @dataProvider configFileDataProvider - */ - public function testConfigFile($file) + public function testConfigFiles() { - $obsoleteNodes = array(); - $obsoleteNodesFiles = glob(__DIR__ . '/_files/obsolete_config_nodes*.php'); - foreach ($obsoleteNodesFiles as $obsoleteNodesFile) { - $obsoleteNodes = array_merge($obsoleteNodes, include($obsoleteNodesFile)); - } + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $obsoleteNodes = array(); + $obsoleteNodesFiles = glob(__DIR__ . '/_files/obsolete_config_nodes*.php'); + foreach ($obsoleteNodesFiles as $obsoleteNodesFile) { + $obsoleteNodes = array_merge($obsoleteNodes, include($obsoleteNodesFile)); + } - $xml = simplexml_load_file($file); - foreach ($obsoleteNodes as $xpath => $suggestion) { - $this->assertEmpty( - $xml->xpath($xpath), - "Nodes identified by XPath '$xpath' are obsolete. $suggestion" - ); - } - } - - /** - * @return array - */ - public function configFileDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getMainConfigFiles(); + $xml = simplexml_load_file($file); + foreach ($obsoleteNodes as $xpath => $suggestion) { + $this->assertEmpty( + $xml->xpath($xpath), + "Nodes identified by XPath '$xpath' are obsolete. $suggestion" + ); + } + }, + \Magento\TestFramework\Utility\Files::init()->getMainConfigFiles() + ); } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php index 0ab84873126..70435bc1b08 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php @@ -32,21 +32,21 @@ namespace Magento\Test\Legacy; class EmailTemplateTest extends \PHPUnit_Framework_TestCase { - /** - * @param string $file - * @dataProvider obsoleteDirectivesDataProvider - */ - public function testObsoleteDirectives($file) + public function testObsoleteDirectives() { - $this->assertNotRegExp( - '/\{\{htmlescape.*?\}\}/i', - file_get_contents($file), - 'Directive {{htmlescape}} is obsolete. Use {{escapehtml}} instead.' + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $this->assertNotRegExp( + '/\{\{htmlescape.*?\}\}/i', + file_get_contents($file), + 'Directive {{htmlescape}} is obsolete. Use {{escapehtml}} instead.' + ); + }, + \Magento\TestFramework\Utility\Files::init()->getEmailTemplates() ); } - - public function obsoleteDirectivesDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getEmailTemplates(); - } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php index fb9cf663b7d..26599006318 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php @@ -97,49 +97,58 @@ class LayoutTest extends \PHPUnit_Framework_TestCase ) ); - /** - * @param string $layoutFile - * @dataProvider layoutFileDataProvider - */ - public function testLayoutFile($layoutFile) + public function testLayoutFile() { - $layoutXml = simplexml_load_file($layoutFile); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $layoutFile + */ + function ($layoutFile) { + $layoutXml = simplexml_load_file($layoutFile); - $this->_testObsoleteReferences($layoutXml); + $this->_testObsoleteReferences($layoutXml); - $selectorHeadBlock = '(name()="block" or name()="referenceBlock") and ' - . '(@name="head" or @name="convert_root_head" or @name="vde_head")'; - $this->assertSame(array(), - $layoutXml->xpath( - '//block[@class="Magento\Page\Block\Html\Head\Css" ' - . 'or @class="Magento\Page\Block\Html\Head\Link" ' - . 'or @class="Magento\Page\Block\Html\Head\Script"]' - . '/parent::*[not(' . $selectorHeadBlock . ')]' - ), - 'Blocks \Magento\Page\Block\Html\Head\{Css,Link,Script} are allowed within the "head" block only. ' - . 'Verify integrity of the nodes nesting.' - ); - $this->assertSame(array(), - $layoutXml->xpath('/layout//*[@output="toHtml"]'), 'output="toHtml" is obsolete. Use output="1"' - ); - foreach ($layoutXml as $handle) { - $this->assertNotContains((string)$handle['id'], $this->_obsoleteNodes, 'This layout handle is obsolete.'); - } - foreach ($layoutXml->xpath('@helper') as $action) { - $this->assertNotContains('/', $action->getAttribute('helper')); - $this->assertContains('::', $action->getAttribute('helper')); - } - - if (false !== strpos($layoutFile, 'app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_sales_order')) { - $this->markTestIncomplete("The file {$layoutFile} has to use \Magento\Core\Block\Text\List, \n" - . 'there is no solution to get rid of it right now.' - ); - } - $this->assertSame(array(), - $layoutXml->xpath('/layout//block[@class="Magento\Core\Block\Text\ListText"]'), - 'The namespace Magento\Core\Block\Text; + $selectorHeadBlock = '(name()="block" or name()="referenceBlock") and ' + . '(@name="head" or @name="convert_root_head" or @name="vde_head")'; + $this->assertSame(array(), + $layoutXml->xpath( + '//block[@class="Magento\Page\Block\Html\Head\Css" ' + . 'or @class="Magento\Page\Block\Html\Head\Link" ' + . 'or @class="Magento\Page\Block\Html\Head\Script"]' + . '/parent::*[not(' . $selectorHeadBlock . ')]' + ), + 'Blocks \Magento\Page\Block\Html\Head\{Css,Link,Script} are allowed within the "head" block only. ' + . 'Verify integrity of the nodes nesting.' + ); + $this->assertSame(array(), + $layoutXml->xpath('/layout//*[@output="toHtml"]'), 'output="toHtml" is obsolete. Use output="1"' + ); + foreach ($layoutXml as $handle) { + $this->assertNotContains( + (string)$handle['id'], + $this->_obsoleteNodes, + 'This layout handle is obsolete.' + ); + } + foreach ($layoutXml->xpath('@helper') as $action) { + $this->assertNotContains('/', $action->getAttribute('helper')); + $this->assertContains('::', $action->getAttribute('helper')); + } -class ListText is not supposed to be used in layout anymore.' + if (false + !== strpos($layoutFile, 'app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_sales_order') + ) { + $this->markTestIncomplete("The file {$layoutFile} has to use \\Magento\\Core\\Block\\Text\\List, \n" + . 'there is no solution to get rid of it right now.' + ); + } + $this->assertSame(array(), + $layoutXml->xpath('/layout//block[@class="Magento\Core\Block\Text\ListText"]'), + 'The class \Magento\Core\Block\Text\ListTest is not supposed to be used in layout anymore.' + ); + }, + \Magento\TestFramework\Utility\Files::init()->getLayoutFiles() ); } @@ -161,28 +170,25 @@ class ListText is not supposed to be used in layout anymore.' } } - /** - * @return array - */ - public function layoutFileDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getLayoutFiles(); - } - - /** - * @param string $layoutFile - * @dataProvider layoutFileDataProvider - */ - public function testActionNodeMethods($layoutFile) + public function testActionNodeMethods() { - $layoutXml = simplexml_load_file($layoutFile); - $methodFilter = '@method!="' . implode('" and @method!="', $this->getAllowedActionNodeMethods()) . '"'; - foreach ($layoutXml->xpath('//action[' . $methodFilter . ']') as $node) { - $attributes = $node->attributes(); - $this->fail(sprintf( - 'Call of method "%s" via layout instruction <action> is not allowed.', $attributes['method'] - )); - } + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $layoutFile + */ + function ($layoutFile) { + $layoutXml = simplexml_load_file($layoutFile); + $methodFilter = '@method!="' . implode('" and @method!="', $this->getAllowedActionNodeMethods()) . '"'; + foreach ($layoutXml->xpath('//action[' . $methodFilter . ']') as $node) { + $attributes = $node->attributes(); + $this->fail(sprintf( + 'Call of method "%s" via layout instruction <action> is not allowed.', $attributes['method'] + )); + } + }, + \Magento\TestFramework\Utility\Files::init()->getLayoutFiles() + ); } /** diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php index 45cbe31a529..12757484913 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php @@ -32,25 +32,28 @@ namespace Magento\Test\Legacy; class LicenseTest extends \PHPUnit_Framework_TestCase { - /** - * @dataProvider legacyCommentDataProvider - */ - public function testLegacyComment($filename) + public function testLegacyComment() { - $fileText = file_get_contents($filename); - if (!preg_match_all('#/\*\*.+@copyright.+?\*/#s', $fileText, $matches)) { - return; - } + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + function ($filename) { + $fileText = file_get_contents($filename); + if (!preg_match_all('#/\*\*.+@copyright.+?\*/#s', $fileText, $matches)) { + return; + } - foreach ($matches[0] as $commentText) { - foreach (array('Irubin Consulting Inc', 'DBA Varien', 'Magento Inc') as $legacyText) { - $this->assertNotContains( - $legacyText, - $commentText, - "The license of file {$filename} contains legacy text." - ); - } - } + foreach ($matches[0] as $commentText) { + foreach (array('Irubin Consulting Inc', 'DBA Varien', 'Magento Inc') as $legacyText) { + $this->assertNotContains( + $legacyText, + $commentText, + "The license of file {$filename} contains legacy text." + ); + } + } + }, + $this->legacyCommentDataProvider() + ); } public function legacyCommentDataProvider() diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Bundle/Model/Product/TypeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Bundle/Model/Product/TypeTest.php deleted file mode 100644 index 65b4434cc42..00000000000 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Bundle/Model/Product/TypeTest.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category tests - * @package static - * @subpackage Legacy - * @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) - */ - -/** - * Tests for obsolete methods in Product Type instances - */ -namespace Magento\Test\Legacy\Magento\Bundle\Model\Product; - -class TypeTest - extends \Magento\Test\Legacy\Magento\Catalog\Model\Product\AbstractTypeTest -{ - /** - * @var array - */ - protected $_productTypeFiles = array( - '/app/code/Magento/Bundle/Model/Product/Type.php', - ); -} diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Catalog/Model/Product/AbstractTypeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Catalog/Model/Product/AbstractTypeTest.php deleted file mode 100644 index 5e51ca1ffa6..00000000000 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Catalog/Model/Product/AbstractTypeTest.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category tests - * @package static - * @subpackage Legacy - * @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) - */ - -/** - * Tests for obsolete methods in Product Type instances - * - * Abstract class is needed because it is not possible to run both tests of inherited class and its inheritors - * @see https://github.com/sebastianbergmann/phpunit/issues/385 - */ -namespace Magento\Test\Legacy\Magento\Catalog\Model\Product; - -abstract class AbstractTypeTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var array - */ - protected $_productTypeFiles = array(); - - /** - * @dataProvider obsoleteMethodsDataProvider - * - * @param string $method - */ - public function testProductTypeModelsForObsoleteMethods($method) - { - $root = \Magento\TestFramework\Utility\Files::init()->getPathToSource(); - foreach ($this->_productTypeFiles as $file) { - $this->assertNotContains( - '$this->' . $method . '(', - file_get_contents($root . $file), - "Method 'Magento\Catalog\Model\Product\Type\AbstractType::$method' is obsolete." - ); - } - } - - /** - * @return array - */ - public static function obsoleteMethodsDataProvider() - { - return array( - array('getProduct'), - array('setProduct'), - ); - } -} diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Catalog/Model/Product/TypeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Catalog/Model/Product/TypeTest.php deleted file mode 100644 index a9a3357a8f4..00000000000 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Catalog/Model/Product/TypeTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category tests - * @package static - * @subpackage Legacy - * @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) - */ - -/** - * Tests for obsolete methods in Product Type instances - */ -namespace Magento\Test\Legacy\Magento\Catalog\Model\Product; - -class TypeTest - extends \Magento\Test\Legacy\Magento\Catalog\Model\Product\AbstractTypeTest -{ - /** - * @var array - */ - protected $_productTypeFiles = array( - '/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php', - '/app/code/Magento/Catalog/Model/Product/Type/Configurable.php', - '/app/code/Magento/Catalog/Model/Product/Type/Grouped.php', - '/app/code/Magento/Catalog/Model/Product/Type/Price.php', - '/app/code/Magento/Catalog/Model/Product/Type/Simple.php', - '/app/code/Magento/Catalog/Model/Product/Type/Virtual.php', - ); -} diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Core/Block/AbstractBlockTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Core/Block/AbstractBlockTest.php index ba844895185..95c3329d669 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Core/Block/AbstractBlockTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Core/Block/AbstractBlockTest.php @@ -32,34 +32,34 @@ namespace Magento\Test\Legacy\Magento\Core\Block; class AbstractBlockTest extends \PHPUnit_Framework_TestCase { - /** - * Tests if methods are used with correct count of parameters - * - * @param string $file - * @dataProvider phpFilesDataProvider - */ - public function testGetChildHtml($file) + public function testGetChildHtml() { - $result = \Magento\TestFramework\Utility\Classes::getAllMatches( - file_get_contents($file), - "/(->getChildHtml\([^,()]+, ?[^,()]+,)/i" + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Tests if methods are used with correct count of parameters + * + * @param string $file + */ + function ($file) { + $result = \Magento\TestFramework\Utility\Classes::getAllMatches( + file_get_contents($file), + "/(->getChildHtml\([^,()]+, ?[^,()]+,)/i" + ); + $this->assertEmpty( + $result, + "3rd parameter is not needed anymore for getChildHtml() in '$file': " . print_r($result, true) + ); + $result = \Magento\TestFramework\Utility\Classes::getAllMatches( + file_get_contents($file), + "/(->getChildChildHtml\([^,()]+, ?[^,()]+, ?[^,()]+,)/i" + ); + $this->assertEmpty( + $result, + "4th parameter is not needed anymore for getChildChildHtml() in '$file': " . print_r($result, true) + ); + }, + \Magento\TestFramework\Utility\Files::init()->getPhpFiles() ); - $this->assertEmpty( - $result, - "3rd parameter is not needed anymore for getChildHtml() in '$file': " . print_r($result, true) - ); - $result = \Magento\TestFramework\Utility\Classes::getAllMatches( - file_get_contents($file), - "/(->getChildChildHtml\([^,()]+, ?[^,()]+, ?[^,()]+,)/i" - ); - $this->assertEmpty( - $result, - "4th parameter is not needed anymore for getChildChildHtml() in '$file': " . print_r($result, true) - ); - } - - public function phpFilesDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getPhpFiles(); } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Downloadable/Model/Product/TypeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Downloadable/Model/Product/TypeTest.php deleted file mode 100644 index 81914d4ddc7..00000000000 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Downloadable/Model/Product/TypeTest.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category tests - * @package static - * @subpackage Legacy - * @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) - */ - -/** - * Tests for obsolete methods in Product Type instances - */ -namespace Magento\Test\Legacy\Magento\Downloadable\Model\Product; - -class TypeTest - extends \Magento\Test\Legacy\Magento\Catalog\Model\Product\AbstractTypeTest -{ - /** - * @var array - */ - protected $_productTypeFiles = array( - '/app/code/Magento/Downloadable/Model/Product/Type.php', - ); -} diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Install/ConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Install/ConfigTest.php index 28147eaef51..c67710da8ae 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Install/ConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Install/ConfigTest.php @@ -27,25 +27,22 @@ namespace Magento\Test\Legacy\Magento\Install; class ConfigTest extends \PHPUnit_Framework_TestCase { - /** - * @param string $file - * @dataProvider configFileDataProvider - */ - public function testConfigFile($file) + public function testConfigFile() { - $xml = simplexml_load_file($file); - $path = '/config/check/php/extensions'; - $this->assertEmpty( - $xml->xpath($path), - "Nodes from '{$path}' in install_wizard.xml have been moved to module.xml" + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $xml = simplexml_load_file($file); + $path = '/config/check/php/extensions'; + $this->assertEmpty( + $xml->xpath($path), + "Nodes from '{$path}' in install_wizard.xml have been moved to module.xml" + ); + }, + \Magento\TestFramework\Utility\Files::init()->getConfigFiles('install_wizard.xml') ); } - - /** - * @return array - */ - public function configFileDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getConfigFiles('install_wizard.xml'); - } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Widget/XmlTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Widget/XmlTest.php index 65a57f6cc12..88178428c29 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Widget/XmlTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Widget/XmlTest.php @@ -34,41 +34,43 @@ namespace Magento\Test\Legacy\Magento\Widget; class XmlTest extends \PHPUnit_Framework_TestCase { - /** - * @param string $file - * @dataProvider widgetXmlFilesDataProvider - */ - public function testClassFactoryNames($file) + public function testClassFactoryNames() { - $xml = simplexml_load_file($file); - $nodes = $xml->xpath('/widgets/*[@type]') ?: array(); - /** @var \SimpleXMLElement $node */ - foreach ($nodes as $node) { - $type = (string)$node['type']; - $this->assertNotRegExp('/\//', $type, "Factory name detected: {$type}."); - } - } - - /** - * @param string $file - * @dataProvider widgetXmlFilesDataProvider - */ - public function testBlocksIntoContainers($file) - { - $xml = simplexml_load_file($file); - $this->assertSame(array(), $xml->xpath('/widgets/*/supported_blocks'), - 'Obsolete node: <supported_blocks>. To be replaced with <supported_containers>' - ); - $this->assertSame(array(), $xml->xpath('/widgets/*/*/*/block_name'), - 'Obsolete node: <block_name>. To be replaced with <container_name>' + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $xml = simplexml_load_file($file); + $nodes = $xml->xpath('/widgets/*[@type]') ?: array(); + /** @var \SimpleXMLElement $node */ + foreach ($nodes as $node) { + $type = (string)$node['type']; + $this->assertNotRegExp('/\//', $type, "Factory name detected: {$type}."); + } + }, + \Magento\TestFramework\Utility\Files::init()->getConfigFiles('widget.xml') ); } - /** - * @return array - */ - public function widgetXmlFilesDataProvider() + public function testBlocksIntoContainers() { - return \Magento\TestFramework\Utility\Files::init()->getConfigFiles('widget.xml'); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $xml = simplexml_load_file($file); + $this->assertSame(array(), $xml->xpath('/widgets/*/supported_blocks'), + 'Obsolete node: <supported_blocks>. To be replaced with <supported_containers>' + ); + $this->assertSame(array(), $xml->xpath('/widgets/*/*/*/block_name'), + 'Obsolete node: <block_name>. To be replaced with <container_name>' + ); + }, + \Magento\TestFramework\Utility\Files::init()->getConfigFiles('widget.xml') + ); } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteAclTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteAclTest.php index 9ba5b9d2fd4..935919fefed 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteAclTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteAclTest.php @@ -32,25 +32,22 @@ namespace Magento\Test\Legacy; class ObsoleteAclTest extends \PHPUnit_Framework_TestCase { - /** - * @param string $aclFile - * @dataProvider aclFilesDataProvider - */ - public function testAclDeclaration($aclFile) + public function testAclDeclarations() { - $aclXml = simplexml_load_file($aclFile); - $xpath = '/config/acl/*[boolean(./children) or boolean(./title)]'; - $this->assertEmpty( - $aclXml->xpath($xpath), - 'Obsolete acl structure detected in file ' . $aclFile . '.' + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $aclFile + */ + function ($aclFile) { + $aclXml = simplexml_load_file($aclFile); + $xpath = '/config/acl/*[boolean(./children) or boolean(./title)]'; + $this->assertEmpty( + $aclXml->xpath($xpath), + 'Obsolete acl structure detected in file ' . $aclFile . '.' + ); + }, + \Magento\TestFramework\Utility\Files::init()->getMainConfigFiles() ); } - - /** - * @return array - */ - public function aclFilesDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getMainConfigFiles(); - } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php index c1809ec194f..7c9e9a61c0f 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php @@ -126,86 +126,74 @@ class ObsoleteCodeTest extends \PHPUnit_Framework_TestCase return include($file); } - /** - * @param string $file - * @dataProvider phpFileDataProvider - */ - public function testPhpFile($file) - { - $content = file_get_contents($file); - $this->_testObsoleteClasses($content); - $this->_testObsoleteMethods($content, $file); - $this->_testGetChildSpecialCase($content, $file); - $this->_testGetOptionsSpecialCase($content); - $this->_testObsoleteMethodArguments($content); - $this->_testObsoleteProperties($content); - $this->_testObsoleteActions($content); - $this->_testObsoleteConstants($content); - $this->_testObsoletePropertySkipCalculate($content); - $this->_testObsoleteNamespace($file); - } - - /** - * @return array - */ - public function phpFileDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getPhpFiles(); - } - - /** - * @param string $file - * @dataProvider phtmlFileDataProvider - */ - public function testTemplateMageCall($file) - { - $content = file_get_contents($file); - $this->_assertNotRegExp('/\bMage::(\w+?)\(/iS', $content, "Static Method of 'Mage' class is obsolete."); - } - - /** - * @return array - */ - public function phtmlFileDataProvider() + public function testPhpFiles() { - return \Magento\TestFramework\Utility\Files::init()->getPhpFiles(false, false, true); - } - - /** - * @param string $file - * @dataProvider xmlFileDataProvider - */ - public function testXmlFile($file) - { - $content = file_get_contents($file); - $this->_testObsoleteClasses($content, $file); - $this->_testObsoleteNamespace($file); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $content = file_get_contents($file); + $this->_testObsoleteClasses($content); + $this->_testObsoleteMethods($content, $file); + $this->_testGetChildSpecialCase($content, $file); + $this->_testGetOptionsSpecialCase($content); + $this->_testObsoleteMethodArguments($content); + $this->_testObsoleteProperties($content); + $this->_testObsoleteActions($content); + $this->_testObsoleteConstants($content); + $this->_testObsoletePropertySkipCalculate($content); + $this->_testObsoleteNamespace($file); + }, + \Magento\TestFramework\Utility\Files::init()->getPhpFiles() + ); } - /** - * @return array - */ - public function xmlFileDataProvider() + public function testTemplateMageCalls() { - return \Magento\TestFramework\Utility\Files::init()->getXmlFiles(); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $content = file_get_contents($file); + $this->_assertNotRegExp('/\bMage::(\w+?)\(/iS', $content, "Static Method of 'Mage' class is obsolete."); + }, + \Magento\TestFramework\Utility\Files::init()->getPhpFiles(false, false, true) + ); } - /** - * @param string $file - * @dataProvider jsFileDataProvider - */ - public function testJsFile($file) + public function testXmlFiles() { - $content = file_get_contents($file); - $this->_testObsoletePropertySkipCalculate($content); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $content = file_get_contents($file); + $this->_testObsoleteClasses($content, $file); + $this->_testObsoleteNamespace($file); + }, + \Magento\TestFramework\Utility\Files::init()->getXmlFiles() + ); } - /** - * @return array - */ - public function jsFileDataProvider() + public function testJsFiles() { - return \Magento\TestFramework\Utility\Files::init()->getJsFiles(); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $content = file_get_contents($file); + $this->_testObsoletePropertySkipCalculate($content); + }, + \Magento\TestFramework\Utility\Files::init()->getJsFiles() + ); } /** @@ -510,18 +498,24 @@ class ObsoleteCodeTest extends \PHPUnit_Framework_TestCase $this->assertSame(0, preg_match($regex, $content), $message); } - /** - * Check elimination of "Mage" class usages - * - * @dataProvider mageObsoleteDataProvider - * @param string $file - */ - public function testMageMethodsObsolete($file) + + public function testMageMethodsObsolete() { - $this->_assertNotRegExp( - '/[^a-z\d_]Mage::[^\s]+?\(/i', - file_get_contents($file), - '"Mage" class methods are obsolete' + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Check elimination of "Mage" class usages + * + * @param string $file + */ + function ($file) { + $this->_assertNotRegExp( + '/[^a-z\d_]Mage::[^\s]+?\(/i', + file_get_contents($file), + '"Mage" class methods are obsolete' + ); + }, + $this->mageObsoleteDataProvider() ); } @@ -540,7 +534,8 @@ class ObsoleteCodeTest extends \PHPUnit_Framework_TestCase foreach ($blackList as $file) { $ignored[] = realpath($appPath . DIRECTORY_SEPARATOR . $file); } - $files = \Magento\TestFramework\Utility\Files::init()->getClassFiles(false); + $files = \Magento\TestFramework\Utility\Files::init()-> + getClassFiles(true, true, true, true, true, true, 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/ObsoleteLayoutLocationTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteLayoutLocationTest.php index ba57dce430e..8de0453abd0 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteLayoutLocationTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteLayoutLocationTest.php @@ -29,20 +29,25 @@ namespace Magento\Test\Legacy; class ObsoleteLayoutLocationTest extends \PHPUnit_Framework_TestCase { - /** - * @param string $location - * @dataProvider obsoleteLayoutLocationDataProvider - */ - public function testObsoleteLayoutLocation($location) + public function testObsoleteLayoutLocation() { - $files = glob($location . '/*.xml'); - $layoutFiles = array(); - foreach ($files as $file) { - if (strpos(file_get_contents($file), '<layout') !== false) { - $layoutFiles[] = $file; - } - } - $this->assertEmpty($layoutFiles, 'Obsolete layout files found: ' . implode(', ', $layoutFiles)); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $location + */ + function ($location) { + $files = glob($location . '/*.xml'); + $layoutFiles = array(); + foreach ($files as $file) { + if (strpos(file_get_contents($file), '<layout') !== false) { + $layoutFiles[] = $file; + } + } + $this->assertEmpty($layoutFiles, 'Obsolete layout files found: ' . implode(', ', $layoutFiles)); + }, + self::obsoleteLayoutLocationDataProvider() + ); } /** diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteMenuTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteMenuTest.php index 22969bc077a..7cee59b2a1c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteMenuTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteMenuTest.php @@ -32,25 +32,22 @@ namespace Magento\Test\Legacy; class ObsoleteMenuTest extends \PHPUnit_Framework_TestCase { - /** - * @param string $menuFile - * @dataProvider menuFilesDataProvider - */ - public function testMenuDeclaration($menuFile) + public function testMenuDeclaration() { - $menuXml = simplexml_load_file($menuFile); - $xpath = '/config/menu/*[boolean(./children) or boolean(./title) or boolean(./action)]'; - $this->assertEmpty( - $menuXml->xpath($xpath), - 'Obsolete menu structure detected in file ' . $menuFile . '.' + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $menuFile + */ + function ($menuFile) { + $menuXml = simplexml_load_file($menuFile); + $xpath = '/config/menu/*[boolean(./children) or boolean(./title) or boolean(./action)]'; + $this->assertEmpty( + $menuXml->xpath($xpath), + 'Obsolete menu structure detected in file ' . $menuFile . '.' + ); + }, + \Magento\TestFramework\Utility\Files::init()->getMainConfigFiles() ); } - - /** - * @return array - */ - public function menuFilesDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getMainConfigFiles(); - } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php index a3dfb5ca947..780203d160c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php @@ -30,31 +30,28 @@ namespace Magento\Test\Legacy; class PhtmlTemplateTest extends \PHPUnit_Framework_TestCase { - /** - * Test usage of protected and private methods and variables in template - * - * According to naming convention (B5.8, B6.2) all class members - * in protected or private scope should be prefixed with underscore. - * Member variables declared "public" should never start with an underscore. - * Access to protected and private members of Block class is obsolete in phtml templates - * since introduction of multiple template engines support - * - * @param string $file - * @dataProvider phtmlFilesDataProvider - */ - public function testObsoleteBlockMethods($file) + public function testObsoleteBlockMethods() { - $this->assertNotRegexp('/this->_[^_]+\S*\(/iS', - file_get_contents($file), - 'Access to protected and private members of Block class is ' . - 'obsolete in phtml templates. Use only public members.'); - } - - /** - * @return array - */ - public function phtmlFilesDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getPhtmlFiles(); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * Test usage of protected and private methods and variables in template + * + * According to naming convention (B5.8, B6.2) all class members + * in protected or private scope should be prefixed with underscore. + * Member variables declared "public" should never start with an underscore. + * Access to protected and private members of Block class is obsolete in phtml templates + * since introduction of multiple template engines support + * + * @param string $file + */ + function ($file) { + $this->assertNotRegexp('/this->_[^_]+\S*\(/iS', + file_get_contents($file), + 'Access to protected and private members of Block class is ' . + 'obsolete in phtml templates. Use only public members.'); + }, + \Magento\TestFramework\Utility\Files::init()->getPhtmlFiles() + ); } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php index 562c538a6fd..29a1385c120 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php @@ -32,23 +32,29 @@ namespace Magento\Test\Legacy; class TableTest extends \PHPUnit_Framework_TestCase { - /** - * @dataProvider tableNameDataProvider - */ - public function testTableName($filePath) + public function testTableName() { - $tables = self::extractTables($filePath); - $legacyTables = array(); - foreach ($tables as $table) { - $tableName = $table['name']; - if (strpos($tableName, '/') === false) { - continue; - } - $legacyTables[] = $table; - } - - $message = $this->_composeFoundsMessage($legacyTables); - $this->assertEmpty($message, $message); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $filePath + */ + function ($filePath) { + $tables = self::extractTables($filePath); + $legacyTables = array(); + foreach ($tables as $table) { + $tableName = $table['name']; + if (strpos($tableName, '/') === false) { + continue; + } + $legacyTables[] = $table; + } + + $message = $this->_composeFoundsMessage($legacyTables); + $this->assertEmpty($message, $message); + }, + \Magento\TestFramework\Utility\Files::init()->getPhpFiles() + ); } /** @@ -229,12 +235,4 @@ class TableTest extends \PHPUnit_Framework_TestCase . implode(', ', $descriptions) . '.'; return $result; } - - /** - * @return array - */ - public function tableNameDataProvider() - { - return \Magento\TestFramework\Utility\Files::init()->getPhpFiles(); - } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/WordsTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/WordsTest.php index edf6ca28a71..eccf3c9bfe9 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/WordsTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/WordsTest.php @@ -45,23 +45,20 @@ class WordsTest extends \PHPUnit_Framework_TestCase ); } - /** - * @param string $file - * @dataProvider wordsDataProvider - */ - public function testWords($file) - { - $words = self::$_wordsFinder->findWords($file); - if ($words) { - $this->fail("Found words: '" . implode("', '", $words) . "' in '$file' file"); - } - } - - /** - * @return array - */ - public function wordsDataProvider() + public function testWords() { - return \Magento\TestFramework\Utility\Files::init()->getAllFiles(); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $words = self::$_wordsFinder->findWords($file); + if ($words) { + $this->fail("Found words: '" . implode("', '", $words) . "' in '$file' file"); + } + }, + \Magento\TestFramework\Utility\Files::init()->getAllFiles() + ); } } 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 d77cc99e43a..6a0f361aaf6 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 @@ -974,17 +974,13 @@ return array( array('Mage_Sales_Model_Order_Api'), array('Mage_Sales_Model_Order_Creditmemo_Api_V2'), array('Mage_Sales_Model_Order_Creditmemo_Api'), - array('Magento\Search\Model\Client\Solr\Factory'), - array('Magento\Search\Model\Client\SolrClient\Factory'), array('Magento\ImportExport\Model\Config'), array('Magento\Data\Collection\Factory', 'Magento\Data\CollectionFactory'), array('Magento\Adminhtml\Block\Customer\System\Config\ValidatevatFactory'), array('Magento\Customer\Model\Attribute\Data'), array('Magento\Eav\Model\Attribute\Data'), array('Magento\Log\Model\Resource\Helper\Mysql4', 'Magento\Log\Model\Resource\Helper'), - array('Magento\CustomerSegment\Model\Resource\Helper\Mysql4', 'Magento\CustomerSegment\Model\Resource\Helper'), array('Magento\CatalogSearch\Model\Resource\Helper\Mysql4', 'Magento\CatalogSearch\Model\Resource\Helper'), - array('Magento\SalesArchive\Model\Resource\Helper\Mysql4', 'Magento\SalesArchive\Model\Resource\Helper'), array('Magento\ImportExport\Model\Resource\Helper\Mysql4', 'Magento\ImportExport\Model\Resource\Helper'), array('Magento\Reports\Model\Resource\Helper\Mysql4', 'Magento\Reports\Model\Resource\Helper'), array('Magento\Backup\Model\Resource\Helper\Mysql4', 'Magento\Backup\Model\Resource\Helper'), 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 8932969888c..dcc7cdb7df3 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 @@ -140,7 +140,6 @@ return array( 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'), array('XML_PATH_DEFAULT_LOCALE', '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 51568924024..02c2c19efdd 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 @@ -223,12 +223,9 @@ return array( ), array('addWishListSortOrder', 'Magento\Wishlist\Model\Resource\Item\Collection'), array('appendBundleSelectionData', 'Magento\Bundle\Model\Observer'), - array('appendGiftcardAdditionalData', 'Magento\GiftCard\Model\Observer'), - array('_getResource', 'Magento\GiftCard\Model\Attribute\Backend\Giftcard\Amount'), array('applyAllDataUpdates', 'Magento\Core\Model\Resource\Setup'), array('applyAllUpdates', 'Magento\Core\Model\Resource\Setup'), array('applyDesign', 'Magento\Catalog\Model\Design'), - array('applyIndexChanges', 'Magento\Search\Model\Observer'), array('asArray', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), array('asSimplexml', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), array('asString', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), @@ -249,7 +246,7 @@ return array( 'Magento_TestFramework_Helper_Bootstrap::canTestHeaders' ), array('catalogCategoryChangeProducts', 'Magento\Catalog\Model\Product\Flat\Observer'), - array('catalogEventProductCollectionAfterLoad', 'Magento\GiftMessage\Model\Observer'), + array('catalog' . 'EventProductCollectionAfterLoad', 'Magento\GiftMessage\Model\Observer'), array('catalogProductCompareClean', 'Magento\Catalog\Model\Observer'), array('catalogProductLoadAfter', 'Magento\Bundle\Model\Observer'), array('changeLocaleAction', 'Magento\Adminhtml\Controller\Index'), @@ -354,7 +351,6 @@ return array( array('getDebug', 'Magento\Ogone\Model\Api'), array('getDebug', 'Magento\Paypal\Model\Api\AbstractApi'), array('getDefaultBasePath', 'Magento\Core\Model\Store'), - array('getDefaultMenuLayoutCode', 'Magento\VersionsCms\Model\Hierarchy\Config'), array('getDeleteUrl', 'Magento\Adminhtml\Block\Catalog\Product\Edit'), array('getDirectOutput', 'Magento\Core\Model\Layout'), array('getDistroServerVars', 'Magento\Core\Model\Config', 'getDistroBaseUrl'), @@ -414,7 +410,6 @@ return array( array('getModuleConfigurationFiles', 'Magento\Core\Model\Config'), array('getModuleSetup', 'Magento\Core\Model\Config'), array('getNeedUsePriceExcludeTax', '', 'Magento_Tax_Model_Config::priceIncludesTax()'), - array('getNode', 'Magento\Logging\Model\Config'), array('getOneBalanceTotal'), array('getOptimalCssUrls', 'Magento\Core\Model\Design\Package\Proxy', 'Magento\Core\Model\Page\Asset\Merged'), array('getOptimalJsUrls', 'Magento\Core\Model\Design\Package\Proxy', 'Magento\Core\Model\Page\Asset\Merged'), @@ -452,6 +447,7 @@ return array( array('getPricesDependingOnTax', 'Magento\Bundle\Model\Product\Price'), array('getPrintUrl', 'Magento\Checkout\Block\Onepage\Success'), array('getPrintUrl', 'Magento\Sales\Block\Order\Info'), + array('getProduct', 'Magento\Catalog\Model\Product\Type\AbstractType'), array('getProductCollectionAttributes', 'Magento\Catalog\Model\Config'), array('getProductCollection', 'Magento\Wishlist\Helper\Data'), array('getProductCollection', 'Magento\Wishlist\Model\Wishlist'), @@ -568,7 +564,6 @@ return array( array('getXmlConfig','Magento\Persistent\Model\Persistent\Config'), array('getXmlElementByType','Magento\Widget\Model\Widget', 'getWidgetByClassType'), array('hasItems', 'Magento\Wishlist\Helper\Data'), - array('holdCommit', 'Magento\Search\Model\Observer'), array('htmlEscape', '', 'escapeHtml'), array('imageAction', 'Magento\Catalog\Controller\Product'), array('implodeStreetAddress', 'Magento\Customer\Model\Address\AbstractAddress'), @@ -585,7 +580,6 @@ return array( array('initSpecified', 'Magento\Core\Model\App'), array('insertProductPrice', 'Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice'), array('isAbsolutePath'), - array('isActive', 'Magento\Logging\Model\Config'), array('isAllowedGuestCheckout', 'Magento\Sales\Model\Quote'), array('isAutomaticCleaningAvailable', 'Magento\Cache\Backend\Eaccelerator'), array('isCheckoutAvailable', 'Magento\Checkout\Model\Type\Multishipping'), @@ -616,7 +610,7 @@ return array( array('loadProductPrices', 'Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice'), array('lockOrderInventoryData', 'Magento\CatalogInventory\Model\Observer'), array('logEncryptionKeySave'), - array('logInvitationSave'), + array('logI' . 'nvitationSave'), array('map', 'Magento\ObjectManager\Config\Mapper\Dom', 'Magento_ObjectManager_Config_Mapper_Dom::convert'), array('mergeFiles', 'Magento\Core\Helper\Data', 'Magento\Core\Model\Page\Asset\MergeStrategyInterface'), array('mergeFiles', 'Magento\Core\Model\Design\Package', 'Magento\Core\Model\Page\Asset\MergeStrategyInterface'), @@ -701,6 +695,7 @@ return array( array('setOrderId', 'Magento\Shipping\Block\Tracking\Popup'), array('setPackageTheme', 'Magento\Widget\Model\Widget\Instance', 'setThemeId'), array('setParentBlock'), + array('setProduct', 'Magento\Catalog\Model\Product\Type\AbstractType'), array('setProfile', 'Magento\Convert\Container\AbstractContainer'), array('setResourceConfig', 'Magento\Core\Model\Resource'), array('setSaveTemplateFlag', 'Magento\Newsletter\Model\Queue'), @@ -851,11 +846,6 @@ return array( array('_getResource', 'Magento\Weee\Model\Attribute\Backend\Weee\Tax', 'Magento_Weee_Model_Attribute_Backend_Weee_Tax::$_attributeTax'), array('getCouponMassGenerator', 'Magento\SalesRule\Model\Rule', 'Magento\SalesRule\Model\Coupon\Massgenerator'), - array('getEntityResourceModel', 'Magento\SalesArchive\Model\Archive', - 'Magento_SalesArchive_Model_ArchivalList::getResource'), - array('detectArchiveEntity', 'Magento\SalesArchive\Model\Archive', - 'Magento_SalesArchive_Model_ArchivalList::getEntityByObject'), - array('_getCallbackFunction', 'Magento\Logging\Model\Processor'), array('_getHelper', 'Magento\Captcha\Model\DefaultModel'), array('getSession', 'Magento\Captcha\Model\DefaultModel'), array('_getBackendSession', 'Magento\Captcha\Model\Observer'), @@ -863,7 +853,6 @@ return array( array('getProductStatusModel', 'Magento\CatalogInventory\Model\Stock\Status'), array('getStorage', 'Magento\Cms\Helper\Wysiwyg\Images'), array('_getSession', 'Magento\Review\Helper\Action\Pager'), - array('_getOrderCreateModel', 'Magento\Reward\Block\Adminhtml\Sales\Order\Create\Payment'), array('_getProductType', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Super\Config\Matrix'), array('_getProductType', 'Magento\Adminhtml\Block\Catalog\Product\Edit\Tab\Super\Config'), array('_getSession', 'Magento\Adminhtml\Model\Sales\Order'), diff --git a/dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest.php b/dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest.php index d87f6ac9fec..e0836aff84b 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest.php @@ -100,33 +100,33 @@ class CodeMessTest extends \PHPUnit_Framework_TestCase } /** - * @param string $inputFile - * @param string|array $expectedXpaths * @depends testRulesetFormat * @depends testPhpMdAvailability - * @dataProvider ruleViolationDataProvider */ - public function testRuleViolation($inputFile, $expectedXpaths) + public function testRuleViolation() { - $this->assertNotEquals(\PHP_PMD_TextUI_Command::EXIT_SUCCESS, self::$_messDetector->run( - array($inputFile)), "PHP Mess Detector has failed to identify problem at the erroneous file {$inputFile}" - ); - - $actualReportXml = simplexml_load_file(self::$_reportFile); - $expectedXpaths = (array)$expectedXpaths; - foreach ($expectedXpaths as $expectedXpath) { - $this->assertNotEmpty( - $actualReportXml->xpath($expectedXpath), - "Expected xpath: '$expectedXpath' for file: '$inputFile'" - ); - } - } + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $inputFile + * @param string|array $expectedXpaths + */ + function ($inputFile, $expectedXpaths) { + $this->assertNotEquals(\PHP_PMD_TextUI_Command::EXIT_SUCCESS, self::$_messDetector->run( + array($inputFile)), + "PHP Mess Detector has failed to identify problem at the erroneous file {$inputFile}" + ); - /** - * @return array - */ - public function ruleViolationDataProvider() - { - return include(__DIR__ . '/_files/phpmd/data.php'); + $actualReportXml = simplexml_load_file(self::$_reportFile); + $expectedXpaths = (array)$expectedXpaths; + foreach ($expectedXpaths as $expectedXpath) { + $this->assertNotEmpty( + $actualReportXml->xpath($expectedXpath), + "Expected xpath: '$expectedXpath' for file: '$inputFile'" + ); + } + }, + include(__DIR__ . '/_files/phpmd/data.php') + ); } } 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 62a0318f787..81e80fdf656 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeStyleTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeStyleTest.php @@ -73,39 +73,46 @@ class CodeStyleTest extends \PHPUnit_Framework_TestCase } /** - * @param string $inputFile - * @param string $expectedResultFile - * @dataProvider ruleDataProvider * @depends testPhpCsAvailability */ - public function testRule($inputFile, $expectedResultFile) + public function testRule() { - $expectedXml = simplexml_load_file($expectedResultFile); + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $inputFile + * @param string $expectedResultFile + */ + function ($inputFile, $expectedResultFile) { + $expectedXml = simplexml_load_file($expectedResultFile); - // rule is not implemented - $elements = $expectedXml->xpath('/config/incomplete'); - if ($elements) { - $message = (string)$elements[0]; - $this->markTestIncomplete("Rule for the fixture '{$inputFile}' is not implemented. {$message}"); - } + // rule is not implemented + $elements = $expectedXml->xpath('/config/incomplete'); + if ($elements) { + $message = (string)$elements[0]; + $this->markTestIncomplete("Rule for the fixture '{$inputFile}' is not implemented. {$message}"); + } - // run additional methods before making test - $elements = $expectedXml->xpath('/config/run'); - foreach ($elements as $element) { - $method = (string)$element->attributes()->method; - $this->$method(); - } + // run additional methods before making test + $elements = $expectedXml->xpath('/config/run'); + foreach ($elements as $element) { + $method = (string)$element->attributes()->method; + $this->$method(); + } - self::$_cmd->run(array($inputFile)); - $resultXml = simplexml_load_file(self::$_reportFile); - $this->_assertTotalErrorsAndWarnings($resultXml, $expectedXml); - $this->_assertErrors($resultXml, $expectedXml); - $this->_assertWarnings($resultXml, $expectedXml); + self::$_cmd->run(array($inputFile)); + $resultXml = simplexml_load_file(self::$_reportFile); + $this->_assertTotalErrorsAndWarnings($resultXml, $expectedXml); + $this->_assertErrors($resultXml, $expectedXml); + $this->_assertWarnings($resultXml, $expectedXml); - // verify that there has been at least one assertion performed - if ($this->getCount() == 0) { - $this->fail("Broken test: there has no assertions been performed for the fixture '{$inputFile}'."); - } + // verify that there has been at least one assertion performed + if ($this->getCount() == 0) { + $this->fail("Broken test: there has no assertions been performed for the fixture '{$inputFile}'."); + } + }, + $this->ruleDataProvider() + ); } /** diff --git a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php index 250a4e00101..29cb09a805e 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php @@ -65,6 +65,9 @@ class LiveCodeTest extends \PHPUnit_Framework_TestCase self::$_blackList = self::_readLists(__DIR__ . '/_files/'.$type.'blacklist/*.txt'); } + /** + * @TODO: combine with testCodeStyle + */ public function testCodeStylePsr2() { $this->markTestSkipped('Skipped'); @@ -83,18 +86,16 @@ class LiveCodeTest extends \PHPUnit_Framework_TestCase } 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->assertFileExists( + $reportFile, + 'Expected ' . $reportFile . ' to be created by phpcs run with PSR2 standard' + ); + $this->markTestIncomplete("PHP Code Sniffer has found $result error(s): See detailed report in $reportFile"); $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() diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index ccd7a7c6840..aeb96a0f570 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -1,6 +1,5 @@ Find/Feed/Block/Adminhtml Magento/Adminhtml -Magento/AdvancedCheckout/Block Magento/Authorizenet/Model Magento/Backend Magento/Bundle @@ -32,14 +31,12 @@ Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab Magento/Catalog/Model/Template Magento/Cms/Model Magento/GiftMessage/Model -Magento/GiftWrapping/Model Magento/GoogleShopping/Model/Attribute Magento/Oauth/Controller Magento/Sales/Block/Order Magento/Sales/Model/Resource/Helper Magento/Sales/Model/Resource/Order Magento/Catalog/Model/Resource/Product -Magento/CatalogEvent/Block/Catalog/Category Magento/Checkout/Block/Onepage Magento/Core/Model/Design/Backend Magento/Core/Model/Layout/File/Source/Override @@ -74,7 +71,6 @@ Magento/CatalogRule/Model Magento/Tax/Block/Checkout Magento/Tax/Model/Sales/Pdf Magento/Usa/Model/Shipping/Carrier -Magento/VersionsCms/Block Magento/Webapi/Model Magento/Webhook/Model Magento/Widget/Model/Widget/Instance diff --git a/dev/tests/static/testsuite/Magento/Test/Twig/TwigExtensionTest.php b/dev/tests/static/testsuite/Magento/Test/Twig/TwigExtensionTest.php index dfdea9a22db..2bc51a7cf87 100644 --- a/dev/tests/static/testsuite/Magento/Test/Twig/TwigExtensionTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Twig/TwigExtensionTest.php @@ -27,18 +27,21 @@ namespace Magento\Test\Twig; class TwigExtensionTest extends \PHPUnit_Framework_TestCase { - /** - * @dataProvider listAllTwigFiles - */ - public function testTwigTemplateValid($file, $runTest = true) + public function testTwigTemplatesValid() { - if (!$runTest) { - return; - } - exec('php ' . __DIR__ . "/_files/twig-lint.phar lint $file", $output, $returnVar); - $this->assertEquals( - 0, $returnVar, - "File $file could not be validated by twig-lint. The output is : \n" . implode("\n", $output) + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + function ($file, $runTest = true) { + if (!$runTest) { + return; + } + exec('php ' . __DIR__ . "/_files/twig-lint.phar lint $file", $output, $returnVar); + $this->assertEquals( + 0, $returnVar, + "File $file could not be validated by twig-lint. The output is : \n" . implode("\n", $output) + ); + }, + $this->listAllTwigFiles() ); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/AbstractElementTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/AbstractElementTest.php index 9777ef91464..851381472d9 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/AbstractElementTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/AbstractElementTest.php @@ -87,11 +87,11 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase $this->_model->setData(array( 'id' => 'elementId', 'label' => 'Element Label', - 'customAttribute' => 'Custom attribute value' + 'someAttribute' => 'Some attribute value' ), 'someScope'); $this->assertEquals('elementId', $this->_model->getAttribute('id')); $this->assertEquals('Element Label', $this->_model->getAttribute('label')); - $this->assertEquals('Custom attribute value', $this->_model->getAttribute('customAttribute')); + $this->assertEquals('Some attribute value', $this->_model->getAttribute('someAttribute')); $this->assertNull($this->_model->getAttribute('nonexistingAttribute')); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/AbstractCompositeTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/AbstractCompositeTest.php index b48bb9ec452..40df46869bb 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/AbstractCompositeTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/AbstractCompositeTest.php @@ -52,7 +52,7 @@ class AbstractCompositeTest extends \PHPUnit_Framework_TestCase protected $_testData = array( 'id' => 'elementId', 'label' => 'Element Label', - 'customAttribute' => 'Custom attribute value', + 'someAttribute' => 'Some attribute value', 'children' => array( 'someGroup' => array() ) diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/_files/valid_menu.xml b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/_files/valid_menu.xml index 49ec3e538bf..4a4723c8b86 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/_files/valid_menu.xml +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/_files/valid_menu.xml @@ -25,7 +25,7 @@ --> <config> <menu> - <add id="Some_TestName::catalog_some_catalogevent_events" title="Events" module="Some_Value" sortOrder="10" parent="Some_Value::test_test" action="action/actions" resource="Some_Value::events" dependsOnModule="Some_Value" dependsOnConfig="catalog/Some_valuet/enabled" toolTip="some tool tip" /> + <add id="Some_TestName::catalog_some_events" title="Events" module="Some_Value" sortOrder="10" parent="Some_Value::test_test" action="action/actions" resource="Some_Value::events" dependsOnModule="Some_Value" dependsOnConfig="catalog/Some_valuet/enabled" toolTip="some tool tip" /> <update id="Module_Name::system_config" title="some title" sortOrder="12" action="some_action" resource="Some_Test::events" dependsOnModule="Some_Test" dependsOnConfig="catalog/Some_value/enabled" module="Some_Module" parent="Some_Test::test_value" toolTip="some toolTip" /> <remove id="Some_Adminhtml::system_currency" /> </menu> diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php index a40d54bcd84..b5cba448441 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php @@ -88,7 +88,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase $this->_menuConfigMock->expects($this->any())->method('getMenu')->will($this->returnValue($this->_menuMock)); $this->_coreSessionMock = $this->getMock( - 'Magento\Core\Model\SessionProxy', array('getFormKey'), array(), '', false + 'Magento\Core\Model\Session', array('getFormKey'), array(), '', false ); $this->_coreSessionMock->expects($this->any())->method('getFormKey')->will($this->returnValue('salt')); @@ -117,13 +117,13 @@ class UrlTest extends \PHPUnit_Framework_TestCase $this->_coreDataMock = $this->getMock('Magento\Core\Helper\Data', array('getHash'), array(), '', false); $this->_coreDataMock->expects($this->any())->method('getHash')->will($this->returnArgument(0)); - $this->_authSessionMock = $this->getMock('Magento\Backend\Model\Auth\SessionProxy', array(), array(), + $this->_authSessionMock = $this->getMock('Magento\Backend\Model\Auth\Session', array(), array(), '', false, false); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_model = $helper->getObject('Magento\Backend\Model\Url', array( 'coreStoreConfig' => $this->_storeConfigMock, 'backendHelper' => $helperMock, - 'coreSession' => $this->_coreSessionMock, + 'session' => $this->_coreSessionMock, 'menuConfig' => $this->_menuConfigMock, 'coreData' => $this->_coreDataMock, 'authSession' => $this->_authSessionMock diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/LinkTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/LinkTest.php index 333f2656c9c..eece24755d8 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/LinkTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/LinkTest.php @@ -84,7 +84,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase ) ); - /** @var \Magento\Invitation\Block\Link $block */ + /** @var \Magento\Checkout\Block\Cart\Link $block */ $block = $this->_objectManagerHelper->getObject( 'Magento\Checkout\Block\Cart\Link', array( @@ -122,7 +122,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase ) ); - /** @var \Magento\Invitation\Block\Link $block */ + /** @var \Magento\Checkout\Block\Cart\Link $block */ $block = $this->_objectManagerHelper->getObject( 'Magento\Checkout\Block\Cart\Link', array( diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/LinkTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/LinkTest.php index a7ea3459f54..0255664a831 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/LinkTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/LinkTest.php @@ -83,7 +83,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase array('helperFactory' => $helperFactory) ); - /** @var \Magento\Invitation\Block\Link $block */ + /** @var \Magento\Checkout\Block\Link $block */ $block = $this->_objectManagerHelper->getObject( 'Magento\Checkout\Block\Link', array( diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ArrayTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ArrayTest.php index da59505fa30..30e491aae82 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ArrayTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ArrayTest.php @@ -177,7 +177,7 @@ class ArrayTest extends \PHPUnit_Framework_TestCase $layout->xpath('//argument[@name="testArrayWithUpdater"]'), array( 'type' => 'array', - 'updaters' => array('Magento\SalesArchive\Model\Order\Grid\Massaction\ItemsUpdater'), + 'updaters' => array('Magento\Sales\Model\Order\Grid\Massaction\ItemsUpdater'), 'value' => array( 'add' => 'array', ), diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/_files/arguments.xml b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/_files/arguments.xml index bd135e081c1..6464227e5a7 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/_files/arguments.xml +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/_files/arguments.xml @@ -56,7 +56,7 @@ <item name="label" xsi:type="string">Excel XML</item> </argument> <argument name="testArrayWithUpdater" xsi:type="array"> - <updater>Magento\SalesArchive\Model\Order\Grid\Massaction\ItemsUpdater</updater> + <updater>Magento\Sales\Model\Order\Grid\Massaction\ItemsUpdater</updater> <item name="add" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Move to Archive</item> <item name="url" xsi:type="string">*/sales_archive/massAdd</item> diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/UrlTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/UrlTest.php index 4a1d9da6a78..510805f8c92 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\SessionProxy', array(), array(), '', false, false) + $this->getMock('Magento\Core\Model\Session', array(), array(), '', false, false) ); } diff --git a/dev/tests/unit/testsuite/Magento/Data/Form/Element/EditablemultiselectTest.php b/dev/tests/unit/testsuite/Magento/Data/Form/Element/EditablemultiselectTest.php index 63b95ca0229..63072295f24 100644 --- a/dev/tests/unit/testsuite/Magento/Data/Form/Element/EditablemultiselectTest.php +++ b/dev/tests/unit/testsuite/Magento/Data/Form/Element/EditablemultiselectTest.php @@ -48,7 +48,7 @@ class EditablemultiselectTest extends \PHPUnit_Framework_TestCase $this->_model->setData(array('values' => $values, 'value' => $value)); } - public function testGetElementHtmlRendersCustomAttributesWhenDisabled() + public function testGetElementHtmlRendersDataAttributesWhenDisabled() { $this->_model->setDisabled(true); $elementHtml = $this->_model->getElementHtml(); 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 665afcf89e4..ca652ac5f2c 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\SessionProxy', array(), array(), '', false); + $session = $this->getMock('Magento\Core\Model\Session', 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/Install/Model/Installer/Db/Mysql4Test.php b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php index 4dcae9c200c..3f965c0853b 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php +++ b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php @@ -51,7 +51,11 @@ class Mysql4Test extends \PHPUnit_Framework_TestCase $adapterMock->expects($this->once())->method('getConnection')->will($this->returnValue($connectionMock)); $adapterFactory->expects($this->once())->method('create')->will($this->returnValue($adapterMock)); - $installer = new \Magento\Install\Model\Installer\Db\Mysql4($adapterFactory); + $localConfig = $this->getMockBuilder('\Magento\Core\Model\Config\Local') + ->disableOriginalConstructor() + ->getMock(); + + $installer = new \Magento\Install\Model\Installer\Db\Mysql4($adapterFactory, $localConfig); $this->assertEquals($expectedResult, $installer->supportEngine()); } @@ -80,8 +84,10 @@ class Mysql4Test extends \PHPUnit_Framework_TestCase $adapterFactory = $this->getMock( 'Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory', array('create'), array(), '', false ); + $localConfig = + $this->getMockBuilder('\Magento\Core\Model\Config\Local')->disableOriginalConstructor()->getMock(); $installer = new \Magento\Install\Model\Installer\Db\Mysql4( - $adapterFactory, $dbExtensions + $adapterFactory, $localConfig, $dbExtensions ); $installer->setConfig($config); $this->assertEquals($expectedResult, $installer->getRequiredExtensions()); diff --git a/dev/tests/unit/testsuite/Magento/Oauth/Helper/ServiceTest.php b/dev/tests/unit/testsuite/Magento/Oauth/Helper/ServiceTest.php index cc77cc8db7a..de3d67e3ed4 100644 --- a/dev/tests/unit/testsuite/Magento/Oauth/Helper/ServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Oauth/Helper/ServiceTest.php @@ -139,21 +139,4 @@ class ServiceTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(10)); $this->assertEquals(10, $this->_oauthHelper->getCleanupExpirationPeriod()); } - - public function testGetConsumerExpirationPeriodZero() - { - $this->_storeConfigMock->expects($this->once())->method('getConfig') - ->will($this->returnValue(0)); - $this->assertEquals( - \Magento\Oauth\Helper\Service::CONSUMER_EXPIRATION_PERIOD_DEFAULT, - $this->_oauthHelper->getConsumerExpirationPeriod() - ); - } - - public function testGetConsumerExpirationPeriodNonZero() - { - $this->_storeConfigMock->expects($this->once())->method('getConfig') - ->will($this->returnValue(10)); - $this->assertEquals(10, $this->_oauthHelper->getConsumerExpirationPeriod()); - } } diff --git a/dev/tests/unit/testsuite/Magento/Oauth/Service/OauthV1Test.php b/dev/tests/unit/testsuite/Magento/Oauth/Service/OauthV1Test.php index 07e21501070..863384bef4d 100644 --- a/dev/tests/unit/testsuite/Magento/Oauth/Service/OauthV1Test.php +++ b/dev/tests/unit/testsuite/Magento/Oauth/Service/OauthV1Test.php @@ -42,9 +42,6 @@ class OauthV1Test extends \PHPUnit_Framework_TestCase /** @var \Magento\Oauth\Model\Token */ private $_tokenMock; - /** @var \Magento\Oauth\Helper\Service */ - private $_helperMock; - /** @var \Magento\Core\Model\StoreManagerInterface */ private $_storeManagerMock; @@ -57,6 +54,12 @@ class OauthV1Test extends \PHPUnit_Framework_TestCase /** @var \Zend_Oauth_Http_Utility */ private $_httpUtilityMock; + /** @var \Magento\Core\Model\Date */ + private $_dateMock; + + /** @var \Magento\Core\Model\Store */ + protected $_storeMock; + private $_oauthToken; private $_oauthSecret; private $_oauthVerifier; @@ -117,26 +120,37 @@ class OauthV1Test extends \PHPUnit_Framework_TestCase ->method('create') ->will($this->returnValue($this->_tokenMock)); - $this->_helperMock = $this->getMockBuilder('Magento\Oauth\Helper\Service') - ->disableOriginalConstructor() - ->getMock(); $this->_storeManagerMock = $this->getMockBuilder('Magento\Core\Model\StoreManagerInterface') ->disableOriginalConstructor() ->getMockForAbstractClass(); + $this->_storeMock = $this->getMockBuilder('Magento\Core\Model\Store') + ->disableOriginalConstructor() + ->getMock(); + $this->_storeManagerMock->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($this->_storeMock)); + $this->_storeMock->expects($this->any()) + ->method('getBaseUrl') + ->will($this->returnValue('http://www.my-store.com/')); + $this->_httpClientMock = $this->getMockBuilder('Magento\HTTP\ZendClient') ->disableOriginalConstructor() ->getMock(); $this->_httpUtilityMock = $this->getMock('Zend_Oauth_Http_Utility'); + $this->_dateMock = $this->getMockBuilder('Magento\Core\Model\Date') + ->disableOriginalConstructor() + ->getMock(); + $this->_service = new \Magento\Oauth\Service\OauthV1( $this->_consumerFactory, $this->_nonceFactory, $this->_tokenFactory, - $this->_helperMock, $this->_storeManagerMock, $this->_httpClientMock, - $this->_httpUtilityMock + $this->_httpUtilityMock, + $this->_dateMock ); $this->_oauthToken = $this->_generateRandomString(\Magento\Oauth\Model\Token::LENGTH_TOKEN); @@ -149,9 +163,10 @@ class OauthV1Test extends \PHPUnit_Framework_TestCase unset($this->_consumerFactory); unset($this->_nonceFactory); unset($this->_tokenFactory); - unset($this->_helperMock); unset($this->_storeManagerMock); + unset($this->_storeMock); unset($this->_httpClientMock); + unset($this->_dateMock); unset($this->_service); } @@ -202,15 +217,6 @@ class OauthV1Test extends \PHPUnit_Framework_TestCase $this->_consumerMock->expects($this->once()) ->method('getData') ->will($this->returnValue($consumerData)); - $storeMock = $this->getMockBuilder('Magento\Core\Model\Store') - ->disableOriginalConstructor() - ->getMock(); - $this->_storeManagerMock->expects($this->once()) - ->method('getStore') - ->will($this->returnValue($storeMock)); - $storeMock->expects($this->once()) - ->method('getBaseUrl') - ->will($this->returnValue('http://www.my-store.com/')); $this->_httpClientMock->expects($this->once()) ->method('setUri') ->with('http://www.magento.com') @@ -222,7 +228,7 @@ class OauthV1Test extends \PHPUnit_Framework_TestCase ->method('createVerifierToken') ->with($consumerId) ->will($this->returnSelf()); - $this->_tokenMock->expects($this->once()) + $this->_tokenMock->expects($this->any()) ->method('getVerifier') ->will($this->returnValue($oauthVerifier)); @@ -290,7 +296,8 @@ class OauthV1Test extends \PHPUnit_Framework_TestCase public function testGetRequestTokenOutdatedConsumerKey() { $this->_setupConsumer(); - $this->_helperMock->expects($this->any())->method('getConsumerExpirationPeriod')->will($this->returnValue(0)); + $this->_dateMock->expects($this->any())->method('timestamp')->will($this->returnValue(9999999999)); + $this->_storeMock->expects($this->once())->method('getConfig')->will($this->returnValue(0)); $this->_service->getRequestToken($this->_getRequestTokenParams()); } @@ -321,10 +328,8 @@ class OauthV1Test extends \PHPUnit_Framework_TestCase protected function _makeValidExpirationPeriod() { - $this->_helperMock - ->expects($this->any()) - ->method('getConsumerExpirationPeriod') - ->will($this->returnValue(2 * 24 * 60 * 60)); // 2 days + $this->_dateMock->expects($this->any())->method('timestamp')->will($this->returnValue(0)); + $this->_storeMock->expects($this->once())->method('getConfig')->will($this->returnValue(300)); } /** diff --git a/dev/tools/Magento/Tools/Di/Compiler/Log/Log.php b/dev/tools/Magento/Tools/Di/Compiler/Log/Log.php index 874ca191897..ad0ea8903c4 100644 --- a/dev/tools/Magento/Tools/Di/Compiler/Log/Log.php +++ b/dev/tools/Magento/Tools/Di/Compiler/Log/Log.php @@ -44,12 +44,23 @@ class Log */ protected $_entries = array(); + /** + * Allowed log types + * + * @var array + */ + protected $_allowedTypes; + /** * @param Writer\WriterInterface $writer + * @param array $allowedTypes */ - public function __construct(Writer\WriterInterface $writer) + public function __construct(Writer\WriterInterface $writer, $allowedTypes = array()) { $this->_writer = $writer; + $this->_allowedTypes = empty($allowedTypes) + ? array(self::GENERATION_ERROR, self::COMPILATION_ERROR, self::GENERATION_SUCCESS) + : $allowedTypes; } /** @@ -61,7 +72,9 @@ class Log */ public function add($type, $key, $message = '') { - $this->_entries[$type][$key][] = $message; + if (in_array($type, $this->_allowedTypes)) { + $this->_entries[$type][$key][] = $message; + } } /** diff --git a/dev/tools/Magento/Tools/Di/compiler.php b/dev/tools/Magento/Tools/Di/compiler.php index 7d5aa886024..a22a198deb1 100644 --- a/dev/tools/Magento/Tools/Di/compiler.php +++ b/dev/tools/Magento/Tools/Di/compiler.php @@ -44,6 +44,7 @@ try { $opt = new Zend_Console_Getopt(array( 'serializer=w' => 'serializer function that should be used (serialize|binary) default = serialize', 'verbose|v' => 'output report after tool run', + 'log|l=s' => 'log level (all|error) default = all', 'extra-classes-file=s' => 'path to file with extra proxies and factories to generate', 'generation=s' => 'absolute path to generated classes, <magento_root>/var/generation by default', 'di=s' => 'absolute path to DI definitions directory, <magento_root>/var/di by default' @@ -65,7 +66,10 @@ try { ); $writer = $opt->getOption('v') ? new Writer\Console() : new Writer\Quiet(); - $log = new Log($writer); + $allowedLogTypes = $opt->getOption('log') == 'error' ? + array(Log::COMPILATION_ERROR, Log::GENERATION_ERROR) + : array(); + $log = new Log($writer, $allowedLogTypes); $serializer = ($opt->getOption('serializer') == 'binary') ? new Serializer\Igbinary() : new Serializer\Standard(); // 1 Code generation diff --git a/dev/tools/xml/logging.xslt b/dev/tools/xml/logging.xslt deleted file mode 100644 index 31d778abeb2..00000000000 --- a/dev/tools/xml/logging.xslt +++ /dev/null @@ -1,135 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - - <xsl:output indent="yes"/> - <xsl:template match="*/text()[normalize-space()]"> - <xsl:value-of select="normalize-space()"/> - </xsl:template> - <xsl:template match="*/text()[not(normalize-space())]" /> - - <xsl:template match="/"> - <logging xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../Magento/Logging/etc/logging.xsd"> - <xsl:apply-templates select="/logging/actions"/> - <groups> - <xsl:apply-templates select="/logging/*[not(name()='actions')]"/> - </groups> - </logging> - </xsl:template> - - <xsl:template match="/logging/actions"> - <actions> - <xsl:apply-templates/> - </actions> - </xsl:template> - - <xsl:template match="/logging/actions/*" priority="1"> - <action> - <xsl:attribute name="id"> - <xsl:value-of select="local-name()"/> - </xsl:attribute> - <xsl:apply-templates select="label"/> - </action> - </xsl:template> - - <xsl:template match="/logging/*[not(name()='actions')]"> - <group> - <xsl:attribute name="name"> - <xsl:value-of select="local-name()"/> - </xsl:attribute> - <xsl:apply-templates select="label|expected_models|actions"/> - </group> - </xsl:template> - - <xsl:template match="label"> - <xsl:copy> - <xsl:attribute name="translate">true</xsl:attribute> - <xsl:apply-templates/> - </xsl:copy> - </xsl:template> - - <xsl:template match="expected_models"> - <expected_models> - <xsl:if test="@extends='merge'"> - <xsl:attribute name="merge_group"> - <xsl:value-of select="'true'" /> - </xsl:attribute> - </xsl:if> - <xsl:apply-templates/> - </expected_models> - </xsl:template> - - <xsl:template match="expected_models/*"> - <expected_model> - <xsl:attribute name="class"> - <xsl:value-of select="local-name()" /> - </xsl:attribute> - <xsl:if test="./skip_data"> - <skip_fields> - <xsl:apply-templates/> - </skip_fields> - </xsl:if> - <xsl:if test="./additional_data"> - <additional_fields> - <xsl:apply-templates/> - </additional_fields> - </xsl:if> - </expected_model> - </xsl:template> - - <xsl:template match="skip_on_back"> - <skip_on_back> - <xsl:apply-templates/> - </skip_on_back> - </xsl:template> - - <xsl:template match="additional_data/*"> - <field> - <xsl:attribute name="name"> - <xsl:value-of select="local-name()" /> - </xsl:attribute> - </field> - </xsl:template> - - <xsl:template match="skip_data/*"> - <field> - <xsl:attribute name="name"> - <xsl:value-of select="local-name()" /> - </xsl:attribute> - </field> - </xsl:template> - - <xsl:template match="skip_on_back/*"> - <controller_action> - <xsl:attribute name="name"> - <xsl:value-of select="local-name()" /> - </xsl:attribute> - </controller_action> - </xsl:template> - - <xsl:template match="actions"> - <events> - <xsl:apply-templates/> - </events> - </xsl:template> - - <xsl:template match="actions/*"> - <event> - <xsl:attribute name="controller_action"> - <xsl:value-of select="local-name()" /> - </xsl:attribute> - <xsl:if test="./action"> - <xsl:attribute name="action_alias"> - <xsl:value-of select="./action/text()" /> - </xsl:attribute> - </xsl:if> - <xsl:if test="./post_dispatch"> - <xsl:attribute name="post_dispatch"> - <xsl:value-of select="./post_dispatch/text()" /> - </xsl:attribute> - </xsl:if> - <xsl:apply-templates select="expected_models"/> - <xsl:apply-templates select="skip_on_back"/> - </event> - </xsl:template> -</xsl:stylesheet> \ No newline at end of file diff --git a/dev/tools/xml/transform_logging.php b/dev/tools/xml/transform_logging.php deleted file mode 100644 index 8a20a89619b..00000000000 --- a/dev/tools/xml/transform_logging.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @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) - */ - -$search = $argv[1]; -$files = shell_exec("find . -name $search"); -$xsl = 'dev/tools/xml/logging.xslt'; -$saxon = 'dev/tools/xml/saxon9he.jar'; - -foreach (preg_split("/((\r?\n)|(\r\n?))/", $files) as $file) { - if (!empty($file)) { - if (!file_exists($saxon)) { - $url = 'http://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/9.5.1-1/Saxon-HE-9.5.1-1.jar'; - system("wget $url --output-document=$saxon"); - } - $cmd = "java -jar $saxon -l:on -s:$file -xsl:$xsl -o:$file"; - echo "$cmd \n"; - system($cmd); - } -} \ No newline at end of file diff --git a/downloader/lib/Magento/Archive.php b/downloader/lib/Magento/Archive.php index a43ad7ede5b..1df0ea3d92f 100644 --- a/downloader/lib/Magento/Archive.php +++ b/downloader/lib/Magento/Archive.php @@ -49,7 +49,7 @@ class Archive /** * Current archiver is used for compress. * - * @var \Magento\Archiver_Tar|\Magento\Archiver_Gz|\Magento\Archiver_Bz + * @var \Magento\Archive\Tar|\Magento\Archive\Gz|\Magento\Archive\Bz */ protected $_archiver=null; @@ -77,7 +77,7 @@ class Archive * Create object of current archiver by $extension. * * @param string $extension - * @return \Magento\Archiver_Tar|\Magento\Archiver_Gz|\Magento\Archiver_Bz + * @return \Magento\Archive\Tar|\Magento\Archive\Gz|\Magento\Archive\Bz */ protected function _getArchiver($extension) { diff --git a/downloader/lib/Magento/Backup/AbstractBackup.php b/downloader/lib/Magento/Backup/AbstractBackup.php index 2e975d5d746..cae25a70114 100644 --- a/downloader/lib/Magento/Backup/AbstractBackup.php +++ b/downloader/lib/Magento/Backup/AbstractBackup.php @@ -161,13 +161,13 @@ abstract class AbstractBackup implements \Magento\Backup\BackupInterface * Set root directory of Magento installation * * @param string $rootDir - * @throws \Magento\MagentoException + * @throws \Magento\Exception * @return \Magento\Backup\BackupInterface */ public function setRootDir($rootDir) { if (!is_dir($rootDir)) { - throw new \Magento\MagentoException('Bad root directory'); + throw new \Magento\Exception('Bad root directory'); } $this->_rootDir = $rootDir; diff --git a/downloader/lib/Magento/Backup/Filesystem/Rollback/Fs.php b/downloader/lib/Magento/Backup/Filesystem/Rollback/Fs.php index c44bcd3defc..fc685be98e9 100755 --- a/downloader/lib/Magento/Backup/Filesystem/Rollback/Fs.php +++ b/downloader/lib/Magento/Backup/Filesystem/Rollback/Fs.php @@ -39,7 +39,7 @@ class Fs extends \Magento\Backup\Filesystem\Rollback\AbstractRollback * Files rollback implementation via local filesystem * * @see \Magento\Backup\Filesystem\Rollback\AbstractRollback::run() - * @throws Magento_MagentoException + * @throws \Magento\Exception */ public function run() { diff --git a/downloader/lib/Magento/Backup/Filesystem/Rollback/Ftp.php b/downloader/lib/Magento/Backup/Filesystem/Rollback/Ftp.php index d5d592fe9c7..6e5cc562f0e 100755 --- a/downloader/lib/Magento/Backup/Filesystem/Rollback/Ftp.php +++ b/downloader/lib/Magento/Backup/Filesystem/Rollback/Ftp.php @@ -46,7 +46,7 @@ class Ftp extends \Magento\Backup\Filesystem\Rollback\AbstractRollback * Files rollback implementation via ftp * * @see \Magento\Backup\Filesystem\Rollback\AbstractRollback::run() - * @throws Magento_MagentoException + * @throws \Magento\Exception */ public function run() { diff --git a/downloader/lib/Magento/Connect/Command.php b/downloader/lib/Magento/Connect/Command.php index 00699e5ac98..cf0a8fbec7e 100644 --- a/downloader/lib/Magento/Connect/Command.php +++ b/downloader/lib/Magento/Connect/Command.php @@ -320,7 +320,7 @@ class Command public static function registerCommands() { $pathCommands = __DIR__.DIRECTORY_SEPARATOR.basename(__FILE__, ".php"); - $f = new DirectoryIterator($pathCommands); + $f = new \DirectoryIterator($pathCommands); foreach($f as $file) { /** @var $file \DirectoryIterator */ if (! $file->isFile()) { diff --git a/lib/Magento/Archive.php b/lib/Magento/Archive.php index c6d8433519c..25e10cd0555 100644 --- a/lib/Magento/Archive.php +++ b/lib/Magento/Archive.php @@ -49,7 +49,7 @@ class Archive /** * Current archiver is used for compress. * - * @var \Magento\Archiver_Tar|\Magento\Archiver_Gz|\Magento\Archiver_Bz + * @var \Magento\Archive\Tar|\Magento\Archive\Gz|\Magento\Archive\Bz */ protected $_archiver=null; @@ -77,7 +77,7 @@ class Archive * Create object of current archiver by $extension. * * @param string $extension - * @return \Magento\Archiver_Tar|\Magento\Archiver_Gz|\Magento\Archiver_Bz + * @return \Magento\Archive\Tar|\Magento\Archive\Gz|\Magento\Archive\Bz */ protected function _getArchiver($extension) { diff --git a/lib/Magento/Cache/Backend/MongoDb.php b/lib/Magento/Cache/Backend/MongoDb.php index 9de0823facd..f5295bf325c 100644 --- a/lib/Magento/Cache/Backend/MongoDb.php +++ b/lib/Magento/Cache/Backend/MongoDb.php @@ -43,7 +43,7 @@ class MongoDb extends \Zend_Cache_Backend implements \Zend_Cache_Backend_Extende /**#@-*/ /** - * @var MongoCollection|null + * @var \MongoCollection|null */ protected $_collection = null; @@ -68,7 +68,7 @@ class MongoDb extends \Zend_Cache_Backend implements \Zend_Cache_Backend_Extende */ public function __construct(array $options = array()) { - if (!extension_loaded('mongo') || !version_compare(Mongo::VERSION, '1.2.11', '>=')) { + if (!extension_loaded('mongo') || !version_compare(\Mongo::VERSION, '1.2.11', '>=')) { \Zend_Cache::throwException( "At least 1.2.11 version of 'mongo' extension is required for using MongoDb cache backend" ); @@ -82,12 +82,12 @@ class MongoDb extends \Zend_Cache_Backend implements \Zend_Cache_Backend_Extende /** * Get collection * - * @return MongoCollection + * @return \MongoCollection */ protected function _getCollection() { if (null === $this->_collection) { - $connection = new Mongo($this->_options['connection_string'], $this->_options['mongo_options']); + $connection = new \Mongo($this->_options['connection_string'], $this->_options['mongo_options']); $database = $connection->selectDB($this->_options['db']); $this->_collection = $database->selectCollection($this->_options['collection']); } diff --git a/lib/Magento/Connect/Command.php b/lib/Magento/Connect/Command.php index 82dfec5c974..e0390b20a7a 100644 --- a/lib/Magento/Connect/Command.php +++ b/lib/Magento/Connect/Command.php @@ -276,7 +276,7 @@ class Command public static function registerCommands() { $pathCommands = __DIR__.DIRECTORY_SEPARATOR.basename(__FILE__, ".php"); - $f = new DirectoryIterator($pathCommands); + $f = new \DirectoryIterator($pathCommands); foreach($f as $file) { if (! $file->isFile()) { continue; diff --git a/lib/Magento/DB/Adapter/Pdo/Mysql.php b/lib/Magento/DB/Adapter/Pdo/Mysql.php index f989b3c0e29..71e93675ac4 100644 --- a/lib/Magento/DB/Adapter/Pdo/Mysql.php +++ b/lib/Magento/DB/Adapter/Pdo/Mysql.php @@ -3356,7 +3356,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad } if (!$columns) { - throw new \Magento\DB\Exception('The columns for UPDATE statement are not defined'); + throw new \Magento\DB\DBException('The columns for UPDATE statement are not defined'); } $query = sprintf("%s\nSET %s", $query, implode(', ', $columns)); diff --git a/lib/Magento/DB/Tree.php b/lib/Magento/DB/Tree.php index 02ce4f3b87a..eb2d34e1cb8 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/TreeException.php'; +require_once 'Tree/TreeException.php'; class Tree { private $_id; @@ -65,7 +65,7 @@ class Tree /** * @param array $config - * @throws \Magento\DB\Tree\Exception + * @throws \Magento\DB\Tree\TreeException */ public function __construct($config = array()) { diff --git a/lib/Magento/Data/Collection/Filesystem.php b/lib/Magento/Data/Collection/Filesystem.php index fa93dff7f8b..f83f747419c 100644 --- a/lib/Magento/Data/Collection/Filesystem.php +++ b/lib/Magento/Data/Collection/Filesystem.php @@ -122,7 +122,7 @@ class Filesystem extends \Magento\Data\Collection * Set empty to not filter * * @param string $regex - * @return \Magento\Data\Collection_Files + * @return \Magento\Data\Collection\Filesystem */ public function setDirsFilter($regex) { @@ -135,7 +135,7 @@ class Filesystem extends \Magento\Data\Collection * Set empty to not filter * * @param string $regex - * @return \Magento\Data\Collection_Files + * @return \Magento\Data\Collection\Filesystem */ public function setFilesFilter($regex) { @@ -148,7 +148,7 @@ class Filesystem extends \Magento\Data\Collection * Set empty value to not use this filter * * @param string $regex - * @return \Magento\Data\Collection_Files + * @return \Magento\Data\Collection\Filesystem */ public function setDisallowedFilesFilter($regex) { diff --git a/lib/Magento/Interception/Config/Config.php b/lib/Magento/Interception/Config/Config.php index 889e6a212c3..3a7de01deac 100644 --- a/lib/Magento/Interception/Config/Config.php +++ b/lib/Magento/Interception/Config/Config.php @@ -156,7 +156,7 @@ class Config implements \Magento\Interception\Config $this->_intercepted[$type] = true; return true; } - } else if ($this->_relations->has($type)) { + } else if (substr($type, -5) != 'Proxy' && $this->_relations->has($type)) { $relations = $this->_relations->getParents($type); foreach ($relations as $relation) { if ($relation && $this->_inheritInterception($relation)) { diff --git a/pub/lib/mage/backend/bootstrap.js b/pub/lib/mage/backend/bootstrap.js index 587195f8fd6..1b311e532c3 100644 --- a/pub/lib/mage/backend/bootstrap.js +++ b/pub/lib/mage/backend/bootstrap.js @@ -24,7 +24,7 @@ */ /*jshint jquery:true browser:true */ /*global FORM_KEY:true*/ -(function ($, console) { +(function ($) { 'use strict'; $.ajaxSetup({ /* @@ -92,4 +92,4 @@ }; $(bootstrap); -})(jQuery, console); +})(jQuery); diff --git a/pub/lib/mage/loader.js b/pub/lib/mage/loader.js index 32991e7a2dd..bec394ad7e6 100644 --- a/pub/lib/mage/loader.js +++ b/pub/lib/mage/loader.js @@ -23,7 +23,8 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ /*jshint browser:true jquery:true */ -(function($, console) { +/*global console:true*/ +(function($) { $.widget("mage.loader", { loaderStarted: 0, spinner: $(undefined), @@ -190,4 +191,4 @@ } }); -})(jQuery, console); +})(jQuery); -- GitLab