From f78121fbbb2a6db6e0ace38f1abdd403ad8656ba Mon Sep 17 00:00:00 2001 From: mage2-team <mage2-team@magento.com> Date: Fri, 16 May 2014 10:18:59 -0700 Subject: [PATCH] 2.0.0.0-dev78 * Fixed bugs: * Fixed an issue where a blank page was displayed when changing store view on a product page * Fixed an issue where it was impossible to change attribute template during product creation * Fixed an issue where the Categories field and the New Category button was displayed during product creation for users with no permissions to access Products and Categories * Fixed an issue where no records were found in the User Roles grid if no users were assigned to a role * Fixed an issue where variable values in the Newsletter templates were not displayed * Fixed an issue where 'No files found' was displayed in the JS Editor on the Design page * Fixed an issue where the State/Province list on frontend was displayed with HTML tags if inline translate was enabled * Fixed an issue where CAPTCHA was not displayed on the Contact Us page * Fixed an issue where scheduled backups were not displayed and neither performed * Fixed functional tests failing PSR-2 test --- CHANGELOG.md | 15 + ...ndex_index.xml => contact_index_index.xml} | 0 .../Product/Helper/Form/Category.php | 48 +- .../Magento/Catalog/Controller/Product.php | 10 +- .../view/adminhtml/catalog/product/edit.phtml | 2 +- .../view/frontend/js/region-updater.js | 4 + .../Cron/Model/Config/Converter/Db.php | 27 +- .../adminhtml/preview/iframeswitcher.phtml | 12 +- .../view/adminhtml/tabs/fieldset/js.phtml | 5 - .../Magento/User/Block/Role/Grid/User.php | 33 +- dev/tests/functional/bootstrap.php | 2 +- dev/tests/functional/isolation.php | 2 +- .../Driver/Selenium/Element/TreeElement.php | 4 +- .../lib/Mtf/ObjectManagerFactory.php | 4 +- .../Util/Generate/Factory/AbstractFactory.php | 3 +- .../lib/Mtf/Util/Protocol/SoapTransport.php | 2 +- .../app/Magento/Backend/Test/Block/Denied.php | 1 - .../Backend/Test/Block/System/Config/Form.php | 3 +- .../Test/Block/System/Config/Form/Group.php | 4 +- .../Backend/Test/Block/Urlrewrite/Actions.php | 1 - .../Urlrewrite/Catalog/Category/Tree.php | 4 +- .../Test/Block/Urlrewrite/Selector.php | 4 +- .../Backend/Test/Block/Widget/FormTabs.php | 8 +- .../Test/Fixture/Urlrewrite/Category.php | 8 +- .../Test/Fixture/Urlrewrite/Product.php | 8 +- .../Backend/Test/Page/System/Config.php | 4 +- .../Test/Page/System/Store/NewStore.php | 4 +- .../Test/Page/Urlrewrite/UrlrewriteEdit.php | 4 +- .../Test/Page/Urlrewrite/UrlrewriteGrid.php | 4 +- .../Test/TestCase/Urlrewrite/CategoryTest.php | 6 +- .../Test/TestCase/Urlrewrite/ProductTest.php | 6 +- .../Test/Fixture/CatalogProductBundle.php | 9 +- .../Bundle/Test/TestCase/EditBundleTest.php | 10 +- .../Adminhtml/Category/Tab/ProductGrid.php | 2 +- .../Catalog/Test/Block/Adminhtml/Product.php | 6 +- .../Adminhtml/Product/Edit/Tab/Related.php | 2 +- .../Product/Edit/Tab/Super/Config.php | 6 +- .../Adminhtml/Product/Edit/Tab/Upsell.php | 2 +- .../Test/Block/Backend/ProductForm.php | 7 +- .../Block/Product/ProductList/Crosssell.php | 6 +- .../Block/Product/ProductList/Related.php | 2 +- .../Test/Block/Product/ProductList/Upsell.php | 2 +- .../Test/Block/Product/View/CustomOptions.php | 1 - .../app/Magento/Catalog/Test/Block/Search.php | 3 +- .../Test/Fixture/CatalogProductSimple.php | 8 +- .../Magento/Catalog/Test/Fixture/Category.php | 2 +- .../Catalog/Test/Fixture/CategoryIds.php | 1 - .../Test/Handler/Curl/CreateCategory.php | 2 +- .../Test/Page/Category/CatalogCategory.php | 3 +- .../Page/Category/CatalogCategoryEdit.php | 6 +- .../Test/Page/Product/CatalogProductView.php | 27 +- .../Configurable/CreateWithAttributeTest.php | 6 +- .../Product/CreateConfigurableTest.php | 20 +- .../Product/CreateSimpleWithCategoryTest.php | 6 +- .../Product/EditSimpleProductTest.php | 10 +- .../Checkout/Test/Page/CheckoutCart.php | 2 +- .../Product/Edit/Tab/Super/Config.php | 6 +- .../Fixture/CatalogProductConfigurable.php | 8 +- .../Test/Handler/Curl/CreateCustomerGroup.php | 2 +- .../Test/Page/Adminhtml/CustomerIndex.php | 4 +- .../Test/Page/Adminhtml/CustomerIndexEdit.php | 4 +- .../Test/Page/Adminhtml/CustomerIndexNew.php | 4 +- .../Test/Page/CustomerAccountCreate.php | 4 +- .../Customer/Test/Repository/Address.php | 17 +- .../Customer/Test/Repository/Customer.php | 17 +- .../Test/Block/Adminhtml/Process/Index.php | 2 +- .../Test/Page/Adminhtml/SubscriberIndex.php | 4 +- .../Constraint/AssertSitemapNotInGrid.php | 2 +- .../AssertSitemapSuccessDeleteMessage.php | 2 +- .../Magento/Sitemap/Test/Fixture/Sitemap.php | 2 +- .../Sitemap/Test/Handler/Sitemap/Curl.php | 2 +- .../Test/Handler/Sitemap/SitemapInterface.php | 4 +- .../Test/Page/Adminhtml/SitemapEdit.php | 4 +- .../Test/Page/Adminhtml/SitemapIndex.php | 4 +- .../Test/Page/Adminhtml/SitemapNew.php | 4 +- .../Test/TestCase/DeleteSitemapEntityTest.php | 2 +- .../app/Magento/Store/Test/Fixture/Store.php | 1 + .../Magento/Store/Test/Fixture/StoreGroup.php | 1 + .../Store/Test/Handler/Curl/CreateStore.php | 1 - .../Test/Handler/Curl/CreateStoreGroup.php | 1 - .../Store/Test/Repository/CustomStore.php | 1 - .../Magento/Store/Test/TestCase/StoreTest.php | 3 +- .../Block/Adminhtml/Rule/Edit/TaxClass.php | 12 +- .../Block/Adminhtml/Rule/Edit/TaxRate.php | 6 +- .../Tax/Test/Block/Adminhtml/Rule/Grid.php | 2 +- .../Magento/Tax/Test/Repository/TaxRate.php | 23 +- .../Magento/Tax/Test/Repository/TaxRule.php | 17 +- .../User/Test/Block/Backend/UserGrid.php | 1 - .../User/Test/Block/User/Edit/Form.php | 1 - .../User/Test/Block/User/Edit/Tab/Roles.php | 1 - .../app/Magento/User/Test/Fixture/Role.php | 1 - .../User/Test/Handler/Curl/CreateUser.php | 8 +- .../User/Test/Page/Backend/UserEdit.php | 9 +- .../User/Test/Page/Backend/UserIndex.php | 1 - .../Magento/Test/Integrity/ClassesTest.php | 1 - .../Magento/Test/Php/LiveCodeTest.php | 1 - .../Controller/Adminhtml/DashboardTest.php | 6 +- .../Bundle/Model/Product/PriceTest.php | 6 +- .../Product/Helper/Form/CategoryTest.php | 66 ++ .../Search/AvailabilityFlag/PluginTest.php | 21 +- .../Checkout/Block/Cart/Item/RendererTest.php | 4 +- .../Checkout/Block/Cart/SidebarTest.php | 4 +- .../Cron/Model/Config/Converter/DbTest.php | 117 +-- .../Cron/Model/Config/Reader/DbTest.php | 10 +- .../Customer/Block/Account/CustomerTest.php | 9 +- .../Model/App/Action/ContextPluginTest.php | 30 +- .../testsuite/Magento/Eav/Helper/DataTest.php | 4 +- .../Magento/Framework/Acl/CacheTest.php | 130 ++++ .../Framework/Acl/Loader/ResourceTest.php | 95 ++- .../Framework/Acl/Role/RegistryTest.php | 101 +++ .../Magento/Framework/App/DefaultClass.php | 30 + .../Framework/App/FrontControllerTest.php | 125 ++- .../Framework/App/RequestFactoryTest.php | 61 ++ .../Magento/Framework/App/RouterListTest.php | 75 +- .../Magento/Framework/App/StateTest.php | 67 +- .../Framework/Cache/Backend/DatabaseTest.php | 719 ++++++++++++++++++ .../Cache/Config/SchemaLocatorTest.php | 49 ++ .../Magento/Framework/Cache/CoreTest.php | 112 +++ .../Magento/Framework/Code/GeneratorTest.php | 96 ++- .../Magento/Framework/Code/ValidatorTest.php | 53 ++ .../Config/_files/converter/dom/cdata.php | 2 +- .../Framework/Model/AbstractModelTest.php | 6 +- .../Framework/Module/Dir/ReaderTest.php | 35 +- .../Framework/Module/ModuleListTest.php | 1 - .../Magento/Framework/Module/UpdaterTest.php | 1 - .../Object/Copy/Config/SchemaLocatorTest.php | 5 +- .../Magento/Framework/Object/CopyTest.php | 43 +- .../Code/Generator/FactoryTest.php | 7 +- .../Code/Generator/ProxyTest.php | 7 +- .../Code/Generator/_files/Sample.php | 2 +- .../Definition/Compiled/BinaryTest.php | 2 +- .../Definition/Compiled/SerializedTest.php | 2 +- .../ObjectManager/Relations/CompiledTest.php | 2 +- .../Service/DataObjectConverterTest.php | 3 +- .../Framework/Translate/Inline/ProxyTest.php | 8 +- .../Framework/Translate/InlineTest.php | 30 +- .../Block/NavigationTest.php | 10 +- .../Model/Queue/TransportBuilderTest.php | 12 +- .../PageCache/Block/Controller/StubBlock.php | 2 +- .../Review/Summary/CollectionTest.php | 30 +- .../Order/Pdf/Config/_files/pdf_merged.php | 1 - lib/Magento/Framework/App/RequestFactory.php | 6 +- lib/Magento/Framework/App/RouterList.php | 36 +- lib/Magento/Framework/AppInterface.php | 2 +- 144 files changed, 2279 insertions(+), 549 deletions(-) rename app/code/Magento/Captcha/view/frontend/layout/{contacts_index_index.xml => contact_index_index.xml} (100%) create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/CategoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Acl/CacheTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Acl/Role/RegistryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/DefaultClass.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/RequestFactoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Cache/Backend/DatabaseTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Cache/Config/SchemaLocatorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Code/ValidatorTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f5bb821d84..55f2cc4ad57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,22 @@ +2.0.0.0-dev78 +============= +* Fixed bugs: + * Fixed an issue where a blank page was displayed when changing store view on a product page + * Fixed an issue where it was impossible to change attribute template during product creation + * Fixed an issue where the Categories field and the New Category button was displayed during product creation for users with no permissions to access Products and Categories + * Fixed an issue where no records were found in the User Roles grid if no users were assigned to a role + * Fixed an issue where variable values in the Newsletter templates were not displayed + * Fixed an issue where 'No files found' was displayed in the JS Editor on the Design page + * Fixed an issue where the State/Province list on frontend was displayed with HTML tags if inline translate was enabled + * Fixed an issue where CAPTCHA was not displayed on the Contact Us page + * Fixed an issue where scheduled backups were not displayed and neither performed + * Fixed functional tests failing PSR-2 test + 2.0.0.0-dev77 ============= * Themes update: * Blank theme was refactored to implement the mobile-first approach +* Added Readme.md file * Fixed bugs: * Fixed an issue where it was impossible to place order using store credit * Fixed an issue where adding products with custom options from a wishlist to shopping cart caused an error diff --git a/app/code/Magento/Captcha/view/frontend/layout/contacts_index_index.xml b/app/code/Magento/Captcha/view/frontend/layout/contact_index_index.xml similarity index 100% rename from app/code/Magento/Captcha/view/frontend/layout/contacts_index_index.xml rename to app/code/Magento/Captcha/view/frontend/layout/contact_index_index.xml diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php index a9659357957..d48b04266d2 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php @@ -24,6 +24,7 @@ namespace Magento\Catalog\Block\Adminhtml\Product\Helper\Form; use Magento\Catalog\Model\Resource\Category\Collection; +use Magento\Framework\AuthorizationInterface; /** * Product form category field helper @@ -52,6 +53,11 @@ class Category extends \Magento\Framework\Data\Form\Element\Multiselect */ protected $_jsonEncoder; + /** + * @var AuthorizationInterface + */ + protected $authorization; + /** * @param \Magento\Framework\Data\Form\Element\Factory $factoryElement * @param \Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection @@ -60,6 +66,7 @@ class Category extends \Magento\Framework\Data\Form\Element\Multiselect * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Framework\View\LayoutInterface $layout * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder + * @param AuthorizationInterface $authorization * @param array $data */ public function __construct( @@ -70,15 +77,30 @@ class Category extends \Magento\Framework\Data\Form\Element\Multiselect \Magento\Backend\Helper\Data $backendData, \Magento\Framework\View\LayoutInterface $layout, \Magento\Framework\Json\EncoderInterface $jsonEncoder, - array $data = array() + AuthorizationInterface $authorization, + array $data = [] ) { $this->_jsonEncoder = $jsonEncoder; $this->_collectionFactory = $collectionFactory; $this->_backendData = $backendData; + $this->authorization = $authorization; parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->_layout = $layout; } + /** + * Get no display + * + * @return bool + * @SuppressWarnings(PHPMD.BooleanGetMethodName) + */ + public function getNoDisplay() + { + + $isNotAllowed = !$this->authorization->isAllowed('Magento_Catalog::categories'); + return $this->getData('no_display') || $isNotAllowed; + } + /** * Get values for select * @@ -94,10 +116,10 @@ class Category extends \Magento\Framework\Data\Form\Element\Multiselect $collection->addAttributeToSelect('name'); $collection->addIdFilter($values); - $options = array(); + $options = []; foreach ($collection as $category) { - $options[] = array('label' => $category->getName(), 'value' => $category->getId()); + $options[] = ['label' => $category->getName(), 'value' => $category->getId()]; } return $options; } @@ -127,14 +149,14 @@ class Category extends \Magento\Framework\Data\Form\Element\Multiselect $button = $this->_layout->createBlock( 'Magento\Backend\Block\Widget\Button' )->setData( - array( - 'id' => 'add_category_button', - 'label' => $newCategoryCaption, - 'title' => $newCategoryCaption, - 'onclick' => 'jQuery("#new-category").dialog("open")', - 'disabled' => $this->getDisabled() - ) - ); + [ + 'id' => 'add_category_button', + 'label' => $newCategoryCaption, + 'title' => $newCategoryCaption, + 'onclick' => 'jQuery("#new-category").dialog("open")', + 'disabled' => $this->getDisabled() + ] + ); $return = <<<HTML <input id="{$htmlId}-suggest" placeholder="$suggestPlaceholder" /> <script> @@ -151,12 +173,12 @@ HTML; */ protected function _getSelectorOptions() { - return array( + return [ 'source' => $this->_backendData->getUrl('catalog/category/suggestCategories'), 'valueField' => '#' . $this->getHtmlId(), 'className' => 'category-select', 'multiselect' => true, 'showAll' => true - ); + ]; } } diff --git a/app/code/Magento/Catalog/Controller/Product.php b/app/code/Magento/Catalog/Controller/Product.php index 795f6ab3727..09675cb950d 100644 --- a/app/code/Magento/Catalog/Controller/Product.php +++ b/app/code/Magento/Catalog/Controller/Product.php @@ -76,15 +76,15 @@ class Product extends \Magento\Framework\App\Action\Action implements \Magento\C $specifyOptions = $this->getRequest()->getParam('options'); if ($this->getRequest()->isPost() && $this->getRequest()->getParam(self::PARAM_NAME_URL_ENCODED)) { + $product = $this->_initProduct(); + if (!$product) { + $this->noProductRedirect(); + } if ($specifyOptions) { - $product = $this->_initProduct(); - if (!$product) { - $this->noProductRedirect(); - } $notice = $product->getTypeInstance()->getSpecifyOptionMessage(); $this->messageManager->addNotice($notice); - $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); } + $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); return; } diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit.phtml index 2a220bfac7b..f118c406b43 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit.phtml @@ -284,7 +284,7 @@ jQuery(function($) { }); var nameDataMapper = function() { - return $(this).data('elementId'); + return $(this).data('attributeCode'); }; //add new element elements or reorder $page.find('[data-form=edit-product] [data-role=tabs] .fieldset, #product_info_tabs .fieldset') diff --git a/app/code/Magento/Checkout/view/frontend/js/region-updater.js b/app/code/Magento/Checkout/view/frontend/js/region-updater.js index 1a13fddae53..10aa54c8dc1 100644 --- a/app/code/Magento/Checkout/view/frontend/js/region-updater.js +++ b/app/code/Magento/Checkout/view/frontend/js/region-updater.js @@ -72,6 +72,10 @@ */ _renderSelectOption: function(selectElement, key, value) { selectElement.append($.proxy(function() { + if (value.code && $(value.name).is('span')) { + key = value.code; + value.name = $(value.name).text(); + } $.template('regionTemplate', this.options.regionTemplate); if (this.options.defaultRegion === key) { return $.tmpl('regionTemplate', {value: key, title: value.name, isSelected: true}); diff --git a/app/code/Magento/Cron/Model/Config/Converter/Db.php b/app/code/Magento/Cron/Model/Config/Converter/Db.php index 54a958ac97c..7dbeb733235 100644 --- a/app/code/Magento/Cron/Model/Config/Converter/Db.php +++ b/app/code/Magento/Cron/Model/Config/Converter/Db.php @@ -36,12 +36,12 @@ class Db implements \Magento\Framework\Config\ConverterInterface */ public function convert($source) { - $jobs = isset($source['crontab']['default']['jobs']) ? $source['crontab']['default']['jobs'] : array(); + $cronTab = isset($source['crontab']) ? $source['crontab'] : array(); - if (empty($jobs)) { - return $jobs; + if (empty($cronTab)) { + return $cronTab; } - return $this->_extractParams($jobs); + return $this->_extractParams($cronTab); } /** @@ -50,18 +50,21 @@ class Db implements \Magento\Framework\Config\ConverterInterface * @param array $jobs * @return array */ - protected function _extractParams(array $jobs) + protected function _extractParams(array $cronTab) { $result = array(); - foreach ($jobs as $jobName => $value) { - $result[$jobName] = $value; + foreach ($cronTab as $groupName => $groupConfig) { + $jobs = $groupConfig['jobs']; + foreach ($jobs as $jobName => $value) { + $result[$groupName][$jobName] = $value; - if (isset($value['schedule']) && is_array($value['schedule'])) { - $this->_processConfigParam($value, $jobName, $result); - $this->_processScheduleParam($value, $jobName, $result); - } + if (isset($value['schedule']) && is_array($value['schedule'])) { + $this->_processConfigParam($value, $jobName, $result[$groupName]); + $this->_processScheduleParam($value, $jobName, $result[$groupName]); + } - $this->_processRunModel($value, $jobName, $result); + $this->_processRunModel($value, $jobName, $result[$groupName]); + } } return $result; } diff --git a/app/code/Magento/Newsletter/view/adminhtml/preview/iframeswitcher.phtml b/app/code/Magento/Newsletter/view/adminhtml/preview/iframeswitcher.phtml index 9be97500505..3509f4511ad 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/preview/iframeswitcher.phtml +++ b/app/code/Magento/Newsletter/view/adminhtml/preview/iframeswitcher.phtml @@ -39,7 +39,7 @@ </div> <?php endif;?> </div> - <iframe name="preview_iframe" id="preview_iframe" frameborder="0" title="<?php echo __('Preview') ?>" width="100%" onload="iframeSetHeight()"></iframe> + <iframe name="preview_iframe" id="preview_iframe" frameborder="0" title="<?php echo __('Preview') ?>" width="100%"></iframe> <?php echo $this->getChildHtml('preview_form'); ?> </div> @@ -67,13 +67,9 @@ function unBlockPreview() { Event.observe(window, 'load', preview); Event.observe(previewIframe, 'load', unBlockPreview); -function iframeSetHeight() { - var iFrameID = document.getElementById('preview_iframe'); - if(iFrameID) { - iFrameID.height = ""; - iFrameID.height = iFrameID.contentWindow.document.body.scrollHeight + "px"; - } -} +jQuery("#preview_iframe").load(function() { + jQuery(this).height(jQuery(this).contents().find("html").height() ); +}); //]]> </script> diff --git a/app/code/Magento/Theme/view/adminhtml/tabs/fieldset/js.phtml b/app/code/Magento/Theme/view/adminhtml/tabs/fieldset/js.phtml index c70ecadfd39..4ec07c68bbd 100644 --- a/app/code/Magento/Theme/view/adminhtml/tabs/fieldset/js.phtml +++ b/app/code/Magento/Theme/view/adminhtml/tabs/fieldset/js.phtml @@ -53,10 +53,6 @@ <input type="hidden" name="js_uploaded_files[]" value="${temporary}" /> </div> -<div class="no-display" id="no-js-files-found-template"> - <span class="filename"><?php echo __('We found no files.') ?></span> -</div> - <ul id="js-files-container" class="js-files-container ui-sortable" ></ul> @@ -67,7 +63,6 @@ jQuery(function($) { $('#js-files-container').themeJsList({ templateId : '#js-uploaded-file-template', - emptyTemplateId : '#no-js-files-found-template', refreshFileListEvent : 'refreshJsList', prefixItemId : 'js-file-' }); diff --git a/app/code/Magento/User/Block/Role/Grid/User.php b/app/code/Magento/User/Block/Role/Grid/User.php index d93699bf6ae..d53d4aea438 100644 --- a/app/code/Magento/User/Block/Role/Grid/User.php +++ b/app/code/Magento/User/Block/Role/Grid/User.php @@ -63,7 +63,7 @@ class User extends \Magento\Backend\Block\Widget\Grid\Extended \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Framework\Registry $coreRegistry, \Magento\User\Model\RoleFactory $roleFactory, - array $data = array() + array $data = [] ) { parent::__construct($context, $backendHelper, $data); $this->_jsonEncoder = $jsonEncoder; @@ -82,7 +82,6 @@ class User extends \Magento\Backend\Block\Widget\Grid\Extended $this->setDefaultSort('role_user_id'); $this->setDefaultDir('asc'); $this->setId('roleUserGrid'); - $this->setDefaultFilter(array('in_role_users' => 1)); $this->setUseAjax(true); } @@ -98,10 +97,10 @@ class User extends \Magento\Backend\Block\Widget\Grid\Extended $inRoleIds = 0; } if ($column->getFilter()->getValue()) { - $this->getCollection()->addFieldToFilter('user_id', array('in' => $inRoleIds)); + $this->getCollection()->addFieldToFilter('user_id', ['in' => $inRoleIds]); } else { if ($inRoleIds) { - $this->getCollection()->addFieldToFilter('user_id', array('nin' => $inRoleIds)); + $this->getCollection()->addFieldToFilter('user_id', ['nin' => $inRoleIds]); } } } else { @@ -129,50 +128,50 @@ class User extends \Magento\Backend\Block\Widget\Grid\Extended { $this->addColumn( 'in_role_users', - array( + [ 'header_css_class' => 'a-center', 'type' => 'checkbox', 'name' => 'in_role_users', 'values' => $this->getUsers(), 'align' => 'center', 'index' => 'user_id' - ) + ] ); $this->addColumn( 'role_user_id', - array('header' => __('User ID'), 'width' => 5, 'align' => 'left', 'sortable' => true, 'index' => 'user_id') + ['header' => __('User ID'), 'width' => 5, 'align' => 'left', 'sortable' => true, 'index' => 'user_id'] ); $this->addColumn( 'role_user_username', - array('header' => __('User Name'), 'align' => 'left', 'index' => 'username') + ['header' => __('User Name'), 'align' => 'left', 'index' => 'username'] ); $this->addColumn( 'role_user_firstname', - array('header' => __('First Name'), 'align' => 'left', 'index' => 'firstname') + ['header' => __('First Name'), 'align' => 'left', 'index' => 'firstname'] ); $this->addColumn( 'role_user_lastname', - array('header' => __('Last Name'), 'align' => 'left', 'index' => 'lastname') + ['header' => __('Last Name'), 'align' => 'left', 'index' => 'lastname'] ); $this->addColumn( 'role_user_email', - array('header' => __('Email'), 'width' => 40, 'align' => 'left', 'index' => 'email') + ['header' => __('Email'), 'width' => 40, 'align' => 'left', 'index' => 'email'] ); $this->addColumn( 'role_user_is_active', - array( + [ 'header' => __('Status'), 'index' => 'is_active', 'align' => 'left', 'type' => 'options', - 'options' => array('1' => __('Active'), '0' => __('Inactive')) - ) + 'options' => ['1' => __('Active'), '0' => __('Inactive')] + ] ); /* @@ -202,7 +201,7 @@ class User extends \Magento\Backend\Block\Widget\Grid\Extended public function getGridUrl() { $roleId = $this->getRequest()->getParam('rid'); - return $this->getUrl('*/*/editrolegrid', array('rid' => $roleId)); + return $this->getUrl('*/*/editrolegrid', ['rid' => $roleId]); } /** @@ -224,7 +223,7 @@ class User extends \Magento\Backend\Block\Widget\Grid\Extended $users = $this->_roleFactory->create()->setId($roleId)->getRoleUsers(); if (sizeof($users) > 0) { if ($json) { - $jsonUsers = array(); + $jsonUsers = []; foreach ($users as $usrid) { $jsonUsers[$usrid] = 0; } @@ -236,7 +235,7 @@ class User extends \Magento\Backend\Block\Widget\Grid\Extended if ($json) { return '{}'; } else { - return array(); + return []; } } } diff --git a/dev/tests/functional/bootstrap.php b/dev/tests/functional/bootstrap.php index efc0f6ee6ad..9b6926f79a1 100644 --- a/dev/tests/functional/bootstrap.php +++ b/dev/tests/functional/bootstrap.php @@ -25,4 +25,4 @@ session_start(); require_once __DIR__ . '/../../../app/bootstrap.php'; restore_error_handler(); -require_once __DIR__ . '/vendor/autoload.php'; \ No newline at end of file +require_once __DIR__ . '/vendor/autoload.php'; diff --git a/dev/tests/functional/isolation.php b/dev/tests/functional/isolation.php index 9337fa446ed..7e3b7edfa51 100644 --- a/dev/tests/functional/isolation.php +++ b/dev/tests/functional/isolation.php @@ -25,4 +25,4 @@ //Isolation script sample //exec('mysql -uroot -p123123q -e"DROP DATABASE mtf; CREATE DATABASE mtf CHARACTER SET utf8;"'); //exec('mysql -uroot -p123123q mtf < /var/www/mtf/mtf.dump.sql'); -//exec('rm -rf /var/www/mtf/var/*'); \ No newline at end of file +//exec('rm -rf /var/www/mtf/var/*'); diff --git a/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/TreeElement.php b/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/TreeElement.php index 69c268ff146..7ece75ae292 100644 --- a/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/TreeElement.php +++ b/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/TreeElement.php @@ -157,13 +157,13 @@ class TreeElement extends Element $nodeList = array(); $counter = 1; - $newNode = $node->find($parentCssClass .' > .x-tree-node:nth-of-type(' . $counter . ')' ); + $newNode = $node->find($parentCssClass .' > .x-tree-node:nth-of-type(' . $counter . ')'); //Get list of all children nodes to work with while ($newNode->isVisible()) { $nodeList[] = $newNode; ++$counter; - $newNode = $node->find($parentCssClass .' > .x-tree-node:nth-of-type(' . $counter . ')' ); + $newNode = $node->find($parentCssClass .' > .x-tree-node:nth-of-type(' . $counter . ')'); } //Write to array values of current node diff --git a/dev/tests/functional/lib/Mtf/ObjectManagerFactory.php b/dev/tests/functional/lib/Mtf/ObjectManagerFactory.php index 832e5266982..b28f9bda7e3 100644 --- a/dev/tests/functional/lib/Mtf/ObjectManagerFactory.php +++ b/dev/tests/functional/lib/Mtf/ObjectManagerFactory.php @@ -111,8 +111,8 @@ class ObjectManagerFactory new \Magento\Framework\App\Arguments\Loader( $directoryList, isset($arguments[\Magento\Framework\App\Arguments\Loader::PARAM_CUSTOM_FILE]) - ? $arguments[\Magento\Framework\App\Arguments\Loader::PARAM_CUSTOM_FILE] - : null + ? $arguments[\Magento\Framework\App\Arguments\Loader::PARAM_CUSTOM_FILE] + : null ) ); } diff --git a/dev/tests/functional/lib/Mtf/Util/Generate/Factory/AbstractFactory.php b/dev/tests/functional/lib/Mtf/Util/Generate/Factory/AbstractFactory.php index 12a7f34a3f4..cbb0daf7bc2 100644 --- a/dev/tests/functional/lib/Mtf/Util/Generate/Factory/AbstractFactory.php +++ b/dev/tests/functional/lib/Mtf/Util/Generate/Factory/AbstractFactory.php @@ -181,7 +181,8 @@ abstract class AbstractFactory $dirIterator = new \RegexIterator( new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($filePath, \FilesystemIterator::SKIP_DOTS) - ), '/.php$/i' + ), + '/.php$/i' ); foreach ($dirIterator as $info) { /** @var $info \SplFileInfo */ diff --git a/dev/tests/functional/lib/Mtf/Util/Protocol/SoapTransport.php b/dev/tests/functional/lib/Mtf/Util/Protocol/SoapTransport.php index 0f575ac9d44..446788a61c4 100644 --- a/dev/tests/functional/lib/Mtf/Util/Protocol/SoapTransport.php +++ b/dev/tests/functional/lib/Mtf/Util/Protocol/SoapTransport.php @@ -72,4 +72,4 @@ class SoapTransport $params[$this->_configuration['auth_token_name']] = $this->_getSessionId(); return call_user_func_array(array($this->_soap, $method), $params); } -} \ No newline at end of file +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Denied.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Denied.php index e67db3b9e4c..92a17e85691 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Denied.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Denied.php @@ -51,4 +51,3 @@ class Denied extends Block return $this->_rootElement->find($this->accessDeniedText, Locator::SELECTOR_CSS)->getText(); } } - diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/Form.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/Form.php index 08057fe62de..58da5762292 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/Form.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/Form.php @@ -55,7 +55,8 @@ class Form extends Block { $blockFactory = Factory::getBlockFactory(); $element = $this->_rootElement->find( - sprintf($this->groupBlock, $name), Locator::SELECTOR_XPATH + sprintf($this->groupBlock, $name), + Locator::SELECTOR_XPATH ); return $blockFactory->getMagentoBackendSystemConfigFormGroup($element); } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/Form/Group.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/Form/Group.php index 8bac8e1e84a..8c9df1dedd1 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/Form/Group.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/Form/Group.php @@ -84,7 +84,9 @@ class Group extends Form } $element = $this->_rootElement->find( - sprintf($this->element, $field), Element\Locator::SELECTOR_XPATH, $input + sprintf($this->element, $field), + Element\Locator::SELECTOR_XPATH, + $input ); if ($element->isDisabled()) { diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Urlrewrite/Actions.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Urlrewrite/Actions.php index e6d636e0c93..60c2ae28bc2 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Urlrewrite/Actions.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Urlrewrite/Actions.php @@ -44,4 +44,3 @@ class Actions extends Block $this->_rootElement->find($this->addNewButton)->click(); } } - diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Urlrewrite/Catalog/Category/Tree.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Urlrewrite/Catalog/Category/Tree.php index 11cfb4dbb9a..3b5bc91c780 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Urlrewrite/Catalog/Category/Tree.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Urlrewrite/Catalog/Category/Tree.php @@ -24,8 +24,8 @@ namespace Magento\Backend\Test\Block\Urlrewrite\Catalog\Category; -use Mtf\Block\Block, - Mtf\Client\Element\Locator; +use Mtf\Block\Block; +use Mtf\Client\Element\Locator; /** * Class Tree diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Urlrewrite/Selector.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Urlrewrite/Selector.php index 79b9aafab73..7ec29d9e881 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Urlrewrite/Selector.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Urlrewrite/Selector.php @@ -25,8 +25,8 @@ namespace Magento\Backend\Test\Block\Urlrewrite; -use Mtf\Block\Block, - Mtf\Client\Element\Locator; +use Mtf\Block\Block; +use Mtf\Client\Element\Locator; /** * Class Selector diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php index f0c94ef9174..354c616c393 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php @@ -138,7 +138,8 @@ class FormTabs extends Form protected function updateUnassignedFields(Tab $tabElement) { $this->unassignedFields = array_diff_key( - $this->unassignedFields, array_intersect_key($this->unassignedFields, $tabElement->setFields) + $this->unassignedFields, + array_intersect_key($this->unassignedFields, $tabElement->setFields) ); } @@ -162,8 +163,9 @@ class FormTabs extends Form } if (!empty($this->unassignedFields)) { - throw new \Exception('Could not find all elements on the tabs: ' - . implode(', ', array_keys($this->unassignedFields))); + throw new \Exception( + 'Could not find all elements on the tabs: ' . implode(', ', array_keys($this->unassignedFields)) + ); } } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/Urlrewrite/Category.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/Urlrewrite/Category.php index 403e1e8f7eb..07937048eb7 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/Urlrewrite/Category.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/Urlrewrite/Category.php @@ -24,10 +24,10 @@ namespace Magento\Backend\Test\Fixture\Urlrewrite; -use Mtf\System\Config, - Mtf\Factory\Factory, - Mtf\Fixture\DataFixture, - Magento\Catalog\Test\Fixture\Category as CategoryFixture; +use Mtf\System\Config; +use Mtf\Factory\Factory; +use Mtf\Fixture\DataFixture; +use Magento\Catalog\Test\Fixture\Category as CategoryFixture; /** * Class Category diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/Urlrewrite/Product.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/Urlrewrite/Product.php index 90c9c2579f8..21da97a9e12 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/Urlrewrite/Product.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/Urlrewrite/Product.php @@ -24,10 +24,10 @@ namespace Magento\Backend\Test\Fixture\Urlrewrite; -use Mtf\System\Config, - Mtf\Factory\Factory, - Mtf\Fixture\DataFixture, - Magento\Catalog\Test\Fixture\Product as ProductFixture; +use Mtf\System\Config; +use Mtf\Factory\Factory; +use Mtf\Fixture\DataFixture; +use Magento\Catalog\Test\Fixture\Product as ProductFixture; /** * Class Product diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/System/Config.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/System/Config.php index 8a7d5501b23..e61502fe4aa 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/System/Config.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/System/Config.php @@ -29,8 +29,8 @@ namespace Magento\Backend\Test\Page\System; use Magento\Backend\Test\Block\System\Config\Switcher; use Magento\Core\Test\Block\Messages; use Mtf\Client\Element\Locator; -use Mtf\Factory\Factory, - Mtf\Page\Page; +use Mtf\Factory\Factory; +use Mtf\Page\Page; class Config extends Page { diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/System/Store/NewStore.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/System/Store/NewStore.php index 562fae94b63..35a9b14d68e 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/System/Store/NewStore.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/System/Store/NewStore.php @@ -24,8 +24,8 @@ */ namespace Magento\Backend\Test\Page\System\Store; -use Mtf\Factory\Factory, - Mtf\Page\Page; +use Mtf\Factory\Factory; +use Mtf\Page\Page; class NewStore extends Page { diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Urlrewrite/UrlrewriteEdit.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Urlrewrite/UrlrewriteEdit.php index 81756785ec7..4a42b8a8886 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Urlrewrite/UrlrewriteEdit.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Urlrewrite/UrlrewriteEdit.php @@ -24,8 +24,8 @@ namespace Magento\Backend\Test\Page\Urlrewrite; -use Mtf\Page\Page, - Mtf\Factory\Factory; +use Mtf\Page\Page; +use Mtf\Factory\Factory; /** * Class UrlrewriteEdit diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Urlrewrite/UrlrewriteGrid.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Urlrewrite/UrlrewriteGrid.php index 145988bc223..04d7156630f 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Urlrewrite/UrlrewriteGrid.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Urlrewrite/UrlrewriteGrid.php @@ -24,8 +24,8 @@ namespace Magento\Backend\Test\Page\Urlrewrite; -use Mtf\Page\Page, - Mtf\Factory\Factory; +use Mtf\Page\Page; +use Mtf\Factory\Factory; /** * Class UrlrewriteGrid diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/Urlrewrite/CategoryTest.php b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/Urlrewrite/CategoryTest.php index c0b5dcbf932..8f1e9df3db1 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/Urlrewrite/CategoryTest.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/Urlrewrite/CategoryTest.php @@ -24,9 +24,9 @@ namespace Magento\Backend\Test\TestCase\Urlrewrite; -use Mtf\Factory\Factory, - Mtf\TestCase\Functional, - Magento\Backend\Test\Fixture\Urlrewrite\Category; +use Mtf\Factory\Factory; +use Mtf\TestCase\Functional; +use Magento\Backend\Test\Fixture\Urlrewrite\Category; use Mtf\TestCase\Injectable; /** diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/Urlrewrite/ProductTest.php b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/Urlrewrite/ProductTest.php index b70870837d9..99fec8fd232 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/Urlrewrite/ProductTest.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/Urlrewrite/ProductTest.php @@ -24,9 +24,9 @@ namespace Magento\Backend\Test\TestCase\Urlrewrite; -use Mtf\Factory\Factory, - Mtf\TestCase\Functional, - Magento\Backend\Test\Fixture\Urlrewrite\Product; +use Mtf\Factory\Factory; +use Mtf\TestCase\Functional; +use Magento\Backend\Test\Fixture\Urlrewrite\Product; /** * Class UrlrewriteTest diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle.php index fa881dcf911..685b2e02421 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle.php @@ -71,7 +71,13 @@ class CatalogProductBundle extends InjectableFixture $data['url_key'] = trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $data['name'])), '-'); } parent::__construct( - $configuration, $repositoryFactory, $fixtureFactory, $handlerFactory, $data, $dataSet, $persist + $configuration, + $repositoryFactory, + $fixtureFactory, + $handlerFactory, + $data, + $dataSet, + $persist ); } @@ -840,5 +846,4 @@ class CatalogProductBundle extends InjectableFixture { return $this->getData('custom_options'); } - } diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/EditBundleTest.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/EditBundleTest.php index ca7d3bd6b3d..46d65ac45d8 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/EditBundleTest.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/EditBundleTest.php @@ -60,10 +60,12 @@ class EditBundleTest extends Functional $cachePage = Factory::getPageFactory()->getAdminCache(); $productGridPage->open(); - $gridBlock->searchAndOpen(array( - 'sku' => $product->getProductSku(), - 'type' => 'Bundle Product' - )); + $gridBlock->searchAndOpen( + array( + 'sku' => $product->getProductSku(), + 'type' => 'Bundle Product' + ) + ); $productBlockForm->fill($editProduct); $productBlockForm->save($editProduct); //Verifying diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tab/ProductGrid.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tab/ProductGrid.php index 40defaaa9af..f93006df9c5 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tab/ProductGrid.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tab/ProductGrid.php @@ -50,4 +50,4 @@ class ProductGrid extends Grid * @var string */ protected $selectItem = 'tbody tr .col-in_category'; -} \ No newline at end of file +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product.php index 5007367b13f..404906dc4c7 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product.php @@ -56,7 +56,9 @@ class Product extends Block public function addProduct($productType = 'simple') { $this->_rootElement->find($this->toggleButton, Locator::SELECTOR_CSS)->click(); - $this->_rootElement->find(str_replace('%productType%', $productType, $this->productItem), - Locator::SELECTOR_CSS)->click(); + $this->_rootElement->find( + str_replace('%productType%', $productType, $this->productItem), + Locator::SELECTOR_CSS + )->click(); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Related.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Related.php index 52b47f41794..20495e32a27 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Related.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Related.php @@ -59,4 +59,4 @@ class Related extends Tab return $this; } -} \ No newline at end of file +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config.php index c0bcf184779..1adca6b9782 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config.php @@ -190,8 +190,10 @@ class Config extends Tab $this->_rootElement->find('#configurable-attribute-selector')->setValue($attributeName); $attributeListLocation = '#variations-search-field .mage-suggest-dropdown'; $this->waitForElementVisible($attributeListLocation, Locator::SELECTOR_CSS); - $attribute = $this->_rootElement->find("//div[@class='mage-suggest-dropdown']//a[text()='$attributeName']", - Locator::SELECTOR_XPATH); + $attribute = $this->_rootElement->find( + "//div[@class='mage-suggest-dropdown']//a[text()='$attributeName']", + Locator::SELECTOR_XPATH + ); if ($attribute->isVisible()) { $attribute->click(); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Upsell.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Upsell.php index 7008f0ce536..e55cd06a961 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Upsell.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Upsell.php @@ -59,4 +59,4 @@ class Upsell extends Tab return $this; } -} \ No newline at end of file +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Backend/ProductForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Backend/ProductForm.php index 91312abd20e..357df855f75 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Backend/ProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Backend/ProductForm.php @@ -159,11 +159,14 @@ class ProductForm extends FormTabs return; } $category = $this->_rootElement->find( - str_replace('%categoryName%', $categoryName, $this->categoryName), Locator::SELECTOR_XPATH + str_replace('%categoryName%', $categoryName, $this->categoryName), + Locator::SELECTOR_XPATH ); if (!$category->isVisible()) { $this->fillCategoryField( - $categoryName, 'category_ids-suggest', '//*[@id="attribute-category_ids-container"]' + $categoryName, + 'category_ids-suggest', + '//*[@id="attribute-category_ids-container"]' ); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/Crosssell.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/Crosssell.php index 95bc77e9d1a..0061e16d5e5 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/Crosssell.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/Crosssell.php @@ -47,8 +47,10 @@ class Crosssell extends Block */ public function verifyProductCrosssell(Product $crosssell) { - $match = $this->_rootElement->find(sprintf($this->linkSelector, - $crosssell->getProductName()), Locator::SELECTOR_CSS); + $match = $this->_rootElement->find( + sprintf($this->linkSelector, $crosssell->getProductName()), + Locator::SELECTOR_CSS + ); return $match->isVisible(); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/Related.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/Related.php index a96b4d4496e..05f50a5123f 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/Related.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/Related.php @@ -77,4 +77,4 @@ class Related extends Block { return $this->_rootElement->find(sprintf($this->relatedProduct, $productName), Locator::SELECTOR_XPATH); } -} \ No newline at end of file +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/Upsell.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/Upsell.php index 50fdaefdb96..2bfa88f9a59 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/Upsell.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/Upsell.php @@ -57,4 +57,4 @@ class Upsell extends Block { return $this->_rootElement->find(sprintf($this->upsellProduct, $productName), Locator::SELECTOR_XPATH); } -} \ No newline at end of file +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php index 483c44121e4..cdede23e765 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php @@ -75,5 +75,4 @@ class CustomOptions extends Block } return $options; } - } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Search.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Search.php index f15fda84f4a..b1efb82c130 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Search.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Search.php @@ -75,7 +75,8 @@ class Search extends Block public function isPlaceholderContains($placeholderText) { $field = $this->_rootElement->find( - sprintf($this->placeholder, $placeholderText), Locator::SELECTOR_XPATH + sprintf($this->placeholder, $placeholderText), + Locator::SELECTOR_XPATH ); return $field->isVisible(); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.php index bf9cbe0b5f1..670aaeb09b4 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.php @@ -68,7 +68,13 @@ class CatalogProductSimple extends InjectableFixture $persist = false ) { parent::__construct( - $configuration, $repositoryFactory, $fixtureFactory, $handlerFactory, $data, $dataSet, $persist + $configuration, + $repositoryFactory, + $fixtureFactory, + $handlerFactory, + $data, + $dataSet, + $persist ); if (!isset($this->data['url_key']) && isset($this->data['name'])) { $this->data['url_key'] = trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $this->data['name'])), '-'); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.php index 4fba7c60d7b..366da70b0e3 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.php @@ -53,7 +53,7 @@ class Category extends DataFixture * @param Config $configuration * @param array $placeholders */ - public function __construct(Config $configuration, $placeholders = array()) + public function __construct(Config $configuration, $placeholders = array()) { parent::__construct($configuration, $placeholders); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CategoryIds.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CategoryIds.php index f1943cc4eab..ea8ca67823d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CategoryIds.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CategoryIds.php @@ -111,5 +111,4 @@ class CategoryIds implements FixtureInterface { return $this->category; } - } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Curl/CreateCategory.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Curl/CreateCategory.php index 4003e883490..2dc771aa45e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Curl/CreateCategory.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Curl/CreateCategory.php @@ -121,4 +121,4 @@ class CreateCategory extends Curl preg_match("~.+\/id\/(\d+)\/.+~", $response, $matches); return isset($matches[1]) ? $matches[1] : null; } -} \ No newline at end of file +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategory.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategory.php index bdfa4ff3e02..0632320983e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategory.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategory.php @@ -108,7 +108,8 @@ class CatalogCategory extends Page public function getTreeBlock() { return Factory::getBlockFactory()->getMagentoCatalogAdminhtmlCategoryTree( - $this->_browser->find($this->treeBlock, Locator::SELECTOR_CSS, 'tree'), $this->getTemplateBlock() + $this->_browser->find($this->treeBlock, Locator::SELECTOR_CSS, 'tree'), + $this->getTemplateBlock() ); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryEdit.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryEdit.php index babd03bb0a1..94ddb2661ba 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryEdit.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryEdit.php @@ -116,7 +116,8 @@ class CatalogCategoryEdit extends Page public function getTreeBlock() { return Factory::getBlockFactory()->getMagentoCatalogAdminhtmlCategoryTree( - $this->_browser->find($this->treeBlock, Locator::SELECTOR_CSS), $this->getTemplateBlock() + $this->_browser->find($this->treeBlock, Locator::SELECTOR_CSS), + $this->getTemplateBlock() ); } @@ -152,6 +153,7 @@ class CatalogCategoryEdit extends Page public function getPageActionsBlock() { return Factory::getBlockFactory()->getMagentoBackendFormPageActions( - $this->_browser->find($this->pageActionsBlock)); + $this->_browser->find($this->pageActionsBlock) + ); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.php index 56a719dc0f0..9a8a91f8300 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.php @@ -24,10 +24,6 @@ namespace Magento\Catalog\Test\Page\Product; -use Mtf\Page\Page; -use Mtf\Factory\Factory; -use Mtf\Fixture\FixtureInterface; -use Mtf\Client\Element\Locator; use Magento\GiftCard\Test\Block\Catalog\Product\View\Type\GiftCard; use Magento\Catalog\Test\Block\Product\ProductList\Crosssell; use Magento\Catalog\Test\Block\Product\Price; @@ -40,7 +36,10 @@ use Magento\Downloadable\Test\Block\Catalog\Product\Links; use Magento\Review\Test\Block\Product\View\Summary; use Magento\Review\Test\Block\Form; use Magento\Review\Test\Block\Product\View as ReviewView; -use Magento\Core\Test\Block\Messages; +use Mtf\Page\Page; +use Mtf\Factory\Factory; +use Mtf\Fixture\FixtureInterface; +use Mtf\Client\Element\Locator; /** * Class CatalogProductView @@ -176,7 +175,7 @@ class CatalogProductView extends Page /** * Get product options block * - * @return Options + * @return View */ public function getOptionsBlock() { @@ -188,7 +187,7 @@ class CatalogProductView extends Page /** * Get product options block * - * @return CustomOptions + * @return Options */ public function getCustomOptionBlock() { @@ -200,7 +199,7 @@ class CatalogProductView extends Page /** * Get customer reviews block * - * @return Form + * @return CustomOptions */ public function getReviewFormBlock() { @@ -210,7 +209,7 @@ class CatalogProductView extends Page /** * Get customer reviews block * - * @return ReviewView + * @return Form */ public function getCustomerReviewBlock() { @@ -222,7 +221,7 @@ class CatalogProductView extends Page /** * Get review summary block * - * @return Summary + * @return ReviewView */ public function getReviewSummaryBlock() { @@ -234,7 +233,7 @@ class CatalogProductView extends Page /** * Get upsell block * - * @return Upsell + * @return Summary */ public function getUpsellProductBlock() { @@ -246,7 +245,7 @@ class CatalogProductView extends Page /** * Get messages block * - * @return Messages + * @return Upsell */ public function getMessagesBlock() { @@ -258,7 +257,7 @@ class CatalogProductView extends Page /** * Get related product block * - * @return Related + * @return GiftCard */ public function getRelatedProductBlock() { @@ -270,7 +269,7 @@ class CatalogProductView extends Page /** * Get gift card options block * - * @return GiftCard + * @return Related */ public function getGiftCardBlock() { diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/Configurable/CreateWithAttributeTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/Configurable/CreateWithAttributeTest.php index 8e3469b388b..f8dc0290480 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/Configurable/CreateWithAttributeTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/Configurable/CreateWithAttributeTest.php @@ -183,11 +183,13 @@ class CreateWithAttributeTest extends Functional $productViewBlock = $productPage->getViewBlock(); $productListBlock->openProductViewPage($product->getProductName()); $this->assertEquals( - $product->getProductName(), $productViewBlock->getProductName(), + $product->getProductName(), + $productViewBlock->getProductName(), 'Product name does not correspond to specified.' ); $this->assertEquals( - $product->getProductPrice(), $productViewBlock->getProductPrice(), + $product->getProductPrice(), + $productViewBlock->getProductPrice(), 'Product price does not correspond to specified.' ); $this->assertTrue( diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateConfigurableTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateConfigurableTest.php index 53f8c33bde3..7b96fb862c5 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateConfigurableTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateConfigurableTest.php @@ -118,15 +118,23 @@ class CreateConfigurableTest extends Functional $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName()); //Verification on category product list $productListBlock = $categoryPage->getListProductBlock(); - $this->assertTrue($productListBlock->isProductVisible($product->getProductName()), - 'Product is absent on category page.'); + $this->assertTrue( + $productListBlock->isProductVisible($product->getProductName()), + 'Product is absent on category page.' + ); //Verification on product detail page $productViewBlock = $productPage->getViewBlock(); $productListBlock->openProductViewPage($product->getProductName()); - $this->assertEquals($product->getProductName(), $productViewBlock->getProductName(), - 'Product name does not correspond to specified.'); - $this->assertEquals($product->getProductPrice(), $productViewBlock->getProductPrice(), - 'Product price does not correspond to specified.'); + $this->assertEquals( + $product->getProductName(), + $productViewBlock->getProductName(), + 'Product name does not correspond to specified.' + ); + $this->assertEquals( + $product->getProductPrice(), + $productViewBlock->getProductPrice(), + 'Product price does not correspond to specified.' + ); $this->assertTrue($productViewBlock->verifyProductOptions($product), 'Added configurable options are absent'); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleWithCategoryTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleWithCategoryTest.php index 9f416d4f423..c0b855d4d1b 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleWithCategoryTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleWithCategoryTest.php @@ -111,8 +111,10 @@ class CreateSimpleWithCategoryTest extends Functional //Verification on category product list $productListBlock = $categoryPage->getListProductBlock(); - $this->assertTrue($productListBlock->isProductVisible($product->getProductName()), - 'Product is absent on category page.'); + $this->assertTrue( + $productListBlock->isProductVisible($product->getProductName()), + 'Product is absent on category page.' + ); //Verification on product detail page $productViewBlock = $productPage->getViewBlock(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/EditSimpleProductTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/EditSimpleProductTest.php index cf720d95ab9..66fa1d5934c 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/EditSimpleProductTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/EditSimpleProductTest.php @@ -62,10 +62,12 @@ class EditSimpleProductTest extends Functional $cachePage = Factory::getPageFactory()->getAdminCache(); $productGridPage->open(); - $gridBlock->searchAndOpen(array( - 'sku' => $product->getProductSku(), - 'type' => 'Simple Product' - )); + $gridBlock->searchAndOpen( + array( + 'sku' => $product->getProductSku(), + 'type' => 'Simple Product' + ) + ); $productBlockForm->fill($editProduct); $productBlockForm->save($editProduct); //Verifying diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.php index 61e4cc62267..09a1fb34b02 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.php @@ -27,12 +27,12 @@ namespace Magento\Checkout\Test\Page; use Mtf\Page\Page; use Mtf\Factory\Factory; use Mtf\Client\Element\Locator; +use Magento\Core\Test\Block\Messages; use Magento\Checkout\Test\Block; use Magento\Checkout\Test\Block\Cart; use Magento\Checkout\Test\Block\Cart\Totals; use Magento\Checkout\Test\Block\Cart\Shipping; use Magento\Catalog\Test\Block\Product\ProductList\Crosssell; -use Magento\Core\Test\Block\Messages; /** * Class CheckoutCart diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config.php index 55a1f299a30..03c6023a915 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config.php @@ -184,8 +184,10 @@ class Config extends Tab $this->_rootElement->find('#configurable-attribute-selector')->setValue($attributeName); $attributeListLocation = '#variations-search-field .mage-suggest-dropdown'; $this->waitForElementVisible($attributeListLocation, Locator::SELECTOR_CSS); - $attribute = $this->_rootElement->find("//div[@class='mage-suggest-dropdown']//a[text()='$attributeName']", - Locator::SELECTOR_XPATH); + $attribute = $this->_rootElement->find( + "//div[@class='mage-suggest-dropdown']//a[text()='$attributeName']", + Locator::SELECTOR_XPATH + ); if ($attribute->isVisible()) { $attribute->click(); } diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/CatalogProductConfigurable.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/CatalogProductConfigurable.php index 9cba0669298..e97c27b63d5 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/CatalogProductConfigurable.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/CatalogProductConfigurable.php @@ -58,7 +58,13 @@ class CatalogProductConfigurable extends InjectableFixture $persist = false ) { parent::__construct( - $configuration, $repositoryFactory, $fixtureFactory, $handlerFactory, $data, $dataSet, $persist + $configuration, + $repositoryFactory, + $fixtureFactory, + $handlerFactory, + $data, + $dataSet, + $persist ); if (!isset($this->data['url_key']) && isset($this->data['name'])) { $this->data['url_key'] = trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $this->data['name'])), '-'); diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Curl/CreateCustomerGroup.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Curl/CreateCustomerGroup.php index e10460fef33..bd1ff7be237 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Curl/CreateCustomerGroup.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Curl/CreateCustomerGroup.php @@ -111,7 +111,7 @@ class CreateCustomerGroup extends Curl preg_match_all($regExp, $response, $matches); $result = ''; if (!empty($matches[1])) { - $result = array_pop($matches[1]);; + $result = array_pop($matches[1]); } return $result; } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.php index d032bff5a0e..c0e140b75ea 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.php @@ -22,9 +22,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Customer\Test\Page\Adminhtml; +namespace Magento\Customer\Test\Page\Adminhtml; -use Mtf\Page\BackendPage; +use Mtf\Page\BackendPage; /** * Class CustomerIndex diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.php index 53babae8d4b..a07e1c6b015 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.php @@ -22,9 +22,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Customer\Test\Page\Adminhtml; +namespace Magento\Customer\Test\Page\Adminhtml; -use Mtf\Page\BackendPage; +use Mtf\Page\BackendPage; /** * Class CustomerIndexEdit diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.php index ad806caebca..a7df02c0d72 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.php @@ -22,9 +22,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Customer\Test\Page\Adminhtml; +namespace Magento\Customer\Test\Page\Adminhtml; -use Mtf\Page\BackendPage; +use Mtf\Page\BackendPage; /** * Class CustomerIndexNew diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.php index 8fce3417831..0f0ddda8ecb 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.php @@ -22,9 +22,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Customer\Test\Page; +namespace Magento\Customer\Test\Page; -use Mtf\Page\FrontendPage; +use Mtf\Page\FrontendPage; /** * Class CustomerAccountCreate diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.php index 6ff62a51735..29fa24e366e 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.php @@ -286,15 +286,18 @@ class Address extends AbstractRepository */ protected function getAddressUKWithVAT($defaultData) { - return array_replace_recursive($defaultData, array( - 'data' => array( - 'fields' => array( - 'vat_id' => array( - 'value' => '584451913', + return array_replace_recursive( + $defaultData, + array( + 'data' => array( + 'fields' => array( + 'vat_id' => array( + 'value' => '584451913', + ), ), ), - ), - )); + ) + ); } /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.php index 15a5805bed2..131309bb3a1 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.php @@ -235,14 +235,17 @@ class Customer extends AbstractRepository */ protected function getUKWithVAT($defaultData) { - return array_replace_recursive($defaultData, array( - 'data' => array( - 'address' => array( - 'dataset' => array( - 'value' => 'address_UK_with_VAT', + return array_replace_recursive( + $defaultData, + array( + 'data' => array( + 'address' => array( + 'dataset' => array( + 'value' => 'address_UK_with_VAT', + ), ), ), - ), - )); + ) + ); } } diff --git a/dev/tests/functional/tests/app/Magento/Index/Test/Block/Adminhtml/Process/Index.php b/dev/tests/functional/tests/app/Magento/Index/Test/Block/Adminhtml/Process/Index.php index 2562bd918c0..a6ed3acf913 100644 --- a/dev/tests/functional/tests/app/Magento/Index/Test/Block/Adminhtml/Process/Index.php +++ b/dev/tests/functional/tests/app/Magento/Index/Test/Block/Adminhtml/Process/Index.php @@ -52,4 +52,4 @@ class Index extends Grid $this->_rootElement->find($this->actionsDropdown, Locator::SELECTOR_CSS, 'select')->setValue('Select All'); $this->_rootElement->find($this->massactionSubmit, Locator::SELECTOR_CSS)->click(); } -} \ No newline at end of file +} diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/SubscriberIndex.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/SubscriberIndex.php index 0fb54035ecf..a8a86474279 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/SubscriberIndex.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/SubscriberIndex.php @@ -22,9 +22,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Newsletter\Test\Page\Adminhtml; +namespace Magento\Newsletter\Test\Page\Adminhtml; -use Mtf\Page\BackendPage; +use Mtf\Page\BackendPage; /** * Class SubscriberIndex diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Constraint/AssertSitemapNotInGrid.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Constraint/AssertSitemapNotInGrid.php index e8eef48e682..2a385683ff2 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Constraint/AssertSitemapNotInGrid.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Constraint/AssertSitemapNotInGrid.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sitemap\Test\Constraint; +namespace Magento\Sitemap\Test\Constraint; use Mtf\Constraint\AbstractConstraint; use Magento\Sitemap\Test\Fixture\Sitemap; diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Constraint/AssertSitemapSuccessDeleteMessage.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Constraint/AssertSitemapSuccessDeleteMessage.php index 53a46c9a124..ef8e1118662 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Constraint/AssertSitemapSuccessDeleteMessage.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Constraint/AssertSitemapSuccessDeleteMessage.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sitemap\Test\Constraint; +namespace Magento\Sitemap\Test\Constraint; use Mtf\Constraint\AbstractConstraint; use Magento\Sitemap\Test\Page\Adminhtml\SitemapIndex; diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Fixture/Sitemap.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Fixture/Sitemap.php index c5cb1c31ba5..66e3a119479 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Fixture/Sitemap.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Fixture/Sitemap.php @@ -124,4 +124,4 @@ class Sitemap extends InjectableFixture { return $this->getData('store_id'); } -} \ No newline at end of file +} diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php index 76be389d0ff..ab762253e89 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sitemap\Test\Handler\Sitemap; +namespace Magento\Sitemap\Test\Handler\Sitemap; use Magento\Sitemap\Test\Handler\Sitemap; use Mtf\Fixture\FixtureInterface; diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/SitemapInterface.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/SitemapInterface.php index bd8f84d1c42..d0e0e354f8f 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/SitemapInterface.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/SitemapInterface.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sitemap\Test\Handler\Sitemap; +namespace Magento\Sitemap\Test\Handler\Sitemap; use Mtf\Handler\HandlerInterface; @@ -32,5 +32,5 @@ use Mtf\Handler\HandlerInterface; */ interface SitemapInterface extends HandlerInterface { - // + // } diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapEdit.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapEdit.php index 6cec6f00445..a3620838b29 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapEdit.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapEdit.php @@ -22,9 +22,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sitemap\Test\Page\Adminhtml; +namespace Magento\Sitemap\Test\Page\Adminhtml; -use Mtf\Page\BackendPage; +use Mtf\Page\BackendPage; /** * Class SitemapEdit diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.php index a36e7ec035c..756f6807cc7 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.php @@ -22,9 +22,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sitemap\Test\Page\Adminhtml; +namespace Magento\Sitemap\Test\Page\Adminhtml; -use Mtf\Page\BackendPage; +use Mtf\Page\BackendPage; /** * Class SitemapIndex diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapNew.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapNew.php index 655d90dc364..46988e92c62 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapNew.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapNew.php @@ -22,9 +22,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sitemap\Test\Page\Adminhtml; +namespace Magento\Sitemap\Test\Page\Adminhtml; -use Mtf\Page\BackendPage; +use Mtf\Page\BackendPage; /** * Class SitemapNew diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.php index b17810f6217..74139b235f4 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.php @@ -64,7 +64,7 @@ class DeleteSitemapEntityTest extends Injectable public function __inject( SitemapIndex $sitemapIndex, SitemapEdit $sitemapEdit - ){ + ) { $this->sitemapIndex = $sitemapIndex; $this->sitemapEdit = $sitemapEdit; } diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Store.php b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Store.php index b64e1a0be31..6b2549d2845 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Store.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Store.php @@ -25,6 +25,7 @@ */ namespace Magento\Store\Test\Fixture; + use Mtf\Fixture\DataFixture; use Mtf\Factory\Factory; diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.php b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.php index 0a28009f9b7..b38db625d07 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.php @@ -25,6 +25,7 @@ */ namespace Magento\Store\Test\Fixture; + use Mtf\Fixture\DataFixture; use Mtf\Factory\Factory; diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Curl/CreateStore.php b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Curl/CreateStore.php index 2ba0d06ec86..222d27febae 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Curl/CreateStore.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Curl/CreateStore.php @@ -114,4 +114,3 @@ class CreateStore extends Curl return $data; } } - diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Curl/CreateStoreGroup.php b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Curl/CreateStoreGroup.php index a4fa22f8198..90c58e6d142 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Curl/CreateStoreGroup.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Curl/CreateStoreGroup.php @@ -113,4 +113,3 @@ class CreateStoreGroup extends Curl return $data; } } - diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Repository/CustomStore.php b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/CustomStore.php index 64bd741a187..2911dbc2b3d 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Repository/CustomStore.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/CustomStore.php @@ -62,4 +62,3 @@ class CustomStore extends AbstractRepository ); } } - diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php index 21aae159dab..91a2df8e1c4 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php @@ -55,7 +55,8 @@ class StoreTest extends Functional $newStorePage->getPageActionsBlock()->clickSave(); $storeListPage->getMessagesBlock()->assertSuccessMessage(); $this->assertContains( - 'The store view has been saved', $storeListPage->getMessagesBlock()->getSuccessMessages() + 'The store view has been saved', + $storeListPage->getMessagesBlock()->getSuccessMessages() ); $this->assertTrue( $storeListPage->getGridBlock()->isStoreExists($storeFixture->getName()) diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/TaxClass.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/TaxClass.php index 1d2c8a54c1c..555d71cd8a3 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/TaxClass.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/TaxClass.php @@ -83,14 +83,18 @@ class TaxClass extends Block } //Select tax classes foreach ($taxClasses as $class) { - $taxOption = $this->_rootElement->find($this->taxClassItem . '[text()="' . $class . '"]', - Locator::SELECTOR_XPATH); + $taxOption = $this->_rootElement->find( + $this->taxClassItem . '[text()="' . $class . '"]', + Locator::SELECTOR_XPATH + ); if (!$taxOption->isVisible()) { $this->_rootElement->find($this->addNewTaxClass, Locator::SELECTOR_CSS)->click(); $this->_rootElement->find($this->newTaxClass, Locator::SELECTOR_CSS)->setValue($class); $this->_rootElement->find($this->saveTaxClass, Locator::SELECTOR_CSS)->click(); - $this->waitForElementVisible($this->taxClassRow . '/span[text()="' . $class . '"]', - Locator::SELECTOR_XPATH); + $this->waitForElementVisible( + $this->taxClassRow . '/span[text()="' . $class . '"]', + Locator::SELECTOR_XPATH + ); } else { $this->_rootElement->find('//label/span[text()="' . $class . '"]', Locator::SELECTOR_XPATH)->click(); } diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/TaxRate.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/TaxRate.php index dd8a1aacc22..e3b87b382a7 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/TaxRate.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/TaxRate.php @@ -77,8 +77,10 @@ class TaxRate extends FormInterface $taxRateDialog->find($this->saveTaxRate, Locator::SELECTOR_CSS)->click(); $this->waitForElementNotVisible($this->taxRateUiDialog, Locator::SELECTOR_XPATH); } else { - $this->_rootElement->find($this->taxRateOption . '/span[text()="' . $rate['code']['value'] . '"]', - Locator::SELECTOR_XPATH)->click(); + $this->_rootElement->find( + $this->taxRateOption . '/span[text()="' . $rate['code']['value'] . '"]', + Locator::SELECTOR_XPATH + )->click(); } } } diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Grid.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Grid.php index 7e6ef053c80..e0c6237ec5c 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Grid.php @@ -82,4 +82,4 @@ class Grid extends GridInterface { $this->_rootElement->find($this->addNewRule, Locator::SELECTOR_XPATH)->click(); } -} \ No newline at end of file +} diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxRate.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxRate.php index 18bec975f7b..f0d0388a7db 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxRate.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxRate.php @@ -154,17 +154,20 @@ class TaxRate extends AbstractRepository */ protected function getUKFullTaxRate($defaultData) { - return array_replace_recursive($defaultData, array( - 'data' => array( - 'fields' => array( - 'rate' => array( - 'value' => 20 - ), - 'tax_country_id' => array( - 'value' => 'GB', + return array_replace_recursive( + $defaultData, + array( + 'data' => array( + 'fields' => array( + 'rate' => array( + 'value' => 20 + ), + 'tax_country_id' => array( + 'value' => 'GB', + ), ), ), - ), - )); + ) + ); } } diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxRule.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxRule.php index 5bb2ded7ee6..f72717da870 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxRule.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxRule.php @@ -134,14 +134,17 @@ class TaxRule extends AbstractRepository */ protected function getUKFullTaxRule($defaultData) { - return array_replace_recursive($defaultData, array( - 'data' => array( - 'fields' => array( - 'tax_rate' => array( - 'value' => '%uk_full_tax_rate%' + return array_replace_recursive( + $defaultData, + array( + 'data' => array( + 'fields' => array( + 'tax_rate' => array( + 'value' => '%uk_full_tax_rate%' + ), ), ), - ), - )); + ) + ); } } diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Block/Backend/UserGrid.php b/dev/tests/functional/tests/app/Magento/User/Test/Block/Backend/UserGrid.php index 88cce26bd6e..55b32da4885 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Block/Backend/UserGrid.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Block/Backend/UserGrid.php @@ -76,4 +76,3 @@ class UserGrid extends Grid parent::_init(); } } - diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Block/User/Edit/Form.php b/dev/tests/functional/tests/app/Magento/User/Test/Block/User/Edit/Form.php index 3088c675503..d5f27dd5da5 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Block/User/Edit/Form.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Block/User/Edit/Form.php @@ -51,4 +51,3 @@ class Form extends FormTabs $this->_rootElement->find($this->roleTab, Locator::SELECTOR_ID)->click(); } } - diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Block/User/Edit/Tab/Roles.php b/dev/tests/functional/tests/app/Magento/User/Test/Block/User/Edit/Tab/Roles.php index 467cd2197b8..ccf627df722 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Block/User/Edit/Tab/Roles.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Block/User/Edit/Tab/Roles.php @@ -59,4 +59,3 @@ class Roles extends Grid $this->selectItem = 'tbody tr'; } } - diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.php b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.php index 27d979b4202..95c2ca1449f 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.php @@ -121,4 +121,3 @@ class Role extends DataFixture $this->_repository->set($name, $data); } } - diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateUser.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateUser.php index fa3f11ce5b4..cfe7ead3deb 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateUser.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateUser.php @@ -68,8 +68,11 @@ class CreateUser extends Curl $curl->write(CurlInterface::POST, $url, '1.0'); $response = $curl->read(); $curl->close(); - preg_match('/class=\"\scol\-id col\-user_id\W*>\W+(\d+)\W+<\/td>\W+<td[\w\s\"=\-]*?>\W+?' - . $data['username'] . '/siu', $response, $matches); + preg_match( + '/class=\"\scol\-id col\-user_id\W*>\W+(\d+)\W+<\/td>\W+<td[\w\s\"=\-]*?>\W+?' . $data['username'] . '/siu', + $response, + $matches + ); if (empty($matches)) { throw new \Exception('Cannot find user id'); } @@ -107,4 +110,3 @@ class CreateUser extends Curl } } - diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Backend/UserEdit.php b/dev/tests/functional/tests/app/Magento/User/Test/Page/Backend/UserEdit.php index 341316cde25..fa736405c46 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Backend/UserEdit.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Page/Backend/UserEdit.php @@ -44,7 +44,7 @@ class UserEdit extends Page * * @var string */ - protected $editFormBlock = 'page:main-container'; + protected $editFormBlock = 'page:main-container'; /** * Global messages block @@ -94,7 +94,8 @@ class UserEdit extends Page public function getMessagesBlock() { return Factory::getBlockFactory()->getMagentoCoreMessages( - $this->_browser->find($this->messagesBlock)); + $this->_browser->find($this->messagesBlock) + ); } /** @@ -105,7 +106,8 @@ class UserEdit extends Page public function getRoleGridBlock() { return Factory::getBlockFactory()->getMagentoUserUserEditTabRoles( - $this->_browser->find($this->roleGridBlock, Locator::SELECTOR_ID)); + $this->_browser->find($this->roleGridBlock, Locator::SELECTOR_ID) + ); } /** @@ -120,4 +122,3 @@ class UserEdit extends Page ); } } - diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Backend/UserIndex.php b/dev/tests/functional/tests/app/Magento/User/Test/Page/Backend/UserIndex.php index 3ea8ee201d1..2ab29dd452b 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Backend/UserIndex.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Page/Backend/UserIndex.php @@ -103,4 +103,3 @@ class UserIndex extends Page ); } } - diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php index d781b5568c5..bf58e69147d 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php @@ -460,7 +460,6 @@ class ClassesTest extends \PHPUnit_Framework_TestCase '/downloader/lib/', '/dev/tools/', '/dev/tests/api-functional/framework/', - '/dev/tests/api-functional/_files/', '/dev/tests/functional/', '/dev/tests/integration/framework/', '/dev/tests/integration/framework/tests/unit/testsuite/', diff --git a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php index 509b0c268af..7099d66c036 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php @@ -88,7 +88,6 @@ class LiveCodeTest extends PHPUnit_Framework_TestCase */ public function testCodeStylePsr2() { - $this->markTestSkipped('This is skipped due to strange errors visible only on publication build'); $reportFile = self::$reportDir . '/phpcs_psr2_report.xml'; $wrapper = new Wrapper(); $codeSniffer = new CodeSniffer('PSR2', $reportFile, $wrapper); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/DashboardTest.php b/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/DashboardTest.php index 6c486bce380..8ffa9107515 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/DashboardTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/DashboardTest.php @@ -251,7 +251,11 @@ class DashboardTest extends \PHPUnit_Framework_TestCase $response->headersSentThrowsException = false; } $rewriteFactory = $this->getMock( - 'Magento\UrlRewrite\Model\UrlRewriteFactory', array('create'), array(), '', false + 'Magento\UrlRewrite\Model\UrlRewriteFactory', + array('create'), + array(), + '', + false ); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $varienFront = $helper->getObject( diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/PriceTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/PriceTest.php index bf1e2fc5a4c..dc15afc0a12 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/PriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/PriceTest.php @@ -68,7 +68,11 @@ class PriceTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->ruleFactoryMock = $this->getMock( - '\Magento\CatalogRule\Model\Resource\RuleFactory', array(), array(), '', false + '\Magento\CatalogRule\Model\Resource\RuleFactory', + array(), + array(), + '', + false ); $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); $this->localeDateMock = $this->getMock('\Magento\Framework\Stdlib\DateTime\TimezoneInterface'); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/CategoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/CategoryTest.php new file mode 100644 index 00000000000..110292007c8 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/CategoryTest.php @@ -0,0 +1,66 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Catalog + * @subpackage unit_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Block\Adminhtml\Product\Helper\Form; + +class CategoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param bool $isAllowed + * @param array $data + * @param bool $expected + * @dataProvider getNoDisplayDataProvider + */ + public function testGetNoDisplay($isAllowed, $data, $expected) + { + $authorizationMock = $this->getMockBuilder('Magento\Framework\AuthorizationInterface') + ->disableOriginalConstructor() + ->getMock(); + $authorizationMock->expects($this->any()) + ->method('isAllowed') + ->will($this->returnValue($isAllowed)); + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + /** @var Category $element */ + $element = $objectManager->getObject( + '\Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Category', + ['authorization' => $authorizationMock, 'data' => $data] + ); + + $this->assertEquals($expected, $element->getNoDisplay()); + } + + public function getNoDisplayDataProvider() + { + return [ + [true, [], false], + [false, [], true], + [true, ['no_display' => false], false], + [true, ['no_display' => true], true], + [false, ['no_display' => false], true], + [false, ['no_display' => true], true], + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/PluginTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/PluginTest.php index cdb3b036385..8b31294bbe5 100644 --- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/PluginTest.php +++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/PluginTest.php @@ -68,10 +68,18 @@ class PluginTest extends \PHPUnit_Framework_TestCase $this->scopeConfigMock = $this->getMock('\Magento\Framework\App\Config\ScopeConfigInterface'); $this->engineMock = $this->getMock('\Magento\CatalogSearch\Model\Resource\EngineInterface'); $this->collectionMock = $this->getMock( - '\Magento\Catalog\Model\Resource\Product\Collection', array(), array(), '', false + '\Magento\Catalog\Model\Resource\Product\Collection', + array(), + array(), + '', + false ); $this->engineProviderMock = $this->getMock( - '\Magento\CatalogSearch\Model\Resource\EngineProvider', array(), array(), '', false + '\Magento\CatalogSearch\Model\Resource\EngineProvider', + array(), + array(), + '', + false ); $this->engineProviderMock->expects($this->any())->method('get')->will($this->returnValue($this->engineMock)); @@ -98,7 +106,8 @@ class PluginTest extends \PHPUnit_Framework_TestCase }; $this->assertEquals( - false, $this->model->aroundIsEnabled($this->subjectMock, $proceed, $this->layerMock, array()) + false, + $this->model->aroundIsEnabled($this->subjectMock, $proceed, $this->layerMock, array()) ); } @@ -129,7 +138,8 @@ class PluginTest extends \PHPUnit_Framework_TestCase }; $this->assertEquals( - true, $this->model->aroundIsEnabled($this->subjectMock, $proceed, $this->layerMock, array()) + true, + $this->model->aroundIsEnabled($this->subjectMock, $proceed, $this->layerMock, array()) ); } @@ -172,7 +182,8 @@ class PluginTest extends \PHPUnit_Framework_TestCase }; $this->assertEquals( - false, $this->model->aroundIsEnabled($this->subjectMock, $proceed, $this->layerMock, array()) + false, + $this->model->aroundIsEnabled($this->subjectMock, $proceed, $this->layerMock, array()) ); } } diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php index 3a0f98c2f5e..aa1bbe3b4e9 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php @@ -99,7 +99,9 @@ class RendererTest extends \PHPUnit_Framework_TestCase $product = $this->getMock( 'Magento\Catalog\Model\Product', array('getName', '__wakeup', 'getIdentities'), - array(), '', false + array(), + '', + false ); $product->expects($this->any())->method('getName')->will($this->returnValue('Parent Product')); diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php index ffc859d2ea0..7f3b690b39a 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php @@ -109,7 +109,9 @@ class SidebarTest extends \PHPUnit_Framework_TestCase $product = $this->getMock( 'Magento\Catalog\Model\Product', array('__wakeup', 'getIdentities'), - array(), '', false + array(), + '', + false ); $identities = [0 => 1, 1 => 2, 2 => 3]; $product->expects($this->exactly(2)) diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/DbTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/DbTest.php index 58f67e93df6..aa053a6427c 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/DbTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/DbTest.php @@ -43,7 +43,7 @@ class DbTest extends \PHPUnit_Framework_TestCase */ public function testConvertNoJobs() { - $source = array(); + $source = []; $result = $this->_converter->convert($source); $this->assertEmpty($result); } @@ -53,39 +53,53 @@ class DbTest extends \PHPUnit_Framework_TestCase */ public function testConvertConfigParams() { - $fullJob = array('schedule' => array('config_path' => 'config/path', 'cron_expr' => '* * * * *')); - $nullJob = array('schedule' => array('config_path' => null, 'cron_expr' => null)); - $notFullJob = array('schedule' => ''); - $source = array( - 'crontab' => array( - 'default' => array( - 'jobs' => array( + $fullJob = ['schedule' => ['config_path' => 'config/path', 'cron_expr' => '* * * * *']]; + $nullJob = ['schedule' => ['config_path' => null, 'cron_expr' => null]]; + $notFullJob = ['schedule' => '']; + $source = [ + 'crontab' => [ + 'default' => [ + 'jobs' => [ 'job_name_1' => $fullJob, 'job_name_2' => $nullJob, 'job_name_3' => $notFullJob, - 'job_name_4' => array() - ) - ) - ) - ); - $expected = array( - 'job_name_1' => array('config_path' => 'config/path', 'schedule' => '* * * * *'), - 'job_name_2' => array('config_path' => null, 'schedule' => null), - 'job_name_3' => array('schedule' => ''), - 'job_name_4' => array('') - ); + 'job_name_4' => [] + ] + ] + ] + ]; + $expected = [ + 'default' => [ + 'job_name_1' => ['config_path' => 'config/path', 'schedule' => '* * * * *'], + 'job_name_2' => ['config_path' => null, 'schedule' => null], + 'job_name_3' => ['schedule' => ''], + 'job_name_4' => [''] + ] + ]; $result = $this->_converter->convert($source); - $this->assertEquals($expected['job_name_1']['config_path'], $result['job_name_1']['config_path']); - $this->assertEquals($expected['job_name_1']['schedule'], $result['job_name_1']['schedule']); + $this->assertEquals( + $expected['default']['job_name_1']['config_path'], + $result['default']['job_name_1']['config_path'] + ); + $this->assertEquals( + $expected['default']['job_name_1']['schedule'], + $result['default']['job_name_1']['schedule'] + ); - $this->assertEquals($expected['job_name_2']['config_path'], $result['job_name_2']['config_path']); - $this->assertEquals($expected['job_name_2']['schedule'], $result['job_name_2']['schedule']); + $this->assertEquals( + $expected['default']['job_name_2']['config_path'], + $result['default']['job_name_2']['config_path'] + ); + $this->assertEquals( + $expected['default']['job_name_2']['schedule'], + $result['default']['job_name_2']['schedule'] + ); - $this->assertArrayHasKey('schedule', $result['job_name_3']); - $this->assertEmpty($result['job_name_3']['schedule']); + $this->assertArrayHasKey('schedule', $result['default']['job_name_3']); + $this->assertEmpty($result['default']['job_name_3']['schedule']); - $this->assertEmpty($result['job_name_4']); + $this->assertEmpty($result['default']['job_name_4']); } /** @@ -93,35 +107,40 @@ class DbTest extends \PHPUnit_Framework_TestCase */ public function testConvertRunConfig() { - $runFullJob = array('run' => array('model' => 'Model1::method1')); - $runNoMethodJob = array('run' => array('model' => 'Model2')); - $runEmptyMethodJob = array('run' => array('model' => 'Model3::')); - $runNoModelJob = array('run' => array('model' => '::method1')); + $runFullJob = ['run' => ['model' => 'Model1::method1']]; + $runNoMethodJob = ['run' => ['model' => 'Model2']]; + $runEmptyMethodJob = ['run' => ['model' => 'Model3::']]; + $runNoModelJob = ['run' => ['model' => '::method1']]; - $source = array( - 'crontab' => array( - 'default' => array( - 'jobs' => array( + $source = [ + 'crontab' => [ + 'default' => [ + 'jobs' => [ 'job_name_1' => $runFullJob, 'job_name_2' => $runNoMethodJob, 'job_name_3' => $runEmptyMethodJob, 'job_name_4' => $runNoModelJob - ) - ) - ) - ); - $expected = array( - 'job_name_1' => array('instance' => 'Model1', 'method' => 'method1'), - 'job_name_2' => array(), - 'job_name_3' => array(), - 'job_name_4' => array() - ); + ] + ] + ] + ]; + $expected = [ + 'default' => [ + 'job_name_1' => ['instance' => 'Model1', 'method' => 'method1'], + 'job_name_2' => [], + 'job_name_3' => [], + 'job_name_4' => [] + ] + ]; $result = $this->_converter->convert($source); - $this->assertEquals($expected['job_name_1']['instance'], $result['job_name_1']['instance']); - $this->assertEquals($expected['job_name_1']['method'], $result['job_name_1']['method']); + $this->assertEquals( + $expected['default']['job_name_1']['instance'], + $result['default']['job_name_1']['instance'] + ); + $this->assertEquals($expected['default']['job_name_1']['method'], $result['default']['job_name_1']['method']); - $this->assertEmpty($result['job_name_2']); - $this->assertEmpty($result['job_name_3']); - $this->assertEmpty($result['job_name_4']); + $this->assertEmpty($result['default']['job_name_2']); + $this->assertEmpty($result['default']['job_name_3']); + $this->assertEmpty($result['default']['job_name_4']); } } diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/DbTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/DbTest.php index 5cd2831f65e..1d4e8914b2f 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/DbTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/DbTest.php @@ -62,12 +62,14 @@ class DbTest extends \PHPUnit_Framework_TestCase $data = array('crontab' => array('default' => array('jobs' => array('job1' => $job1, 'job2' => $job2)))); $this->_defaultReader->expects($this->once())->method('read')->will($this->returnValue($data)); $expected = array( - 'job1' => array('schedule' => $job1['schedule']['cron_expr']), - 'job2' => array('schedule' => $job2['schedule']['cron_expr']) + 'default' => array( + 'job1' => array('schedule' => $job1['schedule']['cron_expr']), + 'job2' => array('schedule' => $job2['schedule']['cron_expr']) + ) ); $result = $this->_reader->get(); - $this->assertEquals($expected['job1']['schedule'], $result['job1']['schedule']); - $this->assertEquals($expected['job2']['schedule'], $result['job2']['schedule']); + $this->assertEquals($expected['default']['job1']['schedule'], $result['default']['job1']['schedule']); + $this->assertEquals($expected['default']['job2']['schedule'], $result['default']['job2']['schedule']); } } diff --git a/dev/tests/unit/testsuite/Magento/Customer/Block/Account/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Customer/Block/Account/CustomerTest.php index a0a6eccb7dd..420078f38c3 100755 --- a/dev/tests/unit/testsuite/Magento/Customer/Block/Account/CustomerTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Block/Account/CustomerTest.php @@ -67,8 +67,13 @@ class CustomerTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $block = new \Magento\Customer\Block\Account\Customer($contextMock, $customerServiceMock, - $viewHelperMock, $httpContextMock, $currentCustomer); + $block = new \Magento\Customer\Block\Account\Customer( + $contextMock, + $customerServiceMock, + $viewHelperMock, + $httpContextMock, + $currentCustomer + ); $this->assertSame($customerName, $block->getCustomerName()); } diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/App/Action/ContextPluginTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/App/Action/ContextPluginTest.php index 12b20cd3dd6..e2a178f0126 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/App/Action/ContextPluginTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/App/Action/ContextPluginTest.php @@ -64,10 +64,20 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->customerSessionMock = $this->getMock('Magento\Customer\Model\Session', - array(), array(), '', false); - $this->httpContextMock = $this->getMock('Magento\Framework\App\Http\Context', - array(), array(), '', false); + $this->customerSessionMock = $this->getMock( + 'Magento\Customer\Model\Session', + array(), + array(), + '', + false + ); + $this->httpContextMock = $this->getMock( + 'Magento\Framework\App\Http\Context', + array(), + array(), + '', + false + ); $this->closureMock = function () { return 'ExpectedValue'; }; @@ -92,10 +102,14 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(true)); $this->httpContextMock->expects($this->atLeastOnce()) ->method('setValue') - ->will($this->returnValueMap(array( - array(\Magento\Customer\Helper\Data::CONTEXT_GROUP, 'UAH', $this->httpContextMock), - array(\Magento\Customer\Helper\Data::CONTEXT_AUTH, 0, $this->httpContextMock), - ))); + ->will( + $this->returnValueMap( + array( + array(\Magento\Customer\Helper\Data::CONTEXT_GROUP, 'UAH', $this->httpContextMock), + array(\Magento\Customer\Helper\Data::CONTEXT_AUTH, 0, $this->httpContextMock), + ) + ) + ); $this->assertEquals( 'ExpectedValue', $this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock) diff --git a/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php index d20d48cfeef..42576df2f9c 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php @@ -71,7 +71,9 @@ class DataTest extends \PHPUnit_Framework_TestCase foreach ($result as $key => $value) { $this->assertArrayHasKey($key, $expected, 'Attribute metadata with key "' . $key . '" not found.'); - $this->assertEquals($expected[$key], $value, + $this->assertEquals( + $expected[$key], + $value, 'Attribute metadata with key "' . $key . '" has invalid value.' ); } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Acl/CacheTest.php b/dev/tests/unit/testsuite/Magento/Framework/Acl/CacheTest.php new file mode 100644 index 00000000000..92832f030a6 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Acl/CacheTest.php @@ -0,0 +1,130 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Framework\Acl; + +class CacheTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Cache + */ + protected $model; + + /** + * @var \Magento\Framework\Config\CacheInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $cacheConfig; + + /** + * @var string + */ + protected $cacheKey; + + protected function setUp() + { + $this->cacheConfig = $this->getMock('Magento\Framework\Config\CacheInterface'); + $this->cacheKey = 'test_key'; + + $this->model = new Cache($this->cacheConfig, $this->cacheKey); + } + + /** + * @param array|bool $dataAcl + * @dataProvider aclDataProvider + */ + public function testGet($dataAcl) + { + $this->initAcl((is_array($dataAcl) ? serialize($dataAcl): $dataAcl)); + $this->assertEquals($dataAcl, $this->model->get()); + } + + /** + * @return array + */ + public function aclDataProvider() + { + return [ + ['dataAcl' => ['someKey' => 'someValue']], + ['dataAcl' => false] + ]; + } + + /** + * @param bool $expectedTest + * @dataProvider hasWithoutAclDataProvider + */ + public function testHasWithoutAcl($expectedTest) + { + $this->cacheConfig->expects($this->once())->method('test')->will($this->returnValue($expectedTest)); + $this->assertEquals($expectedTest, $this->model->has()); + } + + /** + * @return array + */ + public function hasWithoutAclDataProvider() + { + return [ + ['expectedTest' => true], + ['expectedTest' => false] + ]; + } + + /** + * @param array|bool $dataAcl + * @dataProvider aclDataProvider + */ + public function testHasWithAcl($dataAcl) + { + $this->initAcl((is_array($dataAcl) ? serialize($dataAcl): $dataAcl)); + $this->cacheConfig->expects($this->never())->method('test'); + + $this->model->get(); + $this->assertTrue($this->model->has()); + } + + protected function initAcl($aclData) + { + $this->cacheConfig->expects($this->once()) + ->method('load') + ->with($this->cacheKey) + ->will($this->returnValue($aclData)); + } + + public function testSave() + { + $acl = $this->getMockBuilder('Magento\Framework\Acl')->disableOriginalConstructor()->getMock(); + + $this->cacheConfig->expects($this->once())->method('save')->with(serialize($acl), $this->cacheKey); + $this->model->save($acl); + } + + public function testClean() + { + $this->cacheConfig->expects($this->once()) + ->method('remove') + ->with($this->cacheKey); + $this->model->clean(); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Acl/Loader/ResourceTest.php b/dev/tests/unit/testsuite/Magento/Framework/Acl/Loader/ResourceTest.php index 627eeb9758b..665fdf771f5 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Acl/Loader/ResourceTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Acl/Loader/ResourceTest.php @@ -39,16 +39,7 @@ class ResourceTest extends \PHPUnit_Framework_TestCase $acl = $this->getMock('Magento\Framework\Acl', array('addResource'), array(), '', false); $acl->expects($this->exactly(2))->method('addResource'); $acl->expects($this->at(0))->method('addResource')->with($aclResource, null)->will($this->returnSelf()); - $acl->expects( - $this->at(1) - )->method( - 'addResource' - )->with( - $aclResource, - $aclResource - )->will( - $this->returnSelf() - ); + $acl->expects($this->at(1))->method('addResource')->with($aclResource, $aclResource)->will($this->returnSelf()); $factoryObject = $this->getMock( 'Magento\Framework\Acl\ResourceFactory', @@ -61,29 +52,77 @@ class ResourceTest extends \PHPUnit_Framework_TestCase /** @var $resourceProvider \Magento\Framework\Acl\Resource\ProviderInterface */ $resourceProvider = $this->getMock('Magento\Framework\Acl\Resource\ProviderInterface'); - $resourceProvider->expects( - $this->once() - )->method( - 'getAclResources' - )->will( - $this->returnValue( - array( + $resourceProvider->expects($this->once()) + ->method('getAclResources') + ->will( + $this->returnValue( array( - 'id' => 'parent_resource::id', - 'title' => 'Parent Resource Title', - 'sortOrder' => 10, - 'children' => array( - array( - 'id' => 'child_resource::id', - 'title' => 'Child Resource Title', - 'sortOrder' => 10, - 'children' => array() + array( + 'id' => 'parent_resource::id', + 'title' => 'Parent Resource Title', + 'sortOrder' => 10, + 'children' => array( + array( + 'id' => 'child_resource::id', + 'title' => 'Child Resource Title', + 'sortOrder' => 10, + 'children' => array() + ) ) ) ) ) - ) - ); + ); + + /** @var $loaderResource \Magento\Framework\Acl\Loader\Resource */ + $loaderResource = new \Magento\Framework\Acl\Loader\Resource($resourceProvider, $factoryObject); + + $loaderResource->populateAcl($acl); + } + + /** + * Test for \Magento\Framework\Acl\Loader\Resource::populateAcl + * + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Missing ACL resource identifier + */ + public function testPopulateAclWithException() + { + /** @var $aclResource \Magento\Framework\Acl\Resource */ + $aclResource = $this->getMock('Magento\Framework\Acl\Resource', array(), array(), '', false); + + $factoryObject = $this->getMockBuilder('Magento\Framework\Acl\ResourceFactory') + ->setMethods(['createResource']) + ->disableOriginalConstructor() + ->getMock(); + + $factoryObject->expects($this->any())->method('createResource')->will($this->returnValue($aclResource)); + + /** @var $resourceProvider \Magento\Framework\Acl\Resource\ProviderInterface */ + $resourceProvider = $this->getMock('Magento\Framework\Acl\Resource\ProviderInterface'); + $resourceProvider->expects($this->once()) + ->method('getAclResources') + ->will( + $this->returnValue( + array( + array( + 'title' => 'Parent Resource Title', + 'sortOrder' => 10, + 'children' => array( + array( + 'id' => 'child_resource::id', + 'title' => 'Child Resource Title', + 'sortOrder' => 10, + 'children' => array() + ) + ) + ) + ) + ) + ); + + /** @var $acl \Magento\Framework\Acl */ + $acl = $this->getMock('Magento\Framework\Acl', array('addResource'), array(), '', false); /** @var $loaderResource \Magento\Framework\Acl\Loader\Resource */ $loaderResource = new \Magento\Framework\Acl\Loader\Resource($resourceProvider, $factoryObject); diff --git a/dev/tests/unit/testsuite/Magento/Framework/Acl/Role/RegistryTest.php b/dev/tests/unit/testsuite/Magento/Framework/Acl/Role/RegistryTest.php new file mode 100644 index 00000000000..d3db4a8c8eb --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Acl/Role/RegistryTest.php @@ -0,0 +1,101 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Framework\Acl\Role; + +class RegistryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Registry + */ + protected $model; + + protected function setUp() + { + $this->model = new Registry(); + } + + protected function initRoles($roleId, $parentRoleId) + { + $parentRole = $this->getMock('Zend_Acl_Role_Interface'); + $parentRole->expects($this->any())->method('getRoleId')->will($this->returnValue($parentRoleId)); + + $role = $this->getMock('Zend_Acl_Role_Interface'); + $role->expects($this->any())->method('getRoleId')->will($this->returnValue($roleId)); + + $this->model->add($role); + $this->model->add($parentRole); + return [$role, $parentRole]; + } + + public function testAddParent() + { + $roleId = 1; + $parentRoleId = 2; + list($role, $parentRole) = $this->initRoles($roleId, $parentRoleId); + + $this->assertEmpty($this->model->getParents($roleId)); + $this->model->addParent($role, $parentRole); + $this->model->getParents($roleId); + $this->assertEquals([$parentRoleId => $parentRole], $this->model->getParents($roleId)); + } + + public function testAddParentByIds() + { + $roleId = 14; + $parentRoleId = 25; + list(, $parentRole) = $this->initRoles($roleId, $parentRoleId); + + $this->assertEmpty($this->model->getParents($roleId)); + $this->model->addParent($roleId, $parentRoleId); + $this->model->getParents($roleId); + $this->assertEquals([$parentRoleId => $parentRole], $this->model->getParents($roleId)); + } + + /** + * @expectedException \Zend_Acl_Role_Registry_Exception + * @expectedExceptionMessage Child Role id '20' does not exist + */ + public function testAddParentWrongChildId() + { + $roleId = 1; + $parentRoleId = 2; + list(, $parentRole) = $this->initRoles($roleId, $parentRoleId); + + $this->model->addParent(20, $parentRole); + } + + /** + * @expectedException \Zend_Acl_Role_Registry_Exception + * @expectedExceptionMessage Parent Role id '26' does not exist + */ + public function testAddParentWrongParentId() + { + $roleId = 1; + $parentRoleId = 2; + list($role, ) = $this->initRoles($roleId, $parentRoleId); + + $this->model->addParent($role, 26); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/App/DefaultClass.php b/dev/tests/unit/testsuite/Magento/Framework/App/DefaultClass.php new file mode 100644 index 00000000000..88d4faef780 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/App/DefaultClass.php @@ -0,0 +1,30 @@ +<?php +/** + * FrontClass model test class + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Framework\App; + +class DefaultClass +{ +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/App/FrontControllerTest.php b/dev/tests/unit/testsuite/Magento/Framework/App/FrontControllerTest.php index 496818b6bf1..7813598ea34 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/App/FrontControllerTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/App/FrontControllerTest.php @@ -28,31 +28,35 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Framework\App\FrontController */ - protected $_model; + protected $model; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_request; + protected $request; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_routerList; + protected $routerList; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_router; + protected $router; protected function setUp() { - $this->_request = $this->getMock('Magento\Framework\App\Request\Http', array(), array(), '', false); - $this->_router = - $this->getMock('Magento\Framework\App\Router\AbstractRouter', array('match'), array(), '', false); - $this->_routerList = $this->getMock('Magento\Framework\App\RouterList', array(), array(), '', false); - $this->_routerList->expects($this->any())->method('getIterator')->will($this->returnValue($this->_routerList)); - $this->_model = new \Magento\Framework\App\FrontController($this->_routerList); + $this->request = $this->getMockBuilder('Magento\Framework\App\Request\Http') + ->disableOriginalConstructor() + ->setMethods(['isDispatched', 'setDispatched', 'initForward', 'setActionName']) + ->getMock(); + + $this->router = $this->getMockBuilder('Magento\Framework\App\Router\AbstractRouter') + ->disableOriginalConstructor() + ->getMock(); + $this->routerList = $this->getMock('Magento\Framework\App\RouterList', array(), array(), '', false); + $this->model = new \Magento\Framework\App\FrontController($this->routerList); } /** @@ -61,24 +65,97 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase */ public function testDispatchThrowException() { - $this->_request->expects($this->any())->method('isDispatched')->will($this->returnValue(false)); - $this->_model->dispatch($this->_request); + $validCounter = 0; + $callbackValid = function () use (&$validCounter) { + return $validCounter++%10 ? false : true; + }; + $this->routerList->expects($this->any())->method('valid')->will($this->returnCallback($callbackValid)); + + $this->router->expects($this->any()) + ->method('match') + ->with($this->request) + ->will($this->returnValue(false)); + + $this->routerList->expects($this->any()) + ->method('current') + ->will($this->returnValue($this->router)); + + $this->request->expects($this->any())->method('isDispatched')->will($this->returnValue(false)); + + $this->model->dispatch($this->request); } - /** - * @expectedException \LogicException - * @expectedExceptionMessage Front controller reached 100 router match iterations - */ - public function testWhenDispatchedActionInterface() + public function testDispatched() { - $this->_request->expects($this->any())->method('isDispatched')->will($this->returnValue(false)); - $this->_routerList->expects($this->atLeastOnce())->method('valid')->will($this->returnValue(true)); - $this->_routerList->expects($this->atLeastOnce())->method('current')->will($this->returnValue($this->_router)); + $this->routerList->expects($this->any()) + ->method('valid') + ->will($this->returnValue(true)); + + $response = $this->getMock('Magento\Framework\App\Response\Http', array(), array(), '', false); $controllerInstance = $this->getMock('Magento\Framework\App\ActionInterface'); + $controllerInstance->expects($this->any()) + ->method('getResponse') + ->will($this->returnValue($response)); + $controllerInstance->expects($this->any()) + ->method('dispatch') + ->with($this->request) + ->will($this->returnValue($response)); + $this->router->expects($this->at(0)) + ->method('match') + ->with($this->request) + ->will($this->returnValue(false)); + $this->router->expects($this->at(1)) + ->method('match') + ->with($this->request) + ->will($this->returnValue($controllerInstance)); + + $this->routerList->expects($this->any()) + ->method('current') + ->will($this->returnValue($this->router)); + + $this->request->expects($this->at(0))->method('isDispatched')->will($this->returnValue(false)); + $this->request->expects($this->at(1))->method('setDispatched')->with(true); + $this->request->expects($this->at(2))->method('isDispatched')->will($this->returnValue(true)); + + $this->assertEquals($response, $this->model->dispatch($this->request)); + } + + public function testDispatchedNotFoundException() + { + $this->routerList->expects($this->any()) + ->method('valid') + ->will($this->returnValue(true)); + $response = $this->getMock('Magento\Framework\App\Response\Http', array(), array(), '', false); - $controllerInstance->expects($this->any())->method('getResponse')->will($this->returnValue($response)); - $this->_router->expects($this->atLeastOnce())->method('match')->will($this->returnValue($controllerInstance)); - $controllerInstance->expects($this->any())->method('dispatch')->with($this->_request); - $this->_model->dispatch($this->_request); + $controllerInstance = $this->getMock('Magento\Framework\App\ActionInterface'); + $controllerInstance->expects($this->any()) + ->method('getResponse') + ->will($this->returnValue($response)); + $controllerInstance->expects($this->any()) + ->method('dispatch') + ->with($this->request) + ->will($this->returnValue($response)); + $this->router->expects($this->at(0)) + ->method('match') + ->with($this->request) + ->will($this->throwException(new Action\NotFoundException)); + $this->router->expects($this->at(1)) + ->method('match') + ->with($this->request) + ->will($this->returnValue($controllerInstance)); + + $this->routerList->expects($this->any()) + ->method('current') + ->will($this->returnValue($this->router)); + + $this->request->expects($this->at(0))->method('isDispatched')->will($this->returnValue(false)); + $this->request->expects($this->at(1))->method('initForward'); + $this->request->expects($this->at(2))->method('setActionName')->with('noroute'); + $this->request->expects($this->at(3))->method('setDispatched')->with(false); + $this->request->expects($this->at(4))->method('isDispatched')->will($this->returnValue(false)); + $this->request->expects($this->at(5))->method('setDispatched')->with(true); + $this->request->expects($this->at(6))->method('isDispatched')->will($this->returnValue(true)); + + $this->assertEquals($response, $this->model->dispatch($this->request)); } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/App/RequestFactoryTest.php b/dev/tests/unit/testsuite/Magento/Framework/App/RequestFactoryTest.php new file mode 100644 index 00000000000..cdaacceb349 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/App/RequestFactoryTest.php @@ -0,0 +1,61 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Framework\App; + +class RequestFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var RequestFactory + */ + protected $model; + + /** + * @var \Magento\Framework\ObjectManager|\PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + + protected function setUp() + { + $this->objectManagerMock = $this->getMock('Magento\Framework\ObjectManager'); + $this->model = new RequestFactory($this->objectManagerMock); + } + + /** + * @covers \Magento\Framework\App\RequestFactory::__construct + * @covers \Magento\Framework\App\RequestFactory::create + */ + public function testCreate() + { + $arguments = ['some_key' => 'same_value']; + + $appRequest = $this->getMock('Magento\Framework\App\RequestInterface'); + + $this->objectManagerMock->expects($this->once()) + ->method('create') + ->with('Magento\Framework\App\RequestInterface', $arguments) + ->will($this->returnValue($appRequest)); + + $this->assertEquals($appRequest, $this->model->create($arguments)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/App/RouterListTest.php b/dev/tests/unit/testsuite/Magento/Framework/App/RouterListTest.php index 57bb70a4d76..517b3fb5e3c 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/App/RouterListTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/App/RouterListTest.php @@ -30,35 +30,88 @@ class RouterListTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Framework\App\RouterList */ - protected $_model; + protected $model; /** - * @var \Magento\Framework\ObjectManager + * @var \Magento\Framework\ObjectManager|\PHPUnit_Framework_MockObject_MockObject */ - protected $_objectManagerMock; + protected $objectManagerMock; /** * @var array */ - protected $_routerList; + protected $routerList; protected function setUp() { - $this->_routerList = array( + $this->routerList = array( 'adminRouter' => array('class' => 'AdminClass', 'disable' => true, 'sortOrder' => 10), 'frontendRouter' => array('class' => 'FrontClass', 'disable' => false, 'sortOrder' => 10), - 'default' => array('class' => 'DefaultClass', 'disable' => false, 'sortOrder' => 5) + 'default' => array('class' => 'DefaultClass', 'disable' => false, 'sortOrder' => 5), + 'someRouter' => array('class' => 'SomeClass', 'disable' => false, 'sortOrder' => 10), + 'anotherRouter' => array('class' => 'AnotherClass', 'disable' => false, 'sortOrder' => 15), ); - $this->_objectManagerMock = $this->getMock('Magento\Framework\ObjectManager'); - $this->_model = new \Magento\Framework\App\RouterList($this->_objectManagerMock, $this->_routerList); + $this->objectManagerMock = $this->getMock('Magento\Framework\ObjectManager'); + $this->model = new \Magento\Framework\App\RouterList($this->objectManagerMock, $this->routerList); } - public function testGetRoutes() + public function testCurrent() + { + $expectedClass = new DefaultClass(); + $this->objectManagerMock->expects($this->at(0)) + ->method('create') + ->with('DefaultClass') + ->will($this->returnValue($expectedClass)); + + $this->assertEquals($expectedClass, $this->model->current()); + } + + public function testNext() { $expectedClass = new FrontClass(); - $this->_objectManagerMock->expects($this->at(0))->method('create')->will($this->returnValue($expectedClass)); + $this->objectManagerMock->expects($this->at(0)) + ->method('create') + ->with('FrontClass') + ->will($this->returnValue($expectedClass)); + + $this->model->next(); + $this->assertEquals($expectedClass, $this->model->current()); + } + + public function testValid() + { + $this->assertTrue($this->model->valid()); + $this->model->next(); + $this->assertTrue($this->model->valid()); + $this->model->next(); + $this->assertTrue($this->model->valid()); + $this->model->next(); + $this->assertTrue($this->model->valid()); + $this->model->next(); + $this->assertFalse($this->model->valid()); + } + + public function testRewind() + { + $frontClass = new FrontClass(); + $defaultClass = new DefaultClass(); - $this->assertEquals($expectedClass, $this->_model->current('frontendRouter')); + $this->objectManagerMock->expects($this->at(0)) + ->method('create') + ->with('DefaultClass') + ->will($this->returnValue($defaultClass)); + + $this->objectManagerMock->expects($this->at(1)) + ->method('create') + ->with('FrontClass') + ->will($this->returnValue($frontClass)); + + $this->assertEquals($defaultClass, $this->model->current()); + $this->model->next(); + $this->assertEquals($frontClass, $this->model->current()); + $this->model->rewind(); + $this->assertEquals($defaultClass, $this->model->current()); } + } diff --git a/dev/tests/unit/testsuite/Magento/Framework/App/StateTest.php b/dev/tests/unit/testsuite/Magento/Framework/App/StateTest.php index 2a7245ef87d..e54fa456a43 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/App/StateTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/App/StateTest.php @@ -28,63 +28,96 @@ class StateTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Framework\App\State */ - protected $_model; + protected $model; /** * @var \Magento\Framework\Config\ScopeInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $_scopeMock; + protected $scopeMock; protected function setUp() { - $this->_scopeMock = $this->getMockForAbstractClass( + $this->scopeMock = $this->getMockForAbstractClass( 'Magento\Framework\Config\ScopeInterface', array('setCurrentScope'), '', false ); - $this->_model = new \Magento\Framework\App\State($this->_scopeMock, time()); + $this->model = new \Magento\Framework\App\State($this->scopeMock, '0'); + } + + public function testIsInstalled() + { + $this->assertFalse($this->model->isInstalled()); + $this->model->setInstallDate(strtotime('now')); + $this->assertTrue($this->model->isInstalled()); + } + + public function testSetGetUpdateMode() + { + $this->assertFalse($this->model->getUpdateMode()); + $this->model->setUpdateMode(true); + $this->assertTrue($this->model->getUpdateMode()); } public function testSetAreaCode() { $areaCode = 'some code'; - $this->_scopeMock->expects($this->once())->method('setCurrentScope')->with($areaCode); - $this->_model->setAreaCode($areaCode); + $this->scopeMock->expects($this->once())->method('setCurrentScope')->with($areaCode); + $this->model->setAreaCode($areaCode); $this->setExpectedException('Magento\Framework\Exception'); - $this->_model->setAreaCode('any code'); + $this->model->setAreaCode('any code'); } public function testGetAreaCodeException() { - $this->_scopeMock->expects($this->never())->method('setCurrentScope'); + $this->scopeMock->expects($this->never())->method('setCurrentScope'); $this->setExpectedException('Magento\Framework\Exception'); - $this->_model->getAreaCode(); + $this->model->getAreaCode(); } public function testGetAreaCode() { $areaCode = 'some code'; - $this->_scopeMock->expects($this->once())->method('setCurrentScope')->with($areaCode); - $this->_model->setAreaCode($areaCode); - $this->assertEquals($areaCode, $this->_model->getAreaCode()); + $this->scopeMock->expects($this->once())->method('setCurrentScope')->with($areaCode); + $this->model->setAreaCode($areaCode); + $this->assertEquals($areaCode, $this->model->getAreaCode()); } public function testEmulateAreaCode() { $areaCode = 'original code'; $emulatedCode = 'emulated code'; - $this->_scopeMock->expects($this->once())->method('setCurrentScope')->with($areaCode); - $this->_model->setAreaCode($areaCode); + $this->scopeMock->expects($this->once())->method('setCurrentScope')->with($areaCode); + $this->model->setAreaCode($areaCode); $this->assertEquals( $emulatedCode, - $this->_model->emulateAreaCode($emulatedCode, array($this, 'emulateAreaCodeCallback')) + $this->model->emulateAreaCode($emulatedCode, array($this, 'emulateAreaCodeCallback')) ); - $this->assertEquals($this->_model->getAreaCode(), $areaCode); + $this->assertEquals($this->model->getAreaCode(), $areaCode); } public function emulateAreaCodeCallback() { - return $this->_model->getAreaCode(); + return $this->model->getAreaCode(); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Some error + */ + public function testEmulateAreaCodeException() + { + $areaCode = 'original code'; + $emulatedCode = 'emulated code'; + $this->scopeMock->expects($this->once())->method('setCurrentScope')->with($areaCode); + $this->model->setAreaCode($areaCode); + $this->model->emulateAreaCode($emulatedCode, array($this, 'emulateAreaCodeCallbackException')); + $this->assertEquals($this->model->getAreaCode(), $areaCode); + } + + public function emulateAreaCodeCallbackException() + { + throw new \Exception('Some error'); } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Cache/Backend/DatabaseTest.php b/dev/tests/unit/testsuite/Magento/Framework/Cache/Backend/DatabaseTest.php new file mode 100644 index 00000000000..b8903b08bac --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Cache/Backend/DatabaseTest.php @@ -0,0 +1,719 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Framework\Cache\Backend; + +class DatabaseTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + public function setUp() + { + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + } + + /** + * @param array $options + * + * @expectedException \Zend_Cache_Exception + * @dataProvider initializeWithExceptionDataProvider + */ + public function testInitializeWithException($options) + { + $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + [ + 'options' => $options, + ] + ); + } + + /** + * @return array + */ + public function initializeWithExceptionDataProvider() + { + return [ + 'empty_adapter' => [ + 'options' => [ + 'adapter_callback' => '', + 'data_table' => 'data_table', + 'data_table_callback' => 'data_table_callback', + 'tags_table' => 'tags_table', + 'tags_table_callback' => 'tags_table_callback', + 'adapter' => '' + ] + ], + 'empty_data_table' => [ + 'options' => [ + 'adapter_callback' => '', + 'data_table' => '', + 'data_table_callback' => '', + 'tags_table' => 'tags_table', + 'tags_table_callback' => 'tags_table_callback', + 'adapter' => $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', [], '', false) + ] + ], + 'empty_tags_table' => [ + 'options' => [ + 'adapter_callback' => '', + 'data_table' => 'data_table', + 'data_table_callback' => 'data_table_callback', + 'tags_table' => '', + 'tags_table_callback' => '', + 'adapter' => $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', [], '', false) + ] + ], + ]; + } + + /** + * @param array $options + * @param bool|string $expected + * + * @dataProvider loadDataProvider + */ + public function testLoad($options, $expected) + { + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $options] + ); + + $this->assertEquals($expected, $database->load(5)); + $this->assertEquals($expected, $database->load(5, true)); + } + + /** + * @return array + */ + public function loadDataProvider() + { + $adapterMock = $this->getMockBuilder('Zend_Db_Adapter_Abstract') + ->setMethods(['select', 'fetchOne']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $selectMock = $this->getMock('Zend_Db_Select', ['where', 'from'], [], '', false); + + $selectMock->expects($this->any()) + ->method('where') + ->will($this->returnSelf()); + + $selectMock->expects($this->any()) + ->method('from') + ->will($this->returnSelf()); + + $adapterMock->expects($this->any()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $adapterMock->expects($this->any()) + ->method('fetchOne') + ->will($this->returnValue('loaded_value')); + + return [ + 'with_store_data' => [ + 'options' => $this->getOptionsWithStoreData($adapterMock), + 'expected' => 'loaded_value' + + ], + 'without_store_data' => [ + 'options' => $this->getOptionsWithoutStoreData(), + 'expected' => false + ], + ]; + } + + /** + * @param \Zend_Db_Adapter_Abstract|\PHPUnit_Framework_MockObject_MockObject $adapterMock + * @return array + */ + public function getOptionsWithStoreData($adapterMock) + { + return [ + 'adapter_callback' => '', + 'data_table' => 'data_table', + 'data_table_callback' => 'data_table_callback', + 'tags_table' => 'tags_table', + 'tags_table_callback' => 'tags_table_callback', + 'store_data' => 'store_data', + 'adapter' => $adapterMock, + ]; + } + + /** + * @param null|\Zend_Db_Adapter_Abstract|\PHPUnit_Framework_MockObject_MockObject $adapterMock + * @return array + */ + public function getOptionsWithoutStoreData($adapterMock = null) + { + if (null === $adapterMock) { + $adapterMock = $this->getMockBuilder('Zend_Db_Adapter_Abstract')->disableOriginalConstructor() + ->getMockForAbstractClass(); + } + + return [ + 'adapter_callback' => '', + 'data_table' => 'data_table', + 'data_table_callback' => 'data_table_callback', + 'tags_table' => 'tags_table', + 'tags_table_callback' => 'tags_table_callback', + 'store_data' => '', + 'adapter' => $adapterMock + ]; + } + + /** + * @param array $options + * @param bool|string $expected + * + * @dataProvider loadDataProvider + */ + public function testTest($options, $expected) + { + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $options] + ); + + $this->assertEquals($expected, $database->load(5)); + $this->assertEquals($expected, $database->load(5, true)); + } + + /** + * @param array $options + * @param bool $expected + * + * @dataProvider saveDataProvider + */ + public function testSave($options, $expected) + { + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $options] + ); + + $this->assertEquals($expected, $database->save('data', 4)); + } + + /** + * @return array + */ + public function saveDataProvider() + { + return [ + 'major_case_with_store_data' => [ + 'options' => $this->getOptionsWithStoreData($this->getSaveAdapterMock(true)), + 'expected' => true + ], + 'minor_case_with_store_data' => [ + 'options' => $this->getOptionsWithStoreData($this->getSaveAdapterMock(false)), + 'expected' => false + ], + 'without_store_data' => [ + 'options' => $this->getOptionsWithoutStoreData(), + 'expected' => true + ], + ]; + } + + /** + * @param bool $result + * @return \Zend_Db_Adapter_Abstract|\PHPUnit_Framework_MockObject_MockObject + */ + protected function getSaveAdapterMock($result) + { + $adapterMock = $this->getMockBuilder('Zend_Db_Adapter_Abstract') + ->setMethods(['quoteIdentifier', 'query']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $dbStatementMock = $this->getMockBuilder('Zend_Db_Statement_Interface') + ->setMethods(['rowCount']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $dbStatementMock->expects($this->any()) + ->method('rowCount') + ->will($this->returnValue($result)); + + $adapterMock->expects($this->any()) + ->method('quoteIdentifier') + ->will($this->returnValue('data')); + + $adapterMock->expects($this->any()) + ->method('query') + ->will($this->returnValue($dbStatementMock)); + + return $adapterMock; + } + + /** + * @param array $options + * @param bool $expected + * + * @dataProvider removeDataProvider + */ + public function testRemove($options, $expected) + { + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $options] + ); + + $this->assertEquals($expected, $database->remove(3)); + } + + /** + * @return array + */ + public function removeDataProvider() + { + $adapterMock = $this->getMockBuilder('Zend_Db_Adapter_Abstract') + ->setMethods(['delete']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $adapterMock->expects($this->any()) + ->method('delete') + ->will($this->returnValue(true)); + + return [ + 'with_store_data' => [ + 'options' => $this->getOptionsWithStoreData($adapterMock), + 'expected' => true + + ], + 'without_store_data' => [ + 'options' => $this->getOptionsWithoutStoreData(), + 'expected' => false + ], + ]; + } + + /** + * @param array $options + * @param string $mode + * @param bool $expected + * + * @dataProvider cleanDataProvider + */ + public function testClean($options, $mode, $expected) + { + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $options] + ); + + $this->assertEquals($expected, $database->clean($mode)); + } + + /** + * @return array + */ + public function cleanDataProvider() + { + $adapterMock = $this->getMockBuilder('Zend_Db_Adapter_Abstract') + ->setMethods(['query', 'delete']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $adapterMock->expects($this->any()) + ->method('query') + ->will($this->returnValue(false)); + + $adapterMock->expects($this->any()) + ->method('delete') + ->will($this->returnValue(true)); + + return [ + 'mode_all_with_store_data' => [ + 'options' => $this->getOptionsWithStoreData($adapterMock), + 'mode' => \Zend_Cache::CLEANING_MODE_ALL, + 'expected' => false + + ], + 'mode_all_without_store_data' => [ + 'options' => $this->getOptionsWithoutStoreData($adapterMock), + 'mode' => \Zend_Cache::CLEANING_MODE_ALL, + 'expected' => false + ], + 'mode_old_with_store_data' => [ + 'options' => $this->getOptionsWithStoreData($adapterMock), + 'mode' => \Zend_Cache::CLEANING_MODE_OLD, + 'expected' => true + + ], + 'mode_old_without_store_data' => [ + 'options' => $this->getOptionsWithoutStoreData($adapterMock), + 'mode' => \Zend_Cache::CLEANING_MODE_OLD, + 'expected' => true + ], + 'mode_matching_tag_without_store_data' => [ + 'options' => $this->getOptionsWithoutStoreData($adapterMock), + 'mode' => \Zend_Cache::CLEANING_MODE_MATCHING_TAG, + 'expected' => true + ], + 'mode_not_matching_tag_without_store_data' => [ + 'options' => $this->getOptionsWithoutStoreData($adapterMock), + 'mode' => \Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG, + 'expected' => true + ], + 'mode_matching_any_tag_without_store_data' => [ + 'options' => $this->getOptionsWithoutStoreData($adapterMock), + 'mode' => \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, + 'expected' => true + ], + ]; + } + + /** + * @expectedException \Zend_Cache_Exception + */ + public function testCleanException() + { + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $this->getOptionsWithoutStoreData()] + ); + + $database->clean('my_unique_mode'); + } + + /** + * @param array $options + * @param array $expected + * + * @dataProvider getIdsDataProvider + */ + public function testGetIds($options, $expected) + { + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $options] + ); + + $this->assertEquals($expected, $database->getIds()); + } + + /** + * @return array + */ + public function getIdsDataProvider() + { + $adapterMock = $this->getMockBuilder('Zend_Db_Adapter_Abstract') + ->setMethods(['select', 'fetchCol']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $selectMock = $this->getMock('Zend_Db_Select', ['from'], [], '', false); + + $selectMock->expects($this->any()) + ->method('from') + ->will($this->returnSelf()); + + $adapterMock->expects($this->any()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $adapterMock->expects($this->any()) + ->method('fetchCol') + ->will($this->returnValue(['value_one', 'value_two'])); + + return [ + 'with_store_data' => [ + 'options' => $this->getOptionsWithStoreData($adapterMock), + 'expected' => ['value_one', 'value_two'] + + ], + 'without_store_data' => [ + 'options' => $this->getOptionsWithoutStoreData(), + 'expected' => [] + ], + ]; + } + + public function testGetTags() + { + $adapterMock = $this->getMockBuilder('Zend_Db_Adapter_Abstract') + ->setMethods(['select', 'fetchCol']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $selectMock = $this->getMock('Zend_Db_Select', ['from', 'distinct'], [], '', false); + + $selectMock->expects($this->any()) + ->method('from') + ->will($this->returnSelf()); + + $selectMock->expects($this->any()) + ->method('distinct') + ->will($this->returnSelf()); + + $adapterMock->expects($this->any()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $adapterMock->expects($this->any()) + ->method('fetchCol') + ->will($this->returnValue(['value_one', 'value_two'])); + + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $this->getOptionsWithStoreData($adapterMock)] + ); + + $this->assertEquals(['value_one', 'value_two'], $database->getIds()); + } + + public function testGetIdsMatchingTags() + { + $adapterMock = $this->getMockBuilder('Zend_Db_Adapter_Abstract') + ->setMethods(['select', 'fetchCol']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $selectMock = $this->getMock('Zend_Db_Select', ['from', 'distinct', 'where', 'group', 'having'], [], '', false); + + $selectMock->expects($this->any()) + ->method('from') + ->will($this->returnSelf()); + + $selectMock->expects($this->any()) + ->method('distinct') + ->will($this->returnSelf()); + + $selectMock->expects($this->any()) + ->method('where') + ->will($this->returnSelf()); + + $selectMock->expects($this->any()) + ->method('group') + ->will($this->returnSelf()); + + $selectMock->expects($this->any()) + ->method('having') + ->will($this->returnSelf()); + + $adapterMock->expects($this->any()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $adapterMock->expects($this->any()) + ->method('fetchCol') + ->will($this->returnValue(['value_one', 'value_two'])); + + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $this->getOptionsWithStoreData($adapterMock)] + ); + + $this->assertEquals(['value_one', 'value_two'], $database->getIdsMatchingTags()); + } + + public function testGetIdsNotMatchingTags() + { + $adapterMock = $this->getMockBuilder('Zend_Db_Adapter_Abstract') + ->setMethods(['select', 'fetchCol']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $selectMock = $this->getMock('Zend_Db_Select', ['from', 'distinct', 'where', 'group', 'having'], [], '', false); + + $selectMock->expects($this->any()) + ->method('from') + ->will($this->returnSelf()); + + $selectMock->expects($this->any()) + ->method('distinct') + ->will($this->returnSelf()); + + $selectMock->expects($this->any()) + ->method('where') + ->will($this->returnSelf()); + + $selectMock->expects($this->any()) + ->method('group') + ->will($this->returnSelf()); + + $selectMock->expects($this->any()) + ->method('having') + ->will($this->returnSelf()); + + $adapterMock->expects($this->any()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $adapterMock->expects($this->at(1)) + ->method('fetchCol') + ->will($this->returnValue(['some_value_one'])); + + $adapterMock->expects($this->at(3)) + ->method('fetchCol') + ->will($this->returnValue(['some_value_two'])); + + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $this->getOptionsWithStoreData($adapterMock)] + ); + + $this->assertEquals(['some_value_one'], $database->getIdsNotMatchingTags()); + } + + public function testGetIdsMatchingAnyTags() + { + $adapterMock = $this->getMockBuilder('Zend_Db_Adapter_Abstract') + ->setMethods(['select', 'fetchCol']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $selectMock = $this->getMock('Zend_Db_Select', ['from', 'distinct'], [], '', false); + + $selectMock->expects($this->any()) + ->method('from') + ->will($this->returnSelf()); + + $selectMock->expects($this->any()) + ->method('distinct') + ->will($this->returnSelf()); + + $adapterMock->expects($this->any()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $adapterMock->expects($this->any()) + ->method('fetchCol') + ->will($this->returnValue(['some_value_one', 'some_value_two'])); + + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $this->getOptionsWithStoreData($adapterMock)] + ); + + $this->assertEquals(['some_value_one', 'some_value_two'], $database->getIds()); + } + + public function testGetMetadatas() + { + $adapterMock = $this->getMockBuilder('Zend_Db_Adapter_Abstract') + ->setMethods(['select', 'fetchCol', 'fetchRow']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $selectMock = $this->getMock('Zend_Db_Select', ['from', 'where'], [], '', false); + + $selectMock->expects($this->any()) + ->method('from') + ->will($this->returnSelf()); + + $selectMock->expects($this->any()) + ->method('where') + ->will($this->returnSelf()); + + $adapterMock->expects($this->any()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $adapterMock->expects($this->any()) + ->method('fetchCol') + ->will($this->returnValue(['some_value_one', 'some_value_two'])); + + $adapterMock->expects($this->any()) + ->method('fetchRow') + ->will($this->returnValue(['expire_time' => '3', 'update_time' => 2])); + + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $this->getOptionsWithStoreData($adapterMock)] + ); + + $this->assertEquals( + [ + 'expire' => 3, + 'mtime' => 2, + 'tags' => ['some_value_one', 'some_value_two'] + ], + $database->getMetadatas(5) + ); + } + + /** + * @param array $options + * @param bool $expected + * + * @dataProvider touchDataProvider + */ + public function testTouch($options, $expected) + { + /** @var \Magento\Framework\Cache\Backend\Database $database */ + $database = $this->objectManager->getObject( + 'Magento\Framework\Cache\Backend\Database', + ['options' => $options] + ); + + $this->assertEquals($expected, $database->touch(2, 100)); + } + + /** + * @return array + */ + public function touchDataProvider() + { + $adapterMock = $this->getMockBuilder('Zend_Db_Adapter_Abstract') + ->setMethods(['update']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $adapterMock->expects($this->any()) + ->method('update') + ->will($this->returnValue(false)); + + return [ + 'with_store_data' => [ + 'options' => $this->getOptionsWithStoreData($adapterMock), + 'expected' => false + + ], + 'without_store_data' => [ + 'options' => $this->getOptionsWithoutStoreData(), + 'expected' => true + ], + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Cache/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Framework/Cache/Config/SchemaLocatorTest.php new file mode 100644 index 00000000000..0b9f6a31951 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Cache/Config/SchemaLocatorTest.php @@ -0,0 +1,49 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Framework\Cache\Config; + +class SchemaLocatorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\Cache\Config\SchemaLocator + */ + protected $schemaLocator; + + public function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->schemaLocator = $objectManager->getObject('Magento\Framework\Cache\Config\SchemaLocator'); + } + + public function testGetSchema() + { + $this->assertRegExp('/etc[\/\\\\]cache.xsd/', $this->schemaLocator->getSchema()); + } + + public function testGetPerFileSchema() + { + $this->assertEquals(null, $this->schemaLocator->getPerFileSchema()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Cache/CoreTest.php b/dev/tests/unit/testsuite/Magento/Framework/Cache/CoreTest.php index 58ffeae5569..361f0ba7ec0 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Cache/CoreTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Cache/CoreTest.php @@ -96,4 +96,116 @@ class CoreTest extends \PHPUnit_Framework_TestCase $result = $frontend->save('data', 'id'); $this->assertTrue($result); } + + public function testSaveNoCaching() + { + $backendMock = $this->getMock('Zend_Cache_Backend_BlackHole'); + $backendMock->expects($this->never())->method('save'); + $frontend = new \Magento\Framework\Cache\Core(array('disable_save' => false, 'caching' => false)); + $frontend->setBackend($backendMock); + $result = $frontend->save('data', 'id'); + $this->assertTrue($result); + } + + public function testSave() + { + $data = 'data'; + $tags = array('abc', '!def', '_ghi'); + $prefix = 'prefix_'; + $prefixedTags = array('prefix_abc', 'prefix__def', 'prefix__ghi'); + + $backendMock = $this->getMock('Zend_Cache_Backend_BlackHole'); + $backendMock->expects($this->once()) + ->method('save') + ->with($data, $this->anything(), $prefixedTags) + ->will($this->returnValue(true)); + $frontend = new \Magento\Framework\Cache\Core([ + 'disable_save' => false, + 'caching' => true, + 'cache_id_prefix' => $prefix, + 'automatic_cleaning_factor' => 0, + 'write_control' => false + ]); + $frontend->setBackend($backendMock); + $result = $frontend->save($data, 'id', $tags); + $this->assertTrue($result); + } + + public function testClean() + { + $mode = 'all'; + $tags = array('abc', '!def', '_ghi'); + $prefix = 'prefix_'; + $prefixedTags = array('prefix_abc', 'prefix__def', 'prefix__ghi'); + $expectedResult = true; + + $backendMock = $this->getMock('Zend_Cache_Backend_BlackHole'); + $backendMock->expects($this->once()) + ->method('clean') + ->with($mode, $prefixedTags) + ->will($this->returnValue($expectedResult)); + $frontend = new \Magento\Framework\Cache\Core([ + 'caching' => true, + 'cache_id_prefix' => $prefix + ]); + $frontend->setBackend($backendMock); + + $result = $frontend->clean($mode, $tags); + $this->assertEquals($expectedResult, $result); + } + + public function testGetIdsMatchingTags() + { + $tags = array('abc', '!def', '_ghi'); + $prefix = 'prefix_'; + $prefixedTags = array('prefix_abc', 'prefix__def', 'prefix__ghi'); + $ids = array('id', 'id2', 'id3'); + + $backendMock = $this->getMock('Magento\Framework\Cache\CoreMock'); + $backendMock->expects($this->once()) + ->method('getIdsMatchingTags') + ->with($prefixedTags) + ->will($this->returnValue($ids)); + $backendMock->expects($this->any()) + ->method('getCapabilities') + ->will($this->returnValue(['tags' => true])); + $frontend = new \Magento\Framework\Cache\Core([ + 'caching' => true, + 'cache_id_prefix' => $prefix + ]); + $frontend->setBackend($backendMock); + + $result = $frontend->getIdsMatchingTags($tags); + $this->assertEquals($ids, $result); + } + + public function testGetIdsNotMatchingTags() + { + $tags = array('abc', '!def', '_ghi'); + $prefix = 'prefix_'; + $prefixedTags = array('prefix_abc', 'prefix__def', 'prefix__ghi'); + $ids = array('id', 'id2', 'id3'); + + $backendMock = $this->getMock('Magento\Framework\Cache\CoreMock'); + $backendMock->expects($this->once()) + ->method('getIdsNotMatchingTags') + ->with($prefixedTags) + ->will($this->returnValue($ids)); + $backendMock->expects($this->any()) + ->method('getCapabilities') + ->will($this->returnValue(['tags' => true])); + $frontend = new \Magento\Framework\Cache\Core([ + 'caching' => true, + 'cache_id_prefix' => $prefix + ]); + $frontend->setBackend($backendMock); + + $result = $frontend->getIdsNotMatchingTags($tags); + $this->assertEquals($ids, $result); + } + +} + +abstract class CoreMock extends \Zend_Cache_Backend implements \Zend_Cache_Backend_ExtendedInterface +{ } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Code/GeneratorTest.php b/dev/tests/unit/testsuite/Magento/Framework/Code/GeneratorTest.php index 678a9c43fc0..0e8990bd2b3 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Code/GeneratorTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Code/GeneratorTest.php @@ -35,7 +35,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase * * @var array */ - protected $_expectedEntities = array( + protected $expectedEntities = array( 'factory' => \Magento\Framework\ObjectManager\Code\Generator\Factory::ENTITY_TYPE, 'proxy' => \Magento\Framework\ObjectManager\Code\Generator\Proxy::ENTITY_TYPE, 'interceptor' => \Magento\Framework\Interception\Code\Generator\Interceptor::ENTITY_TYPE @@ -46,51 +46,51 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase * * @var \Magento\Framework\Code\Generator */ - protected $_model; + protected $model; /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Autoload\IncludePath */ - protected $_autoloader; + protected $autoloader; /** * @var \PHPUnit_Framework_MockObject_MockObject|Generator\Io */ - protected $_ioObjectMock; + protected $ioObjectMock; /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Filesystem */ - protected $_filesystemMock; + protected $filesystemMock; protected function setUp() { - $this->_autoloader = $this->getMock( + $this->autoloader = $this->getMock( 'Magento\Framework\Autoload\IncludePath', array('getFile'), array(), '', false ); - $this->_ioObjectMock = $this->getMockBuilder( - '\Magento\Framework\Code\Generator\Io' - )->disableOriginalConstructor()->getMock(); + $this->ioObjectMock = $this->getMockBuilder('\Magento\Framework\Code\Generator\Io') + ->disableOriginalConstructor() + ->getMock(); } protected function tearDown() { - unset($this->_model); - unset($this->_autoloader); + unset($this->model); + unset($this->autoloader); } public function testGetGeneratedEntities() { - $this->_model = new \Magento\Framework\Code\Generator( - $this->_autoloader, - $this->_ioObjectMock, + $this->model = new \Magento\Framework\Code\Generator( + $this->autoloader, + $this->ioObjectMock, array('factory', 'proxy', 'interceptor') ); - $this->assertEquals(array_values($this->_expectedEntities), $this->_model->getGeneratedEntities()); + $this->assertEquals(array_values($this->expectedEntities), $this->model->getGeneratedEntities()); } /** @@ -99,19 +99,14 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase */ public function testGenerateClass($className, $entityType) { - $this->_autoloader->expects( - $this->any() - )->method( - 'getFile' - )->with( - $className . $entityType - )->will( - $this->returnValue(false) - ); - - $this->_model = new \Magento\Framework\Code\Generator( - $this->_autoloader, - $this->_ioObjectMock, + $this->autoloader->expects($this->any()) + ->method('getFile') + ->with($className . $entityType) + ->will($this->returnValue(false)); + + $this->model = new \Magento\Framework\Code\Generator( + $this->autoloader, + $this->ioObjectMock, array( 'factory' => '\Magento\Framework\ObjectManager\Code\Generator\Factory', 'proxy' => '\Magento\Framework\ObjectManager\Code\Generator\Proxy', @@ -119,7 +114,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase ) ); - $this->_model->generateClass($className . $entityType); + $this->model->generateClass($className . $entityType); } /** @@ -127,19 +122,14 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase */ public function testGenerateClassWithExistName($className, $entityType) { - $this->_autoloader->expects( - $this->once() - )->method( - 'getFile' - )->with( - $className . $entityType - )->will( - $this->returnValue(true) - ); - - $this->_model = new \Magento\Framework\Code\Generator( - $this->_autoloader, - $this->_ioObjectMock, + $this->autoloader->expects($this->once()) + ->method('getFile') + ->with($className . $entityType) + ->will($this->returnValue(true)); + + $this->model = new \Magento\Framework\Code\Generator( + $this->autoloader, + $this->ioObjectMock, array( 'factory' => '\Magento\Framework\ObjectManager\Code\Generator\Factory', 'proxy' => '\Magento\Framework\ObjectManager\Code\Generator\Proxy', @@ -149,19 +139,19 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase $this->assertEquals( \Magento\Framework\Code\Generator::GENERATION_SKIP, - $this->_model->generateClass($className . $entityType) + $this->model->generateClass($className . $entityType) ); } public function testGenerateClassWithWrongName() { - $this->_autoloader->expects($this->never())->method('getFile'); + $this->autoloader->expects($this->never())->method('getFile'); - $this->_model = new \Magento\Framework\Code\Generator($this->_autoloader, $this->_ioObjectMock); + $this->model = new \Magento\Framework\Code\Generator($this->autoloader, $this->ioObjectMock); $this->assertEquals( \Magento\Framework\Code\Generator::GENERATION_ERROR, - $this->_model->generateClass(self::SOURCE_CLASS) + $this->model->generateClass(self::SOURCE_CLASS) ); } @@ -170,11 +160,11 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase */ public function testGenerateClassWithError() { - $this->_autoloader->expects($this->once())->method('getFile')->will($this->returnValue(false)); + $this->autoloader->expects($this->once())->method('getFile')->will($this->returnValue(false)); - $this->_model = new \Magento\Framework\Code\Generator( - $this->_autoloader, - $this->_ioObjectMock, + $this->model = new \Magento\Framework\Code\Generator( + $this->autoloader, + $this->ioObjectMock, array( 'factory' => '\Magento\Framework\ObjectManager\Code\Generator\Factory', 'proxy' => '\Magento\Framework\ObjectManager\Code\Generator\Proxy', @@ -182,10 +172,10 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase ) ); - $expectedEntities = array_values($this->_expectedEntities); + $expectedEntities = array_values($this->expectedEntities); $resultClassName = self::SOURCE_CLASS . ucfirst(array_shift($expectedEntities)); - $this->_model->generateClass($resultClassName); + $this->model->generateClass($resultClassName); } /** @@ -196,7 +186,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase public function generateValidClassDataProvider() { $data = array(); - foreach ($this->_expectedEntities as $generatedEntity) { + foreach ($this->expectedEntities as $generatedEntity) { $generatedEntity = ucfirst($generatedEntity); $data['test class for ' . $generatedEntity] = array( 'class name' => self::SOURCE_CLASS, diff --git a/dev/tests/unit/testsuite/Magento/Framework/Code/ValidatorTest.php b/dev/tests/unit/testsuite/Magento/Framework/Code/ValidatorTest.php new file mode 100644 index 00000000000..e283eb92a78 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Code/ValidatorTest.php @@ -0,0 +1,53 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Code + * @subpackage unit_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Framework\Code; + +class ValidatorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Validator + */ + protected $model; + + protected function setUp() + { + $this->model = new Validator(); + } + + public function testValidate() + { + $className = 'Same\Class\Name'; + $validator1 = $this->getMock('Magento\Framework\Code\ValidatorInterface'); + $validator1->expects($this->once())->method('validate')->with($className); + $validator2 = $this->getMock('Magento\Framework\Code\ValidatorInterface'); + $validator2->expects($this->once())->method('validate')->with($className); + + $this->model->add($validator1); + $this->model->add($validator2); + $this->model->validate($className); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Config/_files/converter/dom/cdata.php b/dev/tests/unit/testsuite/Magento/Framework/Config/_files/converter/dom/cdata.php index ca689ddbd7b..28c570e2297 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Config/_files/converter/dom/cdata.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Config/_files/converter/dom/cdata.php @@ -36,4 +36,4 @@ return array( ), ), ), -); \ No newline at end of file +); diff --git a/dev/tests/unit/testsuite/Magento/Framework/Model/AbstractModelTest.php b/dev/tests/unit/testsuite/Magento/Framework/Model/AbstractModelTest.php index 5ecd0b3d679..abce177ec60 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Model/AbstractModelTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Model/AbstractModelTest.php @@ -64,7 +64,11 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->actionValidatorMock = $this->getMock( - '\Magento\Framework\Model\ActionValidator\RemoveAction', array(), array(), '', false + '\Magento\Framework\Model\ActionValidator\RemoveAction', + array(), + array(), + '', + false ); $this->contextMock = new \Magento\Framework\Model\Context( $this->getMock('Magento\Framework\Logger', array(), array(), '', false), diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/Dir/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/Dir/ReaderTest.php index d1b6072e948..15fd1965cb4 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/Dir/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/Dir/ReaderTest.php @@ -28,8 +28,8 @@ */ namespace Magento\Framework\Module\Dir; -use \Magento\Framework\App\Filesystem, - \Magento\Framework\Config\FileIteratorFactory; +use \Magento\Framework\App\Filesystem; +use \Magento\Framework\Config\FileIteratorFactory; class ReaderTest extends \PHPUnit_Framework_TestCase { @@ -79,13 +79,31 @@ class ReaderTest extends \PHPUnit_Framework_TestCase false ); $this->_dirsMock = $this->getMock('Magento\Framework\Module\Dir', array(), array(), '', false, false); - $this->_baseConfigMock = - $this->getMock('Magento\Framework\App\Config\Base', array(), array(), '', false, false); + $this->_baseConfigMock = $this->getMock( + 'Magento\Framework\App\Config\Base', + array(), + array(), + '', + false, + false + ); $this->_moduleListMock = $this->getMock('Magento\Framework\Module\ModuleListInterface'); - $this->_filesystemMock = - $this->getMock('\Magento\Framework\App\Filesystem', array(), array(), '', false, false); - $this->_fileIteratorFactory = - $this->getMock('\Magento\Framework\Config\FileIteratorFactory', array(), array(), '', false, false); + $this->_filesystemMock = $this->getMock( + '\Magento\Framework\App\Filesystem', + array(), + array(), + '', + false, + false + ); + $this->_fileIteratorFactory = $this->getMock( + '\Magento\Framework\Config\FileIteratorFactory', + array(), + array(), + '', + false, + false + ); $this->_model = new \Magento\Framework\Module\Dir\Reader( $this->_dirsMock, @@ -147,5 +165,4 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals($configPath, $model->getConfigurationFiles('config.xml')->key()); } - } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/ModuleListTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/ModuleListTest.php index 1403a34bbbf..b32b1f31a3e 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/ModuleListTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/ModuleListTest.php @@ -91,5 +91,4 @@ class ModuleListTest extends \PHPUnit_Framework_TestCase $this->assertEquals($moduleData, $model->getModule('declared_module')); $this->assertNull($model->getModule('not_declared_module')); } - } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php b/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php index d7df236618f..2b75fe0a8f6 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Module/UpdaterTest.php @@ -178,5 +178,4 @@ class UpdaterTest extends \PHPUnit_Framework_TestCase $this->_model->updateScheme(); $this->_model->updateData(); } - } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Object/Copy/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Framework/Object/Copy/Config/SchemaLocatorTest.php index faee879832f..945a6f623c2 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Object/Copy/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Object/Copy/Config/SchemaLocatorTest.php @@ -41,7 +41,10 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase { $this->fileSystemMock = $this->getMock( 'Magento\Framework\App\Filesystem', - array(), array(), '', false + array(), + array(), + '', + false ); $this->fileSystemMock->expects($this->any()) ->method('getPath') diff --git a/dev/tests/unit/testsuite/Magento/Framework/Object/CopyTest.php b/dev/tests/unit/testsuite/Magento/Framework/Object/CopyTest.php index cafcbeea611..943c88b0978 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Object/CopyTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Object/CopyTest.php @@ -68,8 +68,10 @@ class CopyTest extends \PHPUnit_Framework_TestCase public function testCopyFieldsetToTargetWhenFieldsetInputInvalid() { $this->fieldsetConfigMock->expects($this->never())->method('getFieldset'); - $this->assertEquals(null, - $this->copy->copyFieldsetToTarget('fieldset', 'aspect', array(), 'target')); + $this->assertEquals( + null, + $this->copy->copyFieldsetToTarget('fieldset', 'aspect', array(), 'target') + ); } public function testCopyFieldsetToTargetWhenFieldIsNotExists() @@ -80,8 +82,10 @@ class CopyTest extends \PHPUnit_Framework_TestCase ->with('fieldset', 'global') ->will($this->returnValue(null)); $this->eventManagerMock->expects($this->never())->method('dispatch'); - $this->assertEquals(array($this->targetMock), - $this->copy->copyFieldsetToTarget('fieldset', 'aspect', $this->sourceMock, array($this->targetMock))); + $this->assertEquals( + array($this->targetMock), + $this->copy->copyFieldsetToTarget('fieldset', 'aspect', $this->sourceMock, array($this->targetMock)) + ); } public function testCopyFieldsetToTargetWhenFieldExists() @@ -100,8 +104,10 @@ class CopyTest extends \PHPUnit_Framework_TestCase 'root' => 'global' ); $this->eventManagerMock->expects($this->once())->method('dispatch')->with($eventName, $data); - $this->assertEquals(array($this->targetMock), - $this->copy->copyFieldsetToTarget('fieldset', 'aspect', $this->sourceMock, array($this->targetMock))); + $this->assertEquals( + array($this->targetMock), + $this->copy->copyFieldsetToTarget('fieldset', 'aspect', $this->sourceMock, array($this->targetMock)) + ); } public function testCopyFieldsetToTargetWhenTargetNotArray() @@ -131,8 +137,10 @@ class CopyTest extends \PHPUnit_Framework_TestCase 'root' => 'global' ); $this->eventManagerMock->expects($this->once())->method('dispatch')->with($eventName, $data); - $this->assertEquals($this->targetMock, - $this->copy->copyFieldsetToTarget('fieldset', 'aspect', $this->sourceMock, $this->targetMock)); + $this->assertEquals( + $this->targetMock, + $this->copy->copyFieldsetToTarget('fieldset', 'aspect', $this->sourceMock, $this->targetMock) + ); } public function testGetCopyFieldsetToTargetWhenTargetIsArray() @@ -158,7 +166,6 @@ class CopyTest extends \PHPUnit_Framework_TestCase $newTarget = array( 'code' => array(), 'value' => 'value' - ); $data = array( 'target' => $newTarget, @@ -166,8 +173,10 @@ class CopyTest extends \PHPUnit_Framework_TestCase 'root' => 'global' ); $this->eventManagerMock->expects($this->once())->method('dispatch')->with($eventName, $data); - $this->assertEquals($newTarget, - $this->copy->copyFieldsetToTarget('fieldset', 'aspect', $this->sourceMock, $target)); + $this->assertEquals( + $newTarget, + $this->copy->copyFieldsetToTarget('fieldset', 'aspect', $this->sourceMock, $target) + ); } public function testGetDataFromFieldsetWhenSourceIsInvalid() @@ -203,8 +212,10 @@ class CopyTest extends \PHPUnit_Framework_TestCase ->with('code') ->will($this->returnValue('value')); - $this->assertEquals(array('value' => 'value'), - $this->copy->getDataFromFieldset('fieldset', 'aspect', $this->sourceMock)); + $this->assertEquals( + array('value' => 'value'), + $this->copy->getDataFromFieldset('fieldset', 'aspect', $this->sourceMock) + ); } @@ -220,7 +231,9 @@ class CopyTest extends \PHPUnit_Framework_TestCase ->expects($this->never()) ->method('getDataUsingMethod'); - $this->assertEquals(array(), - $this->copy->getDataFromFieldset('fieldset', 'aspect', $this->sourceMock)); + $this->assertEquals( + array(), + $this->copy->getDataFromFieldset('fieldset', 'aspect', $this->sourceMock) + ); } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/FactoryTest.php index 31293e11a40..491cca92e5a 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/FactoryTest.php @@ -39,7 +39,8 @@ class FactoryTest extends \PHPUnit_Framework_TestCase public function testGenerate() { require_once __DIR__ . '/_files/Sample.php'; - $model = $this->getMock('\Magento\Framework\ObjectManager\Code\Generator\Factory', + $model = $this->getMock( + '\Magento\Framework\ObjectManager\Code\Generator\Factory', array('_validateData'), array('\Magento\Framework\ObjectManager\Code\Generator\Sample', null, $this->ioObjectMock, null, null) ); @@ -54,6 +55,4 @@ class FactoryTest extends \PHPUnit_Framework_TestCase $model->expects($this->once())->method('_validateData')->will($this->returnValue(true)); $this->assertTrue($model->generate()); } - - -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/ProxyTest.php b/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/ProxyTest.php index da59d0722ed..78526f6611c 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/ProxyTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/ProxyTest.php @@ -39,7 +39,8 @@ class ProxyTest extends \PHPUnit_Framework_TestCase public function testGenerate() { require_once __DIR__ . '/_files/Sample.php'; - $model = $this->getMock('\Magento\Framework\ObjectManager\Code\Generator\Proxy', + $model = $this->getMock( + '\Magento\Framework\ObjectManager\Code\Generator\Proxy', array('_validateData'), array('\Magento\Framework\ObjectManager\Code\Generator\Sample', null, $this->ioObjectMock, null, null) ); @@ -54,6 +55,4 @@ class ProxyTest extends \PHPUnit_Framework_TestCase $model->expects($this->once())->method('_validateData')->will($this->returnValue(true)); $this->assertTrue($model->generate()); } - - -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/_files/Sample.php b/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/_files/Sample.php index 2ed50fc7671..3e4ef36664e 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/_files/Sample.php +++ b/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Code/Generator/_files/Sample.php @@ -49,4 +49,4 @@ class Sample { return $this->messages; } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Definition/Compiled/BinaryTest.php b/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Definition/Compiled/BinaryTest.php index 2001af54679..1a31dedbcfb 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Definition/Compiled/BinaryTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Definition/Compiled/BinaryTest.php @@ -36,4 +36,4 @@ class BinaryTest extends \PHPUnit_Framework_TestCase $model = new \Magento\Framework\ObjectManager\Definition\Compiled\Binary(array($signatures, $definitions)); $this->assertEquals($checkString, $model->getParameters('wonderful')); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Definition/Compiled/SerializedTest.php b/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Definition/Compiled/SerializedTest.php index 7dd40436de0..066683f92c9 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Definition/Compiled/SerializedTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Definition/Compiled/SerializedTest.php @@ -50,4 +50,4 @@ class SerializedTest extends \PHPUnit_Framework_TestCase $model = new \Magento\Framework\ObjectManager\Definition\Compiled\Serialized(array($signatures, $definitions)); $this->assertEquals($checkString, $model->getParameters('wonderful')); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Relations/CompiledTest.php b/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Relations/CompiledTest.php index a58ea811e25..174ef4e18c8 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Relations/CompiledTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Relations/CompiledTest.php @@ -44,4 +44,4 @@ class CompiledTest extends \PHPUnit_Framework_TestCase $model = new \Magento\Framework\ObjectManager\Relations\Compiled($relations); $this->assertEquals('parents', $model->getParents('amazing')); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Service/DataObjectConverterTest.php b/dev/tests/unit/testsuite/Magento/Framework/Service/DataObjectConverterTest.php index 8297e6c91cf..0f94cc8a693 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Service/DataObjectConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Service/DataObjectConverterTest.php @@ -105,7 +105,7 @@ class DataObjectConverterTest extends \PHPUnit_Framework_TestCase public function testConvertSoapStdObjectToArray() { - $stdObject = json_decode(json_encode($this->getCustomerDetails()->__toArray()), FALSE); + $stdObject = json_decode(json_encode($this->getCustomerDetails()->__toArray()), false); $addresses = $stdObject->addresses; unset($stdObject->addresses); $stdObject->addresses = new \stdClass(); @@ -215,5 +215,4 @@ class DataObjectConverterTest extends \PHPUnit_Framework_TestCase return $customerDetails; } - } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Translate/Inline/ProxyTest.php b/dev/tests/unit/testsuite/Magento/Framework/Translate/Inline/ProxyTest.php index 159a226520b..455da0fae64 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Translate/Inline/ProxyTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Translate/Inline/ProxyTest.php @@ -52,11 +52,11 @@ class ProxyTest extends \PHPUnit_Framework_TestCase $this->objectManagerMock->expects( $this->once() )->method( - 'get' + 'get' )->with( - 'Magento\Framework\Translate\Inline' + 'Magento\Framework\Translate\Inline' )->will( - $this->returnValue($this->translateMock) + $this->returnValue($this->translateMock) ); $this->objectManagerMock->expects($this->never())->method('create'); $this->translateMock->expects($this->once())->method('isAllowed')->will($this->returnValue(false)); @@ -150,4 +150,4 @@ class ProxyTest extends \PHPUnit_Framework_TestCase $this->assertEquals('some_value', $model->getAdditionalHtmlAttribute('some_value')); $this->assertNull($model->getAdditionalHtmlAttribute()); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Translate/InlineTest.php b/dev/tests/unit/testsuite/Magento/Framework/Translate/InlineTest.php index e6006fb38d4..08e2ab8cbf7 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Translate/InlineTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Translate/InlineTest.php @@ -252,27 +252,27 @@ class InlineTest extends \PHPUnit_Framework_TestCase $this->parserMock->expects( $this->exactly($jsonCall) )->method( - 'setIsJson' - )->will( - $this->returnValueMap(array( - array($isJson, $this->returnSelf()), - array(!$isJson, $this->returnSelf()), - )) - ); + 'setIsJson' + )->will( + $this->returnValueMap(array( + array($isJson, $this->returnSelf()), + array(!$isJson, $this->returnSelf()), + )) + ); $this->parserMock->expects( $this->exactly(1) )->method( - 'processResponseBodyString' - )->with( - is_array($body) ? reset($body) : $body - ); + 'processResponseBodyString' + )->with( + is_array($body) ? reset($body) : $body + ); $this->parserMock->expects( $this->exactly(2) )->method( - 'getContent' - )->will( - $this->returnValue(is_array($body) ? reset($body) : $body) - ); + 'getContent' + )->will( + $this->returnValue(is_array($body) ? reset($body) : $body) + ); $model = new Inline( $this->scopeResolverMock, diff --git a/dev/tests/unit/testsuite/Magento/LayeredNavigation/Block/NavigationTest.php b/dev/tests/unit/testsuite/Magento/LayeredNavigation/Block/NavigationTest.php index 97e90575749..37cef8b0e09 100644 --- a/dev/tests/unit/testsuite/Magento/LayeredNavigation/Block/NavigationTest.php +++ b/dev/tests/unit/testsuite/Magento/LayeredNavigation/Block/NavigationTest.php @@ -56,7 +56,11 @@ class NavigationTest extends \PHPUnit_Framework_TestCase $this->catalogLayerMock = $this->getMock('\Magento\Catalog\Model\Layer', array(), array(), '', false); $this->filterListMock = $this->getMock('\Magento\Catalog\Model\Layer\FilterList', array(), array(), '', false); $this->visibilityFlagMock = $this->getMock( - '\Magento\Catalog\Model\Layer\AvailabilityFlagInterface', array(), array(), '', false + '\Magento\Catalog\Model\Layer\AvailabilityFlagInterface', + array(), + array(), + '', + false ); $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); @@ -122,7 +126,9 @@ class NavigationTest extends \PHPUnit_Framework_TestCase $blockMock = $this->getMockForAbstractClass( '\Magento\Framework\View\Element\AbstractBlock', - array(), '', false + array(), + '', + false ); $clearUrl = 'very clear URL'; $blockMock->setClearUrl($clearUrl); diff --git a/dev/tests/unit/testsuite/Magento/Newsletter/Model/Queue/TransportBuilderTest.php b/dev/tests/unit/testsuite/Magento/Newsletter/Model/Queue/TransportBuilderTest.php index 5f02dd5e1e9..48e2d424fb9 100644 --- a/dev/tests/unit/testsuite/Magento/Newsletter/Model/Queue/TransportBuilderTest.php +++ b/dev/tests/unit/testsuite/Magento/Newsletter/Model/Queue/TransportBuilderTest.php @@ -113,12 +113,12 @@ class TransportBuilderTest extends \Magento\Framework\Mail\Template\TransportBui $this->_mailTransportFactoryMock->expects( $this->at(0) )->method( - 'create' - )->with( - $this->equalTo(array('message' => $this->messageMock)) - )->will( - $this->returnValue($transport) - ); + 'create' + )->with( + $this->equalTo(array('message' => $this->messageMock)) + )->will( + $this->returnValue($transport) + ); $this->objectManagerMock->expects( $this->at(0) diff --git a/dev/tests/unit/testsuite/Magento/PageCache/Block/Controller/StubBlock.php b/dev/tests/unit/testsuite/Magento/PageCache/Block/Controller/StubBlock.php index ad29160836f..74c3eb20e32 100644 --- a/dev/tests/unit/testsuite/Magento/PageCache/Block/Controller/StubBlock.php +++ b/dev/tests/unit/testsuite/Magento/PageCache/Block/Controller/StubBlock.php @@ -38,4 +38,4 @@ class StubBlock extends AbstractBlock implements IdentityInterface { return array('identity1', 'identity2'); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Review/Model/Resource/Review/Summary/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Review/Model/Resource/Review/Summary/CollectionTest.php index 323656377de..b0794f55546 100644 --- a/dev/tests/unit/testsuite/Magento/Review/Model/Resource/Review/Summary/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Review/Model/Resource/Review/Summary/CollectionTest.php @@ -64,20 +64,38 @@ class CollectionTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->fetchStrategyMock = $this->getMock( - 'Magento\Framework\Data\Collection\Db\FetchStrategy\Query', array('fetchAll'), array(), '', false + 'Magento\Framework\Data\Collection\Db\FetchStrategy\Query', + array('fetchAll'), + array(), + '', + false ); $this->entityFactoryMock = $this->getMock( - 'Magento\Core\Model\EntityFactory', array('create'), array(), '', false + 'Magento\Core\Model\EntityFactory', + array('create'), + array(), + '', + false ); $this->loggerMock = $this->getMock('Magento\Framework\Logger', array('log'), array(), '', false); $this->resourceMock = $this->getMock( - 'Magento\Framework\App\Resource', array('getConnection', 'getTableName'), array(), '', false + 'Magento\Framework\App\Resource', + array('getConnection', 'getTableName'), + array(), + '', + false ); $this->adapterMock = $this->getMock( - 'Zend_Db_Adapter_Pdo_Mysql', array('select', 'query'), array(), '', false + 'Zend_Db_Adapter_Pdo_Mysql', + array('select', 'query'), + array(), + '', + false ); $this->selectMock = $this->getMock( - 'Magento\Framework\DB\Select', array('from'), array('adapter' => $this->adapterMock) + 'Magento\Framework\DB\Select', + array('from'), + array('adapter' => $this->adapterMock) ); $this->adapterMock->expects($this->once()) ->method('select') @@ -143,4 +161,4 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $this->collection->load(); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/_files/pdf_merged.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/_files/pdf_merged.php index a1b63e01382..9a4106927a9 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/_files/pdf_merged.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/_files/pdf_merged.php @@ -64,4 +64,3 @@ return array( ), ), ); - diff --git a/lib/Magento/Framework/App/RequestFactory.php b/lib/Magento/Framework/App/RequestFactory.php index e7ddffa672b..40e8c491186 100644 --- a/lib/Magento/Framework/App/RequestFactory.php +++ b/lib/Magento/Framework/App/RequestFactory.php @@ -30,14 +30,14 @@ class RequestFactory /** * @var \Magento\Framework\ObjectManager */ - protected $_objectManager; + protected $objectManager; /** * @param \Magento\Framework\ObjectManager $objectManager */ public function __construct(\Magento\Framework\ObjectManager $objectManager) { - $this->_objectManager = $objectManager; + $this->objectManager = $objectManager; } /** @@ -48,6 +48,6 @@ class RequestFactory */ public function create(array $arguments = array()) { - return $this->_objectManager->create('Magento\Framework\App\RequestInterface', $arguments); + return $this->objectManager->create('Magento\Framework\App\RequestInterface', $arguments); } } diff --git a/lib/Magento/Framework/App/RouterList.php b/lib/Magento/Framework/App/RouterList.php index fd16ee2150d..f4d47688bb9 100644 --- a/lib/Magento/Framework/App/RouterList.php +++ b/lib/Magento/Framework/App/RouterList.php @@ -31,14 +31,14 @@ class RouterList implements RouterListInterface /** * @var \Magento\Framework\ObjectManager */ - protected $_objectManager; + protected $objectManager; /** * List of routers * * @var array */ - protected $_routerList; + protected $routerList; /** * @param \Magento\Framework\ObjectManager $objectManager @@ -46,15 +46,15 @@ class RouterList implements RouterListInterface */ public function __construct(\Magento\Framework\ObjectManager $objectManager, array $routerList) { - $this->_objectManager = $objectManager; - $this->_routerList = $routerList; - $this->_routerList = array_filter( + $this->objectManager = $objectManager; + $this->routerList = $routerList; + $this->routerList = array_filter( $routerList, function ($item) { return (!isset($item['disable']) || !$item['disable']) && $item['class']; } ); - uasort($this->_routerList, array($this, '_compareRoutersSortOrder')); + uasort($this->routerList, array($this, 'compareRoutersSortOrder')); } /** @@ -63,14 +63,14 @@ class RouterList implements RouterListInterface * @param string $routerId * @return RouterInterface */ - protected function _getRouterInstance($routerId) + protected function getRouterInstance($routerId) { - if (!isset($this->_routerList[$routerId]['object'])) { - $this->_routerList[$routerId]['object'] = $this->_objectManager->create( - $this->_routerList[$routerId]['class'] + if (!isset($this->routerList[$routerId]['object'])) { + $this->routerList[$routerId]['object'] = $this->objectManager->create( + $this->routerList[$routerId]['class'] ); } - return $this->_routerList[$routerId]['object']; + return $this->routerList[$routerId]['object']; } /** @@ -81,7 +81,7 @@ class RouterList implements RouterListInterface */ public function current() { - return $this->_getRouterInstance(key($this->_routerList)); + return $this->getRouterInstance($this->key()); } /** @@ -92,18 +92,18 @@ class RouterList implements RouterListInterface */ public function next() { - next($this->_routerList); + next($this->routerList); } /** * (PHP 5 >= 5.0.0)<br/> * Return the key of the current element * @link http://php.net/manual/en/iterator.key.php - * @return void + * @return string|int|null */ public function key() { - return key($this->_routerList); + return key($this->routerList); } /** @@ -115,7 +115,7 @@ class RouterList implements RouterListInterface */ public function valid() { - return !!current($this->_routerList); + return !!current($this->routerList); } /** @@ -126,7 +126,7 @@ class RouterList implements RouterListInterface */ public function rewind() { - reset($this->_routerList); + reset($this->routerList); } /** @@ -136,7 +136,7 @@ class RouterList implements RouterListInterface * @param array $routerDataSecond * @return int */ - protected function _compareRoutersSortOrder($routerDataFirst, $routerDataSecond) + protected function compareRoutersSortOrder($routerDataFirst, $routerDataSecond) { if ((int)$routerDataFirst['sortOrder'] == (int)$routerDataSecond['sortOrder']) { return 0; diff --git a/lib/Magento/Framework/AppInterface.php b/lib/Magento/Framework/AppInterface.php index 43811fb2da2..0f3b4661142 100644 --- a/lib/Magento/Framework/AppInterface.php +++ b/lib/Magento/Framework/AppInterface.php @@ -35,7 +35,7 @@ interface AppInterface /** * Magento version */ - const VERSION = '2.0.0.0-dev77'; + const VERSION = '2.0.0.0-dev78'; /** * Launch application -- GitLab